From 9e9bbd003a79f25ead9ca990d2897ab6a2ed824a Mon Sep 17 00:00:00 2001 From: 肖洋 <cathay_xy@163.com> Date: 星期三, 18 十二月 2024 23:09:47 +0800 Subject: [PATCH] 更新 --- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs | 52 +++++++++++++++++++++++++++++++++------------------- 1 files changed, 33 insertions(+), 19 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 bc4f8f6..a64d5e3 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs @@ -108,6 +108,27 @@ ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(childDeviceCode, "DeviceCommand"); if (command != null && commandWrite != null) { + + #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.LineData(userIds?.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, childDeviceCode, data = obj }); + + #endregion 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇 + var structs = BitConverter.GetBytes(commandWrite.WriteInteractiveSignal).Reverse().ToArray().ToBoolArray(); List<DeviceProtocolDetailDTO>? deviceProtocolDetails = conveyorLine.DeviceProtocolDetailDTOs.Where(x => x.DeviceProParamName == nameof(ConveyorLineTaskCommand.InteractiveSignal)).ToList(); @@ -190,25 +211,6 @@ } } - #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.LineData(userIds?.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, childDeviceCode, data = obj }); - - #endregion 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇 } } @@ -234,6 +236,18 @@ { HandleTaskOut(conveyorLine, command, childDeviceCode, ProtocalDetailValue, task); } + else + { + var next = task.NextAddress; + var taskCommand = MapTaskCommand(task, command); + task.NextAddress = next; + conveyorLine.SendCommand(taskCommand, childDeviceCode); + + ConsoleHelper.WriteWarningLine($"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣姹傛壂鐮佸叆搴�,涓嬩竴鐩爣鍦板潃銆恵taskCommand.TargetAddress}銆�"); + + ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); + _taskService.UpdateTaskStatusToNext(task); + } } else { -- Gitblit v1.9.3