From af9c3ed5d036ad68faf7e18f566679b3da92d244 Mon Sep 17 00:00:00 2001 From: wanshenmean <cathay_xy@163.com> Date: 星期六, 22 三月 2025 11:36:06 +0800 Subject: [PATCH] 合并 --- CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs | 49 ++++++++++++++++++++++++++++--------------------- 1 files changed, 28 insertions(+), 21 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..6852e39 100644 --- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs +++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs @@ -55,8 +55,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 +66,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 +122,7 @@ catch (Exception ex) { WriteError("CommonStackerStationCraneJob", "test", ex); - //Console.WriteLine(nameof(CommonStackerCraneJob) + ":" + ex.ToString()); } - finally - { - StaticVariable.isStackerRun = true; - } - //WriteDebug("CommonStackerStationCraneJob", "test"); return Task.CompletedTask; } @@ -205,17 +192,37 @@ if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { - // 妫�鏌ュ綋鍓嶅嚭搴撲换鍔$珯鍙版槸鍚﹀厑璁告斁璐� - var occupiedStation = OutTaskStationIsOccupied(task); - if (occupiedStation == null) + if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound) { - // 濡傛灉褰撳墠鍑哄簱浠诲姟绔欏彴涓嶅厑璁告斁璐э紝鎺掗櫎褰撳墠浠诲姟锛屾煡鎵惧叾浠栧嚭搴撲换鍔� - ConsoleHelper.WriteErrorLine($"浠诲姟鍙凤細銆恵task.TaskNum}銆戝嚭搴撳湴鍧�锛氥�恵task.NextAddress}銆戜笉鍏佽鏀捐揣"); - task = FindAnotherOutboundTask(commonStackerCrane.DeviceCode, 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; + string str = conveyorLine.DeviceProDTOs.Where(x => x.DeviceChildCode == stationManager.stationChildCode).Select(x => x.DeviceProAddress) + ".0"; + conveyorLine.Communicator.Write(str, true); + return task; + } + else + { + _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒板嚭搴撶珯鍙般�恵task.NextAddress}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤"); + return null; + } } else { - return task; + // 妫�鏌ュ綋鍓嶅嚭搴撲换鍔$珯鍙版槸鍚﹀厑璁告斁璐� + var occupiedStation = OutTaskStationIsOccupied(task); + if (occupiedStation == null) + { + // 濡傛灉褰撳墠鍑哄簱浠诲姟绔欏彴涓嶅厑璁告斁璐э紝鎺掗櫎褰撳墠浠诲姟锛屾煡鎵惧叾浠栧嚭搴撲换鍔� + ConsoleHelper.WriteErrorLine($"浠诲姟鍙凤細銆恵task.TaskNum}銆戝嚭搴撳湴鍧�锛氥�恵task.NextAddress}銆戜笉鍏佽鏀捐揣"); + task = FindAnotherOutboundTask(commonStackerCrane.DeviceCode, task); + } + else + { + return task; + } } if (task == null) -- Gitblit v1.9.3