FrmIOTest.cs
5.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.CompilerServices;
using System.Threading;
using System.IO;
using System.Runtime.InteropServices;
using OnlineStore.DeviceLibrary;
using log4net;
using System.Reflection;
using UserFromControl;
using OnlineStore.LoadCSVLibrary;
using OnlineStore.Common;
namespace OnlineStore.AssemblyLine
{
internal partial class FrmIOTest : FrmBase
{
internal FrmIOTest()
{
Control.CheckForIllegalCrossThreadCalls = false;
InitializeComponent();
}
private void LoadIOList(int subType,Label lblDI,Label lblDO,Label lblDes)
{
List<ConfigIO> DIList = new List<ConfigIO>();
List<ConfigIO> DOList = new List<ConfigIO>();
DIList =new List<ConfigIO> ( DeviceConfig.SubDIList[subType].Values);
DOList = new List<ConfigIO>(DeviceConfig.SubDOList[subType].Values);
lblDI.Text = "";
lblDO.Text = "";
foreach (ConfigIO ioValue in DIList)
{
lblDI.Text+= ioValue.DisplayStr + "\r\n";
}
foreach (ConfigIO ioValue in DOList)
{
lblDO.Text += ioValue.DisplayStr + "\r\n";
}
if (LineManager.Line.HYEquipMap.ContainsKey(subType))
{
lblDes.Text = LineManager.Line.HYEquipMap[subType].GetHYDesc();
}
else
{
lblDes.Text = "";
}
this.SuspendLayout(); //此处为不闪屏,一定要有的!
}
private void FrmTest_FormClosing(object sender, FormClosingEventArgs e)
{
// KNDAIManager.NeedShow = false;
try
{
if (this.timer1.Enabled)
{
this.timer1.Enabled = false;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.StackTrace, "Exception(异常)", MessageBoxButtons.OK, MessageBoxIcon.Error);
LogUtil.error("",ex);
}
}
private Dictionary<int, string> deviceList = new Dictionary<int, string>();
private void FrmStoreIOStatus_Load(object sender, EventArgs e)
{
// KNDAIManager.NeedShow = true;
//tabControl1.TabPages.RemoveAt(1);
comboBox1.Items.Clear();
deviceList = new Dictionary<int, string>();
deviceList.Add(0, "C1环形线");
for (int i = 1; i <= 6; i++)
{
deviceList.Add(i, "D" + i + "-" + "移栽_" + i);
}
deviceList.Add(107, "D7_出料口");
for (int i = 1; i <= 1; i++)
{
deviceList.Add(100 + i, "上料模块_T" + i);
}
for (int i = 1; i <= 4; i++)
{
deviceList.Add(200 + i, "横移_HY" + i);
}
foreach (string key in deviceList.Values)
{
comboBox1.Items.Add(key);
comboBox2.Items.Add(key);
comboBox3.Items.Add(key);
comboBox4.Items.Add(key);
}
comboBox1.SelectedIndex = 0;
comboBox2.SelectedIndex = 1;
comboBox3.SelectedIndex = 2;
comboBox4.SelectedIndex = 3;
LoadIOList(0, lblDI1, lblDO1, lblDes1);
LoadIOList(1, lblDI2, lblDO2, lblDes2);
LoadIOList(2, lblDI3, lblDO3, lblDes3);
LoadIOList(3, lblDI4, lblDO4, lblDes4);
}
private void FrmIOStatus_Shown(object sender, EventArgs e)
{
timer1.Start();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox1.SelectedIndex >= 0)
{
List<int> list = new List<int>(deviceList.Keys);
int subType = list[comboBox1.SelectedIndex];
LoadIOList(subType,lblDI1,lblDO1, lblDes1);
}
}
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox2.SelectedIndex >= 0)
{
List<int> list = new List<int>(deviceList.Keys);
int subType = list[comboBox2.SelectedIndex];
LoadIOList(subType,lblDI2,lblDO2, lblDes2);
}
}
private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox4.SelectedIndex >= 0)
{
List<int> list = new List<int>(deviceList.Keys);
int subType = list[comboBox4.SelectedIndex];
LoadIOList(subType, lblDI4, lblDO4, lblDes4);
}
}
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox3.SelectedIndex >= 0)
{
List<int> list = new List<int>(deviceList.Keys);
int subType = list[comboBox3.SelectedIndex];
LoadIOList(subType, lblDI3, lblDO3, lblDes3);
}
}
}
}