DischargeLine_Partial.cs
8.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
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
partial class DischargeLine
{
protected override bool CheckWaitResult(LineMoveInfo moveInfo, WaitResultInfo wait)
{
if (wait.WaitType.Equals(WaitEnum.W301_DLineScanCode))
{
if (LastCodeList.Count > 0)
{
return true;
}
}
return false;
}
#region 是否可移栽料盘
internal bool CanStartOut(int lineNum)
{
if (NoAlarm() || runStatus>LineRunStatus.HomeMoving)
{
if (lineNum.Equals(1) && TrayLine1.MoveInfo.MoveType.Equals(LineMoveType.None))
{
return true;
}
if (lineNum.Equals(2) && TrayLine2.MoveInfo.MoveType.Equals(LineMoveType.None))
{
return true;
}
}
return false;
}
#endregion
#region 料盘移栽处理
public override bool StartOutStoreMove(InOutParam param)
{
if (runStatus.Equals(LineRunStatus.Runing))
{
runStatus = LineRunStatus.Busy;
MoveInfo.MoveParam = param;
MoveInfo.NewMove(LineMoveType.OutStore);
LogInfo(hengyiName+ "出口有料,等待1000后扫码");
MoveInfo.NextMoveStep(LineMoveStep.DO_01_WaitTime);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
LastCodeList = new List<string>();
// LastHeight = 0;
LastWidth = 0;
scanCodeCount = 0;
return true;
}
else
{
LogUtil.error(Name + " 启动出料失败,当前 storeStatus=" + runStatus);
return false;
}
}
private List<string> LastCodeList = new List<string>();
private int LastWidth = 0;
private int scanCodeCount=0;
private void ScanCode()
{
MoveInfo.NextMoveStep(LineMoveStep.DO_02_ScanCode);
List<string> cameraList = Config.GetCameraList();
if (cameraList.Count > 0)
{
scanCodeCount++;
LogInfo(hengyiName + "出口有料,开始第【"+scanCodeCount+"】次扫码");
MoveInfo.OneWaitCanEndStep = true;
MoveInfo.WaitList.Add(WaitResultInfo.WaitDLineScanCode());
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(6000));
try
{
Task<List<string>> scanTask = Task.Factory.StartNew(delegate
{
LastCodeList = CodeManager.CameraScan(Config.GetCameraList());
if (LastCodeList.Count <= 0)
{
LastCodeList = CodeManager.CameraScan(Config.GetCameraList());
}
return LastCodeList;
});
}
catch (Exception ex)
{
LogUtil.error("FI_13_ScanCode扫码出错:" + ex.ToString());
}
}
else
{
LogInfo(hengyiName + "出口有料,未取到相机名称,不扫码,等待1000后继续");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(6000));
}
}
protected override void OutStoreProcess()
{
if (MoveInfo.IsInWait)
{
CheckWait(MoveInfo);
}
if (SecondMoveInfo.IsInWait)
{
CheckWait(SecondMoveInfo);
}
if (MoveInfo.IsInWait)
{
return;
}
if (MoveInfo.MoveStep.Equals(LineMoveStep.DO_01_WaitTime))
{
ScanCode();
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.DO_02_ScanCode))
{
MoveInfo.NextMoveStep(LineMoveStep.DO_03_GetTraySize);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
string lastCode = "";
foreach (string code in LastCodeList)
{
lastCode += code;
}
//如果未扫到条码,重新扫码3次
if (scanCodeCount < 3 && lastCode.Equals("") && Config.GetCameraList().Count > 0)
{
ScanCode();
}
else
{
LastWidth = 0;
int robotIndex = 1;
if (DeviceID.Equals(301))
{
robotIndex = 2;
}
SServerManager.GetTraySize(Name, robotIndex, LastCodeList, out LastWidth);
LogInfo(hengyiName + "出口有料,二维码[" + lastCode + "] 获取料盘尺寸【" + LastWidth + "】");
}
// MoveInfo.EndMove();
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.DO_03_GetTraySize))
{
MoveInfo.NextMoveStep(LineMoveStep.DO_04_SeparateDeviceMove);
if (LastWidth.Equals(7))
{
LogInfo(hengyiName + "出口有料,料盘尺寸【" + LastWidth + "】上升分盘定位气缸");
CylinderMove(MoveInfo, IO_Type.SeparateDevice_Down, IO_Type.SeparateDevice_Up);
}
else
{
LogInfo(hengyiName + "出口有料,料盘尺寸【" + LastWidth + "】下降分盘定位气缸");
CylinderMove(MoveInfo, IO_Type.SeparateDevice_Up, IO_Type.SeparateDevice_Down);
}
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.DO_04_SeparateDeviceMove))
{
if (TrayLine2.Line3CanRun && TrayLine1.Line3CanRun)
{
MoveInfo.NextMoveStep(LineMoveStep.DO_05_LineRun);
LogInfo(hengyiName + "出口有料,转动皮带线,同时转动分盘装置");
IOMove(IO_Type.SeparateDevice_Run, IO_VALUE.HIGH);
Line3Turn.StartLineRun(IO_Type.DLine_Run3, IO_Type.Location_Check3, Line3EndProcess);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Location_Check3, IO_VALUE.HIGH));
}
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.DO_05_LineRun))
{
MoveInfo.NextMoveStep(LineMoveStep.DO_06_Wait_SeparateDevice_Check);
Line3LastTrayP++;
LogInfo(hengyiName + "出口有料,等待料盘到达分盘装置位置");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Location_Check3, IO_VALUE.HIGH));
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.DO_06_Wait_SeparateDevice_Check))
{
MoveInfo.NextMoveStep(LineMoveStep.DO_07_CRun);
LogInfo(hengyiName + "出口有料,最多等待2000");
MoveInfo.OneWaitCanEndStep = true;
IOMove(IO_Type.SeparateDevice_Run, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.DO_07_CRun))
{
runStatus = LineRunStatus.Runing;
MoveInfo.EndMove();
IOMove(IO_Type.SeparateDevice_Run, IO_VALUE.LOW);
LogInfo(hengyiName + "出口有料,送料结束,停止皮带线");
}
}
#endregion
}
}