| | |
| | | using WIDESEA_DTO.Order; |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_DTO.WMS; |
| | | using WIDESEA_IBusinessesRepository; |
| | | using WIDESEA_IOrderRepository; |
| | | using WIDESEA_IOrderServices; |
| | | using WIDESEA_IStorageBasicRepository; |
| | |
| | | using WIDESEA_IStorageTaskRepository; |
| | | using WIDESEA_IStorageTaskServices; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Model.Models.ERP; |
| | | using WIDESEA_Model.Models.Order; |
| | | using WIDESEA_OrderRepository; |
| | | using WIDESEA_StorageTaskRepository; |
| | |
| | | private readonly ILocationInfoRepository _locationRepository; |
| | | private readonly IDt_TaskRepository _taskRepository; |
| | | private readonly ILocationStatusChangeRecordRepository _locationStatusChangeRecordRepository; |
| | | private readonly IDt_OrderOutDetailsRepository _outDetailsRepository; |
| | | private readonly IDt_AreaInfoRepository _areaInfoRepository; |
| | | |
| | | public Dt_AllocateOutboundOrderService(IDt_AllocateOutboundOrderRepository BaseDal, |
| | | IUnitOfWorkManage unitOfWorkManage, |
| | |
| | | IDt_TaskService taskService, |
| | | ILocationInfoRepository locationRepository, |
| | | IDt_TaskRepository taskRepository, |
| | | ILocationStatusChangeRecordRepository locationStatusChangeRecordRepository) : base(BaseDal) |
| | | ILocationStatusChangeRecordRepository locationStatusChangeRecordRepository, |
| | | IDt_OrderOutDetailsRepository outDetailsRepository, |
| | | IDt_AreaInfoRepository areaInfoRepository) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _allocateoutboundOrderDetailRepository = allocateoutboundOrderDetailRepository; |
| | |
| | | _locationRepository = locationRepository; |
| | | _taskRepository = taskRepository; |
| | | _locationStatusChangeRecordRepository = locationStatusChangeRecordRepository; |
| | | _outDetailsRepository = outDetailsRepository; |
| | | _areaInfoRepository = areaInfoRepository; |
| | | } |
| | | |
| | | public WebResponseContent GetAllocateOutboundOrder(OutboundOrderGetDTO outboundOrderGetDTO) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | { |
| | | foreach (var orderId in requestOut.orderIds) |
| | | { |
| | | Dt_AreaInfo areaInfo = null; |
| | | if (requestOut.AreaId != null) |
| | | areaInfo = _areaInfoRepository.QueryFirst(x => x.AreaID == Convert.ToInt32(requestOut.AreaId)); |
| | | |
| | | |
| | | List<RequestTaskDto> taskDtos = new List<RequestTaskDto>(); |
| | | Dt_AllocateOutboundOrderDetail allocateoutboundOrderdetail = _allocateoutboundOrderDetailRepository.QueryFirst(x => x.Id == orderId); |
| | | Dt_AllocateOutboundOrder outboundOrder = BaseDal.QueryFirst(x => x.Id == allocateoutboundOrderdetail.OrderId); |
| | |
| | | |
| | | if (result.Item1.Count <= 0) |
| | | { |
| | | return content.Error("æªæ¾å°åºååé
ï¼è¯·ç¡®è®¤æ¯å¦åå¨åºåæåæ®æ°éå·²åºå®"); |
| | | return content.Error($"订å{outboundOrder.UpperOrderNo}ç©æç¼ç {allocateoutboundOrderdetail.MaterielCode}æªæ¾å°åºååé
ï¼è¯·ç¡®è®¤æ¯å¦åå¨åºåæåæ®æ°éå·²åºå®"); |
| | | } |
| | | |
| | | List<Dt_OrderOutDetails> outDetails = new List<Dt_OrderOutDetails>(); |
| | | result.Item1.Distinct().ForEach(item => |
| | | { |
| | | RequestTaskDto task = new RequestTaskDto |
| | |
| | | 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() |
| | | { |
| | | 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), |
| | | }); |
| | | }); |
| | | List<Dt_Task> taskNews = new List<Dt_Task>(); |
| | | List<WMSTaskDTO> taskDTOs = new List<WMSTaskDTO>(); |
| | |
| | | await _locationStatusChangeRecordRepository.AddDataAsync(locationStatusChangeRecords); |
| | | await _locationRepository.UpdateDataAsync(locations); |
| | | _allocateoutboundOrderDetailRepository.UpdateData(result.Item2); |
| | | _outDetailsRepository.AddData(outDetails); |
| | | }); |
| | | content = await _taskService.SendWCSTask(taskDTOs); |
| | | } |