Files
T-DAS/Epost.DAL/Cache/ScanModelCacheDAL.cs

118 lines
2.7 KiB
C#
Raw Normal View History

2023-01-13 15:30:20 +08:00
using Epost.Common;
using Epost.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Epost.DAL.Cache
{
public class ScanModelCacheDAL
{
private static object lockobj = new object();
public static List<ScanModel> PlanScanList = new List<ScanModel>();//
#region
public List<ScanModel> GetPlanScanList()
{
return PlanScanList;
}
#endregion
#region
public void ClearScanList()
{
foreach (var planitem in PlanScanList.ToArray())
{
PlanScanList.Remove(planitem);
}
}
#endregion
#region Job缓存处理方法
/// <summary>
/// Job缓存处理方法
/// </summary>
/// <param name="JobParam"></param>
/// <param name="ECommend"></param>
/// <returns></returns>
public bool UpdateScanModelList(List<ScanModel> JobParam, ECommend CommendType)
{
lock (lockobj)
{
if (CommendType.Equals(ECommend.Create))
{
PlanScanList.AddRange(JobParam);
}
else if (CommendType.Equals(ECommend.Execute))
{
JobParam.ForEach(m => PlanScanList.Remove(m));
}
return true;
}
}
#endregion
//#region 员工号缓存处理方法
///// <summary>
///// Job缓存处理方法
///// </summary>
///// <param name="JobParam"></param>
///// <param name="ECommend"></param>
///// <returns></returns>
//public bool UpdateUserList(List<UserCodeModel> JobParam, ECommend CommendType)
//{
// lock (lockobj)
// {
// if (CommendType.Equals(ECommend.Create))
// {
// UserCodeList.AddRange(JobParam);
// }
// else if (CommendType.Equals(ECommend.Execute))
// {
// JobParam.ForEach(m => UserCodeList.Remove(m));
// UserCodeList.AddRange(JobParam);
// }
// return true;
// }
//}
//#endregion
}
public enum ECommend
{
/// <summary>
/// 接收扫描任务
/// </summary>
[Description("接收扫描任务")]
Create,
/// <summary>
/// 任务处理
/// </summary>
[Description("任务处理")]
Execute
}
}