- 시리얼/이더넷 통신 Test Send 버그 수정

- 이더넷 통신 통신모드 설정부분 제대로 값이 뜨는부분 확인
master
CJY 2021-07-15 11:00:58 +09:00
parent 90e22868d5
commit a0de66591a
4 changed files with 166 additions and 23 deletions

View File

@ -19,7 +19,7 @@ namespace ITC81DB_0H.Controls
public partial class ControlCenterConfiEthernet : UserControl
{
#region Field
private int m_ModeSTD2;
private static int ModeSTD2 = 4;
private FormMenu m_ParentForm;
public ControlConfiEthernetLocalIP ControlEthernetLocalIP;
@ -45,11 +45,6 @@ namespace ITC81DB_0H.Controls
get { return this.m_ParentForm; }
private set { this.m_ParentForm = value; }
}
public int ModeSTD2
{
get { return this.m_ModeSTD2; }
set { this.m_ModeSTD2 = value; }
}
#endregion
#region Method
@ -190,8 +185,6 @@ namespace ITC81DB_0H.Controls
this.Controls.Add(this.ControlMarkoprint);
this.ControlMarkoprint.Location = new Point(0, 217);
this.ModeSTD2 = 4;
if (this.ParentForm.ParentForm.SystemConfig2.IsEthernetEnable == true)
{
this.buttonStart.Enabled = true;
@ -436,7 +429,7 @@ namespace ITC81DB_0H.Controls
if (this.ParentForm.ParentForm.SystemConfig2.IsCommunicationOption == false)
{
if (this.ParentForm.ParentForm.SystemConfig2.EthernetCommMode == (int)DataStore.EthernetMode.f23_STD2)
this.comboBoxEthernetMode.SelectedIndex = this.ModeSTD2;
this.comboBoxEthernetMode.SelectedIndex = ModeSTD2;
else if (this.ParentForm.ParentForm.SystemConfig2.EthernetCommMode > this.comboBoxEthernetMode.Items.Count - 1)
{
this.comboBoxEthernetMode.SelectedIndex = 0;
@ -533,7 +526,8 @@ namespace ITC81DB_0H.Controls
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("2000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("3000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append("P");
sb.Append(Helper.StringZeroFillDigits6(Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append(" ");
sb.Append(string.Format("{0, 6}", Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append((char)0x03);
#endregion
break;
@ -542,6 +536,7 @@ namespace ITC81DB_0H.Controls
sb.Append((char)0x02);
sb.Append("01");
sb.Append("P");
sb.Append("0");
sb.Append(Helper.StringToDecimalPlaces("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces));
sb.Append((char)0x03);
#endregion
@ -843,6 +838,111 @@ namespace ITC81DB_0H.Controls
break;
case 16:
break;
case 17:
#region OPT3
string tempValue = "";
DateTime dt = DateTime.Now;
sb.Append((char)0x02);
sb.Append(string.Format(" {0:yyyyMMdd}", dt));
sb.Append(string.Format(" {0:HH:mm:ss}", dt));
sb.Append(" 12345");
sb.Append(" P");
sb.Append(string.Format("{0,9}", 123.4));
if (this.ParentForm.ParentForm.CurrentProductItem.LotNo.Length > 9)
sb.Append(this.ParentForm.ParentForm.CurrentProductItem.LotNo.Substring(0, 9));
else
sb.Append(this.ParentForm.ParentForm.CurrentProductItem.LotNo.PadLeft(9, ' '));
sb.Append((Helper.StringToDecimalPlaces(this.ParentForm.ParentForm.CurrentProductItem.OverRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)).PadLeft(9));
sb.Append((Helper.StringToDecimalPlaces(this.ParentForm.ParentForm.CurrentProductItem.UnderRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)).PadLeft(9));
sb.Append((Helper.StringToDecimalPlaces(this.ParentForm.ParentForm.CurrentProductItem.PassRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)).PadLeft(9));
sb.Append((char)0x03);
#endregion
break;
case 18:
#region HP-200
sb.Append((char)0x02);
sb.Append((char)0x4a);
sb.Append((char)0x30);
sb.Append((char)0x2c);
sb.Append(" 123.4");
sb.Append((char)0x0d);
sb.Append((char)0x04);
switch (temp)
{
case DataStore.MenuBottomConfiguration.SerialCOM1:
this.ParentForm.ParentForm.TransferSerialCOM1(sb.ToString());
break;
case DataStore.MenuBottomConfiguration.SerialCOM3:
this.ParentForm.ParentForm.TransferSerialCOM3(sb.ToString());
break;
case DataStore.MenuBottomConfiguration.SerialCOM4:
this.ParentForm.ParentForm.TransferSerialCOM4(sb.ToString());
break;
default:
break;
}
sb = new StringBuilder();
sb.Append((char)0x02);
sb.Append((char)0x5a);
sb.Append((char)0x04);
#endregion
break;
case 19:
#region Smart Jet
sb.Append((char)0x02);
sb.Append("A01");
sb.Append(" 12.34");
sb.Append((char)0x04);
#endregion
break;
case 20:
#region imaje 9410 OPT3
byteArray = new byte[12];
weightBytes = new byte[5];
// 외부변수사용 : 0xE8
byteArray[0] = 0xE8;
// Length : 0x00, 0x08 고정값
byteArray[1] = 0x00;
byteArray[2] = 0x08;
byteArray[3] = 0x01; // 1번 외부변수 번호
byteArray[4] = 0x00;
byteArray[5] = 0x05; // 1번 외부변수 길이
weightBytes = new UTF8Encoding().GetBytes(string.Format("{0,5}", Helper.StringToWeight("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
for (int i = 0; i < weightBytes.Length; i++)
{
byteArray[i + 6] = weightBytes[i];
}
byteArray[11] = 0x00;
byteArray[11] = Helper.ChecksumCalculator(byteArray);
#endregion
break;
case 23:
#region STD2
sb.Append((char)0x02);
sb.Append("IN001");
sb.Append("0001");
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("1000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("2000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("3000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append(string.Format("{0:0000000}", 11111));
sb.Append(string.Format("{0:0000000}", 22222));
sb.Append(string.Format("{0:0000000}", 33333));
sb.Append(string.Format("{0:0000000}", 11111));
sb.Append(string.Format("{0:000000000}", 77777));
sb.Append("P");
sb.Append(" ");
sb.Append(string.Format("{0, 6}", Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append((char)0x03);
#endregion
break;
default:
break;
}
@ -1140,7 +1240,6 @@ namespace ITC81DB_0H.Controls
this.comboBoxEthernetOpMode.SelectedIndex = 1;
}
if (this.comboBoxEthernetOpMode.SelectedIndex == 1)
{
this.ParentForm.ParentForm.EthernetClientDisconnect();
@ -1175,11 +1274,8 @@ namespace ITC81DB_0H.Controls
this.labelConnectedIP.Text = "-";
}
if (this.ParentForm.ParentForm.SystemConfig2.IsCommunicationOption == false)
{
if (this.comboBoxEthernetMode.SelectedIndex == this.ModeSTD2)
mode = (int)DataStore.SerialMode.f23_STD2;
}
if (this.ParentForm.ParentForm.SystemConfig2.IsCommunicationOption == false && mode == ModeSTD2)
mode = (int)DataStore.SerialMode.f23_STD2;
else
mode = this.comboBoxEthernetMode.SelectedIndex;
this.ParentForm.ParentForm.SystemConfig2.EthernetCommMode = mode;

View File

@ -337,6 +337,7 @@ namespace ITC81DB_0H.Controls
this.comboBoxSerialBaudRate.Enabled = true;
this.comboBoxSerialMode.Enabled = true;
this.ControlBarcode.Visible = false;
this.comboBoxSerialMode.Enabled = true;
switch (temp)
{
@ -356,7 +357,7 @@ namespace ITC81DB_0H.Controls
else if (item.SerialCOM1Mode > this.comboBoxSerialMode.Items.Count - 1)
this.comboBoxSerialMode.SelectedIndex = 0;
else
this.comboBoxSerialMode.SelectedIndex = this.ParentForm.ParentForm.SystemConfig1.SerialCOM1Mode;
this.comboBoxSerialMode.SelectedIndex = item.SerialCOM1Mode;
this.SaveComboBox(this.comboBoxSerialBaudRate.SelectedIndex, this.comboBoxSerialMode.SelectedIndex);
}
@ -364,7 +365,7 @@ namespace ITC81DB_0H.Controls
this.comboBoxSerialMode.SelectedIndex = item.SerialCOM1Mode;
this.comboBoxSerialMode.SelectedIndexChanged += new EventHandler(this.comboBoxSerialMode_SelectedIndexChanged);
this.labelTransmissionDelayTime.Text = this.ParentForm.ParentForm.SystemConfig1.TransmissionDelayTimeCOM1.ToString();
this.labelTransmissionDelayTime.Text = item.TransmissionDelayTimeCOM1.ToString();
#endregion
break;
case DataStore.MenuBottomConfiguration.SerialCOM3:
@ -416,7 +417,7 @@ namespace ITC81DB_0H.Controls
else if (item.SerialCOM3Mode > this.comboBoxSerialMode.Items.Count - 1)
this.comboBoxSerialMode.SelectedIndex = 0;
else
this.comboBoxSerialMode.SelectedIndex = this.ParentForm.ParentForm.SystemConfig1.SerialCOM3Mode;
this.comboBoxSerialMode.SelectedIndex = item.SerialCOM3Mode;
this.SaveComboBox(this.comboBoxSerialBaudRate.SelectedIndex, this.comboBoxSerialMode.SelectedIndex);
}
@ -444,7 +445,7 @@ namespace ITC81DB_0H.Controls
else if (item.SerialCOM4Mode > this.comboBoxSerialMode.Items.Count - 1)
this.comboBoxSerialMode.SelectedIndex = 0;
else
this.comboBoxSerialMode.SelectedIndex = this.ParentForm.ParentForm.SystemConfig1.SerialCOM4Mode;
this.comboBoxSerialMode.SelectedIndex = item.SerialCOM4Mode;
this.SaveComboBox(this.comboBoxSerialBaudRate.SelectedIndex, this.comboBoxSerialMode.SelectedIndex);
}
@ -452,7 +453,7 @@ namespace ITC81DB_0H.Controls
this.comboBoxSerialMode.SelectedIndex = item.SerialCOM4Mode;
this.comboBoxSerialMode.SelectedIndexChanged += new EventHandler(this.comboBoxSerialMode_SelectedIndexChanged);
this.labelTransmissionDelayTime.Text = this.ParentForm.ParentForm.SystemConfig1.TransmissionDelayTimeCOM4.ToString();
this.labelTransmissionDelayTime.Text = item.TransmissionDelayTimeCOM4.ToString();
#endregion
break;
default:
@ -725,7 +726,8 @@ namespace ITC81DB_0H.Controls
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("2000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("3000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append("P");
sb.Append(Helper.StringZeroFillDigits6(Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append(" ");
sb.Append(string.Format("{0, 6}", Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append((char)0x03);
#endregion
break;
@ -734,6 +736,7 @@ namespace ITC81DB_0H.Controls
sb.Append((char)0x02);
sb.Append("01");
sb.Append("P");
sb.Append("0");
sb.Append(Helper.StringToDecimalPlaces("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces));
sb.Append((char)0x03);
#endregion
@ -1089,6 +1092,50 @@ namespace ITC81DB_0H.Controls
sb.Append((char)0x04);
#endregion
break;
case 20:
#region imaje 9410 OPT3
byteArray = new byte[12];
weightBytes = new byte[5];
// 외부변수사용 : 0xE8
byteArray[0] = 0xE8;
// Length : 0x00, 0x08 고정값
byteArray[1] = 0x00;
byteArray[2] = 0x08;
byteArray[3] = 0x01; // 1번 외부변수 번호
byteArray[4] = 0x00;
byteArray[5] = 0x05; // 1번 외부변수 길이
weightBytes = new UTF8Encoding().GetBytes(" 123");
for (int i = 0; i < weightBytes.Length; i++)
{
byteArray[i + 6] = weightBytes[i];
}
byteArray[11] = 0x00;
byteArray[11] = Helper.ChecksumCalculator(byteArray);
#endregion
break;
case 23:
#region STD2
sb.Append((char)0x02);
sb.Append("IN001");
sb.Append("0001");
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("1000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("2000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("3000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append(string.Format("{0:0000000}", 11111));
sb.Append(string.Format("{0:0000000}", 22222));
sb.Append(string.Format("{0:0000000}", 33333));
sb.Append(string.Format("{0:0000000}", 11111));
sb.Append(string.Format("{0:000000000}", 77777));
sb.Append("P");
sb.Append(" ");
sb.Append(string.Format("{0, 6}", Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
sb.Append((char)0x03);
#endregion
break;
default:
isTest = false;
break;