| | |
| | | private readonly ICacheService _cacheService; |
| | | private readonly INoticeService _noticeService; |
| | | private readonly IDt_StationManagerRepository _stationManagerRepository; |
| | | private readonly ITask_HtyRepository _htyRepository; |
| | | private readonly ITask_HtyRepository _task_htyRepository; |
| | | private readonly ISys_ConfigService _sys_ConfigService; |
| | | private static List<string>? userTokenIds; |
| | | private static List<int>? userIds; |
| | | |
| | | public CommonStackerCraneJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, ICacheService cacheService, INoticeService noticeService, IDt_StationManagerRepository stationManagerRepository, ITask_HtyRepository htyRepository, ISys_ConfigService sys_ConfigService) |
| | | public CommonStackerCraneJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, ICacheService cacheService, INoticeService noticeService, IDt_StationManagerRepository stationManagerRepository, ITask_HtyRepository task_htyRepository, ISys_ConfigService sys_ConfigService) |
| | | { |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | |
| | | _cacheService = cacheService; |
| | | _noticeService = noticeService; |
| | | _stationManagerRepository = stationManagerRepository; |
| | | _htyRepository = htyRepository; |
| | | _task_htyRepository = task_htyRepository; |
| | | _sys_ConfigService = sys_ConfigService; |
| | | } |
| | | |
| | |
| | | var task = _taskRepository.QueryFirst(x => x.TaskNum == e.TaskNum); |
| | | |
| | | if (task == null) commonStackerCrane.SetValue(StackerCraneDBName.FinishConfirm, 1); |
| | | string x = $"ã{commonStackerCrane.StackerCraneWorkStatusValue}ã"; |
| | | |
| | | //if(task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | //{ |
| | | // CommonConveyorLine? conveyorLine = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1001") as CommonConveyorLine; |
| | | // if (conveyorLine != null) |
| | | // { |
| | | // short InteractiveSignal = conveyorLine.GetValue<ConveyorLineDBName, short>(ConveyorLineDBName.InteractiveSignal, "101"); |
| | | // var structs = BitConverter.GetBytes(InteractiveSignal).Reverse().ToArray().ToBoolArray(); |
| | | // if (structs[0]) |
| | | // { |
| | | // conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTaskNum, "9999", "101"); |
| | | // } |
| | | // } |
| | | //} |
| | | string WorkStatus = $"ã{commonStackerCrane.StackerCraneWorkStatusValue}ã"; |
| | | |
| | | var content = _taskService.StackCraneTaskCompleted(e.TaskNum); |
| | | |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | CommonConveyorLine? conveyorLine = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1001") as CommonConveyorLine; |
| | | if (conveyorLine != null) |
| | | { |
| | | short InteractiveSignal = conveyorLine.GetValue<ConveyorLineDBName, short>(ConveyorLineDBName.InteractiveSignal, "LK001"); |
| | | var structs = BitConverter.GetBytes(InteractiveSignal).Reverse().ToArray().ToBoolArray(); |
| | | if (structs[0]) |
| | | { |
| | | bool x = conveyorLine.Communicator.WriteNoRead("DB100.0", 9999); |
| | | if (!x) |
| | | { |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.TargetAddress); |
| | | if (station != null) |
| | | { |
| | | _taskService.SendAgvTask(station.stationRemark, task.TaskNum); |
| | | _taskService.UpdateTaskStatusToNext(task.TaskNum); |
| | | } |
| | | } |
| | | |
| | | var isWorkType = commonStackerCrane.SetValue(StackerCraneDBName.FinishConfirm, 1); |
| | | |
| | | |
| | | str = $"{commonStackerCrane.DeviceName}ãWMS|WCSä»»å¡å®æï¼ã{content.Status}{content.Message}ã,å åæºå®æä¿¡å·åå
¥ï¼ã{isWorkType}ã,ä»»å¡å·ï¼ã{e.TaskNum}ãæ¶é´ã{DateTime.Now}ã"; |
| | | WriteInfo(commonStackerCrane.DeviceName, str+x); |
| | | WriteInfo(commonStackerCrane.DeviceName, str + WorkStatus); |
| | | ConsoleHelper.WriteColorLine(str, ConsoleColor.Blue); |
| | | } |
| | | } |
| | |
| | | |
| | | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | // // æ£æ¥å½ååºåºä»»å¡ç«å°æ¯å¦å
许æ¾è´§ |
| | | // var occupiedStation = OutTaskStationIsOccupied(task); |
| | | // if (occupiedStation == null) |
| | | // { |
| | | // // 妿å½ååºåºä»»å¡ç«å°ä¸å
许æ¾è´§ï¼æé¤å½åä»»å¡ï¼æ¥æ¾å
¶ä»åºåºä»»å¡ |
| | | |
| | | // var log = $"ä»»å¡å·ï¼ã{task.TaskNum}ãåºåºå°åï¼ã{task.NextAddress}ãä¸å
许æ¾è´§"; |
| | | // ConsoleHelper.WriteErrorLine(log); |
| | | |
| | | // _noticeService.Logs(userTokenIds, new { commonStackerCrane.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" }); |
| | | // WriteInfo(commonStackerCrane.DeviceName, log); |
| | | |
| | | // task = FindAnotherOutboundTask(commonStackerCrane.DeviceCode, task.TaskId); |
| | | |
| | | // if (task == null) |
| | | // { |
| | | // task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // return task; |
| | | // } |
| | | return task; |
| | | var InTask = _taskRepository.QueryFirst(x => x.TaskState > (int)TaskInStatusEnum.InNew && x.TaskState< (int)TaskInStatusEnum.SC_InExecuting); |
| | | var OutTask = _taskRepository.QueryFirst(x => x.TaskState > (int)TaskOutStatusEnum.OutNew && x.TaskState < (int)TaskOutStatusEnum.AGV_OutExecuting); |
| | | if (InTask != null) |
| | | { |
| | | return null; |
| | | } |
| | | else if (OutTask != null) |
| | | { |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | CommonConveyorLine? conveyorLine = Storage.Devices.FirstOrDefault(x=>x.DeviceCode =="1001") as CommonConveyorLine; |
| | | if (conveyorLine != null) |
| | | { |
| | | short InteractiveSignal = conveyorLine.GetValue<ConveyorLineDBName, short>(ConveyorLineDBName.InteractiveSignal, "LK001"); |
| | | var structs = BitConverter.GetBytes(InteractiveSignal).Reverse().ToArray().ToBoolArray(); |
| | | if (structs[0] && !structs[2] && !structs[1]) |
| | | { |
| | | conveyorLine.Communicator.WriteNoRead("DB100.0", 9990); |
| | | } |
| | | if (structs[0] && structs[2]) |
| | | { |
| | | conveyorLine.Communicator.WriteNoRead("DB100.0", 9990); |
| | | return task; |
| | | } |
| | | else |
| | | { |
| | | task.ExceptionMessage = "è¯·æ£æ¥è¾é线æ¯å¦æ¯èªå¨æ¨¡å¼æå·²ç»ç§»å¨å°åºåºå£"; |
| | | return null; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | task.ExceptionMessage = "è¾éçº¿è®¾å¤æå¼è¿æ¥"; |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | else if (task == null) |
| | | { |
| | |
| | | stackerCraneTaskCommand.StartCommand = Convert.ToInt16(1); |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//夿æ¯å¦æ¯å
¥åºä»»å¡ |
| | | { |
| | | string[] sourceCodes = task.CurrentAddress.Split("-"); |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.stationChildCode == task.CurrentAddress); |
| | | string[] sourceCodes = station.stationLocation.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]) % 2 != 0 ? (short)1 : (short)2; |
| | |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"åºåºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); |
| | | return null; |
| | | } |
| | | |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | | { |
| | |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"åºåºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); |
| | | return null; |
| | | } |
| | | |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.stationChildCode == task.NextAddress); |
| | | string[] targetCodes = station.stationLocation.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]) % 2 != 0 ? (short)1 : (short)2; |