wangxinhui
2025-11-12 f54b7815d8451f362554e3d2d09b4991ce13d4ff
ÏîÄ¿´úÂë/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderDetailService.cs
@@ -79,7 +79,7 @@
                    throw new Exception($"未找到可分配库存");
                }
                //分配实际库存
                List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, needQuantity).OrderBy(x => x.StockLength - x.StockOutLength).ToList();
                List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, needQuantity).ToList();
                //添加库存分配
                outStocks.AddRange(autoAssignStocks);
                //获取所有该物料单据
@@ -104,13 +104,11 @@
                        Dt_OutSGOrder? sGOrder = outBSTOrders.FirstOrDefault(x => x.Id == details[i].OutSGOrderId);
                        if (orderDetailNeedQuantity > useStockLength)
                        {
                            //生成详情
                            Dt_OutStockLockInfo outStockLockInfo = _outStockLockInfoService.GetOutStockLockInfo(sGOrder, details[i], autoAssignStocks[0], useStockLength);
                            outStockLockInfos.Add(outStockLockInfo);
                            details[i].AssignTotalUsage += useStockLength;
                            autoAssignStocks.Remove(autoAssignStocks[0]);
                        }
                        else
                        {