From b1a419c2886666934da6499ee552516d0769562e Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期四, 16 四月 2026 13:40:56 +0800
Subject: [PATCH] Merge branch 'htq20251215' of http://115.159.85.185:8098/r/ZhongRui/ALDbanyunxiangmu into htq20251215

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundQueryService.cs |   29 +++++++++++++++++++++++++----
 1 files changed, 25 insertions(+), 4 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundQueryService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundQueryService.cs"
index 6f2ee51..73a7aa1 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundQueryService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundQueryService.cs"
@@ -4,6 +4,7 @@
 using System.Text;
 using System.Threading.Tasks;
 using SqlSugar;
+using SqlSugar.Extensions;
 using WIDESEA_Common.StockEnum;
 using WIDESEA_Core;
 using WIDESEA_DTO.CalcOut;
@@ -70,13 +71,28 @@
                     .QueryData(x => x.PalletCode == palletCode && x.OrderNo == orderNo);
 
                 bool isMatMixed = false;
+                bool orderOver = false;
+                decimal sumQty = 0;
                 if (stockInfo != null && stockInfo.Details != null && stockInfo.Details.Any())
                 {
                     if (outStockLockInfos.FirstOrDefault() != null)
                     {
                         bool includeBatchNo = !string.IsNullOrEmpty(outStockLockInfos.FirstOrDefault().BatchNo);
                         bool includeSupplyCode = !string.IsNullOrEmpty(outStockLockInfos.FirstOrDefault().SupplyCode);
-
+                        var orderId = outStockLockInfos.FirstOrDefault().OrderDetailIds.Split(",");
+                        foreach (var item in orderId)
+                        {
+                            Dt_OutboundOrderDetail outboundOrderDetail = _outboundRepository.Db.Queryable<Dt_OutboundOrderDetail>().Where(x=>x.Id == item.ObjToInt()).First();
+                            if(outboundOrderDetail == null)
+                            {
+                                return WebResponseContent.Instance.Error("璇ユ墭鐩樼殑鍑哄簱鏄庣粏鏈壘鍒�");
+                            }
+                            sumQty += (outboundOrderDetail.OrderQuantity - outboundOrderDetail.OverOutQuantity - outboundOrderDetail.MoveQty);
+                        }
+                        if(sumQty < outStockLockInfos.FirstOrDefault().AssignQuantity)
+                        {
+                            orderOver = true;
+                        }
                         if (includeBatchNo && includeSupplyCode)
                         {
                             isMatMixed = stockInfo.Details.GroupBy(x => new
@@ -126,12 +142,17 @@
                             x.MaterielName,
                             x.WarehouseCode
                         }).Count() > 1;
+
+                        Dt_OutStockLockInfo outStockLockInfo = _outboundLockInfoRepository.QueryFirst(x=>x.PalletCode == palletCode);
+
+                        if (outStockLockInfo != null)
+                        {
+                            return WebResponseContent.Instance.Error($"璇ユ墭鐩樺湪璇ュ崟鎹腑鏃犳嫞閫夎褰曪紝璇峰墠寰�{outStockLockInfo.OrderNo}鍗曟嵁涓繘琛屾嫞璐ф搷浣�");
+                        }
                     }
                 }
 
-                
-
-                return WebResponseContent.Instance.OK(data: new { outStockLockInfos, stockInfo, isMatMixed });
+                return WebResponseContent.Instance.OK(data: new { outStockLockInfos, stockInfo, isMatMixed, orderOver });
             }
             catch (Exception ex)
             {

--
Gitblit v1.9.3