From 9190b1eabf080af4e0d4d76d6e4ef127a12b1074 Mon Sep 17 00:00:00 2001 From: 肖洋 <cathay_xy@163.com> Date: 星期二, 10 十二月 2024 15:44:29 +0800 Subject: [PATCH] 12312312 --- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs | 37 +++++++++++++++++++++++++++++++++---- 1 files changed, 33 insertions(+), 4 deletions(-) diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs index 7aad880..ade5a33 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs @@ -10,7 +10,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; @@ -22,8 +24,10 @@ using WIDESEAWCS_QuartzJob.DeviceBase; using WIDESEAWCS_QuartzJob.DTO; using WIDESEAWCS_QuartzJob.Service; +using WIDESEAWCS_SignalR; using WIDESEAWCS_Tasks.ConveyorLineJob; using static System.Collections.Specialized.BitVector32; +using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; namespace WIDESEAWCS_Tasks { @@ -39,8 +43,10 @@ private readonly IMapper _mapper; private readonly IDt_StationManagerService _stationManagerService; private readonly IDt_StationManagerRepository _stationManagerRepository; + private readonly ICacheService _cacheService; + private readonly INoticeService _noticeService; - public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerService stationManagerService, IDt_StationManagerRepository stationManagerRepository) + public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerService stationManagerService, IDt_StationManagerRepository stationManagerRepository, ICacheService cacheService, INoticeService noticeService) { _taskService = taskService; _taskExecuteDetailService = taskExecuteDetailService; @@ -51,6 +57,8 @@ _sys_ConfigService = sys_ConfigService; _stationManagerService = stationManagerService; _stationManagerRepository = stationManagerRepository; + _cacheService = cacheService; + _noticeService = noticeService; } public async Task Execute(IJobExecutionContext context) @@ -165,6 +173,27 @@ } } } + + + #region 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇 + + var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken"); + if (tokenInfos == null || !tokenInfos.Any()) + { + //throw new Exception(conveyorLine.DeviceName + "缂撳瓨涓湭鎵惧埌Token缂撳瓨"); + return; + } + var userTokenIds = tokenInfos?.Select(x => x.Token_ID).ToList(); + var userIds = tokenInfos?.Select(x => x.UserId).ToList(); + + object obj = new + { + command, + commandWrite + }; + _noticeService.StackerData(userIds?.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, data = obj }); + + #endregion 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇 } } @@ -388,7 +417,7 @@ taskOutboundTypeEnum = TaskOutboundTypeEnum.OutTray; else taskOutboundTypeEnum = TaskOutboundTypeEnum.Outbound; - await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker); + await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker, platform); } catch (Exception) { @@ -398,7 +427,7 @@ /// <summary> /// 妫�鏌ヤ换鍔″苟鍒涘缓鏂颁换鍔� /// </summary> - private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, List<string> roadways = null) + private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, Platform platform) { var tasks = _taskRepository.QueryData(x => x.TaskType == (int)taskType && x.TargetAddress == childDeviceCode); if (tasks.Count < index) @@ -419,7 +448,7 @@ var wmsIpAddress = wmsBase + requestTrayOutTask; - var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = roadWay, roadways = roadways }.ToJsonString()); + var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = roadWay, platform.ProductionLine }.ToJsonString()); //var result = await HttpHelper.PostAsync("http://localhost:5000/api/Task/RequestTrayOutTaskAsync", dynamic.ToJsonString()); WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result); -- Gitblit v1.9.3