| | |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Common.TaskEnum; |
| | | using WIDESEA_Common.WareHouseEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO.Task; |
| | |
| | | var palletCode = saveModel.MainData["barcode"].ToString(); |
| | | var warehouseId = saveModel.MainData["warehouseId"].ObjToInt(); |
| | | var stationCode = saveModel.MainData["startPoint"].ToString(); |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == warehouseId); |
| | | if (warehouse == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°åºåº"); |
| | | } |
| | | Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode && x.WarehouseId == warehouseId); |
| | | if (task != null) |
| | | { |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"ä»åºä¸æ£ç¡®"); |
| | | } |
| | | |
| | | Dt_Task newTask = new Dt_Task() |
| | | if (warehouse.WarehouseCode == WarehouseEnum.HA60.ToString()) |
| | | { |
| | | CurrentAddress = stationCode, |
| | | Grade = 0, |
| | | NextAddress = "", |
| | | PalletCode = palletCode, |
| | | Roadway = "", |
| | | SourceAddress = stationCode, |
| | | TargetAddress = "", |
| | | TaskType = TaskTypeEnum.Inbound.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | PalletType = stockInfo.PalletType |
| | | }; |
| | | |
| | | if (stockInfo.StockStatus == StockStatusEmun.æå¨ç»çæå.ObjToInt()) |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.æå¨ç»çå
¥åºç¡®è®¤.ObjToInt(); |
| | | Dt_LocationInfo locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.WarehouseId == warehouseId); |
| | | if (locationInfo == null) return WebResponseContent.Instance.Error($"æªæ¾å°å½ååºåºè´§ä½ä¿¡æ¯"); |
| | | return DeviceRequestInboundTask(stationCode, locationInfo.RoadwayNo, palletCode); |
| | | } |
| | | else |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(); |
| | | Dt_Task newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = stationCode, |
| | | Grade = 0, |
| | | NextAddress = "", |
| | | PalletCode = palletCode, |
| | | Roadway = "", |
| | | SourceAddress = stationCode, |
| | | TargetAddress = "", |
| | | TaskType = TaskTypeEnum.Inbound.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | PalletType = stockInfo.PalletType |
| | | }; |
| | | |
| | | if (stockInfo.StockStatus == StockStatusEmun.æå¨ç»çæå.ObjToInt()) |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.æå¨ç»çå
¥åºç¡®è®¤.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(); |
| | | } |
| | | _unitOfWorkManage.BeginTran(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | PushTasksToWCS(new List<Dt_Task> { newTask }); |
| | | return WebResponseContent.Instance.OK(data: newTask); |
| | | } |
| | | _unitOfWorkManage.BeginTran(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | PushTasksToWCS(new List<Dt_Task> { newTask }); |
| | | return WebResponseContent.Instance.OK(data: newTask); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(); |
| | | } |
| | | LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; |
| | | _unitOfWorkManage.BeginTran(); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.Lock, LocationChangeType.InboundAssignLocation); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)newTask.PalletType, LocationStatusEnum.Lock, newTask.WarehouseId); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | WMSTaskDTO wMSTaskDTO = _mapper.Map<WMSTaskDTO>(newTask); |
| | | |
| | | //PushTasksToWCS(new List<Dt_Task> { newTask }); |
| | | PushTasksToWCS(new List<Dt_Task> { newTask }); |
| | | return WebResponseContent.Instance.OK(data: wMSTaskDTO); |
| | | } |
| | | catch (Exception ex) |