| | |
| | | using WIDESEAWCS_Core.Caches; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_Core.HttpContextUser; |
| | | using WIDESEAWCS_DTO.Enum; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_IBasicInfoService; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | |
| | | 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; |
| | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | [DisallowConcurrentExecution] |
| | | public class CommonRGVJob :JobBase, IJob |
| | | public class CommonRGVJob : JobBase, IJob |
| | | { |
| | | 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.GetValue<StackerCraneDBName, bool>(StackerCraneDBName.WorkCompleted)) |
| | | { |
| | | var x = commonRGV.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum); |
| | | RGVTaskFinish(commonRGV, commonRGV.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum)); |
| | | } |
| | | |
| | |
| | | { |
| | | if (commonRGV != null) |
| | | { |
| | | WriteInfo("RGVä»»å¡å®æ", $"{commonRGV.DeviceName}宿任å¡å·{TaskNum}"); |
| | | var task = _taskRepository.QueryFirst(x => x.TaskNum == TaskNum); |
| | | if (task != null) |
| | | { |
| | | if (task.TaskState == (int)TaskInStatusEnum.RGV_Indispatch) |
| | | { |
| | | if (task.SourceAddress == "3002") |
| | | { |
| | | task.TaskState = (int)TaskInStatusEnum.RGV_IndispatchFinish; |
| | | _taskRepository.UpdateData(task); |
| | | return; |
| | | } |
| | | Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.SourceAddress); |
| | | if (stationManager != null) |
| | | { |
| | |
| | | { |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | Thread.Sleep(100); |
| | | |
| | | var Barcode = conveyorLine.GetValue<ConveyorLineDBName, string>(ConveyorLineDBName.ConveyorLineBarcode, stationManager.stationChildCode); |
| | | |
| | | if (Barcode == null||Barcode=="") |
| | | DeviceProDTO? devicePro = conveyorLine.DeviceProDTOs.Where(x => x.DeviceChildCode == stationManager.stationChildCode && x.DeviceProParamName == "ConveyorLineBarcode").FirstOrDefault(); |
| | | var x = conveyorLine.Communicator.Read(devicePro.DeviceProAddress, 5); |
| | | string Barcode = Encoding.UTF8.GetString(x); |
| | | |
| | | if (Barcode == null || Barcode == "" || Barcode.Trim().Contains("\0")) |
| | | { |
| | | commonRGV.SetValue(StackerCraneDBName.PutcargoLocation, Convert.ToSByte(stationManager.stationRemark)); |
| | | commonRGV.SetValue(StackerCraneDBName.TaskNum, Convert.ToInt16(task.TaskNum)); |
| | | 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; |
| | | task_Hty.OperateType = (int)OperateTypeEnum.å¼å¸¸éå; |
| | | |
| | | _taskRepository.DeleteData(task); |
| | | _task_HtyRepository.AddData(task_Hty); |
| | | return; |
| | | } |
| | | var content = _taskService.RGVTaskCompleted(TaskNum, Barcode); |
| | |
| | | { |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | Thread.Sleep(100); |
| | | var Barcode = conveyorLine.GetValue<ConveyorLineDBName, string>(ConveyorLineDBName.ConveyorLineBarcode, stationManager.stationChildCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, Convert.ToInt16(stationManager.stationNextChildCode), stationManager.stationChildCode); |
| | | Thread.Sleep(100); |
| | | conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTaskNum, Convert.ToInt16(1000), stationManager.stationChildCode); |
| | |
| | | Dt_Task task; |
| | | if (InStock) |
| | | { |
| | | task = _taskService.QueryRGVExecutingTask(commonRGV.DeviceCode); |
| | | task = _taskService.QueryRGVExecutingTask(commonRGV.DeviceCode, commonRGV.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum)); |
| | | if (task != null) |
| | | { |
| | | return task; |
| | |
| | | rgvTaskCommand.TaskNum = Convert.ToInt16(task.TaskNum); |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//夿æ¯å¦æ¯å
¥åºä»»å¡ |
| | | { |
| | | //rgvTaskCommand.TaskType = (byte)Convert.ToSByte(16); |
| | | //rgvTaskCommand.TaskType = (byte)Convert.ToSByte(64); éå |
| | | if (task.TaskState == (int)TaskInStatusEnum.InNew) |
| | | { |
| | | Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.SourceAddress); |
| | | Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.CurrentAddress); |
| | | rgvTaskCommand.TaskType = (byte)Convert.ToSByte(3); |
| | | rgvTaskCommand.PickupLocation = (byte)Convert.ToSByte(stationManager.stationRemark); |
| | | } |
| | |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | |
| | | if (task.TaskState == (int)TaskOutStatusEnum.Line_OutFinish) |
| | | { |
| | | Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.CurrentAddress); |