From 23cdbe08ee002d12c6d2a9034cc265fea0270a88 Mon Sep 17 00:00:00 2001
From: huanghongfeng <huanghongfeng@hnkhzn.com>
Date: 星期四, 18 九月 2025 17:11:44 +0800
Subject: [PATCH] 更新

---
 代码管理/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SpeStackerCraneJob/SpeStackerCraneJob.cs |   83 ++++++++++++++++++++++++++++++++++-------
 1 files changed, 69 insertions(+), 14 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SpeStackerCraneJob/SpeStackerCraneJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SpeStackerCraneJob/SpeStackerCraneJob.cs"
index 11b6056..1e98b9a 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SpeStackerCraneJob/SpeStackerCraneJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SpeStackerCraneJob/SpeStackerCraneJob.cs"
@@ -67,17 +67,18 @@
                     GetStackerObject getStackerObject = new GetStackerObject(speStackerCrane);
 
                     //璇诲彇璁惧瀹屾垚淇℃伅
-                    if (getStackerObject.StaclerkJobJobStatusValue == RgvJobCraneStatus.Completed && getStackerObject.CurrentRgvtaskid!=0)
+                    if (getStackerObject.StaclerkJobJobStatusValue == RgvJobCraneStatus.Completed && getStackerObject.CurrentRgvtaskid != 0)
                     {
                         _taskService.UpdateTaskStatus(getStackerObject.CurrentRgvtaskid);
                     }
-                    
+
 
                     if (getStackerObject.RgvCraneAutoStatusValue == RgvCraneAutoStatus.Automatic &&
                         getStackerObject.StaclerkJobJobStatusValue == RgvJobCraneStatus.Ready && getStackerObject.RgvCraneWorkStatusValue == RGVStepprocess.NoAction)
                     {
 
                         //涓嬪彂RGV浠诲姟涔嬪墠锛屽厛璇诲彇涓�涓嬪畨鍏ㄩ棬鐘舵��
+
 
 
 
@@ -126,7 +127,7 @@
             {
                 (int)TaskInStatusEnum.RGV_InNew => task,
                 (int)TaskInStatusEnum.RGV_InPickupFinish => HandlePickupFinish(task),
-                (int)TaskInStatusEnum.RGV_InReleaseFinish => task,  //闇�瑕佸垽鏂瓙杞︽槸鍐呬晶鍖鸿繕鏄渚у彇璐э紙寰呭畬鎴愶級
+                (int)TaskInStatusEnum.RGV_InReleaseFinish => HandInneRouterSides(task),
                 (int)TaskInStatusEnum.RGV_InZicheFinish => HandleZicheFinish(task),
                 (int)TaskInStatusEnum.RGV_InZicheReleaseFinish => HandleZicheReleaseFinish(task),
                 (int)TaskInStatusEnum.RGV_InZichemoveFinish => HandleZicheMoveFinish(task),
@@ -150,6 +151,60 @@
         }
 
         #region 鍏ュ簱鏂规硶
+        private Dt_Task? HandInneRouterSides(Dt_Task task)
+        {
+            // 楠岃瘉杈撳叆
+            if (task == null) throw new ArgumentNullException(nameof(task));
+            if (string.IsNullOrEmpty(task.CurrentAddress)) return null;
+
+            // 鑾峰彇褰撳墠绔欏彴淇℃伅
+            AGVStation currentStation = _agvStationService.GetAllStationByDeviceCode(int.Parse(task.CurrentAddress));
+            if (currentStation == null) return null;
+
+            // 鍙鐞嗙壒瀹氱被鍨嬬殑绔欏彴
+            if (currentStation.Station_material != (int)AgvStationEnum.HCJAisleplatform)
+                return task;
+
+            // 鑾峰彇瀛愯溅浣嶇疆
+            int zicheAddress = GetZichelocation(task, task.CurrentAddress);
+            if (zicheAddress == 0) return null;
+
+            AGVStation zicheStation = _agvStationService.GetAllStationByDeviceCode(zicheAddress);
+            if (zicheStation == null) return null;
+
+            // 鏍规嵁瀛愯溅浣嶇疆澶勭悊涓嶅悓鎯呭喌
+            switch (zicheStation.Station_material)
+            {
+                case (int)AgvStationEnum.Aisleplatform_Outside:
+                    // 瀛愯溅鍦ㄥ渚� - 鐩存帴杩斿洖浠诲姟
+                    return task;
+
+                case (int)AgvStationEnum.Aisleplatform_Medial:
+                    // 瀛愯溅鍦ㄥ唴渚� - 妫�鏌ユ瘝杞︿綅缃�
+                    return HandleMedialCase(task, currentStation, zicheStation);
+
+                default:
+                    // 鏈煡鐨勫瓙杞︿綅缃姸鎬�
+                    return null;
+            }
+        }
+
+        private Dt_Task? HandleMedialCase(Dt_Task task, AGVStation currentStation, AGVStation zicheStation)
+        {
+            int motherCarAddress = GetMothercarlocation(task.TaskNum, currentStation.MotherCarDeviceCode);
+            if (motherCarAddress == 0) return null;
+
+            // 濡傛灉姣嶈溅涓嶅湪棰勬湡浣嶇疆锛屼笅鍙戠Щ鍔ㄤ换鍔�
+            if (motherCarAddress != int.Parse(currentStation.MotherCarDeviceCode))
+            {
+                RGVMovetask(zicheStation.Motherinlaw, currentStation.ChildPosiDeviceCode, task.TaskId);
+                return null; // 姣嶈溅闇�瑕佺Щ鍔紝鏆備笉杩斿洖浠诲姟
+            }
+
+            // 姣嶈溅宸插湪姝g‘浣嶇疆
+            return task;
+        }
+
         private Dt_Task? HandlePickupFinish(Dt_Task task)
         {
             try
@@ -203,7 +258,7 @@
             }
             else if (aGVStation.Station_Area == 3)  //褰撳墠鍦板潃涓篐CJ绔欏彴锛屼笖AGV浠诲姟涓哄彇璐�
             {
-                return task;    //鍘诲彇璐э紝闇�瑕佸垽鏂瓙杞﹀綋鍓嶄綅瀛愶紝锛堝悗缁紭鍖栵級
+                return task;    //鍘诲彇璐т綅锛岄渶瑕佸垽鏂瓙杞﹀綋鍓嶄綅瀛愶紝锛堝悗缁紭鍖栵級
             }
 
             return null;
@@ -226,13 +281,13 @@
         private bool MotherCarMoves(Dt_Task _Task, AGVStation aGVStation)
         {
             int mcadder = GetMothercarlocation(_Task.TaskNum, aGVStation.Motherinlaw);      //鑾峰彇鍒版瘝杞﹀渚т綅缃�
-            if(mcadder != 0)
+            if (mcadder != 0)
             {
                 if (mcadder == int.Parse(_Task.CurrentAddress))
                 {
                     return true;
                 }
-                 RGVMovetask(_Task.CurrentAddress, aGVStation.ChildPosiDeviceCode,_Task.TaskId);
+                RGVMovetask(_Task.CurrentAddress, aGVStation.ChildPosiDeviceCode, _Task.TaskId);
             }
             return false;
         }
@@ -243,7 +298,7 @@
         /// <param name="RGVAdders">鐩爣鍦板潃</param>
         /// <param name="ChildPosiDeviceCode">璁惧缂栧彿</param>
         /// <returns></returns>
-        private bool RGVMovetask(string RGVAdders,string ChildPosiDeviceCode,int taskid)
+        private bool RGVMovetask(string RGVAdders, string ChildPosiDeviceCode, int taskid)
         {
             RgvCraneTaskCommand standardCommands = ConvertMotherCarTaskCommand(RGVAdders);
             bool sendFlag = SendCommand2(standardCommands, ChildPosiDeviceCode);
@@ -288,14 +343,14 @@
             }
             return false;
         }
-        private bool HCJMotherCarMovesinside(Dt_Task _Task, AGVStation aGVStation)  
+        private bool HCJMotherCarMovesinside(Dt_Task _Task, AGVStation aGVStation)
         {
             //鑾峰彇澶栦晶姣嶈溅浣嶇疆
             int mcadder = GetMothercarlocation(_Task.TaskNum, aGVStation.MotherCarDeviceCode);
             //鑾峰彇鍐呬晶姣嶈溅浣嶇疆
-            int ncadder = GetMothercarlocation(_Task.TaskNum, aGVStation.MotherCardeputy);   
+            int ncadder = GetMothercarlocation(_Task.TaskNum, aGVStation.MotherCardeputy);
 
-            if (mcadder != int.Parse(aGVStation.MotherCarDeviceCode) && ncadder != int.Parse(aGVStation.MotherCardeputy))   
+            if (mcadder != int.Parse(aGVStation.MotherCarDeviceCode) && ncadder != int.Parse(aGVStation.MotherCardeputy))
             {
                 return true;
             }
@@ -319,7 +374,7 @@
             return false;
         }
 
-       
+
 
         //鍒ゆ柇鏄惁
         public bool GetMotherCarCurrentAdder(Dt_Task task)
@@ -358,7 +413,7 @@
             try
             {
                 //鍒╃敤鍏ュ簱绔欏彴鍦板潃鑾峰彇姣嶈溅plc
-                AGVStation aGVStation =_agvStationService.GetMothercarCode(MotherCarDeviceCode);  
+                AGVStation aGVStation = _agvStationService.GetMothercarCode(MotherCarDeviceCode);
                 IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == aGVStation.ChildPosiDeviceCode);
                 CommonStackerCrane Commonstacker = (CommonStackerCrane)device;
                 DeviceProDTO? deviceProDTO = GetDeviceProDTO(Commonstacker, aGVStation.ChildPosiDeviceCode, "RGVCurrentlocation");
@@ -461,7 +516,7 @@
         /// <returns></returns>
         public DeviceProDTO? GetDeviceProDTO(CommonStackerCrane Commonstacker, string SCAddress, string Interactivet)
         {
-            return Commonstacker.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == SCAddress && x.DeviceProParamName == Interactivet && x.DeviceProParamType== "ReadDeviceCommand");
+            return Commonstacker.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == SCAddress && x.DeviceProParamName == Interactivet && x.DeviceProParamType == "ReadDeviceCommand");
         }
         /// <summary>
         /// 鏍瑰湴鍧�璇诲彇杈撻�佺嚎淇℃伅
@@ -483,7 +538,7 @@
                 IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == DeviceCode);
                 CommonStackerCrane Commonstacker = (CommonStackerCrane)device;
 
-                DeviceProDTO? deviceProDTO =  GetDeviceProDTO(Commonstacker, DeviceCode, "RGV_Rgvtaskstutas");
+                DeviceProDTO? deviceProDTO = GetDeviceProDTO(Commonstacker, DeviceCode, "RGV_Rgvtaskstutas");
                 int MCGStatus = GetLine(Commonstacker, deviceProDTO.DeviceProAddress);
                 if (Commonstacker.IsConnected)
                 {

--
Gitblit v1.9.3