wangxinhui
2025-11-18 b513ce3a4527e998da66c6f179a279472c7262a8
ÏîÄ¿´úÂë/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderDetailService.cs
@@ -76,10 +76,10 @@
                List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(item.MaterialNo, item.Width, outBSTOrders.FirstOrDefault().WarehouseId).Where(x=>!outStocks.Select(x=>x.PalletCode).Contains(x.PalletCode)).ToList();
                if (!stockInfos.Any())
                {
                    throw new Exception($"未找到可分配库存");
                    continue;
                }
                //分配实际库存
                List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, needQuantity).ToList();
                List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutOldStocks(stockInfos, needQuantity).ToList();
                //添加库存分配
                outStocks.AddRange(autoAssignStocks);
                //获取所有该物料单据
@@ -100,6 +100,11 @@
                        decimal orderDetailNeedQuantity = details[i].XqLen - detailAssignQuantity;
                        if (autoAssignStocks.Count==0)
                        {
                            break;
                        }
                        decimal useStockLength = autoAssignStocks[0].StockLength- autoAssignStocks[0].StockOutLength;
                        Dt_OutSGOrder? sGOrder = outBSTOrders.FirstOrDefault(x => x.Id == details[i].OutSGOrderId);
                        if (orderDetailNeedQuantity > useStockLength)