DISTLineConfig.cs 4.3 KB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace OnlineStore.LoadCSVLibrary
{
    public class FeederLineConfig : RobotConfig
    {
        public FeederLineConfig()
            : base()
        {
        }
        public FeederLineConfig(  string filepath)
            : base(1, "", "", filepath)
        {
        }


        /// <summary>
        ///  PRO,休眠秒数(秒),SleepSeconds,60,,,,,,,
        /// </summary>
        [ConfigProAttribute("SleepSeconds", false)]
        public int SleepSeconds { get; set; }

        /// <summary>
        /// PRO,IO信号超时时间(毫秒),IOSingle_TimerOut,10000,,,,,,,
        /// </summary>
        [ConfigProAttribute("IOSingle_TimerOut", false)]
        public int IOSingle_TimerOut { get; set; }

        /// <summary>
        /// PRO,IO模块对应的DI数量,IO_DILength,10.85.199.21#16,,,,,,,
        /// </summary>
        [ConfigProAttribute("IO_DILength")]
        public string IO_DILength { get; set; }
        /// <summary>
        /// PRO,模块对应的DO数量,IO_DOLength,10.85.199.21#16,,,,,,,
        /// </summary>
        [ConfigProAttribute("IO_DOLength")]
        public string IO_DOLength { get; set; }
        /// <summary>
        /// PRO,Feeder1线AGV节点名称,L1_AgvName,D21,,,,,,,
        /// </summary>
        [ConfigProAttribute("L1_AgvName")]
        public string L1_AgvName { get; set; }
        /// <summary>
        /// PRO,Feeder2线AGV节点名称,L2_AgvName,D22,,,,,,,
        /// </summary>
        [ConfigProAttribute("L2_AgvName")]
        public string L2_AgvName { get; set; }
         
        public double AirCheckSeconds = 60;


        /// <summary>
        /// PRO,Feeder线出口RFIDIP,L2Out_RFIDIP,192.168.103.108,,,,,, ,
        /// </summary>
        [ConfigProAttribute("L2Out_RFIDIP", false)]
        public string L2Out_RFIDIP { get; set; }
        /// <summary>
        /// PRO,Feeder线入口RFIDIP,L1In_RFIDIP,192.168.103.109,,,,,, ,
        /// </summary>
        [ConfigProAttribute("L1In_RFIDIP", false)]
        public string L1In_RFIDIP { get; set; }
        protected override void initMustHavePro()
        {
            MustHaveDIList = new List<string>();
            MustHaveDOList = new List<string>();
            MustHaveDIList.Add(IO_Type.SuddenStop_BTN);
        }
      
        private Dictionary<string, ushort> DILengthMap = null;
        private Dictionary<string, ushort> DOLengthMap = null;
        public ushort GetDILength(string ip)
        {
            try
            {
                if (DILengthMap == null)
                {
                    DILengthMap = new Dictionary<string, ushort>();
                    string[] arrayList = IO_DILength.Split(';');
                    foreach (string str in arrayList)
                    {
                        string[] arrStr = str.Split('#');
                        if (arrStr.Length == 2)
                        {
                            string ioip = arrStr[0];
                            ushort length = Convert.ToUInt16(arrStr[1]);
                            DILengthMap.Add(ioip, length);
                        }
                    }
                }
            }
            catch (Exception ex)
            {

            }
            if (DILengthMap.ContainsKey(ip))
            {
                return DILengthMap[ip];
            }
            return 16;
        }
        public ushort GetDOLength(string ip)
        {
            try
            {
                if (DOLengthMap == null)
                {
                    DOLengthMap = new Dictionary<string, ushort>();
                    string[] arrayList = IO_DOLength.Split(';');
                    foreach (string str in arrayList)
                    {
                        string[] arrStr = str.Split('#');
                        if (arrStr.Length == 2)
                        {
                            string ioip = arrStr[0];
                            ushort length = Convert.ToUInt16(arrStr[1]);
                            DOLengthMap.Add(ioip, length);
                        }
                    }
                }
            }
            catch (Exception ex)
            {

            }
            if (DOLengthMap.ContainsKey(ip))
            {
                return DOLengthMap[ip];
            }
            return 16;
        }

    }
}