添加项目文件。
This commit is contained in:
106
Epost.DAL/Cache/JobDownCacheDAL.cs
Normal file
106
Epost.DAL/Cache/JobDownCacheDAL.cs
Normal file
@ -0,0 +1,106 @@
|
||||
using Epost.Common;
|
||||
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 JobDownCacheDAL
|
||||
{
|
||||
private static object lockobj = new object();
|
||||
public static List<ResultMessageModel> PlanJobDownList = new List<ResultMessageModel>();//
|
||||
|
||||
|
||||
#region 获取计划任务列表
|
||||
public List<ResultMessageModel> GetPlanJobDownList()
|
||||
{
|
||||
|
||||
return PlanJobDownList;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
#region 初始化任务列表
|
||||
public void ClearJobDownList()
|
||||
{
|
||||
foreach (var planitem in PlanJobDownList.ToArray())
|
||||
{
|
||||
PlanJobDownList.Remove(planitem);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region Job缓存处理方法
|
||||
/// <summary>
|
||||
/// Job缓存处理方法
|
||||
/// </summary>
|
||||
/// <param name="JobParam"></param>
|
||||
/// <param name="EdownCommend"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateJobDownModelList(List<ResultMessageModel> JobParam, EdownCommend CommendType)
|
||||
{
|
||||
|
||||
lock (lockobj)
|
||||
{
|
||||
|
||||
if (CommendType.Equals(EdownCommend.Create))
|
||||
{
|
||||
PlanJobDownList.AddRange(JobParam);
|
||||
}
|
||||
else if (CommendType.Equals(EdownCommend.Update))
|
||||
{
|
||||
JobParam.ForEach(m => m.Status="2");
|
||||
|
||||
}
|
||||
else if (CommendType.Equals(EdownCommend.Execute))
|
||||
{
|
||||
//JobParam.ForEach(m => PlanJobDownList.Remove(m));
|
||||
foreach (var planitem in JobParam.ToArray())
|
||||
{
|
||||
PlanJobDownList.Remove(planitem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
public enum EdownCommend
|
||||
{
|
||||
/// <summary>
|
||||
/// 接收扫描任务
|
||||
/// </summary>
|
||||
[Description("接收任务")]
|
||||
Create,
|
||||
|
||||
/// <summary>
|
||||
/// 任务处理
|
||||
/// </summary>
|
||||
[Description("任务处理")]
|
||||
Update,
|
||||
/// <summary>
|
||||
/// 任务完成
|
||||
/// </summary>
|
||||
[Description("任务完成")]
|
||||
Execute
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user