This commit is contained in:
xiaowei.song
2024-06-20 11:52:05 +08:00
parent b5412117a7
commit 7e99683678
9 changed files with 71 additions and 46 deletions

View File

@@ -35,18 +35,20 @@ namespace ZR.Service.mes.ql
PLTest t3 = GetDefaultPLTest();
PLTest t4 = GetDefaultPLTest();
PLTest t5 = GetDefaultPLTest();
t1.Value01 = "15°"; t1.Value07 = "加浆"; t1.Value09 = "R1"; t1.Value14 = "底漆";
t2.Value01 = "25°"; t2.Value07 = "加浆"; t2.Value09 = "R2"; t2.Value14 = "漆";
t3.Value01 = "45°"; t3.Value07 = "加浆"; t3.Value09 = "R3"; t3.Value14 = "云母";
t4.Value01 = "75°"; t4.Value07 = "加浆"; t4.Value09 = "R4"; t4.Value14 = "清漆";
t5.Value01 = "110°"; t5.Value07 = "加浆"; t5.Value09 = "R5"; t5.Value14 = "总膜厚";
PLTest t6 = GetDefaultPLTest();
t1.Value01 = "15°"; t1.Value07 = "0"; t1.Value09 = "R1"; t1.Value14 = "漆";
t2.Value01 = "25°"; t2.Value07 = "0"; t2.Value09 = "R2"; t2.Value14 = "色漆";
t3.Value01 = "45°"; t3.Value07 = "0"; t3.Value09 = "R3"; t3.Value14 = "云母";
t4.Value01 = "75°"; t4.Value07 = "0"; t4.Value09 = "R4"; t4.Value14 = "清漆";
t5.Value01 = "110°"; t5.Value07 = "0"; t5.Value09 = "R5"; t5.Value14 = "总膜厚";
t6.Value01 = ""; t6.Value07 = "0"; t6.Value09 = "R6"; t6.Value14 = "";
t2.IdGroup = t1.IdGroup;
t3.IdGroup = t1.IdGroup;
t4.IdGroup = t1.IdGroup;
t5.IdGroup = t1.IdGroup;
t6.IdGroup = t1.IdGroup;
List<PLTest> lst = new List<PLTest>();
lst.Add(t1); lst.Add(t2); lst.Add(t3); lst.Add(t4); lst.Add(t5);
lst.Add(t1); lst.Add(t2); lst.Add(t3); lst.Add(t4); lst.Add(t5); lst.Add(t6);
int ret = Context.Insertable<PLTest>(lst).ExecuteReturnIdentity();
@@ -73,11 +75,21 @@ namespace ZR.Service.mes.ql
/// <param name="pageSize"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public (List<PLTest>, int) GetPLTestTable(DateTime starttime, DateTime endTime, int pageNum, int pageSize)
public (List<PLTest>, int) GetPLTestTable(DateTime starttime, DateTime endTime, string code,int pageNum, int pageSize)
{
starttime = starttime.ToLocalTime();
endTime = endTime.ToLocalTime();
int totalNum = 0;
var predicate = Expressionable.Create<PLTest>()
.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(!string.IsNullOrEmpty(code), it => it.Code.Contains(code))
.ToExpression();
//int totalNum = 0;
List<PLTest> data = Context.Queryable<PLTest>()
.Where(it => it.CreatedTime > starttime.ToLocalTime() && it.CreatedTime <= endTime.ToLocalTime())
.Where(predicate)
.OrderByDescending(it => it.IdGroup)
.OrderBy(it => it.Id)
.ToPageList(pageNum, pageSize, ref totalNum);
return (data, totalNum);