LineToLineJob.cs
9.4 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
using Common;
using DeviceLibrary.manager;
namespace DeviceLibrary.bean.job
{
/// <summary>
/// 同一层间线体到线体
/// </summary>
public class LineToLineJob : Job
{
/// <summary>
/// 料车取送任务
/// </summary>
public LineToLineJob(JobParam jobParam) : base(jobParam)
{
}
public LineToLineJob() : base()
{
}
lift.LiftStatus liftStatus;
public override Job Run(AgvInfo agv)
{
if (JobRunStep.IsStep(RunStep.NONE))
{
JobRunStep.ToNextStep(RunStep.SD_LineToLine_01_ToPickUpPosition);
runInfo = $"{JobName}开始:去{JobParam.SrcNode.AliceName}的取料点";
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.接料, out string msg);
AllocateTask(agv, $"{JobParam.SrcNode.Name}_{SettingString.PutShelfOn}");
JobRunStep.Msg = runInfo;
}
else if (JobRunStep.IsStep(RunStep.SD_LineToLine_01_ToPickUpPosition))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LineToLine_02_PutShelfOn);
//上报运输状态
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.status, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.auto,
$"到达{ JobParam.SrcNode.Name }"));
runInfo = $"到达{JobParam.SrcNode.AliceName}的取料点,准备拾取料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.PutShelfOn}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LineToLine_02_PutShelfOn))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LineToLine_03_ToLine);
//上报位置
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.status, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.auto,
$"取车"));
runInfo = $"在{JobParam.SrcNode.AliceName}拾取料车完成,准备去线体{JobParam.CurTargetNode.Name}的放料点";
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.送料, out string msg);
AllocateTask(agv, $"{JobParam.CurTargetNode.Name}_{SettingString.TakeShelfOff}");
JobRunStep.Msg = runInfo;
}
}
else if (JobRunStep.IsStep(RunStep.SD_LineToLine_03_ToLine))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LineToLine_04_WaitConfirm);
//确认按钮生效
JobParam.CurTargetNode.ExtendEquip.AllowConfirm();
//上报运输状态
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.status, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.auto,
$"到达{ JobParam.CurTargetNode.Name }"));
runInfo = $"到达{JobParam.CurTargetNode.AliceName}的放料点";
JobRunStep.Msg = runInfo;
}
}
else if (JobRunStep.IsStep(RunStep.SD_LineToLine_04_WaitConfirm))
{
if (OpManager.WaitConfirm.Line(JobParam.CurTargetNode))
{
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.status, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.agvButton,
$"卸货{ JobParam.CurTargetNode.Name }"));
if (JobParam.GetMissionInfo() != null && JobParam.GetMissionInfo().needBack)
{
JobRunStep.ToNextStep(RunStep.SD_LineToLine_05_BackToSrcLine);
runInfo = $"{JobParam.CurTargetNode.AliceName}的人员确认完成,准备返回{JobParam.SrcNode.AliceName}";
AllocateTask(agv, $"{JobParam.SrcNode.Name}_{SettingString.TakeShelfOff}");
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.返回起始地, out string msg);
JobRunStep.Msg = runInfo;
}
else if(JobParam.GetMissionInfo() != null && !JobParam.GetMissionInfo().needBack)
{
JobRunStep.ToNextStep(RunStep.SD_LineToLine_06_TakeShelfOff);
runInfo = $"将料车在{JobParam.CurTargetNode.AliceName}卸下";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.TakeShelfOff}");
}
else
{
LogUtil.error(JobParam.GetMissionInfo().ToString());
}
//关闭按钮确认
JobParam.CurTargetNode.ExtendEquip.Reset();
}
else if (JobRunStep.IsTimeOut(WaitTimeOut, out double timeoutval))
{
//报警,$"等待{JobParam.CurTargetNode.AliceName}的人员确认超时{timeoutval}分"
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.error, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.agvButton,
$"等待{ JobParam.CurTargetNode.Name }确认超时{timeoutval}分"));
}
}
else if (JobRunStep.IsStep(RunStep.SD_LineToLine_05_BackToSrcLine))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LineToLine_06_TakeShelfOff);
//上报运输状态
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.status, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.auto,
$"到达{ JobParam.SrcNode.Name }"));
runInfo = $"到达{JobParam.SrcNode.AliceName}并将料车卸下";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.TakeShelfOff}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LineToLine_06_TakeShelfOff))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.END);
if (JobParam.GetMissionInfo() != null && JobParam.GetMissionInfo().needBack)
{
//上报运输状态
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.status, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.auto,
$"还车"));
}
else if (JobParam.GetMissionInfo() != null && !JobParam.GetMissionInfo().needBack)
{
//上报运输状态
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.status, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.auto,
$"卸车"));
}
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.完成, out string msg);
runInfo = $"料车在{JobParam.CurTargetNode.AliceName}卸下完成,任务结束";
JobRunStep.Msg = runInfo;
}
}
else if (JobRunStep.IsStep(RunStep.END))
{
JobRunStep.EndJob();
return null;
}
agv.SetJobContext(new bean.agv.JobContext()
{
MissionId = JobParam.GetMissionInfo().missionId,
AgvTask = agv.TaskRunState.Task,
JobFullName = this.ToString(),
JobStep = JobRunStep.PreStep(),
Name = agv.Name,
JobParam = JobParam
});
return this;
}
}
}