diff --git a/ITC81DB.suo b/ITC81DB.suo index d67d956..d9926f0 100644 Binary files a/ITC81DB.suo and b/ITC81DB.suo differ diff --git a/ITC81DB/Controls/CenterConfiguration/ControlCenterConfiEthernet.cs b/ITC81DB/Controls/CenterConfiguration/ControlCenterConfiEthernet.cs index 40dfe3c..0a23fea 100644 --- a/ITC81DB/Controls/CenterConfiguration/ControlCenterConfiEthernet.cs +++ b/ITC81DB/Controls/CenterConfiguration/ControlCenterConfiEthernet.cs @@ -628,8 +628,15 @@ namespace ITC81DB.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"); + //sb.Append(Helper.StringZeroFillDigits4(this.ParentForm.ParentForm.CurrentProductItem.Number.ToString())); + //sb.Append(" Empty"); + //sb.Append(this.ParentForm.ParentForm.PadLeft(10, Helper.DoubleToString + // (this.ParentForm.ParentForm.CurrentWeightData.Weight, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces))); + //sb.Append("Balance".PadLeft(10, ' ')); #endregion break; case 4: diff --git a/ITC81DB/Controls/CenterConfiguration/ControlCenterConfiSerial.cs b/ITC81DB/Controls/CenterConfiguration/ControlCenterConfiSerial.cs index c80441a..62cf418 100644 --- a/ITC81DB/Controls/CenterConfiguration/ControlCenterConfiSerial.cs +++ b/ITC81DB/Controls/CenterConfiguration/ControlCenterConfiSerial.cs @@ -886,7 +886,9 @@ namespace ITC81DB.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/Controls/MainDisplay/ControlMainStartMenu.cs b/ITC81DB/Controls/MainDisplay/ControlMainStartMenu.cs index 93f1f2f..5859175 100644 --- a/ITC81DB/Controls/MainDisplay/ControlMainStartMenu.cs +++ b/ITC81DB/Controls/MainDisplay/ControlMainStartMenu.cs @@ -79,19 +79,15 @@ namespace ITC81DB.Controls private void buttonConnect_Click(object sender, EventArgs e) { // 이더넷 - if (this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode == 2) - { - this.ParentForm.ParentForm.EthernetClientConnect(); - } + this.ParentForm.ParentForm.EthernetClientConnect(); } private void buttonDisconnect_Click(object sender, EventArgs e) { // 이더넷 - if (this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode == 2) - { - this.ParentForm.ParentForm.IsEthernetTransferData = false; - this.ParentForm.ParentForm.EthernetClientDisconnect(); - } + this.ParentForm.ParentForm.IsEthernetTransferData = false; + this.ParentForm.ParentForm.IsClientConnectTryTimerStart = false; + this.ParentForm.ParentForm.timerClientConnect.Enabled = false; + this.ParentForm.ParentForm.EthernetClientDisconnect(); } private void labelTimer_Click(object sender, EventArgs e) @@ -116,15 +112,15 @@ namespace ITC81DB.Controls } private void buttonTimerON_Click(object sender, EventArgs e) { - this.ParentForm.ParentForm.TimerEnabled(false); - + this.ParentForm.ParentForm.timerClientConnect.Enabled = false; this.ParentForm.ParentForm.timerClientConnect.Interval = int.Parse(this.labelTimer.Text); - - this.ParentForm.ParentForm.TimerEnabled(true); + this.ParentForm.ParentForm.timerClientConnect.Enabled = true; + this.ParentForm.ParentForm.IsClientConnectTryTimerStart = true; } private void buttonTimerOFF_Click(object sender, EventArgs e) { - this.ParentForm.ParentForm.TimerEnabled(false); + this.ParentForm.ParentForm.timerClientConnect.Enabled = false; + this.ParentForm.ParentForm.IsClientConnectTryTimerStart = false; } #endregion } diff --git a/ITC81DB/Controls/MainDisplay/ControlMainWeightBigScreen.cs b/ITC81DB/Controls/MainDisplay/ControlMainWeightBigScreen.cs index 239ca54..d2e93be 100644 --- a/ITC81DB/Controls/MainDisplay/ControlMainWeightBigScreen.cs +++ b/ITC81DB/Controls/MainDisplay/ControlMainWeightBigScreen.cs @@ -338,7 +338,7 @@ namespace ITC81DB } else if (this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode == 2) { - if (this.ParentForm.ParentForm.IsEthernetThreadStart == true) + if (this.ParentForm.ParentForm.IsEthernetClientConnect == true) { this.pictureBoxEthernetDisconnection.Visible = false; this.pictureBoxEthernetConnection.Visible = true; diff --git a/ITC81DB/Controls/MainDisplay/ControlMainWeightSmallScreen.cs b/ITC81DB/Controls/MainDisplay/ControlMainWeightSmallScreen.cs index caaa566..1db77ff 100644 --- a/ITC81DB/Controls/MainDisplay/ControlMainWeightSmallScreen.cs +++ b/ITC81DB/Controls/MainDisplay/ControlMainWeightSmallScreen.cs @@ -339,7 +339,7 @@ namespace ITC81DB.Controls } else if (this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode == 2) { - if (this.ParentForm.ParentForm.IsEthernetThreadStart == true) + if (this.ParentForm.ParentForm.IsEthernetClientConnect == true) { this.pictureBoxEthernetDisconnection.Visible = false; this.pictureBoxEthernetConnection.Visible = true; diff --git a/ITC81DB/Forms/FormMain.Designer.cs b/ITC81DB/Forms/FormMain.Designer.cs index 1c1d406..cd79faf 100644 --- a/ITC81DB/Forms/FormMain.Designer.cs +++ b/ITC81DB/Forms/FormMain.Designer.cs @@ -215,7 +215,7 @@ // // timerClientConnect // - this.timerClientConnect.Interval = 3000; + this.timerClientConnect.Interval = 1000; this.timerClientConnect.Tick += new System.EventHandler(this.timerClientConnect_Tick); // // smartFile1 diff --git a/ITC81DB/Forms/FormMain.cs b/ITC81DB/Forms/FormMain.cs index 95f8591..4d5816e 100644 --- a/ITC81DB/Forms/FormMain.cs +++ b/ITC81DB/Forms/FormMain.cs @@ -24,8 +24,8 @@ namespace ITC81DB.Forms public partial class FormMain : Form { #region Field - public static string DisplayVersion = "8.19.0"; - public static string ReleaseDate = "2023.12.06"; + public static string DisplayVersion = "8.19.1"; + public static string ReleaseDate = "2023.12.18"; public SmartSplash SmartSplashProgramLoad; public bool IsCommunicationLogOpen; @@ -212,11 +212,11 @@ namespace ITC81DB.Forms private int HMEthernet_Step; // Ethernet - public bool IsEthernetThreadStart = false; + public bool IsEthernetClientConnect = false; + public bool IsEthernetClientThreadStart = false; public bool IsEthernetTransferData; - public bool IsEthernetStartMenu = false; - public object EthernetTransferData; + public bool IsClientConnectTryTimerStart; private TcpClient EthernetTcpClient; @@ -230,6 +230,7 @@ namespace ITC81DB.Forms private delegate void TextStatusCallback(string strText); private delegate void UIControlCallback(bool bEnable); private delegate void UIServerStatusCallback(bool bEnable); + private delegate void UITimerWorkCallback(bool bEnable); #endregion #region Constructor @@ -389,6 +390,7 @@ namespace ITC81DB.Forms this.FlagComRetry3th = 0; this.MissingCommIDCount = 0; this.CommID = 0; + this.IsClientConnectTryTimerStart = false; this.QueueCommunicationRecive = new Queue(); this.CurrentAlarmList = new AlarmList(); @@ -579,7 +581,8 @@ namespace ITC81DB.Forms } else if (this.SystemConfig2.EthernetOperationMode == 2) { - this.TimerEnabled(true); + this.EthernetClientDisconnect(); + this.UITimerWork(true); } if (this.SystemConfig2.EthernetCommMode != (int)DataStore.EthernetMode.f0_None) @@ -2573,10 +2576,10 @@ namespace ITC81DB.Forms this.IsBootingComplete = true; this.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress.ParameterCount, ""); - if (this.SystemConfig2.EthernetOperationMode == 2) - { - this.TimerEnabled(true); - } + //if (this.SystemConfig2.EthernetOperationMode == 2) + //{ + // this.TimerEnabled(true); + //} } else { @@ -4808,10 +4811,11 @@ namespace ITC81DB.Forms sb.Append(string.Format("{0,8}", weight.JudgmentStatus)); if (isFillZero == true) - sb.Append(Helper.StringZeroFillDigits10(Helper.DoubleToString(weight.Weight, this.SystemConfig1.DecimalPlaces))); + sb.Append(Helper.StringZeroFillDigits9(Helper.DoubleToString(weight.Weight, this.SystemConfig1.DecimalPlaces))); else - sb.Append(this.PadLeft(10, Helper.DoubleToString(weight.Weight, this.SystemConfig1.DecimalPlaces))); + sb.Append(this.PadLeft(9, Helper.DoubleToString(weight.Weight, this.SystemConfig1.DecimalPlaces))); + sb.Append(" "); sValue = weight.TotalCount.ToString(); sb.Append(sValue.PadLeft(10, ' ')); @@ -8465,28 +8469,20 @@ namespace ITC81DB.Forms } #region Client - public void TimerEnabled(bool bValue) - { - // if (this.CurrentSystemStatus.CurrentDisplay == DataStore.DisplayStore.MainDisplay) - // if (this.IsEthernetStartMenu == false) - this.timerClientConnect.Enabled = bValue; - } - public void EthernetClientConnect() { - if (this.IsEthernetThreadStart == true) - return; // Online 경우 if (this.SystemConfig2.IsEthernetEnable == false) { this.TextStatusOut("Thread Error"); + this.DelegateUISeverStatus(false); + this.DelegateTextStatusOut(">Thread Error"); + + this.EthernetClientDisconnect(); } } public void EthernetClientDisconnect() { - this.IsUsingTimerEthernetPing(false); - + //this.IsUsingTimerEthernetPing(false); this.DelegateUISeverStatus(false); + this.DelegateTextStatusOut(">Disconnected"); + if (null != this.EthernetStmReader) this.EthernetStmReader.Close(); @@ -8519,11 +8519,6 @@ namespace ITC81DB.Forms if (null != this.EthernetTcpClient) this.EthernetTcpClient.Close(); - - this.DelegateTextStatusOut(">Disconnected"); - - this.IsEthernetThreadStart = false; - this.TimerEnabled(true); } private void EthernetClientReceiveThread() @@ -8531,6 +8526,8 @@ namespace ITC81DB.Forms int nConnectPort = Convert.ToInt32(this.SystemConfig2.EthernetHostPort); try { + this.IsEthernetClientThreadStart = true; + this.DelegateTextStatusOut(">Now Connecting.."); this.EthernetTcpClient = new TcpClient(this.SystemConfig2.EthernetAddress, nConnectPort); @@ -8540,9 +8537,7 @@ namespace ITC81DB.Forms this.DelegateUISeverStatus(true); this.DelegateTextStatusOut(">Connected Server"); - - this.IsEthernetThreadStart = true; - this.TimerEnabled(false); + this.DelegateUITimerWork(false); // 판정 데이터 전송 if (this.IsEthernetTransferData == true) @@ -8557,50 +8552,55 @@ namespace ITC81DB.Forms this.DelegateTransferData((byte)this.EthernetTransferData); } - while (this.IsEthernetThreadStart == true) + while (this.IsEthernetClientConnect == true) { string strRecvMsg = this.EthernetStmReader.ReadLine(); if (null == strRecvMsg) - { - this.DelegateTextStatusOut(">Server Out"); - - this.IsEthernetThreadStart = false; - this.TimerEnabled(true); - break; - } this.DelegateTextStatusOut(strRecvMsg); } + + this.DelegateTextStatusOut(">Server Out"); + + this.EthernetClientDisconnect(); + this.DelegateUITimerWork(true); } catch - { - this.DelegateTextStatusOut(">Connect Fail !"); - } - finally { this.DelegateUISeverStatus(false); - this.DelegateTextStatusOut(">Disconnected"); - if (null != this.EthernetStmReader) - this.EthernetStmReader.Close(); - if (null != this.EthernetStmWriter) - this.EthernetStmWriter.Close(); + this.DelegateTextStatusOut(">Connect Fail !"); - if (null != this.EthernetNetStream) - this.EthernetNetStream.Close(); - - if (null != this.EthernetTcpClient) - this.EthernetTcpClient.Close(); - - this.IsEthernetThreadStart = false; - this.TimerEnabled(true); + this.EthernetClientDisconnect(); + this.DelegateUITimerWork(true); } + this.IsEthernetClientThreadStart = false; + return; } + public void UITimerWork(bool status) + { + if (this.CurrentSystemStatus.CurrentDisplay == DataStore.DisplayStore.MainDisplay + && this.ChildFormMainDisplay.CurrentDisplay != DataStore.MainDisplayStore.StartMenu) + { + if (this.IsClientConnectTryTimerStart != status) + { + this.timerClientConnect.Enabled = status; + this.IsClientConnectTryTimerStart = status; + + //Console.Write("\n" + string.Format("{0:yyyy-MM-dd HH:mm:ss}: {1}", DateTime.Now, status.ToString())); + } + } + } + private void DelegateUITimerWork(bool status) + { + this.Invoke(new UITimerWorkCallback(this.UITimerWork), status); + } + private void UIServerStatus(bool status) { this.ChildFormMainDisplay.UpdateEthernetStatusDisplay(status); @@ -8612,8 +8612,15 @@ namespace ITC81DB.Forms private void TextStatusOut(string value) { + if (value.Contains(">Connected Server") == true) + this.IsEthernetClientConnect = true; + else + this.IsEthernetClientConnect = false; + if (this.ChildFormMenu.CenterConfiEthernet != null) this.ChildFormMenu.CenterConfiEthernet.UpdateEthernetStatusDisplay(value); + + //Console.Write("\n" + string.Format("{0:yyyy-MM-dd HH:mm:ss}: {1}", DateTime.Now, value)); } private void DelegateTextStatusOut(string value) { @@ -8642,7 +8649,6 @@ namespace ITC81DB.Forms catch { this.DelegateUISeverStatus(false); - this.DelegateTextStatusOut("> Disconnect"); } } public void EthernetSendMessage(byte[] msg) @@ -8655,7 +8661,6 @@ namespace ITC81DB.Forms catch { this.DelegateUISeverStatus(false); - this.DelegateTextStatusOut("> Disconnect"); } } public void EthernetSendMessage(byte msg) @@ -8668,7 +8673,6 @@ namespace ITC81DB.Forms catch { this.DelegateUISeverStatus(false); - this.DelegateTextStatusOut("> Disconnect"); } } public void EthernetWeightData(string strTemp) @@ -8678,13 +8682,10 @@ namespace ITC81DB.Forms try { - if (this.IsEthernetThreadStart == false) - { + if (this.IsEthernetClientConnect == false) this.EthernetClientConnect(); - this.EthernetSendMessage((string)this.EthernetTransferData); - } - else - this.EthernetSendMessage((string)this.EthernetTransferData); + + this.EthernetSendMessage((string)this.EthernetTransferData); } catch { @@ -8698,13 +8699,10 @@ namespace ITC81DB.Forms try { - if (this.IsEthernetThreadStart == false) - { + if (this.IsEthernetClientConnect == false) this.EthernetClientConnect(); - this.EthernetSendMessage(bytes); - } - else - this.EthernetSendMessage(bytes); + + this.EthernetSendMessage(bytes); } catch { @@ -8718,13 +8716,10 @@ namespace ITC81DB.Forms try { - if (this.IsEthernetThreadStart == false) - { + if (this.IsEthernetClientConnect == false) this.EthernetClientConnect(); - this.EthernetSendMessage(bytes); - } - else - this.EthernetSendMessage(bytes); + + this.EthernetSendMessage(bytes); } catch { @@ -16186,9 +16181,14 @@ namespace ITC81DB.Forms private void timerClientConnect_Tick(object sender, EventArgs e) { - if (this.IsEthernetThreadStart == false) + this.timerClientConnect.Enabled = false; + this.IsClientConnectTryTimerStart = false; + + if (this.IsEthernetClientConnect == false) { this.EthernetClientConnect(); + + //Console.Write("\n" + string.Format("{0:yyyy-MM-dd HH:mm:ss}: {1}", DateTime.Now, "timerClientConnect - Try connect")); } } diff --git a/ITC81DB/Forms/FormMainDisplay.cs b/ITC81DB/Forms/FormMainDisplay.cs index 840ef83..983d6ac 100644 --- a/ITC81DB/Forms/FormMainDisplay.cs +++ b/ITC81DB/Forms/FormMainDisplay.cs @@ -21,7 +21,7 @@ namespace ITC81DB.Forms #region Field private FormMain m_ParentForm; - private DataStore.MainDisplayStore CurrentDisplay; + public DataStore.MainDisplayStore CurrentDisplay; public ControlMainAlarm MainAlarm; public ControlMainAverageTracking MainAverageTracking; @@ -1095,8 +1095,6 @@ namespace ITC81DB.Forms } public void DisplayBottomMain(DataStore.MainDisplayStore main) { - this.ParentForm.IsEthernetStartMenu = false; - switch (main) { case DataStore.MainDisplayStore.SubMenu: @@ -1106,7 +1104,6 @@ namespace ITC81DB.Forms this.MainWeightSmallScreen.BringToFront(); break; case DataStore.MainDisplayStore.StartMenu: - this.ParentForm.IsEthernetStartMenu = true; this.UpdateDisplayMenuButton(DataStore.MainDisplayStore.StartMenu); this.MainStartMenu.DisplayRefresh(this.ParentForm.CurrentSystemStatus); this.MainStartMenu.BringToFront(); @@ -1239,7 +1236,8 @@ namespace ITC81DB.Forms this.DisplayBottomMain(this.CurrentDisplay); - this.ParentForm.TimerEnabled(true); + if (this.ParentForm.SystemConfig2.EthernetOperationMode == 2) + this.ParentForm.UITimerWork(true); //this.CurrentDisplay = DataStore.MainDisplayStore.DisplayStartBarGraph; //this.DisplayBottomMain(this.CurrentDisplay); @@ -1569,7 +1567,8 @@ namespace ITC81DB.Forms { if (this.ParentForm.CurrentSystemStatus.Equipment == DataStore.EquipmentStatus.Stop) { - this.ParentForm.TimerEnabled(false); + if (this.ParentForm.SystemConfig2.EthernetOperationMode == 2) + this.ParentForm.UITimerWork(false); this.ParentForm.ChildFormMenu.DisplayRefresh(this.ParentForm.CurrentSystemStatus); ((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormMenu); diff --git a/ITC81DB/Version.txt b/ITC81DB/Version.txt index b1736b0..0fbe14f 100644 Binary files a/ITC81DB/Version.txt and b/ITC81DB/Version.txt differ diff --git a/ITC81DB/bin/Release/ITC81DB.exe b/ITC81DB/bin/Release/ITC81DB.exe index bca555c..b70120b 100644 Binary files a/ITC81DB/bin/Release/ITC81DB.exe and b/ITC81DB/bin/Release/ITC81DB.exe differ diff --git a/ITC81DB/bin/Release/ITC81DB.pdb b/ITC81DB/bin/Release/ITC81DB.pdb index 3d17dfd..22c0de1 100644 Binary files a/ITC81DB/bin/Release/ITC81DB.pdb and b/ITC81DB/bin/Release/ITC81DB.pdb differ diff --git a/ITC81DB/obj/Release/ITC81DB.csproj.GenerateResource.Cache b/ITC81DB/obj/Release/ITC81DB.csproj.GenerateResource.Cache index 4c635ae..38a7d8b 100644 Binary files a/ITC81DB/obj/Release/ITC81DB.csproj.GenerateResource.Cache and b/ITC81DB/obj/Release/ITC81DB.csproj.GenerateResource.Cache differ diff --git a/ITC81DB/obj/Release/ITC81DB.exe b/ITC81DB/obj/Release/ITC81DB.exe index bca555c..b70120b 100644 Binary files a/ITC81DB/obj/Release/ITC81DB.exe and b/ITC81DB/obj/Release/ITC81DB.exe differ diff --git a/ITC81DB/obj/Release/ITC81DB.pdb b/ITC81DB/obj/Release/ITC81DB.pdb index 3d17dfd..22c0de1 100644 Binary files a/ITC81DB/obj/Release/ITC81DB.pdb and b/ITC81DB/obj/Release/ITC81DB.pdb differ diff --git a/ITC81DB_ImageDll/ITC81DB_ImageDll/obj/Release/Refactor/ITC81DB_ImageDll.dll b/ITC81DB_ImageDll/ITC81DB_ImageDll/obj/Release/Refactor/ITC81DB_ImageDll.dll index edb1f16..506d22c 100644 Binary files a/ITC81DB_ImageDll/ITC81DB_ImageDll/obj/Release/Refactor/ITC81DB_ImageDll.dll and b/ITC81DB_ImageDll/ITC81DB_ImageDll/obj/Release/Refactor/ITC81DB_ImageDll.dll differ