diff --git a/ITC81DB_0H/Controls/CenterInformation/ControlCenterInforSystem2.cs b/ITC81DB_0H/Controls/CenterInformation/ControlCenterInforSystem2.cs index 6e3b40f..73f026b 100644 --- a/ITC81DB_0H/Controls/CenterInformation/ControlCenterInforSystem2.cs +++ b/ITC81DB_0H/Controls/CenterInformation/ControlCenterInforSystem2.cs @@ -631,7 +631,7 @@ namespace ITC81DB_0H int temp = 0; #region Calibration - this.labelBalanceWeight.Text = Helper.CommunicationWeightValueToString(item.BalanceWeight, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces); + this.labelBalanceWeight.Text = Helper.StringToDecimalPlaces(item.BalanceWeight, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces); if (this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces == 1) this.labelDecimalPoint.Text = "0.0"; else if (this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces == 2) @@ -709,8 +709,10 @@ namespace ITC81DB_0H this.labelIsAutoZeroUsing.Text = "OFF"; break; } - this.labelPlusRange.Text = Helper.RemoveZeroNumberString(item.AutoZeroPlusRange); - this.labelMinusRange.Text = Helper.RemoveZeroNumberString(item.AutoZeroMinusRange); + this.labelPlusRange.Text = Helper.StringToDecimalPlaces(int.Parse(item.AutoZeroPlusRange).ToString(), + this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces); + this.labelMinusRange.Text = Helper.StringToDecimalPlaces(int.Parse(item.AutoZeroMinusRange).ToString(), + this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces); temp = int.Parse(item.AutoZeroVariate); switch (temp) { diff --git a/ITC81DB_0H/Controls/CenterInformation/ControlCenterInforSystem3.cs b/ITC81DB_0H/Controls/CenterInformation/ControlCenterInforSystem3.cs index 143b286..e1d36c7 100644 --- a/ITC81DB_0H/Controls/CenterInformation/ControlCenterInforSystem3.cs +++ b/ITC81DB_0H/Controls/CenterInformation/ControlCenterInforSystem3.cs @@ -108,98 +108,165 @@ namespace ITC81DB_0H } private string ReturnCommunicationModeName(int num) { - if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German) + if (this.ParentForm.ParentForm.SystemConfig2.IsCommunicationOption == true) { - switch (num) + if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German) { - case 0: - return "Keiner"; - case 1: - return "STD1"; - case 2: - return "Fernzugriff"; - case 3: - return "Drucker"; - case 4: - return "imaje9410-1"; - case 5: - return "imaje9028-1"; - case 6: - return "OPT0"; - case 7: - return "imaje9410-2"; - case 8: - return "imaje9028-2"; - case 9: - return "Hitachi"; - case 10: - return "MACSA"; - case 11: - return "Markoprint"; - case 12: - return "alphaJET"; - case 13: - return "VJ1510"; - case 14: - return "OPT1"; - case 15: - return "OPT2"; - case 16: - return "OPC"; - case 17: - return "OPT3"; - case 18: - return "HP-200"; - default: - return "Keiner"; + #region German + switch (num) + { + case 0: + return "Keiner"; + case 1: + return "STD1"; + case 2: + return "Fernzugriff"; + case 3: + return "Drucker"; + case 4: + return "imaje9410-1"; + case 5: + return "imaje9028-1"; + case 6: + return "OPT0"; + case 7: + return "imaje9410-2"; + case 8: + return "imaje9028-2"; + case 9: + return "Hitachi"; + case 10: + return "MACSA"; + case 11: + return "Markoprint"; + case 12: + return "alphaJET"; + case 13: + return "VJ1510"; + case 14: + return "OPT1"; + case 15: + return "OPT2"; + case 16: + return "OPC"; + case 17: + return "OPT3"; + case 18: + return "HP-200"; + case 19: + return "Smart Jet"; + case 20: + return "imaje 9410 OPT3"; + case 22: + return "Modbus"; + case 23: + return "STD2"; + default: + return "Keiner"; + } + #endregion + } + else + { + #region else + switch (num) + { + case 0: + return "None"; + case 1: + return "STD1"; + case 2: + return "Remote"; + case 3: + return "Printer"; + case 4: + return "imaje9410-1"; + case 5: + return "imaje9028-1"; + case 6: + return "OPT0"; + case 7: + return "imaje9410-2"; + case 8: + return "imaje9028-2"; + case 9: + return "Hitachi"; + case 10: + return "MACSA"; + case 11: + return "Markoprint"; + case 12: + return "alphaJET"; + case 13: + return "VJ1510"; + case 14: + return "OPT1"; + case 15: + return "OPT2"; + case 16: + return "OPC"; + case 17: + return "OPT3"; + case 18: + return "HP-200"; + case 19: + return "Smart Jet"; + case 20: + return "imaje 9410 OPT3"; + case 22: + return "Modbus"; + case 23: + return "STD2"; + default: + return "None"; + } + #endregion } } else { - switch (num) + if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German) { - case 0: - return "None"; - case 1: - return "STD1"; - case 2: - return "Remote"; - case 3: - return "Printer"; - case 4: - return "imaje9410-1"; - case 5: - return "imaje9028-1"; - case 6: - return "OPT0"; - case 7: - return "imaje9410-2"; - case 8: - return "imaje9028-2"; - case 9: - return "Hitachi"; - case 10: - return "MACSA"; - case 11: - return "Markoprint"; - case 12: - return "alphaJET"; - case 13: - return "VJ1510"; - case 14: - return "OPT1"; - case 15: - return "OPT2"; - case 16: - return "OPC"; - case 17: - return "OPT3"; - case 18: - return "HP-200"; - default: - return "None"; + #region German + switch (num) + { + case 0: + return "Keiner"; + case 1: + return "STD1"; + case 2: + return "Fernzugriff"; + case 3: + return "Drucker"; + case 4: + return "STD2"; + default: + return "Keiner"; + } + #endregion + } + else + { + #region else + switch (num) + { + case 0: + return "None"; + case 1: + return "STD1"; + case 2: + return "Remote"; + case 3: + return "Printer"; + case 4: + return "STD2"; + default: + return "None"; + } + #endregion } } + } private string ReturnBoolValue(bool bValue) { diff --git a/ITC81DB_0H/Controls/CenterSystem/ControlCenterSystemCalibration.cs b/ITC81DB_0H/Controls/CenterSystem/ControlCenterSystemCalibration.cs index 5d9f4ca..e2b5c27 100644 --- a/ITC81DB_0H/Controls/CenterSystem/ControlCenterSystemCalibration.cs +++ b/ITC81DB_0H/Controls/CenterSystem/ControlCenterSystemCalibration.cs @@ -236,10 +236,7 @@ namespace ITC81DB_0H.Controls case DataStore.WeightStatus.CalWait: // 분동중량 표시 this.IsCalibrationFinish = false; - if (this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces == 1) - this.labelWeight.Text = "-500.0"; - else - this.labelWeight.Text = "-500.00"; + this.labelWeight.Text = string.Format("-{0}", this.labelBalanceWeight.Text); this.labelWeight.ForeColor = this.NormalColor; break; case DataStore.WeightStatus.CalStandby: @@ -279,11 +276,7 @@ namespace ITC81DB_0H.Controls break; case DataStore.WeightStatus.CalBalans: // 분동중량표시 - if (this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces == 1) - this.labelWeight.Text = "-500.0"; - else - this.labelWeight.Text = "-500.00"; - this.labelWeight.ForeColor = this.NormalColor; + this.labelWeight.Text = string.Format("-{0}", this.labelBalanceWeight.Text); this.CalibrationButtonEnable(false, false, true); this.CalibrationPictureBoxVisible(false, false, true); break; @@ -364,7 +357,7 @@ namespace ITC81DB_0H.Controls { string value = ""; - value = Helper.CommunicationWeightValueToString(item.BalanceWeight, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces); + value = Helper.StringToDecimalPlaces(item.BalanceWeight, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces); if (this.labelBalanceWeight.Text != value) this.labelBalanceWeight.Text = value; } diff --git a/ITC81DB_0H/Controls/Etc/ControlConfiEthernetLocalIP.cs b/ITC81DB_0H/Controls/Etc/ControlConfiEthernetLocalIP.cs index 3a6b590..78dd5e7 100644 --- a/ITC81DB_0H/Controls/Etc/ControlConfiEthernetLocalIP.cs +++ b/ITC81DB_0H/Controls/Etc/ControlConfiEthernetLocalIP.cs @@ -532,7 +532,7 @@ namespace ITC81DB_0H.Controls catch { this.ParentForm.ParentForm.smartConfigs.IPSettings.DeviceIP = "192.168.3.10"; - this.ParentForm.ParentForm.smartConfigs.IPSettings.SubNetMask = "255.255.255.255"; + this.ParentForm.ParentForm.smartConfigs.IPSettings.SubNetMask = "255.255.255.0"; this.ParentForm.ParentForm.smartConfigs.IPSettings.GateWay = "192.168.3.1"; this.UpdateLocalIPAddressDisplay(); diff --git a/ITC81DB_0H/DataStore.cs b/ITC81DB_0H/DataStore.cs index 9f96210..b7f58a9 100644 --- a/ITC81DB_0H/DataStore.cs +++ b/ITC81DB_0H/DataStore.cs @@ -2762,7 +2762,7 @@ namespace ITC81DB_0H this.IsCommunicationOption = false; this.IsPingTimerUsing = true; - this.IsEthernetPingTimer = false; + this.IsEthernetPingTimer = true; this.ModbusTCPStartAddress = 10; this.ModbusRTUStartAddressCOM1 = 10; this.ModbusRTUStartAddressCOM3 = 10; @@ -5712,21 +5712,21 @@ namespace ITC81DB_0H #region Method public void Initialization() { - this.BalanceWeight = "0"; + this.BalanceWeight = "2000"; - this.Filter = "8"; - this.JudgmentDelay = "1000"; - this.DoubleDelay = "900"; + this.Filter = "4"; + this.JudgmentDelay = "350"; + this.DoubleDelay = "200"; this.JudgmentNumber = "10"; - this.Speed = "60"; + this.Speed = "70"; this.Dynamic = "1000000"; this.SorterAMode = "0"; - this.SorterADelay = "1"; - this.SorterAOperation = "1000"; + this.SorterADelay = "100"; + this.SorterAOperation = "100"; this.SorterBMode = "0"; - this.SorterBDelay = "1"; - this.SorterBOperation = "1000"; + this.SorterBDelay = "100"; + this.SorterBOperation = "100"; this.DoubleEntry = "0"; this.ExternalInput = "0"; this.ETCNG = "0"; @@ -5737,23 +5737,23 @@ namespace ITC81DB_0H this.TareRange = "0"; this.ExternalOutput1Mode = "0"; - this.ExternalOutput1Delay = "500"; - this.ExternalOutput1Operation = "1000"; + this.ExternalOutput1Delay = "100"; + this.ExternalOutput1Operation = "100"; this.ExternalOutput2Mode = "0"; - this.ExternalOutput2Delay = "500"; - this.ExternalOutput2Operation = "1000"; + this.ExternalOutput2Delay = "100"; + this.ExternalOutput2Operation = "100"; this.ExternalOutput3Mode = "0"; - this.ExternalOutput3Delay = "500"; - this.ExternalOutput3Operation = "1000"; + this.ExternalOutput3Delay = "100"; + this.ExternalOutput3Operation = "100"; this.ExternalOutput4Mode = "0"; - this.ExternalOutput4Delay = "500"; - this.ExternalOutput4Operation = "1000"; + this.ExternalOutput4Delay = "100"; + this.ExternalOutput4Operation = "100"; this.ExternalOutput5Mode = "0"; - this.ExternalOutput5Delay = "500"; - this.ExternalOutput5Operation = "1000"; + this.ExternalOutput5Delay = "100"; + this.ExternalOutput5Operation = "100"; this.ExternalOutput6Mode = "0"; - this.ExternalOutput6Delay = "500"; - this.ExternalOutput6Operation = "1000"; + this.ExternalOutput6Delay = "100"; + this.ExternalOutput6Operation = "100"; this.PhotoB = "1"; this.PI3 = "3"; diff --git a/ITC81DB_0H/Forms/FormMain.cs b/ITC81DB_0H/Forms/FormMain.cs index 79da726..f3c7193 100644 --- a/ITC81DB_0H/Forms/FormMain.cs +++ b/ITC81DB_0H/Forms/FormMain.cs @@ -42,6 +42,7 @@ namespace ITC81DB_0H.Forms public bool IsAlarmOccured; public int UpdateValue; // Modbus - Update 될 때마다 +1 public bool IsOPCModbusUsing; + private int GCCount; private int PingFalseCount; private byte[] ClientSendDatabyteArray; @@ -335,6 +336,7 @@ namespace ITC81DB_0H.Forms this.IsAlarmOccured = false; this.UpdateValue = 0; this.IsOPCModbusUsing = false; + this.GCCount = 0; this.PingFalseCount = 0; this.PingTrueCount = 0; @@ -1335,8 +1337,8 @@ namespace ITC81DB_0H.Forms #region Test 용 통신 로그 fullPath = this.PathDataBackupFolder + "Communicationlog.txt"; this.smartFileCommunicationLog.FilePathName = fullPath; - this.smartFileCommunicationLog.Open(); - this.IsCommunicationLogOpen = true; + //this.smartFileCommunicationLog.Open(); + //this.IsCommunicationLogOpen = true; #endregion #region Error Check 용 통신 로그 @@ -7901,9 +7903,6 @@ namespace ITC81DB_0H.Forms if (null != this.EthernetTcpClient) this.EthernetTcpClient.Close(); - - if (this.IsCommunicationLogOpen == true) - this.smartFileCommunicationLog.WriteString(string.Format("Client ({0:yyyy-MM-dd HH:mm:ss}): Disconnect", DateTime.Now)); } private void EthernetClientReceiveThread() @@ -7938,7 +7937,11 @@ namespace ITC81DB_0H.Forms while (this.IsEthernetThreadStop == false) { - string strRecvMsg = this.EthernetStmReader.ReadLine(); + string strRecvMsg = ""; + char[] datas = new char[12]; + int sum = 0; + + //string strRecvMsg = this.EthernetStmReader.ReadLine(); this.TimerWaitResponseEnabled(false); this.TimerPingDisabled(); @@ -7946,17 +7949,33 @@ namespace ITC81DB_0H.Forms if (this.ResponseFailCount > 0) this.ResponseFailCount = 0; - if (this.IsCommunicationLogOpen == true) - this.smartFileCommunicationLog.WriteString(string.Format("Client Receive ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, strRecvMsg)); + try + { + this.EthernetStmReader.Read(datas, 0, datas.Length); + for (int i = 0; i < datas.Length; i++) + sum += datas[i]; + if (sum == 0) + return; - if (null == strRecvMsg) + strRecvMsg = BitConverter.ToString(Encoding.UTF8.GetBytes(datas)); + + if (this.IsCommunicationLogOpen == true) + this.smartFileCommunicationLog.WriteString(string.Format("EthernetClientReceiveThread Receive ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, strRecvMsg)); + + if (null == strRecvMsg) + { + this.DelegateTextStatusOut(">Server Out"); + this.IsEthernetThreadStop = true; + break; + } + + this.DelegateTextStatusOut(strRecvMsg); + } + catch { this.DelegateTextStatusOut(">Server Out"); this.IsEthernetThreadStop = true; - break; } - - this.DelegateTextStatusOut(strRecvMsg); } } catch @@ -8019,8 +8038,11 @@ namespace ITC81DB_0H.Forms { try { - this.EthernetStmWriter.WriteLine(msg); + this.EthernetStmWriter.Write(msg); this.EthernetStmWriter.Flush(); + + if (this.IsCommunicationLogOpen == true) + this.smartFileCommunicationLog.WriteString(string.Format("EthernetSendMessage Send string ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, msg)); } catch { @@ -8032,8 +8054,11 @@ namespace ITC81DB_0H.Forms { try { - this.EthernetStmWriter.WriteLine(msg); + this.EthernetStmWriter.BaseStream.Write(msg, 0, msg.Length); this.EthernetStmWriter.Flush(); + + if (this.IsCommunicationLogOpen == true) + this.smartFileCommunicationLog.WriteString(string.Format("EthernetSendMessage Send byte[] ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, BitConverter.ToString(msg))); } catch { @@ -8045,8 +8070,11 @@ namespace ITC81DB_0H.Forms { try { - this.EthernetStmWriter.WriteLine(msg); + this.EthernetStmWriter.Write(msg); this.EthernetStmWriter.Flush(); + + if (this.IsCommunicationLogOpen == true) + this.smartFileCommunicationLog.WriteString(string.Format("EthernetSendMessage Send byte ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, msg)); } catch { @@ -12147,6 +12175,15 @@ namespace ITC81DB_0H.Forms } this.ThreadEthernetPing.Join(); + + //if (this.GCCount > 1800) + //{ + // System.GC.Collect(); + // System.GC.WaitForPendingFinalizers(); + // this.GCCount = 0; + //} + //else + // this.GCCount++; } #endregion #endregion diff --git a/ITC81DB_0H/Forms/FormMainDisplay.cs b/ITC81DB_0H/Forms/FormMainDisplay.cs index 5d8ac32..b9eda8d 100644 --- a/ITC81DB_0H/Forms/FormMainDisplay.cs +++ b/ITC81DB_0H/Forms/FormMainDisplay.cs @@ -25,6 +25,8 @@ namespace ITC81DB_0H.Forms ThreadStart ThreadDelegate; Thread ThreadClientConnected; + private int GCCount; + private DataStore.MainDisplayStore CurrentDisplay; public ControlMainDisplayWeightBigScreen MainDisplayWeightBigScreen; @@ -205,6 +207,8 @@ namespace ITC81DB_0H.Forms this.labelUserLevel.Visible = false; this.buttonUser.Visible = false; } + + this.GCCount = 0; } private void DefaultSetting() { @@ -1037,6 +1041,15 @@ namespace ITC81DB_0H.Forms } this.ThreadClientConnected.Join(); + + //if (this.GCCount > 1800) + //{ + // System.GC.Collect(); + // System.GC.WaitForPendingFinalizers(); + // this.GCCount = 0; + //} + //else + // this.GCCount++; } } catch (Exception ex) diff --git a/ITC81DB_0H/Helper.cs b/ITC81DB_0H/Helper.cs index 752770b..8dfc0e7 100644 --- a/ITC81DB_0H/Helper.cs +++ b/ITC81DB_0H/Helper.cs @@ -137,23 +137,6 @@ namespace ITC81DB_0H } } - /// - /// 통신으로 받은 중량 값(소수점 미포함)을 소수점 자리수에 마추어 찍어주는 함수 - /// - /// - /// - /// - public static string CommunicationWeightValueToString(string value, int decimalPlaces) - { - string sValue = ""; - double dValue = 0.0; - - dValue = Helper.StringToWeight(value, decimalPlaces); - sValue = Helper.DoubleToString(dValue, decimalPlaces); - - return sValue; - } - public static DataStore.JudgmentStatus StringToJudgmentStatus(string value) { if (value.Length != 2) diff --git a/ITC81DB_0H/bin/Release/ITC81DB_2H.exe b/ITC81DB_0H/bin/Release/ITC81DB_2H.exe index ec92786..9ced10f 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 ec92786..9ced10f 100644 Binary files a/ITC81DB_0H/obj/Release/ITC81DB_2H.exe and b/ITC81DB_0H/obj/Release/ITC81DB_2H.exe differ