Blame view

HHECS.DAQClient/DataAccess/DataSeeding.cs 6.75 KB
唐召明 authored
1
2
using HHECS.DAQClient.Common.Enums;
using HHECS.DAQClient.Model;
唐召明 authored
3
using HHECS.EquipmentModel;
唐召明 authored
4
唐召明 authored
5
namespace HHECS.DAQClient.DataAccess
唐召明 authored
6
7
8
9
10
11
12
13
{
    /// <summary>
    /// 种子数据
    /// </summary>
    public static class DataSeeding
    {
        public static List<CommunicationConfig> GetCommunicationConfigs()
        {
唐召明 authored
14
15
16
17
            var temps = new List<CommunicationConfig>
            {
                new CommunicationConfig
                {
18
                    Id = 1,
唐召明 authored
19
20
21
22
23
                    Code = "PLC1",
                    Name = "西门子S1500",
                    CommunicationType = CommunicationTypeConst.Siemens_S1500,
                    IpAddress = "127.0.0.1",
                    Port = 102,
24
                    Disable = false,
唐召明 authored
25
26
27
                },
            };
            return temps;
唐召明 authored
28
29
30
31
        }

        public static List<Equipment> GetEquipment()
        {
唐召明 authored
32
33
            var temps = new List<Equipment>();
            return temps;
唐召明 authored
34
35
        }
唐召明 authored
36
        public static List<EquipmentProp> GetEquipmentProperties()
唐召明 authored
37
        {
唐召明 authored
38
39
40
41
42
43
44
45
46
47
            var temps = new List<EquipmentProp>();
            return temps;
        }

        public static List<EquipmentType> GetEquipmentTypes()
        {
            var temps = new List<EquipmentType>
            {
                new EquipmentType
                {
48
                    Id = 1,
唐召明 authored
49
                    Code = EquipmentTypeConst.SingleForkSRM.ToString(),
唐召明 authored
50
51
52
53
                    Name = "单叉堆垛机",
                },
                new EquipmentType
                {
54
                    Id = 2,
唐召明 authored
55
                    Code = EquipmentTypeConst.DoubleForkSRM.ToString(),
唐召明 authored
56
                    Name = "双叉堆垛机",
-  
唐召明 authored
57
58
59
                },
                new EquipmentType
                {
60
                    Id = 3,
-  
唐召明 authored
61
62
                    Code = EquipmentTypeConst.SingleForkSSRM.ToString(),
                    Name = "单叉高速堆垛机",
唐召明 authored
63
64
65
                },
                new EquipmentType
                {
66
                    Id= 4,
唐召明 authored
67
68
69
                    Code = EquipmentTypeConst.SingleForkSSRMV132.ToString(),
                    Name = "单叉单任务堆垛机V132",
                    Description = "V132版单叉单任务,一般为高速堆垛机,不兼容转轨",
唐召明 authored
70
71
72
73
74
75
                },
                new EquipmentType
                {
                    Id= 5,
                    Code = EquipmentTypeConst.StationMonitor.ToString(),
                    Name = "站台监控",
唐召明 authored
76
77
78
79
80
81
                }
            };
            return temps;
        }

        /// <summary>
-  
唐召明 authored
82
        /// 获取设备属性模板
唐召明 authored
83
84
        /// </summary>
        /// <returns></returns>
85
        public static List<EquipmentTypePropTemplate> GetEquipmentTypePropTemplates()
唐召明 authored
86
        {
87
88
89
90
91
92
93
94
95
96
            var temps = new List<EquipmentTypePropTemplate>();

            var singleSRMPropTemplates = GetSingleSRMPropTemplates();
            var doubleSRMPropTemplates = GetDoubleSRMPropTemplates();

            temps.AddRange(singleSRMPropTemplates);
            temps.AddRange(doubleSRMPropTemplates);

            var index = 1;
            temps.ForEach(x =>
-  
唐召明 authored
97
            {
98
99
                x.Id = index++;
            });
唐召明 authored
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
            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,
                },
            };
124
125
126
127
            temps.ForEach(x =>
            {
                x.EquipmentTypeId = 1;
            });
唐召明 authored
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
            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,
                },
            };
152
153
154
155
            temps.ForEach(x =>
            {
                x.EquipmentTypeId = 2;
            });
唐召明 authored
156
            return temps;
唐召明 authored
157
        }
唐召明 authored
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210

        private static List<Equipment> GetStationMonitorEquipment(IEnumerable<string> stationCode, string ip, int db = 3002, int start = 0, string destinationArea = null)
        {
            var temps = new List<Equipment>();
            foreach (var station in stationCode)
            {
                var equipmentTypeId = 6;
                var equipment = new Equipment
                {
                    Code = station,
                    Name = "站台监控",
                    EquipmentTypeId = equipmentTypeId,
                    IP = ip,
                    Created = DateTime.Now,
                    DestinationArea = destinationArea,
                    Description = station
                };
                var props = new List<EquipmentProp>
                {
                    new EquipmentProp
                    {
                        EquipmentTypePropTemplateCode = "StationMonitorBarcode",
                        Address = "DB3002.0,20",
                        Remark = "站台监控-条码",
                        Created = DateTime.Now,
                        ServerHandle = 0
                    },
                    new EquipmentProp
                    {

                    },
                    new EquipmentProp
                    {

                    },
                    new EquipmentProp
                    {

                    },
                    new EquipmentProp
                    {

                    },
                    new EquipmentProp
                    {

                    },
                };
                equipment.EquipmentProps = props;
                temps.Add(equipment);
            }
            return temps;
        }
唐召明 authored
211
212
    }
}