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 BoxCodeCacheDAL { private static object lockboxobj = new object(); public static List BoxList = new List();// #region 获取计划任务列表 public List GetBoxList() { return BoxList; } #endregion #region 初始化任务列表 public void ClearBoxList() { foreach (var planitem in BoxList.ToArray()) { BoxList.Remove(planitem); } } #endregion #region Job缓存处理方法 /// /// Job缓存处理方法 /// /// /// /// public bool UpdateBoxList(List JobParam, EboxCommend CommendType) { lock (lockboxobj) { if (CommendType.Equals(EboxCommend.Create)) { BoxList.AddRange(JobParam); } else if (CommendType.Equals(EboxCommend.Execute)) { // JobParam.ForEach(m => BoxList.Remove(m)); List list= BoxList.FindAll(p=>p.Block== JobParam.FirstOrDefault().Block); foreach (BoxModel item in list) { BoxList.Remove(item); } } return true; } } #endregion } public enum EboxCommend { /// /// 接收扫描任务 /// [Description("接收扫描任务")] Create, /// /// 任务处理 /// [Description("任务处理")] Execute } }