LineOneToManyJobType.cs
2.1 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
using Common;
using DeviceLibrary.bean.job;
using System.Linq;
namespace DeviceLibrary.bean.jobType
{
/// <summary>
/// 获取一对多线体的任务
/// </summary>
public class LineOneToManyJobType : JobType
{
public override Job GetNewJob(AgvInfo agv)
{
if (!agv.IsIdle())
return null;
else if (!agv.Scope.Floor.Equals(1))
{
service.model.MissionInfo missionInfo = null;
missionInfo = manager.MissionManager.GetLineToLineMission(agv);
if (missionInfo == null)
missionInfo = manager.MissionManager.GetStoreToLinesMission(agv);
if (missionInfo != null)
{
Node src = manager.NodeManager.GetNode(missionInfo.sourcePoint, NodeType.Node);
string[] destTmp = missionInfo.destinationPoint.Split(',');
string[] dests = destTmp.Distinct().ToArray();
Node dest = manager.NodeManager.GetNode(dests.Length > 0 ? dests[0] : dests[0], NodeType.Node);
if(dest == null)
{
LogUtil.error($"无法生成任务,因不存在的节点:{dest}");
return null;
}
JobParam jobParam = new JobParam(src, dest, null, missionInfo);
if (dests.Length > 1)
{
for (int i = 1; i < dests.Length; i++)
{
Node node = manager.NodeManager.GetNode(dests[i], NodeType.Node);
if (node != null)
jobParam.TargetNodes.Add(node);
else
{
LogUtil.error($"无法生成任务,因不存在的节点:{dests[i]}");
return null;
}
}
}
return new LineOneToManyJob(jobParam);
}
}
return null;
}
}
}