diff --git a/ITC81DB_0H/Controls/CenterConfiguration/ControlCenterConfiEthernet.cs b/ITC81DB_0H/Controls/CenterConfiguration/ControlCenterConfiEthernet.cs index bf9b660..54e2946 100644 --- a/ITC81DB_0H/Controls/CenterConfiguration/ControlCenterConfiEthernet.cs +++ b/ITC81DB_0H/Controls/CenterConfiguration/ControlCenterConfiEthernet.cs @@ -641,7 +641,9 @@ namespace ITC81DB_0H.Controls #region Printer sb.Append("0001"); sb.Append(" Pass"); - sb.Append(" " + Helper.StringToDecimalPlaces("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)); + sb.Append(this.ParentForm.ParentForm.PadLeft(9, Helper.DoubleToString + (this.ParentForm.ParentForm.CurrentWeightData.Weight, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces))); + sb.Append(" "); sb.Append("1234567890"); #endregion break; @@ -1020,6 +1022,19 @@ namespace ITC81DB_0H.Controls byteArray[11] = Helper.ChecksumCalculator(byteArray); #endregion break; + case (int)Define.E_CommMode.f22_Modbus: + #region Modbus TCP(16. Write Multiple Registers) + if (this.ParentForm.ParentForm.SystemConfig3.IsModbus == true) + { + if (this.ParentForm.ParentForm.SystemConfig2.ModbusTCPSelectFunction == (int)Define.E_ModbusFunction._16_WriteMultipleRegister) + { + byte[] sendData = this.ParentForm.ParentForm.Modbus.MakeTCPSendAllData(this.ParentForm.ParentForm.Transfer_22_Modbus_Write(), this.ParentForm.ParentForm.SystemConfig2.ModbusTCPStartAddress); + + this.ParentForm.ParentForm.EthernetWeightDataForModbus(sendData); + } + } + #endregion + break; case 23: #region STD2 sb.Append((char)0x02); diff --git a/ITC81DB_0H/Controls/CenterConfiguration/ControlCenterConfiSerial.cs b/ITC81DB_0H/Controls/CenterConfiguration/ControlCenterConfiSerial.cs index 73bbc3c..1ad0403 100644 --- a/ITC81DB_0H/Controls/CenterConfiguration/ControlCenterConfiSerial.cs +++ b/ITC81DB_0H/Controls/CenterConfiguration/ControlCenterConfiSerial.cs @@ -1038,7 +1038,9 @@ namespace ITC81DB_0H.Controls #region Printer sb.Append("0001"); sb.Append(" Pass"); - sb.Append(" " + Helper.StringToDecimalPlaces("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)); + sb.Append(this.ParentForm.ParentForm.PadLeft(9, Helper.DoubleToString + (this.ParentForm.ParentForm.CurrentWeightData.Weight, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces))); + sb.Append(" "); sb.Append("1234567890"); #endregion break; diff --git a/ITC81DB_0H/Datastore/DataStore.cs b/ITC81DB_0H/Datastore/DataStore.cs index 514847b..8d9bc47 100644 --- a/ITC81DB_0H/Datastore/DataStore.cs +++ b/ITC81DB_0H/Datastore/DataStore.cs @@ -2829,6 +2829,7 @@ namespace ITC81DB_0H public class SystemConfigurationItem3 { #region Field + private bool m_IsModbus; private bool m_IsPart11; private int m_MULTiJETSlaveAddressCOM1; @@ -2847,6 +2848,11 @@ namespace ITC81DB_0H #endregion #region Property + public bool IsModbus + { + get { return this.m_IsModbus; } + set { this.m_IsModbus = value; } + } public bool IsPart11 { get { return this.m_IsPart11; } @@ -2884,6 +2890,7 @@ namespace ITC81DB_0H #region Method public void Initialization() { + this.IsModbus = false; this.IsPart11 = false; this.MULTiJETSlaveAddressCOM1 = 58; @@ -2928,7 +2935,7 @@ namespace ITC81DB_0H public bool DummyBool26; public bool DummyBool27; public bool DummyBool28; - public bool DummyBool29; + public bool IsModbus; public bool IsPart11; public int DummyInt1; diff --git a/ITC81DB_0H/Forms/FormMain.cs b/ITC81DB_0H/Forms/FormMain.cs index 453bf6a..ffcbe0e 100644 --- a/ITC81DB_0H/Forms/FormMain.cs +++ b/ITC81DB_0H/Forms/FormMain.cs @@ -25,8 +25,8 @@ namespace ITC81DB_0H.Forms public partial class FormMain : Form { #region Field - public static string DisplayVersion = "3.3.0"; - public static string ReleaseDate = "2024.02.01"; + public static string DisplayVersion = "3.3.1"; + public static string ReleaseDate = "2024.02.07"; private SmartSplash SmartSplashProgramLoad; public bool IsCommunicationLogOpen; @@ -55,7 +55,7 @@ namespace ITC81DB_0H.Forms // 재전송 기능 public int MissingCommIDCount; public int CommID; - public bool FlagSerialDll = true; + public bool FlagSerialDll = false; private string ComPortMainToLCD; private Queue QueueCommunicationRecive; // 큐 통신 데이터용 private int FlagComRetry3th; // 3회 재전송 횟수 @@ -65,7 +65,6 @@ namespace ITC81DB_0H.Forms private byte[] ClientSendDatabyteArray; private string ClientSendDataString; - #region 통신관련 // OPT2 private SerialOPT2 CurrentOPT2COM1; @@ -95,6 +94,9 @@ namespace ITC81DB_0H.Forms // OPC private static int TotalBytes = 48; // 전체 bytes + + // OPC + private static int ModbusTotalBytes = 80; // 전체 bytes #endregion // 로그온 색상 @@ -203,9 +205,6 @@ namespace ITC81DB_0H.Forms private int HMCOM4_Step; private int HMEthernet_Step; - // OPC - private static int ModbusTotalBytes = 80; // 전체 bytes - // Ethernet private bool IsEthernetThreadStop; private bool IsEthernetTransferData; @@ -2052,6 +2051,9 @@ namespace ITC81DB_0H.Forms } catch { + // 로그 + if (this.IsCommunicationLogOpen == true) + this.smartFileCommunicationLog.WriteString(string.Format("Receive ({0:yyyy-MM-dd HH:mm:ss}): {1} : Receive Command Data CHKSUM Error", DateTime.Now, strTemp)); } } @@ -3108,963 +3110,970 @@ namespace ITC81DB_0H.Forms //// 통신 제대로 받으면 ACK //this.TransferData(string.Format("{0}{1}{2}{3}", CommunicationCommand.RunWeightData, (int)Define.E_ResponseData.ACK, dataID, transferCount), CommunicationID.MainBoard); - if (this.CommID % 10 != int.Parse(transactionID)) + + if (this.FlagSerialDll == true) { - this.MissingCommIDCount++; - this.ChildFormMainDisplay.labelMissingCount.Text = this.MissingCommIDCount.ToString(); + if (this.CommID % 10 != int.Parse(transactionID)) + { + this.MissingCommIDCount++; + this.ChildFormMainDisplay.labelMissingCount.Text = this.MissingCommIDCount.ToString(); + } + else + this.CommID++; + + if (this.CurrentComRespone.TransactionID != transactionID) + { + this.CurrentComRespone.TransactionID = transactionID; + this.CurrentComRespone.TransferCount = transferCount; + } + else + return -1; } - else - this.CommID++; - - if (this.CurrentComRespone.TransactionID != transactionID) - { - this.CurrentComRespone.TransactionID = transactionID; - this.CurrentComRespone.TransferCount = transferCount; - - if (this.CurrentWeightData.WeightString.Trim() == "-9999" || this.CurrentWeightData.WeightString.Trim() == "9999" - || this.CurrentWeightData.WeightString.Trim() == "99999") - if (this.IsErrorLogOpen == true) - this.smartFileCheckLog.WriteString(string.Format("Check ({0:yyyy-MM-dd HH:mm:ss}): {1},{2},{3}", DateTime.Now, receiveData, this.CurrentProductItem.UnderRange, this.CurrentProductItem.OverRange)); + if (this.CurrentWeightData.WeightString.Trim() == "-9999" || this.CurrentWeightData.WeightString.Trim() == "9999" + || this.CurrentWeightData.WeightString.Trim() == "99999") if (this.IsErrorLogOpen == true) - this.ChecklogPrint(receiveData, this.CurrentWeightData); + this.smartFileCheckLog.WriteString(string.Format("Check ({0:yyyy-MM-dd HH:mm:ss}): {1},{2},{3}", DateTime.Now, receiveData, this.CurrentProductItem.UnderRange, this.CurrentProductItem.OverRange)); - // V6.2.0 - if (this.OverloadWeight <= this.CurrentWeightData.Weight) - { - this.CurrentWeightData.WeightString = this.CurrentCalibrationItem.OverloadWeightString; - this.CurrentWeightData.Weight = this.OverloadWeight; - } + if (this.IsErrorLogOpen == true) + this.ChecklogPrint(receiveData, this.CurrentWeightData); - #region 통신 - // 통신 COM1 - if (this.SystemConfig1.SerialCOM1Mode != 0) - { - #region COM1 - switch (this.SystemConfig1.SerialCOM1Mode) - { - case 1: - this.TransferSerialCOM1(this.Transfer_1_STD1(this.SystemConfig1, this.CurrentWeightData, this.CurrentProductItem)); - break; - case 2: - this.TransferSerialCOM1(this.Transfer_2_Remote(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 3: - if (this.SystemConfig1.IsPrintPerProductEnable == true) - this.TransferSerialCOM1(this.Transfer_3_Print(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 4: - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) - { - this.TransferSerialCOM1(this.RoomChange9410(2)); // 2번방 변경 - Thread.Sleep(200); - this.TransferSerialCOM1(this.SendChar(Define.E_CharValue.ACK)); // ACK - Thread.Sleep(200); - this.TransferSerialCOM1(this.WeightData9410_OPT1(this.CurrentWeightData)); // 중량값 전송 - } - else - { - this.TransferSerialCOM1(this.RoomChange9410(1)); // 1번방 변경 - Thread.Sleep(200); - this.TransferSerialCOM1(this.SendChar(Define.E_CharValue.ACK)); // ACK - } - break; - case 5: - this.HMCOM1_Step = 1; - this.TransferSerialCOM1(this.SendChar(Define.E_CharValue.ENQ)); - break; - case 6: - this.TransferSerialCOM1(this.Transfer_6_OPT0(this.CurrentWeightData)); - break; - case 7: - this.TransferSerialCOM1(this.Transfer_7_imaje9410OPT2(this.CurrentWeightData)); - break; - case 8: - this.TransferSerialCOM1(this.Transfer_8_imaje9028OPT2(this.CurrentWeightData)); - break; - case 9: - this.TransferSerialCOM1(this.Transfer_9_Hitachi(this.CurrentWeightData, Define.E_SerialCOM.COM1)); - break; - case 10: - this.TransferSerialCOM1(this.Transfer_10_MACSA(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 11: - this.TransferSerialCOM1(this.Transfer_11_Markoprint(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 12: - this.TransferSerialCOM1(this.Transfer_12_alphaJET(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 13: - this.TransferSerialCOM1(this.Transfer_13_Marking_VJ1510(this.CurrentWeightData)); - break; - case 17: - this.TransferSerialCOM1(this.Transfer_17_OPT3(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 18: - this.TransferSerialCOM1(this.Transfer_18_HP200(this.CurrentWeightData, 1)); - this.TransferSerialCOM1(this.Transfer_18_HP200(this.CurrentWeightData, 2)); - break; - case 19: - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) - this.TransferSerialCOM1(this.Transfer_19_SmartJet(this.CurrentWeightData)); - break; - case 20: - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) - { - this.TransferSerialCOM1(this.RoomChange9410(2)); // 2번방 변경 - Thread.Sleep(200); - this.TransferSerialCOM1(this.SendChar(Define.E_CharValue.ACK)); // ACK - Thread.Sleep(200); - this.TransferSerialCOM1(this.WeightData9410_OPT3(this.CurrentWeightData)); // 중량값 전송 - } - else - { - this.TransferSerialCOM1(this.RoomChange9410(1)); // 1번방 변경 - Thread.Sleep(200); - this.TransferSerialCOM1(this.SendChar(Define.E_CharValue.ACK)); // ACK - } - break; - case (int)Define.E_CommMode.f22_Modbus: // Modbus RTU(Master 사용 시 - Write multiple register) - if (this.SystemConfig2.ModbusRTUSelectFunction == (int)Define.E_ModbusFunction._16_WriteMultipleRegister) - { - byte[] sendData = this.Modbus.MakeRTUSendAllData(this.Transfer_22_Modbus_Write(), this.SystemConfig2.ModbusSlaveIDCOM1, this.SystemConfig2.ModbusRTUStartAddressCOM1); + // V6.2.0 + if (this.OverloadWeight <= this.CurrentWeightData.Weight) + { + this.CurrentWeightData.WeightString = this.CurrentCalibrationItem.OverloadWeightString; + this.CurrentWeightData.Weight = this.OverloadWeight; + } - this.TransferSerialCOM1(sendData); - } - break; - case (int)Define.E_CommMode.f23_STD2: - this.TransferSerialCOM1(this.Transfer_23_STD2(this.SystemConfig1, this.CurrentWeightData, this.CurrentProductItem)); - break; - case (int)Define.E_CommMode.f24_MULTi_JET: - this.TransferSerialCOM1(this.Transfer_24_MULTi_JET(false, this.CurrentWeightData)); - break; - case (int)Define.E_CommMode.f26_LINX8830: - this.TransferSerialCOM1(this.Transfer_26_LINX8830(false, this.CurrentWeightData)); - break; - case (int)Define.E_CommMode.f27_MYJET: - this.TransferSerialCOM1(this.Transfer_27_MYJET(false, this.CurrentWeightData)); - break; - case (int)Define.E_CommMode.f28_OPT4: // Tasco(타스코) PC 전송 - this.TransferSerialCOM1(this.Transfer_28_OPT4(false, this.CurrentWeightData)); - break; - default: - break; - } - #endregion - } - // 통신 COM3 - if (this.SystemConfig1.SerialCOM3Mode != 0) - { - #region COM3 - switch (this.SystemConfig1.SerialCOM3Mode) - { - case 1: - this.TransferSerialCOM3(this.Transfer_1_STD1(this.SystemConfig1, this.CurrentWeightData, this.CurrentProductItem)); - break; - case 2: - this.TransferSerialCOM3(this.Transfer_2_Remote(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 3: - if (this.SystemConfig1.IsPrintPerProductEnable == true) - this.TransferSerialCOM3(this.Transfer_3_Print(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 4: - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) - { - this.TransferSerialCOM3(this.RoomChange9410(2)); // 2번방 변경 - Thread.Sleep(200); - this.TransferSerialCOM3(this.SendChar(Define.E_CharValue.ACK)); // ACK - Thread.Sleep(200); - this.TransferSerialCOM3(this.WeightData9410_OPT1(this.CurrentWeightData)); // 중량값 전송 - } - else - { - this.TransferSerialCOM3(this.RoomChange9410(1)); // 1번방 변경 - Thread.Sleep(200); - this.TransferSerialCOM3(this.SendChar(Define.E_CharValue.ACK)); // ACK - } - break; - case 5: - this.HMCOM3_Step = 1; - this.TransferSerialCOM3(this.SendChar(Define.E_CharValue.ENQ)); - break; - case 6: - this.TransferSerialCOM3(this.Transfer_6_OPT0(this.CurrentWeightData)); - break; - case 7: - this.TransferSerialCOM3(this.Transfer_7_imaje9410OPT2(this.CurrentWeightData)); - break; - case 8: - this.TransferSerialCOM3(this.Transfer_8_imaje9028OPT2(this.CurrentWeightData)); - break; - case 9: - this.TransferSerialCOM3(this.Transfer_9_Hitachi(this.CurrentWeightData, Define.E_SerialCOM.COM3)); - break; - case 10: - this.TransferSerialCOM3(this.Transfer_10_MACSA(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 11: - this.TransferSerialCOM3(this.Transfer_11_Markoprint(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 12: - this.TransferSerialCOM3(this.Transfer_12_alphaJET(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 13: - this.TransferSerialCOM3(this.Transfer_13_Marking_VJ1510(this.CurrentWeightData)); - break; - case 17: - this.TransferSerialCOM3(this.Transfer_17_OPT3(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 18: - this.TransferSerialCOM3(this.Transfer_18_HP200(this.CurrentWeightData, 1)); - this.TransferSerialCOM3(this.Transfer_18_HP200(this.CurrentWeightData, 2)); - break; - case 19: - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) - this.TransferSerialCOM3(this.Transfer_19_SmartJet(this.CurrentWeightData)); - break; - case 20: - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) - { - this.TransferSerialCOM3(this.RoomChange9410(2)); // 2번방 변경 - Thread.Sleep(200); - this.TransferSerialCOM3(this.SendChar(Define.E_CharValue.ACK)); // ACK - Thread.Sleep(200); - this.TransferSerialCOM3(this.WeightData9410_OPT3(this.CurrentWeightData)); // 중량값 전송 - } - else - { - this.TransferSerialCOM3(this.RoomChange9410(1)); // 1번방 변경 - Thread.Sleep(200); - this.TransferSerialCOM3(this.SendChar(Define.E_CharValue.ACK)); // ACK - } - break; - case (int)Define.E_CommMode.f22_Modbus: // Modbus RTU(Master 사용 시 - Write multiple register) - if (this.SystemConfig2.ModbusRTUSelectFunction == (int)Define.E_ModbusFunction._16_WriteMultipleRegister) - { - byte[] sendData = this.Modbus.MakeRTUSendAllData(this.Transfer_22_Modbus_Write(), this.SystemConfig2.ModbusSlaveIDCOM3, this.SystemConfig2.ModbusRTUStartAddressCOM3); - - this.TransferSerialCOM3(sendData); - } - break; - case (int)Define.E_CommMode.f23_STD2: - this.TransferSerialCOM3(this.Transfer_23_STD2(this.SystemConfig1, this.CurrentWeightData, this.CurrentProductItem)); - break; - case (int)Define.E_CommMode.f24_MULTi_JET: - this.TransferSerialCOM3(this.Transfer_24_MULTi_JET(false, this.CurrentWeightData)); - break; - case (int)Define.E_CommMode.f26_LINX8830: - this.TransferSerialCOM3(this.Transfer_26_LINX8830(false, this.CurrentWeightData)); - break; - case (int)Define.E_CommMode.f27_MYJET: - this.TransferSerialCOM3(this.Transfer_27_MYJET(false, this.CurrentWeightData)); - break; - case (int)Define.E_CommMode.f28_OPT4: // Tasco(타스코) PC 전송 - this.TransferSerialCOM3(this.Transfer_28_OPT4(false, this.CurrentWeightData)); - break; - default: - break; - } - #endregion - } - // 통신 COM4 - if (this.SystemConfig1.SerialCOM4Mode != 0) - { - #region COM4 - switch (this.SystemConfig1.SerialCOM4Mode) - { - case 1: - this.TransferSerialCOM4(this.Transfer_1_STD1(this.SystemConfig1, this.CurrentWeightData, this.CurrentProductItem)); - break; - case 2: - this.TransferSerialCOM4(this.Transfer_2_Remote(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 3: - if (this.SystemConfig1.IsPrintPerProductEnable == true) - this.TransferSerialCOM4(this.Transfer_3_Print(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 4: - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) - { - this.TransferSerialCOM4(this.RoomChange9410(2)); // 2번방 변경 - Thread.Sleep(200); - this.TransferSerialCOM4(this.SendChar(Define.E_CharValue.ACK)); // ACK - Thread.Sleep(200); - this.TransferSerialCOM4(this.WeightData9410_OPT1(this.CurrentWeightData)); // 중량값 전송 - } - else - { - this.TransferSerialCOM4(this.RoomChange9410(1)); // 1번방 변경 - Thread.Sleep(200); - this.TransferSerialCOM4(this.SendChar(Define.E_CharValue.ACK)); // ACK - } - break; - case 5: - this.HMCOM4_Step = 1; - this.TransferSerialCOM4(this.SendChar(Define.E_CharValue.ENQ)); - break; - case 6: - this.TransferSerialCOM4(this.Transfer_6_OPT0(this.CurrentWeightData)); - break; - case 7: - this.TransferSerialCOM4(this.Transfer_7_imaje9410OPT2(this.CurrentWeightData)); - break; - case 8: - this.TransferSerialCOM4(this.Transfer_8_imaje9028OPT2(this.CurrentWeightData)); - break; - case 9: - this.TransferSerialCOM4(this.Transfer_9_Hitachi(this.CurrentWeightData, Define.E_SerialCOM.COM4)); - break; - case 10: - this.TransferSerialCOM4(this.Transfer_10_MACSA(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 11: - this.TransferSerialCOM4(this.Transfer_11_Markoprint(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 12: - this.TransferSerialCOM4(this.Transfer_12_alphaJET(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 13: - this.TransferSerialCOM4(this.Transfer_13_Marking_VJ1510(this.CurrentWeightData)); - break; - case 17: - this.TransferSerialCOM4(this.Transfer_17_OPT3(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 18: - this.TransferSerialCOM4(this.Transfer_18_HP200(this.CurrentWeightData, 1)); - this.TransferSerialCOM4(this.Transfer_18_HP200(this.CurrentWeightData, 2)); - break; - case 19: - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) - this.TransferSerialCOM4(this.Transfer_19_SmartJet(this.CurrentWeightData)); - break; - case 20: - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) - { - this.TransferSerialCOM4(this.RoomChange9410(2)); // 2번방 변경 - Thread.Sleep(200); - this.TransferSerialCOM4(this.SendChar(Define.E_CharValue.ACK)); // ACK - Thread.Sleep(200); - this.TransferSerialCOM4(this.WeightData9410_OPT3(this.CurrentWeightData)); // 중량값 전송 - } - else - { - this.TransferSerialCOM4(this.RoomChange9410(1)); // 1번방 변경 - Thread.Sleep(200); - this.TransferSerialCOM4(this.SendChar(Define.E_CharValue.ACK)); // ACK - } - break; - case (int)Define.E_CommMode.f22_Modbus: // Modbus RTU(Master 사용 시 - Write multiple register) - if (this.SystemConfig2.ModbusRTUSelectFunction == (int)Define.E_ModbusFunction._16_WriteMultipleRegister) - { - byte[] sendData = this.Modbus.MakeRTUSendAllData(this.Transfer_22_Modbus_Write(), this.SystemConfig2.ModbusSlaveIDCOM4, this.SystemConfig2.ModbusRTUStartAddressCOM4); - - this.TransferSerialCOM4(sendData); - } - break; - case (int)Define.E_CommMode.f23_STD2: - this.TransferSerialCOM4(this.Transfer_23_STD2(this.SystemConfig1, this.CurrentWeightData, this.CurrentProductItem)); - break; - case (int)Define.E_CommMode.f24_MULTi_JET: - this.TransferSerialCOM4(this.Transfer_24_MULTi_JET(false, this.CurrentWeightData)); - break; - case (int)Define.E_CommMode.f26_LINX8830: - this.TransferSerialCOM4(this.Transfer_26_LINX8830(false, this.CurrentWeightData)); - break; - case (int)Define.E_CommMode.f27_MYJET: - this.TransferSerialCOM4(this.Transfer_27_MYJET(false, this.CurrentWeightData)); - break; - case (int)Define.E_CommMode.f28_OPT4: // Tasco(타스코) PC 전송 - this.TransferSerialCOM4(this.Transfer_28_OPT4(false, this.CurrentWeightData)); - break; - default: - break; - } - #endregion - } - - // 이더넷 - switch (this.SystemConfig2.EthernetOperationMode) + #region 통신 + // 통신 COM1 + if (this.SystemConfig1.SerialCOM1Mode != 0) + { + #region COM1 + switch (this.SystemConfig1.SerialCOM1Mode) { case 1: - if (this.smartTCPMultiServer.ClientInfoList != null) - { - if (this.SystemConfig2.EthernetCommMode != 0) - { - foreach (SmartTCPMultiServer.CLIENTSINFOS client in this.smartTCPMultiServer.ClientInfoList) - { - #region Server - switch (this.SystemConfig2.EthernetCommMode) - { - case 1: - this.EthernetServerSendMessage(client, - this.Transfer_1_STD1(this.SystemConfig1, this.CurrentWeightData, this.CurrentProductItem)); - break; - case 2: - this.EthernetServerSendMessage(client, this.Transfer_2_Remote(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 3: - if (this.SystemConfig1.IsPrintPerProductEnable == true) - this.EthernetServerSendMessage(client, this.Transfer_3_Print(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 4: - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) - { - this.EthernetServerSendMessage(client, this.RoomChange9410(2)); // 2번방 변경 - Thread.Sleep(200); - this.EthernetServerSendMessage(client, this.SendChar(Define.E_CharValue.ACK)); // ACK - Thread.Sleep(200); - this.EthernetServerSendMessage(client, this.WeightData9410_OPT1(this.CurrentWeightData)); // 중량값 전송 - } - else - { - this.EthernetServerSendMessage(client, this.RoomChange9410(1)); // 1번방 변경 - Thread.Sleep(200); - this.EthernetServerSendMessage(client, this.SendChar(Define.E_CharValue.ACK)); // ACK - } - break; - case 5: - this.HMCOM1_Step = 1; - this.EthernetServerSendMessage(client, this.SendChar(Define.E_CharValue.ENQ)); - break; - case 6: - this.EthernetServerSendMessage(client, this.Transfer_6_OPT0(this.CurrentWeightData)); - break; - case 7: - this.EthernetServerSendMessage(client, this.Transfer_7_imaje9410OPT2(this.CurrentWeightData)); - break; - case 8: - this.EthernetServerSendMessage(client, this.Transfer_8_imaje9028OPT2(this.CurrentWeightData)); - break; - case 9: - this.EthernetServerSendMessage(client, this.Transfer_9_Hitachi(this.CurrentWeightData, Define.E_SerialCOM.COM1)); - break; - case 10: - this.EthernetServerSendMessage(client, this.Transfer_10_MACSA(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 11: - this.EthernetServerSendMessage(client, this.Transfer_11_Markoprint(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 12: - this.EthernetServerSendMessage(client, this.Transfer_12_alphaJET(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 13: - this.EthernetServerSendMessage(client, this.Transfer_13_Marking_VJ1510(this.CurrentWeightData)); - break; - case 17: - this.EthernetServerSendMessage(client, this.Transfer_17_OPT3(this.CurrentWeightData, this.CurrentProductItem)); - break; - case 18: - this.EthernetServerSendMessage(client, this.Transfer_18_HP200(this.CurrentWeightData, 1)); - this.EthernetServerSendMessage(client, this.Transfer_18_HP200(this.CurrentWeightData, 2)); - break; - case 19: - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) - this.EthernetServerSendMessage(client, this.Transfer_19_SmartJet(this.CurrentWeightData)); - break; - case 20: - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) - { - this.EthernetServerSendMessage(client, this.RoomChange9410(2)); // 2번방 변경 - Thread.Sleep(200); - this.EthernetServerSendMessage(client, this.SendChar(Define.E_CharValue.ACK)); // ACK - Thread.Sleep(200); - this.EthernetServerSendMessage(client, this.WeightData9410_OPT3(this.CurrentWeightData)); // 중량값 전송 - } - else - { - this.EthernetServerSendMessage(client, this.RoomChange9410(1)); // 1번방 변경 - Thread.Sleep(200); - this.EthernetServerSendMessage(client, this.SendChar(Define.E_CharValue.ACK)); // ACK - } - break; - case (int)Define.E_CommMode.f22_Modbus: // 22, Modbus TCP - if (this.SystemConfig2.ModbusTCPSelectFunction == (int)Define.E_ModbusFunction._16_WriteMultipleRegister) - { - byte[] sendData = this.Modbus.MakeTCPSendAllData(this.Transfer_22_Modbus_Write(), this.SystemConfig2.ModbusTCPStartAddress); - - this.EthernetServerSendMessage(client, sendData); - } - break; - case (int)Define.E_CommMode.f23_STD2: - this.EthernetServerSendMessage(client, - this.Transfer_23_STD2(this.SystemConfig1, this.CurrentWeightData, this.CurrentProductItem)); - break; - case (int)Define.E_CommMode.f24_MULTi_JET: - this.EthernetServerSendMessage(client, this.Transfer_24_MULTi_JET(false, this.CurrentWeightData)); - break; - case (int)Define.E_CommMode.f26_LINX8830: - this.EthernetServerSendMessage(client, this.Transfer_26_LINX8830(false, this.CurrentWeightData)); - break; - case (int)Define.E_CommMode.f27_MYJET: - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) - this.EthernetServerSendMessage(client, this.Transfer_27_MYJET(false, this.CurrentWeightData)); - break; - case (int)Define.E_CommMode.f28_OPT4: // Tasco(타스코) PC 전송 - this.EthernetServerSendMessage(client, this.Transfer_28_OPT4(false, this.CurrentWeightData)); - break; - default: - break; - } - #endregion - } - } - } + this.TransferSerialCOM1(this.Transfer_1_STD1(this.SystemConfig1, this.CurrentWeightData, this.CurrentProductItem)); break; case 2: - if (this.SystemConfig2.EthernetCommMode != 0) - { - #region Client - switch (this.SystemConfig2.EthernetCommMode) - { - case 1: - this.ClientSendDataString = this.Transfer_1_STD1(this.SystemConfig1, this.CurrentWeightData, this.CurrentProductItem); - this.EthernetWeightData(this.ClientSendDataString); - break; - case 2: - this.ClientSendDataString = this.Transfer_2_Remote(this.CurrentWeightData, this.CurrentProductItem); - this.EthernetWeightData(this.ClientSendDataString); - break; - case 3: - if (this.SystemConfig1.IsPrintPerProductEnable == true) - { - this.ClientSendDataString = this.Transfer_3_Print(this.CurrentWeightData, this.CurrentProductItem); - this.EthernetWeightData(this.ClientSendDataString); - } - break; - case 4: - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) - { - this.EthernetWeightData(this.RoomChange9410(2)); // 2번방 변경 - Thread.Sleep(200); - this.EthernetWeightData(this.SendChar(Define.E_CharValue.ACK)); // ACK - Thread.Sleep(200); - this.EthernetWeightData(this.WeightData9410_OPT1(this.CurrentWeightData)); // 중량값 전송 - } - else - { - this.EthernetWeightData(this.RoomChange9410(1)); // 1번방 변경 - Thread.Sleep(200); - this.EthernetWeightData(this.SendChar(Define.E_CharValue.ACK)); // ACK - } - break; - case 5: - this.HMCOM1_Step = 1; - this.ClientSendDataString = this.SendChar(Define.E_CharValue.ENQ); - this.EthernetWeightData(this.ClientSendDataString); - break; - case 6: - this.ClientSendDataString = this.Transfer_6_OPT0(this.CurrentWeightData); - this.EthernetWeightData(this.ClientSendDataString); - break; - case 7: - this.ClientSendDatabyteArray = this.Transfer_7_imaje9410OPT2(this.CurrentWeightData); - this.EthernetWeightData(this.ClientSendDatabyteArray); - break; - case 8: - this.ClientSendDatabyteArray = this.Transfer_8_imaje9028OPT2(this.CurrentWeightData); - this.EthernetWeightData(this.ClientSendDatabyteArray); - break; - case 9: - this.ClientSendDataString = this.Transfer_9_Hitachi(this.CurrentWeightData, Define.E_SerialCOM.COM1); - this.EthernetWeightData(this.ClientSendDataString); - break; - case 10: - this.ClientSendDatabyteArray = this.Transfer_10_MACSA(this.CurrentWeightData, this.CurrentProductItem); - this.EthernetWeightData(this.ClientSendDatabyteArray); - break; - case 11: - this.ClientSendDatabyteArray = this.Transfer_11_Markoprint(this.CurrentWeightData, this.CurrentProductItem); - this.EthernetWeightData(this.ClientSendDatabyteArray); - break; - case 12: - this.ClientSendDatabyteArray = this.Transfer_12_alphaJET(this.CurrentWeightData, this.CurrentProductItem); - this.EthernetWeightData(this.ClientSendDatabyteArray); - break; - case 13: - this.ClientSendDataString = this.Transfer_13_Marking_VJ1510(this.CurrentWeightData); - this.EthernetWeightData(this.ClientSendDataString); - break; - case 17: - this.ClientSendDataString = this.Transfer_17_OPT3(this.CurrentWeightData, this.CurrentProductItem); - this.EthernetWeightData(this.ClientSendDataString); - break; - case 18: - this.EthernetWeightData(this.Transfer_18_HP200(this.CurrentWeightData, 1)); - this.EthernetWeightData(this.Transfer_18_HP200(this.CurrentWeightData, 2)); - break; - case 19: - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) - { - this.ClientSendDataString = this.Transfer_19_SmartJet(this.CurrentWeightData); - this.EthernetWeightData(this.ClientSendDataString); - } - break; - case 20: - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) - { - this.EthernetWeightData(this.RoomChange9410(2)); // 2번방 변경 - Thread.Sleep(200); - this.EthernetWeightData(this.SendChar(Define.E_CharValue.ACK)); // ACK - Thread.Sleep(200); - this.EthernetWeightData(this.WeightData9410_OPT3(this.CurrentWeightData)); // 중량값 전송 - } - else - { - this.EthernetWeightData(this.RoomChange9410(1)); // 1번방 변경 - Thread.Sleep(200); - this.EthernetWeightData(this.SendChar(Define.E_CharValue.ACK)); // ACK - } - break; - case (int)Define.E_CommMode.f22_Modbus: // 22, Modbus TCP - if (this.SystemConfig2.ModbusTCPSelectFunction == (int)Define.E_ModbusFunction._16_WriteMultipleRegister) - { - this.ClientSendDatabyteArray = this.Modbus.MakeTCPSendAllData(this.Transfer_22_Modbus_Write(), this.SystemConfig2.ModbusTCPStartAddress); - - this.EthernetWeightDataForModbus(this.ClientSendDatabyteArray); - } - break; - case (int)Define.E_CommMode.f23_STD2: - this.ClientSendDataString = this.Transfer_23_STD2(this.SystemConfig1, this.CurrentWeightData, this.CurrentProductItem); - this.EthernetWeightData(this.ClientSendDataString); - break; - case (int)Define.E_CommMode.f24_MULTi_JET: - this.EthernetWeightData(this.Transfer_24_MULTi_JET(false, this.CurrentWeightData)); - break; - case (int)Define.E_CommMode.f26_LINX8830: - this.EthernetWeightData(this.Transfer_26_LINX8830(false, this.CurrentWeightData)); - break; - case (int)Define.E_CommMode.f27_MYJET: - this.EthernetWeightData(this.Transfer_27_MYJET(false, this.CurrentWeightData)); - break; - case (int)Define.E_CommMode.f28_OPT4: // Tasco(타스코) PC 전송 - this.EthernetWeightData(this.Transfer_28_OPT4(false, this.CurrentWeightData)); - break; - default: - break; - } - #endregion - } + this.TransferSerialCOM1(this.Transfer_2_Remote(this.CurrentWeightData, this.CurrentProductItem)); break; - default: + case 3: + if (this.SystemConfig1.IsPrintPerProductEnable == true) + this.TransferSerialCOM1(this.Transfer_3_Print(this.CurrentWeightData, this.CurrentProductItem)); break; - } - #endregion - - #region 카운터출력 - - #region Counting Output 1 - temp = this.SystemConfig2.CountingOutput1Number; - - if (this.SystemConfig2.CountingOutput1Mode != 0 && temp != 0) - { - switch (this.SystemConfig2.CountingOutput1Mode) - { - case 1: // Pass - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) - { - this.CountingOutput1Count++; - - if (this.CountingOutput1Count >= temp) - { - this.CountingOutput1Count = 0; - - if (this.SystemConfig2.IsCountingOutput1BuzzerOn == true) - this.TransferData(CommunicationCommand.BuzzerOn, CommunicationID.MainBoard); - if (this.SystemConfig2.IsCountingOutput1ConveyorStop == true) - { - this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard); - // 메시지 23 - this.StartThreadMessage1(); - } - if (this.SystemConfig2.IsCountingOutput1ExternalOutput == true) - this.TransferData(CommunicationCommand.CountingOutput1Pulse, CommunicationID.MainBoard); - } - } - else - { - if (this.SystemConfig2.IsCountingOutput1Continuous == true) - this.CountingOutput1Count = 0; - } - break; - case 2: // NG - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Over - || this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Under) - { - this.CountingOutput1Count++; - - if (this.CountingOutput1Count >= temp) - { - this.CountingOutput1Count = 0; - - if (this.SystemConfig2.IsCountingOutput1BuzzerOn == true) - this.TransferData(CommunicationCommand.BuzzerOn, CommunicationID.MainBoard); - if (this.SystemConfig2.IsCountingOutput1ConveyorStop == true) - { - this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard); - // 메시지 23 - this.StartThreadMessage1(); - } - if (this.SystemConfig2.IsCountingOutput1ExternalOutput == true) - this.TransferData(CommunicationCommand.CountingOutput1Pulse, CommunicationID.MainBoard); - } - } - else - { - if (this.SystemConfig2.IsCountingOutput1Continuous == true) - this.CountingOutput1Count = 0; - } - break; - case 3: // Over - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Over) - { - this.CountingOutput1Count++; - - if (this.CountingOutput1Count >= temp) - { - this.CountingOutput1Count = 0; - - if (this.SystemConfig2.IsCountingOutput1BuzzerOn == true) - this.TransferData(CommunicationCommand.BuzzerOn, CommunicationID.MainBoard); - if (this.SystemConfig2.IsCountingOutput1ConveyorStop == true) - { - this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard); - // 메시지 23 - this.StartThreadMessage1(); - } - if (this.SystemConfig2.IsCountingOutput1ExternalOutput == true) - this.TransferData(CommunicationCommand.CountingOutput1Pulse, CommunicationID.MainBoard); - } - } - else - { - if (this.SystemConfig2.IsCountingOutput1Continuous == true) - this.CountingOutput1Count = 0; - } - break; - case 4: // Under - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Under) - { - this.CountingOutput1Count++; - - if (this.CountingOutput1Count >= temp) - { - this.CountingOutput1Count = 0; - - if (this.SystemConfig2.IsCountingOutput1BuzzerOn == true) - this.TransferData(CommunicationCommand.BuzzerOn, CommunicationID.MainBoard); - if (this.SystemConfig2.IsCountingOutput1ConveyorStop == true) - { - this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard); - // 메시지 23. 알람 조건이 충족하여 장비가 정지되었습니다 - this.StartThreadMessage1(); - } - if (this.SystemConfig2.IsCountingOutput1ExternalOutput == true) - this.TransferData(CommunicationCommand.CountingOutput1Pulse, CommunicationID.MainBoard); - } - } - else - { - if (this.SystemConfig2.IsCountingOutput1Continuous == true) - this.CountingOutput1Count = 0; - } - break; - default: - break; - } - } - #endregion - - #region Counting Output 2 - temp = this.SystemConfig2.CountingOutput2Number; - - if (this.SystemConfig2.CountingOutput2Mode != 0 && temp != 0) - { - switch (this.SystemConfig2.CountingOutput2Mode) - { - case 1: // Pass - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) - { - this.CountingOutput2Count++; - - if (this.CountingOutput2Count >= temp) - { - this.CountingOutput2Count = 0; - - if (this.SystemConfig2.IsCountingOutput2BuzzerOn == true) - this.TransferData(CommunicationCommand.BuzzerOn, CommunicationID.MainBoard); - if (this.SystemConfig2.IsCountingOutput2ConveyorStop == true) - { - this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard); - // 메시지 23 - this.StartThreadMessage1(); - } - if (this.SystemConfig2.IsCountingOutput2ExternalOutput == true) - this.TransferData(CommunicationCommand.CountingOutput2Pulse, CommunicationID.MainBoard); - } - } - else - { - if (this.SystemConfig2.IsCountingOutput2Continuous == true) - this.CountingOutput2Count = 0; - } - break; - case 2: // NG - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Over - || this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Under) - { - this.CountingOutput2Count++; - - if (this.CountingOutput2Count >= temp) - { - this.CountingOutput2Count = 0; - - if (this.SystemConfig2.IsCountingOutput2BuzzerOn == true) - this.TransferData(CommunicationCommand.BuzzerOn, CommunicationID.MainBoard); - if (this.SystemConfig2.IsCountingOutput2ConveyorStop == true) - { - this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard); - // 메시지 23 - this.StartThreadMessage1(); - } - if (this.SystemConfig2.IsCountingOutput2ExternalOutput == true) - this.TransferData(CommunicationCommand.CountingOutput2Pulse, CommunicationID.MainBoard); - } - } - else - { - if (this.SystemConfig2.IsCountingOutput2Continuous == true) - this.CountingOutput2Count = 0; - } - break; - case 3: // Over - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Over) - { - this.CountingOutput2Count++; - - if (this.CountingOutput2Count >= temp) - { - this.CountingOutput2Count = 0; - - if (this.SystemConfig2.IsCountingOutput2BuzzerOn == true) - this.TransferData(CommunicationCommand.BuzzerOn, CommunicationID.MainBoard); - if (this.SystemConfig2.IsCountingOutput2ConveyorStop == true) - { - this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard); - // 메시지 23 - this.StartThreadMessage1(); - } - if (this.SystemConfig2.IsCountingOutput2ExternalOutput == true) - this.TransferData(CommunicationCommand.CountingOutput2Pulse, CommunicationID.MainBoard); - } - } - else - { - if (this.SystemConfig2.IsCountingOutput2Continuous == true) - this.CountingOutput2Count = 0; - } - break; - case 4: // Under - if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Under) - { - this.CountingOutput2Count++; - - if (this.CountingOutput2Count >= temp) - { - this.CountingOutput2Count = 0; - - if (this.SystemConfig2.IsCountingOutput2BuzzerOn == true) - this.TransferData(CommunicationCommand.BuzzerOn, CommunicationID.MainBoard); - if (this.SystemConfig2.IsCountingOutput2ConveyorStop == true) - { - this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard); - // 메시지 23 - this.StartThreadMessage1(); - } - if (this.SystemConfig2.IsCountingOutput2ExternalOutput == true) - this.TransferData(CommunicationCommand.CountingOutput2Pulse, CommunicationID.MainBoard); - } - } - else - { - if (this.SystemConfig2.IsCountingOutput2Continuous == true) - this.CountingOutput2Count = 0; - } - break; - default: - break; - } - } - #endregion - - this.ChildFormMainDisplay.MainDisplayWeightBigScreen.UpdateAlarmLabelDisplay(this.CountingOutput1Count, this.CountingOutput2Count); - this.ChildFormMainDisplay.MainDisplayWeightSmall.UpdateAlarmLabelDisplay(this.CountingOutput1Count, this.CountingOutput2Count); - #endregion - - // CurrentDisplay - switch (this.CurrentSystemStatus.CurrentDisplay) - { - case Define.E_DisplayStore.MainDisplay: - #region MainDisplay - if (this.SystemConfig1.IsBarcodeEnable == true) + case 4: + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) { - this.CurrentBarcode.BarcodeDequeue(); - - if (this.ChildFormMainDisplay != null) - this.ChildFormMainDisplay.UpdateBarcodeDisplay(this.CurrentBarcode); - - if (this.CurrentBarcode.GetQueueCount > 0) - this.BarcodeProductChange(this.CurrentBarcode); - - if (this.ChildFormMainDisplay != null) - this.ChildFormMainDisplay.UpdateCurrentProductDisplay(this.CurrentSystemStatus.Equipment, this.CurrentProductItem, this.CurrentWeightData); - } - - if (this.ChildFormMainDisplay != null) - this.ChildFormMainDisplay.UpdateStartWeightDisplay(this.CurrentSystemStatus.Equipment, this.CurrentProductItem, this.CurrentWeightData); - - if (this.SystemConfig1.DatabackupFormat == 1) - { - #region OPT1 - 종근당 옵션 - if (this.timeOut.Enabled == true) - this.timeOut.Enabled = false; - - //if (this.CollectionBufferWeightData.Count != 0) - //{ - // if (this.CurrentJudgmentResult.PreviousRejectData != Define.E_JudgmentResult.None) - // this.CollectionBufferWeightData[0].Status = this.CurrentJudgmentResult.PreviousRejectData.ToString(); - // else - // this.CollectionBufferWeightData[0].Status = Define.E_JudgmentResult.OM.ToString(); - // this.DataBackup1(this.CollectionBufferWeightData[0]); - // this.CollectionBufferWeightData.Clear(); - //} - - this.CollectionBufferWeightData.Add(new DataBackupOPT1()); - this.CollectionBufferWeightData[this.CollectionBufferWeightData.Count - 1].SetData( - this.CurrentProductItem, this.CurrentWeightData, this.SystemConfig1, DateTime.Now); - - if (this.CurrentJudgmentSetItem.Sorter2Mode == 3) - this.timeOut.Interval = (this.CurrentJudgmentSetItem.Sorter2DelayTime * 2) + (this.CurrentJudgmentSetItem.Sorter2RunTime * 5) + 1000; - else - this.timeOut.Interval = (this.CurrentJudgmentSetItem.Sorter1DelayTime * 2) + (this.CurrentJudgmentSetItem.Sorter1RunTime * 5) + 1000; - this.timeOut.Enabled = true; - #endregion + this.TransferSerialCOM1(this.RoomChange9410(2)); // 2번방 변경 + Thread.Sleep(200); + this.TransferSerialCOM1(this.SendChar(Define.E_CharValue.ACK)); // ACK + Thread.Sleep(200); + this.TransferSerialCOM1(this.WeightData9410_OPT1(this.CurrentWeightData)); // 중량값 전송 } else { - #region STD1 - if (this.CurrentWeightData.JudgmentStatus != Define.E_JudgmentStatus.Empty) - this.TrackingInspectionData0(this.CurrentWeightData); - #endregion + this.TransferSerialCOM1(this.RoomChange9410(1)); // 1번방 변경 + Thread.Sleep(200); + this.TransferSerialCOM1(this.SendChar(Define.E_CharValue.ACK)); // ACK } + break; + case 5: + this.HMCOM1_Step = 1; + this.TransferSerialCOM1(this.SendChar(Define.E_CharValue.ENQ)); + break; + case 6: + this.TransferSerialCOM1(this.Transfer_6_OPT0(this.CurrentWeightData)); + break; + case 7: + this.TransferSerialCOM1(this.Transfer_7_imaje9410OPT2(this.CurrentWeightData)); + break; + case 8: + this.TransferSerialCOM1(this.Transfer_8_imaje9028OPT2(this.CurrentWeightData)); + break; + case 9: + this.TransferSerialCOM1(this.Transfer_9_Hitachi(this.CurrentWeightData, Define.E_SerialCOM.COM1)); + break; + case 10: + this.TransferSerialCOM1(this.Transfer_10_MACSA(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 11: + this.TransferSerialCOM1(this.Transfer_11_Markoprint(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 12: + this.TransferSerialCOM1(this.Transfer_12_alphaJET(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 13: + this.TransferSerialCOM1(this.Transfer_13_Marking_VJ1510(this.CurrentWeightData)); + break; + case 17: + this.TransferSerialCOM1(this.Transfer_17_OPT3(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 18: + this.TransferSerialCOM1(this.Transfer_18_HP200(this.CurrentWeightData, 1)); + this.TransferSerialCOM1(this.Transfer_18_HP200(this.CurrentWeightData, 2)); + break; + case 19: + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) + this.TransferSerialCOM1(this.Transfer_19_SmartJet(this.CurrentWeightData)); + break; + case 20: + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) + { + this.TransferSerialCOM1(this.RoomChange9410(2)); // 2번방 변경 + Thread.Sleep(200); + this.TransferSerialCOM1(this.SendChar(Define.E_CharValue.ACK)); // ACK + Thread.Sleep(200); + this.TransferSerialCOM1(this.WeightData9410_OPT3(this.CurrentWeightData)); // 중량값 전송 + } + else + { + this.TransferSerialCOM1(this.RoomChange9410(1)); // 1번방 변경 + Thread.Sleep(200); + this.TransferSerialCOM1(this.SendChar(Define.E_CharValue.ACK)); // ACK + } + break; + case (int)Define.E_CommMode.f22_Modbus: // Modbus RTU(Master 사용 시 - Write multiple register) + if (this.SystemConfig2.ModbusRTUSelectFunction == (int)Define.E_ModbusFunction._16_WriteMultipleRegister) + { + byte[] sendData = this.Modbus.MakeRTUSendAllData(this.Transfer_22_Modbus_Write(), this.SystemConfig2.ModbusSlaveIDCOM1, this.SystemConfig2.ModbusRTUStartAddressCOM1); - // 표준분포 - this.CurrentWeightData.SetNormalDistribution(this.CurrentProductItem.CollectionNormalDistributionRange, this.CurrentWeightData.WeightString); - #endregion + this.TransferSerialCOM1(sendData); + } + break; + case (int)Define.E_CommMode.f23_STD2: + this.TransferSerialCOM1(this.Transfer_23_STD2(this.SystemConfig1, this.CurrentWeightData, this.CurrentProductItem)); + break; + case (int)Define.E_CommMode.f24_MULTi_JET: + this.TransferSerialCOM1(this.Transfer_24_MULTi_JET(false, this.CurrentWeightData)); + break; + case (int)Define.E_CommMode.f26_LINX8830: + this.TransferSerialCOM1(this.Transfer_26_LINX8830(false, this.CurrentWeightData)); + break; + case (int)Define.E_CommMode.f27_MYJET: + this.TransferSerialCOM1(this.Transfer_27_MYJET(false, this.CurrentWeightData)); + break; + case (int)Define.E_CommMode.f28_OPT4: // Tasco(타스코) PC 전송 + this.TransferSerialCOM1(this.Transfer_28_OPT4(false, this.CurrentWeightData)); break; default: break; } + #endregion + } + // 통신 COM3 + if (this.SystemConfig1.SerialCOM3Mode != 0) + { + #region COM3 + switch (this.SystemConfig1.SerialCOM3Mode) + { + case 1: + this.TransferSerialCOM3(this.Transfer_1_STD1(this.SystemConfig1, this.CurrentWeightData, this.CurrentProductItem)); + break; + case 2: + this.TransferSerialCOM3(this.Transfer_2_Remote(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 3: + if (this.SystemConfig1.IsPrintPerProductEnable == true) + this.TransferSerialCOM3(this.Transfer_3_Print(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 4: + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) + { + this.TransferSerialCOM3(this.RoomChange9410(2)); // 2번방 변경 + Thread.Sleep(200); + this.TransferSerialCOM3(this.SendChar(Define.E_CharValue.ACK)); // ACK + Thread.Sleep(200); + this.TransferSerialCOM3(this.WeightData9410_OPT1(this.CurrentWeightData)); // 중량값 전송 + } + else + { + this.TransferSerialCOM3(this.RoomChange9410(1)); // 1번방 변경 + Thread.Sleep(200); + this.TransferSerialCOM3(this.SendChar(Define.E_CharValue.ACK)); // ACK + } + break; + case 5: + this.HMCOM3_Step = 1; + this.TransferSerialCOM3(this.SendChar(Define.E_CharValue.ENQ)); + break; + case 6: + this.TransferSerialCOM3(this.Transfer_6_OPT0(this.CurrentWeightData)); + break; + case 7: + this.TransferSerialCOM3(this.Transfer_7_imaje9410OPT2(this.CurrentWeightData)); + break; + case 8: + this.TransferSerialCOM3(this.Transfer_8_imaje9028OPT2(this.CurrentWeightData)); + break; + case 9: + this.TransferSerialCOM3(this.Transfer_9_Hitachi(this.CurrentWeightData, Define.E_SerialCOM.COM3)); + break; + case 10: + this.TransferSerialCOM3(this.Transfer_10_MACSA(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 11: + this.TransferSerialCOM3(this.Transfer_11_Markoprint(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 12: + this.TransferSerialCOM3(this.Transfer_12_alphaJET(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 13: + this.TransferSerialCOM3(this.Transfer_13_Marking_VJ1510(this.CurrentWeightData)); + break; + case 17: + this.TransferSerialCOM3(this.Transfer_17_OPT3(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 18: + this.TransferSerialCOM3(this.Transfer_18_HP200(this.CurrentWeightData, 1)); + this.TransferSerialCOM3(this.Transfer_18_HP200(this.CurrentWeightData, 2)); + break; + case 19: + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) + this.TransferSerialCOM3(this.Transfer_19_SmartJet(this.CurrentWeightData)); + break; + case 20: + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) + { + this.TransferSerialCOM3(this.RoomChange9410(2)); // 2번방 변경 + Thread.Sleep(200); + this.TransferSerialCOM3(this.SendChar(Define.E_CharValue.ACK)); // ACK + Thread.Sleep(200); + this.TransferSerialCOM3(this.WeightData9410_OPT3(this.CurrentWeightData)); // 중량값 전송 + } + else + { + this.TransferSerialCOM3(this.RoomChange9410(1)); // 1번방 변경 + Thread.Sleep(200); + this.TransferSerialCOM3(this.SendChar(Define.E_CharValue.ACK)); // ACK + } + break; + case (int)Define.E_CommMode.f22_Modbus: // Modbus RTU(Master 사용 시 - Write multiple register) + if (this.SystemConfig2.ModbusRTUSelectFunction == (int)Define.E_ModbusFunction._16_WriteMultipleRegister) + { + byte[] sendData = this.Modbus.MakeRTUSendAllData(this.Transfer_22_Modbus_Write(), this.SystemConfig2.ModbusSlaveIDCOM3, this.SystemConfig2.ModbusRTUStartAddressCOM3); + + this.TransferSerialCOM3(sendData); + } + break; + case (int)Define.E_CommMode.f23_STD2: + this.TransferSerialCOM3(this.Transfer_23_STD2(this.SystemConfig1, this.CurrentWeightData, this.CurrentProductItem)); + break; + case (int)Define.E_CommMode.f24_MULTi_JET: + this.TransferSerialCOM3(this.Transfer_24_MULTi_JET(false, this.CurrentWeightData)); + break; + case (int)Define.E_CommMode.f26_LINX8830: + this.TransferSerialCOM3(this.Transfer_26_LINX8830(false, this.CurrentWeightData)); + break; + case (int)Define.E_CommMode.f27_MYJET: + this.TransferSerialCOM3(this.Transfer_27_MYJET(false, this.CurrentWeightData)); + break; + case (int)Define.E_CommMode.f28_OPT4: // Tasco(타스코) PC 전송 + this.TransferSerialCOM3(this.Transfer_28_OPT4(false, this.CurrentWeightData)); + break; + default: + break; + } + #endregion + } + // 통신 COM4 + if (this.SystemConfig1.SerialCOM4Mode != 0) + { + #region COM4 + switch (this.SystemConfig1.SerialCOM4Mode) + { + case 1: + this.TransferSerialCOM4(this.Transfer_1_STD1(this.SystemConfig1, this.CurrentWeightData, this.CurrentProductItem)); + break; + case 2: + this.TransferSerialCOM4(this.Transfer_2_Remote(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 3: + if (this.SystemConfig1.IsPrintPerProductEnable == true) + this.TransferSerialCOM4(this.Transfer_3_Print(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 4: + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) + { + this.TransferSerialCOM4(this.RoomChange9410(2)); // 2번방 변경 + Thread.Sleep(200); + this.TransferSerialCOM4(this.SendChar(Define.E_CharValue.ACK)); // ACK + Thread.Sleep(200); + this.TransferSerialCOM4(this.WeightData9410_OPT1(this.CurrentWeightData)); // 중량값 전송 + } + else + { + this.TransferSerialCOM4(this.RoomChange9410(1)); // 1번방 변경 + Thread.Sleep(200); + this.TransferSerialCOM4(this.SendChar(Define.E_CharValue.ACK)); // ACK + } + break; + case 5: + this.HMCOM4_Step = 1; + this.TransferSerialCOM4(this.SendChar(Define.E_CharValue.ENQ)); + break; + case 6: + this.TransferSerialCOM4(this.Transfer_6_OPT0(this.CurrentWeightData)); + break; + case 7: + this.TransferSerialCOM4(this.Transfer_7_imaje9410OPT2(this.CurrentWeightData)); + break; + case 8: + this.TransferSerialCOM4(this.Transfer_8_imaje9028OPT2(this.CurrentWeightData)); + break; + case 9: + this.TransferSerialCOM4(this.Transfer_9_Hitachi(this.CurrentWeightData, Define.E_SerialCOM.COM4)); + break; + case 10: + this.TransferSerialCOM4(this.Transfer_10_MACSA(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 11: + this.TransferSerialCOM4(this.Transfer_11_Markoprint(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 12: + this.TransferSerialCOM4(this.Transfer_12_alphaJET(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 13: + this.TransferSerialCOM4(this.Transfer_13_Marking_VJ1510(this.CurrentWeightData)); + break; + case 17: + this.TransferSerialCOM4(this.Transfer_17_OPT3(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 18: + this.TransferSerialCOM4(this.Transfer_18_HP200(this.CurrentWeightData, 1)); + this.TransferSerialCOM4(this.Transfer_18_HP200(this.CurrentWeightData, 2)); + break; + case 19: + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) + this.TransferSerialCOM4(this.Transfer_19_SmartJet(this.CurrentWeightData)); + break; + case 20: + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) + { + this.TransferSerialCOM4(this.RoomChange9410(2)); // 2번방 변경 + Thread.Sleep(200); + this.TransferSerialCOM4(this.SendChar(Define.E_CharValue.ACK)); // ACK + Thread.Sleep(200); + this.TransferSerialCOM4(this.WeightData9410_OPT3(this.CurrentWeightData)); // 중량값 전송 + } + else + { + this.TransferSerialCOM4(this.RoomChange9410(1)); // 1번방 변경 + Thread.Sleep(200); + this.TransferSerialCOM4(this.SendChar(Define.E_CharValue.ACK)); // ACK + } + break; + case (int)Define.E_CommMode.f22_Modbus: // Modbus RTU(Master 사용 시 - Write multiple register) + if (this.SystemConfig2.ModbusRTUSelectFunction == (int)Define.E_ModbusFunction._16_WriteMultipleRegister) + { + byte[] sendData = this.Modbus.MakeRTUSendAllData(this.Transfer_22_Modbus_Write(), this.SystemConfig2.ModbusSlaveIDCOM4, this.SystemConfig2.ModbusRTUStartAddressCOM4); + + this.TransferSerialCOM4(sendData); + } + break; + case (int)Define.E_CommMode.f23_STD2: + this.TransferSerialCOM4(this.Transfer_23_STD2(this.SystemConfig1, this.CurrentWeightData, this.CurrentProductItem)); + break; + case (int)Define.E_CommMode.f24_MULTi_JET: + this.TransferSerialCOM4(this.Transfer_24_MULTi_JET(false, this.CurrentWeightData)); + break; + case (int)Define.E_CommMode.f26_LINX8830: + this.TransferSerialCOM4(this.Transfer_26_LINX8830(false, this.CurrentWeightData)); + break; + case (int)Define.E_CommMode.f27_MYJET: + this.TransferSerialCOM4(this.Transfer_27_MYJET(false, this.CurrentWeightData)); + break; + case (int)Define.E_CommMode.f28_OPT4: // Tasco(타스코) PC 전송 + this.TransferSerialCOM4(this.Transfer_28_OPT4(false, this.CurrentWeightData)); + break; + default: + break; + } + #endregion + } + + // 이더넷 + switch (this.SystemConfig2.EthernetOperationMode) + { + case 1: + if (this.smartTCPMultiServer.ClientInfoList != null) + { + if (this.SystemConfig2.EthernetCommMode != 0) + { + foreach (SmartTCPMultiServer.CLIENTSINFOS client in this.smartTCPMultiServer.ClientInfoList) + { + #region Server + switch (this.SystemConfig2.EthernetCommMode) + { + case 1: + this.EthernetServerSendMessage(client, + this.Transfer_1_STD1(this.SystemConfig1, this.CurrentWeightData, this.CurrentProductItem)); + break; + case 2: + this.EthernetServerSendMessage(client, this.Transfer_2_Remote(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 3: + if (this.SystemConfig1.IsPrintPerProductEnable == true) + this.EthernetServerSendMessage(client, this.Transfer_3_Print(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 4: + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) + { + this.EthernetServerSendMessage(client, this.RoomChange9410(2)); // 2번방 변경 + Thread.Sleep(200); + this.EthernetServerSendMessage(client, this.SendChar(Define.E_CharValue.ACK)); // ACK + Thread.Sleep(200); + this.EthernetServerSendMessage(client, this.WeightData9410_OPT1(this.CurrentWeightData)); // 중량값 전송 + } + else + { + this.EthernetServerSendMessage(client, this.RoomChange9410(1)); // 1번방 변경 + Thread.Sleep(200); + this.EthernetServerSendMessage(client, this.SendChar(Define.E_CharValue.ACK)); // ACK + } + break; + case 5: + this.HMCOM1_Step = 1; + this.EthernetServerSendMessage(client, this.SendChar(Define.E_CharValue.ENQ)); + break; + case 6: + this.EthernetServerSendMessage(client, this.Transfer_6_OPT0(this.CurrentWeightData)); + break; + case 7: + this.EthernetServerSendMessage(client, this.Transfer_7_imaje9410OPT2(this.CurrentWeightData)); + break; + case 8: + this.EthernetServerSendMessage(client, this.Transfer_8_imaje9028OPT2(this.CurrentWeightData)); + break; + case 9: + this.EthernetServerSendMessage(client, this.Transfer_9_Hitachi(this.CurrentWeightData, Define.E_SerialCOM.COM1)); + break; + case 10: + this.EthernetServerSendMessage(client, this.Transfer_10_MACSA(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 11: + this.EthernetServerSendMessage(client, this.Transfer_11_Markoprint(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 12: + this.EthernetServerSendMessage(client, this.Transfer_12_alphaJET(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 13: + this.EthernetServerSendMessage(client, this.Transfer_13_Marking_VJ1510(this.CurrentWeightData)); + break; + case 17: + this.EthernetServerSendMessage(client, this.Transfer_17_OPT3(this.CurrentWeightData, this.CurrentProductItem)); + break; + case 18: + this.EthernetServerSendMessage(client, this.Transfer_18_HP200(this.CurrentWeightData, 1)); + this.EthernetServerSendMessage(client, this.Transfer_18_HP200(this.CurrentWeightData, 2)); + break; + case 19: + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) + this.EthernetServerSendMessage(client, this.Transfer_19_SmartJet(this.CurrentWeightData)); + break; + case 20: + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) + { + this.EthernetServerSendMessage(client, this.RoomChange9410(2)); // 2번방 변경 + Thread.Sleep(200); + this.EthernetServerSendMessage(client, this.SendChar(Define.E_CharValue.ACK)); // ACK + Thread.Sleep(200); + this.EthernetServerSendMessage(client, this.WeightData9410_OPT3(this.CurrentWeightData)); // 중량값 전송 + } + else + { + this.EthernetServerSendMessage(client, this.RoomChange9410(1)); // 1번방 변경 + Thread.Sleep(200); + this.EthernetServerSendMessage(client, this.SendChar(Define.E_CharValue.ACK)); // ACK + } + break; + case (int)Define.E_CommMode.f22_Modbus: // 22, Modbus TCP + if (this.SystemConfig2.ModbusTCPSelectFunction == (int)Define.E_ModbusFunction._16_WriteMultipleRegister) + { + byte[] sendData = this.Modbus.MakeTCPSendAllData(this.Transfer_22_Modbus_Write(), this.SystemConfig2.ModbusTCPStartAddress); + + this.EthernetServerSendMessage(client, sendData); + } + break; + case (int)Define.E_CommMode.f23_STD2: + this.EthernetServerSendMessage(client, + this.Transfer_23_STD2(this.SystemConfig1, this.CurrentWeightData, this.CurrentProductItem)); + break; + case (int)Define.E_CommMode.f24_MULTi_JET: + this.EthernetServerSendMessage(client, this.Transfer_24_MULTi_JET(false, this.CurrentWeightData)); + break; + case (int)Define.E_CommMode.f26_LINX8830: + this.EthernetServerSendMessage(client, this.Transfer_26_LINX8830(false, this.CurrentWeightData)); + break; + case (int)Define.E_CommMode.f27_MYJET: + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) + this.EthernetServerSendMessage(client, this.Transfer_27_MYJET(false, this.CurrentWeightData)); + break; + case (int)Define.E_CommMode.f28_OPT4: // Tasco(타스코) PC 전송 + this.EthernetServerSendMessage(client, this.Transfer_28_OPT4(false, this.CurrentWeightData)); + break; + default: + break; + } + #endregion + } + } + } + break; + case 2: + if (this.SystemConfig2.EthernetCommMode != 0) + { + #region Client + switch (this.SystemConfig2.EthernetCommMode) + { + case 1: + this.ClientSendDataString = this.Transfer_1_STD1(this.SystemConfig1, this.CurrentWeightData, this.CurrentProductItem); + this.EthernetWeightData(this.ClientSendDataString); + break; + case 2: + this.ClientSendDataString = this.Transfer_2_Remote(this.CurrentWeightData, this.CurrentProductItem); + this.EthernetWeightData(this.ClientSendDataString); + break; + case 3: + if (this.SystemConfig1.IsPrintPerProductEnable == true) + { + this.ClientSendDataString = this.Transfer_3_Print(this.CurrentWeightData, this.CurrentProductItem); + this.EthernetWeightData(this.ClientSendDataString); + } + break; + case 4: + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) + { + this.EthernetWeightData(this.RoomChange9410(2)); // 2번방 변경 + Thread.Sleep(200); + this.EthernetWeightData(this.SendChar(Define.E_CharValue.ACK)); // ACK + Thread.Sleep(200); + this.EthernetWeightData(this.WeightData9410_OPT1(this.CurrentWeightData)); // 중량값 전송 + } + else + { + this.EthernetWeightData(this.RoomChange9410(1)); // 1번방 변경 + Thread.Sleep(200); + this.EthernetWeightData(this.SendChar(Define.E_CharValue.ACK)); // ACK + } + break; + case 5: + this.HMCOM1_Step = 1; + this.ClientSendDataString = this.SendChar(Define.E_CharValue.ENQ); + this.EthernetWeightData(this.ClientSendDataString); + break; + case 6: + this.ClientSendDataString = this.Transfer_6_OPT0(this.CurrentWeightData); + this.EthernetWeightData(this.ClientSendDataString); + break; + case 7: + this.ClientSendDatabyteArray = this.Transfer_7_imaje9410OPT2(this.CurrentWeightData); + this.EthernetWeightData(this.ClientSendDatabyteArray); + break; + case 8: + this.ClientSendDatabyteArray = this.Transfer_8_imaje9028OPT2(this.CurrentWeightData); + this.EthernetWeightData(this.ClientSendDatabyteArray); + break; + case 9: + this.ClientSendDataString = this.Transfer_9_Hitachi(this.CurrentWeightData, Define.E_SerialCOM.COM1); + this.EthernetWeightData(this.ClientSendDataString); + break; + case 10: + this.ClientSendDatabyteArray = this.Transfer_10_MACSA(this.CurrentWeightData, this.CurrentProductItem); + this.EthernetWeightData(this.ClientSendDatabyteArray); + break; + case 11: + this.ClientSendDatabyteArray = this.Transfer_11_Markoprint(this.CurrentWeightData, this.CurrentProductItem); + this.EthernetWeightData(this.ClientSendDatabyteArray); + break; + case 12: + this.ClientSendDatabyteArray = this.Transfer_12_alphaJET(this.CurrentWeightData, this.CurrentProductItem); + this.EthernetWeightData(this.ClientSendDatabyteArray); + break; + case 13: + this.ClientSendDataString = this.Transfer_13_Marking_VJ1510(this.CurrentWeightData); + this.EthernetWeightData(this.ClientSendDataString); + break; + case 17: + this.ClientSendDataString = this.Transfer_17_OPT3(this.CurrentWeightData, this.CurrentProductItem); + this.EthernetWeightData(this.ClientSendDataString); + break; + case 18: + this.EthernetWeightData(this.Transfer_18_HP200(this.CurrentWeightData, 1)); + this.EthernetWeightData(this.Transfer_18_HP200(this.CurrentWeightData, 2)); + break; + case 19: + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) + { + this.ClientSendDataString = this.Transfer_19_SmartJet(this.CurrentWeightData); + this.EthernetWeightData(this.ClientSendDataString); + } + break; + case 20: + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) + { + this.EthernetWeightData(this.RoomChange9410(2)); // 2번방 변경 + Thread.Sleep(200); + this.EthernetWeightData(this.SendChar(Define.E_CharValue.ACK)); // ACK + Thread.Sleep(200); + this.EthernetWeightData(this.WeightData9410_OPT3(this.CurrentWeightData)); // 중량값 전송 + } + else + { + this.EthernetWeightData(this.RoomChange9410(1)); // 1번방 변경 + Thread.Sleep(200); + this.EthernetWeightData(this.SendChar(Define.E_CharValue.ACK)); // ACK + } + break; + case (int)Define.E_CommMode.f22_Modbus: // 22, Modbus TCP + if (this.SystemConfig2.ModbusTCPSelectFunction == (int)Define.E_ModbusFunction._16_WriteMultipleRegister) + { + this.ClientSendDatabyteArray = this.Modbus.MakeTCPSendAllData(this.Transfer_22_Modbus_Write(), this.SystemConfig2.ModbusTCPStartAddress); + + this.EthernetWeightDataForModbus(this.ClientSendDatabyteArray); + } + break; + case (int)Define.E_CommMode.f23_STD2: + this.ClientSendDataString = this.Transfer_23_STD2(this.SystemConfig1, this.CurrentWeightData, this.CurrentProductItem); + this.EthernetWeightData(this.ClientSendDataString); + break; + case (int)Define.E_CommMode.f24_MULTi_JET: + this.EthernetWeightData(this.Transfer_24_MULTi_JET(false, this.CurrentWeightData)); + break; + case (int)Define.E_CommMode.f26_LINX8830: + this.EthernetWeightData(this.Transfer_26_LINX8830(false, this.CurrentWeightData)); + break; + case (int)Define.E_CommMode.f27_MYJET: + this.EthernetWeightData(this.Transfer_27_MYJET(false, this.CurrentWeightData)); + break; + case (int)Define.E_CommMode.f28_OPT4: // Tasco(타스코) PC 전송 + this.EthernetWeightData(this.Transfer_28_OPT4(false, this.CurrentWeightData)); + break; + default: + break; + } + #endregion + } + break; + default: + break; + } + #endregion + + #region 카운터출력 + + #region Counting Output 1 + temp = this.SystemConfig2.CountingOutput1Number; + + if (this.SystemConfig2.CountingOutput1Mode != 0 && temp != 0) + { + switch (this.SystemConfig2.CountingOutput1Mode) + { + case 1: // Pass + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) + { + this.CountingOutput1Count++; + + if (this.CountingOutput1Count >= temp) + { + this.CountingOutput1Count = 0; + + if (this.SystemConfig2.IsCountingOutput1BuzzerOn == true) + this.TransferData(CommunicationCommand.BuzzerOn, CommunicationID.MainBoard); + if (this.SystemConfig2.IsCountingOutput1ConveyorStop == true) + { + this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard); + // 메시지 23 + this.StartThreadMessage1(); + } + if (this.SystemConfig2.IsCountingOutput1ExternalOutput == true) + this.TransferData(CommunicationCommand.CountingOutput1Pulse, CommunicationID.MainBoard); + } + } + else + { + if (this.SystemConfig2.IsCountingOutput1Continuous == true) + this.CountingOutput1Count = 0; + } + break; + case 2: // NG + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Over + || this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Under) + { + this.CountingOutput1Count++; + + if (this.CountingOutput1Count >= temp) + { + this.CountingOutput1Count = 0; + + if (this.SystemConfig2.IsCountingOutput1BuzzerOn == true) + this.TransferData(CommunicationCommand.BuzzerOn, CommunicationID.MainBoard); + if (this.SystemConfig2.IsCountingOutput1ConveyorStop == true) + { + this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard); + // 메시지 23 + this.StartThreadMessage1(); + } + if (this.SystemConfig2.IsCountingOutput1ExternalOutput == true) + this.TransferData(CommunicationCommand.CountingOutput1Pulse, CommunicationID.MainBoard); + } + } + else + { + if (this.SystemConfig2.IsCountingOutput1Continuous == true) + this.CountingOutput1Count = 0; + } + break; + case 3: // Over + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Over) + { + this.CountingOutput1Count++; + + if (this.CountingOutput1Count >= temp) + { + this.CountingOutput1Count = 0; + + if (this.SystemConfig2.IsCountingOutput1BuzzerOn == true) + this.TransferData(CommunicationCommand.BuzzerOn, CommunicationID.MainBoard); + if (this.SystemConfig2.IsCountingOutput1ConveyorStop == true) + { + this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard); + // 메시지 23 + this.StartThreadMessage1(); + } + if (this.SystemConfig2.IsCountingOutput1ExternalOutput == true) + this.TransferData(CommunicationCommand.CountingOutput1Pulse, CommunicationID.MainBoard); + } + } + else + { + if (this.SystemConfig2.IsCountingOutput1Continuous == true) + this.CountingOutput1Count = 0; + } + break; + case 4: // Under + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Under) + { + this.CountingOutput1Count++; + + if (this.CountingOutput1Count >= temp) + { + this.CountingOutput1Count = 0; + + if (this.SystemConfig2.IsCountingOutput1BuzzerOn == true) + this.TransferData(CommunicationCommand.BuzzerOn, CommunicationID.MainBoard); + if (this.SystemConfig2.IsCountingOutput1ConveyorStop == true) + { + this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard); + // 메시지 23. 알람 조건이 충족하여 장비가 정지되었습니다 + this.StartThreadMessage1(); + } + if (this.SystemConfig2.IsCountingOutput1ExternalOutput == true) + this.TransferData(CommunicationCommand.CountingOutput1Pulse, CommunicationID.MainBoard); + } + } + else + { + if (this.SystemConfig2.IsCountingOutput1Continuous == true) + this.CountingOutput1Count = 0; + } + break; + default: + break; + } + } + #endregion + + #region Counting Output 2 + temp = this.SystemConfig2.CountingOutput2Number; + + if (this.SystemConfig2.CountingOutput2Mode != 0 && temp != 0) + { + switch (this.SystemConfig2.CountingOutput2Mode) + { + case 1: // Pass + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Pass) + { + this.CountingOutput2Count++; + + if (this.CountingOutput2Count >= temp) + { + this.CountingOutput2Count = 0; + + if (this.SystemConfig2.IsCountingOutput2BuzzerOn == true) + this.TransferData(CommunicationCommand.BuzzerOn, CommunicationID.MainBoard); + if (this.SystemConfig2.IsCountingOutput2ConveyorStop == true) + { + this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard); + // 메시지 23 + this.StartThreadMessage1(); + } + if (this.SystemConfig2.IsCountingOutput2ExternalOutput == true) + this.TransferData(CommunicationCommand.CountingOutput2Pulse, CommunicationID.MainBoard); + } + } + else + { + if (this.SystemConfig2.IsCountingOutput2Continuous == true) + this.CountingOutput2Count = 0; + } + break; + case 2: // NG + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Over + || this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Under) + { + this.CountingOutput2Count++; + + if (this.CountingOutput2Count >= temp) + { + this.CountingOutput2Count = 0; + + if (this.SystemConfig2.IsCountingOutput2BuzzerOn == true) + this.TransferData(CommunicationCommand.BuzzerOn, CommunicationID.MainBoard); + if (this.SystemConfig2.IsCountingOutput2ConveyorStop == true) + { + this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard); + // 메시지 23 + this.StartThreadMessage1(); + } + if (this.SystemConfig2.IsCountingOutput2ExternalOutput == true) + this.TransferData(CommunicationCommand.CountingOutput2Pulse, CommunicationID.MainBoard); + } + } + else + { + if (this.SystemConfig2.IsCountingOutput2Continuous == true) + this.CountingOutput2Count = 0; + } + break; + case 3: // Over + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Over) + { + this.CountingOutput2Count++; + + if (this.CountingOutput2Count >= temp) + { + this.CountingOutput2Count = 0; + + if (this.SystemConfig2.IsCountingOutput2BuzzerOn == true) + this.TransferData(CommunicationCommand.BuzzerOn, CommunicationID.MainBoard); + if (this.SystemConfig2.IsCountingOutput2ConveyorStop == true) + { + this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard); + // 메시지 23 + this.StartThreadMessage1(); + } + if (this.SystemConfig2.IsCountingOutput2ExternalOutput == true) + this.TransferData(CommunicationCommand.CountingOutput2Pulse, CommunicationID.MainBoard); + } + } + else + { + if (this.SystemConfig2.IsCountingOutput2Continuous == true) + this.CountingOutput2Count = 0; + } + break; + case 4: // Under + if (this.CurrentWeightData.JudgmentStatus == Define.E_JudgmentStatus.Under) + { + this.CountingOutput2Count++; + + if (this.CountingOutput2Count >= temp) + { + this.CountingOutput2Count = 0; + + if (this.SystemConfig2.IsCountingOutput2BuzzerOn == true) + this.TransferData(CommunicationCommand.BuzzerOn, CommunicationID.MainBoard); + if (this.SystemConfig2.IsCountingOutput2ConveyorStop == true) + { + this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard); + // 메시지 23 + this.StartThreadMessage1(); + } + if (this.SystemConfig2.IsCountingOutput2ExternalOutput == true) + this.TransferData(CommunicationCommand.CountingOutput2Pulse, CommunicationID.MainBoard); + } + } + else + { + if (this.SystemConfig2.IsCountingOutput2Continuous == true) + this.CountingOutput2Count = 0; + } + break; + default: + break; + } + } + #endregion + + this.ChildFormMainDisplay.MainDisplayWeightBigScreen.UpdateAlarmLabelDisplay(this.CountingOutput1Count, this.CountingOutput2Count); + this.ChildFormMainDisplay.MainDisplayWeightSmall.UpdateAlarmLabelDisplay(this.CountingOutput1Count, this.CountingOutput2Count); + #endregion + + // CurrentDisplay + switch (this.CurrentSystemStatus.CurrentDisplay) + { + case Define.E_DisplayStore.MainDisplay: + #region MainDisplay + if (this.SystemConfig1.IsBarcodeEnable == true) + { + this.CurrentBarcode.BarcodeDequeue(); + + if (this.ChildFormMainDisplay != null) + this.ChildFormMainDisplay.UpdateBarcodeDisplay(this.CurrentBarcode); + + if (this.CurrentBarcode.GetQueueCount > 0) + this.BarcodeProductChange(this.CurrentBarcode); + + if (this.ChildFormMainDisplay != null) + this.ChildFormMainDisplay.UpdateCurrentProductDisplay(this.CurrentSystemStatus.Equipment, this.CurrentProductItem, this.CurrentWeightData); + } + + if (this.ChildFormMainDisplay != null) + this.ChildFormMainDisplay.UpdateStartWeightDisplay(this.CurrentSystemStatus.Equipment, this.CurrentProductItem, this.CurrentWeightData); + + + if (this.SystemConfig1.DatabackupFormat == 1) + { + #region OPT1 - 종근당 옵션 + if (this.timeOut.Enabled == true) + this.timeOut.Enabled = false; + + //if (this.CollectionBufferWeightData.Count != 0) + //{ + // if (this.CurrentJudgmentResult.PreviousRejectData != Define.E_JudgmentResult.None) + // this.CollectionBufferWeightData[0].Status = this.CurrentJudgmentResult.PreviousRejectData.ToString(); + // else + // this.CollectionBufferWeightData[0].Status = Define.E_JudgmentResult.OM.ToString(); + // this.DataBackup1(this.CollectionBufferWeightData[0]); + // this.CollectionBufferWeightData.Clear(); + //} + + this.CollectionBufferWeightData.Add(new DataBackupOPT1()); + this.CollectionBufferWeightData[this.CollectionBufferWeightData.Count - 1].SetData( + this.CurrentProductItem, this.CurrentWeightData, this.SystemConfig1, DateTime.Now); + + if (this.CurrentJudgmentSetItem.Sorter2Mode == 3) + this.timeOut.Interval = (this.CurrentJudgmentSetItem.Sorter2DelayTime * 2) + (this.CurrentJudgmentSetItem.Sorter2RunTime * 5) + 1000; + else + this.timeOut.Interval = (this.CurrentJudgmentSetItem.Sorter1DelayTime * 2) + (this.CurrentJudgmentSetItem.Sorter1RunTime * 5) + 1000; + this.timeOut.Enabled = true; + #endregion + } + else + { + #region STD1 + if (this.CurrentWeightData.JudgmentStatus != Define.E_JudgmentStatus.Empty) + this.TrackingInspectionData0(this.CurrentWeightData); + #endregion + } + + // 표준분포 + this.CurrentWeightData.SetNormalDistribution(this.CurrentProductItem.CollectionNormalDistributionRange, this.CurrentWeightData.WeightString); + #endregion + break; + default: + break; } break; default: @@ -4384,8 +4393,9 @@ namespace ITC81DB_0H.Forms } else sb.Append(string.Format("{0,8}", weight.JudgmentStatus)); - sValue = Helper.DoubleToString(weight.Weight, this.SystemConfig1.DecimalPlaces); - sb.Append(sValue.PadLeft(10, ' ')); + + sb.Append(this.PadLeft(9, Helper.DoubleToString(weight.Weight, this.SystemConfig1.DecimalPlaces))); + sb.Append(" "); sValue = weight.TotalCount.ToString(); sb.Append(sValue.PadLeft(10, ' ')); @@ -9120,7 +9130,7 @@ namespace ITC81DB_0H.Forms structItem.DummyBool26 = false; structItem.DummyBool27 = false; structItem.DummyBool28 = false; - structItem.DummyBool29 = false; + structItem.IsModbus = this.SystemConfig3.IsModbus; structItem.IsPart11 = this.SystemConfig3.IsPart11; structItem.DummyInt1 = 0; @@ -9222,7 +9232,7 @@ namespace ITC81DB_0H.Forms structItem.DummyBool26 = false; structItem.DummyBool27 = false; structItem.DummyBool28 = false; - structItem.DummyBool29 = false; + structItem.IsModbus = item.IsModbus; structItem.IsPart11 = item.IsPart11; structItem.DummyInt1 = 0; @@ -9302,6 +9312,7 @@ namespace ITC81DB_0H.Forms { structItem = (StructSystemConfigurationItem3)this.smartFileIO.ReadStructure(1, typeof(StructSystemConfigurationItem3)); + this.SystemConfig3.IsModbus = structItem.IsModbus; this.SystemConfig3.IsPart11 = structItem.IsPart11; this.SystemConfig3.MULTiJETSlaveAddressCOM1 = structItem.MULTiJETSlaveAddressCOM1; @@ -12684,9 +12695,12 @@ namespace ITC81DB_0H.Forms this.OpenSmartSerialPort2(); // 통신 버퍼용 - this.smartThreadSerialPort2Read.Priority = ThreadPriority.Normal; - this.smartThreadSerialPort2Read.Start(); - //this.smartThreadSerialPort2OverRun.Start(); + if (this.FlagSerialDll == true) + { + this.smartThreadSerialPort2Read.Priority = ThreadPriority.Normal; + this.smartThreadSerialPort2Read.Start(); + //this.smartThreadSerialPort2OverRun.Start(); + } #region Communication if (this.SystemConfig1.SerialCOM1Mode != (int)Define.E_CommMode.f0_None) @@ -13147,7 +13161,28 @@ namespace ITC81DB_0H.Forms if ((receiveDataState == SmartSerialPort.FRAMEDATAREADSTATUS.EMPTY) || (receiveDataState == SmartSerialPort.FRAMEDATAREADSTATUS.FAILDATA)) return; - this.SerialReceiveData(strTemp); + if (this.FlagSerialDll == true) + this.SerialReceiveData(strTemp); + else + { + this.ReceiveData(strTemp); + + // 통신 확인 + if (this.CommunicationCheckCount / 3 == 1) + { + if (this.ChildFormMainDisplay != null) + this.ChildFormMainDisplay.pictureBoxCommunicationStatus.Visible = true; + + this.CommunicationCheckCount = 0; + } + else + { + if (this.ChildFormMainDisplay != null) + this.ChildFormMainDisplay.pictureBoxCommunicationStatus.Visible = false; + + this.CommunicationCheckCount += 1; + } + } } private void smartSerialPort3_OnReadQueueEvent() { @@ -13792,7 +13827,6 @@ namespace ITC81DB_0H.Forms byte[] readByte; string strRecData = ""; byte[] sendDatas = new byte[57]; - byte[] madeDatas = new byte[TotalBytes]; try { @@ -13977,8 +14011,8 @@ namespace ITC81DB_0H.Forms // 로그 if (this.IsCommunicationLogOpen == true) { - this.smartFileCommunicationLog.WriteString(string.Format("Receive TCP ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, BitConverter.ToString(readByte))); - this.smartFileCommunicationLog.WriteString(string.Format("Send TCP ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, BitConverter.ToString(responseData))); + //this.smartFileCommunicationLog.WriteString(string.Format("Receive TCP ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, BitConverter.ToString(readByte))); + //this.smartFileCommunicationLog.WriteString(string.Format("Send TCP ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, BitConverter.ToString(responseData))); } } catch diff --git a/ITC81DB_0H/Forms/FormMainDisplay.cs b/ITC81DB_0H/Forms/FormMainDisplay.cs index 05f7353..27363ba 100644 --- a/ITC81DB_0H/Forms/FormMainDisplay.cs +++ b/ITC81DB_0H/Forms/FormMainDisplay.cs @@ -654,6 +654,22 @@ namespace ITC81DB_0H.Forms if (this.labelUserID.Text != id) this.labelUserID.Text = id; } + public void UpdateMainTitleDisplay(ProductItem pItem) + { + string value = ""; + + value = pItem.Number.ToString(); + if (this.buttonProductNo.Text != value) + this.buttonProductNo.Text = value; + + value = pItem.Name; + if (this.labelProductName.Text != value) + this.labelProductName.Text = value; + + value = pItem.LotNo; + if (this.labelLotNo.Text != value) + this.labelLotNo.Text = value; + } public void UpdateEquipmentStatusDisplay(Define.E_EquipmentStatus status) { if (status == Define.E_EquipmentStatus.Start) @@ -1429,7 +1445,12 @@ namespace ITC81DB_0H.Forms this.ParentForm.CurrentSystemStatus.CurrentDisplay = Define.E_DisplayStore.MainDisplay; this.ParentForm.SetDisplayMode(Define.E_DisplayMode.Normal); - this.ProductChange(this.ParentForm.SystemConfig1.ProductNumber); + #region 순서변경 금지(품번 중량 변경) + this.ParentForm.TransferCurrentProductItem(this.ParentForm.CurrentProductItem); + this.RescaleControl(this.ParentForm.CurrentProductItem); + this.UpdateMainTitleDisplay(this.ParentForm.CurrentProductItem); + //this.SendCommProductChange(this.ParentForm.SystemConfig1.ProductNumber); + #endregion // Log - smartFile Close this.ParentForm.ChildFormMenu.FileClose(); @@ -1465,8 +1486,8 @@ namespace ITC81DB_0H.Forms //this.CurrentDisplay = Define.E_MainDisplayStore.DisplayStartBarGraph; //this.DisplayBottomMain(this.CurrentDisplay); - //this.MainDisplayWeightBigScreen.DisplayRefresh(status); - //this.MainDisplayWeightSmall.DisplayRefresh(status); + this.MainDisplayWeightBigScreen.DisplayRefresh(status); + this.MainDisplayWeightSmall.DisplayRefresh(status); //this.MainDisplayMenu.DisplayRefresh(status); //this.MainDisplayStart.DisplayRefresh(status); //this.MainDisplayFeedback.DisplayRefresh(status); diff --git a/ITC81DB_0H/Version.txt b/ITC81DB_0H/Version.txt index 5271dc3..6d06037 100644 --- a/ITC81DB_0H/Version.txt +++ b/ITC81DB_0H/Version.txt @@ -12,6 +12,14 @@ ⺻ м 跮 */ +@ Ver 3.3.1 by CJY + - 2024.02.07 + - Ver 3.3.0 Modify + - Printer - Test Send ư ߷ + ڸ ̼ + - OFF + īƮ ö ʱ κ + @ Ver 3.3.0 by CJY - 2024.02.01 - Ver 3.2.0 Modify diff --git a/ITC81DB_0H/bin/Release/ITC81DB_2H.exe b/ITC81DB_0H/bin/Release/ITC81DB_2H.exe index 6eafce7..166cc26 100644 Binary files a/ITC81DB_0H/bin/Release/ITC81DB_2H.exe and b/ITC81DB_0H/bin/Release/ITC81DB_2H.exe differ diff --git a/ITC81DB_0H/obj/Release/ITC81DB_2H.exe b/ITC81DB_0H/obj/Release/ITC81DB_2H.exe index 6eafce7..166cc26 100644 Binary files a/ITC81DB_0H/obj/Release/ITC81DB_2H.exe and b/ITC81DB_0H/obj/Release/ITC81DB_2H.exe differ