From 01ba2e2affa33320ef8aca6e033248388bb8f60e Mon Sep 17 00:00:00 2001 From: 肖洋 <cathay_xy@163.com> Date: 星期二, 10 十二月 2024 11:04:41 +0800 Subject: [PATCH] 高温出库修改 --- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs | 3 + Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs | 11 +++++ Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs | 3 + Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs | 34 ++++++++++++++++ Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs | 13 +++++- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs | 3 + 6 files changed, 61 insertions(+), 6 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 1a90a5c..3d35a4a 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs @@ -180,7 +180,8 @@ var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken"); if (tokenInfos == null || !tokenInfos.Any()) { - throw new Exception(conveyorLine.DeviceName + "缂撳瓨涓湭鎵惧埌Token缂撳瓨"); + //throw new Exception(conveyorLine.DeviceName + "缂撳瓨涓湭鎵惧埌Token缂撳瓨"); + return; } var userTokenIds = tokenInfos?.Select(x => x.Token_ID).ToList(); var userIds = tokenInfos?.Select(x => x.UserId).ToList(); diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs index 9fd5456..368e323 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs @@ -107,7 +107,8 @@ var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken"); if (tokenInfos == null || !tokenInfos.Any()) { - throw new Exception(conveyorLine.DeviceName + "缂撳瓨涓湭鎵惧埌Token缂撳瓨"); + //throw new Exception(conveyorLine.DeviceName + "缂撳瓨涓湭鎵惧埌Token缂撳瓨"); + continue; } var userTokenIds = tokenInfos?.Select(x => x.Token_ID).ToList(); var userIds = tokenInfos?.Select(x => x.UserId).ToList(); 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 616a63c..530f02e 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 @@ -170,7 +170,8 @@ var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken"); if (tokenInfos == null || !tokenInfos.Any()) { - throw new Exception(conveyorLine.DeviceName + "缂撳瓨涓湭鎵惧埌Token缂撳瓨"); + //throw new Exception(conveyorLine.DeviceName + "缂撳瓨涓湭鎵惧埌Token缂撳瓨"); + continue; } var userTokenIds = tokenInfos?.Select(x => x.Token_ID).ToList(); var userIds = tokenInfos?.Select(x => x.UserId).ToList(); diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs index 1375410..949e6fb 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs @@ -96,7 +96,8 @@ var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken"); if (tokenInfos == null || !tokenInfos.Any()) { - throw new Exception(commonStackerCrane.DeviceName + "缂撳瓨涓湭鎵惧埌Token缂撳瓨"); + //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(); @@ -151,7 +152,15 @@ if (device != null) { CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device; - conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, task.PalletCode, task.TargetAddress); + var isResult = conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, task.PalletCode, task.TargetAddress); + if (!isResult) + { + var result = conveyorLine.GetValue<ConveyorLineDBName_After, string>(ConveyorLineDBName_After.ConveyorLineBarcode, task.TargetAddress); + if(result!= task.PalletCode) + { + conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, task.PalletCode, task.TargetAddress); + } + } } else return; 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 f65a3c1..65474d7 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) diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs index 19379e7..e8a35a4 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs @@ -102,6 +102,7 @@ // 鏇存柊搴撳瓨鐘舵�佸拰浠诲姟鐘舵�� (var loc, var tas) = UpdateStockAndTaskStatus(stock, task); + var taskHty = task.Adapt<Dt_Task_Hty>(); // 浜嬪姟澶勭悊 await _unitOfWorkManage.UseTranAsync(async () => @@ -114,6 +115,7 @@ await UpdateLocationAsync(loc); //if (task.Roadway.Contains("FR") || task.Roadway.Contains("GW") || task.TaskType == (int)TaskOutboundTypeEnum.OutTray) //濡傛灉鏄垎瀹规垨楂樻俯鍑哄簱 灏嗕换鍔″垹闄� await DeleteTaskAsync(task.TaskId); + await AddTaskHtyAsync(taskHty); }); return content.OK("浠诲姟瀹屾垚鎴愬姛", task.Remark); @@ -236,6 +238,15 @@ } } + private async Task AddTaskHtyAsync(Dt_Task_Hty taskHty) + { + var isTaskAdd = await _task_HtyRepository.AddDataAsync(taskHty) > 0; + if (!isTaskAdd) + { + throw new Exception("鍘嗗彶浠诲姟淇℃伅娣诲姞澶辫触"); + } + } + #endregion 鍑哄簱浠诲姟瀹屾垚 #region 绉诲簱浠诲姟瀹屾垚 -- Gitblit v1.9.3