From 62a21f9dbc671bdff5c8d0410588111cf6daa343 Mon Sep 17 00:00:00 2001
From: hao <1836460075@qq.com>
Date: 星期六, 20 九月 2025 09:38:28 +0800
Subject: [PATCH] 组装拆卸
---
StandardInterface/MES.Service/service/ZZCXDManager.cs | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/StandardInterface/MES.Service/service/ZZCXDManager.cs b/StandardInterface/MES.Service/service/ZZCXDManager.cs
index 733be1c..4449457 100644
--- a/StandardInterface/MES.Service/service/ZZCXDManager.cs
+++ b/StandardInterface/MES.Service/service/ZZCXDManager.cs
@@ -12,8 +12,20 @@
{
public bool SaveList(List<ERPZZCXD> list)
{
- var result = list.Select(Save).ToList();
- return result.All(b => b);
+ /*var result = list.Select(Save).ToList();
+ return result.All(b => b);*/
+ foreach (var item in list)
+ {
+ try
+ {
+ Save(item);
+ }
+ catch (Exception ex)
+ {
+ throw new Exception($"鍗曟嵁 {item.Main.bill_no} 鍑洪敊: {ex.Message}", ex);
+ }
+ }
+ return true;
}
public bool Save(ERPZZCXD data)
@@ -126,7 +138,7 @@
Memo = subDto.memo
};
- var existingSub = Db.Queryable<ZZCXB>().Where(s => s.Eid == subEntity.Eid).Single();
+ var existingSub = Db.Queryable<ZZCXB>().Where(s => s.Erpid == subEntity.Erpid).Single();
if (existingSub != null) subEntity.Id = existingSub.Id;
item.SubItems ??= new List<ZZCXB>();
@@ -152,9 +164,13 @@
if (head.Id != null)
base.DeleteById(head.Id);
+
+ // 鍒犻櫎瀛欒〃
+ db.Deleteable<ZZCXB>().Where(d => d.YdId == head.Erpid).ExecuteCommand();
+ // 鍒犻櫎瀛愯〃锛堜娇鐢� yd_id 浣滀负鍏宠仈锛�
db.Deleteable<ZZCXA>().Where(d => d.YdId == head.Erpid).ExecuteCommand();
- db.Deleteable<ZZCXB>().Where(d => d.Erpid == head.Erpid).ExecuteCommand();
-
+ // 鍒犻櫎涓昏〃
+ db.Deleteable<ZZCX>().Where(d => d.Erpid == head.Erpid).ExecuteCommand();
var insertedHead = db.Insertable(head)
.IgnoreColumns(true)
.ExecuteReturnIdentity();
--
Gitblit v1.9.3