油漆实验室,批量变动,定时任务变动

This commit is contained in:
2025-03-19 13:13:40 +08:00
parent 0e4d7e11d2
commit 9b1c8b2b5a
9 changed files with 104 additions and 19 deletions

View File

@@ -1,6 +1,7 @@
using Infrastructure.Attribute;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Globalization;
using ZR.Model.MES.pro;
using ZR.Model.MES.ql;
@@ -73,14 +74,18 @@ namespace ZR.Service.mes.ql
.ToExpression();
List<ProWorkorder_v2> workOrderList = Context.Queryable<ProWorkorder_v2>()
.Where(predicate)
.OrderBy(it => it.Sort)
.OrderByDescending(it => it.Sort)
.ToList();
foreach(ProWorkorder_v2 workorder in workOrderList)
{
List<PLBatch> pLBatches = CreatePLBatchRecordsByWorkOrder(workorder);
int res = Context.Insertable<PLBatch>(pLBatches).ExecuteCommand();
if (res == 0)
{
Context.Ado.RollbackTran();
throw new Exception("插入批量检测记录异常,异常工单:" + workorder.ClientWorkorder);
}
}
Context.Ado.CommitTran();
return 1;
}
@@ -106,6 +111,40 @@ namespace ZR.Service.mes.ql
PLBatch t4 = GetDefaultPLBatch();
PLBatch t5 = GetDefaultPLBatch();
PLBatch t6 = GetDefaultPLBatch();
// 工单信息录入
t1.Dt = DateTime.Now.ToString("yyyy.MM.dd");
t1.Description = workorder.ProductDescription;
t1.Code = workorder.Colour;
t1.Workorder = workorder.ClientWorkorder;
t2.Dt = DateTime.Now.ToString("yyyy.MM.dd");
t2.Description = workorder.ProductDescription;
t2.Code = workorder.Colour;
t2.Workorder = workorder.ClientWorkorder;
t3.Dt = DateTime.Now.ToString("yyyy.MM.dd");
t3.Description = workorder.ProductDescription;
t3.Code = workorder.Colour;
t3.Workorder = workorder.ClientWorkorder;
t4.Dt = DateTime.Now.ToString("yyyy.MM.dd");
t4.Description = workorder.ProductDescription;
t4.Code = workorder.Colour;
t4.Workorder = workorder.ClientWorkorder;
t5.Dt = DateTime.Now.ToString("yyyy.MM.dd");
t5.Description = workorder.ProductDescription;
t5.Code = workorder.Colour;
t5.Workorder = workorder.ClientWorkorder;
t6.Dt = DateTime.Now.ToString("yyyy.MM.dd");
t6.Description = workorder.ProductDescription;
t6.Code = workorder.Colour;
t6.Workorder = workorder.ClientWorkorder;
t1.Value01 = "15°"; t1.Value07 = "0"; t1.Value09 = "R1"; t1.Value14 = "底漆"; t1.Value19 = "2";
t2.Value01 = "25°"; t2.Value07 = "0"; t2.Value09 = "R2"; t2.Value14 = "色漆"; t2.Value19 = "2";
t3.Value01 = "45°"; t3.Value07 = "0"; t3.Value09 = "R3"; t3.Value14 = "云母"; t3.Value19 = "2";
@@ -155,8 +194,8 @@ namespace ZR.Service.mes.ql
endTime = endTime.ToLocalTime();
int totalNum = 0;
var predicate = Expressionable.Create<PLBatch>()
.AndIF(starttime > new DateTime(2023, 1, 1, 0, 0, 0), it => it.CreatedTime >= starttime.ToLocalTime())
.AndIF(endTime > new DateTime(2023, 1, 1, 0, 0, 0), it => it.CreatedTime <= endTime.ToLocalTime())
.AndIF(starttime > new DateTime(2023, 1, 1, 0, 0, 0), it => it.CreatedTime >= starttime)
.AndIF(endTime > new DateTime(2023, 1, 1, 0, 0, 0), it => it.CreatedTime <= endTime)
.AndIF(!string.IsNullOrEmpty(code), it => it.Code.Contains(code))
.AndIF(!string.IsNullOrEmpty(description), it => it.Description.Contains(description))
.ToExpression();
@@ -187,6 +226,7 @@ namespace ZR.Service.mes.ql
{
Id = 0,
IdGroup = DateTime.Now.ToString("yyyyMMddHHmmssfff"),
Workorder = "",
Description = "",
Dt = "",
Code = "",
@@ -246,7 +286,7 @@ namespace ZR.Service.mes.ql
}
else
{
return (int)dayOfWeek + 1;
return (int)dayOfWeek;
}
}
}

View File

@@ -158,7 +158,8 @@ namespace ZR.Service.mes.ql
{
Key = it.Id,
Label = "[ " + it.Partnumber + " ] " + it.Description,
Value = it.Description
Value = it.Description,
Color = it.Color
}
)
.Take(10)