83 lines
1.8 KiB
C#
83 lines
1.8 KiB
C#
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 ChangeBoxCache
|
|
{
|
|
private static object lockcgobj = new object();
|
|
public static List<ChangeBoxModel> CgBoxList = new List<ChangeBoxModel>();//
|
|
|
|
#region 获取计划任务列表
|
|
public List<ChangeBoxModel> GetBoxList()
|
|
{
|
|
|
|
return CgBoxList;
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
#region 初始化任务列表
|
|
public void ClearBoxList()
|
|
{
|
|
foreach (var planitem in CgBoxList.ToArray())
|
|
{
|
|
CgBoxList.Remove(planitem);
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region Job缓存处理方法
|
|
/// <summary>
|
|
/// Job缓存处理方法
|
|
/// </summary>
|
|
/// <param name="JobParam"></param>
|
|
/// <param name="ECommend"></param>
|
|
/// <returns></returns>
|
|
public bool UpdateBoxList(List<ChangeBoxModel> JobParam, EChangeboxCommend CommendType)
|
|
{
|
|
|
|
lock (lockcgobj)
|
|
{
|
|
|
|
if (CommendType.Equals(EChangeboxCommend.Create))
|
|
{
|
|
CgBoxList.AddRange(JobParam);
|
|
}
|
|
|
|
else if (CommendType.Equals(EChangeboxCommend.Execute))
|
|
{
|
|
JobParam.ForEach(m => CgBoxList.Remove(m));
|
|
}
|
|
|
|
|
|
return true;
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
public enum EChangeboxCommend
|
|
{
|
|
/// <summary>
|
|
/// 接收扫描任务
|
|
/// </summary>
|
|
[Description("接收扫描任务")]
|
|
Create,
|
|
/// <summary>
|
|
/// 任务处理
|
|
/// </summary>
|
|
[Description("任务处理")]
|
|
Execute
|
|
}
|
|
}
|