DataSeeding.cs 4.67 KB
using HHECS.DAQClient.Common.Enums;
using HHECS.DAQClient.Model;
using HHECS.EquipmentModel;

namespace HHECS.DAQClient.DataAccess
{
    /// <summary>
    /// 种子数据
    /// </summary>
    public static class DataSeeding
    {
        public static List<CommunicationConfig> GetCommunicationConfigs()
        {
            var temps = new List<CommunicationConfig>
            {
                new CommunicationConfig
                {
                    Code = "PLC1",
                    Name = "西门子S1500",
                    CommunicationType = CommunicationTypeConst.Siemens_S1500,
                    IpAddress = "127.0.0.1",
                    Port = 102,
                    Area = "1",
                    Disable = true,
                },
            };
            return temps;
        }

        public static List<Equipment> GetEquipment()
        {
            var temps = new List<Equipment>();
            return temps;
        }

        public static List<EquipmentProp> GetEquipmentProperties()
        {
            var temps = new List<EquipmentProp>();
            return temps;
        }

        public static List<EquipmentType> GetEquipmentTypes()
        {
            var temps = new List<EquipmentType>
            {
                new EquipmentType
                {
                    Code = EquipmentTypeConst.SingleForkSRM.ToString(),
                    Name = "单叉堆垛机",
                },
                new EquipmentType
                {
                    Code = EquipmentTypeConst.DoubleForkSRM.ToString(),
                    Name = "双叉堆垛机",
                },
                new EquipmentType
                {
                    Code = EquipmentTypeConst.SingleForkSSRM.ToString(),
                    Name = "单叉高速堆垛机",
                },
                new EquipmentType
                {
                    Code = EquipmentTypeConst.SingleForkSSRMV132.ToString(),
                    Name = "单叉单任务堆垛机V132",
                    Description = "V132版单叉单任务,一般为高速堆垛机,不兼容转轨",
                }
            };
            return temps;
        }

        /// <summary>
        /// 获取设备属性模板
        /// </summary>
        /// <returns></returns>
        public static List<EquipmentTypePropTemplate> GetEquipmentTypePropTemplates(EquipmentTypeConst equipmentType)
        {
            var temps = equipmentType switch
            {
                EquipmentTypeConst.SingleForkSRM => GetSingleSRMPropTemplates(),
                EquipmentTypeConst.DoubleForkSRM => GetDoubleSRMPropTemplates(),
                _ => new List<EquipmentTypePropTemplate>(),
            };
            return temps;
        }

        /// <summary>
        /// 单叉堆垛机属性模板
        /// </summary>
        /// <returns></returns>
        private static List<EquipmentTypePropTemplate> GetSingleSRMPropTemplates()
        {
            var temps = new List<EquipmentTypePropTemplate>
            {
                new EquipmentTypePropTemplate
                {
                    Code = SingleSRMPropConst.Code1.ToString(),
                    Name = "属性1",
                    Address = "DB100.0.0",
                    DataType = EquipmentDataType.WORD,
                    PropType = EquipmentPropType.PLCDataAddress,
                    MonitorCompareValue = string.Empty,
                    Description = string.Empty,
                    MonitorFailure = string.Empty,
                    MonitorNormal = string.Empty,
                },
            };
            //temps.ForEach(x =>
            //{
            //    x.EquipmentTypeId = 1;
            //});
            return temps;
        }

        /// <summary>
        /// 双叉堆垛机属性模板
        /// </summary>
        /// <returns></returns>
        private static List<EquipmentTypePropTemplate> GetDoubleSRMPropTemplates()
        {
            var temps = new List<EquipmentTypePropTemplate>
            {
                new EquipmentTypePropTemplate
                {
                    Code = DoubleSRMPropConst.Code1.ToString(),
                    Name = "属性1",
                    Address = "DB100.0.0",
                    DataType = EquipmentDataType.WORD,
                    PropType = EquipmentPropType.PLCDataAddress,
                    MonitorCompareValue = string.Empty,
                    Description = string.Empty,
                    MonitorFailure = string.Empty,
                    MonitorNormal = string.Empty,
                },
            };
            //temps.ForEach(x =>
            //{
            //    x.EquipmentTypeId = 2;
            //});
            return temps;
        }
    }
}