| | |
| | | |
| | | private Dictionary<string, OrderByType> _taskOrderBy = new() |
| | | { |
| | | {nameof(Dt_Task.Grade), OrderByType.Desc }, |
| | | {nameof(Dt_Task.Grade), OrderByType.Asc }, |
| | | {nameof(Dt_Task.CreateDate), OrderByType.Asc}, |
| | | }; |
| | | |
| | | |
| | | public Dictionary<string, OrderByType> TaskOrderBy |
| | | { get { return _taskOrderBy; } set { _taskOrderBy = value; } } |
| | | |
| | | |
| | | #region è·åææä»»å¡ç±»åãç¶æ |
| | | public List<int> TaskInboundTypes => typeof(TaskInboundTypeEnum).GetEnumIndexList(); |
| | | |
| | | public List<int> TaskOutboundTypes => typeof(TaskOutboundTypeEnum).GetEnumIndexList(); |
| | | public List<int> TaskRelocationboundTypes => typeof(TaskRelocationStatusEnum).GetEnumIndexList(); |
| | | public List<int> TaskAGVCarryboundTypes => typeof(TaskAGVCarryStatusEnum).GetEnumIndexList(); |
| | | public List<int> TaskAcrossFloorboundTypes => typeof(TaskAcrossFloorStatusEnum).GetEnumIndexList(); |
| | | public List<int> TaskRelocationboundTypes => typeof(TaskRelocationTypeEnum).GetEnumIndexList(); |
| | | public List<int> TaskAGVCarryboundTypes => typeof(TaskAGVCarryTypeEnum).GetEnumIndexList(); |
| | | public List<int> TaskAcrossFloorboundTypes => typeof(TaskAcrossFloorTypeEnum).GetEnumIndexList(); |
| | | |
| | | public List<int> TaskInboundStates => typeof(TaskInStatusEnum).GetEnumIndexList(); |
| | | |
| | | public List<int> TaskOutboundStates => typeof(TaskOutStatusEnum).GetEnumIndexList(); |
| | | public List<int> TaskRelocationboundStates => typeof(TaskRelocationStatusEnum).GetEnumIndexList(); |
| | | public List<int> TaskAGVCarryboundStates => typeof(TaskAGVCarryStatusEnum).GetEnumIndexList(); |
| | | public List<int> TaskAcrossFloorboundStates => typeof(TaskAcrossFloorStatusEnum).GetEnumIndexList(); |
| | | |
| | | #endregion è·åææä»»å¡ç±»åãç¶æ |
| | | |
| | | |
| | | public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ISys_ConfigService sys_ConfigService, IDt_StationManagerService stationManagerService, IDt_StationManagerRepository stationManagerRepository, IRouterRepository routerRepository, ITask_HtyRepository htyRepository) : base(BaseDal) |
| | | { |
| | |
| | | // 夿任å¡ç±»åæ¯å¦ä¸ºåºåºä»»å¡ |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.Roadway == "SC1"); |
| | | |
| | | task.TaskState = (int)TaskOutStatusEnum.OutNew; |
| | | |
| | | task.CurrentAddress = item.SourceAddress; |
| | | |
| | | task.NextAddress = station.stationChildCode; |
| | | |
| | | task.Floor = "1F"; |
| | | |
| | | task.AGVSign = ""; |
| | | } |
| | | // 夿任å¡ç±»åæ¯å¦ä¸ºå
¥åºä»»å¡ |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.Roadway == "SC1"); |
| | | |
| | | task.TaskState = (int)TaskInStatusEnum.InNew; |
| | | |
| | | task.CurrentAddress = item.SourceAddress; |
| | | |
| | | task.NextAddress = station.stationChildCode; |
| | | |
| | | task.Floor = "1F"; |
| | | |
| | | task.AGVSign= ""; |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) |
| | | { |
| | | task.TaskState = (int)TaskRelocationStatusEnum.RelocationNew; |
| | | |
| | | task.CurrentAddress = item.SourceAddress; |
| | | |
| | | task.NextAddress = task.TargetAddress; |
| | | |
| | | task.Floor = "1F"; |
| | | |
| | | task.AGVSign = ""; |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.CarryGroup) |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress); |
| | | |
| | | task.TaskState = (int)TaskAGVCarryStatusEnum.CarryNew; |
| | | |
| | | task.CurrentAddress = item.SourceAddress; |
| | | |
| | | task.NextAddress = task.TargetAddress; |
| | | |
| | | task.Floor = station.stationFloor; |
| | | |
| | | task.AGVSign = ""; |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.AcrossFloorGroup) |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress); |
| | | |
| | | if (station != null) |
| | | if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.OutbondGroup) |
| | | { |
| | | var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == station.stationFloor); |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.Roadway == "SC1"); |
| | | |
| | | task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew; |
| | | task.TaskState = (int)TaskOutStatusEnum.OutNew; |
| | | |
| | | task.CurrentAddress = item.SourceAddress; |
| | | |
| | | task.NextAddress = next.stationChildCode; |
| | | task.NextAddress = station.stationChildCode; |
| | | |
| | | task.Floor = "1F"; |
| | | |
| | | task.AGVSign = ""; |
| | | } |
| | | else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup) |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress); |
| | | |
| | | if (station != null) |
| | | { |
| | | var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == station.stationFloor); |
| | | |
| | | task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew; |
| | | |
| | | task.CurrentAddress = item.SourceAddress; |
| | | |
| | | task.NextAddress = next.stationChildCode; |
| | | |
| | | task.Floor = station.stationFloor; |
| | | |
| | | task.AGVSign = ""; |
| | | } |
| | | } |
| | | else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.CarryGroup) |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.TargetAddress); |
| | | |
| | | task.TaskState = (int)TaskAGVCarryStatusEnum.CarryNew; |
| | | |
| | | task.CurrentAddress = item.SourceAddress; |
| | | |
| | | task.NextAddress = task.TargetAddress; |
| | | |
| | | task.Floor = station.stationFloor; |
| | | |
| | | task.AGVSign = ""; |
| | | } |
| | | } |
| | | // 夿任å¡ç±»åæ¯å¦ä¸ºå
¥åºä»»å¡ |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.InboundGroup) |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.Roadway == "SC1"); |
| | | |
| | | task.TaskState = (int)TaskInStatusEnum.InNew; |
| | | |
| | | task.CurrentAddress = item.SourceAddress; |
| | | |
| | | task.NextAddress = station.stationChildCode; |
| | | |
| | | task.Floor = "1F"; |
| | | |
| | | task.AGVSign = ""; |
| | | } |
| | | else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup) |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress); |
| | | |
| | | if (station != null) |
| | | { |
| | | var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == station.stationFloor); |
| | | |
| | | task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew; |
| | | |
| | | task.CurrentAddress = item.SourceAddress; |
| | | |
| | | task.NextAddress = next.stationChildCode; |
| | | |
| | | task.Floor = station.stationFloor; |
| | | |
| | | task.AGVSign = ""; |
| | | } |
| | | } |
| | | else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.CarryGroup) |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress); |
| | | |
| | | task.TaskState = (int)TaskAGVCarryStatusEnum.CarryNew; |
| | | |
| | | task.CurrentAddress = item.SourceAddress; |
| | | |
| | | task.NextAddress = task.TargetAddress; |
| | | |
| | | task.Floor = station.stationFloor; |
| | | |
| | | task.AGVSign = ""; |
| | | } |
| | | |
| | | } |
| | | // 夿任å¡ç±»åæ¯å¦ä¸ºç§»åºä»»å¡ |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) |
| | | { |
| | | if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.RelocationGroup) |
| | | { |
| | | task.TaskState = (int)TaskRelocationStatusEnum.RelocationNew; |
| | | |
| | | task.CurrentAddress = item.SourceAddress; |
| | | |
| | | task.NextAddress = task.TargetAddress; |
| | | |
| | | task.Floor = "1F"; |
| | | |
| | | task.AGVSign = ""; |
| | | } |
| | | else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup) |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress); |
| | | |
| | | if (station != null) |
| | | { |
| | | var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == station.stationFloor); |
| | | |
| | | task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew; |
| | | |
| | | task.CurrentAddress = item.SourceAddress; |
| | | |
| | | task.NextAddress = next.stationChildCode; |
| | | |
| | | task.Floor = station.stationFloor; |
| | | |
| | | task.AGVSign = ""; |
| | | } |
| | | } |
| | | else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.CarryGroup) |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress); |
| | | |
| | | task.TaskState = (int)TaskAGVCarryStatusEnum.CarryNew; |
| | | |
| | | task.CurrentAddress = item.SourceAddress; |
| | | |
| | | task.NextAddress = task.TargetAddress; |
| | | |
| | | task.Floor = station.stationFloor; |
| | | |
| | | task.AGVSign = ""; |
| | | } |
| | | } |
| | | //夿任å¡ç±»åæ¯å¦ä¸ºè·¨æ¥¼å±æ¬è¿ä»»å¡ |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.AcrossFloorGroup) |
| | | { |
| | | if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup) |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress); |
| | | |
| | | if (station != null) |
| | | { |
| | | var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == station.stationFloor); |
| | | |
| | | task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew; |
| | | |
| | | task.CurrentAddress = item.SourceAddress; |
| | | |
| | | task.NextAddress = next.stationChildCode; |
| | | |
| | | task.Floor = station.stationFloor; |
| | | |
| | | task.AGVSign = ""; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // å°è½¬æ¢åç任塿·»å å°ä»»å¡åè¡¨ä¸ |
| | | tasks.Add(task); |
| | | } |
| | |
| | | /// <returns></returns> |
| | | public Dt_Task QueryRequestTSJSignalTask() |
| | | { |
| | | return BaseDal.QueryFirst(x => TaskAcrossFloorboundTypes.Contains(x.TaskType) && x.TaskState > (int)TaskAcrossFloorStatusEnum.CarryNew && (x.AGVSign == "RequestPickUp" || x.AGVSign == "RequestPut")); |
| | | return BaseDal.QueryFirst(x => x.TaskState > (int)TaskAcrossFloorStatusEnum.CarryNew && (x.AGVSign == "RequestPickUp" || x.AGVSign == "RequestPut")); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | try |
| | | { |
| | | int oldState = task.TaskState; |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.OutbondGroup) |
| | | { |
| | | int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskOutStatusEnum>(); |
| | | |
| | |
| | | content = StackCraneTaskCompleted(task.TaskNum); |
| | | return content; |
| | | } |
| | | if (task.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting) |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.TargetAddress); |
| | | SendAgvTask(station.stationRemark, task.TaskNum); |
| | | } |
| | | |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.InboundGroup) |
| | | { |
| | | int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>(); |
| | | task.TaskState = nextStatus; |
| | |
| | | //// ååºååååºå
容 |
| | | //content = JsonConvert.DeserializeObject<WebResponseContent>(abc); |
| | | |
| | | //LogFactory.WriteError($"Info_è·åè´§ä½", $"è·åè´§ä½,ä»»å¡å·:ã{task.TaskNum}ã,æçå·ï¼ã{task.PalletCode}ãè¿ååæ°ã{JsonConvert.SerializeObject(content)}ã{Environment.NewLine}{Environment.NewLine}"); |
| | | //LogFactory.WriteError($"è·åè´§ä½", $"è·åè´§ä½,ä»»å¡å·:ã{task.TaskNum}ã,æçå·ï¼ã{task.PalletCode}ãè¿ååæ°ã{JsonConvert.SerializeObject(content)}ã"); |
| | | |
| | | //// æ£æ¥ç¶æå¹¶è¿å |
| | | //if (!content.Status) |
| | |
| | | if (App.User.UserId > 0) |
| | | { |
| | | content = StackCraneTaskCompleted(task.TaskNum); |
| | | return content; |
| | | } |
| | | |
| | | task.ModifyDate = DateTime.Now; |
| | |
| | | _taskHtyRepository.AddData(task_Hty); |
| | | } |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.CarryGroup) |
| | | else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.CarryGroup) |
| | | { |
| | | int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskAGVCarryStatusEnum>(); |
| | | |
| | |
| | | |
| | | if (task.TaskState == (int)TaskAGVCarryStatusEnum.AGV_CarryFinish) |
| | | { |
| | | CompletedTask(task.TaskNum); |
| | | |
| | | task.ModifyDate = DateTime.Now; |
| | | task.Modifier = "System"; |
| | | |
| | |
| | | _taskHtyRepository.AddData(task_Hty); |
| | | } |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.AcrossFloorGroup) |
| | | else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup) |
| | | { |
| | | int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskAcrossFloorStatusEnum>(); |
| | | |
| | |
| | | stationManager = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == "1F"); |
| | | TaskTemplate = "CCC"; |
| | | } |
| | | |
| | | |
| | | var taskDto = new RequestAcrossFloorTaskDto() |
| | | { |
| | | NextAddress = task.NextAddress, |
| | |
| | | BaseDal.AddData(taskNew); |
| | | |
| | | SendAgvTask(TaskTemplate, taskNew.TaskNum); |
| | | return content.OK(); |
| | | } |
| | | |
| | | if (task.TaskState == (int)TaskAGVCarryStatusEnum.AGV_CarryFinish) |
| | | { |
| | | |
| | | CompletedTask(task.TaskNum); |
| | | |
| | | task.ModifyDate = DateTime.Now; |
| | | task.Modifier = "System"; |
| | | |
| | | Dt_Task_Hty task_Hty = _mapper.Map<Dt_Task_Hty>(task); |
| | | task_Hty.TaskId = 0; |
| | | |
| | | BaseDal.DeleteData(task); |
| | | _taskHtyRepository.AddData(task_Hty); |
| | | } |
| | | } |
| | | else |
| | |
| | | task.Modifier = "System"; |
| | | BaseDal.UpdateData(task); |
| | | |
| | | content.OK(data: task); |
| | | |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"å åæºåºåºå®æ"); |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup && task.TaskState == (int)TaskInStatusEnum.SC_InExecuting) |