From 5496134056ef9b9e2bc290edeb1a4d4716e9f37a Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期三, 18 十二月 2024 17:08:30 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs |   66 ++++++++++++++++++++++++--------
 1 files changed, 49 insertions(+), 17 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs"
index 60c1462..26e345a 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs"
@@ -48,18 +48,29 @@
             _recordService = recordService;
         }
 
+        /// <summary>
+        /// 閿佸畾搴撳瓨锛岀敱绯荤粺鍒嗛厤(浠呴�昏緫杩愮畻锛屼笉鐢熸垚浠诲姟锛屼笉淇敼鏁版嵁搴撴暟鎹�)
+        /// </summary>
+        /// <param name="orderDetailId"></param>
+        /// <returns></returns>
         public WebResponseContent LockOutboundStock(int orderDetailId)
         {
             Dt_OutboundOrderDetail outboundOrderDetail = BaseDal.QueryFirst(x => x.Id == orderDetailId);
-            (bool, string) result = CheckDeital(outboundOrderDetail);
-            if (!result.Item1) return WebResponseContent.Instance.Error(result.Item2);
+            if (outboundOrderDetail == null)
+            {
+                return WebResponseContent.Instance.Error("鏈壘鍒板嚭搴撳崟鏄庣粏淇℃伅");
+            }
+            if (outboundOrderDetail.OrderDetailStatus != OrderDetailStatusEnum.New.ObjToInt())
+            {
+                return WebResponseContent.Instance.Error("璇ユ槑缁嗕笉鍙搷浣�");
+            }
             Dt_OutboundOrder outboundOrder = _outboundRepository.OutboundOrderRepository.QueryFirst(x => x.Id == outboundOrderDetail.OrderId);
 
             float needQuantity = outboundOrderDetail.OrderQuantity - outboundOrderDetail.LockQuantity;
 
             List<Dt_StockInfo> outStock = new List<Dt_StockInfo>();
 
-            List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(outboundOrderDetail.MaterielCode, outboundOrder.WarehouseId);
+            List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(outboundOrderDetail.MaterielCode, outboundOrderDetail.BatchNo, outboundOrder.WarehouseId);
             float stockTotalQuantity = stockInfos.Select(x => x.Details.Sum(v => v.StockQuantity - v.OutboundQuantity)).Sum(x => x);
             if (stockTotalQuantity >= needQuantity)//搴撳瓨澶�
             {
@@ -137,19 +148,13 @@
             }
         }
 
-        private (bool, string) CheckDeital(Dt_OutboundOrderDetail outboundOrderDetail)
-        {
-            if (outboundOrderDetail == null)
-            {
-                return (false, "鏈壘鍒板嚭搴撳崟鏄庣粏淇℃伅");
-            }
-            if (outboundOrderDetail.OrderDetailStatus != OrderDetailStatusEnum.New.ObjToInt())
-            {
-                return (false, "璇ユ槑缁嗕笉鍙搷浣�");
-            }
-            return (true, "鎴愬姛");
-        }
-
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="outboundOrderDetail"></param>
+        /// <param name="stockSelectViews"></param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
         public (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(Dt_OutboundOrderDetail outboundOrderDetail, List<StockSelectViewDTO> stockSelectViews)
         {
             (bool, string) checkResult = CheckSelectStockDeital(outboundOrderDetail, stockSelectViews);
@@ -181,7 +186,7 @@
             needQuantity -= assignQuantity;
             if (outboundOrderDetail.OrderQuantity > outboundOrderDetail.LockQuantity)
             {
-                List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(outboundOrderDetail.MaterielCode, outboundOrder.WarehouseId);
+                List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(outboundOrderDetail.MaterielCode, outboundOrderDetail.BatchNo, outboundOrder.WarehouseId);
                 stockInfos = stockInfos.Where(x => !stockSelectViews.Select(v => v.PalletCode).Contains(x.PalletCode)).ToList();
                 List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, outboundOrderDetail.MaterielCode, needQuantity, out float residueQuantity);
                 outboundOrderDetail.LockQuantity += needQuantity - residueQuantity;
@@ -200,6 +205,12 @@
             return (outStocks, outboundOrderDetail, outStockLockInfos, locationInfos);
         }
 
+        /// <summary>
+        ///  閿佸畾搴撳瓨锛岀敱浜哄伐鎸囧畾锛屾垨鍔犱笂绯荤粺鍒嗛厤(鍖呭惈閫昏緫杩愮畻锛屼笖淇敼鏁版嵁搴撴暟鎹�)
+        /// </summary>
+        /// <param name="orderDetailId"></param>
+        /// <param name="stockSelectViews"></param>
+        /// <returns></returns>
         public WebResponseContent LockOutboundStock(int orderDetailId, List<StockSelectViewDTO> stockSelectViews)
         {
             try
@@ -229,6 +240,12 @@
             }
         }
 
+        /// <summary>
+        ///  閿佸畾搴撳瓨锛岀敱绯荤粺鍒嗛厤(鍖呭惈閫昏緫杩愮畻锛屼笖淇敼鏁版嵁搴撴暟鎹�)
+        /// </summary>
+        /// <param name="orderDetailId"></param>
+        /// <param name="stockSelectViews"></param>
+        /// <returns></returns>
         public WebResponseContent LockOutboundStock(int[] keys)
         {
             try
@@ -273,6 +290,16 @@
             }
         }
 
+        /// <summary>
+        /// 鍑哄簱搴撳瓨鍒嗛厤鍚庯紝鏇存柊鏁版嵁搴撴暟鎹�
+        /// </summary>
+        /// <param name="stockInfos"></param>
+        /// <param name="outboundOrderDetails"></param>
+        /// <param name="outStockLockInfos"></param>
+        /// <param name="locationInfos"></param>
+        /// <param name="locationStatus"></param>
+        /// <param name="tasks"></param>
+        /// <returns></returns>
         public WebResponseContent LockOutboundStockDataUpdate(List<Dt_StockInfo> stockInfos, List<Dt_OutboundOrderDetail> outboundOrderDetails, List<Dt_OutStockLockInfo> outStockLockInfos, List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus = LocationStatusEnum.Lock, List<Dt_Task>? tasks = null)
         {
             try
@@ -324,6 +351,11 @@
             return (true, "鎴愬姛");
         }
 
+        /// <summary>
+        /// 鎾ら攢閿佸畾搴撳瓨
+        /// </summary>
+        /// <param name="orderDetailId"></param>
+        /// <returns></returns>
         public WebResponseContent RevokeLockOutboundStock(int orderDetailId)
         {
             Dt_OutboundOrderDetail outboundOrderDetail = BaseDal.QueryFirst(x => x.Id == orderDetailId);

--
Gitblit v1.9.3