From 8f25fecab6e6a79096b9940ab3432401b9045b39 Mon Sep 17 00:00:00 2001
From: cnf <3200815559@qq.com>
Date: 星期四, 10 七月 2025 18:00:14 +0800
Subject: [PATCH] 首检\巡检\入库检适配

---
 MES.Service/service/QC/RKJService.cs |   88 ++++++++++++++++++++++++-------------------
 1 files changed, 49 insertions(+), 39 deletions(-)

diff --git a/MES.Service/service/QC/RKJService.cs b/MES.Service/service/QC/RKJService.cs
index aeca6d4..bdcaa01 100644
--- a/MES.Service/service/QC/RKJService.cs
+++ b/MES.Service/service/QC/RKJService.cs
@@ -54,13 +54,14 @@
 
 
     //鑾峰彇宸ュ崟鍙�
-    public List<RKJDaa001> GetDaa001s(string lineNo)
+    public List<RkDaa002> GetDaa001s(string lineNo)
     {
         var db = SqlSugarHelper.GetInstance();
-        return db.Queryable<RKJDaa001>()
-            .Where(t => t.LineNo == lineNo)
-            .OrderBy(t => t.BillNo, OrderByType.Desc)
-            .ToList();
+        // return db.Queryable<RKJDaa001>()
+        //     .Where(t => t.LineNo == lineNo)
+        //     .OrderBy(t => t.BillNo, OrderByType.Desc)
+        //     .ToList();
+        return null;
     }
 
     //鏍规嵁妫�楠屾爣鍑嗘潵璁$畻妫�楠屼釜鏁�
@@ -453,52 +454,61 @@
     }
 
 
-    public List<QsItemOqcReq> getPage(XJPageResult queryObj)
+    public (List<QsItemOqcReq> items, int TotalCount) GetPage(XJPageResult queryObj)
     {
         var db = SqlSugarHelper.GetInstance();
+        var totalCount = 0;
 
-        var id = Convert.ToDecimal(queryObj.id);
-
-        string[]? lineNo = null;
-
-        if (StringUtil.IsNotNullOrEmpty(queryObj.createUser))
+        // 鑾峰彇鐢ㄦ埛鍏宠仈鐨勭嚎浣撶紪鍙�
+        string[] lineNo = null;
+        if (!string.IsNullOrEmpty(queryObj.createUser))
+        {
             lineNo = _baseService.getUserLineNo(queryObj.createUser);
+        }
 
-        return db.Queryable<QsItemOqcReq, RKJDaa001>((a, b) =>
-                new JoinQueryInfos(JoinType.Left, a.BillNo == b.BillNo))
-            .WhereIF(lineNo != null && lineNo.Length > 0,
-                (a, b) => lineNo.Contains(b.LineNo))
-            .WhereIF(
-                StringUtil.IsNotNullOrEmpty(queryObj.result) &&
-                "鏈畬鎴�".Equals(queryObj.result),
-                (a, b) => a.FcheckResu == null)
-            .WhereIF(
-                StringUtil.IsNotNullOrEmpty(queryObj.result) &&
-                !"鏈畬鎴�".Equals(queryObj.result),
-                (a, b) => a.FcheckResu != null)
-            .WhereIF(id > 0, (a, b) => a.Id == id)
-            .Select((a, b) => new QsItemOqcReq
+        var query = db.Queryable<QsItemOqcReq, MesItems, Womdaa>((a, b, da) =>
+            new JoinQueryInfos(
+                JoinType.Left, a.ItemNo == b.ItemNo,       // 鍏宠仈鐗╂枡淇℃伅
+                JoinType.Left, a.BillNo == da.Daa001        // 鍏宠仈宸ュ崟淇℃伅
+            ))
+            // 鐢ㄦ埛绾夸綋杩囨护鏉′欢
+            //.WhereIF(lineNo != null && lineNo.Length > 0 && !"PL017".Equals(queryObj.createUser),
+            //    (a, b, da) => lineNo.Contains(da.Daa015))
+            // ID绮剧‘鏌ヨ
+            .WhereIF(!string.IsNullOrEmpty(queryObj.id),
+                (a, b, da) => a.Id.ToString() == queryObj.id)
+            // 瀹屾垚鐘舵�佽繃婊�
+            .WhereIF("鏈畬鎴�".Equals(queryObj.result), (a, b, da) => a.FcheckResu == null)
+            .WhereIF(!"鏈畬鎴�".Equals(queryObj.result), (a, b, da) => a.FcheckResu != null)
+            // 鎼滅储鏉′欢锛堢墿鏂欏悕绉�/缂栧彿锛�
+            .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue),
+                (a, b, da) => b.ItemName.ToLower().Contains(queryObj.SearchValue.ToLower()) ||
+                              a.ItemNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
+            // 鏌ヨ瀛楁
+            .Select((a, b, da) => new QsItemOqcReq
             {
                 Id = a.Id,
-                ReleaseNo = a.ReleaseNo,
                 BillNo = a.BillNo,
-                LineName = b.LineNo,
-                Quantity = b.Quantity,
-                CreateBy = a.CreateBy,
-                CreateDate = a.CreateDate,
                 ItemNo = a.ItemNo,
-                Mocode = b.Mocode,
-                BoardModel = b.BoardModel,
-                TaskNo = b.TaskNo,
+                ItemName = b.ItemName,
+                ItemModel = b.ItemModel,
+                CreateDate = a.CreateDate,
+                CreateBy = a.CreateBy,
                 FcheckResu = a.FcheckResu,
                 FcheckBy = a.FcheckBy,
                 FcheckDate = a.FcheckDate,
-                MoidNum = a.MoidNum,
-                BoardName = b.BoardName,
-                ColorName = b.ColorName,
-                Remarks = a.Remarks
-            }).OrderBy(a => a.CreateDate, OrderByType.Desc)
-            .ToPageList(queryObj.PageIndex, queryObj.Limit);
+                ReleaseNo = a.ReleaseNo,
+                Remarks = a.Remarks,
+                Daa015 = da.Daa015,  // 宸ュ崟绾夸綋
+                Fsubmit = a.Fsubmit
+            })
+            // 鎺掑簭
+            .OrderBy(a => a.CreateDate, OrderByType.Desc);
+
+        // 鍒嗛〉鏌ヨ
+        var result = query.ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount);
+
+        return (result, totalCount);
     }
 
     //鍒犻櫎涓昏〃骞朵笖杩炵骇鍒犻櫎瀛愯〃鍜屽瓩琛�

--
Gitblit v1.9.3