huanghongfeng
2025-09-26 83f3c63f1cae6224320a8d19251e3bc0404da096
´úÂë¹ÜÀí/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SpeStackerCraneJob/GetDeviceAddress.cs
@@ -8,6 +8,7 @@
using WIDESEAWCS_QuartzJob;
using WIDESEA_Common.Log;
using System.Xml.Linq;
using SixLabors.ImageSharp;
namespace WIDESEAWCS_Tasks.StackerCraneJob
{
@@ -20,18 +21,83 @@
        /// </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;
            GetStackerObject getStackerObject = new GetStackerObject(speStackerCrane);
            return getStackerObject.RGVCurrentlocation;
        }
        /// <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;
            GetStackerObject getStackerObject = new GetStackerObject(speStackerCrane);
            if (getStackerObject.RgvCraneAutoStatusValue == RgvCraneAutoStatus.Automatic &&
                        getStackerObject.StaclerkJobJobStatusValue == RgvJobCraneStatus.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;
            GetStackerObject getStackerObject = new GetStackerObject(speStackerCrane);
            if (getStackerObject.RgvCraneAutoStatusValue == RgvCraneAutoStatus.Automatic &&
                        getStackerObject.StaclerkJobJobStatusValue == RgvJobCraneStatus.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;
            GetStackerObject getStackerObject = new GetStackerObject(speStackerCrane);
            if (getStackerObject.RgvCraneAutoStatusValue == RgvCraneAutoStatus.Automatic &&
                        getStackerObject.StaclerkJobJobStatusValue == RgvJobCraneStatus.Ready && getStackerObject.RgvCraneWorkStatusValue == RGVStepprocess.NoAction)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// æŸ¥è¯¢HCJ站台设备
        /// </summary>
        /// <param name="Commonstacker"></param>
        /// <param name="SCAddress"></param>
@@ -42,7 +108,17 @@
            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 == "ReadDeviceCommand");
        }
        /// <summary>
        /// è¯»å–设备信息
        /// </summary>
@@ -50,6 +126,11 @@
        /// <param name="DeviceProDataBlock"></param>
        /// <returns></returns>
        public static int GetLine(CommonStackerCrane 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 +147,26 @@
        {
            WriteLog.Write_Log(SCLLinStack, Filename, Logtype, new { ä¿¡æ¯ = Magessadd });
        }
        /// <summary>
        /// ä¼ å…¥ç«™å°ç¼–号,判断是否有货
        /// </summary>
        /// <param name="Platformnumber">站台编号</param>
        public static bool HCJIsstock(string Platformnumber)
        {
            //获取需要区分是否去入库与去不合格载货台任务
            IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "HCJ2000");
            CommonStackerCrane Commonstacker = (CommonStackerCrane)device;
            DeviceProDTO? deviceProDTO = GetDeviceProDTO(Commonstacker, Platformnumber.ToString(), "HCJ_GoodsStatus");
            int HCJGStatus = GetLine(Commonstacker, deviceProDTO.DeviceProAddress);
            if (HCJGStatus == 0)    //为无货
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}