From 6cc88ff41d879065dc0752c8af566002baf0a5c2 Mon Sep 17 00:00:00 2001 From: wanshenmean <cathay_xy@163.com> Date: 星期日, 23 三月 2025 15:28:19 +0800 Subject: [PATCH] 合并 --- CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs | 65 +++++++++++++++++++++++--------- 1 files changed, 46 insertions(+), 19 deletions(-) diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs index 73152f9..71c7a8b 100644 --- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs +++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs @@ -1,4 +1,4 @@ -锘縰sing HslCommunication; +锘縰sing Masuit.Tools.Systems; using Newtonsoft.Json; using Quartz; using System.Diagnostics.CodeAnalysis; @@ -9,20 +9,17 @@ using WIDESEAWCS_Core.Caches; using WIDESEAWCS_Core.Helper; using WIDESEAWCS_Core.HttpContextUser; -using WIDESEAWCS_DTO.MOM; using WIDESEAWCS_IProcessRepository; using WIDESEAWCS_ITaskInfoRepository; using WIDESEAWCS_ITaskInfoService; -using WIDESEAWCS_Model; using WIDESEAWCS_Model.Models; using WIDESEAWCS_QuartzJob; using WIDESEAWCS_QuartzJob.DeviceBase; -using WIDESEAWCS_QuartzJob.Models; using WIDESEAWCS_QuartzJob.Service; using WIDESEAWCS_QuartzJob.StackerCrane.Enum; using WIDESEAWCS_SignalR; +using WIDESEAWCS_Tasks.ConveyorLineJob; using WIDESEAWCS_Tasks.StackerCraneJob; -using WIDESEAWCS_Common; namespace WIDESEAWCS_Tasks { @@ -55,8 +52,6 @@ CommonStackerStationCrane commonStackerCrane = (CommonStackerStationCrane)context.JobDetail.JobDataMap.Get("JobParams"); if (commonStackerCrane != null) { - //EqptAlive(commonStackerCrane); - //Console.Out.WriteLine(commonStackerCrane.DeviceName); if (!commonStackerCrane.IsEventSubscribed) { commonStackerCrane.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//璁㈤槄浠诲姟瀹屾垚浜嬩欢 @@ -68,12 +63,7 @@ if (commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) { - Dt_Task? task = null; - if (StaticVariable.isLineRun) - { - StaticVariable.isStackerRun = false; - task = GetTask(commonStackerCrane); - } + Dt_Task? task = GetTask(commonStackerCrane); if (task != null) { StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); @@ -129,13 +119,7 @@ catch (Exception ex) { WriteError("CommonStackerStationCraneJob", "test", ex); - //Console.WriteLine(nameof(CommonStackerCraneJob) + ":" + ex.ToString()); } - finally - { - StaticVariable.isStackerRun = true; - } - //WriteDebug("CommonStackerStationCraneJob", "test"); return Task.CompletedTask; } @@ -164,6 +148,28 @@ str = $"{commonStackerCrane.DeviceName}銆慦MS|WCS浠诲姟瀹屾垚锛氥�恵content.Status}銆�,鍫嗗灈鏈哄畬鎴愪俊鍙峰啓鍏ワ細銆恵isWorkType}銆�,浠诲姟鍙凤細銆恵e.TaskNum}銆戞椂闂淬�恵DateTime.Now}銆�"; WriteInfo(commonStackerCrane.DeviceName, str); ConsoleHelper.WriteColorLine(str, ConsoleColor.Blue); + + if (content.Status) + { + var task = content.Data as Dt_Task; + Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.Roadway == task.Roadway && x.stationLocation == task.TargetAddress); + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManager.stationPLC); + if (device != null) + { + CommonConveyorLine_After conveyorLine = (CommonConveyorLine_After)device; + var proAddress = conveyorLine.DeviceProDTOs.Where(x => x.DeviceChildCode == stationManager.stationChildCode).Where(x => x.DeviceProParamName == ConveyorLineDBName_After.InteractiveSignal.ToString()).FirstOrDefault().DeviceProAddress; + string? address = proAddress; + if (!proAddress.Contains(".0")) + { + address = proAddress + ".0"; + } + conveyorLine.Communicator.Write(str, false); + } + else + { + _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒板嚭搴撶珯鍙般�恵task.NextAddress}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曟竻闄ゅ嚭搴撶珯鍙伴《鍗囩姸鎬�"); + } + } } } } @@ -205,6 +211,27 @@ if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { + if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound) + { + Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.Roadway == task.Roadway && x.stationLocation == task.TargetAddress); + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManager.stationPLC); + if (device != null) + { + CommonConveyorLine_After conveyorLine = (CommonConveyorLine_After)device; + var proAddress = conveyorLine.DeviceProDTOs.Where(x => x.DeviceChildCode == stationManager.stationChildCode).Where(x => x.DeviceProParamName == ConveyorLineDBName_After.InteractiveSignal.ToString()).FirstOrDefault().DeviceProAddress; + string? str = proAddress; + if (!proAddress.Contains(".0")) + { + str = proAddress + ".0"; + } + conveyorLine.Communicator.Write(str, true); + } + else + { + _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒板嚭搴撶珯鍙般�恵task.NextAddress}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤"); + return null; + } + } // 妫�鏌ュ綋鍓嶅嚭搴撲换鍔$珯鍙版槸鍚﹀厑璁告斁璐� var occupiedStation = OutTaskStationIsOccupied(task); if (occupiedStation == null) -- Gitblit v1.9.3