TransplantControl.cs
3.9 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 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.Tasks;
using System.Windows.Forms;
namespace TheMachine
{
public partial class TransplantControl : UserControl, Idevicetab
{
public TransplantControl()
{
InitializeComponent();
this.Tag = "not";
crc.OpenResourceLog = true;
crc.LanguageChangeEvent += (s, o) => crc.LanguageProcess(this);
if (!string.IsNullOrEmpty(Setting_Init.Device_Default_Language))
crc.CurrLanguage = Setting_Init.Device_Default_Language;
}
public void Init(string deviceGroupName)
{
this.DeviceGroupName = deviceGroupName;
foreach (var c in panel1.Controls)
{
if (!(c is CylinderButton))
continue;
var cc = (c as CylinderButton);
cc.DeviceType = deviceGroupName;
if (!RobotManage.Config.DOList[deviceGroupName].ContainsKey(cc.IO_HIGH))
cc.Visible = false;
}
ioControl1.Init(RobotManage.Config, deviceGroupName);
//var axis = RobotManage.Config.moveAxisList.Find(ma => ma.GetAxisValue() == RobotManage.DeviceGroup[devicetype].AxisID);
axisMoveControl1.LoadData(AxisBean.List[deviceGroupName]);
textBox_p2.Text = RobotManage.DeviceGroup[DeviceGroupName].p2.ToString();
textBox_p3.Text = RobotManage.DeviceGroup[DeviceGroupName].p3.ToString();
if (TransplantMove.DeviceList[deviceGroupName].RFID_1 != null)
rfidControl1.Init(deviceGroupName, TransplantMove.DeviceList[deviceGroupName].RFID_1);
crc.LanguageProcess(this);
}
public string DeviceGroupName { get; set; }
private void button1_Click(object sender, EventArgs e)
{
if (int.TryParse(textBox_p2.Text,out int p2))
RobotManage.DeviceGroup[DeviceGroupName].p2=p2;
if (int.TryParse(textBox_p3.Text, out int p3))
RobotManage.DeviceGroup[DeviceGroupName].p3 = p3;
CSVPositionReader<DeviceGroup>.SavePostion("Config\\DeviceGroup.csv", RobotManage.DeviceGroup[DeviceGroupName],"GroupName");
}
private void button_p2_Click(object sender, EventArgs e)
{
if (int.TryParse(textBox_p2.Text, out int p2))
{
var axis = AxisBean.List[DeviceGroupName][0];
axis.AbsMove(null, p2,RobotManage.Config.AMH_TS_P1_speed);
}
}
private void button_p3_Click(object sender, EventArgs e)
{
if (int.TryParse(textBox_p3.Text, out int p3))
{
var axis = AxisBean.List[DeviceGroupName][0];
axis.AbsMove(null, p3, RobotManage.Config.AMH_TS_P1_speed);
}
}
private void button_p1_Click(object sender, EventArgs e)
{
var axis = AxisBean.List[DeviceGroupName][0];
axis.AbsMove(null, RobotManage.Config.AMH_TS_P1, RobotManage.Config.AMH_TS_P1_speed);
}
private void btn_sucker_release_Click(object sender, EventArgs e)
{
TransplantMove.DeviceList[DeviceGroupName].IOMove(IO_Type.AMH_Sucker, IO_VALUE.LOW);
TransplantMove.DeviceList[DeviceGroupName].IOMove(IO_Type.AMH_Sucker_Release, IO_VALUE.HIGH,2000);
}
private void btn_Reset_Click(object sender, EventArgs e)
{
TransplantMove.DeviceList[DeviceGroupName].ResetStatus();
}
private void cb_disabledevice_CheckedChanged(object sender, EventArgs e)
{
TransplantMove.DeviceList[DeviceGroupName].Disable = cb_disabledevice.Checked;
}
}
}