| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_BasicService; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.OrderEnum; |
| | |
| | | { |
| | | try |
| | | { |
| | | Dt_Task dbtask = Repository.QueryFirst(x => x.PalletCode == palletCode); |
| | | Dt_Task dbtask = Repository.Db.Queryable<Dt_Task>().Where(x => x.PalletCode == palletCode).OrderByDescending(x=>x.CreateDate).First(); |
| | | if (dbtask != null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçå·²çæä»»å¡"); |
| | | } |
| | | _logger.LogInformation($"ä»»å¡ç±»å{dbtask.TaskType.ToString()} ,{dbtask.TaskNum} "); |
| | | if (dbtask.TaskType == TaskTypeEnum.Outbound.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"åºåºå¾
忣任å¡"); |
| | | } |
| | | else if (dbtask.TaskType == TaskTypeEnum.OutAllocate.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"åºåºå¾
忣任å¡"); |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçå·²çæä»»å¡"); |
| | | } |
| | | } |
| | | |
| | | Dt_StockInfo stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First(); |
| | | if (stockInfo == null) |
| | |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç»çä¿¡æ¯"); |
| | | } |
| | | |
| | | if (stockInfo.StockStatus != StockStatusEmun.ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æå¨ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æ£é宿.ObjToInt()) |
| | | if (stockInfo.StockStatus != StockStatusEmun.ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æå¨ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æ£é宿.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æºä»å
¥æºä»ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鿣åºå宿.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçç¶æä¸æ£ç¡®,ä¸å¯ç³è¯·å
¥åº"); |
| | | } |
| | |
| | | return WebResponseContent.Instance.Error($"è´§ä½åé
失败,æªæ¾å°å¯åé
è´§ä½"); |
| | | } |
| | | |
| | | |
| | | var newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = stationCode, |
| | | { |
| | | CurrentAddress = stations.GetValueOrDefault(stationCode) ?? "", |
| | | Grade = 0, |
| | | NextAddress = stations.GetValueOrDefault(stationCode) ?? "", |
| | | NextAddress = locationInfo.LocationCode, |
| | | PalletCode = palletCode, |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stationCode, |
| | | SourceAddress = stations.GetValueOrDefault(stationCode) ?? "", |
| | | TargetAddress = locationInfo.LocationCode, |
| | | TaskType = TaskTypeEnum.Inbound.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | PalletType = stockInfo.PalletType, |
| | | OrderNo= stockInfo.Details.FirstOrDefault()?.OrderNo |
| | | |
| | | OrderNo= stockInfo.Details.FirstOrDefault()?.OrderNo, |
| | | }; |
| | | //空箱 |
| | | if (stockInfo.PalletType == PalletTypeEnum.Empty.ObjToInt()) |
| | | if (stockInfo.PalletType == PalletTypeEnum.Empty.ObjToInt()|| stockInfo.StockStatus == StockStatusEmun.æºä»å
¥æºä»ç»çæå.ObjToInt() || stockInfo.StockStatus == StockStatusEmun.鿣åºå宿.ObjToInt()) |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | newTask.TaskType = TaskTypeEnum.InEmpty.ObjToInt(); |
| | | |
| | | if (stockInfo.StockStatus == StockStatusEmun.æºä»å
¥æºä»ç»çæå.ObjToInt()) |
| | | { |
| | | newTask.TaskType = TaskTypeEnum.AllocateInWarehouse.ObjToInt(); |
| | | } |
| | | if (stockInfo.StockStatus == StockStatusEmun.鿣åºå宿.ObjToInt()) |
| | | { |
| | | newTask.TaskType = TaskTypeEnum.InQuality.ObjToInt(); |
| | | } |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | |
| | |
| | | inboundOrder = _inboundOrderService.Repository.QueryFirst(x => x.InboundOrderNo == orderNo && x.OrderStatus < InOrderStatusEnum.å
¥åºå®æ.ObjToInt()); |
| | | |
| | | } |
| | | |
| | | |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(); |
| | | |
| | | LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; |
| | |
| | | _stockRepository.UpdateData(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | TaskModel esstask = new TaskModel() |
| | | await _eSSApiService.MoveContainerAsync(new WIDESEA_DTO.Basic.MoveContainerRequest |
| | | { |
| | | taskType = "putaway", |
| | | taskGroupCode = "", |
| | | groupPriority = 0, |
| | | tasks = new List<TasksType> |
| | | { |
| | | new() |
| | | { |
| | | taskCode=newTask.TaskNum.ToString(), |
| | | taskPriority=0, |
| | | taskDescribe=new TaskDescribeType{ |
| | | containerCode=palletCode, |
| | | containerType= "CT_KUBOT_STANDARD", |
| | | fromLocationCode=stations.GetValueOrDefault(stationCode)??"", |
| | | toStationCode="", |
| | | toLocationCode=locationInfo.LocationCode, |
| | | deadline=0,storageTag="" |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | |
| | | var result = await _eSSApiService.CreateTaskAsync(esstask); |
| | | slotCode = stationCode, |
| | | containerCode = palletCode |
| | | }); |
| | | |
| | | _logger.LogInformation("å建任å¡è¿å: " + result); |
| | | if (result) |
| | | { |
| | | try |
| | | { |
| | | await _eSSApiService.MoveContainerAsync(new WIDESEA_DTO.Basic.MoveContainerRequest |
| | | { |
| | | slotCode = stationCode, |
| | | containerCode = palletCode |
| | | }); |
| | | } |
| | | catch (Exception ex) { |
| | | |
| | | |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error("ä¸åæºå¨äººä»»å¡å¤±è´¥ï¼"); |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |