IOControls.cs
3.3 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
using DeviceLibrary;
using OnlineStore;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TheMachine
{
public partial class IOControls : UserControl
{
Robot_Config _Config;
public Robot_Config Config
{
get { return _Config; }
set
{
_Config = value;
ioControl1.Config = value;
}
}
public IOControls()
{
InitializeComponent();
}
private void ioControl1_Load(object sender, EventArgs e)
{
}
private void btn_FlipEquip_Click(object sender, EventArgs e)
{
RobotManage.mainMachine.FlipEquip.LiftUp(null);
LogUtil.info("手动点击:FlipEquip.LiftUp");
}
private void button1_Click(object sender, EventArgs e)
{
RobotManage.mainMachine.FlipEquip.LiftDown(null);
LogUtil.info("手动点击:FlipEquip.LiftDown");
}
private void button2_Click(object sender, EventArgs e)
{
RobotManage.mainMachine.RotateEquip.TurnToEnd(true);
LogUtil.info("手动点击:RotateEquip.TurnToEnd 水平");
}
private void button3_Click(object sender, EventArgs e)
{
RobotManage.mainMachine.RotateEquip.TurnToEnd(false);
LogUtil.info("手动点击:RotateEquip.TurnToEnd 垂直");
}
private void button5_Click(object sender, EventArgs e)
{
RobotManage.mainMachine.TPMove.ToLow(null);
}
private void button4_Click(object sender, EventArgs e)
{
RobotManage.mainMachine.TPMove.ToHigh(null);
}
private void button6_Click(object sender, EventArgs e)
{
RobotManage.mainMachine.RotateEquip.TurnDegree(45);
}
private void button7_Click(object sender, EventArgs e)
{
RobotManage.mainMachine.RotateEquip.TurnDegree(-45);
}
private void button8_Click(object sender, EventArgs e)
{
RobotManage.mainMachine.RotateEquip.TurnRound();
}
private void button9_Click(object sender, EventArgs e)
{
for (int i = 0; i < 6;i++) {
Thread.Sleep(200);
if (RobotManage.RFID.ReadEPC(12,out byte[] data)) {
if (data[0] != 0xFF)
{
MessageBox.Show(RobotManage.RFID.HexBuff(data) + "\r\n" + Encoding.ASCII.GetString(data).Trim());
return;
}
}
}
MessageBox.Show("no data");
}
private void button10_Click(object sender, EventArgs e)
{
Thread.Sleep(300);
var epc = "20418002Z-203";
epc = "20418002Z-20";
epc = epc.PadRight(12);
var result = RobotManage.RFID.WriteEPC(Encoding.ASCII.GetBytes(epc));
if (result)
{
MessageBox.Show("写入成功");
return;
}
}
}
}