From 1b8d10dbb20b513be61556021f8f471e506d92c3 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期二, 08 十月 2024 09:48:57 +0800
Subject: [PATCH] 1

---
 MES.Service/service/QC/RKJService.cs |   31 +++++++++++++++++++++++++++----
 1 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/MES.Service/service/QC/RKJService.cs b/MES.Service/service/QC/RKJService.cs
index ccbfbe3..00b78f9 100644
--- a/MES.Service/service/QC/RKJService.cs
+++ b/MES.Service/service/QC/RKJService.cs
@@ -483,6 +483,10 @@
 
         var barCodes = mesInvItemInsList.Select(s => s.ItemBarcode).ToList();
 
+        var count = db.Queryable<MesInvItemBarcodes>()
+            .Where(s => barCodes.Contains(s.ItemBarcode) && s.WorkFlg == 0)
+            .Count();
+
         var gxId = mesInvItemInsList.Select(s => s.MesScgdGxId).ToList();
 
         var sumQty = mesInvItemInsList.Sum(s => s.Quantity);
@@ -494,6 +498,23 @@
                 .SetColumns(s => s.CheckFlag == "鈭�")
                 .Where(s => gxId.Contains(s.Id))
                 .ExecuteCommand();
+
+            if (count <= 0) return;
+            
+            //鍙栨秷mes_inv_item_barcodes 鐨勬姤宸ユ爣璇� WORK_FLG 浣跨敤鏉$爜
+            var executeCommand = db.Updateable<MesInvItemBarcodes>()
+                .SetColumns(a => a.WorkFlg == 1)
+                .Where(a => barCodes.Contains(a.ItemBarcode))
+                .ExecuteCommand();
+
+            if (executeCommand > 0)
+            {
+                //womdaa 宸茬敓浜ч噺 DAA011鍔犲洖鏉$爜鎶ュ伐鏁伴噺
+                db.Updateable<Womdaa>()
+                    .SetColumns(b => b.Daa011 == b.Daa011 + sumQty)
+                    .Where(b => b.Daa001 == qsItemOqcReq.Daa001)
+                    .ExecuteCommand();
+            }
         }
         else if ("涓嶅悎鏍�".Equals(FcheckResu))
         {
@@ -608,6 +629,7 @@
             .Select((a, b, c, ca, m, da, z) => new QsItemOqcReq
             {
                 BillNo = a.BillNo,
+                Fsubmit = a.Fsubmit,
                 Remarks = a.Remarks,
                 Id = a.Id,
                 CreateDate = a.CreateDate,
@@ -825,12 +847,13 @@
     private bool isRk(int? gid)
     {
         var db = SqlSugarHelper.GetInstance();
-        return db.Queryable<QsItemOqcReq, MesInvItemIns, MesInvItemInCDetails>(
-                (a, b, c) => new JoinQueryInfos(
+        return db.Queryable<QsItemOqcReq, MesInvItemIns, MesInvItemInCDetails2,MesInvItemStocks>(
+                (a, b, c,d) => new JoinQueryInfos(
                     JoinType.Inner, a.BillNo == b.BillNo,
-                    JoinType.Inner, b.Id == c.ItemInId
+                    JoinType.Inner, b.Id == c.ItemInId,
+                    JoinType.Inner,c.ItemBarcode == d.ItemBarcode
                 ))
-            .Where((a, b, c) => a.Id == gid)
+            .Where((a, b, c,d) => a.Id == gid)
             .Count() > 0;
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3