| | |
| | | { |
| | | 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(); |
| | | |
| | |
| | | { |
| | | 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; |
| | |
| | | { |
| | | ids = item.LinId; |
| | | var postContent = new MultipartFormDataContent(); |
| | | postContent.Headers.Add("ContentType", $"multipart/form-data"); |
| | | postContent.Add(new StringContent(ids), "ids"); |
| | | string result = string.Empty; |
| | | HttpClient client = null; |
| | |
| | | { |
| | | using (client = new HttpClient()) |
| | | { |
| | | HttpResponseMessage response = client.PostAsync(ToCancelOutFeedbackERP, postContent) |
| | | .ConfigureAwait(false).GetAwaiter().GetResult(); |
| | | // 2. 发送请求 |
| | | string url = $"{ToCancelOutFeedbackERP}?ids={Uri.EscapeDataString(ids)}"; |
| | | var response = HttpHelper.Post<WebResponseContent>(url, "出库明细取消回传ERP"); |
| | | |
| | | // 确保响应成功 |
| | | response.EnsureSuccessStatusCode(); |
| | | result = response.Content.ReadAsStringAsync() |
| | | .ConfigureAwait(false).GetAwaiter().GetResult(); |
| | | if (response.Code !=0) |
| | | { |
| | | throw new Exception($"操作失败: {response.msg ?? "未提供错误信息"}"); |
| | | } |
| | | } |
| | | _unitOfWorkManage.BeginTran(); |
| | | _outboundRepository.OutboundOrderDetailRepository.DeleteAndMoveIntoHty(outboundOrderDetails, OperateType.人工取消); |