New
czw
2025-05-31 c6f52253a482e866640dd075fd3dcbb56687f4f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Runtime.Serialization;
using System.Collections.Concurrent;
using System.ServiceModel;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Net;
using NLog;
using NLog.Config;
using NLog.Targets;
using GZ.DB.Map.OIDATABASE;
using GZ.DB.App.OIDATABASE;
using GZ.DB.Repository.OIDATABASE;
using GZ.DB.IRepository.OIDATABASE;
using GZ.DB.Entity.OIDATABASE;
namespace GZ.Projects.S7
{
    #region 设备通信
    /// <summary>
    /// 设备通信
    /// </summary>
    public class Device
    {
        public GZ.Device.PLC.PlcBase PLC1=null;
        public GZ.Device.PLC.PlcBase 西门子2=null;
        public GZ.Device.PLC.PlcBase wxwp=null;
        public GZ.Device.PLC.PlcBase wxrp=null;
        public GZ.Device.PLC.PlcBase warp=null;
        public GZ.Device.PLC.PlcBase ssx2xPlcRead=null;
        public GZ.Device.PLC.PlcBase ssx1xPlcRead=null;
        public GZ.Device.PLC.PlcBase ssx3xPlcRead=null;
        public GZ.Device.PLC.PlcBase 维希尔抓臂1=null;
        public GZ.Device.PLC.PlcBase 维希尔抓臂2=null;
        public GZ.Device.PLC.PlcBase 捷瞬抓臂1=null;
        public GZ.Device.PLC.PlcBase 捷瞬抓臂2=null;
        public GZ.Device.PLC.PlcBase PLC3=null;
        public GZ.Device.PLC.PlcBase PLC4=null;
        public Device()
        {
            PLC1 = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
            (
                System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "PLC1"),
                null
            );
            西门子2 = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
            (
                System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "西门子2"),
                null
            );
            wxwp = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
            (
                System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "wxwp"),
                null
            );
            wxrp = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
            (
                System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "wxrp"),
                null
            );
            warp = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
            (
                System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "warp"),
                null
            );
            ssx2xPlcRead = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
            (
                System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "ssx2xPlcRead"),
                null
            );
            ssx1xPlcRead = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
            (
                System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "ssx1xPlcRead"),
                null
            );
            ssx3xPlcRead = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
            (
                System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "ssx3xPlcRead"),
                null
            );
            维希尔抓臂1 = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
            (
                System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "维希尔抓臂1"),
                null
            );
            维希尔抓臂2 = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
            (
                System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "维希尔抓臂2"),
                null
            );
            捷瞬抓臂1 = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
            (
                System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "捷瞬抓臂1"),
                null
            );
            捷瞬抓臂2 = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
            (
                System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "捷瞬抓臂2"),
                null
            );
            PLC3 = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
            (
                System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "PLC3"),
                null
            );
            PLC4 = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
            (
                System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "PLC4"),
                null
            );
            if(System.Configuration.ConfigurationManager.AppSettings["AutoRunPLC"]=="1")
            {
                if(PLC1!=null){PLC1.Run();}
                if(西门子2!=null){西门子2.Run();}
                if(wxwp!=null){wxwp.Run();}
                if(wxrp!=null){wxrp.Run();}
                if(warp!=null){warp.Run();}
                if(ssx2xPlcRead!=null){ssx2xPlcRead.Run();}
                if(ssx1xPlcRead!=null){ssx1xPlcRead.Run();}
                if(ssx3xPlcRead!=null){ssx3xPlcRead.Run();}
                if(维希尔抓臂1!=null){维希尔抓臂1.Run();}
                if(维希尔抓臂2!=null){维希尔抓臂2.Run();}
                if(捷瞬抓臂1!=null){捷瞬抓臂1.Run();}
                if(捷瞬抓臂2!=null){捷瞬抓臂2.Run();}
                if(PLC3!=null){PLC3.Run();}
                if(PLC4!=null){PLC4.Run();}
            }
        }
    }
    #endregion
    
    #region 简单PLC
        
    /// <summary>
    /// PLC变量组
    /// </summary>
    public class EasyPLC
    {
        #region PLC1
        public _PLC1 PLC1 = new _PLC1();
        /// <summary>
        /// xxx
        /// </summary>        
        public class _PLC1
        {
            public _Group1 Group1 = new _Group1();
            /// <summary>
            /// 
            /// </summary>    
            public class _Group1
            {
                public string Param2 = "";
                public string Param3 = "";
 
                public bool Write()
                {
                    return true;
                }
            }
            public _Group2 Group2 = new _Group2();
            /// <summary>
            /// 
            /// </summary>    
            public class _Group2
            {
                public string Param4 = "";
                public string Param5 = "";
 
                public bool Write()
                {
                    return true;
                }
            }
        }
        #endregion
        
        #region 西门子2
        public _西门子2 西门子2 = new _西门子2();
        /// <summary>
        /// 
        /// </summary>        
        public class _西门子2
        {
        }
        #endregion
        
        #region wxwp
        public _wxwp wxwp = new _wxwp();
        /// <summary>
        /// wcs write plc
        /// </summary>        
        public class _wxwp
        {
        }
        #endregion
        
        #region wxrp
        public _wxrp wxrp = new _wxrp();
        /// <summary>
        /// wcs read plc
        /// </summary>        
        public class _wxrp
        {
        }
        #endregion
        
        #region warp
        public _warp warp = new _warp();
        /// <summary>
        /// wcs read turn agv
        /// </summary>        
        public class _warp
        {
        }
        #endregion
        
        #region ssx2xPlcRead
        public _ssx2xPlcRead ssx2xPlcRead = new _ssx2xPlcRead();
        /// <summary>
        /// 出烤箱区
        /// </summary>        
        public class _ssx2xPlcRead
        {
        }
        #endregion
        
        #region ssx1xPlcRead
        public _ssx1xPlcRead ssx1xPlcRead = new _ssx1xPlcRead();
        /// <summary>
        /// 进烤区
        /// </summary>        
        public class _ssx1xPlcRead
        {
        }
        #endregion
        
        #region ssx3xPlcRead
        public _ssx3xPlcRead ssx3xPlcRead = new _ssx3xPlcRead();
        /// <summary>
        /// 部件区
        /// </summary>        
        public class _ssx3xPlcRead
        {
        }
        #endregion
        
        #region 维希尔抓臂1
        public _维希尔抓臂1 维希尔抓臂1 = new _维希尔抓臂1();
        /// <summary>
        /// 
        /// </summary>        
        public class _维希尔抓臂1
        {
        }
        #endregion
        
        #region 维希尔抓臂2
        public _维希尔抓臂2 维希尔抓臂2 = new _维希尔抓臂2();
        /// <summary>
        /// 
        /// </summary>        
        public class _维希尔抓臂2
        {
        }
        #endregion
        
        #region 捷瞬抓臂1
        public _捷瞬抓臂1 捷瞬抓臂1 = new _捷瞬抓臂1();
        /// <summary>
        /// 
        /// </summary>        
        public class _捷瞬抓臂1
        {
        }
        #endregion
        
        #region 捷瞬抓臂2
        public _捷瞬抓臂2 捷瞬抓臂2 = new _捷瞬抓臂2();
        /// <summary>
        /// 
        /// </summary>        
        public class _捷瞬抓臂2
        {
        }
        #endregion
        
        #region PLC3
        public _PLC3 PLC3 = new _PLC3();
        /// <summary>
        /// 
        /// </summary>        
        public class _PLC3
        {
        }
        #endregion
        
        #region PLC4
        public _PLC4 PLC4 = new _PLC4();
        /// <summary>
        /// 
        /// </summary>        
        public class _PLC4
        {
        }
        #endregion
        
    }
 
    #endregion
}