From ad6f399066a747aeaba987360bce9ee40227302c Mon Sep 17 00:00:00 2001
From: 肖洋 <cathay_xy@163.com>
Date: 星期一, 09 十二月 2024 18:23:00 +0800
Subject: [PATCH] SignalR+事件总线推送前端

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
index b660fb6..616a63c 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
@@ -33,7 +33,9 @@
 using WIDESEAWCS_Common;
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Core;
+using WIDESEAWCS_Core.Caches;
 using WIDESEAWCS_Core.Helper;
+using WIDESEAWCS_Core.HttpContextUser;
 using WIDESEAWCS_DTO.MOM;
 using WIDESEAWCS_DTO.TaskInfo;
 using WIDESEAWCS_IProcessRepository;
@@ -46,7 +48,9 @@
 using WIDESEAWCS_QuartzJob.DeviceBase;
 using WIDESEAWCS_QuartzJob.DTO;
 using WIDESEAWCS_QuartzJob.Service;
+using WIDESEAWCS_SignalR;
 using WIDESEAWCS_Tasks.ConveyorLineJob;
+using ICacheService = WIDESEAWCS_Core.Caches.ICacheService;
 
 namespace WIDESEAWCS_Tasks
 {
@@ -61,8 +65,10 @@
         private readonly ISys_ConfigService _sys_ConfigService;
         private readonly IMapper _mapper;
         private readonly IDt_StationManagerRepository _stationManagerRepository;
+        private readonly ICacheService _cacheService;
+        private readonly INoticeService _noticeService;
 
-        public CommonConveyorLine_GWJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerRepository stationManagerRepository)
+        public CommonConveyorLine_GWJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerRepository stationManagerRepository, ICacheService cacheService, INoticeService noticeService)
         {
             _taskService = taskService;
             _taskExecuteDetailService = taskExecuteDetailService;
@@ -72,6 +78,8 @@
             _platFormRepository = platFormRepository;
             _sys_ConfigService = sys_ConfigService;
             _stationManagerRepository = stationManagerRepository;
+            _cacheService = cacheService;
+            _noticeService = noticeService;
         }
 
         public Task Execute(IJobExecutionContext context)
@@ -157,6 +165,24 @@
                             }
                         }
 
+                        #region 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇
+
+                        var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken");
+                        if (tokenInfos == null || !tokenInfos.Any())
+                        {
+                            throw new Exception(conveyorLine.DeviceName + "缂撳瓨涓湭鎵惧埌Token缂撳瓨");
+                        }
+                        var userTokenIds = tokenInfos?.Select(x => x.Token_ID).ToList();
+                        var userIds = tokenInfos?.Select(x => x.UserId).ToList();
+
+                        object obj = new
+                        {
+                            commandAfter = command,
+                        };
+                        _noticeService.StackerData(userIds?.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, data = obj });
+
+                        #endregion 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇
+
                     }
                     #endregion
 

--
Gitblit v1.9.3