FrmTurnoverBox.cs
7.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
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
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.XLRStore
{
internal partial class FrmTurnoverBox : FrmBase
{
private bool IsLoad = false;
private TurnoverBox moveBean;
internal FrmTurnoverBox(TurnoverBox moveEquip)
{
this.moveBean = moveEquip;
Control.CheckForIllegalCrossThreadCalls = false;
InitializeComponent();
checkBox2.Visible = Common.ConfigAppSettings.GetBoolValue("AutoClearBoxBind", false);
}
private void timer1_Tick(object sender, EventArgs e)
{
try
{
if (!this.Visible)
{
return;
}
lblWarnMsg.Text = moveBean.WarnMsg;
lblCurrInfo.Text = moveBean.GetMoveStr();
string text = $"AGV {moveBean.AgvNode?.name}[{moveBean.AgvNode?.id}] {moveBean.AgvNode?.status.ToString()}";// + " :" + AgvClient.GetAction(moveBean.Config.AgvName);
if (StoreManager.XLRStore.inputEquip.runStatus > RunStatus.Wait)
{
btnReset.Enabled = true;
}
else
{
btnReset.Enabled = true;
}
text += "\r\n" + moveBean.MoveInfo.MoveType + "_" + moveBean.MoveInfo.MoveStep;
lblAgvInfo.Text = text;
}
catch (Exception ex)
{
LogUtil.error(moveBean.Name + "界面定时器出错:", ex);
}
}
private void FrmTest_FormClosing(object sender, FormClosingEventArgs e)
{
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 void FrmStoreIOStatus_Load(object sender, EventArgs e)
{
lblWarnMsg.Text = moveBean.WarnMsg;
lblCurrInfo.Text = moveBean.GetMoveStr();
// lblAgvInfo.Text = "AGV " + moveBean.Config.AgvName + " :" + AgvClient.GetAction(moveBean.Config.AgvName);
IsLoad = true;
}
private void FrmIOStatus_Shown(object sender, EventArgs e)
{
timer1.Start();
}
private void btnStart_Click(object sender, EventArgs e)
{
moveBean.StartReset();
LogUtil.info(moveBean.Name + "点击:" + btnReset.Text);
}
private void btnShelfOut_Click(object sender, EventArgs e)
{
if (!IsLoad)
{
return;
}
moveBean.ReadBoxId();
moveBean.NeedLeave(true);
LogUtil.info(moveBean.Name + "用户点击:" + btnShelfOut.Text);
}
//private void btnScanTest_Click(object sender, EventArgs e)
//{
// if (!IsLoad)
// {
// return;
// }
// string camera = moveBean.Config.CameraName;
// List<string> LastCodeList = CodeManager.CameraScan(camera, moveBean.Name.Trim() + "测试");
// string msg = CodeManager.ProcessCode(LastCodeList);
// LogUtil.info(moveBean.Name + "[" + camera + "]扫码测试结果:\r\n" + msg);
// MessageBox.Show(moveBean.Name + "[" + camera + "]扫码测试结果:" + msg);
//}
private void LineStart_A_Click(object sender, EventArgs e)
{
LogUtil.info(moveBean.Name + "点击:" + LineStart_A.Text);
moveBean.LineRun();
}
private void LineBack_A_Click(object sender, EventArgs e)
{
LogUtil.info(moveBean.Name + "点击:" + LineBack_A.Text);
moveBean.LineBackRun();
}
private void LineStop_A_Click(object sender, EventArgs e)
{
LogUtil.info(moveBean.Name + "点击:" + LineStop_A.Text);
moveBean.LineStopRun();
}
//private void btnResetShelf_Click(object sender, EventArgs e)
//{
// moveBean.ClearBoxInfo(true);
// LogUtil.info(moveBean.Name + "点击:" + btnResetShelf.Text + ";【" + moveBean.BoxId + "】");
//}
private void chbMoveStop_CheckedChanged(object sender, EventArgs e)
{
if (!IsLoad)
{
return;
}
// moveBean.MoveStop = chbMoveStop.Checked;
//LogUtil.info(moveBean.Name + "用户切换是否暂停: " + moveBean.MoveStop);
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
groupBox1.Enabled = checkBox1.Checked;
}
private void button2_Click(object sender, EventArgs e)
{
moveBean.MayLeave();
}
private void button3_Click(object sender, EventArgs e)
{
moveBean.FinishLeave();
}
private void button1_Click(object sender, EventArgs e)
{
moveBean.MayEnter();
}
private void button4_Click(object sender, EventArgs e)
{
moveBean.GetBoxTaskInfo();
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
if (checkBox2.Checked)
{
if (!moveBean.AutoClearBoxBind)
{
DialogResult result = MessageBox.Show("是否切换到自动清除料箱?", "是否确认切换", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if (result.Equals(DialogResult.Yes))
{
moveBean.AutoClearBoxBind = true;
LogUtil.info(moveBean.Name + "用户切换到自动清除料箱状态 ");
}
}
}
else
{
if (moveBean.AutoClearBoxBind)
{
DialogResult result = MessageBox.Show("是否切换到正常工作状态?", "是否确认切换", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if (result.Equals(DialogResult.Yes))
{
moveBean.AutoClearBoxBind = false;
LogUtil.info(moveBean.Name + "用户切换到正常工作状态 ");
}
}
}
}
private void button5_Click(object sender, EventArgs e)
{
moveBean.FinishEnter();
}
}
}