118 lines
2.7 KiB
C#
118 lines
2.7 KiB
C#
![]() |
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
|
|||
|
}
|
|||
|
}
|