From c586d7e6347609a545bd588d7297bf272b32e465 Mon Sep 17 00:00:00 2001
From: test <15284381150@163.com>
Date: 星期五, 15 八月 2025 09:34:12 +0800
Subject: [PATCH] 修改创建出库单据中的仓库编号

---
 Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs |   38 +++++++++++++++++++++++++++++++++++---
 1 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
index b83a0fb..cd21a0c 100644
--- a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
+++ b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
@@ -342,7 +342,8 @@
                         throw new Exception("瀹㈡埛淇℃伅涓嶅瓨鍦�!");
                     }
                     CustomerName = customer.CustomerName;
-                }               
+                }
+
                 //鎵胯繍鍟嗕俊鎭�
                 //var logistics = Db.Queryable<SysLogisticsInfo>().First(m => m.IsDel == "0" && m.CarrierName == model.LogisticsNo);
                 //int? logisticsId = null;
@@ -366,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");
@@ -589,16 +602,35 @@
                         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" || houseNo == "2002" || houseNo == "2003" || houseNo == "2004")
+                    {
+                        notice.WareHouseNo = "W02";
+                    }
+                    else if (houseNo == "4000")
+                    {
+                        notice.WareHouseNo = "W01";
+                    }
+                    else
+                    {
+                        // houseNo鎶涘紓甯革紝閬垮厤鍑虹幇闈濿01锛學02鐨勫��
+                        throw new Exception($"涓嶆敮鎸佺殑鍙戝嚭浠撳簱缂栧彿锛歿houseNo}锛屼粎鏀寔鐢熸垚W01鍜學02浠撳簱鐨勫崟鎹�");
+                    }
+                    //棰濆鏍¢獙锛堝彲閫夛紝鍙岄噸淇濋殰锛�
+                    if (notice.WareHouseNo != "W01" && notice.WareHouseNo != "W02")
+                    {
+                        throw new Exception($"浠撳簱缂栧彿寮傚父锛歿notice.WareHouseNo}锛屼粎鍏佽W01鍜學02");
+                    }
+
 
                     var n = Db.Insertable<BllExportNotice>(notice).ExecuteCommand();
                     var m = Db.Insertable<BllExportNoticeDetail>(list).ExecuteCommand();

--
Gitblit v1.8.0