liulijun
2026-03-12 7dcd8da0f2467d077551ddd39f33be5836dd80a9
ÏîÄ¿´úÂë/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderDetailService.cs
@@ -5,8 +5,10 @@
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common.LocationEnum;
using WIDESEA_Common.StockEnum;
using WIDESEA_Core;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Helper;
using WIDESEA_IBasicRepository;
using WIDESEA_IBasicService;
using WIDESEA_IOutboundRepository;
@@ -72,8 +74,10 @@
            foreach (var item in groupDetails)
            {
                decimal needQuantity = item.XqLen;
                //获取可用库存
                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();
                //获取老厂缓存可用库存
                List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseOldCacheStocks(item.MaterialNo, item.Width) ?? new List<Dt_StockInfo>();
                //获取立库可用库存
                stockInfos.AddRange(_stockService.StockInfoService.GetUseableStocks(item.MaterialNo, item.Width, outBSTOrders.FirstOrDefault().WarehouseId).Where(x=>!outStocks.Select(x=>x.PalletCode).Contains(x.PalletCode)).ToList());
                if (!stockInfos.Any())
                {
                    continue;
@@ -90,7 +94,11 @@
                });
                for (int i = 0; i < details.Count; i++)
                {
                    //订单数量
                    ////订单数量
                    //if ((details.Count-1) == i)
                    //{
                    //}
                    decimal orderQuantity = details[i].XqLen;
                    bool assignStop = true;
                    while (assignStop)
@@ -132,7 +140,7 @@
                    
                }
                locationInfos.AddRange(_basicRepository.LocationInfoRepository.GetLocationInfos(outStocks.Select(x => x.LocationCode).ToList()));
                locationInfos.AddRange(_basicRepository.LocationInfoRepository.GetLocationInfos(outStocks.Where(x=>!x.LocationCode.IsNullOrEmpty() && !locationInfos.Select(x=>x.LocationCode).Contains(x.LocationCode)).Select(x => x.LocationCode).ToList()));
            }
            return (outStocks, outboundOrderDetails, outStockLockInfos, locationInfos);
@@ -144,6 +152,10 @@
        {
            try
            {
                stockInfos.Where(x => x.LocationCode.IsNullOrEmpty()).ToList().ForEach(x =>
                {
                    x.StockStatus = StockStatusEmun.出库完成.ObjToInt();
                });
                _stockService.StockInfoService.Repository.UpdateData(stockInfos);
                BaseDal.UpdateData(outboundOrderDetails);
@@ -159,6 +171,9 @@
                    }
                    _outStockLockInfoService.Repository.AddData(addOutStockLockInfos);
                    List<Dt_OutStockLockInfo> addOutCacheInfos = addOutStockLockInfos.Where(x => x.LocationCode.Contains("老厂缓存区")).ToList();
                    List<Dt_OutLineView> outLineViewsAdd = addOutCacheInfos.Select(x => _mapper.Map<Dt_OutLineView>(x)).ToList();
                    _outboundRepository.OutLineViewRepository.AddData(outLineViewsAdd);
                }
                List<Dt_OutStockLockInfo> updateOutStockLockInfos = outStockLockInfos.Where(x => x.Id > 0).ToList();
                if (updateOutStockLockInfos != null && updateOutStockLockInfos.Any())