SendFullShelfToLineJob.cs
4.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
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
using Common;
namespace DeviceLibrary
{
/// <summary>
/// 从云仓向产线运行任务(出满料)
/// </summary>
public class SendFullShelfToLineJob : Job
{
/// <summary>
/// 从A6向产线运行任务(出满料)
/// </summary>
/// <param name="palce">产线名</param>
/// <param name="rfid">料架RFID</param>
/// <param name="isIgNoreBigShelf">是否忽略大料架</param>
public SendFullShelfToLineJob(HttpManager.BoxDestInfo boxDestInfo, string rfid,bool isIgNoreBigShelf = false)
{
FullShelfPlace = boxDestInfo.data;
RFID =rfid;
BoxDestInfo = boxDestInfo;
IsIgnoreBigShelf = isIgNoreBigShelf;
}
/// <summary>
/// 满料架目标位置点
/// </summary>
public string FullShelfPlace { get; set; }
public string RFID { get; set; }
public HttpManager.BoxDestInfo BoxDestInfo { get; private set; }
/// <summary>
/// 是否忽略大料架移库解绑
/// </summary>
public bool IsIgnoreBigShelf { get; private set; }
private string runInfo = "";
/// <summary>
/// 运行信息
/// </summary>
public override string RunInfo
{
get { return string.Format("送满料任务[RFID={0}][{1}]:{2}", RFID, CurTaskID, runInfo); }
}
private JobStep<SEND_FULL_SHELF_STEP> jobStep = new JobStep<SEND_FULL_SHELF_STEP>(SEND_FULL_SHELF_STEP.NONE);
public override Job Execute(Agv_Info agv)
{
string msg = string.Format("{0} 送满料任务[RFID={1}]: ", agv.Name, RFID);
//bool rtn = false;
agv.RFID = RFID;
if (jobStep.IsStep(SEND_FULL_SHELF_STEP.NONE))
{
jobStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_AGV_REACH_LINE);
runInfo = "从云仓送往[" + FullShelfPlace + "]";
msg += string.Format("[{0}] {1}", jobStep.CurStep(), runInfo);
jobStep.Msg = msg;
MissionSys.AssignMission(agv, FullShelfPlace);
UpdateJobTaskInfo(agv);
}
else if (jobStep.IsStep(SEND_FULL_SHELF_STEP.WAIT_AGV_REACH_LINE))
{
CurTaskState = MissionSys.GetTakJobState(agv);
if (MissionSys.CheckTaskFinished(agv, FullShelfPlace, CurTaskState))
{
//jobStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_BIG_SHELF_UNLOCK);
//runInfo = "AGV到达 " + FullShelfPlace + ",等待人员操作";
//msg += string.Format("[{0}] {1}", jobStep.CurStep(), runInfo);
//jobStep.Msg = msg;
runInfo = "人员在" + FullShelfPlace + "卸料完成";
msg += string.Format("[{0}] {1}", jobStep.CurStep(), runInfo);
jobStep.Msg = msg;
AGVManager.CheckBoxNeedShelfState(agv, out string nodeName);
return new EmptyShelfBackJob(FullShelfPlace, eShelfType.SmallShelf, nodeName);
}
}
else if (jobStep.IsStep(SEND_FULL_SHELF_STEP.WAIT_BIG_SHELF_UNLOCK))
{
MiR_API.Get_IO_Status(agv, out bool[] input, out bool[] output);
System.Threading.Thread.Sleep(500);
if ((input != null && (input[0]|| input[1])))
{
runInfo = "人员在" + FullShelfPlace + "卸料完成";
msg += string.Format("[{0}] {1}", jobStep.CurStep(), runInfo);
jobStep.Msg = msg;
AGVManager.CheckBoxNeedShelfState(agv, out string nodeName);
return new EmptyShelfBackJob(FullShelfPlace, eShelfType.SmallShelf,nodeName);
}
}
return this;
}
}
/// <summary>
/// AGV送满料架到产线
/// </summary>
public enum SEND_FULL_SHELF_STEP
{
/// <summary>
/// 料架已进入小车,去目的地
/// </summary>
NONE,
/// <summary>
/// 等待小车到达目的地
/// </summary>
WAIT_AGV_REACH_LINE,
/// <summary>
/// 等待大料架解绑
/// </summary>
WAIT_BIG_SHELF_UNLOCK,
/// <summary>
/// 进入产线完成
/// </summary>
END
}
}