1
wangxinhui
2 天以前 0023d3db5bd701864b73e57c0240c219c40c3a4e
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/ProStockInfoService.cs
@@ -339,47 +339,6 @@
                    index++;
                }
            }
            else
            {
                for (int i = 0; i < stockInfos.Count; i++)
                {
                    Dt_ProStockInfo stockInfo = stockInfos[i];
                    float useableStockQuantity = stockInfo.proStockInfoDetails
                        .Where(x => x.SaleOrder == mesRworkOutboundOrder.SaleOrder
                            && x.ProductCode == mesRworkOutboundOrder.ProductCode
                            && x.ProductVersion == mesRworkOutboundOrder.ProductVersion
                            && (isCanDate ? isCanDate : x.DateCode == mesRworkOutboundOrder.DateCode))
                        .Sum(x => x.StockPcsQty - x.OutboundQuantity);
                    if (useableStockQuantity < needQuantity)
                    {
                        stockInfo.proStockInfoDetails.ForEach(x => x.OutboundQuantity = x.StockPcsQty);
                        needQuantity -= useableStockQuantity;
                    }
                    else
                    {
                        stockInfo.proStockInfoDetails.ForEach(x =>
                        {
                            if (x.StockPcsQty > x.OutboundQuantity && x.SaleOrder == mesRworkOutboundOrder.SaleOrder
                                && x.ProductCode == mesRworkOutboundOrder.ProductCode
                                && x.ProductVersion == mesRworkOutboundOrder.ProductVersion
                                && (isCanDate ? isCanDate : x.DateCode == mesRworkOutboundOrder.DateCode))
                            {
                                if (x.StockPcsQty - x.OutboundQuantity >= needQuantity)
                                {
                                    x.OutboundQuantity += needQuantity;
                                    needQuantity = 0;
                                }
                                else
                                {
                                    needQuantity -= (x.StockPcsQty - x.OutboundQuantity);
                                    x.OutboundQuantity = x.StockPcsQty;
                                }
                            }
                        });
                    }
                    assignOutStocks.Add(stockInfo);
                }
            }
            residueQuantity = needQuantity;
            return assignOutStocks;
        }