| | |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_QuartzJob.StackerCrane; |
| | | using WIDESEAWCS_QuartzJob.StackerCrane.Enum; |
| | | using WIDESEAWCS_Common.Constants; |
| | | using WIDESEAWCS_Tasks.StackerCraneJob; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | |
| | | |
| | | // ========== 检查是否可以发送新任务 ========== |
| | | //if (!commonStackerCrane.IsCanSendTask(commonStackerCrane.Communicator, commonStackerCrane.DeviceProDTOs, commonStackerCrane.DeviceProtocolDetailDTOs)) |
| | | if (commonStackerCrane.StackerCraneStatusValue != StackerCraneStatus.Normal) |
| | | if (commonStackerCrane.StackerCraneStatusValue != StackerCraneStatus.Normal /*&& commonStackerCrane.StackerCraneAutoStatusValue != StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneWorkStatusValue != StackerCraneWorkStatus.Standby*/) |
| | | { |
| | | // 堆垛机不可用(如正在执行上一任务),直接返回 |
| | | _logger.LogDebug("Execute:堆垛机不可用,设备: {DeviceCode}", _deviceCode); |
| | | QuartzLogger.Debug($"堆垛机不可用,设备: {_deviceCode}", _deviceCode); |
| | | //_logger.LogDebug("Execute:堆垛机不可用,设备: {DeviceCode}", _deviceCode); |
| | | //QuartzLogger.Debug($"堆垛机不可用,设备: {_deviceCode}", _deviceCode); |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | |
| | | if (sendFlag) |
| | | { |
| | | Task.Delay(1000).Wait(); |
| | | commonStackerCrane.SetValue(StackerCraneDBName.WorkAction, (short)1); |
| | | commonStackerCrane.SetValue(StackerCraneDBName.WorkAction, (short)StackerCraneWorkActionEnum.StartTask); |
| | | // 发送成功,更新状态 |
| | | commonStackerCrane.LastTaskType = task.TaskType; |
| | | _taskService.UpdateTaskStatusToNext(task.TaskNum); |
| | |
| | | // 更新任务状态为完成 |
| | | if (_taskService.StackCraneTaskCompleted(e.TaskNum).Status) |
| | | { |
| | | // 清除堆垛机的作业指令(设置为 2,表示空闲) |
| | | stackerCrane.SetValue(StackerCraneDBName.WorkAction, 2); |
| | | // 清除堆垛机的作业指令(设置为空闲) |
| | | stackerCrane.SetValue(StackerCraneDBName.WorkAction, (short)StackerCraneWorkActionEnum.TaskComplete); |
| | | } |
| | | } |
| | | } |