From b2853f8e10d8fd9d0318190eb8e6253f738a7420 Mon Sep 17 00:00:00 2001
From: wbc <2597324127@qq.com>
Date: 星期三, 16 七月 2025 19:24:02 +0800
Subject: [PATCH] 工单变更

---
 StandardPda/MES.Service/service/WomcaaManager.cs |   37 +++++++++++++++++++++++++++----------
 1 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/StandardPda/MES.Service/service/WomcaaManager.cs b/StandardPda/MES.Service/service/WomcaaManager.cs
index 3f38115..8ef9312 100644
--- a/StandardPda/MES.Service/service/WomcaaManager.cs
+++ b/StandardPda/MES.Service/service/WomcaaManager.cs
@@ -57,7 +57,30 @@
             .IgnoreColumnsNull()
             .ExecuteCommand() > 0;
 
-        if (orUpdate && baOrUpdate) return true;
+
+        if (orUpdate && baOrUpdate)
+        {
+            //瀹氫箟杈撳叆鍙傛暟
+            var inputParam1 = new SugarParameter("P_WORK_NO", mesWomcaa.Caa001);
+            // 瀹氫箟杈撳嚭鍙傛暟
+            var outParam1 = new SugarParameter("c_Result", null, true);
+            var outParam2 = new SugarParameter("C_MSG", null, true);
+            // 浣跨敤 SqlSugar 鎵ц瀛樺偍杩囩▼
+            Db.Ado.ExecuteCommand("BEGIN PRC_UPDATE_DAA(:P_WORK_NO,:c_Result,:C_MSG); END;", inputParam1, outParam1, outParam2);
+            // 鑾峰彇杈撳嚭鍙傛暟鐨勫��
+            int result = int.Parse((string)outParam1.Value);
+            string message = outParam2.Value == DBNull.Value ? string.Empty : (string)outParam2.Value;
+            if (result == 1)
+            {
+                //瀛樺偍杩囩▼澶辫触鍒欎簨鍔¤繘琛屽洖婊�
+                //db.Ado.RollbackTran();
+                throw new Exception(message);
+            }
+            // 鎻愪氦浜嬪姟
+            //db.Ado.CommitTran();
+            return true;
+        }
+
         throw new NotImplementedException("鏇存柊澶辫触");
     }
 
@@ -102,13 +125,7 @@
             Caa013 = dto.FBomId,
 
             CreateType = dto.FCreateType,
-            Caa018 = !string.IsNullOrEmpty(dto.PLAN_ID)
-                ? Convert.ToInt64(dto.PLAN_ID)
-                : null,
-            Caa019 = !string.IsNullOrEmpty(dto.PLAN_SEQ)
-                ? Convert.ToInt64(dto.PLAN_SEQ)
-                : null,
-            Caa020 = dto.PLAN_NUM,
+            Caa020 = dto.FBillNo,
             SrcBillType = dto.FSrcBillType,
             SrcBillNo = dto.FSrcBillNo,
             SrcBillentryseq = dto.FSrcBillEntrySeq,
@@ -118,7 +135,6 @@
             CloseType = dto.FCloseType,
             SrcSplitBillno = dto.FSrcSplitBillNo,
             Caa016 = dto.FDescription,
-            //BTBZ = dto.BTBZ,  
             PrdOrg = dto.FPrdOrgId,
             TrustOrg = dto.FEnTrustOrgId,
             Bomtype = dto.FBOMType,
@@ -140,7 +156,8 @@
             Totalrcvqty = dto.FTotalRcvQty,
             Totalreworkingqty = dto.FTotalReworkingQty,
             Reasonforrework = dto.FReasonForRework,
-            Isforcewholeset = dto.FIsForceWholeSet, 
+            Isforcewholeset = dto.FIsForceWholeSet,
+            PREVMO = dto.FPrevMO,
             Typea = dto.TypeA
         };
 

--
Gitblit v1.9.3