From 9843b47612ee6ab23e3e36bf74b14c11354997af Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期日, 23 三月 2025 15:25:32 +0800
Subject: [PATCH] 1

---
 CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs |   60 ++++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 40 insertions(+), 20 deletions(-)

diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs
index 6852e39..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
 {
@@ -151,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}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曟竻闄ゅ嚭搴撶珯鍙伴《鍗囩姸鎬�");
+                        }
+                    }
                 }
             }
         }
@@ -192,16 +211,20 @@
 
             if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
             {
-                if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound) 
+                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;
-                        string str = conveyorLine.DeviceProDTOs.Where(x => x.DeviceChildCode == stationManager.stationChildCode).Select(x => x.DeviceProAddress) + ".0";
+                        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);
-                        return task;
                     }
                     else
                     {
@@ -209,20 +232,17 @@
                         return null;
                     }
                 }
+                // 妫�鏌ュ綋鍓嶅嚭搴撲换鍔$珯鍙版槸鍚﹀厑璁告斁璐�
+                var occupiedStation = OutTaskStationIsOccupied(task);
+                if (occupiedStation == null)
+                {
+                    // 濡傛灉褰撳墠鍑哄簱浠诲姟绔欏彴涓嶅厑璁告斁璐э紝鎺掗櫎褰撳墠浠诲姟锛屾煡鎵惧叾浠栧嚭搴撲换鍔�
+                    ConsoleHelper.WriteErrorLine($"浠诲姟鍙凤細銆恵task.TaskNum}銆戝嚭搴撳湴鍧�锛氥�恵task.NextAddress}銆戜笉鍏佽鏀捐揣");
+                    task = FindAnotherOutboundTask(commonStackerCrane.DeviceCode, task);
+                }
                 else
                 {
-                    // 妫�鏌ュ綋鍓嶅嚭搴撲换鍔$珯鍙版槸鍚﹀厑璁告斁璐�
-                    var occupiedStation = OutTaskStationIsOccupied(task);
-                    if (occupiedStation == null)
-                    {
-                        // 濡傛灉褰撳墠鍑哄簱浠诲姟绔欏彴涓嶅厑璁告斁璐э紝鎺掗櫎褰撳墠浠诲姟锛屾煡鎵惧叾浠栧嚭搴撲换鍔�
-                        ConsoleHelper.WriteErrorLine($"浠诲姟鍙凤細銆恵task.TaskNum}銆戝嚭搴撳湴鍧�锛氥�恵task.NextAddress}銆戜笉鍏佽鏀捐揣");
-                        task = FindAnotherOutboundTask(commonStackerCrane.DeviceCode, task);
-                    }
-                    else
-                    {
-                        return task;
-                    }
+                    return task;
                 }
 
                 if (task == null)

--
Gitblit v1.9.3