HYEquipBase.cs
6.9 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
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>
public int HyOutDeviceId = 0;
/// <summary>
/// 当前设备对应的横移入口的设备ID
/// </summary>
public int HyInDeviceId = 0;
public static HYEquipBase GetHY(string cid, HYEquip_Config config)
{
int hynum = (config.Id % 100);
List<int> jNumList = new List<int>() { 5 };
//if (jNumList.Contains(hynum))
//{
// return new HY_Coveryor(cid, config);
//}
//else
{
return new HY_C1_SLStation(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(1, '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))
{
HyOutDeviceId = 202;
}
else if (DeviceID.Equals(202))
{
HyInDeviceId = 201;
}
else if (DeviceID.Equals(203))
{
HyOutDeviceId = 204;
}
else if (DeviceID.Equals(204))
{
HyInDeviceId = 203;
}
RFIDIP = RFIDManager.GetRFIP(DeviceID);
}
public string GetHYDesc()
{
StringBuilder buf = new StringBuilder();
//buf.Append(" 所在流水线:" + Config.LineName+"\r\n");
string dName = "暂无";
if (Config.WorkDeviceId > 0 && LineManager.Line.AllEquipMap.ContainsKey(Config.WorkDeviceId))
{
dName = LineManager.Line.AllEquipMap[Config.WorkDeviceId].Name;
}
buf.Append(" 取放料设备:" + dName + "\r\n");
if (Config.IsSideWayIn)
{
dName = LineManager.Line.AllEquipMap[HyOutDeviceId].Name;
buf.Append("横移入口:✔" + ",对应出口" + dName + "\r\n");
}
if (Config.IsSideWayOut)
{
dName = LineManager.Line.AllEquipMap[HyInDeviceId].Name;
buf.Append("横移出口:✔" + ",对应入口" + dName + "\r\n");
}
if (Config.Id.Equals(205))
{
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()
{
}
internal virtual bool CanStartMove()
{
if (MoveInfo.MoveType.Equals(LineMoveType.None) && runStatus.Equals(LineRunStatus.Runing))
{
if (IOValue(IO_Type.HY_TrayCheck).Equals(IO_VALUE.LOW))
{
return true;
}
}
return false;
}
#region 定位气缸升降 ,链条转动
public void LocationCylinderUp(LineMoveInfo moveinfo = null)
{
if (DeviceID.Equals(202))
{
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)
{
if (DeviceID.Equals(202))
{
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)
{
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 LineStop(LineMoveInfo moveInfo = null)
{
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()
{
}
}
}