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 CgBoxList = new List();// #region 获取计划任务列表 public List GetBoxList() { return CgBoxList; } #endregion #region 初始化任务列表 public void ClearBoxList() { foreach (var planitem in CgBoxList.ToArray()) { CgBoxList.Remove(planitem); } } #endregion #region Job缓存处理方法 /// /// Job缓存处理方法 /// /// /// /// public bool UpdateBoxList(List 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 { /// /// 接收扫描任务 /// [Description("接收扫描任务")] Create, /// /// 任务处理 /// [Description("任务处理")] Execute } }