1
yangpeixing
2026-01-19 c6f6be2d942214580e61c2647c846d7e11e06f48
WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs
@@ -355,11 +355,21 @@
                {
                    throw new Exception($"未找到可分配库存");
                }
                List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, item.MaterielCode, needQuantity, out decimal residueQuantity);
                item.LockQuantity += needQuantity - residueQuantity;
                List<Dt_StockInfo> autoAssignStocks = new List<Dt_StockInfo>();
                decimal newResidueQuantity = 0;
                if (warehouse.Any(x => x.WarehouseCode.Contains("DW")) || warehouse.Any(x => x.WarehouseCode.Contains("YS")))
                {
                    autoAssignStocks = _stockService.StockInfoService.DWANDYSGetOutboundStocks(stockInfos, item.MaterielCode, item.BatchNo, needQuantity,out decimal residueQuantity);
                    newResidueQuantity = residueQuantity;
                }
                else
                {
                    autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, item.MaterielCode, needQuantity, out decimal residueQuantity);
                    newResidueQuantity = residueQuantity;
                }
                item.LockQuantity += needQuantity - newResidueQuantity;
                outStocks.AddRange(autoAssignStocks);
                decimal assignQuantity = needQuantity - residueQuantity;
                decimal assignQuantity = needQuantity - newResidueQuantity;
                List<Dt_OutboundOrderDetail> details = outboundOrderDetails.Where(x => !string.IsNullOrEmpty(x.BatchNo) ? x.BatchNo == item.BatchNo : true && x.MaterielCode == item.MaterielCode).ToList();
@@ -375,7 +385,17 @@
                        {
                            palletAssignQuantity = outStockLockInfos.Where(x => x.MaterielCode == item.MaterielCode && x.PalletCode == autoAssignStocks[j].PalletCode).Sum(x => x.AssignQuantity);//出库详情已分配数量
                        }
                        decimal palletOutboundQuantity = autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity);
                        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.BatchNo == item.BatchNo).Sum(x => x.OutboundQuantity);
                        }
                        else
                        {
                             palletOutboundQuantity = autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity);
                        }
                        if (palletAssignQuantity < palletOutboundQuantity)//如果出库详情已分配数量小于托盘已分配数量,则可以继续添加该托盘出库信息
                        {
                            decimal orderDetailNeedQuantity = details[i].OrderQuantity - detailAssignQuantity;
@@ -506,7 +526,8 @@
                    using (client = new HttpClient())
                    {
                        // 2. 发送请求
                        var response = HttpHelper.Post<WebResponseContent>(ToCancelOutFeedbackERP, postContent, "出库明细取消回传ERP");
                        string url = $"{ToCancelOutFeedbackERP}?ids={Uri.EscapeDataString(ids)}";
                        var response = HttpHelper.Post<WebResponseContent>(url, "出库明细取消回传ERP");
                        if (response.Code !=0)
                        {