From 0e022ecccc0cccd486df4cd208658c332ddbdf3b Mon Sep 17 00:00:00 2001
From: huanghongfeng <huanghongfeng@hnkhzn.com>
Date: 星期一, 20 十月 2025 19:58:45 +0800
Subject: [PATCH] 1

---
 代码管理/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SpeStackerCraneJob/GetDeviceAddress.cs |  231 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 221 insertions(+), 10 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SpeStackerCraneJob/GetDeviceAddress.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SpeStackerCraneJob/GetDeviceAddress.cs"
index 23e19e6..f971694 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SpeStackerCraneJob/GetDeviceAddress.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SpeStackerCraneJob/GetDeviceAddress.cs"
@@ -8,10 +8,12 @@
 using WIDESEAWCS_QuartzJob;
 using WIDESEA_Common.Log;
 using System.Xml.Linq;
+using SixLabors.ImageSharp;
+using WIDESEAWCS_QuartzJob.Service;
 
 namespace WIDESEAWCS_Tasks.StackerCraneJob
 {
-
+    
 
     public class GetDeviceAddress
     {
@@ -20,36 +22,152 @@
         /// </summary>
         /// <param name="ChildPosiDeviceCode">璁惧</param>
         /// <returns></returns>
-        public static int GetEquipmentlocation(string ChildPosiDeviceCode)
+        public static int GetEquipmentlocation(string ChildPosiDeviceCode)   
         {
             IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == ChildPosiDeviceCode);
-            CommonStackerCrane Commonstacker = (CommonStackerCrane)device;
-            DeviceProDTO? deviceProDTO = GetDeviceProDTO(Commonstacker, ChildPosiDeviceCode, "RGVCurrentlocation");
-            int HCJGStatus = GetLine(Commonstacker, deviceProDTO.DeviceProAddress);
-            return HCJGStatus;
+            SpeStackerCrane speStackerCrane = (SpeStackerCrane)device;
+            if (speStackerCrane == null) return 0;
+            DeviceProDTO? deviceProDTO = speStackerCrane.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == ChildPosiDeviceCode && x.DeviceProParamName == "RGVCurrentlocation" && x.DeviceProParamType == "RGVCurrentlocation");
+            int MCGStatus = GetDeviceAddress.RGVGetLine(speStackerCrane, deviceProDTO.DeviceProAddress);
+            return MCGStatus;
+        }
+
+        /// <summary>
+        /// 浼犲叆璁惧锛岃繑鍥炶澶囦俊鎭�
+        /// </summary>
+        /// <param name="ChildPosiDeviceCode">璁惧</param>
+        /// <returns></returns>
+        public static GetStackerObject GetChildDeviceCode(string ChildPosiDeviceCode)
+        {
+            IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == ChildPosiDeviceCode);
+            SpeStackerCrane speStackerCrane = (SpeStackerCrane)device;
+            if (speStackerCrane == null)
+            {
+                Console.WriteLine($"璇诲彇鍒拌澶囦负绌�,璁惧缂栧彿锛歿ChildPosiDeviceCode},002");
+                return null;
+            }
+            GetStackerObject getStackerObject = new GetStackerObject(speStackerCrane);
+            return getStackerObject;
         }
 
 
         /// <summary>
-        /// 鏌ヨ鍏蜂綋鍦板潃
+        /// 浼犲叆璁惧锛岃繑鍥炲綋鍓嶈澶囦俊鎭�
+        /// </summary>
+        /// <param name="ChildPosiDeviceCode">璁惧</param>
+        /// <returns></returns>
+        public static int GetEquipmentInformation(string ChildPosiDeviceCode)
+        {
+            IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == ChildPosiDeviceCode);
+            SpeStackerCrane speStackerCrane = (SpeStackerCrane)device;
+            if (speStackerCrane == null)
+            {
+                Console.WriteLine($"璇诲彇鍒拌澶囦负绌�,璁惧缂栧彿锛歿ChildPosiDeviceCode},003");
+                return 0;
+            }
+            GetStackerObject getStackerObject = new GetStackerObject(speStackerCrane);
+            if (getStackerObject.RgvCraneAutoStatusValue == RgvCraneAutoStatus.Automatic &&
+                        getStackerObject.StaclerkJobJobStatusValue == RGV_Rgvtaskstutas.Ready && getStackerObject.RgvCraneWorkStatusValue == RGVStepprocess.NoAction)
+            {
+                return getStackerObject.RGVCurrentlocation;
+            }
+            else
+            {
+                return 0;
+            }
+                
+        }
+
+        /// <summary>
+        /// 浼犲叆璁惧锛岃繑鍥炲綋鍓嶈澶囦俊鎭紙鍏ュ簱姣嶈溅锛岄渶瑕佸姞鍏ユ槸鍚︽湁璐у垽鏂�)
+        /// </summary>
+        /// <param name="ChildPosiDeviceCode">璁惧</param>
+        /// <returns></returns>
+        public static int GetEquipmentInMuche(string ChildPosiDeviceCode)
+        {
+            IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == ChildPosiDeviceCode);
+            SpeStackerCrane speStackerCrane = (SpeStackerCrane)device;
+            if (speStackerCrane == null)
+            {
+                Console.WriteLine($"璇诲彇鍒拌澶囦负绌�,璁惧缂栧彿锛歿ChildPosiDeviceCode},004");
+                return 0;
+            }
+            GetStackerObject getStackerObject = new GetStackerObject(speStackerCrane);
+            if (getStackerObject.RgvCraneAutoStatusValue == RgvCraneAutoStatus.Automatic &&
+                        getStackerObject.StaclerkJobJobStatusValue == RGV_Rgvtaskstutas.Ready && getStackerObject.RgvCraneWorkStatusValue == RGVStepprocess.NoAction && getStackerObject.RgvCraneStatusValue == RgvEquipmentStatus.NoCargo)
+            {
+                return getStackerObject.RGVCurrentlocation;
+            }
+            else
+            {
+                return 0;
+            }
+
+        }
+
+
+        /// <summary>
+        /// 浼犲叆璁惧缂栧彿锛屽垽鏂澶囩姸鎬佹槸鍚﹀彲杩涘叆
+        /// </summary>
+        /// <param name="ChildPosiDeviceCode"></param>
+        /// <returns></returns>
+        public static bool ReturnCurrentStatus(string ChildPosiDeviceCode)
+        {
+            IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == ChildPosiDeviceCode);
+            SpeStackerCrane speStackerCrane = (SpeStackerCrane)device;
+            if (speStackerCrane == null)
+            {
+                Console.WriteLine($"璇诲彇鍒拌澶囦负绌�,璁惧缂栧彿锛歿ChildPosiDeviceCode},005");
+                return false;
+            }
+            GetStackerObject getStackerObject = new GetStackerObject(speStackerCrane);
+            if (getStackerObject.RgvCraneAutoStatusValue == RgvCraneAutoStatus.Automatic &&
+                        getStackerObject.StaclerkJobJobStatusValue == RGV_Rgvtaskstutas.Ready && getStackerObject.RgvCraneWorkStatusValue == RGVStepprocess.NoAction)
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+
+        /// <summary>
+        /// 鏌ヨHCJ绔欏彴璁惧
         /// </summary>
         /// <param name="Commonstacker"></param>
         /// <param name="SCAddress"></param>
         /// <param name="Interactivet"></param>
         /// <returns></returns>
-        public static DeviceProDTO? GetDeviceProDTO(CommonStackerCrane Commonstacker, string SCAddress, string Interactivet)
+        public static DeviceProDTO? GetDeviceProDTO(CommonConveyorLine Commonstacker, string SCAddress, string Interactivet)
         {
             return Commonstacker.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == SCAddress && x.DeviceProParamName == Interactivet && x.DeviceProParamType == "ReadDeviceCommand");
         }
 
-
+        /// <summary>
+        /// 鏌ヨRGV璁惧
+        /// </summary>
+        /// <param name="Commonstacker"></param>
+        /// <param name="SCAddress"></param>
+        /// <param name="Interactivet"></param>
+        /// <returns></returns>
+        public static DeviceProDTO? GetRGVDeviceProDTO(SpeStackerCrane Commonstacker, string SCAddress, string Interactivet)
+        {
+            return Commonstacker.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == SCAddress && x.DeviceProParamName == Interactivet && x.DeviceProParamType == "RGV_Rgvtaskstutas");
+        }
         /// <summary>
         /// 璇诲彇璁惧淇℃伅
         /// </summary>
         /// <param name="conveyorLine"></param>
         /// <param name="DeviceProDataBlock"></param>
         /// <returns></returns>
-        public static int GetLine(CommonStackerCrane Commonstacker, string DeviceProDataBlock)
+        public static int GetLine(CommonConveyorLine Commonstacker, string DeviceProDataBlock)
+        {
+            return Commonstacker.Communicator.Read<short>(DeviceProDataBlock);
+        }
+
+        public static int RGVGetLine(SpeStackerCrane Commonstacker, string DeviceProDataBlock)
         {
             return Commonstacker.Communicator.Read<short>(DeviceProDataBlock);
         }
@@ -66,5 +184,98 @@
         {
             WriteLog.Write_Log(SCLLinStack, Filename, Logtype, new { 淇℃伅 = Magessadd });
         }
+
+        /// <summary>
+        /// 浼犲叆绔欏彴缂栧彿锛屽垽鏂槸鍚︽湁璐�
+        /// </summary>
+        /// <param name="Platformnumber">绔欏彴缂栧彿</param>
+        public static bool HCJIsstock(string Platformnumber)
+        {
+            return true;
+            //鑾峰彇闇�瑕佸尯鍒嗘槸鍚﹀幓鍏ュ簱涓庡幓涓嶅悎鏍艰浇璐у彴浠诲姟
+            IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "HCJ2000");
+            CommonConveyorLine Commonstacker = (CommonConveyorLine)device;
+            DeviceProDTO? deviceProDTO = GetDeviceProDTO(Commonstacker, Platformnumber.ToString(), "HCJ_GoodsStatus");
+            int HCJGStatus = GetLine(Commonstacker, deviceProDTO.DeviceProAddress);
+            if (HCJGStatus == 0)    //涓烘棤璐�
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 鍒ゆ柇璁惧鏄惁鏈夎揣
+        /// </summary>
+        public static bool Mucheywhaddres(string DeviceCode)
+        {
+            IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == DeviceCode);
+            SpeStackerCrane Commonstacker = (SpeStackerCrane)device;
+
+            DeviceProDTO? deviceProDTO = Commonstacker.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == DeviceCode && x.DeviceProParamName == "RgvEquipmentStatus" && x.DeviceProParamType == "RgvEquipmentStatus");
+            int MCGStatus = GetDeviceAddress.RGVGetLine(Commonstacker, deviceProDTO.DeviceProAddress);
+            if(MCGStatus== (int)RgvEquipmentStatus.NoCargo)
+            {
+                return true;
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 鍒ゆ柇3涓畨鍏ㄩ棬鐘舵��
+        /// </summary>
+        public static bool AQMStatus(List<AGVStation> aGVStatList)
+        {
+            try
+            {
+                IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "HCJ2000");
+                CommonConveyorLine Commonstacker = (CommonConveyorLine)device;
+                foreach (var item in aGVStatList)
+                {
+                    DeviceProDTO? deviceProDTO = GetDeviceProDTO(Commonstacker, item.Station_code.ToString(), "HCJ_GoodsStatus");
+                    int HCJGStatus = GetLine(Commonstacker, deviceProDTO.DeviceProAddress);
+                    if (HCJGStatus != 0)    //涓烘棤璐�
+                    {
+                        return false;
+                    }
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                return false;
+                throw;
+            }
+            
+        }
+
+        public static List<string> StationareaList = new List<string>() { "RGV111", "RGV116", "RGV110", "RGV112", "RGV114", "RGV115" };
+
+        public static bool OutbounMotherChildCartbool(string DeviceChildCode)
+        {
+            if (StationareaList.Contains(DeviceChildCode))
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+        public static bool OutbounMotherChildCartbool2(string DeviceChildCode)
+        {
+            if (DeviceChildCode=="RGV104" || DeviceChildCode == "RGV107")
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
     }
 }

--
Gitblit v1.9.3