From 21eaaa8218e1389babb60d75e6870659abed992e Mon Sep 17 00:00:00 2001
From: 如洲 陈 <1278080563@qq.com>
Date: 星期二, 24 六月 2025 17:01:33 +0800
Subject: [PATCH] 增加ERP删除任务单后删除工单
---
MESApplication/bin/Debug/net8.0/MESApplication.pdb | 0
MESApplication/bin/Debug/net8.0/MESApplication.exe | 0
MESApplication/bin/Debug/net8.0/MES.Service.pdb | 0
MESApplication/bin/Debug/net8.0/MESApplication.dll | 0
MES.Service/bin/Debug/net8.0/MES.Service.dll | 0
MES.Service/service/WomcaaManager.cs | 50 ++++++++++++++++++++++++++++++++++++++------------
MESApplication/bin/Debug/net8.0/MES.Service.dll | 0
MES.Service/bin/Debug/net8.0/MES.Service.pdb | 0
8 files changed, 38 insertions(+), 12 deletions(-)
diff --git a/MES.Service/bin/Debug/net8.0/MES.Service.dll b/MES.Service/bin/Debug/net8.0/MES.Service.dll
index d22604f..d3abeb1 100644
--- a/MES.Service/bin/Debug/net8.0/MES.Service.dll
+++ b/MES.Service/bin/Debug/net8.0/MES.Service.dll
Binary files differ
diff --git a/MES.Service/bin/Debug/net8.0/MES.Service.pdb b/MES.Service/bin/Debug/net8.0/MES.Service.pdb
index e8542cf..c89f342 100644
--- a/MES.Service/bin/Debug/net8.0/MES.Service.pdb
+++ b/MES.Service/bin/Debug/net8.0/MES.Service.pdb
Binary files differ
diff --git a/MES.Service/service/WomcaaManager.cs b/MES.Service/service/WomcaaManager.cs
index 209a96b..5859f34 100644
--- a/MES.Service/service/WomcaaManager.cs
+++ b/MES.Service/service/WomcaaManager.cs
@@ -241,27 +241,53 @@
public bool Delete(YFDelete data)
{
+ if (data == null)
+ throw new ArgumentNullException(nameof(data));
+ if (string.IsNullOrWhiteSpace(data.FBillNo))
+ throw new ArgumentException("FBillNo 涓嶈兘涓虹┖", nameof(data.FBillNo));
+
+ if (string.IsNullOrWhiteSpace(data.FBillTypeID))
+ throw new ArgumentException("FBillTypeID 涓嶈兘涓虹┖", nameof(data.FBillTypeID));
return UseTransaction(db =>
{
- var update = db.Deleteable<Womcaa>()
- .Where(it => it.Caa001 == data.FBillNo &&
- it.SrcBillType == data.FBillTypeID)
- .ExecuteCommand() > 0;
+ // 鍒犻櫎涓昏〃鏁版嵁
+ var deleteMain = db.Deleteable<Womcaa>()
+ .Where(it => it.Caa001 == data.FBillNo && it.SrcBillType == data.FBillTypeID)
+ .ExecuteCommand() > 0;
- var insertOrUpdate = db.Deleteable<Womcab>()
- .Where(it => it.Cab001 == data.FBillNo &&
- it.Cab002 == data.FBillTypeID)
- .ExecuteCommand() > 0;
+ // 鍒犻櫎瀛愯〃鏁版嵁
+ var deleteDetail = db.Deleteable<Womcab>()
+ .Where(it => it.Cab001 == data.FBillNo && it.Cab002 == data.FBillTypeID)
+ .ExecuteCommand() > 0;
+ if (!deleteMain || !deleteDetail)
+ throw new Exception("鍒犻櫎澶辫触锛氫富琛ㄦ垨瀛愯〃璁板綍涓嶅瓨鍦�");
+ // 璋冪敤瀛樺偍杩囩▼杩涜鍚庣画澶勭悊
+ var inputParam1 = new SugarParameter("P_WORK_NO", data.FBillNo);
+ var inputParam2 = new SugarParameter("P_WORK_TYPE", data.FBillTypeID);
+ var outParam1 = new SugarParameter("C_RESULT", null, true); // 杈撳嚭鍙傛暟
+ var outParam2 = new SugarParameter("C_MSG", null, true); // 杈撳嚭鍙傛暟
- if (update && insertOrUpdate) return 1;
- throw new NotImplementedException("鍒犻櫎澶辫触");
+ db.Ado.ExecuteCommand(
+ "BEGIN PRC_DELETE_DAA(:P_WORK_NO, :P_WORK_TYPE, :C_RESULT, :C_MSG); END;",
+ inputParam1, inputParam2, 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);
+
+ }
+
+ return 1;
}) > 0;
-
-
}
diff --git a/MESApplication/bin/Debug/net8.0/MES.Service.dll b/MESApplication/bin/Debug/net8.0/MES.Service.dll
index d22604f..d3abeb1 100644
--- a/MESApplication/bin/Debug/net8.0/MES.Service.dll
+++ b/MESApplication/bin/Debug/net8.0/MES.Service.dll
Binary files differ
diff --git a/MESApplication/bin/Debug/net8.0/MES.Service.pdb b/MESApplication/bin/Debug/net8.0/MES.Service.pdb
index e8542cf..c89f342 100644
--- a/MESApplication/bin/Debug/net8.0/MES.Service.pdb
+++ b/MESApplication/bin/Debug/net8.0/MES.Service.pdb
Binary files differ
diff --git a/MESApplication/bin/Debug/net8.0/MESApplication.dll b/MESApplication/bin/Debug/net8.0/MESApplication.dll
index f7e00a3..f4ff9e0 100644
--- a/MESApplication/bin/Debug/net8.0/MESApplication.dll
+++ b/MESApplication/bin/Debug/net8.0/MESApplication.dll
Binary files differ
diff --git a/MESApplication/bin/Debug/net8.0/MESApplication.exe b/MESApplication/bin/Debug/net8.0/MESApplication.exe
index d730051..89cf2ad 100644
--- a/MESApplication/bin/Debug/net8.0/MESApplication.exe
+++ b/MESApplication/bin/Debug/net8.0/MESApplication.exe
Binary files differ
diff --git a/MESApplication/bin/Debug/net8.0/MESApplication.pdb b/MESApplication/bin/Debug/net8.0/MESApplication.pdb
index f9fe5ee..895fc4b 100644
--- a/MESApplication/bin/Debug/net8.0/MESApplication.pdb
+++ b/MESApplication/bin/Debug/net8.0/MESApplication.pdb
Binary files differ
--
Gitblit v1.9.3