From 2b9f544a55f30f0b6e8010b84ed8b60f2c4cb78e Mon Sep 17 00:00:00 2001
From: hao <1836460075@qq.com>
Date: 星期一, 04 八月 2025 20:35:52 +0800
Subject: [PATCH] 工单更新

---
 StandardInterface/MES.Service/service/BasicData/Material/MesDepotsManager.cs |    2 +-
 StandardInterface/MES.Service/service/WomcaaManager.cs                       |   55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 StandardInterface/MESApplication/appsettings.json                            |    2 +-
 3 files changed, 56 insertions(+), 3 deletions(-)

diff --git a/StandardInterface/MES.Service/service/BasicData/Material/MesDepotsManager.cs b/StandardInterface/MES.Service/service/BasicData/Material/MesDepotsManager.cs
index f43f5fb..e935a1f 100644
--- a/StandardInterface/MES.Service/service/BasicData/Material/MesDepotsManager.cs
+++ b/StandardInterface/MES.Service/service/BasicData/Material/MesDepotsManager.cs
@@ -48,7 +48,7 @@
             .SetColumns(s => s.IsNg == status)
             .Where(s => s.DepotId == depotId).ExecuteCommand();
 
-        if (result > 0)
+       // if (result > 0)
             return true;
 
         throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触");
diff --git a/StandardInterface/MES.Service/service/WomcaaManager.cs b/StandardInterface/MES.Service/service/WomcaaManager.cs
index c1584c4..84b5753 100644
--- a/StandardInterface/MES.Service/service/WomcaaManager.cs
+++ b/StandardInterface/MES.Service/service/WomcaaManager.cs
@@ -64,13 +64,43 @@
             .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_DAA2(:P_WORK_NO,:c_Result,:C_MSG); END;",
+                inputParam1, outParam1, outParam2);
+            // 鑾峰彇杈撳嚭鍙傛暟鐨勫��
+            var result = int.Parse((string)outParam1.Value);
+            var 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("鎻掑叆鎴栨洿鏂板け璐�");
     }
 
     private bool UpdateData(SqlSugarScope db, Womcaa mesWomcaa,
         List<Womcab> mesWomcabs)
     {
+
+
+      
+
         var decimals = mesWomcabs.Select(s => s.Id).ToArray();
 
         var update = true;
@@ -89,6 +119,29 @@
 
         if (update && insertOrUpdate)
         {
+            //瀹氫箟杈撳叆鍙傛暟
+            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_DAA2(:P_WORK_NO,:c_Result,:C_MSG); END;",
+                inputParam1, outParam1, outParam2);
+            // 鑾峰彇杈撳嚭鍙傛暟鐨勫��
+            var result = int.Parse((string)outParam1.Value);
+            var 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("鏇存柊澶辫触");
diff --git a/StandardInterface/MESApplication/appsettings.json b/StandardInterface/MESApplication/appsettings.json
index 59a3601..28cfc2a 100644
--- a/StandardInterface/MESApplication/appsettings.json
+++ b/StandardInterface/MESApplication/appsettings.json
@@ -10,6 +10,6 @@
   "AppSettings": {
     "TestErpUrl": "http://192.168.11.120:8098/WebService1.asmx/mesToErpinfo",
     "ProductionErpUrl": "http://192.168.11.120:8098/WebService1.asmx/mesToErpinfoFormal",
-    "DataBaseConn": "Data Source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.22)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = ORCL))); Persist Security Info=True;User ID = test_dev; Password=hmprd"
+    "DataBaseConn": "Data Source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.22)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = ORCL))); Persist Security Info=True;User ID = hm_prd; Password=hmprd"
   }
 }

--
Gitblit v1.9.3