Common.cs
7.3 KB
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
using System;
namespace AssemblyLine
{
public static class Common
{
/// <summary>
/// 日志文件路径
/// </summary>
public readonly static string LOG_PATH = AppDomain.CurrentDomain.BaseDirectory + "LOG\\";
public delegate void StatusEvent(int idx, string ip, bool status);
public delegate void OutTextEvent(string s);
public static IOInfo IO21_Dev; //双层线
public static IOInfo IO22_Dev; //双层线
public static IOInfo IO23_Dev; //双层线
public static IOInfo IO24_Dev; //包装料
public static IOInfo IO25_Dev; //进出料
public static IOInfo IO26_Dev; //出料皮带线1
public static IOInfo IO27_Dev; //出料皮带线2
public static IOInfo IO28_Dev; //分盘线
public static RFIDInfo RFID101_Dev; //双层线
public static RFIDInfo RFID102_Dev; //双层线
public static RFIDInfo RFID103_Dev; //双层线
public static RFIDInfo RFID104_Dev; //双层线
public static RFIDInfo RFID105_Dev; //双层线
public static RFIDInfo RFID106_Dev; //包装料
public static RFIDInfo RFID107_Dev; //进出料
public static RFIDInfo RFID108_Dev; //进出料
public static RFIDInfo RFID109_Dev; //双层线
public static RFIDInfo RFID110_Dev; //分盘线
public static Asa.RFID.ReaderAll ReaderAll;
public static ABBInfo[] ABB_Dev;
public static AgvInfo[] Agv;
public static BLL.ABB ABB_Robot;
public static BLL.MiR MiR_AGV;
public static BLL.Doubleline line_Double;
public static BLL.PackingLine line_Packing;
public static BLL.ControlCenter controlCenter;
public static FrmMain frmMain;
public static System.Collections.Generic.Dictionary<string, string> config;
public static string LOCAL_IP = ""; // = "192.168.103.12";
public const string ABB_MOVEP = "movep";
public const string ABB_MOVEGET = "moveget";
public const string ABB_MOVEPUT = "moveput";
public const string ABB_MOVEHOME = "movehome";
/// <summary>
/// 16进制
/// </summary>
/// <param name="buff"></param>
/// <returns></returns>
public static string HexBuff(byte[] buff)
{
string s = "";
if (buff == null) return s;
for (int i = 0; i < buff.Length; i++)
s += buff[i].ToString("X2") + " ";
return s;
}
}
/// <summary>
/// IO设备信息
/// </summary>
public class IOInfo
{
/// <summary>
/// IP地址
/// </summary>
public string IP;
/// <summary>
/// 名称
/// </summary>
public string Name;
/// <summary>
/// IO模块
/// </summary>
public Asa.IOModule.AIOBOX Box;
/// <summary>
/// DI
/// </summary>
public Register[] DI;
/// <summary>
/// DO
/// </summary>
public Register[] DO;
public string ToStrDO(int index, int status)
{
string s = "";
if (status == 255)
s += " [ON]";
else if (status == 0)
s += " [OFF]";
s += DO[index].Name;
return s;
}
public string ToStrDI(int index, int status)
{
string s = "";
if (status == 255)
s += " [ON]";
else if (status == 0)
s += " [OFF]";
s += DI[index].Name;
return s;
}
}
/// <summary>
/// 寄存器
/// </summary>
public class Register
{
/// <summary>
/// 模块寄存器ID
/// </summary>
public string ID;
/// <summary>
/// 号码管名称
/// </summary>
public string Name;
/// <summary>
/// 解释说明
/// </summary>
public string Explain;
/// <summary>
/// 状态
/// </summary>
public Asa.IOModule.Box_Sta Sta;
/// <summary>
/// 寄存器
/// </summary>
/// <param name="id">模块寄存器ID</param>
/// <param name="name">号码管名称</param>
/// <param name="explain">解释说明</param>
public Register(string id, string name, string explain)
{
ID = id;
Name = name;
Explain = explain;
Sta = Asa.IOModule.Box_Sta.Off;
}
}
/// <summary>
/// RFID设备信息
/// </summary>
public class RFIDInfo
{
/// <summary>
/// IP地址
/// </summary>
public string IP;
/// <summary>
/// 模块编号
/// </summary>
public string ID;
/// <summary>
/// 解释说明
/// </summary>
public string Explain;
public RFIDInfo(string ip, string id, string explain)
{
IP = ip;
ID = id;
Explain = explain;
}
}
/// <summary>
/// MiR AGV设备信息
/// </summary>
public class AgvInfo
{
/// <summary>
/// 是否在线
/// </summary>
public bool IsCon;
/// <summary>
/// 是否可用
/// </summary>
public bool IsUse;
/// <summary>
/// 是否手动取消使用
/// </summary>
public bool IsCancel;
/// <summary>
/// 是否存在架子
/// </summary>
public bool ExistShelf;
public string Place;
public string Name;
public string IP;
public string RFID;
public string Mark;
public string Key;
public int StateID;
public string StateText;
/// <summary>
/// PLC20寄存器的状态
/// </summary>
public BLL.MiR_Status Status;
public AgvInfo(string name, string ip, string key)
{
Name = name;
IP = ip;
Key = key;
IsCon = false;
IsUse = false;
IsCancel = false;
ExistShelf = false;
RFID = "";
Place = "";
StateID = -1;
StateText = "";
Mark = "";
Status = BLL.MiR_Status.None;
}
}
/// <summary>
/// ABB机器人设备信息
/// </summary>
public class ABBInfo
{
public string IP;
public string Name;
public string State;
public string Server;
public bool IsOpen;
//public string SendStr;
//public string ReceiveStr;
//public string StartStr;
//public string StopStr;
public ABBInfo(string ip, string name, string state, string server)
{
IP = ip;
Name = name;
State = state;
Server = server;
IsOpen = false;
//SendStr = ip + " " + name + " Send ";
//ReceiveStr = ip + " " + name + " Received ";
//StartStr = ip + " " + name + " Server Start";
//StopStr = ip + " " + name + " Server Stop";
}
public string ToString(string s)
{
return IP + " " + Name + " " + s;
}
}
}