FrmRobot.cs
3.8 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
using OnlineStore.DeviceLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.DoubleLineClient
{
public partial class FrmRobot : FrmBase
{
public FrmRobot()
{
InitializeComponent();
}
public List<string> IpList = new List<string>();
private void FrmRobot_Load(object sender, EventArgs e)
{
IpList.Add(LineManager.Config.ABB1_IP);
IpList.Add(LineManager.Config.ABB2_IP);
IpList.Add(LineManager.Config.ABB3_IP);
DgvABBInfo.Rows.Add("ABB1(右)",LineManager.Config.ABB1_IP, "关闭", "" );
DgvABBInfo.Rows.Add("ABB2(左)", LineManager.Config.ABB2_IP, "关闭", "");
DgvABBInfo.Rows.Add("ABB3(包装料)", LineManager.Config.ABB3_IP, "关闭", "");
CboAbbAction.Items.Add(ABBRobotServer.Cmd_movep);
CboAbbAction.Items.Add(ABBRobotServer.Cmd_moveput);
CboAbbAction.Items.Add(ABBRobotServer.Cmd_moveget);
CboAbbAction.Items.Add(ABBRobotServer.Cmd_validateP);
CboAbbAction.SelectedIndex = 0;
CboAbbType.Items.Add("C:大料架");
CboAbbType.Items.Add("D:7寸料架");
CboAbbType.SelectedIndex = 0;
}
private void BtnAbbMove_Click(object sender, EventArgs e)
{
if (DgvABBInfo.SelectedCells.Count == 0) return;
int idx = DgvABBInfo.SelectedCells[0].RowIndex;
string command = CboAbbAction.Text;
string point = "p" + numericUpDown1.Value;
if (command == ABBRobotServer.Cmd_moveput)
{
if (CboAbbType.SelectedIndex == 0)
point = "cp" + numericUpDown1.Value;
else
point = "dp" + numericUpDown1.Value;
}
string movement = RdoAbbMove1.Checked ? "L" : "J";
int speed = Convert.ToInt32(NudAbbSpeed.Value);
string s = string.Format("{0},{1},{2},{3}", command, point, movement, speed);
ABBRobotServer.SendMovePoint(IpList[idx], command, point, movement, speed.ToString() );
}
private void BtnAbbMove2_Click(object sender, EventArgs e)
{
if (DgvABBInfo.SelectedCells.Count == 0) return;
int idx = DgvABBInfo.SelectedCells[0].RowIndex;
string command = CboAbbAction.Text;
string point = "p{0}";
if (command == ABBRobotServer.Cmd_moveput)
{
if (CboAbbType.SelectedIndex == 0)
point = "cp{0}";
else
point = "dp{0}";
}
int p1 = Convert.ToInt32(numericUpDown1.Value);
int p2 = Convert.ToInt32(numericUpDown2.Value);
string movement = RdoAbbMove1.Checked ? "L" : "J";
int speed = Convert.ToInt32(NudAbbSpeed.Value);
string s = string.Format("{0},{1},{2},{3}", command, point, movement, speed);
// ABBRobotServer.SendMovePoint(IpList[idx], command, point, movement, speed.ToString());
}
//private void Robot_StatusChanged(int idx, string sta)
//{
// Invoke(new Action(() =>
// {
// DgvABBInfo.Rows[idx].Cells[2].Value = sta;
// Common.ABB_Dev[idx].State = sta;
// groupBox13.Controls["LblABBSta" + idx].BackColor = Color.Lime;
// }));
//}
//private void Robot_ServerChanged(int idx, string sta)
//{
// Invoke(new Action(() =>
// {
// DgvABBInfo.Rows[idx].Cells[3].Value = sta;
// Common.ABB_Dev[idx].Server = sta;
// }));
//}
}
}