Common.cs
4.5 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
using System;
using System.Runtime.InteropServices;
namespace DoubleLine
{
public static class Common
{
public readonly static string LOG_PATH = AppDomain.CurrentDomain.BaseDirectory + "LOG\\";
public static Asa.File.Log log;
public static BLL.ABB ABB;
public static BLL.WebService Web;
public static BLL.BenQ_AGV BenqAGV;
public static BLL.LineDouble LineDouble;
public static BLL.LinePack LinePack;
public static BLL.LineDischarge LineDischarge;
public static BLL.ControlCenter ControlCenter;
public static Asa.RFID.ReaderAll RFID;
public static ABBInfo[] ABB_Info;
public static RFIDInfo[] RFID_Info;
public static IOInfo[] IO_Info;
public const string ABB_MOVEP = "movep";
public const string ABB_MOVEGET = "moveget";
public const string ABB_MOVEPUT = "moveput";
public const string ABB_MOVEHOME = "movehome";
}
public static class API
{
[DllImport("user32.dll", EntryPoint = "ShowWindow", CharSet = CharSet.Auto)]
public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
[DllImport("user32.dll ", SetLastError = true)]
public static extern void SwitchToThisWindow(IntPtr hWnd, bool fAltTab);
public const int SW_RESTORE = 9;
}
public enum DeviceAction
{
Start, Stop, Error
}
public class ABBInfo
{
public string IP;
public string Name;
public int Speed;
public string State;
public bool IsOpen;
public bool GetStart;
public bool GetEnd;
public bool PutStart;
public bool PutIn;
public bool PutEnd;
public ABBInfo(string name, string ip, int speed)
{
IP = ip;
Name = name;
Speed = speed;
State = "";
IsOpen = false;
GetStart = false;
GetEnd = true;
PutStart = false;
PutIn = false;
PutEnd = true;
}
}
public class RFIDInfo
{
public string IP;
public string Name;
public bool IsOpen;
public bool IsScan;
public RFIDInfo(string name, string ip)
{
Name = name;
IP = ip;
IsOpen = false;
IsScan = false;
}
}
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 IOInfo(string name, string ip)
{
Name = name;
IP = ip;
Box = new Asa.IOModule.AIOBOX();
Box.IP = ip;
}
//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;
}
}
}