From 54c83d07d8317692b73f3af84d8df504812c3275 Mon Sep 17 00:00:00 2001
From: zyf <1071160500@qq.com>
Date: 星期三, 23 四月 2025 17:57:04 +0800
Subject: [PATCH] 巡检检验项目查询新增工序条件

---
 MES.Service/service/QC/XJService.cs |   48 ++++++++++++++++++++++++++++++++++--------------
 1 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/MES.Service/service/QC/XJService.cs b/MES.Service/service/QC/XJService.cs
index ad76d93..6099c17 100644
--- a/MES.Service/service/QC/XJService.cs
+++ b/MES.Service/service/QC/XJService.cs
@@ -83,7 +83,8 @@
             {
                 Id = a.Id,
                 Daa001 = a.Daa001,
-                Daa003 = a.Daa003
+                Daa003 = a.Daa003,
+                Daa008 = a.Daa008
             }).ToList();
     }
 
@@ -98,8 +99,10 @@
             .Select<MesItems>((a, b) =>
                 new MesItems
                 {
+                    Id = b.Id,
                     ItemNo = b.ItemNo,
-                    ItemName = b.ItemName
+                    ItemName = b.ItemName,
+                    ItemModel = b.ItemModel
                 }).ToList();
     }
 
@@ -116,49 +119,66 @@
 
         return db
             .Queryable<QsQaItemXj, Womdaa, MesLine,
-                MesItems>((s, a, c, b) =>
+                MesItems,Womcaa, ExZzCaaFiled>((s, a, c, b,ca,zf) =>
                 new JoinQueryInfos(
                     JoinType.Inner, s.BillNo == a.Daa001,
                     JoinType.Left, a.Daa015 == c.LineNo,
-                    JoinType.Left, s.ItemNo == b.ItemNo
+                    JoinType.Left, s.ItemId == b.Id,
+                    JoinType.Left, a.Daa021 == ca.Caa020,
+                    JoinType.Left, ca.Erpid == zf.Erpid
                 )
             )
             .WhereIF(lineNo != null && lineNo.Length > 0,
-                (s, a, c, b) => lineNo.Contains(c.LineNo))
+                (s, a, c, b, ca, zf) => lineNo.Contains(c.LineNo))
             .WhereIF(
                 StringUtil.IsNotNullOrEmpty(queryObj.result) &&
                 "鏈畬鎴�".Equals(queryObj.result),
-                (s, a, c, b) => s.FcheckResu == null)
+                (s, a, c, b, ca, zf) => s.FcheckResu == null)
             .WhereIF(
                 StringUtil.IsNotNullOrEmpty(queryObj.result) &&
                 !"鏈畬鎴�".Equals(queryObj.result),
-                (s, a, c, b) => s.FcheckResu != null)
-            .WhereIF(id > 0, (s, a, c, b) => s.Id == id)
-            .Select((s, a, c, b) => new QsQaItemXj
+                (s, a, c, b, ca, zf) => s.FcheckResu != null)
+            .WhereIF(id > 0, (s, a, c, b, ca, zf) => s.Id == id)
+            //鍔犵瓫閫夋潯浠�,鏍规嵁渚涘簲鍟嗭紝鐗╂枡缂栫爜锛岀墿鏂欏悕绉版悳绱�
+            //.WhereIF(queryObj.SearchValue!=null && queryObj.SearchValue!="", (a) => a.SuppName == queryObj.SearchValue|| a.ItemName == queryObj.SearchValue || a.ItemNo == queryObj.SearchValue )
+            .WhereIF(queryObj.SearchValue != null && queryObj.SearchValue != "",
+            (s, a, c, b, ca, zf) => (b.ItemName.ToLower().Contains(queryObj.SearchValue.ToLower())
+            || b.ItemNo.ToLower().Contains(queryObj.SearchValue.ToLower())))
+            .Select((s, a, c, b, ca, zf) => new QsQaItemXj
             {
-                MoidNum = s.MoidNum,
                 Daa020 = c.LineNo,
                 Id = s.Id,
+                PlanQty = a.Daa008,
                 CreateBy = s.CreateBy,
                 CreateDate = s.CreateDate,
                 ReleaseNo = s.ReleaseNo,
                 ItemNo = s.ItemNo,
-                ItemUnit = s.ItemUnit,
                 BillNo = s.BillNo,
+                ItemName = b.ItemName,
+                ItemModel = b.ItemModel,
                 FcheckBy = s.FcheckBy,
                 FcheckResu = s.FcheckResu,
-                Remarks = s.Remarks,
+                Caa015 = ca.Caa015,
+                cust = a.Cust == null ? zf.Cust : a.Cust,
+                Remarks = s.Remarks
             }).OrderBy(s => s.CreateDate, OrderByType.Desc)
             .ToPageList(queryObj.PageIndex, queryObj.Limit);
     }
 
 
-    public List<QsQaItemXj01> setJYItem(string itemNo)
+    public List<QsQaItemXj01> setJYItem(string itemNo, string lineNo)
     {
         var db = SqlSugarHelper.GetInstance();
 
+        //鏍规嵁绾夸綋缂栧彿鑾峰彇宸ュ簭ID
+
+
+        decimal? procid = db.Queryable<MesLine>().Where(s => s.LineNo == lineNo).Select(s => s.ProcId).First();
+
+        if (procid == null) { procid = 99999999; };
+
         var count = db.Queryable<MesQa>().Where(s => s.QsType == "2"
-            && s.ItemNo == itemNo && s.Fsubmit == 1).Count();
+            && s.ItemNo == itemNo && s.Fsubmit == 1 && s.procid == procid).Count();
 
         if (count <= 0) return new List<QsQaItemXj01>();
 

--
Gitblit v1.9.3