Merge branch 'master' of https://gitee.com/doan-tech/zhuangpei-mesbackend
This commit is contained in:
commit
fc5eae5e57
@ -148,8 +148,11 @@ namespace ZR.Service.MES.dev
|
||||
List<DeviceRouteInspectionPlan> deviceRouteInspectionPlan_execute_List = new List<DeviceRouteInspectionPlan>();
|
||||
#region 1.1 每日类型处理
|
||||
|
||||
List<DeviceRouteInspectionPlan> RouteInspectionPlan_day_List = Context.Queryable<DeviceRouteInspectionPlan>().Where(it => it.Type == 1)
|
||||
List<DeviceRouteInspectionPlan> RouteInspectionPlan_day_List = Context.Queryable<DeviceRouteInspectionPlan>()
|
||||
.Where(it => it.ExcuteCycleType == 1)
|
||||
.Where(it => it.Status == 1).ToList();
|
||||
|
||||
Console.WriteLine("每日类型处理" + RouteInspectionPlan_day_List.Count);
|
||||
if (RouteInspectionPlan_day_List != null && RouteInspectionPlan_day_List.Count > 0)
|
||||
{
|
||||
foreach (var item in RouteInspectionPlan_day_List)
|
||||
@ -183,8 +186,9 @@ namespace ZR.Service.MES.dev
|
||||
#region 1.2 每周类型处理
|
||||
|
||||
|
||||
List<DeviceRouteInspectionPlan> DeviceRouteInspectionPlan_week_list = Context.Queryable<DeviceRouteInspectionPlan>().Where(it => it.Type == 2).Where(it => it.Status == 1).ToList();
|
||||
List<DeviceRouteInspectionPlan> DeviceRouteInspectionPlan_week_list = Context.Queryable<DeviceRouteInspectionPlan>().Where(it => it.ExcuteCycleType == 2).Where(it => it.Status == 1).ToList();
|
||||
|
||||
Console.WriteLine("每周类型处理" + DeviceRouteInspectionPlan_week_list.Count);
|
||||
int dayofweek = (int)CurrentTime.DayOfWeek;
|
||||
if (CurrentTime.DayOfWeek == DayOfWeek.Sunday)
|
||||
{
|
||||
@ -193,19 +197,33 @@ namespace ZR.Service.MES.dev
|
||||
}
|
||||
if (DeviceRouteInspectionPlan_week_list != null && DeviceRouteInspectionPlan_week_list.Count > 0)
|
||||
{
|
||||
foreach (var item in RouteInspectionPlan_day_List)
|
||||
foreach (var item in DeviceRouteInspectionPlan_week_list)
|
||||
{
|
||||
string[] cycle_period = item.WeekList.Split(",");
|
||||
for (int i = 0; i < cycle_period.Length; i++)
|
||||
if (cycle_period.Length > 0)
|
||||
{
|
||||
|
||||
|
||||
if (dayofweek == Convert.ToInt32(cycle_period[i]))
|
||||
for (int i = 0; i < cycle_period.Length; i++)
|
||||
{
|
||||
deviceRouteInspectionPlan_execute_List.Add((DeviceRouteInspectionPlan)item); break;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Console.WriteLine("cycle_period[i]="+cycle_period[i]);
|
||||
if (dayofweek == Convert.ToInt32(cycle_period[i]))
|
||||
{
|
||||
deviceRouteInspectionPlan_execute_List.Add((DeviceRouteInspectionPlan)item); break;
|
||||
}
|
||||
}
|
||||
catch (FormatException ex)
|
||||
{
|
||||
Console.WriteLine("An error occurred: " + ex.Message);
|
||||
continue;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -214,19 +232,30 @@ namespace ZR.Service.MES.dev
|
||||
|
||||
#region 1.3 每月类型处理
|
||||
|
||||
List<DeviceRouteInspectionPlan> DeviceRouteInspectionPlan_month_list = Context.Queryable<DeviceRouteInspectionPlan>().Where(it => it.Type == 3).Where(it => it.Status == 1).ToList();
|
||||
|
||||
List<DeviceRouteInspectionPlan> DeviceRouteInspectionPlan_month_list = Context.Queryable<DeviceRouteInspectionPlan>().Where(it => it.ExcuteCycleType == 3).Where(it => it.Status == 1).ToList();
|
||||
|
||||
Console.WriteLine("每月类型处理" + DeviceRouteInspectionPlan_month_list.Count);
|
||||
if (DeviceRouteInspectionPlan_week_list != null && DeviceRouteInspectionPlan_week_list.Count > 0)
|
||||
{
|
||||
foreach (var item in RouteInspectionPlan_day_List)
|
||||
foreach (var item in DeviceRouteInspectionPlan_week_list)
|
||||
{
|
||||
string[] cycle_period = item.WeekList.Split(",");
|
||||
for (int i = 0; i < cycle_period.Length; i++)
|
||||
{
|
||||
if (CurrentTime.Day == Convert.ToInt32(cycle_period[i]))
|
||||
|
||||
try
|
||||
{
|
||||
deviceRouteInspectionPlan_execute_List.Add((DeviceRouteInspectionPlan)item); break;
|
||||
if (CurrentTime.Day == Convert.ToInt32(cycle_period[i]))
|
||||
{
|
||||
deviceRouteInspectionPlan_execute_List.Add((DeviceRouteInspectionPlan)item); break;
|
||||
}
|
||||
}
|
||||
catch (FormatException ex)
|
||||
{
|
||||
Console.WriteLine("An error occurred: " + ex.Message);
|
||||
continue;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -240,23 +269,29 @@ namespace ZR.Service.MES.dev
|
||||
|
||||
// 插入数据库
|
||||
List<DeviceTaskExecute> executes = new List<DeviceTaskExecute>();
|
||||
foreach (var item in deviceRouteInspectionPlan_execute_List)
|
||||
{
|
||||
DeviceTaskExecute taskExecute = new DeviceTaskExecute();
|
||||
taskExecute.TaskName = item.Name;
|
||||
taskExecute.TaskName = item.Id;
|
||||
taskExecute.Type = 1;
|
||||
taskExecute.DistributedTime = DateTime.Now;
|
||||
taskExecute.Status = 0;
|
||||
taskExecute.CreatedTime = DateTime.Now;
|
||||
executes.Add(taskExecute);
|
||||
}
|
||||
if (deviceRouteInspectionPlan_execute_List.Count > 0) {
|
||||
foreach (var item in deviceRouteInspectionPlan_execute_List)
|
||||
{
|
||||
|
||||
if (executes.Count > 0)
|
||||
{
|
||||
DeviceTaskExecute taskExecute = new DeviceTaskExecute();
|
||||
taskExecute.Id = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
taskExecute.TaskName = item.Name;
|
||||
taskExecute.TaskId = item.Id;
|
||||
taskExecute.Type = 1;
|
||||
taskExecute.DistributedTime = DateTime.Now;
|
||||
taskExecute.Status = 0;
|
||||
taskExecute.CreatedTime = DateTime.Now;
|
||||
executes.Add(taskExecute);
|
||||
}
|
||||
|
||||
if (executes.Count > 0)
|
||||
{
|
||||
|
||||
result = Context.Insertable(executes).ExecuteCommand();
|
||||
}
|
||||
|
||||
result = Context.Insertable(executes).ExecuteCommand();
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
|
||||
@ -274,6 +309,7 @@ namespace ZR.Service.MES.dev
|
||||
DevicePointInspectionPlan point = Context.Queryable<DevicePointInspectionPlan>().Where(it => it.Id == id).First();
|
||||
|
||||
DeviceTaskExecute taskExecute = new DeviceTaskExecute();
|
||||
taskExecute.Id= SnowFlakeSingle.Instance.NextId().ToString();
|
||||
taskExecute.TaskName = point.Name;
|
||||
taskExecute.TaskId = point.Id;
|
||||
taskExecute.Type = 2;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user