1
huanghongfeng
10 天以前 0b4792ff8245f9eac16e6d02452eb9a091f6f72b
´úÂë¹ÜÀí/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SpeStackerCraneJob/GetDeviceAddress.cs
@@ -10,6 +10,7 @@
using System.Xml.Linq;
using SixLabors.ImageSharp;
using WIDESEAWCS_QuartzJob.Service;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
namespace WIDESEAWCS_Tasks.StackerCraneJob
{
@@ -191,7 +192,6 @@
        /// <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;
@@ -252,7 +252,7 @@
            
        }
        public static List<string> StationareaList = new List<string>() { "RGV111", "RGV116", "RGV110", "RGV112", "RGV114", "RGV115" };
        public static List<string> StationareaList = new List<string>() { "RGV111", "RGV116", "RGV110", "RGV112", "RGV114", "RGV115","RGV118" };
        public static bool OutbounMotherChildCartbool(string DeviceChildCode)
        {
@@ -277,5 +277,75 @@
                return false;
            }
        }
        /// <summary>
        /// è¯»å–子是否为手动
        /// </summary>
        public static bool OutRGVStatice()
        {
            bool rgvbool=false;
            foreach (string AGVStation in StationareaList)
            {
                IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == AGVStation);
                if (device == null) return false;
                SpeStackerCrane Commonstacker = (SpeStackerCrane)device;
                DeviceProDTO? deviceProDTO = Commonstacker.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == AGVStation && x.DeviceProParamName == "RgvCraneAutoStatus" && x.DeviceProParamType == "RgvCraneAutoStatus");
                int RGVState = GetDeviceAddress.RGVGetLine(Commonstacker, deviceProDTO.DeviceProAddress);
                if (RGVState == 0)
                {
                    rgvbool= true;
                }
            }
            return rgvbool;
        }
        public static bool WriteSecurityDoorpolice(string DeviceCode,string WriteType,int Writevalue)
        {
            try
            {
                IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == DeviceCode);
                if (device == null) return false;
                CommonConveyorLine commonConveyorLine = (CommonConveyorLine)device;
                DeviceProDTO? deviceProDTO = commonConveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == DeviceCode && x.DeviceProParamName == WriteType && x.DeviceProParamType == "DeviceCommand");
                return commonConveyorLine.Communicator.Write<short>(deviceProDTO.DeviceProDataBlock, (short)Writevalue);
            }
            catch (Exception)
            {
                return false;
                throw;
            }
        }
        public static List<string> AQMListdata = new List<string>() { "AQM001", "AQM002"};
        /// <summary>
        /// åˆ¤æ–­å®‰å…¨é—¨çŠ¶æ€
        /// </summary>
        /// <param name="aqmtype">1为出库安全门3号,2为入库安全门判断</param>
        /// <returns></returns>
        public static bool ReadAqmDecicStice(int aqmtype)
        {
            IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "HCJ2000");
            CommonConveyorLine commonConveyorLine = (CommonConveyorLine)device;
            if (aqmtype == 1)
            {
                DeviceProDTO? deviceProDTO = commonConveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == "AQM003" && x.DeviceProParamName == "IndicatorStatus" && x.DeviceProParamType == "ReadDeviceCommand");
                short AQMldeng = commonConveyorLine.Communicator.Read<short>(deviceProDTO.DeviceProDataBlock);
                if (AQMldeng == 2) return false;
            }
            else
            {
                foreach (string aqmname in AQMListdata)
                {
                    DeviceProDTO? deviceProDTO = commonConveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == aqmname && x.DeviceProParamName == "IndicatorStatus" && x.DeviceProParamType == "ReadDeviceCommand");
                    short AQMldeng = commonConveyorLine.Communicator.Read<short>(deviceProDTO.DeviceProDataBlock);
                    if (AQMldeng == 2) return false;
                }
            }
            return true;
        }
    }
}