StoreToLinesWithBackJob.cs
7.5 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
using Common;
using DeviceLibrary.manager;
namespace DeviceLibrary.bean.job
{
/// <summary>
/// 库房到线体,(空架返回)
/// </summary>
public class StoreToLinesWithBackJob : Job
{
/// <summary>
/// 库房分发料任务
/// </summary>
public StoreToLinesWithBackJob(JobParam jobParam) : base(jobParam)
{
}
lift.LiftStatus liftStatus;
public override Job Run(AgvInfo agv)
{
if (JobRunStep.IsStep(RunStep.NONE))
{
JobRunStep.ToNextStep(RunStep.SD_StoreToLine_01_ToPickUpPosition);
runInfo = $"任务开始,去{JobParam.SrcNode.AliceName}的取料点";
JobRunStep.Msg = runInfo;
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.接料, out string msg);
AllocateTask(agv, $"{JobParam.SrcNode.Name}_{SettingString.PutShelfOn}");
}
else if (JobRunStep.IsStep(RunStep.SD_StoreToLine_01_ToPickUpPosition))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_StoreToLine_02_PutShelfOn);
runInfo = $"到达{JobParam.SrcNode.AliceName}的取料点,准备拾取料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.PutShelfOn}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_StoreToLine_02_PutShelfOn))
{
JobRunStep.ToNextStep(RunStep.SD_StoreToLine_03_ToLine);
runInfo = $"在{JobParam.SrcNode.AliceName}拾取料车完成,去{JobParam.CurTargetNode.AliceName}的放料点";
JobRunStep.Msg = runInfo;
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.送料, out string msg);
AllocateTask(agv,$"{JobParam.CurTargetNode.Name}_{SettingString.TakeShelfOff}");
}
else if (JobRunStep.IsStep(RunStep.SD_StoreToLine_03_ToLine))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
//确认按钮生效
JobParam.CurTargetNode.ExtendEquip.AllowConfirm();
JobRunStep.ToNextStep(RunStep.SD_StoreToLine_04_UpdateLocation);
runInfo = $"到达{JobParam.CurTargetNode.AliceName}的放料点,上报位置给ITS";
JobRunStep.Msg = runInfo;
//上报位置
manager.UploadManager.UploadPosition(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 }"));
System.Threading.Thread.Sleep(2000);
}
}
else if (JobRunStep.IsStep(RunStep.SD_StoreToLine_04_UpdateLocation))
{
JobRunStep.ToNextStep(RunStep.SD_StoreToLine_05_WaitConfirm);
runInfo = $"等待{JobParam.CurTargetNode.AliceName}的人员确认";
JobRunStep.Msg = runInfo;
manager.UploadManager.UploadPosition(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 }确认"));
System.Threading.Thread.Sleep(2000);
}
else if (JobRunStep.IsStep(RunStep.SD_StoreToLine_05_WaitConfirm))
{
if (OpManager.WaitConfirm.Line(JobParam.CurTargetNode))
{
//关闭按钮确认
JobParam.CurTargetNode.ExtendEquip.Reset();
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_10_CheckNextLine);
runInfo = $"{JobParam.CurTargetNode.AliceName}的人员确认完成";
JobRunStep.Msg = runInfo;
}
else if (JobRunStep.IsTimeOut(WaitTimeOut, out double timeoutval))
{
//报警,$"等待{JobParam.CurTargetNode.AliceName}的人员确认超时{timeoutval}分"
manager.UploadManager.UploadPosition(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}分"));
System.Threading.Thread.Sleep(2000);
}
}
else if (JobRunStep.IsStep(RunStep.SD_StoreToLine_06_CheckNextLine))
{
if (JobParam.TargetNodes.Count > 0)
{
JobRunStep.ToNextStep(RunStep.SD_StoreToLine_03_ToLine);
JobParam.CurTargetNode = JobParam.TargetNodes[0];
JobParam.TargetNodes.RemoveAt(0);
System.Threading.Thread.Sleep(1000);
runInfo = $"去下一线体{JobParam.CurTargetNode.AliceName}的放料点";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{JobParam.CurTargetNode.Name}_{SettingString.TakeShelfOff}");
}
else
{
JobRunStep.ToNextStep(RunStep.SD_StoreToLine_07_BackToPickUpPosition);
runInfo = $"{JobParam.CurTargetNode.AliceName}是最后一个线体,分发结束,返回{JobParam.SrcNode.Name}的放料点";
JobRunStep.Msg = runInfo;
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.返回起始地, out string msg);
AllocateTask(agv, $"{JobParam.SrcNode.Name}_{SettingString.TakeShelfOff}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_StoreToLine_07_BackToPickUpPosition))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_StoreToLine_08_TakeShelfOff);
runInfo = $"到达{JobParam.SrcNode.AliceName}的放料点,准备卸下料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.TakeShelfOff);
}
}
else if (JobRunStep.IsStep(RunStep.SD_StoreToLine_08_TakeShelfOff))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.END);
runInfo = $"料车在{JobParam.SrcNode.AliceName}放下完成,任务结束";
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.完成, out string msg);
JobRunStep.Msg = runInfo;
}
}
else if (JobRunStep.IsStep(RunStep.END))
{
JobRunStep.EndJob();
return null;
}
return this;
}
}
}