wangxinhui
昨天 a8756c3526832332db4ef5685348d9b188c2bf2b
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP²Ö/StackerCraneJob_PP.cs
@@ -28,6 +28,9 @@
using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_Core.Caches;
using AutoMapper;
using WIDESEAWCS_Tasks.PP仓;
using HslCommunication.WebSocket;
using WIDESEAWCS_Tasks.干膜仓;
namespace WIDESEAWCS_Tasks
{
@@ -39,11 +42,13 @@
        private readonly ITaskService _taskService;
        private readonly ITaskExecuteDetailService _taskExecuteDetailService;
        private readonly ITaskRepository _taskRepository;
        public static PPReadData pPReadData = new PPReadData();
        private readonly IRouterService _routerService;
        private readonly IStationMangerRepository _stationMangerRepository;
        private List<Dt_ApiInfo> apiInfos;
        private WebSocketServer _webSocketServer;
        public StackerCraneJob_PP(IMapper mapper, ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository, ICacheService cacheService)
        public StackerCraneJob_PP(IMapper mapper, ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository, ICacheService cacheService,WebSocketServer webSocketServer)
        {
            _taskService = taskService;
            _taskExecuteDetailService = taskExecuteDetailService;
@@ -52,6 +57,21 @@
            _stationMangerRepository = stationMangerRepository;
            _cacheService = cacheService;
            _mapper=mapper;
            _webSocketServer = webSocketServer;
            string? apiInfoStr = _cacheService.Get("apiInfos");
            if (!string.IsNullOrEmpty(apiInfoStr))
            {
                List<Dt_ApiInfo>? infos = JsonConvert.DeserializeObject<List<Dt_ApiInfo>>(apiInfoStr);
                if (infos == null || infos.Count == 0)
                {
                    apiInfos = new List<Dt_ApiInfo>();
                }
                else
                {
                    apiInfos = infos;
                }
            }
        }
        public Task Execute(IJobExecutionContext context)
@@ -89,6 +109,14 @@
                            }
                        }
                    }
                    pPReadData.R_PP_Status = ((short)commonStackerCrane.StackerCraneStatusValue);
                    pPReadData.R_PP_AutoStatus = ((short)commonStackerCrane.StackerCraneAutoStatusValue);
                    pPReadData.R_PP_WorkStatus = ((short)commonStackerCrane.StackerCraneWorkStatusValue);
                    pPReadData.R_PP_TaskNum = commonStackerCrane.CurrentTaskNum.ObjToInt();
                    pPReadData.R_PP_WorkType = commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType);
                    pPReadData.R_PP_TrayType = commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.TrayType);
                    string pPData = JsonConvert.SerializeObject(pPReadData);
                    _webSocketServer.PublishAllClientPayload(pPData);
                }
            }
            catch (Exception ex)