AC_BOX_Bean_Shelf.cs
13.0 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
285
286
287
288
289
290
291
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 料架新增的出入库逻辑
/// </summary>
partial class AC_BOX_Bean
{
/// <summary>
/// 开始入库移动移动
/// </summary>
public void StartShelfInStore()
{
if (storeRunStatus == StoreRunStatus.Runing)
{
if (IOValue(IO_Type.LineIn_Check).Equals(IO_VALUE.HIGH))
{
LogInfo(" 空闲中,检测到入料口有信号,料架入库:入料口移门打开,");
storeRunStatus = StoreRunStatus.Busy;
storeStatus = StoreStatus.InStoreExecute;
MoveInfo.NewMove(StoreMoveType.InStore, new InOutParam());
MoveInfo.ShelfPositionList = new List<string>(ShelfPosList);
MoveInfo.NextMoveStep(StoreMoveStep.SI_S02_DoorOpen);
CylinderMove(MoveInfo, IO_Type.EntranceDoor_Close, IO_Type.EntranceDoor_Open);
}
}
}
private void ShelfInStoreProcess()
{
LineMoveP moveP = MoveInfo.MoveParam.MoveP;
#region 料架移入料仓内部处理
if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S01_LineIn_Check))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S02_DoorOpen);
InOutStoreLog("料架入库:入料口移门打开");
CylinderMove(MoveInfo, IO_Type.EntranceDoor_Close, IO_Type.EntranceDoor_Open);
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S02_DoorOpen))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S03_LineRun);
InOutStoreLog("料架入库:线体正转,等待取料位检测到信号");
IOMove(IO_Type.Line_BackRun, IO_VALUE.LOW);
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LineIn_Check, IO_VALUE.LOW));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LineTake_Check, IO_VALUE.HIGH));
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S03_LineRun))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S04_LineStop);
InOutStoreLog("料架入库:取料位检测到信号,停止线体正转");
IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S04_LineStop))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S05_DoorClose);
InOutStoreLog("料架入库:入料口移门关闭");
CylinderMove(MoveInfo, IO_Type.EntranceDoor_Open, IO_Type.EntranceDoor_Close);
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S05_DoorClose))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S06_LocationUp);
InOutStoreLog("料架入库:定位装置上升");
CylinderMove(MoveInfo, IO_Type.LocationCylinder_Down, IO_Type.LocationCylinder_Up);
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S06_LocationUp))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S07_TopCylinderUp);
InOutStoreLog("料架入库:顶升装置上升");
CylinderMove(MoveInfo, IO_Type.TopCylinder_Down, IO_Type.TopCylinder_Up);
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S07_TopCylinderUp))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S08_StartGetTray);
InOutStoreLog("料架入库:开始循环从第一个空位逐个取料盘,扫码入库");
}
#endregion
#region 料架取料盘扫码获取POSID
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S08_StartGetTray))
{
if (MoveInfo.NextShelfPos())
{
//新的料架库位
MoveInfo.NextMoveStep(StoreMoveStep.SI_S11_InoutToP1);
InOutStoreLog("料架取料:叉子后退到待机点P1");
ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed);
}
else
{
//所有料盘已取料完成
}
}else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S11_InoutToP1))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S12_MoveToShelf);
InOutStoreLog("料架取料:升降轴移动到PA1低点,旋转轴移动到PA1点,压紧轴到压紧前点");
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_LPA1, Config.UpDownAxis_PA1_Speed);
ACAxisMove(Config.Middle_Axis, moveP.Middle_PA, Config.MiddleAxis_PA_Speed);
ACAxisMove(Config.Comp_Axis, Config.CompAxis_P3_Speed, Config.CompAxis_P3_Speed);
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S12_MoveToShelf))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S13_InoutToPA);
InOutStoreLog("料架取料:叉子前进到PA点");
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S13_InoutToPA))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S14_UpdownToPA2);
InOutStoreLog("料架取料:升降轴上升到PA2点");
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S14_UpdownToPA2))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S15_StartCompress);
InOutStoreLog("料架取料:压紧轴开始缓慢压紧");
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S15_StartCompress))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S16_ComAxisDownMove);
InOutStoreLog("料架取料:检测到料叉压紧确认信号,再次向下压紧指定的值");
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S16_ComAxisDownMove))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S17_InoutBack);
InOutStoreLog("料架取料:记录压紧高度,叉子后退到扫码点");
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S17_InoutBack))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S18_ScanCode);
InOutStoreLog("料架取料:记录宽度,开始扫码");
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S18_ScanCode))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S19_GetPosId);
InOutStoreLog("料架取料:扫码成功,从服务器获取库位号");
StartSendTray();
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S19_GetPosId))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S20_CompressWare);
InOutStoreLog("料架取料: 获取库位号完成,设置位置参数,开始入库");
StartSendTray();
}
#endregion
#region 入库逻辑
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S20_CompressWare))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S21_MoveToBag);
InOutStoreLog("入库:移动到库位点,轴1( 转盘) 至P2( 库位点)轴2(上下) 至P3(库位入库前点)");
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S21_MoveToBag))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S22_DeviceToBag);
InOutStoreLog("入库:叉子进入库位中,轴3( 叉子) 至P3(库位取放料点)");
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S22_DeviceToBag))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S23_PutWareToBag);
InOutStoreLog("入库:放下物品,轴2( 上下) 至P4( 库位入料缓冲点)轴4( 压紧) 至P3( 压紧前点)");
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S23_PutWareToBag))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S24_DeviceBackFromBag);
InOutStoreLog("入库:叉子从库位中返回,轴3( 叉子) 动作至P1( 待机点)");
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S24_DeviceBackFromBag))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S25_GoBack);
InOutStoreLog("入库:返回待机点,轴2/轴1/轴4动作至P1( 待机点))开始");
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S25_GoBack))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S08_StartGetTray);
InOutStoreLog("料架入库:开始循环从第一个空位逐个取料盘,扫码入库");
}
#endregion
#region 入库逻辑
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S31_ToNGDoor))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S32_NGDoorUp);
InOutStoreLog("送出料盘:NG料口升降门上升");
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S32_NGDoorUp))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S33_InoutToNGDoor);
InOutStoreLog("送出料盘:进出轴前进到NG料门口位置");
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S33_InoutToNGDoor))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S34_UpdownDown);
InOutStoreLog("送出料盘:升降轴缓慢下降,放下料盘");
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S34_UpdownDown))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S12_MoveToShelf);
InOutStoreLog("料架取料:叉子后退到待机点P1");
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S34_UpdownDown))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S35_InoutToP1);
InOutStoreLog("送出料盘:叉子后退到P1");
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S35_InoutToP1))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S36_NGDoorDown);
InOutStoreLog("送出料盘:关门NG料门,送出料盘结束");
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_S36_NGDoorDown))
{
}
#endregion
else
{
LogInfo(" 入库,moveStatus=" + MoveInfo.MoveStep + ",没有对应的处理!");
}
}
private void StartSendTray()
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_S31_ToNGDoor);
InOutStoreLog("送出料盘:扫码或获取库位失败,升降轴移动到NG料门口上端,旋转轴移动到NG料门口");
}
#region 压紧轴压紧处理
private System.Timers.Timer axisCheckTimer = null;
private string TargetIoType = IO_Type.Compress_Check;
private IO_VALUE TargetIoValue = IO_VALUE.HIGH;
private bool ComAxisStartCheck(string targetIo = "", IO_VALUE value = IO_VALUE.HIGH)
{
if (String.IsNullOrEmpty(targetIo))
{
targetIo = IO_Type.Compress_Check;
}
if (axisCheckTimer == null)
{
axisCheckTimer = new System.Timers.Timer();
axisCheckTimer.AutoReset = true;
axisCheckTimer.Interval += 30;
axisCheckTimer.Elapsed += CheckTimer_Elapsed;
axisCheckTimer.Enabled = false;
}
TargetIoValue = value;
TargetIoType = targetIo;
axisCheckTimer.Start();
return true;
}
private bool ComAxisStopCheck()
{
if (!(axisCheckTimer == null))
{
axisCheckTimer.Stop();
}
return true;
}
private bool IsInProcess = false;
private void CheckTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (IsInProcess) { return; }
IsInProcess = true;
if (IOValue(TargetIoType).Equals(TargetIoValue))
{
LogUtil.info(Name + "上料轴,检测到 " + TargetIoType + "=" + TargetIoValue + ",可以停止运动");
ACServerManager.SuddenStop(Config.Comp_Axis.DeviceName, Config.Comp_Axis.GetAxisValue());
ComAxisStopCheck();
}
IsInProcess = false;
}
#endregion
}
}