| | |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_SignalR; |
| | | using WIDESEAWCS_TaskInfoRepository; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using WIDESEAWCS_Tasks.RGVJob; |
| | | using WIDESEAWCS_Tasks.StackerCraneJob; |
| | |
| | | { |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly ITask_HtyRepository _task_HtyRepository; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly IRouterService _routerService; |
| | | private readonly IDt_StationManagerService _stationManagerService; |
| | |
| | | private static List<string>? userTokenIds; |
| | | private static List<int>? userIds; |
| | | |
| | | public CommonRGVJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IDt_StationManagerService stationManagerService, IMapper mapper, ICacheService cacheService, INoticeService noticeService, ITaskRepository taskRepository,IDt_StationManagerRepository stationManagerRepository) |
| | | public CommonRGVJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IDt_StationManagerService stationManagerService, IMapper mapper, ICacheService cacheService, INoticeService noticeService, ITaskRepository taskRepository,IDt_StationManagerRepository stationManagerRepository, ITask_HtyRepository task_HtyRepository) |
| | | { |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | |
| | | _noticeService = noticeService; |
| | | _taskRepository = taskRepository; |
| | | _stationManagerRepository = stationManagerRepository; |
| | | _task_HtyRepository = task_HtyRepository; |
| | | } |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | |
| | | { |
| | | if (commonRGV != null) |
| | | { |
| | | WriteInfo("RGV浠诲姟瀹屾垚", $"{commonRGV.DeviceName}瀹屾垚浠诲姟鍙穥TaskNum}"); |
| | | var task = _taskRepository.QueryFirst(x => x.TaskNum == TaskNum); |
| | | if (task != null) |
| | | { |
| | | if (task.TaskState == (int)TaskInStatusEnum.InRetuen) |
| | | { |
| | | Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.SourceAddress); |
| | | if (stationManager != null) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManager.stationPLC); |
| | | if (device != null) |
| | | { |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, Convert.ToSByte(3), stationManager.stationChildCode); |
| | | |
| | | var content = _taskService.RGVTaskCompleted(TaskNum); |
| | | } |
| | | } |
| | | } |
| | | if (task.TaskState == (int)TaskInStatusEnum.RGV_Indispatch) |
| | | { |
| | | if (task.SourceAddress == "3002") |
| | |
| | | var x = conveyorLine.Communicator.Read(devicePro.DeviceProAddress, 5); |
| | | string Barcode = Encoding.UTF8.GetString(x); |
| | | |
| | | if (Barcode == null || Barcode == "") |
| | | if (Barcode == null || Barcode == "" || Barcode.Trim().Contains("\0")) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, Convert.ToSByte(3), stationManager.stationChildCode); |
| | | commonRGV.SetValue(StackerCraneDBName.PutcargoLocation, Convert.ToSByte(stationManager.stationRemark)); |
| | | commonRGV.SetValue(StackerCraneDBName.TaskNum, Convert.ToInt16(task.TaskNum)); |
| | | // commonRGV.SetValue(StackerCraneDBName.TaskType, Convert.ToSByte(4)); |
| | | task.TaskState = (int)TaskInStatusEnum.InRetuen; |
| | | _taskRepository.UpdateData(task); |
| | | commonRGV.SetValue(StackerCraneDBName.TaskType, Convert.ToSByte(4)); |
| | | |
| | | task.ModifyDate = DateTime.Now; |
| | | task.Modifier = "System"; |
| | | |
| | | Dt_Task_Hty task_Hty = _mapper.Map<Dt_Task_Hty>(task); |
| | | task_Hty.TaskId = 0; |
| | | |
| | | _taskRepository.DeleteData(task); |
| | | _task_HtyRepository.AddData(task_Hty); |
| | | return; |
| | | } |
| | | var content = _taskService.RGVTaskCompleted(TaskNum, Barcode); |