From 302054e253f1550ee64430882786ec9a3920ec92 Mon Sep 17 00:00:00 2001
From: sjz <1240968267@qq.com>
Date: 星期六, 19 七月 2025 08:33:44 +0800
Subject: [PATCH] 优化多组织代码

---
 MES.Service/service/QC/XJService.cs |   55 +++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/MES.Service/service/QC/XJService.cs b/MES.Service/service/QC/XJService.cs
index 3870859..145d6cc 100644
--- a/MES.Service/service/QC/XJService.cs
+++ b/MES.Service/service/QC/XJService.cs
@@ -47,7 +47,7 @@
         return db.Queryable<Womdaa>()
             .Where(a =>
                 a.Daa001 == daa001 &&
-                statusArray.Contains(a.Daa018))
+                a.Daa018 != "瀹屽伐")
             .ToList();
     }
 
@@ -58,10 +58,11 @@
         return db.Queryable<Womdaa, MesLine>((a, b) =>
                 new JoinQueryInfos(JoinType.Left, a.Daa015 == b.LineNo))
             .Where((a, b) => b.LineName != null &&
-                             statusArray.Contains(a.Daa018))
+                             a.Daa018 != "瀹屽伐")
             .GroupBy((a, b) => new
             {
-                b.LineNo, b.LineName
+                b.LineNo,
+                b.LineName
             })
             .Select((a, b) => new MesLine
             {
@@ -78,12 +79,13 @@
             .Where((a, b) =>
                 a.Daa015 == daa020 &&
                 b.ItemNo == item &&
-                statusArray.Contains(a.Daa018))
+                a.Daa018 != "瀹屽伐")
             .Select<Womdaa>(a => new Womdaa
             {
                 Id = a.Id,
                 Daa001 = a.Daa001,
-                Daa003 = a.Daa003
+                Daa003 = a.Daa003,
+                Daa008 = a.Daa008
             }).ToList();
     }
 
@@ -92,14 +94,16 @@
         var db = SqlSugarHelper.GetInstance();
         return db.Queryable<Womdaa, MesItems>((a, b) =>
                 new JoinQueryInfos(JoinType.Inner, a.Daa002 == b.Id.ToString()))
-            .Where((a, b) => statusArray.Contains(a.Daa018) &&
+            .Where((a, b) => a.Daa018 != "瀹屽伐" &&
                              a.Daa015 == lineNo)
             .OrderBy((a, b) => b.ItemName)
             .Select<MesItems>((a, b) =>
                 new MesItems
                 {
+                    ItemId = b.ItemId,
                     ItemNo = b.ItemNo,
-                    ItemName = b.ItemName
+                    ItemName = b.ItemName,
+                    ItemModel = b.ItemModel
                 }).ToList();
     }
 
@@ -120,7 +124,7 @@
                 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
                 )
             )
             .WhereIF(lineNo != null && lineNo.Length > 0,
@@ -134,20 +138,23 @@
                 !"鏈畬鎴�".Equals(queryObj.result),
                 (s, a, c, b) => s.FcheckResu != null)
             .WhereIF(id > 0, (s, a, c, b) => s.Id == id)
+            //.WhereIF(queryObj.Comments != null, (s, a, c, b) => s.Comments == queryObj.Comments)
             .Select((s, a, c, b) => 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
+                Remarks = s.Remarks,
+                Comments = s.Comments
             }).OrderBy(s => s.CreateDate, OrderByType.Desc)
             .ToPageList(queryObj.PageIndex, queryObj.Limit);
     }
@@ -157,16 +164,15 @@
     {
         var db = SqlSugarHelper.GetInstance();
 
-        var count = db.Queryable<MesQa>().Where(s => s.QsType == "2"
-            && s.ItemNo == itemNo && s.Fsubmit == 1).Count();
+        var count = db.Queryable<MesQa>().Where(s =>
+            s.QsType == "2" && s.ItemNo == itemNo && s.Fsubmit == 1).Count();
 
         if (count <= 0) return new List<QsQaItemXj01>();
 
         return db
             .Queryable<MesQualityStandard>()
-            .Where(b => b.QsType == "2"
-                        && b.ItemNo == itemNo).Select(
-                b => new QsQaItemXj01
+            .Where(b => b.QsType == "2" && b.ItemNo == itemNo).Select(b =>
+                new QsQaItemXj01
                 {
                     ProjName = b.ProjName,
                     ItemMod = b.ItemMod,
@@ -394,8 +400,8 @@
 
         if (count == passCount) result = 1;
 
-        var useTransactionWithOracle = SqlSugarHelper.UseTransactionWithOracle(
-            db =>
+        var useTransactionWithOracle =
+            SqlSugarHelper.UseTransactionWithOracle(db =>
             {
                 var commit = 0;
                 commit += db.Updateable<QsQaItemXj01>()
@@ -499,6 +505,19 @@
         });
     }
 
+
+    public int saveCommentGid(XJDto dto)
+    {
+        return SqlSugarHelper.UseTransactionWithOracle(db =>
+        {
+            return db.Updateable<QsQaItemXj>()
+                .SetColumns(it =>
+                    it.Comments == dto.Comments) //SetColumns鏄彲浠ュ彔鍔犵殑 鍐�2涓氨2涓瓧娈佃祴鍊�
+                .Where(it => it.Id == dto.gid)
+                .ExecuteCommand();
+        });
+    }
+
     //瀛愯〃淇敼澶囨敞瀛楁
     public int saveRemarksPid(XJDto dto)
     {

--
Gitblit v1.9.3