添加项目文件。
This commit is contained in:
94
Epost.DAL/Cache/BoxCodeCacheDAL.cs
Normal file
94
Epost.DAL/Cache/BoxCodeCacheDAL.cs
Normal file
@ -0,0 +1,94 @@
|
||||
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
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user