EmptyAGVBackJob.cs
4.3 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
using AGVControl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.PeerResolvers;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AGVControl
{
/// <summary>
/// 空车返回待机位任务
/// </summary>
public class EmptyAGVBackJob : Job
{
/// <summary>
/// 出完满料后-空车返回任务
/// </summary>
/// <param name="agvPlae">小车当前位置,空表示在待机位</param>
/// <param name="palce">空料架位置点</param>
public EmptyAGVBackJob(string agvPlae)
{
this.agvPlace = agvPlae;
}
/// <summary>
/// 接收任务时,agv的位置
/// </summary>
private string agvPlace { get; set; }
/// <summary>
/// 运行信息
/// </summary>
public string RunInfo { get; set; }
/// <summary>
/// 到达待机位
/// </summary>
public override bool IsEnd { get { return EmptyAGVBackStep.IsStep(EMPTY_AGV_BACK_STEP.END); } }
private JobStep<EMPTY_AGV_BACK_STEP> EmptyAGVBackStep = new JobStep<EMPTY_AGV_BACK_STEP>(EMPTY_AGV_BACK_STEP.NONE);
/// <summary>
/// 空车返回执行
/// </summary>
/// <param name="agv"></param>
public override Job Execute(Agv_Info agv)
{
string msg = "";
bool rtn = false;
if (EmptyAGVBackStep.IsStep(EMPTY_AGV_BACK_STEP.NONE))
{
if(Common.FindEmptyShelfNode(agv,out string nodeName))
{
//EmptyAGVBackStep.ToNextStep(EMPTY_AGV_BACK_STEP.END);
msg = "小车在产线"+agvPlace+"准备返回时检测到"+nodeName+"有空料架";
EmptyAGVBackStep.Msg = msg;
return new GoEmptyShelfLineJob(agvPlace,nodeName);
}
else
{
if(agvPlace.StartsWith("G"))
{
EmptyAGVBackStep.ToNextStep(EMPTY_AGV_BACK_STEP.WAIT_AGV_REACH_4D_DOOR);
msg = "从产线" + agvPlace + "回到待机位,先到4D门";
EmptyAGVBackStep.Msg = msg;
Common.DoorMission(agv, SettingString.MoveDoorCToD);
}
else
{
EmptyAGVBackStep.ToNextStep(EMPTY_AGV_BACK_STEP.WAIT_REACH_STANDBY);
msg = "从产线" + agvPlace + "回到待机位";
EmptyAGVBackStep.Msg = msg;
Common.MoveToNode(agv, SettingString.MoveStandby);
}
}
}
else if (EmptyAGVBackStep.IsStep(EMPTY_AGV_BACK_STEP.WAIT_AGV_REACH_4D_DOOR))
{
if(agv.Place.Equals(SettingString.D4_DOOR_Name)&& agv.PlaceState.Equals(ePlaceState.MoveFinish))
{
if(Common.FindFullShelfTask(agv))
{
msg = "从产线" + agvPlace + "到达4D门,检测到A6出满料,去A6";
EmptyAGVBackStep.Msg = msg;
return new GoFullShelfStationJob(SettingString.D4_DOOR_Name);
}
else
{
msg = "从产线" + agvPlace + "到达4D门,暂无任务,去充电位";
EmptyAGVBackStep.Msg = msg;
return new ChargeJob(SettingString.D4_DOOR_Name);
}
}
}
RunInfo = EmptyAGVBackStep.Msg;
return this;
}
/// <summary>
/// AGV回收空料架流程
/// </summary>
private enum EMPTY_AGV_BACK_STEP
{
/// <summary>
/// 查询任务
/// </summary>
NONE,
/// <summary>
/// 等待到达4D门
/// </summary>
WAIT_AGV_REACH_4D_DOOR,
/// <summary>
/// 等待AGV到达待机位
/// </summary>
WAIT_REACH_STANDBY,
/// <summary>
///
/// </summary>
END
}
}
}