From c37ac3c9349c10afb3938326ea8e17b338e68a92 Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期五, 15 八月 2025 09:05:22 +0800
Subject: [PATCH] 修改SAP下发出库单接口

---
 Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs |   54 ++++++++++++++++++++++++++++++++----------------------
 1 files changed, 32 insertions(+), 22 deletions(-)

diff --git a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
index d1c5d5b..5395b9e 100644
--- a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
+++ b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
@@ -332,33 +332,18 @@
                 //鑾峰彇搴撳瓨
                 var stockList = Db.Queryable<DataStock>().Where(s => skuNos.Contains(s.SkuNo) && (s.Qty - s.FrozenQty - s.LockQty) > 0).ToList();
 
-                //string CustomerName = string.Empty;
-                //if (!string.IsNullOrEmpty(model.customerNo))
-                //{
-                //    //瀹㈡埛淇℃伅
-                //    var customer = Db.Queryable<SysCustomer>().First(m => m.IsDel == "0" && m.CustomerNo == model.customerNo);
-                //    if (customer == null)
-                //    {
-                //        throw new Exception("瀹㈡埛淇℃伅涓嶅瓨鍦�!");
-                //    }
-                //    CustomerName = customer.CustomerName;
-                //}
                 string CustomerName = string.Empty;
                 if (!string.IsNullOrEmpty(model.customerNo))
                 {
+                    //瀹㈡埛淇℃伅
                     var customer = Db.Queryable<SysCustomer>().First(m => m.IsDel == "0" && m.CustomerNo == model.customerNo);
-                    if (customer != null)
+                    if (customer == null)
                     {
-                        CustomerName = customer.CustomerName;
+                        throw new Exception("瀹㈡埛淇℃伅涓嶅瓨鍦�!");
                     }
-                    else
-                    {
-                        // 璁板綍鏃ュ織锛屼究浜庢帓鏌�
-                        Console.WriteLine($"璀﹀憡锛氬鎴蜂俊鎭笉瀛樺湪锛宑ustomerNo={model.customerNo}");
-                        // 鍙缃粯璁ゅ鎴峰悕绉版垨鍏朵粬澶勭悊锛屾牴鎹笟鍔″喅瀹�
-                        CustomerName = "榛樿瀹㈡埛";
-                    }
+                    CustomerName = customer.CustomerName;
                 }
+
                 //鎵胯繍鍟嗕俊鎭�
                 //var logistics = Db.Queryable<SysLogisticsInfo>().First(m => m.IsDel == "0" && m.CarrierName == model.LogisticsNo);
                 //int? logisticsId = null;
@@ -382,9 +367,21 @@
                 try
                 {
                     var list = new List<BllExportNoticeDetail>();
+                    var houseNo = string.Empty;
                     //娣诲姞鍑哄簱鍗�
                     foreach (var d in model.orderDetailList)
                     {
+                        if (!string.IsNullOrEmpty(houseNo))
+                        {
+                            if (houseNo != d.wareHouseNo)
+                            {
+                                throw new Exception("鍚屼釜鍑哄簱鍗曚笅鏄庣粏鍒楄〃鍙戝嚭浠撳簱涓嶄竴鑷�!");
+                            }
+                        }
+                        else
+                        {
+                            houseNo = d.wareHouseNo;
+                        }
                         if (d.skuQty < 1)
                         {
                             throw new Exception("鍑哄簱鏁伴噺蹇呴』澶т簬0");
@@ -605,16 +602,29 @@
                         OrderCode=model.orderNo,
                         Type = model.orderType,
                         Status = "0",
-                        Origin = "WMS",
+                        Origin = "SAP",
                         CustomerNo = model.customerNo,
                         CustomerName = CustomerName,
                         LogisticsId = null,//logisticsId,
                         IsWave = "0",
                         WaveNo = "",
                         IsDespatch = "0",
-
+                        
                         CreateUser = 0,
                     };
+                    if (houseNo == "1000" || houseNo == "1001" || houseNo == "2000")
+                    {
+                        notice.WareHouseNo = "W01";
+                    }
+                    else if (houseNo == "2001")
+                    {
+                        notice.WareHouseNo = "W02";
+                    }
+                    else
+                    {
+                        throw new Exception("鍙戝嚭浠撳簱寮傚父");
+                    }
+                    
 
                     var n = Db.Insertable<BllExportNotice>(notice).ExecuteCommand();
                     var m = Db.Insertable<BllExportNoticeDetail>(list).ExecuteCommand();

--
Gitblit v1.8.0