From 89d384623e1acdb3c58ec6d4094f9e8f2ec5ca57 Mon Sep 17 00:00:00 2001
From: hao <1836460075@qq.com>
Date: 星期三, 22 十月 2025 09:23:58 +0800
Subject: [PATCH] 销售发货同步防呆+合并单号

---
 StandardInterface/MES.Service/service/BasicData/Sales/SalesDeliveryNoticeManager.cs |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/StandardInterface/MES.Service/service/BasicData/Sales/SalesDeliveryNoticeManager.cs b/StandardInterface/MES.Service/service/BasicData/Sales/SalesDeliveryNoticeManager.cs
index 3fc4c37..0c7ab57 100644
--- a/StandardInterface/MES.Service/service/BasicData/Sales/SalesDeliveryNoticeManager.cs
+++ b/StandardInterface/MES.Service/service/BasicData/Sales/SalesDeliveryNoticeManager.cs
@@ -90,6 +90,15 @@
         private bool SaveOrUpdateData(SqlSugarScope db, SalesDeliveryNotice mesSalesDelivery,
             List<SalesDeliveryNoticeDetail> mesSalesDeliveryDatas, string type)
         {
+
+            // 1. 鏍¢獙鏄惁瀛樺湪棰嗘枡璁板綍锛圡ES_INV_ITEM_OUTS锛�
+            var hasMaterialOut = db.Queryable<MesInvItemOuts>()
+                                   .Any(x => x.WorkNo == mesSalesDelivery.BillNo);
+
+            if (hasMaterialOut)
+            {
+                throw new Exception($"MES宸叉湁棰嗘枡璁板綍锛屽崟鍙凤細{mesSalesDelivery.BillNo}锛屼笉鑳芥洿鏂帮紒");
+            }
             if (mesSalesDelivery.Id != null) base.DeleteById(mesSalesDelivery.Id);
 
             if (mesSalesDeliveryDatas.Count > 0)
@@ -176,7 +185,8 @@
                 CloseStatus = erpDto.FBillCloseStatus, // 鍏抽棴鐘舵��
                 BillStatus = erpDto.FDocumentStatus, //鍗曟嵁鐘舵��
                 DeliveryOrg = erpDto.FDeliveryOrgID, //鍙戣揣缁勭粐
-                SalesOrg    = erpDto.FSaleOrgId //閿�鍞粍缁�
+                SalesOrg    = erpDto.FSaleOrgId, //閿�鍞粍缁�
+                HbDh    = erpDto.HbDh //閿�鍞粍缁�
 
             };
 
@@ -242,7 +252,10 @@
                     TerminationDate = ParseDateTime(erpDto.FTerminateDate),//涓氬姟缁堟鏃ユ湡
                     SumOutQty = erpDto.FSumOutQty,//绱鍑哄簱鏁伴噺
                     RemainOutQty = erpDto.FRemainOutQty,//鏈嚭搴撴暟閲�
-                    NOTE = erpDto.FEntrynote//澶囨敞
+                    NOTE = erpDto.FEntrynote,//澶囨敞
+                    Xsdd=erpDto.Xsdd,
+                    XsddId=erpDto.Xsdd_id,
+                    XsddLineId=erpDto.Xsdd_line_id,
 
                 };
 

--
Gitblit v1.9.3