From f7f1f176f931f5ad54056df7b8e8a9f028eea100 Mon Sep 17 00:00:00 2001 From: 刘磊 <1161824510@qq.com> Date: 星期二, 17 十二月 2024 19:50:38 +0800 Subject: [PATCH] 合并 --- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs | 34 +++++++++++++++++++++++++++++++++- 1 files changed, 33 insertions(+), 1 deletions(-) diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs index 6b3d16b..f9ea672 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs @@ -4,7 +4,9 @@ using System.Diagnostics.CodeAnalysis; using WIDESEAWCS_BasicInfoRepository; using WIDESEAWCS_Common.TaskEnum; +using WIDESEAWCS_Core.Caches; using WIDESEAWCS_Core.Helper; +using WIDESEAWCS_Core.HttpContextUser; using WIDESEAWCS_DTO.MOM; using WIDESEAWCS_IProcessRepository; using WIDESEAWCS_ITaskInfoRepository; @@ -16,6 +18,7 @@ using WIDESEAWCS_QuartzJob.Models; using WIDESEAWCS_QuartzJob.Service; using WIDESEAWCS_QuartzJob.StackerCrane.Enum; +using WIDESEAWCS_SignalR; using WIDESEAWCS_Tasks.StackerCraneJob; namespace WIDESEAWCS_Tasks @@ -28,14 +31,18 @@ private readonly ITaskRepository _taskRepository; private readonly IProcessRepository _processRepository; private readonly IDt_StationManagerRepository _stationManagerRepository; + private readonly ICacheService _cacheService; + private readonly INoticeService _noticeService; - public CommonStackerStationCraneJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IProcessRepository processRepository, IDt_StationManagerRepository stationManagerRepository) + public CommonStackerStationCraneJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IProcessRepository processRepository, IDt_StationManagerRepository stationManagerRepository, ICacheService cacheService, INoticeService noticeService) { _taskService = taskService; _taskExecuteDetailService = taskExecuteDetailService; _taskRepository = taskRepository; _processRepository = processRepository; _stationManagerRepository = stationManagerRepository; + _cacheService = cacheService; + _noticeService = noticeService; } public Task Execute(IJobExecutionContext context) @@ -78,6 +85,31 @@ } } } + + #region 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇 + + var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken"); + if (tokenInfos == null || !tokenInfos.Any()) + { + //throw new Exception(commonStackerCrane.DeviceName + "缂撳瓨涓湭鎵惧埌Token缂撳瓨"); + return Task.CompletedTask; + } + var userTokenIds = tokenInfos?.Select(x => x.Token_ID).ToList(); + var userIds = tokenInfos?.Select(x => x.UserId).ToList(); + + object obj = new + { + commonStackerCrane.StackerCraneStatusDes, + commonStackerCrane.StackerCraneAutoStatusDes, + commonStackerCrane.StackerCraneWorkStatusDes, + commonStackerCrane.DeviceCode, + commonStackerCrane.DeviceName, + commonStackerCrane.CurrentTaskNum, + commonStackerCrane.LastTaskNum, + }; + _noticeService.StackerData(userIds?.FirstOrDefault(), userTokenIds, new { commonStackerCrane.DeviceName, data = obj }); + + #endregion 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇 } } catch (Exception ex) -- Gitblit v1.9.3