AutoInOutTestTask.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
using CtuDeviceLib;
using Mushiny;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.CtuService
{
public class AutoInOutTestTask : CtuTaskBase
{
public AutoInOutTestTask(CTU ctu) : base(ctu)
{
}
public List<string> shelfCodes = null;
int curIndex = 0;
public override void Excute()
{
//switch (MoveInfo.MoveStep)
//{
// case RunStep.Wait:
// break;
// case RunStep.AutoInOut_Start:
// MoveInfo.NextMoveStep(RunStep.AutoInOut_GetBoxFromBunker);
// string landcode = shelfCodes[curIndex];
// setDstName(landcode);
// MoveInfo.Info($"准备执行【{landcode}】");
// break;
// case RunStep.AutoInOut_GetBoxFromBunker:
// if (MushinyManager.GetBoxFromBasket(ctu, boxCode, out curPathPoint))
// {
// if (curCtu.CreatePathPoint(curPathPoint))
// {
// ctuStep = CtuStep.Ctu_GetBoxFromBunkerOk;
// logInfo("从背篓取货");
// lastSendTime = DateTime.Now;
// }
// }
// break;
// case RunStep.AutoInOut_GetBoxFromBunkerOk:
// if (actions?.ActionFinishCode == ActionFinishCode.从料仓取货完成)
// {
// ctuStep = CtuStep.Ctu_01_ToPointCode;
// logInfo($"从背篓取货完成");
// }
// else if (isSendTimeout())
// {
// ctuStep = CtuStep.Ctu_GetBoxFromBunker;
// logInfo($"从背篓取货超时,重发");
// }
// else
// {
// logInfo("等待从背篓取货完成");
// }
// break;
// case RunStep.AutoInOut_01_ToPointCode:
// if (curCtu.CurLandMark == curShelf.PointCode)
// {
// ctuStep = CtuStep.Ctu_02_AtPointCode;
// logInfo($"当前在地标[{curShelf.PointCode}],无需发送移动任务");
// }
// else if (CreateMoveTask(curCtu, curShelf.PointCode))
// {
// if (curCtu.CreatePathPoint(curPathPoint))
// {
// ctuStep = CtuStep.Ctu_02_AtPointCode_1;
// logInfo($"去地标[{curShelf.PointCode}]");
// lastSendTime = DateTime.Now;
// }
// }
// else
// {
// logInfo($"去地标[{curShelf.PointCode}]失败");
// }
// break;
// case RunStep.AutoInOut_02_AtPointCode:
// if (curCtu.CurLandMark == curShelf.PointCode)
// {
// ctuStep = CtuStep.Ctu_03_PutToShelf;
// logInfo($"到达地标[{curShelf.PointCode}]");
// }
// break;
// case RunStep.AutoInOut_02_AtPointCode_1:
// if (actions?.ActionFinishCode == ActionFinishCode.整个路径执行完成)
// {
// ctuStep = CtuStep.Ctu_03_PutToShelf;
// logInfo($"到达地标[{curShelf.PointCode}]");
// }
// else if (isSendTimeout())
// {
// ctuStep = CtuStep.Ctu_01_ToPointCode;
// logInfo($"到达地标[{curShelf.PointCode}]超时,重发");
// }
// break;
// case RunStep.AutoInOut_03_PutToShelf:
// if (MushinyManager.PutBoxToShelf(curCtu, curShelf, 1, out curPathPoint))
// {
// if (curCtu.CreatePathPoint(curPathPoint))
// {
// ctuStep = CtuStep.Ctu_04_PutToShelfOk;
// logInfo($"往货架放货");
// lastSendTime = DateTime.Now;
// }
// }
// break;
// case RunStep.AutoInOut_04_PutToShelfOk:
// if (actions?.ActionFinishCode == ActionFinishCode.往货架放货完成)
// {
// ctuStep = CtuStep.Ctu_05_GetFromShelf;
// logInfo($"往货架放货完成");
// }
// else if (isSendTimeout())
// {
// ctuStep = CtuStep.Ctu_03_PutToShelf;
// logInfo($"往货架放货超时,重发");
// }
// break;
// case RunStep.AutoInOut_05_GetFromShelf:
// if (MushinyManager.GetBoxFomShelf(curCtu, curShelf, out curPathPoint))
// {
// if (curCtu.CreatePathPoint(curPathPoint))
// {
// ctuStep = CtuStep.Ctu_06_GetFromShelfOk;
// logInfo($"从货架取货");
// lastSendTime = DateTime.Now;
// }
// }
// break;
// case RunStep.AutoInOut_06_GetFromShelfOk:
// if (actions?.ActionFinishCode == ActionFinishCode.从货架取货完成)
// {
// ctuStep = CtuStep.Ctu_07_NextShelf;
// logInfo($"从货架取货完成");
// }
// else if (isSendTimeout())
// {
// ctuStep = CtuStep.Ctu_05_GetFromShelf;
// logInfo($"从货架取货超时,重发");
// }
// break;
// case RunStep.AutoInOut_07_NextShelf:
// if (!isRun)
// {
// ctuStep = CtuStep.Ctu_08_PutToBunker;
// logInfo($"手动结束[{curShelf.ShelveCode}],将料箱放回背篓");
// }
// else if (curIndex == shelfCodes.Count - 1)
// {
// ctuStep = CtuStep.Ctu_08_PutToBunker;
// logInfo($"最后一个库位[{curShelf.ShelveCode}],将料箱放回背篓");
// }
// else if (curIndex < shelfCodes.Count - 1)
// {
// curIndex++;
// landcode = shelfCodes[curIndex];
// curShelf = ctuBean.PosInfos.Where(p => p.Name == landcode).First();
// if (curShelf == null)
// {
// ctuStep = CtuStep.Ctu_End;
// }
// else
// {
// ctuStep = CtuStep.Ctu_01_ToPointCode;
// logInfo($"去[{curShelf.PointCode}]");
// }
// }
// break;
// case RunStep.AutoInOut_08_PutToBunker:
// if (MushinyManager.PutBoxToBasket(curCtu, curShelf, 1, out curPathPoint))
// {
// if (curCtu.CreatePathPoint(curPathPoint))
// {
// ctuStep = CtuStep.Ctu_09_PutToBunkerOk;
// logInfo($"将料箱放回背篓");
// lastSendTime = DateTime.Now;
// }
// }
// break;
// case CtuStep.AutoInOut_09_PutToBunkerOk:
// if (actions?.ActionFinishCode == ActionFinishCode.往料仓放货完成)
// {
// ctuStep = CtuStep.Ctu_End;
// logInfo($"将料箱放回背篓完成");
// }
// else if (isSendTimeout())
// {
// ctuStep = CtuStep.Ctu_08_PutToBunker;
// logInfo($"将料箱放回背篓超时,重发");
// }
// break;
// case CtuStep.AutoInOut_End:
// if (curCtu != null)
// curCtu.PathActionFinish -= Ctu_PathActionFinish;
// editControl(true);
// curIndex = 0;
// curShelf = null;
// runningCtus.Remove(curCtu.Name);
// SetControlText(label4, $"跑库位:当前行走{curIndex}个库位,运行结束!");
// ctuStep = CtuStep.Ctu_Wait;
// isRun = false;
// break;
//}
}
}
}