IOControls.cs
4.1 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 DeviceLibrary;
using OnlineStore;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TheMachineNView
{
public partial class IOControls : UserControl
{
Robot_Config _Config;
public Robot_Config Config
{
get { return _Config; }
set
{
_Config = value;
ioControl1.Config = value;
}
}
public IOControls()
{
InitializeComponent();
ioControllerTimer = new System.Threading.Timer(new TimerCallback(IOPRocess), null, 0, 1000);
GC.KeepAlive(ioControllerTimer);
}
private void IOPRocess(object state)
{
if (RobotManage.mainMachine != null && RobotManage.mainMachine.runStatus.Equals(RunStatus.Stop))
{
if (IOManager.IOValue(IO_Type.AGV_OnPosition).Equals(IO_VALUE.LOW))
{
//如果折叠门再打开状态
if (RobotManage.mainMachine.CyStringDoor != null &&RobotManage.mainMachine.CyStringDoor.NeedStop())
{
RobotManage.mainMachine.CyStringDoor.Pause();
}
}
if(IOManager.IOValue(IO_Type.SafetyLightCurtains).Equals(IO_VALUE.LOW))
{
if(RobotManage.mainMachine.SingleDoor != null&& RobotManage.mainMachine.SingleDoor.NeedStop())
{
RobotManage.mainMachine.SingleDoor.Pause();
}
}
}
}
System.Threading.Timer ioControllerTimer;
private void btn_linerun_Click(object sender, EventArgs e)
{
RobotManage.mainMachine.Line.LineRun("n",false, 999);
}
private void btn_linerev_Click(object sender, EventArgs e)
{
RobotManage.mainMachine.Line.LineRun("n",true, 999);
}
private void btn_linestop_Click(object sender, EventArgs e)
{
RobotManage.mainMachine.Line.LineStop("n");
}
private void btn_flipopen_Click(object sender, EventArgs e)
{
LogUtil.info("手动控制:翻板门打开");
RobotManage.mainMachine.OpenFlipDoor(null);
}
private void btn_flipclose_Click(object sender, EventArgs e)
{
LogUtil.info("手动控制:翻板门关闭");
RobotManage.mainMachine.CloseFlipDoor(null);
}
private void ioControl1_Load(object sender, EventArgs e)
{
}
private void btn_stringdooropen_Click(object sender, EventArgs e)
{
//判断光栅是否关闭
if (IOManager.IOValue(IO_Type.AGV_OnPosition).Equals(IO_VALUE.LOW))
{
MessageBox.Show(crc.GetString("OpeartionFail", "操作失败"));
return;
}
LogUtil.info("手动控制:折叠门门打开");
RobotManage.mainMachine.StringDoorOpen(null);
}
private void btn_stringdoorclose_Click(object sender, EventArgs e)
{
//判断光栅是否关闭
if (IOManager.IOValue(IO_Type.AGV_OnPosition).Equals(IO_VALUE.LOW))
{
MessageBox.Show(crc.GetString("OpeartionFail", "操作失败"));
return;
}
LogUtil.info("手动控制:折叠门门关闭");
RobotManage.mainMachine.StringDoorClose(null);
}
private void btn_ngdooropen_Click(object sender, EventArgs e)
{
RobotManage.mainMachine.OpenSingleDoor(null);
}
private void btn_ngdoorclose_Click(object sender, EventArgs e)
{
RobotManage.mainMachine.CloseSingleDoor(null);
}
}
}