From 83748b08c2016120e914f669f1b8d376846abf01 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期五, 13 三月 2026 01:10:21 +0800
Subject: [PATCH] 1

---
 项目代码/WMS/WMSServices/WIDESEA_IOutboundService/IOutSGOrderDetailService.cs |    2 +-
 项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs       |    4 ++++
 项目代码/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderDetailService.cs   |   14 +++++++++-----
 项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs      |    9 +++++----
 4 files changed, 19 insertions(+), 10 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_IOutboundService/IOutSGOrderDetailService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_IOutboundService/IOutSGOrderDetailService.cs"
index 52b3434..225632c 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_IOutboundService/IOutSGOrderDetailService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_IOutboundService/IOutSGOrderDetailService.cs"
@@ -19,7 +19,7 @@
         /// </summary>
         /// <param name="outboundOrderDetails"></param>
         /// <returns></returns>
-        (List<Dt_StockInfo>, List<Dt_OutSGOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(List<Dt_OutSGOrderDetail> outboundOrderDetails);
+        (List<Dt_StockInfo>, List<Dt_OutSGOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>,string) AssignStockOutbound(List<Dt_OutSGOrderDetail> outboundOrderDetails);
 
         /// <summary>
         /// 鍑哄簱搴撳瓨鍒嗛厤鍚庯紝鏇存柊鏁版嵁搴撴暟鎹�
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderDetailService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderDetailService.cs"
index 59292fb..907c163 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderDetailService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderDetailService.cs"
@@ -45,13 +45,13 @@
         /// <summary>
         /// 鍒嗛厤搴撳瓨
         /// </summary>
-        public (List<Dt_StockInfo>, List<Dt_OutSGOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(List<Dt_OutSGOrderDetail> outboundOrderDetails)
+        public (List<Dt_StockInfo>, List<Dt_OutSGOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>,string) AssignStockOutbound(List<Dt_OutSGOrderDetail> outboundOrderDetails)
         {
             if (!outboundOrderDetails.Any())
             {
                 throw new Exception($"鏈壘鍒板嚭搴撳崟鏄庣粏淇℃伅");
             }
-
+            string message = "";
             //鑾峰彇鎵�鏈夋帓绋嬩富琛�
             List<Dt_OutSGOrder> outBSTOrders = _outboundRepository.OutSGOrderRepository.QueryData(x => outboundOrderDetails.Select(x=>x.OutSGOrderId).Distinct().Contains(x.Id));
             List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>();
@@ -74,14 +74,18 @@
             foreach (var item in groupDetails)
             {
                 decimal needQuantity = item.XqLen;
+                //鑾峰彇鎵�鏈夋潯鐮�
+                List<string> palletCodes = outStocks.Select(x => x.PalletCode).ToList();
                 //鑾峰彇鑰佸巶缂撳瓨鍙敤搴撳瓨
-                List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseOldCacheStocks(item.MaterialNo, item.Width) ?? new List<Dt_StockInfo>();
+                List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseOldCacheStocks(item.MaterialNo, item.Width).Where(x => !palletCodes.Contains(x.PalletCode)).ToList() ?? new List<Dt_StockInfo>();
                 //鑾峰彇绔嬪簱鍙敤搴撳瓨
-                stockInfos.AddRange(_stockService.StockInfoService.GetUseableStocks(item.MaterialNo, item.Width, outBSTOrders.FirstOrDefault().WarehouseId).Where(x=>!outStocks.Select(x=>x.PalletCode).Contains(x.PalletCode)).ToList());
+                stockInfos.AddRange(_stockService.StockInfoService.GetUseableStocks(item.MaterialNo, item.Width, outBSTOrders.FirstOrDefault().WarehouseId).Where(x=>!palletCodes.Contains(x.PalletCode)).ToList());
                 if (!stockInfos.Any())
                 {
+                    message += $"鐗╂枡锛歿item.MaterialNo},骞呭锛歿item.Width}鏃犲簱瀛橈紱";
                     continue;
                 }
+
                 //鍒嗛厤瀹為檯搴撳瓨
                 List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutOldStocks(stockInfos, needQuantity).ToList();
                 //娣诲姞搴撳瓨鍒嗛厤
@@ -143,7 +147,7 @@
                 locationInfos.AddRange(_basicRepository.LocationInfoRepository.GetLocationInfos(outStocks.Where(x=>!x.LocationCode.IsNullOrEmpty() && !locationInfos.Select(x=>x.LocationCode).Contains(x.LocationCode)).Select(x => x.LocationCode).ToList()));
             }
 
-            return (outStocks, outboundOrderDetails, outStockLockInfos, locationInfos);
+            return (outStocks, outboundOrderDetails, outStockLockInfos, locationInfos, message);
         }
         /// <summary>
         /// 鍑哄簱搴撳瓨鍒嗛厤鍚庯紝鏇存柊鏁版嵁搴撴暟鎹�
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
index d076cc6..27a2bfd 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
@@ -365,6 +365,10 @@
                     throw new Exception($"鏈壘鍒版潯鐮亄stockInfoOld.PalletCode}涓�鏈烢RP搴撳瓨涓嶅瓨鍦�");
                 }
                 BSTStockInfoDTO bSTStockInfoDTO = bSTResponse.Data ?? throw new Exception($"涓�鏈烢RP鏈繑鍥瀧stockInfoOld.PalletCode}鐨勫簱瀛樹俊鎭�");
+                if (stockInfoOld.StockLength <= 0 || bSTStockInfoDTO.StockMeter<=0)
+                {
+                    throw new Exception($"{stockInfoOld.RfidCode}缁戝畾鏉$爜{stockInfoOld.PalletCode}搴撳瓨涓�0");
+                }
                 stockInfoOld.IsPick = WhetherEnum.False.ObjToInt();
                 decimal stockLength = bSTStockInfoDTO.StockMeter;
                 decimal errWeight = Math.Abs(weight - bSTStockInfoDTO.Qty);
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
index 99b483c..389fb59 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
@@ -683,7 +683,7 @@
                 List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>();
                 List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>();
                 //鐢熸垚浠诲姟銆佸簱瀛樼瓑淇℃伅
-                (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutSGTaskDataHandle(keys);
+                (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?,string) result = OutSGTaskDataHandle(keys);
                 if (result.Item2 != null && result.Item2.Count > 0)
                 {
                     stockInfos.AddRange(result.Item2);
@@ -704,6 +704,7 @@
                 {
                     tasks.AddRange(result.Item1);
                 }
+                content.Message = result.Item6;
                 //澶勭悊鍑哄簱鏁版嵁
                 return GenerateOutboundTaskDataUpdate(tasks, stockInfos, outSGOrderDetails, outStockLockInfos, locationInfos);
             }
@@ -721,7 +722,7 @@
         /// <param name="stockSelectViews"></param>
         /// <returns></returns>
         /// <exception cref="Exception"></exception>
-        public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) OutSGTaskDataHandle(int[] keys)
+        public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?,string) OutSGTaskDataHandle(int[] keys)
         {
             List<Dt_Task> tasks = new List<Dt_Task>();
             List<Dt_OutSGOrderDetail> outSGOrderDetails = _outboundRepository.OutSGOrderDetailRepository.QueryData(x => keys.Contains(x.Id));
@@ -741,7 +742,7 @@
             List<Dt_LocationInfo>? locationInfos = null;
 
             //鍒嗛厤搴撳瓨
-            (List<Dt_StockInfo>, List<Dt_OutSGOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutSGOrderDetailService.AssignStockOutbound(outSGOrderDetails);
+            (List<Dt_StockInfo>, List<Dt_OutSGOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>,string) result = _outboundService.OutSGOrderDetailService.AssignStockOutbound(outSGOrderDetails);
             if (result.Item1 != null && result.Item1.Count > 0)
             {
                 //鑾峰彇浠诲姟
@@ -775,7 +776,7 @@
                 throw new Exception("鏃犲簱瀛�");
             }
 
-            return (tasks, stockInfos, orderDetails, outStockLockInfos, locationInfos);
+            return (tasks, stockInfos, orderDetails, outStockLockInfos, locationInfos, result.Item5);
         }
         /// <summary>
         /// 澶勭悊鍑哄簱鏁版嵁

--
Gitblit v1.9.3