From fcc3f2c9cc894a6d071ccd34cfb575790ff5c2b9 Mon Sep 17 00:00:00 2001 From: "DESKTOP-999R8N3\\CJY" Date: Fri, 7 Feb 2025 15:09:32 +0900 Subject: [PATCH] =?UTF-8?q?-=20OPT5=20=EC=B6=94=EA=B0=80(Count=20-=20Pass,?= =?UTF-8?q?=20NG,=20All=20=EC=B6=94=EA=B0=80=ED=95=9C=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=ED=86=A0=EC=BD=9C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- INT69DB_2A/Controls/ControlEquipmentTest.cs | 4 + INT69DB_2A/DataStore.cs | 2 + INT69DB_2A/Forms/FormCommunication.cs | 49 +++++ INT69DB_2A/Forms/FormInformation.cs | 2 +- INT69DB_2A/Forms/FormMain.cs | 207 ++++++++++++++++++++ INT69DB_2A/Forms/FormMainDisplay.cs | 14 +- INT69DB_2A/Version.txt | 6 + 7 files changed, 276 insertions(+), 8 deletions(-) diff --git a/INT69DB_2A/Controls/ControlEquipmentTest.cs b/INT69DB_2A/Controls/ControlEquipmentTest.cs index 3ad51aa..7829235 100644 --- a/INT69DB_2A/Controls/ControlEquipmentTest.cs +++ b/INT69DB_2A/Controls/ControlEquipmentTest.cs @@ -204,6 +204,10 @@ namespace INT69DB_2A.Controls this.labelCH3Mode.Text = "OPT3"; else if (item.Serial3Mode == 4) this.labelCH3Mode.Text = "Printer"; + else if (item.Serial3Mode == 5) + this.labelCH3Mode.Text = "OPT4"; + else if (item.Serial3Mode == 6) + this.labelCH3Mode.Text = "OPT5"; else this.labelCH3Mode.Text = "None"; } diff --git a/INT69DB_2A/DataStore.cs b/INT69DB_2A/DataStore.cs index 1073408..a55c6ae 100644 --- a/INT69DB_2A/DataStore.cs +++ b/INT69DB_2A/DataStore.cs @@ -346,6 +346,7 @@ namespace INT69DB_2A f3_OPT3, f4_Printer, f5_OPT4, + f6_OPT5, } public enum EthernetMode @@ -356,6 +357,7 @@ namespace INT69DB_2A f3_OPT3, f4_Modbus, f5_OPT4, + f6_OPT5, } public enum UserGroup diff --git a/INT69DB_2A/Forms/FormCommunication.cs b/INT69DB_2A/Forms/FormCommunication.cs index 801f544..f0b1879 100644 --- a/INT69DB_2A/Forms/FormCommunication.cs +++ b/INT69DB_2A/Forms/FormCommunication.cs @@ -122,6 +122,7 @@ namespace INT69DB_2A.Forms this.comboBoxMode.Items.Add("OPT3"); this.comboBoxMode.Items.Add("Modbus"); this.comboBoxMode.Items.Add("OPT4"); + this.comboBoxMode.Items.Add("OPT5"); this.comboBoxMode.SelectedIndex = 0; this.comboBoxMode.SelectedIndexChanged += new EventHandler(this.comboBoxMode_SelectedIndexChanged); @@ -142,6 +143,7 @@ namespace INT69DB_2A.Forms this.comboBoxSerial3Mode.Items.Add("OPT3"); this.comboBoxSerial3Mode.Items.Add("Printer"); this.comboBoxSerial3Mode.Items.Add("OPT4"); + this.comboBoxSerial3Mode.Items.Add("OPT5"); this.comboBoxSerial3Mode.SelectedIndex = 0; this.comboBoxSerial3Mode.SelectedIndexChanged += new EventHandler(this.comboBoxSerial3Mode_SelectedIndexChanged); } @@ -300,6 +302,13 @@ namespace INT69DB_2A.Forms else if (this.ParentForm.SystemConfig.EquipmentMode == 2) data = this.ParentForm.Protocol_OPT4(1, this.ParentForm.CollectionWeightData[0]); } + else if (this.ParentForm.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f6_OPT5) + { + if (this.ParentForm.SystemConfig.EquipmentMode == 1) + data = this.ParentForm.Protocol_OPT5(this.ParentForm.CollectionWeightData); + else if (this.ParentForm.SystemConfig.EquipmentMode == 2) + data = this.ParentForm.Protocol_OPT5(1, this.ParentForm.CollectionWeightData[0]); + } switch (this.ParentForm.SystemConfig.EthernetOperationMode) { @@ -358,6 +367,13 @@ namespace INT69DB_2A.Forms else if (this.ParentForm.SystemConfig.EquipmentMode == 2) data = this.ParentForm.Protocol_OPT4(1, this.ParentForm.CollectionWeightData[0]); } + else if (this.ParentForm.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f6_OPT5) + { + if (this.ParentForm.SystemConfig.EquipmentMode == 1) + data = this.ParentForm.Protocol_OPT5(this.ParentForm.CollectionWeightData); + else if (this.ParentForm.SystemConfig.EquipmentMode == 2) + data = this.ParentForm.Protocol_OPT5(1, this.ParentForm.CollectionWeightData[0]); + } switch (this.ParentForm.SystemConfig.EthernetOperationMode) { @@ -464,6 +480,19 @@ namespace INT69DB_2A.Forms this.labelProtocolDescriptionCOM3_2.Text = "LANE[2],GRD[1],WEIGHT[6],ETX[1]]"; } } + else if (this.comboBoxSerial3Mode.SelectedIndex == 6) + { + if (this.ParentForm.SystemConfig.EquipmentMode == 1 || this.ParentForm.SystemConfig.EquipmentMode == 3) + { + this.labelProtocolDescriptionCOM3_1.Text = "STX[1],ID[5],NO[4],Pass Count[7],NG Count[7],"; + this.labelProtocolDescriptionCOM3_2.Text = "Total Count[9],{GRD[1],WEIGHT[6]} * n,ETX[1]"; + } + else if (this.ParentForm.SystemConfig.EquipmentMode == 2) + { + this.labelProtocolDescriptionCOM3_1.Text = "STX[1],ID[5],NO[4],Pass Count[7],NG Count[7],"; + this.labelProtocolDescriptionCOM3_2.Text = "Total Count[9],LANE[2],GRD[1],WEIGHT[6],ETX[1]]"; + } + } else { if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese) @@ -537,6 +566,19 @@ namespace INT69DB_2A.Forms this.labelProtocolDescriptionEthernet_2.Text = "LANE[2],GRD[1],WEIGHT[6],ETX[1]]"; } } + else if (this.comboBoxMode.SelectedIndex == (int)DataStore.EthernetMode.f6_OPT5) + { + if (this.ParentForm.SystemConfig.EquipmentMode == 1 || this.ParentForm.SystemConfig.EquipmentMode == 3) + { + this.labelProtocolDescriptionEthernet_1.Text = "STX[1],ID[5],NO[4],Pass Count[7],NG Count[7],"; + this.labelProtocolDescriptionEthernet_2.Text = "Total Count[9],{GRD[1],WEIGHT[6]} * n,ETX[1]"; + } + else if (this.ParentForm.SystemConfig.EquipmentMode == 2) + { + this.labelProtocolDescriptionEthernet_1.Text = "STX[1],ID[5],NO[4],Pass Count[7],NG Count[7],"; + this.labelProtocolDescriptionEthernet_2.Text = "Total Count[9],LANE[2],GRD[1],WEIGHT[6],ETX[1]]"; + } + } else { if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese) @@ -1548,6 +1590,13 @@ namespace INT69DB_2A.Forms else if (this.ParentForm.SystemConfig.EquipmentMode == 2) this.ParentForm.UartCom3Write(this.ParentForm.Protocol_OPT4_NotStxEtx(1, this.ParentForm.CollectionWeightData[0])); } + else if (this.ParentForm.SystemConfig.Serial3Mode == (int)DataStore.SerialMode.f6_OPT5) + { + if (this.ParentForm.SystemConfig.EquipmentMode == 1 || this.ParentForm.SystemConfig.EquipmentMode == 3) + this.ParentForm.UartCom3Write(this.ParentForm.Protocol_OPT5_NotStxEtx(this.ParentForm.CollectionWeightData)); + else if (this.ParentForm.SystemConfig.EquipmentMode == 2) + this.ParentForm.UartCom3Write(this.ParentForm.Protocol_OPT5_NotStxEtx(1, this.ParentForm.CollectionWeightData[0])); + } } private void comboBoxSerial3BaudRate_SelectedIndexChanged(object sender, EventArgs e) diff --git a/INT69DB_2A/Forms/FormInformation.cs b/INT69DB_2A/Forms/FormInformation.cs index d98964d..359243b 100644 --- a/INT69DB_2A/Forms/FormInformation.cs +++ b/INT69DB_2A/Forms/FormInformation.cs @@ -109,7 +109,7 @@ namespace INT69DB_2A.Forms } private void DefaultSetting() { - this.labelDisplayVer.Text = "6.2.0"; + this.labelDisplayVer.Text = "6.3.0"; this.labelUserMgerVer.Text = ""; this.labelAes128Ver.Text = ""; this.labelSerialNo.Text = this.ParentForm.SystemConfig.SerialNumber; diff --git a/INT69DB_2A/Forms/FormMain.cs b/INT69DB_2A/Forms/FormMain.cs index 765f411..8ff7a43 100644 --- a/INT69DB_2A/Forms/FormMain.cs +++ b/INT69DB_2A/Forms/FormMain.cs @@ -43,6 +43,9 @@ namespace INT69DB_2A.Forms public string ComPortMainToLCD; // DllSerial Port public bool FlagDllSerial; // DllSerial 사용여부 private string TransferNum; // 수신데이터 ID저장 (재전송 시 사용) + public int TotalAllCount; // 스틱1 전체 수량 + public int TotalPassCount; // 스틱1 전체 Pass 수량 + public int TotalNGCount; // 스틱1 전체 NG 수량 // Motor Download 통신용 변수 public int LineNum; @@ -440,6 +443,9 @@ namespace INT69DB_2A.Forms this.ColorLogOff = Color.Red; this.ColorLogOn = Color.Yellow; this.TransferNum = "-"; + this.TotalAllCount = 0; + this.TotalNGCount = 0; + this.TotalPassCount = 0; this.PathLaunchFolder = "SD Card\\"; this.PathSystemFileFolder1 = this.PathLaunchFolder + "SystemFile1\\"; @@ -1497,6 +1503,187 @@ namespace INT69DB_2A.Forms return sb.ToString(); } + public string Protocol_OPT5(Collection datas) + { + string value = ""; + StringBuilder sb = new StringBuilder(); + + sb.Append((char)0x02); + sb.Append(string.Format("IN{0:D3}", this.SystemConfig.EquipmentID)); + sb.Append(string.Format("{0:D4}", this.SystemConfig.ProductNumber)); + + value = this.TotalPassCount.ToString(); + sb.Append(value.PadLeft(7, ' ')); + value = this.TotalNGCount.ToString(); + sb.Append(value.PadLeft(7, ' ')); + value = this.TotalAllCount.ToString(); + sb.Append(value.PadLeft(9, ' ')); + + if (this.SystemConfig.IsWeightViewForward == true) + { + for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++) + { + if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else + sb.Append("E"); + + value = Helper.DoubleToString(datas[i].Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + } + } + else + { + for (int i = 1; i <= this.SystemConfig.EquipmentColumns; i++) + { + if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else + sb.Append("E"); + + value = Helper.DoubleToString(datas[datas.Count - i].Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + } + } + sb.Append((char)0x03); + + return sb.ToString(); + } + public string Protocol_OPT5(int lane, WeightData data) + { + string value = ""; + StringBuilder sb = new StringBuilder(); + + sb.Append((char)0x02); + sb.Append(string.Format("IN{0:D3}", this.SystemConfig.EquipmentID)); + sb.Append(string.Format("{0:D4}", this.SystemConfig.ProductNumber)); + + value = this.TotalPassCount.ToString(); + sb.Append(value.PadLeft(7, ' ')); + value = this.TotalNGCount.ToString(); + sb.Append(value.PadLeft(7, ' ')); + value = this.TotalAllCount.ToString(); + sb.Append(value.PadLeft(9, ' ')); + sb.Append(string.Format("{0:D2}", lane)); + + if (data.JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (data.JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (data.JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else if (data.JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else + sb.Append("E"); + + value = Helper.DoubleToString(data.Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + sb.Append((char)0x03); + + return sb.ToString(); + } + public string Protocol_OPT5_NotStxEtx(Collection datas) + { + string value = ""; + StringBuilder sb = new StringBuilder(); + + sb.Append(string.Format("IN{0:D3}", this.SystemConfig.EquipmentID)); + sb.Append(string.Format("{0:D4}", this.SystemConfig.ProductNumber)); + + value = this.TotalPassCount.ToString(); + sb.Append(value.PadLeft(7, ' ')); + value = this.TotalNGCount.ToString(); + sb.Append(value.PadLeft(7, ' ')); + value = this.TotalAllCount.ToString(); + sb.Append(value.PadLeft(9, ' ')); + + if (this.SystemConfig.IsWeightViewForward == true) + { + for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++) + { + if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else + sb.Append("E"); + + value = Helper.DoubleToString(datas[i].Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + } + } + else + { + for (int i = 1; i <= this.SystemConfig.EquipmentColumns; i++) + { + if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else + sb.Append("E"); + + value = Helper.DoubleToString(datas[datas.Count - i].Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + } + } + + return sb.ToString(); + } + public string Protocol_OPT5_NotStxEtx(int lane, WeightData data) + { + string value = ""; + StringBuilder sb = new StringBuilder(); + + sb.Append(string.Format("IN{0:D3}", this.SystemConfig.EquipmentID)); + sb.Append(string.Format("{0:D4}", this.SystemConfig.ProductNumber)); + + value = this.TotalPassCount.ToString(); + sb.Append(value.PadLeft(7, ' ')); + value = this.TotalNGCount.ToString(); + sb.Append(value.PadLeft(7, ' ')); + value = this.TotalAllCount.ToString(); + sb.Append(value.PadLeft(9, ' ')); + sb.Append(string.Format("{0:D2}", lane)); + + if (data.JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (data.JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (data.JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else if (data.JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else + sb.Append("E"); + + value = Helper.DoubleToString(data.Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + + return sb.ToString(); + } + public byte[] Protocol_Modbus_Client_Write_Common_Data() { int index = 0; @@ -2968,6 +3155,9 @@ namespace INT69DB_2A.Forms case 5: this.UartCom3Write(this.Protocol_OPT4_NotStxEtx(datas)); break; + case 6: + this.UartCom3Write(this.Protocol_OPT5_NotStxEtx(datas)); + break; default: break; } @@ -2988,6 +3178,9 @@ namespace INT69DB_2A.Forms case 5: this.SendEthernetData(this.Protocol_OPT4_NotStxEtx(datas)); break; + case 6: + this.SendEthernetData(this.Protocol_OPT5_NotStxEtx(datas)); + break; default: break; } @@ -3119,6 +3312,8 @@ namespace INT69DB_2A.Forms } else if (this.SystemConfig.Serial3Mode == 5) // OPT4 this.UartCom3Write(this.Protocol_OPT4_NotStxEtx(this.CollectionWeightData)); + else if (this.SystemConfig.Serial3Mode == 6) // OPT5 + this.UartCom3Write(this.Protocol_OPT5_NotStxEtx(this.CollectionWeightData)); } private void TreatSerialCommunication(int lane, WeightData data) { @@ -3139,6 +3334,8 @@ namespace INT69DB_2A.Forms } else if (this.SystemConfig.Serial3Mode == 5) // OPT4 this.UartCom3Write(this.Protocol_OPT4_NotStxEtx(lane, data)); + else if (this.SystemConfig.Serial3Mode == 6) // OPT5 + this.UartCom3Write(this.Protocol_OPT5_NotStxEtx(lane, data)); } #endregion #region Ethernet @@ -3181,6 +3378,11 @@ namespace INT69DB_2A.Forms sendData = this.Protocol_OPT4(this.CollectionWeightData); this.SendEthernetData(sendData); } + else if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f6_OPT5) + { + sendData = this.Protocol_OPT5(this.CollectionWeightData); + this.SendEthernetData(sendData); + } } private void TreatEthernetCommunication(int lane, WeightData data) { @@ -3218,6 +3420,11 @@ namespace INT69DB_2A.Forms sendData = this.Protocol_OPT4(lane, data); this.SendEthernetData(sendData); } + else if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f6_OPT5) + { + sendData = this.Protocol_OPT5(lane, data); + this.SendEthernetData(sendData); + } } private void SendEthernetData(string etherData) { diff --git a/INT69DB_2A/Forms/FormMainDisplay.cs b/INT69DB_2A/Forms/FormMainDisplay.cs index 408588c..a413023 100644 --- a/INT69DB_2A/Forms/FormMainDisplay.cs +++ b/INT69DB_2A/Forms/FormMainDisplay.cs @@ -1353,14 +1353,14 @@ namespace INT69DB_2A.Forms public void SetTotalCount() { string totalCNT = "", ngCNT = ""; - int totalAll = 0, totalPass = 0, totalNG = 0, totalUnder = 0, totalOver = 0, totalExNG = 0; + int totalUnder = 0, totalOver = 0, totalExNG = 0; for (int i = 0; i < this.ParentForm.SystemConfig.EquipmentColumns; i++) { - totalAll += this.ParentForm.CollectionWeightData[i].TotalCount; - totalPass += this.ParentForm.CollectionWeightData[i].PassCount; + this.ParentForm.TotalAllCount += this.ParentForm.CollectionWeightData[i].TotalCount; + this.ParentForm.TotalPassCount += this.ParentForm.CollectionWeightData[i].PassCount; - totalNG += this.ParentForm.CollectionWeightData[i].TotalNGCount; + this.ParentForm.TotalNGCount += this.ParentForm.CollectionWeightData[i].TotalNGCount; totalUnder += this.ParentForm.CollectionWeightData[i].UnderCount; totalOver += this.ParentForm.CollectionWeightData[i].OverCount; totalExNG += this.ParentForm.CollectionWeightData[i].ExNGCount; @@ -1370,10 +1370,10 @@ namespace INT69DB_2A.Forms switch (this.Mode_TotalCnt) { case DataStore.E_TotalCnt.f0_Total: - totalCNT = totalAll.ToString(); + totalCNT = this.ParentForm.TotalAllCount.ToString(); break; case DataStore.E_TotalCnt.f1_Pass: - totalCNT = totalPass.ToString(); + totalCNT = this.ParentForm.TotalPassCount.ToString(); break; default: break; @@ -1386,7 +1386,7 @@ namespace INT69DB_2A.Forms switch (this.Mode_TotalCntNG) { case DataStore.E_TotalCntNG.f0_NG: - ngCNT = totalNG.ToString(); + ngCNT = this.ParentForm.TotalNGCount.ToString(); break; case DataStore.E_TotalCntNG.f1_Under: ngCNT = totalUnder.ToString(); diff --git a/INT69DB_2A/Version.txt b/INT69DB_2A/Version.txt index 42429d1..38e9b9b 100644 --- a/INT69DB_2A/Version.txt +++ b/INT69DB_2A/Version.txt @@ -15,6 +15,12 @@ Ƽ 2~6 ƽ 跮 */ +@ Ver 6.3.0 by CJY + - 2025.02.07 + - Ver 6.2.0 Modify + - Framework : SmartX Framework V3.2.4(update: 2021.01.20) + - OPT5 ߰ + @ Ver 6.2.0 by CJY - 2025.01.08 - Ver 6.1.1 Modify