RecoveryJobType.cs
1.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.bean.jobType
{
public class RecoveryJobType : JobType
{
public override Job GetNewJob(AgvInfo agv)
{
if (agv.JobContext.MissionId.Equals(""))
{
return null;
}
else
{
service.model.MissionInfo missionInfo = manager.MissionManager.GetMission(agv.JobContext.MissionId);
if (missionInfo != null)
{
agv.TaskRunState = new TaskRunState();
agv.TaskRunState.Task = agv.JobContext.AgvTask;
Type type = Type.GetType(agv.JobContext.JobFullName); // 通过类名获取同名类
Job job = (Job)System.Activator.CreateInstance(type);
job.JobParam = agv.JobContext.JobParam;
job.JobParam.CurTargetNode = manager.NodeManager.GetNodeByName(agv.JobContext.JobParam.CurTargetNode.Name);
job.JobParam.SetMissionInfo(missionInfo);
job.Task = agv.JobContext.AgvTask;
job.JobRunStep.ToNextStep((RunStep)Enum.Parse(typeof(RunStep), agv.JobContext.JobStep));
return job;
}
}
return null;
}
}
}