From 347a4c4ec6b65aeb29d8af0ad43d5d7c5ffab5a9 Mon Sep 17 00:00:00 2001
From: sjz <1240968267@qq.com>
Date: 星期三, 04 六月 2025 09:03:20 +0800
Subject: [PATCH] 生产订单变更修改
---
MES.Service/service/WomcaaManager.cs | 30 ++++++++++++++++++++++++++----
MES.Service/service/WomcaaWWManager.cs | 29 ++++++++++++++++++++++++++---
2 files changed, 52 insertions(+), 7 deletions(-)
diff --git a/MES.Service/service/WomcaaManager.cs b/MES.Service/service/WomcaaManager.cs
index 27a1cbe..a697391 100644
--- a/MES.Service/service/WomcaaManager.cs
+++ b/MES.Service/service/WomcaaManager.cs
@@ -56,6 +56,7 @@
}
var orUpdate = base.Insert(mesWomcaa);
var baOrUpdate = _womcabManager.InsertRange(mesWomcabs);
+ db.Ado.CommitTran();
if (orUpdate && baOrUpdate) {
//瀹氫箟杈撳叆鍙傛暟
var inputParam1 = new SugarParameter("P_WORK_NO", mesWomcaa.Caa001);
@@ -70,11 +71,11 @@
if (result == 1)
{
//瀛樺偍杩囩▼澶辫触鍒欎簨鍔¤繘琛屽洖婊�
- db.Ado.RollbackTran();
+ //db.Ado.RollbackTran();
throw new Exception(message);
}
// 鎻愪氦浜嬪姟
- db.Ado.CommitTran();
+ //db.Ado.CommitTran();
return true;
}
throw new NotImplementedException("鎻掑叆鎴栨洿鏂板け璐�");
@@ -90,8 +91,29 @@
}
var orUpdate = base.Insert(mesWomcaa);
var baOrUpdate = _womcabManager.InsertRange(mesWomcabs);
-
- if (orUpdate && baOrUpdate) return true;
+ db.Ado.CommitTran();
+ 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("鎻掑叆鎴栨洿鏂板け璐�");
}
diff --git a/MES.Service/service/WomcaaWWManager.cs b/MES.Service/service/WomcaaWWManager.cs
index 0b52483..8b61e2c 100644
--- a/MES.Service/service/WomcaaWWManager.cs
+++ b/MES.Service/service/WomcaaWWManager.cs
@@ -56,6 +56,7 @@
}
var orUpdate = base.Insert(mesWomcaa);
var baOrUpdate = _womcabWWManager.InsertRange(mesWomcabs);
+ db.Ado.CommitTran();
if (orUpdate && baOrUpdate)
{
//瀹氫箟杈撳叆鍙傛暟
@@ -71,11 +72,11 @@
if (result == 1)
{
//瀛樺偍杩囩▼澶辫触鍒欎簨鍔¤繘琛屽洖婊�
- db.Ado.RollbackTran();
+ //db.Ado.RollbackTran();
throw new Exception(message);
}
// 鎻愪氦浜嬪姟
- db.Ado.CommitTran();
+ //db.Ado.CommitTran();
return true;
}
throw new NotImplementedException("鎻掑叆鎴栨洿鏂板け璐�");
@@ -90,7 +91,29 @@
var orUpdate = base.Insert(mesWomcaa);
var baOrUpdate = _womcabWWManager.InsertRange(mesWomcabss);
- if (orUpdate && baOrUpdate) return true;
+ db.Ado.CommitTran();
+ 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("鎻掑叆鎴栨洿鏂板け璐�");
}
--
Gitblit v1.9.3