From 01a24397d01fa1cf6c12876ae05609c5a198be96 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期六, 18 十月 2025 17:34:21 +0800
Subject: [PATCH] 判断是否全部完工,若是则写入实际完工日期

---
 Services/MesInvItemBarcodesManager.cs |   30 +++++++++++++++++++++++++-----
 1 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/Services/MesInvItemBarcodesManager.cs b/Services/MesInvItemBarcodesManager.cs
index 6b5e122..032a0c2 100644
--- a/Services/MesInvItemBarcodesManager.cs
+++ b/Services/MesInvItemBarcodesManager.cs
@@ -290,6 +290,8 @@
 
         if (womdaa == null) throw new Exception("宸ュ崟鍗曞彿涓嶅瓨鍦�");
 
+        var okQty = query.currentCjNum - query.initCjNum - query.bf;//鑹搧鏁伴噺
+
         // 鍒涘缓鎶ュ伐璁板綍
         var mesReporting = new MesReporting
         {
@@ -301,13 +303,31 @@
             AddressCode = womdaa.AddressCode,
             MachineNo = womdaa.MachineNo,
             BfQty = query.bf,//涓嶈壇鏁伴噺
-            OkQty = query.currentCjNum - query.initCjNum - query.bf,//鑹搧鏁伴噺
+            OkQty = okQty,//鑹搧鏁伴噺
             CsQty = query.initCjNum,//鍒濆閲囬泦鏁�
-            JtQty = query.currentCjNum,//鎶ュ伐鏃堕噰闆嗘暟
+            CjQty = query.currentCjNum,//鎶ュ伐鏃堕噰闆嗘暟
             ItemNo = womdaa.Daa002,
             BillNo = womdaa.Daa001,
             BgPerson = query.staffNo // 鏂板锛氭姤宸ヤ汉缂栧彿
         };
+
+        // 鏇存柊宸ュ崟Daa011涓哄師鍊煎姞涓婃湰娆¤壇鍝佹暟閲�
+        Db.Updateable<Womdaa>()
+            .SetColumns(x => x.Daa011 == (womdaa.Daa011 ?? 0) + (okQty ?? 0))
+            .Where(x => x.Daa001 == womdaa.Daa001)
+            .ExecuteCommand();
+
+        // 鍒ゆ柇鏄惁鍏ㄩ儴瀹屽伐锛岃嫢鏄垯鍐欏叆瀹為檯瀹屽伐鏃ユ湡
+        var womdaaAfter = Db.Queryable<Womdaa>()
+            .Where(s => s.Daa001 == query.orderNo)
+            .First();
+        if (womdaaAfter != null && womdaaAfter.Daa011 >= womdaaAfter.Daa008)
+        {
+            Db.Updateable<Womdaa>()
+                .SetColumns(x => x.Daa017 == DateTime.Now)
+                .Where(x => x.Daa001 == womdaaAfter.Daa001)
+                .ExecuteCommand();
+        }
 
         // 鎻掑叆鎶ュ伐璁板綍鍜屾潯鐮佽褰�
         return Db.Insertable(mesReporting)
@@ -364,12 +384,12 @@
 
         // 鏇存柊鎶ュ伐璁板綍
         Db.Updateable<MesReporting>()
-            .SetColumns(a => a.BlQty == BlQty.ToString())
+            .SetColumns(a => a.BlQty == BlQty)
             .SetColumns(a => a.CsQty == (anchors.InitialValue ?? 0))
             .SetColumns(a => a.JtQty == jt)
             // .SetColumns(a => a.BfQty == bfQty)
-            .SetColumns(a => a.CjQty == ljcj.ToString())
-            .SetColumns(a => a.DyQty == DyQty.ToString())
+            .SetColumns(a => a.CjQty == ljcj)
+            .SetColumns(a => a.DyQty == DyQty)
             .Where(a => a.ItemNoCade == mesReporting.ItemNoCade)
             .ExecuteCommand();
     }

--
Gitblit v1.9.3