StandbyJob.cs
2.6 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
using DeviceLib.Model.AGV;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLib.BLL
{
public class StandbyJob : ImpJob
{
public StandbyJob(JobParam jobParam) : base(jobParam)
{
JobName = "待机任务";
}
public override Job Run(Robot robot)
{
Job job = this;
switch (JobRunStep.CurStep)
{
case RunStep.None:
ToNextStep(RunStep.Standby_03_CrossDoorSuccess, $"开始待机任务");
break;
case RunStep.Standby_01_Start:
ToNextStep(RunStep.Standby_02_CrossDoor, $"准备去目标车间");
GenJobCallBack(this.GetType(), RunStep.Standby_03_CrossDoorSuccess, JobParam);
job = new CrossDoorJob(JobParam);
break;
//case RunStep.Standby_02_CrossDoor:
// break;
case RunStep.Standby_03_CrossDoorSuccess:
ToNextStep(RunStep.Standby_04_ToDst, $"准备去待机点");
MoveToNode(robot, JobParam.CurDstNode);
break;
case RunStep.Standby_04_ToDst:
ToNextStep(RunStep.Standby_05_End, $"到达待机点");
SetRobotState(robot,RobotState.待机中);
break;
case RunStep.Standby_05_End:
//1. 获取运输任务
bool newJob = JobManager.CheckNewJob(robot);
if (newJob)
job= null;
else
{
//2. 该机器人在待机点,且未找到其他电量低于当前车电量的小车
NodeJobState chargePile = ChargeStandJobType.getChargePile(robot);
if (chargePile != null && !ChargeStandJobType.FindOtherLowerRobor(robot))
{
List<NodeJobState> targets = new List<NodeJobState>();
targets.Add(chargePile);
JobParam param = new JobParam(null, targets);
param.PreDstNode = JobType.getPreDstNode(robot);
param.JobGoal = JobGoal.None;
param.RobotIp = robot.ip;
ChargeJob chargeJob = new ChargeJob(param);
return chargeJob;
}
}
break;
}
return job;
}
}
}