agv 오류코드가 전송되도록함, 에뮬레이터에서 표시되게 함

This commit is contained in:
backuppc
2026-02-02 15:04:05 +09:00
parent 9bca8f67d1
commit b25be68986
5 changed files with 133 additions and 85 deletions

View File

@@ -36,7 +36,19 @@ namespace AGVEmulator
/// <summary> /// <summary>
/// 호출제어기 통신 오류 /// 호출제어기 통신 오류
/// </summary> /// </summary>
controller_comm_error = 11, controller_comm_error,
/// <summary>
/// 배터리 저전압
/// </summary>
battery_low_voltage,
spare08,
lift_timeout,
lift_driver_overcurrent,
lift_driver_emergency,
/// <summary> /// <summary>
/// 도착경보기 통신 오류 /// 도착경보기 통신 오류
/// </summary> /// </summary>

View File

@@ -9,6 +9,7 @@ namespace AGVEmulator
public byte RunSt { get; set; } // 0=stop, 1=run, 2=error public byte RunSt { get; set; } // 0=stop, 1=run, 2=error
public byte RunStep { get; set; } public byte RunStep { get; set; }
public byte RunStepSeq { get; set; } public byte RunStepSeq { get; set; }
public ushort HWError { get; set; }
public byte MotorDir { get; set; } // 0=F, 1=B public byte MotorDir { get; set; } // 0=F, 1=B
public byte MagnetDir { get; set; } // 0=S, 1=L, 2=R public byte MagnetDir { get; set; } // 0=S, 1=L, 2=R
public byte ChargeSt { get; set; } // 0=off, 1=on public byte ChargeSt { get; set; } // 0=off, 1=on
@@ -22,6 +23,18 @@ namespace AGVEmulator
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.AppendLine($"Mode: {(Mode == 1 ? "Auto" : "Manual")}"); sb.AppendLine($"Mode: {(Mode == 1 ? "Auto" : "Manual")}");
sb.AppendLine($"RunSt: {(RunSt == 0 ? "Stop" : (RunSt == 1 ? "Run" : "Error"))}"); sb.AppendLine($"RunSt: {(RunSt == 0 ? "Stop" : (RunSt == 1 ? "Run" : "Error"))}");
if (HWError > 0)
{
sb.Append(" [HW ERR: ");
for (int i = 0; i < 16; i++)
{
if ((HWError & (1 << i)) != 0)
{
sb.Append($"{(DevAGV.eerror)i},");
}
}
sb.AppendLine("]");
}
sb.AppendLine($"Step: {RunStep}, Seq: {RunStepSeq}"); sb.AppendLine($"Step: {RunStep}, Seq: {RunStepSeq}");
sb.AppendLine($"Dir: {(MotorDir == 1 ? "B" : "F")}, Mag: {(MagnetDir == 1 ? "L" : (MagnetDir == 2 ? "R" : "S"))}"); sb.AppendLine($"Dir: {(MotorDir == 1 ? "B" : "F")}, Mag: {(MagnetDir == 1 ? "L" : (MagnetDir == 2 ? "R" : "S"))}");
sb.AppendLine($"Charge: {(ChargeSt == 1 ? "ON" : "OFF")}"); sb.AppendLine($"Charge: {(ChargeSt == 1 ? "ON" : "OFF")}");

View File

@@ -33,19 +33,22 @@ namespace AGVEmulator
if (cmd == ENIGProtocol.AGVCommandEH.Status) if (cmd == ENIGProtocol.AGVCommandEH.Status)
{ {
if (data.Length >= 14) if (data.Length >= 16)
{ {
_remoteStatus.Mode = data[0]; _remoteStatus.Mode = data[0];
_remoteStatus.RunSt = data[1]; _remoteStatus.RunSt = data[1];
_remoteStatus.RunStep = data[2]; _remoteStatus.HWError = BitConverter.ToUInt16(data, 2);
_remoteStatus.RunStepSeq = data[3]; _remoteStatus.RunStep = data[4];
_remoteStatus.MotorDir = data[4]; _remoteStatus.RunStepSeq = data[5];
_remoteStatus.MagnetDir = data[5]; _remoteStatus.MotorDir = data[6];
_remoteStatus.ChargeSt = data[6]; _remoteStatus.MagnetDir = data[7];
_remoteStatus.CartSt = data[7]; _remoteStatus.ChargeSt = data[8];
_remoteStatus.LiftSt = data[8]; _remoteStatus.CartSt = data[9];
_remoteStatus.ErrorCode = data[9]; _remoteStatus.LiftSt = data[10];
_remoteStatus.LastTag = Encoding.ASCII.GetString(data, 10, 4); _remoteStatus.ErrorCode = data[11];
_remoteErrorCode = (ENIGProtocol.AGVErrorCode)data[11];
_remoteErrorMessage = ENIGProtocol.AGVUtility.GetAGVErrorMessage(_remoteErrorCode);
_remoteStatus.LastTag = Encoding.ASCII.GetString(data, 12, 4);
UpdateUIStatus(); UpdateUIStatus();
} }

View File

@@ -142,6 +142,11 @@ namespace AGVEmulator
this.tabPage2 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabPage3 = new System.Windows.Forms.TabPage(); this.tabPage3 = new System.Windows.Forms.TabPage();
this.panel3 = new System.Windows.Forms.Panel(); this.panel3 = new System.Windows.Forms.Panel();
this.groupBox13 = new System.Windows.Forms.GroupBox();
this.tbErCode = new System.Windows.Forms.TextBox();
this.tbErmsg = new System.Windows.Forms.TextBox();
this.groupBox12 = new System.Windows.Forms.GroupBox();
this.rtStatus = new System.Windows.Forms.RichTextBox();
this.label13 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label();
this.button6 = new System.Windows.Forms.Button(); this.button6 = new System.Windows.Forms.Button();
this.button13 = new System.Windows.Forms.Button(); this.button13 = new System.Windows.Forms.Button();
@@ -174,11 +179,6 @@ namespace AGVEmulator
this.sbBMS = new System.Windows.Forms.ToolStripStatusLabel(); this.sbBMS = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
this.sbCAL = new System.Windows.Forms.ToolStripStatusLabel(); this.sbCAL = new System.Windows.Forms.ToolStripStatusLabel();
this.groupBox12 = new System.Windows.Forms.GroupBox();
this.groupBox13 = new System.Windows.Forms.GroupBox();
this.tbErmsg = new System.Windows.Forms.TextBox();
this.tbErCode = new System.Windows.Forms.TextBox();
this.rtStatus = new System.Windows.Forms.RichTextBox();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trbT2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.trbT2)).BeginInit();
@@ -205,13 +205,13 @@ namespace AGVEmulator
this.tabPage2.SuspendLayout(); this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout(); this.tabPage3.SuspendLayout();
this.panel3.SuspendLayout(); this.panel3.SuspendLayout();
this.groupBox13.SuspendLayout();
this.groupBox12.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudIDAgv)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudIDAgv)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudTagNo)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudTagNo)).BeginInit();
this.toolStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout();
this.groupBox12.SuspendLayout();
this.groupBox13.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupBox1 // groupBox1
@@ -1310,10 +1310,55 @@ namespace AGVEmulator
this.panel3.Size = new System.Drawing.Size(364, 622); this.panel3.Size = new System.Drawing.Size(364, 622);
this.panel3.TabIndex = 15; this.panel3.TabIndex = 15;
// //
// groupBox13
//
this.groupBox13.Controls.Add(this.tbErCode);
this.groupBox13.Controls.Add(this.tbErmsg);
this.groupBox13.Dock = System.Windows.Forms.DockStyle.Bottom;
this.groupBox13.Location = new System.Drawing.Point(0, 545);
this.groupBox13.Name = "groupBox13";
this.groupBox13.Size = new System.Drawing.Size(364, 77);
this.groupBox13.TabIndex = 21;
this.groupBox13.TabStop = false;
this.groupBox13.Text = "error";
//
// tbErCode
//
this.tbErCode.Location = new System.Drawing.Point(12, 18);
this.tbErCode.Name = "tbErCode";
this.tbErCode.Size = new System.Drawing.Size(287, 21);
this.tbErCode.TabIndex = 1;
//
// tbErmsg
//
this.tbErmsg.Location = new System.Drawing.Point(13, 45);
this.tbErmsg.Name = "tbErmsg";
this.tbErmsg.Size = new System.Drawing.Size(287, 21);
this.tbErmsg.TabIndex = 0;
//
// groupBox12
//
this.groupBox12.Controls.Add(this.rtStatus);
this.groupBox12.Location = new System.Drawing.Point(7, 318);
this.groupBox12.Name = "groupBox12";
this.groupBox12.Size = new System.Drawing.Size(355, 221);
this.groupBox12.TabIndex = 20;
this.groupBox12.TabStop = false;
this.groupBox12.Text = "status";
//
// rtStatus
//
this.rtStatus.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtStatus.Location = new System.Drawing.Point(3, 17);
this.rtStatus.Name = "rtStatus";
this.rtStatus.Size = new System.Drawing.Size(349, 201);
this.rtStatus.TabIndex = 0;
this.rtStatus.Text = "";
//
// label13 // label13
// //
this.label13.AutoSize = true; this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(17, 362); this.label13.Location = new System.Drawing.Point(18, 287);
this.label13.Name = "label13"; this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(26, 12); this.label13.Size = new System.Drawing.Size(26, 12);
this.label13.TabIndex = 19; this.label13.TabIndex = 19;
@@ -1321,7 +1366,7 @@ namespace AGVEmulator
// //
// button6 // button6
// //
this.button6.Location = new System.Drawing.Point(204, 349); this.button6.Location = new System.Drawing.Point(205, 274);
this.button6.Name = "button6"; this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(133, 38); this.button6.Size = new System.Drawing.Size(133, 38);
this.button6.TabIndex = 18; this.button6.TabIndex = 18;
@@ -1332,7 +1377,7 @@ namespace AGVEmulator
// //
// button13 // button13
// //
this.button13.Location = new System.Drawing.Point(65, 349); this.button13.Location = new System.Drawing.Point(66, 274);
this.button13.Name = "button13"; this.button13.Name = "button13";
this.button13.Size = new System.Drawing.Size(133, 38); this.button13.Size = new System.Drawing.Size(133, 38);
this.button13.TabIndex = 17; this.button13.TabIndex = 17;
@@ -1344,7 +1389,7 @@ namespace AGVEmulator
// label12 // label12
// //
this.label12.AutoSize = true; this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(17, 318); this.label12.Location = new System.Drawing.Point(18, 243);
this.label12.Name = "label12"; this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(34, 12); this.label12.Size = new System.Drawing.Size(34, 12);
this.label12.TabIndex = 16; this.label12.TabIndex = 16;
@@ -1352,7 +1397,7 @@ namespace AGVEmulator
// //
// button3 // button3
// //
this.button3.Location = new System.Drawing.Point(204, 305); this.button3.Location = new System.Drawing.Point(205, 230);
this.button3.Name = "button3"; this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(133, 38); this.button3.Size = new System.Drawing.Size(133, 38);
this.button3.TabIndex = 15; this.button3.TabIndex = 15;
@@ -1363,7 +1408,7 @@ namespace AGVEmulator
// //
// button2 // button2
// //
this.button2.Location = new System.Drawing.Point(65, 305); this.button2.Location = new System.Drawing.Point(66, 230);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(133, 38); this.button2.Size = new System.Drawing.Size(133, 38);
this.button2.TabIndex = 14; this.button2.TabIndex = 14;
@@ -1375,7 +1420,7 @@ namespace AGVEmulator
// nudIDAgv // nudIDAgv
// //
this.nudIDAgv.Font = new System.Drawing.Font("굴림", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); this.nudIDAgv.Font = new System.Drawing.Font("굴림", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.nudIDAgv.Location = new System.Drawing.Point(6, 249); this.nudIDAgv.Location = new System.Drawing.Point(7, 174);
this.nudIDAgv.Maximum = new decimal(new int[] { this.nudIDAgv.Maximum = new decimal(new int[] {
9999999, 9999999,
0, 0,
@@ -1394,7 +1439,7 @@ namespace AGVEmulator
// label7 // label7
// //
this.label7.AutoSize = true; this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(32, 220); this.label7.Location = new System.Drawing.Point(33, 145);
this.label7.Name = "label7"; this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(45, 12); this.label7.Size = new System.Drawing.Size(45, 12);
this.label7.TabIndex = 12; this.label7.TabIndex = 12;
@@ -1403,7 +1448,7 @@ namespace AGVEmulator
// numericUpDown2 // numericUpDown2
// //
this.numericUpDown2.Font = new System.Drawing.Font("굴림", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); this.numericUpDown2.Font = new System.Drawing.Font("굴림", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.numericUpDown2.Location = new System.Drawing.Point(110, 207); this.numericUpDown2.Location = new System.Drawing.Point(111, 132);
this.numericUpDown2.Maximum = new decimal(new int[] { this.numericUpDown2.Maximum = new decimal(new int[] {
9999999, 9999999,
0, 0,
@@ -1421,7 +1466,7 @@ namespace AGVEmulator
// //
// button1 // button1
// //
this.button1.Location = new System.Drawing.Point(246, 207); this.button1.Location = new System.Drawing.Point(247, 132);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(86, 38); this.button1.Size = new System.Drawing.Size(86, 38);
this.button1.TabIndex = 10; this.button1.TabIndex = 10;
@@ -1433,7 +1478,7 @@ namespace AGVEmulator
// nudTagNo // nudTagNo
// //
this.nudTagNo.Font = new System.Drawing.Font("굴림", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); this.nudTagNo.Font = new System.Drawing.Font("굴림", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.nudTagNo.Location = new System.Drawing.Point(110, 251); this.nudTagNo.Location = new System.Drawing.Point(111, 176);
this.nudTagNo.Maximum = new decimal(new int[] { this.nudTagNo.Maximum = new decimal(new int[] {
9999999, 9999999,
0, 0,
@@ -1451,7 +1496,7 @@ namespace AGVEmulator
// //
// btacsgoto // btacsgoto
// //
this.btacsgoto.Location = new System.Drawing.Point(246, 251); this.btacsgoto.Location = new System.Drawing.Point(247, 176);
this.btacsgoto.Name = "btacsgoto"; this.btacsgoto.Name = "btacsgoto";
this.btacsgoto.Size = new System.Drawing.Size(86, 38); this.btacsgoto.Size = new System.Drawing.Size(86, 38);
this.btacsgoto.TabIndex = 8; this.btacsgoto.TabIndex = 8;
@@ -1462,7 +1507,7 @@ namespace AGVEmulator
// //
// button7 // button7
// //
this.button7.Location = new System.Drawing.Point(83, 72); this.button7.Location = new System.Drawing.Point(219, 12);
this.button7.Name = "button7"; this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(62, 54); this.button7.Size = new System.Drawing.Size(62, 54);
this.button7.TabIndex = 7; this.button7.TabIndex = 7;
@@ -1471,7 +1516,7 @@ namespace AGVEmulator
// //
// button8 // button8
// //
this.button8.Location = new System.Drawing.Point(83, 132); this.button8.Location = new System.Drawing.Point(87, 72);
this.button8.Name = "button8"; this.button8.Name = "button8";
this.button8.Size = new System.Drawing.Size(62, 54); this.button8.Size = new System.Drawing.Size(62, 54);
this.button8.TabIndex = 6; this.button8.TabIndex = 6;
@@ -1481,7 +1526,7 @@ namespace AGVEmulator
// //
// button9 // button9
// //
this.button9.Location = new System.Drawing.Point(15, 130); this.button9.Location = new System.Drawing.Point(19, 70);
this.button9.Name = "button9"; this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(62, 54); this.button9.Size = new System.Drawing.Size(62, 54);
this.button9.TabIndex = 5; this.button9.TabIndex = 5;
@@ -1491,7 +1536,7 @@ namespace AGVEmulator
// //
// button10 // button10
// //
this.button10.Location = new System.Drawing.Point(15, 70); this.button10.Location = new System.Drawing.Point(151, 10);
this.button10.Name = "button10"; this.button10.Name = "button10";
this.button10.Size = new System.Drawing.Size(62, 54); this.button10.Size = new System.Drawing.Size(62, 54);
this.button10.TabIndex = 3; this.button10.TabIndex = 3;
@@ -1632,51 +1677,6 @@ namespace AGVEmulator
this.sbCAL.Size = new System.Drawing.Size(19, 17); this.sbCAL.Size = new System.Drawing.Size(19, 17);
this.sbCAL.Text = "●"; this.sbCAL.Text = "●";
// //
// groupBox12
//
this.groupBox12.Controls.Add(this.rtStatus);
this.groupBox12.Location = new System.Drawing.Point(6, 393);
this.groupBox12.Name = "groupBox12";
this.groupBox12.Size = new System.Drawing.Size(355, 147);
this.groupBox12.TabIndex = 20;
this.groupBox12.TabStop = false;
this.groupBox12.Text = "status";
//
// groupBox13
//
this.groupBox13.Controls.Add(this.tbErCode);
this.groupBox13.Controls.Add(this.tbErmsg);
this.groupBox13.Dock = System.Windows.Forms.DockStyle.Bottom;
this.groupBox13.Location = new System.Drawing.Point(0, 546);
this.groupBox13.Name = "groupBox13";
this.groupBox13.Size = new System.Drawing.Size(364, 76);
this.groupBox13.TabIndex = 21;
this.groupBox13.TabStop = false;
this.groupBox13.Text = "error";
//
// tbErmsg
//
this.tbErmsg.Location = new System.Drawing.Point(13, 45);
this.tbErmsg.Name = "tbErmsg";
this.tbErmsg.Size = new System.Drawing.Size(287, 21);
this.tbErmsg.TabIndex = 0;
//
// tbErCode
//
this.tbErCode.Location = new System.Drawing.Point(12, 18);
this.tbErCode.Name = "tbErCode";
this.tbErCode.Size = new System.Drawing.Size(287, 21);
this.tbErCode.TabIndex = 1;
//
// rtStatus
//
this.rtStatus.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtStatus.Location = new System.Drawing.Point(3, 17);
this.rtStatus.Name = "rtStatus";
this.rtStatus.Size = new System.Drawing.Size(349, 127);
this.rtStatus.TabIndex = 0;
this.rtStatus.Text = "";
//
// fMain // fMain
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
@@ -1725,6 +1725,9 @@ namespace AGVEmulator
this.tabPage3.ResumeLayout(false); this.tabPage3.ResumeLayout(false);
this.panel3.ResumeLayout(false); this.panel3.ResumeLayout(false);
this.panel3.PerformLayout(); this.panel3.PerformLayout();
this.groupBox13.ResumeLayout(false);
this.groupBox13.PerformLayout();
this.groupBox12.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.nudIDAgv)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nudIDAgv)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudTagNo)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nudTagNo)).EndInit();
@@ -1732,9 +1735,6 @@ namespace AGVEmulator
this.toolStrip1.PerformLayout(); this.toolStrip1.PerformLayout();
this.statusStrip1.ResumeLayout(false); this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout(); this.statusStrip1.PerformLayout();
this.groupBox12.ResumeLayout(false);
this.groupBox13.ResumeLayout(false);
this.groupBox13.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();

View File

@@ -13,6 +13,7 @@ using System.Windows.Forms.VisualStyles;
using static AGVEmulator.DevAGV; using static AGVEmulator.DevAGV;
using AGVNavigationCore.Controls; using AGVNavigationCore.Controls;
using AGVNavigationCore.Models; using AGVNavigationCore.Models;
using System.Text;
namespace AGVEmulator namespace AGVEmulator
{ {
@@ -993,10 +994,29 @@ namespace AGVEmulator
} }
rtStatus.Text = _remoteStatus.ToString(); rtStatus.Text = _remoteStatus.ToString();
tbErCode.Text = _remoteErrorCode.ToString();
tbErmsg.Text = _remoteErrorMessage;
if (_remoteErrorCode != ENIGProtocol.AGVErrorCode.None) string errCode = _remoteErrorCode.ToString();
string errMsg = _remoteErrorMessage;
if (_remoteStatus.HWError > 0)
{
errCode = $"HW:{_remoteStatus.HWError:X4}" + (errCode == "None" ? "" : $" | {errCode}");
StringBuilder sbHw = new StringBuilder();
for (int i = 0; i < 16; i++)
{
if (((ushort)_remoteStatus.HWError & (1 << i)) != 0)
{
sbHw.Append($"{(DevAGV.eerror)i}, ");
}
}
errMsg = $"[HW] {sbHw}" + (string.IsNullOrEmpty(errMsg) ? "" : $" | {errMsg}");
}
tbErCode.Text = errCode;
tbErmsg.Text = errMsg;
if (_remoteErrorCode != ENIGProtocol.AGVErrorCode.None || _remoteStatus.HWError > 0)
{ {
tbErCode.BackColor = Color.Red; tbErCode.BackColor = Color.Red;
tbErCode.ForeColor = Color.White; tbErCode.ForeColor = Color.White;