MainMachine_RFIDSelftest.cs
6.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
using CodeLibrary;
using OnlineStore;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
namespace DeviceLibrary
{
partial class MainMachine
{
public bool DemoTestMode = false;
List<string> DemoTestList;
int DemoTestIndex = 0;
int DemoTestCount = 0;
void TFIDSelfTestProcess()
{
if (CheckWait(StoreMoveInfo))
return;
//常规上料扫码流程
switch (StoreMoveInfo.MoveStep)
{
case MoveStep.Wait:
break;
case MoveStep.StoreIn01:
StoreMoveInfo.NextMoveStep(MoveStep.StoreIn02);
Y_Axis.AbsMove(StoreMoveInfo, Config.Y_Axis_P1, Config.Y_Axis_P1_speed);
X_Axis.AbsMove(StoreMoveInfo, Config.X_Axis_P1, Config.X_Axis_P1_speed);
break;
case MoveStep.StoreIn02:
StoreMoveInfo.NextMoveStep(MoveStep.StoreOut10);
if (IOManager.IOValue(IO_Type.Tside_Right).Equals(IO_VALUE.HIGH))
DemoTestList = CameraPointTest.GetThingStoreName(TestStorePointPort.上层右侧);
else
DemoTestList = CameraPointTest.GetThingStoreName(TestStorePointPort.上层左侧);
if (DemoTestList.Count == 0)
return;
DemoTestIndex = 0;
break;
case MoveStep.StoreOut10:
if (IOValue(IO_Type.Out_Drawer).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.Out_Drawer_Lock).Equals(IO_VALUE.HIGH))
{
StoreMoveInfo.NextMoveStep(MoveStep.StoreOut11);
}
else if (IOValue(IO_Type.Out_Drawer).Equals(IO_VALUE.LOW) && IOValue(IO_Type.Out_Drawer_Lock).Equals(IO_VALUE.HIGH))
{
IOMove(IO_Type.Out_Drawer_Lock, IO_VALUE.LOW);
}
else if (IOValue(IO_Type.Out_Drawer).Equals(IO_VALUE.LOW))
{
Msg.add(crc.GetString("Res0137","出库任务正在执行,请关好抽屉"), MsgLevel.warning);
}
else {
IOMove(IO_Type.Out_Drawer_Lock, IO_VALUE.HIGH);
}
break;
case MoveStep.StoreOut11:
StoreMoveInfo.NextMoveStep(MoveStep.StoreOut12);
var from = CSVPositionReader<ACStorePosition>.GetPositon(DemoTestList[DemoTestIndex]);
var to = CSVPositionReader<ACStorePosition>.GetPositon(RFIDP);
StoreMoveInfo.MoveParam.ReelOnFixture = false;
boxTransport.Start(new BoxStorePosition(Config, from, StoreMoveInfo.MoveParam), new BoxStorePosition(Config, to, StoreMoveInfo.MoveParam), StoreMoveType.OutStore, true);
StoreMoveInfo.log($"开始转运出库");
break;
case MoveStep.StoreOut12:
if (boxTransport.IsComplateOrFree)
{
bool issame = false;
string ds="";
for (int i = 0; i < 15; i++)
{
if (RobotManage.RFID.ReadEPC(12, out byte[] data))
{
if (data[0] != 0xFF)
{
ds = Encoding.ASCII.GetString(data).Trim();
//if (StoreMoveInfo.MoveParam.WareCode.IndexOf(ds)>-1)
{
StoreMoveInfo.MoveParam.RFID = ds;
StoreMoveInfo.log("读取到 RFID:" + ds + " , "+ RobotManage.RFID.HexBuff(data));
issame = true;
break;
}
}
}
Thread.Sleep(200);
}
if (!issame)
{
//StoreMoveInfo.log("读取到 RFID:" + ds);
//Msg.add("读取到的RFID与物料信息不符:" + ds, MsgLevel.alarm);
//RobotManage.UserPause("读取到的RFID与物料信息不符");
}
StoreMoveInfo.NextMoveStep(MoveStep.StoreOut13);
from = CSVPositionReader<ACStorePosition>.GetPositon(RFIDP);
to = CSVPositionReader<ACStorePosition>.GetPositon(DemoTestList[DemoTestIndex]);
StoreMoveInfo.MoveParam.ReelOnFixture = true;
boxTransport.Start(new BoxStorePosition(Config, from, StoreMoveInfo.MoveParam), new BoxStorePosition(Config, to, StoreMoveInfo.MoveParam), StoreMoveType.OutStore, true);
StoreMoveInfo.log($"开始转运出库");
}
break;
case MoveStep.StoreOut13:
if (boxTransport.IsComplateOrFree)
{
StoreMoveInfo.NextMoveStep(MoveStep.StoreOut11);
DemoTestIndex++;
if (DemoTestIndex >= DemoTestList.Count)
DemoTestIndex = 0;
DemoTestCount++;
}
break;
default:
StoreMoveInfo.log($"未找到对应步骤:{StoreMoveInfo.MoveStep}");
break;
}
}
}
}