FrmIOMsg.cs
3.6 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 OnlineStore.DeviceLibrary;
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 OnlineStore.AssemblyLine
{
internal partial class FrmIOMsg : FrmBase
{
public FrmIOMsg()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (this.Visible)
{
UpdateData();
}
}
private void UpdateData()
{
lblMsg.Text = "自动刷新时间:" + timer1.Interval + "毫秒,最后更新时间:" + DateTime.Now.ToLongTimeString();
lblConInfo.Text = "IO连接信息:\r\n";
string msg = "";
List<string> tList = new List<string>(LineManager.Line.cioList);
foreach (string ip in tList)
{
string con = (IOManager.instance.IsConnect(ip)) ? " ✔" : " ✘";
msg += ("IO模块[" + ip + "]").PadLeft(26, ' ') + con + "\n";
}
lblConInfo.Text += msg;
//lblRFID.Text = "RFID信息:\r\n";
//msg = "";
//List<string> rfidList = new List<string>(DeviceConfig.ProRFIpMap.Values);
//foreach (string ip in rfidList)
//{
// string errorCode = "?";
// if (RFIDAutoReader.rfidErrorMap.ContainsKey(ip))
// {
// errorCode = "" + RFIDAutoReader.rfidErrorMap[ip];
// }
// // string con = RFIDManager.ReadRFID(ip) .NumStr() ;
// msg += ("RFID[" + ip + "]:").PadLeft(26, ' ') + "ErrorCode=" + errorCode + "\n";
//}
//lblRFID.Text += msg;
lblBox.Text = "料仓连接信息:\r\n";
msg = "";
List<int> list = new List<int>();
foreach(MoveEquip move in LineManager.Line.MoveEquipMap.Values)
{
list.Add(move.StoreID);
}
foreach (int storeId in list)
{
if (LineServer. BoxConnected(storeId))
{
string doorTray = "仓门口:未知";
BoxInfo box= LineServer.GetBoxInfo(storeId);
if (box != null )
{
if (box.HasTray.Equals(1))
{
doorTray = "仓门口:有料";
}
else
{
doorTray = "仓门口:无料";
}
}
msg += ("BOX[" + storeId + "]").PadLeft(16, ' ') + " ✔ "+LineServer.ClientMap[storeId].AddStr + " "+doorTray+"\n";
}
else
{
msg += ("BOX[" + storeId + "]").PadLeft(16, ' ') + " ✘ " + "\n";
}
}
lblBox.Text += msg;
}
private void FrmIOMsg_Load(object sender, EventArgs e)
{
UpdateData();
timer1.Start();
}
private void btnExit_Click(object sender, EventArgs e)
{
timer1.Stop();
this.Close();
}
private void btnUpdate_Click(object sender, EventArgs e)
{
UpdateData();
}
private void FrmIOMsg_FormClosed(object sender, FormClosedEventArgs e)
{
timer1.Stop();
}
}
}