| | |
| | | foreach (var orderId in requestOut.orderIds) |
| | | { |
| | | Dt_AreaInfo areaInfo = null; |
| | | if (requestOut.AreaId != null) |
| | | areaInfo = _areaInfoRepository.QueryFirst(x => x.AreaID == Convert.ToInt32(requestOut.AreaId)); |
| | | if (requestOut.Warehouse != "") |
| | | areaInfo = _areaInfoRepository.QueryFirst(x => x.AreaCode == requestOut.Warehouse); |
| | | |
| | | |
| | | List<RequestTaskDto> taskDtos = new List<RequestTaskDto>(); |
| | |
| | | MaterielCode = allocateoutboundOrderdetail.MaterielCode, |
| | | Position = item.LocationCode, |
| | | PalletCode = item.PalletCode, |
| | | AreaId = Convert.ToInt32(requestOut.AreaId), |
| | | //AreaId = Convert.ToInt32(requestOut.AreaId), |
| | | AreaId = Convert.ToInt32(2), |
| | | }; |
| | | taskDtos.Add(task); |
| | | item.StockInfoDetails.Where(x => x.MaterielCode == allocateoutboundOrderdetail.MaterielCode).FirstOrDefault().Status = (int)StockStateEmun.åºåºéå®; |
| | | item.StockStatus = (int)StockStateEmun.åºåºéå®; |
| | | item.Remark = requestOut.Warehouse; |
| | | item.OrderNo = outboundOrder.UpperOrderNo; |
| | | outDetails.Add(new Dt_OrderOutDetails() |
| | | |
| | | item.StockInfoDetails.Where(x => x.OutboundQuantity > 0 && x.MaterielCode == allocateoutboundOrderdetail.MaterielCode).ForEach(x => |
| | | { |
| | | OrderNo = outboundOrder.UpperOrderNo, |
| | | PalletCode = item.PalletCode, |
| | | OrderType = outboundOrder.OrderType, |
| | | ERPOrderId = allocateoutboundOrderdetail.ERPOrderId, |
| | | MaterielCode = allocateoutboundOrderdetail.MaterielCode, |
| | | MaterielName = allocateoutboundOrderdetail.MaterielName, |
| | | AllocateWarehouse = areaInfo == null ? item.StockInfoDetails.Where(x => x.MaterielCode == allocateoutboundOrderdetail.MaterielCode).FirstOrDefault().Warehouse : areaInfo.AreaName, |
| | | AllocateWarehouseId = areaInfo == null ? item.StockInfoDetails.Where(x => x.MaterielCode == allocateoutboundOrderdetail.MaterielCode).FirstOrDefault().WareHouseId : areaInfo.AreaCode, |
| | | Warehouse = "æºè½ç«åº", |
| | | WareHouseId = "107", |
| | | OutboundQuantity = item.StockInfoDetails.Where(x => x.MaterielCode == allocateoutboundOrderdetail.MaterielCode).Sum(x => x.Quantity), |
| | | outDetails.Add(new Dt_OrderOutDetails() |
| | | { |
| | | OrderNo = outboundOrder.UpperOrderNo, |
| | | PalletCode = item.PalletCode, |
| | | OrderType = outboundOrder.OrderType, |
| | | ERPOrderId = allocateoutboundOrderdetail.ERPOrderId, |
| | | MaterielCode = allocateoutboundOrderdetail.MaterielCode, |
| | | MaterielName = allocateoutboundOrderdetail.MaterielName, |
| | | AllocateWarehouse = areaInfo == null ? item.StockInfoDetails.Where(x => x.MaterielCode == allocateoutboundOrderdetail.MaterielCode).FirstOrDefault().Warehouse : areaInfo.AreaName, |
| | | AllocateWarehouseId = areaInfo == null ? item.StockInfoDetails.Where(x => x.MaterielCode == allocateoutboundOrderdetail.MaterielCode).FirstOrDefault().WareHouseId : areaInfo.AreaCode, |
| | | Warehouse = "æºè½ç«åº", |
| | | WareHouseId = "107", |
| | | OutboundQuantity = x.OutboundQuantity, |
| | | }); |
| | | }); |
| | | }); |
| | | List<Dt_Task> taskNews = new List<Dt_Task>(); |
| | |
| | | foreach (var item in taskDtos) |
| | | { |
| | | taskNews.Add(await _taskService.RequestOutboundTaskAsync(item)); |
| | | |
| | | } |
| | | List<DtLocationStatusChangeRecord> locationStatusChangeRecords = new List<DtLocationStatusChangeRecord>(); |
| | | List<DtLocationInfo> locations = new List<DtLocationInfo>(); |
| | | if(taskNews.Count <= 0) |
| | | { |
| | | throw new Exception($"{allocateoutboundOrderdetail.MaterielCode}æªæ¾å°å¯åºåºæç"); |
| | | } |
| | | foreach (var item in taskNews) |
| | | { |
| | | taskDTOs.Add(CreateTaskDTO(item)); |
| | |
| | | locations.AddRange(result1.Item2); |
| | | locations.AddRange(result2.Item2); |
| | | } |
| | | |
| | | outboundOrder.OrderStatus = (int)OrderStateEmun.å¼å§; |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | BaseDal.UpdateData(outboundOrder); |
| | | _taskRepository.AddData(taskNews); |
| | | _stockInfoRepository.UpdateDataNav(result.Item1); |
| | | await _locationStatusChangeRecordRepository.AddDataAsync(locationStatusChangeRecords); |
| | |
| | | |
| | | } |
| | | allocateoutboundOrderdetail.OverOutQuantity = allocateoutboundOrderdetail.OrderQuantity - needQuantity; |
| | | allocateoutboundOrderdetail.NotOutQuantity = allocateoutboundOrderdetail.OrderQuantity - allocateoutboundOrderdetail.OverOutQuantity; |
| | | |
| | | if (allocateoutboundOrderdetail.OverOutQuantity != 0) |
| | | { |
| | | allocateoutboundOrderdetail.OrderDetailStatus = (int)OrderStateEmun.å¼å§; |
| | | } |
| | | if (allocateoutboundOrderdetail.OverOutQuantity == allocateoutboundOrderdetail.OrderQuantity) |
| | | { |
| | | allocateoutboundOrderdetail.OrderDetailStatus = (int)OrderStateEmun.已宿; |
| | | } |
| | | return (outStockNews, allocateoutboundOrderdetail); |
| | | } |
| | | |