1
yangpeixing
3 天以前 aa4aa67abfdf69e30d5076451716e5aba11d5ec0
WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/NewOutboundOrderDetailService.cs
@@ -30,7 +30,7 @@
        /// <summary>
        /// 低温、药水库存分配
        /// 成品分配
        /// </summary>
        /// <param name="outboundOrderDetails"></param>
        /// <returns></returns>
@@ -64,7 +64,7 @@
                foreach (var stockInfoDetail in dt_StockInfoDetails)
                {
                    dt_StockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.Id == stockInfoDetail.StockId && x.StockStatus == StockStatusEmun.入库完成.ObjToInt());
                    if (dt_StockInfo != null)
                    if (dt_StockInfo != null && !PalletCodes.Any(x => x == dt_StockInfo.PalletCode))
                    {
                        PalletCodes.Add(dt_StockInfo.PalletCode);
                    }
@@ -114,12 +114,9 @@
                }
                List<Dt_StockInfo> autoAssignStocks = new List<Dt_StockInfo>();
                List<IStockInfoService.residueQuantity> newResidueQuantitys = new List<IStockInfoService.residueQuantity>();
                if (warehouse.Any(x => x.WarehouseCode.Contains("DW")) || warehouse.Any(x => x.WarehouseCode.Contains("YS")))
                {
                    autoAssignStocks = _stockService.StockInfoService.CPGetOutboundStocks(stockInfos, dt_OutboundOrderDetails, out List<IStockInfoService.residueQuantity> residueQuantitys);
                    newResidueQuantitys.AddRange(residueQuantitys);
                    outStocks.AddRange(autoAssignStocks);
                }
                autoAssignStocks = _stockService.StockInfoService.CPGetOutboundStocks(stockInfos, dt_OutboundOrderDetails, out List<IStockInfoService.residueQuantity> residueQuantitys);
                newResidueQuantitys.AddRange(residueQuantitys);
                outStocks.AddRange(autoAssignStocks);
                foreach (var residueQuantity in newResidueQuantitys)
                {
                    foreach (var item in dt_OutboundOrderDetails)
@@ -130,7 +127,7 @@
                            decimal needQuantity = originalNeedQuantity - item.LockQuantity;
                            item.LockQuantity += needQuantity - residueQuantity.NewNeendQuantity;
                            //item.LockQuantity += needQuantity - residueQuantity.NewNeendQuantity;
                            decimal assignQuantity = needQuantity - residueQuantity.NewNeendQuantity;
@@ -149,11 +146,9 @@
                                        palletAssignQuantity = outStockLockInfos.Where(x => x.MaterielCode == item.MaterielCode && x.PalletCode == autoAssignStocks[j].PalletCode).Sum(x => x.AssignQuantity);//出库详情已分配数量
                                    }
                                    decimal palletOutboundQuantity = 0;
                                    if (warehouse.Any(x => x.WarehouseCode.Contains("DW")) || warehouse.Any(x => x.WarehouseCode.Contains("YS")))
                                    {
                                        palletOutboundQuantity = autoAssignStocks[j].Details.Where(x => x.MaterielCode == item.MaterielCode).Sum(x => x.OutboundQuantity);
                                    }
                                    palletOutboundQuantity = autoAssignStocks[j].Details.Where(x => x.MaterielCode == item.MaterielCode).Sum(x => x.OutboundQuantity);
                                    if (palletAssignQuantity < palletOutboundQuantity)//如果出库详情已分配数量小于托盘已分配数量,则可以继续添加该托盘出库信息
                                    {
                                        decimal orderDetailNeedQuantity = details[i].OrderQuantity - detailAssignQuantity;