| | |
| | | using WIDESEAWCS_Tasks.StackerCraneJob; |
| | | using WIDESEAWCS_Tasks; |
| | | using WIDESEAWCS_Core; |
| | | using SqlSugar.Extensions; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using WIDESEAWCS_QuartzJob.Repository; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using HslCommunication.WebSocket; |
| | | using WIDESEAWCS_DTO.Equipment; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | |
| | | private readonly IRouterService _routerService; |
| | | private readonly IRouterRepository _routerRepository; |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | private WebSocketServer _webSocketServer; |
| | | |
| | | public StackerCraneJob_YLSC3(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository) |
| | | public StackerCraneJob_YLSC3(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository,WebSocketServer webSocketServer) |
| | | { |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | |
| | | _routerService = routerService; |
| | | _stationMangerRepository = stationMangerRepository; |
| | | _routerRepository = routerRepository; |
| | | _webSocketServer = webSocketServer; |
| | | } |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | |
| | | commonStackerCrane.LastTaskType = task.TaskType; |
| | | task.Dispatchertime = DateTime.Now; |
| | | task.ExceptionMessage = ""; |
| | | //_taskService.UpdateTask(task, TaskStatusEnum.SC_Executing); |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | | commonStackerCrane.Communicator.Write("DB1000.20.0", true); |
| | | //å»¶æ¶1s |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | #region è°ç¨äºä»¶æ»çº¿éç¥å端 |
| | | |
| | | EquipmentDTO equipmentDTO = new EquipmentDTO(); |
| | | object obj = new |
| | | { |
| | | commonStackerCrane.DeviceName, |
| | | commonStackerCrane.DeviceCode, |
| | | StackerCraneAutoStatus.Automatic, |
| | | StackerCraneStatus.Normal, |
| | | StackerCraneWorkStatus.Standby, |
| | | TaskNum = commonStackerCrane.CurrentTaskNum, |
| | | WorkType = commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType), |
| | | StackerAlarm = commonStackerCrane.Communicator.Read<short>("DB1000.54.0"), |
| | | }; |
| | | equipmentDTO.StackerDataJson = obj.Serialize(); |
| | | _webSocketServer.PublishAllClientPayload(equipmentDTO.Serialize()); |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | //åæä¸æ¥¼åºåºä¸å线ä½é»è¾ |
| | | if (stationManger.StationDeviceCode == "CL1_YL") |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device != null) |
| | | { |
| | | OtherDevice conveyorLine = (OtherDevice)device; |
| | | conveyorLine.SetValue(ConveyorLineDBName.TaskNum, taskNum, stationManger.StationCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName.TargetAddress, router.NextPosi, stationManger.StationCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName.ResponState, 86, stationManger.StationCode); |
| | | |
| | | // å åæºå®æ |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute, deviceCode: stationManger.StationDeviceCode, currentAddress: stationManger.StationCode, nextAddress: router.NextPosi); |
| | | } |
| | | else |
| | | { |
| | | WriteInfo(deviceCode, $"æªæ¾å°åºåºç«å°ã{stationManger.StationDeviceCode}ã对åºçéè®¯å¯¹è±¡ï¼æ æ³åéè¾é线åºåºä¿¡å·"); |
| | | _taskService.UpdateTaskExceptionMessage(taskNum, $"æªæ¾å°åºåºç«å°ã{stationManger.StationDeviceCode}ã对åºçéè®¯å¯¹è±¡ï¼æ æ³åéè¾é线åºåºä¿¡å·"); |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°åºåºç«å°ã{stationManger.StationDeviceCode}ã对åºçéè®¯å¯¹è±¡ï¼æ æ³åéè¾é线åºåºä¿¡å·"); |
| | | } |
| | | }//åæäºæ¥¼åºåºä¸å线ä½é»è¾ |
| | | else |
| | | // å åæºå®æ |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute, deviceCode: stationManger.StationDeviceCode, currentAddress: stationManger.StationCode, nextAddress: router.NextPosi); |
| | | } |
| | | else//åæäºæ¥¼åºåºä¸å线ä½é»è¾ |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device != null) |
| | | { |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | conveyorLine.SetValue(WR_CLineYLDB.WR_Task, taskNum, stationManger.StationCode); |
| | | conveyorLine.SetValue(WR_CLineYLDB.WR_ToHode, router.NextPosi, stationManger.StationCode); |
| | | conveyorLine.SetValue(WR_CLineYLDB.WR_Reresult, 86, stationManger.StationCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName.TaskNum, taskNum, stationManger.StationCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName.TargetAddress, router.NextPosi, stationManger.StationCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName.Width, task.TaskLength, stationManger.StationCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName.Height, task.HeightType, stationManger.StationCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName.Barcode, task.PalletCode, stationManger.StationCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName.ResponState, 86, stationManger.StationCode); |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | | } |
| | | else |
| | |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[2]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[3]); |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); |
| | | } |
| | | else |
| | | { |
| | |
| | | string[] sourceCodes = task.CurrentAddress.Split("-"); |
| | | if (sourceCodes.Length == 5) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[2]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[3]); |
| | | } |
| | | else |
| | | { |