TransplantMove.cs
5.0 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
121
122
123
124
125
126
127
128
129
130
131
using OnlineStore;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public class TransplantMove : DeviceBase,IDevice,ISafetyDevice
{
static List<TransplantMove> SideMoves = new List<TransplantMove>();
public static void Init(Robot_Config config, Dictionary<string, DeviceGroup> devices,out string msg) {
msg = "";
foreach (var key in devices.Keys) {
if (!devices[key].DeviceType.StartsWith("SISO"))
continue;
TransplantMove sideMove = new TransplantMove(devices[key],out string m);
SideMoves.Add(sideMove);
msg += m;
}
}
DeviceGroup DeviceGroup;
MoveInfo MoveInfo;
MsgService Msg;
PuYueRFID_C2S RFID_1 = null;
PuYueRFID_C2S RFID_2 = null;
AxisBean axis;
public DeviceStateE DeviceState { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public TransplantMove(DeviceGroup device,out string msg) {
msg = "";
Name = device.Name+"("+ device.GroupName + ")";
DeviceGroup = device;
GroupName = DeviceGroup.GroupName;
Msg = new MsgService(GroupName);
MoveInfo = new MoveInfo(GroupName);
SafetyDevice.AddDevice(this);
if (!string.IsNullOrEmpty(DeviceGroup.RFID_1))
{
RFID_1 = new PuYueRFID_C2S(DeviceGroup.RFID_1);
if (!RFID_1.Open()) {
msg += DeviceGroup.GroupName + " RFID 1:" + DeviceGroup.RFID_1 +","+crc.GetString("Res0183","打开失败")+ "\r\n";
}
}
if (!string.IsNullOrEmpty(DeviceGroup.RFID_2))
{
RFID_2 = new PuYueRFID_C2S(DeviceGroup.RFID_2);
if (!RFID_2.Open())
{
msg += DeviceGroup.GroupName + " RFID 2:" + DeviceGroup.RFID_2 + "," + crc.GetString("Res0183","打开失败") + "\r\n";
}
}
var axisc = RobotManage.Config.moveAxisList.Find(ma => ma.GetAxisValue() == RobotManage.DeviceGroup[GroupName].AxisID);
axis = new AxisBean(axisc, GroupName);
}
public void Process()
{
if (CheckWait(MoveInfo))
return;
switch (MoveInfo.MoveStep)
{
case MoveStep.Wait:
if (IOValue(IO_Type.Ls_B_Tray_Check).Equals(IO_VALUE.HIGH)) {
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
}
else if(IOValue(IO_Type.Ls_A_Tray_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
}
else if (IOValue(IO_Type.Ls_A_Front_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(MoveStep.SideMove_01);
CylinderMove(MoveInfo, IO_Type.Ls_A_Location_Up, IO_Type.Ls_A_Location_Down, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Type.Ls_B_Location_Up, IO_Type.Ls_B_Location_Down, IO_VALUE.LOW);
IOMove(IO_Type.Ls_A_Front_Stop, IO_VALUE.HIGH, 1000);
IOMove(IO_Type.Ls_A_BufStop_Fwd, IO_VALUE.HIGH, 500);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Ls_A_Tray_Check,IO_VALUE.HIGH));
}
else {
Msg.add(crc.GetString("Res0184","空闲中"), MsgLevel.info);
}
break;
case MoveStep.SideMove_01:
MoveInfo.NextMoveStep(MoveStep.SideMove_02);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
break;
case MoveStep.SideMove_02:
MoveInfo.NextMoveStep(MoveStep.SideMove_02);
CylinderMove(MoveInfo, IO_Type.Ls_A_Location_Up, IO_Type.Ls_A_Location_Down, IO_VALUE.HIGH);
CylinderMove(MoveInfo, IO_Type.Ls_B_Location_Up, IO_Type.Ls_B_Location_Down, IO_VALUE.HIGH);
break;
case MoveStep.SideMove_03:
MoveInfo.NextMoveStep(MoveStep.SideMove_04);
IOMove(IO_Type.Ls_A_LineRun, IO_VALUE.HIGH);
break;
}
}
public void Start()
{
throw new NotImplementedException();
}
public void Stop()
{
throw new NotImplementedException();
}
public void Pause()
{
throw new NotImplementedException();
}
public void Resume()
{
throw new NotImplementedException();
}
enum LS_TypeE {
NoRfid,
OneWay,
TwoWay
}
}
}