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