From dcecb039035f4b2e82e31c39b74db9402444c536 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期二, 08 四月 2025 21:35:39 +0800
Subject: [PATCH] 代码更新,优化等内容

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ProOutOrderDetailService.cs |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ProOutOrderDetailService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ProOutOrderDetailService.cs"
index 4e89f26..5ea4fd0 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ProOutOrderDetailService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ProOutOrderDetailService.cs"
@@ -123,12 +123,16 @@
                 //鑾峰彇鍑哄簱搴撳瓨
                 List<Dt_ProStockInfo> assignOutStocks = _stockInfoService.ProStockInfoService.GetOutboundStocks(stockInfoss, item, needQty, out float residueQuantity);
                 item.LockQtyPcs += needQty - residueQuantity;
+                if (item.QtyPcs> item.LockQtyPcs)
+                {
+                    throw new Exception($"浜у搧缂栫爜{item.PCode}鍙垎閰嶆暟閲忎笉瓒�,鍙敤鏁伴噺{item.LockQtyPcs}");
+                }
                 outStocks.AddRange(assignOutStocks);
                 float assignQuantity = needQty - residueQuantity;
                 bool isCanLot = string.IsNullOrEmpty(item.PLot);
                 bool isCanDate = string.IsNullOrEmpty(item.DateCode);
                 List<Dt_ProOutOrderDetail> details = proOutOrderDetails
-                    .Where(x => x.SaleOrder == item.SaleOrder && x.PCode == item.PCode && x.PVer == item.PVer
+                    .Where(x =>x.PCode == item.PCode && x.PVer == item.PVer
                     && (isCanLot ? isCanLot : x.PLot == item.PLot)
                     && (isCanDate ? isCanDate : x.DateCode == item.DateCode))
                     .ToList();
@@ -139,17 +143,17 @@
                     for (int j = 0; j < assignOutStocks.Count; j++)
                     {
                         //鍑哄簱璁㈠崟鏄庣粏宸插垎閰嶆暟閲�
-                        float detailAssignQuantity = outProStockInfos.Where(x => x.SaleOrder == item.SaleOrder && x.PCode == item.PCode && x.PVer == item.PVer
+                        float detailAssignQuantity = outProStockInfos.Where(x => x.PCode == item.PCode && x.PVer == item.PVer
                             && (isCanLot ? isCanLot : x.PLot == item.PLot)
                             && (isCanDate ? isCanDate : x.DateCode == item.DateCode)
                             && x.OrderDetailId == details[i].Id).Sum(x => x.AssignQuantity);
 
-                        float palletAssignQuantity = outProStockInfos.Where(x => x.SaleOrder == item.SaleOrder && x.PCode == item.PCode && x.PVer == item.PVer
+                        float palletAssignQuantity = outProStockInfos.Where(x => x.PCode == item.PCode && x.PVer == item.PVer
                             && (isCanLot ? isCanLot : x.PLot == item.PLot)
                             && (isCanDate ? isCanDate : x.DateCode == item.DateCode)
                             && x.PalletCode == assignOutStocks[j].PalletCode).Sum(x => x.AssignQuantity);
                         //鍑哄簱璇︽儏宸插垎閰嶆暟閲�
-                        palletAssignQuantity = outProStockInfos.Where(x => x.SaleOrder == item.SaleOrder && x.PCode == item.PCode && x.PVer == item.PVer
+                        palletAssignQuantity = outProStockInfos.Where(x => x.PCode == item.PCode && x.PVer == item.PVer
                             && (isCanLot ? isCanLot : x.PLot == item.PLot)
                             && (isCanDate ? isCanDate : x.DateCode == item.DateCode) 
                             && x.PalletCode == assignOutStocks[j].PalletCode).Sum(x => x.AssignQuantity);//鍑哄簱璇︽儏宸插垎閰嶆暟閲�

--
Gitblit v1.9.3