WashPointJob.cs
2.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
using System;
using Model;
namespace BLL
{
public class WashPointJob : IJob
{
private AgvInfo _info;
private MoveJob move;
private string mission;
private JobStep<WashPointStep> washPointStep;
public WashPointJob()
{
washPointStep = new JobStep<WashPointStep>(WashPointStep.None);
Common.log.Debug("加载WashPointJob");
}
public bool IsEnd { get; private set; }
public IJob Execute(AgvInfo info)
{
_info = info;
if (washPointStep.Equals(WashPointStep.None))
{
if (_info.IsWorkspace())
MoveWash();
else
PassDoor();
}
else if (washPointStep.Equals(WashPointStep.PassDoor))
{
move.Execute(_info);
if (move.IsEnd)
MoveWash();
}
else if (washPointStep.Equals(WashPointStep.MoveWash))
{
move.Execute(_info);
if (move.IsEnd)
{
washPointStep.NextStep(WashPointStep.End);
washPointStep.Msg = _info.Name + "到达清洗点";
}
}
else if (washPointStep.Equals(WashPointStep.End))
{
IJob job = SteelManage.GetSteelJob(info);
if (job == null)
return new StandbyJob();
else
return job;
}
return this;
}
private void MoveWash()
{
mission = Common.MISSION_MOVE_WASH + _info.Workshop;
_info.Place = mission;
move = new MoveJob(mission);
move.Execute(_info);
washPointStep.NextStep(WashPointStep.MoveWash);
washPointStep.Msg = _info.Name + "发送任务" + mission;
}
private void PassDoor()
{
mission = Common.MISSION_PASS_DOOR_INTO + _info.Workshop;
_info.Place = mission;
move = new MoveJob(mission);
move.Execute(_info);
washPointStep.NextStep(WashPointStep.PassDoor);
washPointStep.Msg = _info.Name + "发送任务" + mission;
}
private enum WashPointStep
{
None,
End,
PassDoor,
MoveWash,
}
}
}