HYEquipBase.cs
9.2 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
272
273
274
275
276
277
278
279
280
281
282
283
284
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public abstract class HYEquipBase : EquipBase
{
public HYEquip_Config Config;
/// <summary>
/// 当前设备对应的横移出口的设备ID
/// </summary>
private int HyOutDeviceId = 0;
/// <summary>
/// 当前设备对应的横移入口的设备ID
/// </summary>
private int HyInDeviceId = 0;
public static HYEquipBase GetHY(string cid, HYEquip_Config config)
{
int hynum = (config.Id % 100);
List<int> workList = new List<int>() { 1, 2, 20,21 };
List<int> jNumList = new List<int>() { 10,12,17};
List<int> oNumList = new List<int>() { 5, 7, 14 };
//List<int> cNumList = new List<int>() { 10, 12, 17 };
if (workList.Contains(hynum))
{
return new HY_C1_SLStation(cid, config);
}
if (jNumList.Contains(hynum))
{
return new HY_Coveryor(cid, config);
}else if (oNumList.Contains(hynum))
{
return new HY_OutLine(cid, config);
}
else
{
return new HY_C1Line(cid, config);
}
}
public HYEquipBase(string cid, HYEquip_Config config)
{
this.DeviceID = config.Id;
this.Config = config;
baseConfig = config;
IsDebug = config.IsDebug.Equals(1);
Name = (" HY" + (DeviceID % 100).ToString().PadLeft(2, '0') + " ").ToUpper();
Init();
MoveInfo = new LineMoveInfo(DeviceID, "[" + Name.Trim() + "-Move]");
SecondMoveInfo = new LineMoveInfo(DeviceID, "[" + Name.Trim() + "-SMove]");
UseAxis = config.UpDownUseAxis.Equals(1);
if (UseAxis)
{
UpdownAxis = new AxisBean(config.UpDown_Axis, Name);
}
HyOutDeviceId = 0;
HyInDeviceId = 0;
if (DeviceID.Equals(201))
{
HyInDeviceId = 202;
}
else if (DeviceID.Equals(202))
{
HyOutDeviceId = 201;
}
else if (DeviceID.Equals(220))
{
HyOutDeviceId = 221;
}
else if (DeviceID.Equals(221))
{
HyInDeviceId = 220;
}
else if (DeviceID.Equals(204))
{
HyOutDeviceId = 203;
}
else if (DeviceID.Equals(203))
{
HyInDeviceId = 204;
}
else if (DeviceID.Equals(209))
{
HyOutDeviceId = 208;
}
else if (DeviceID.Equals(208))
{
HyInDeviceId = 209;
}
else if (DeviceID.Equals(215))
{
HyOutDeviceId = 216;
}
else if (DeviceID.Equals(216))
{
HyInDeviceId = 215;
}
else if (DeviceID.Equals(218))
{
HyOutDeviceId = 219;
}
else if (DeviceID.Equals(219))
{
HyInDeviceId = 218;
}
RFIDIP = RFIDManager.GetRFIP(DeviceID);
}
public string GetHYDesc()
{
StringBuilder buf = new StringBuilder();
buf.Append(" 所在流水线:" + Config.LineName+"\r\n");
string dName = "暂无";
if (Config.WorkDevice>0&&LineManager.Line.AllEquipMap.ContainsKey(Config.WorkDevice))
{
dName = LineManager.Line.AllEquipMap[Config.WorkDevice].Name;
}
buf.Append(" 取放料设备:" + dName + "\r\n");
if (Config.IsSideWayIn.Equals(1))
{
buf.Append("C1线横移入口:✔" + "\r\n");
}
if (Config.IsSideWayOut.Equals(1))
{
buf.Append("C1线横移出口:✔" + "\r\n");
}
if (Config.IsOutLineIn.Equals(1))
{
buf.Append(" 出料托盘入口:✔" + "\r\n");
}
if (Config.IsOutLineOut.Equals(1))
{
buf.Append(" 出料托盘出口:✔" + "\r\n");
}
int hynum = (this.Config.Id % 100);
List<int> jNumList = new List<int>() { 10, 12, 17 };
if (hynum.Equals(17))
{
buf.Append(" NG料工位:✔" + "\r\n");
}
else if (jNumList.Contains(hynum))
{
buf.Append(" 接驳台工位:✔" + "\r\n");
}
return buf.ToString();
}
protected HYEquipBase GetHyOutEquip()
{
if (HyOutDeviceId > 0)
{
return LineManager.Line.HYEquipMap[HyOutDeviceId];
}
return null;
}
protected HYEquipBase GetHyInEquip()
{
if (HyInDeviceId > 0)
{
return LineManager.Line.HYEquipMap[HyInDeviceId];
}
return null;
}
internal virtual bool TrayIsReady()
{
return false;
}
internal virtual void TrayCanLeave()
{
}
#region 定位气缸升降 ,链条转动
public void LocationCylinderUp(LineMoveInfo moveinfo = null)
{
IOMove(IO_Type.HY_LocationCylinder_Down, IO_VALUE.LOW);
IOMove(IO_Type.HY_LocationCylinder_Up, IO_VALUE.HIGH);
if (moveinfo != null)
{
moveinfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_LocationCylinder_Down1, IO_VALUE.LOW));
moveinfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_LocationCylinder_Up1, IO_VALUE.HIGH));
moveinfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_LocationCylinder_Down2, IO_VALUE.LOW));
moveinfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_LocationCylinder_Up2, IO_VALUE.HIGH));
}
}
public void LocationCylinderDown(LineMoveInfo moveinfo = null)
{
IOMove(IO_Type.HY_LocationCylinder_Up, IO_VALUE.LOW);
IOMove(IO_Type.HY_LocationCylinder_Down, IO_VALUE.HIGH);
if (moveinfo != null)
{
moveinfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_LocationCylinder_Up1, IO_VALUE.LOW));
moveinfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_LocationCylinder_Down1, IO_VALUE.HIGH));
moveinfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_LocationCylinder_Up2, IO_VALUE.LOW));
moveinfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_LocationCylinder_Down2, IO_VALUE.HIGH));
}
}
public void LineRun(LineMoveInfo moveInfo = null)
{
if (Config.DOList.ContainsKey(IO_Type.HY_LineBackRun))
{
IOMove(IO_Type.HY_LineBackRun, IO_VALUE.LOW);
if (moveInfo != null)
{
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_LineBackRun, IO_VALUE.LOW));
}
}
IOMove(IO_Type.HY_LineRun, IO_VALUE.HIGH);
if (moveInfo != null)
{
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_LineRun, IO_VALUE.HIGH));
}
}
public void LineBackRun(LineMoveInfo moveInfo = null)
{
//暂时只有HY04(204)有倒转功能。
if (Config.DOList.ContainsKey(IO_Type.HY_LineBackRun))
{
IOMove(IO_Type.HY_LineBackRun, IO_VALUE.HIGH);
IOMove(IO_Type.HY_LineRun, IO_VALUE.LOW);
if (moveInfo != null)
{
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_LineBackRun, IO_VALUE.HIGH));
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_LineRun, IO_VALUE.LOW));
}
}
}
public void LineStop(LineMoveInfo moveInfo = null)
{
if (Config.DOList.ContainsKey(IO_Type.HY_LineBackRun))
{
IOMove(IO_Type.HY_LineBackRun, IO_VALUE.LOW);
if (moveInfo != null)
{
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_LineBackRun, IO_VALUE.LOW));
}
}
IOMove(IO_Type.HY_LineRun, IO_VALUE.LOW);
if (moveInfo != null)
{
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_LineRun, IO_VALUE.LOW));
}
}
#endregion
public override bool StartInStoreMove(InOutParam param)
{
return false;
}
public override bool StartOutStoreMove(InOutParam param)
{
return false;
}
protected override void InStoreProcess()
{
}
protected override void OutStoreProcess()
{
}
}
}