- 끊김감지기능 관련 코드 삭제

master V2.2.0
DESKTOP-999R8N3\CJY 2023-03-06 07:42:06 +09:00
parent e7c63b8a07
commit dde0d636d1
9 changed files with 150 additions and 349 deletions

View File

@ -1236,8 +1236,6 @@ namespace ITC81DB_0H.Controls
if (this.timerServer.Enabled != true)
this.timerServer.Enabled = true;
this.ParentForm.ParentForm.ChildFormMainDisplay.TimerDetectConnected(false);
}
}
else if (this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode == 2)
@ -1257,8 +1255,6 @@ namespace ITC81DB_0H.Controls
if (this.labelServerStatus.Text != ">Stop")
this.labelServerStatus.Text = ">Stop";
this.ParentForm.ParentForm.ChildFormMainDisplay.TimerDetectConnected(false);
}
else if (this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode == 2)
{
@ -1279,11 +1275,13 @@ namespace ITC81DB_0H.Controls
{
this.ParentForm.ParentForm.SystemConfig2.IsDisconnectDetection = true;
this.buttonDisconnectDetection.Text = "Disconnect Detection OFF";
this.ParentForm.ParentForm.IsUsingTimerEthernetPing(true);
}
else
{
this.ParentForm.ParentForm.SystemConfig2.IsDisconnectDetection = false;
this.buttonDisconnectDetection.Text = "Disconnect Detection ON";
this.ParentForm.ParentForm.IsUsingTimerEthernetPing(false);
}
this.ParentForm.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.ParentForm.SystemConfig2);

View File

@ -66,7 +66,7 @@ namespace ITC81DB_0H.Controls
private void DefaultSetting()
{
this.labelSerialNo.Text = this.ParentForm.ParentForm.SystemConfig1.SerialNumber;
this.labelDisplayVer.Text = "2.1.3";
this.labelDisplayVer.Text = "2.2.0";
}
public void UpdateMainBoardVersionDisplay(string version)

View File

@ -44,7 +44,6 @@
this.timeOut = new System.Windows.Forms.Timer();
this.smartTimerUpdate = new SmartX.SmartTimer(this.components);
this.timerEthernetPing = new System.Windows.Forms.Timer();
this.timerWaitResponse = new System.Windows.Forms.Timer();
((System.ComponentModel.ISupportInitialize)(this.smartForm)).BeginInit();
this.SuspendLayout();
//
@ -194,11 +193,6 @@
this.timerEthernetPing.Interval = 2000;
this.timerEthernetPing.Tick += new System.EventHandler(this.timerEthernetPing_Tick);
//
// timerWaitResponse
//
this.timerWaitResponse.Interval = 150;
this.timerWaitResponse.Tick += new System.EventHandler(this.timerWaitResponse_Tick);
//
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@ -230,7 +224,6 @@
private System.Windows.Forms.Timer timeOut;
private SmartX.SmartTimer smartTimerUpdate;
private System.Windows.Forms.Timer timerEthernetPing;
private System.Windows.Forms.Timer timerWaitResponse;
}
}

View File

@ -42,15 +42,10 @@ 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;
private string ClientSendDataString;
private int PingTrueCount;
private int ResponseFailCount;
private bool IsTimerPingEnableTrue;
private bool IsTimerWaitResponseEnableTrue;
#region 통신관련
// OPT2
@ -190,10 +185,6 @@ namespace ITC81DB_0H.Forms
private delegate void TextStatusCallback(string strtext);
private delegate void UIControlCallback(bool bEnable);
private delegate void UIServerStatusCallback(bool bEnable);
// Ethernet Connect단 Thread 처리
ThreadStart ThreadDelegate;
Thread ThreadEthernetPing;
#endregion
#region Constructor
@ -336,15 +327,6 @@ namespace ITC81DB_0H.Forms
this.IsAlarmOccured = false;
this.UpdateValue = 0;
this.IsOPCModbusUsing = false;
this.GCCount = 0;
this.PingFalseCount = 0;
this.PingTrueCount = 0;
this.ResponseFailCount = 0;
this.IsTimerPingEnableTrue = false;
this.IsTimerWaitResponseEnableTrue = false;
this.ThreadDelegate = new ThreadStart(this.EthernetPing);
this.Modbus = new Modbus();
this.Current30000ModbusData = new _30000_ModbusData();
@ -1864,7 +1846,10 @@ namespace ITC81DB_0H.Forms
// 이더넷
if (this.SystemConfig2.EthernetOperationMode == 2)
{
this.IsEthernetTransferData = false;
this.EthernetClientDisconnect();
}
if (this.CurrentSystemStatus.CurrentDisplay == DataStore.DisplayStore.MainDisplay)
{
@ -2204,6 +2189,9 @@ namespace ITC81DB_0H.Forms
if (this.SystemConfig1.IsBarcodeEnable == true && this.CurrentSystemStatus.Equipment == DataStore.EquipmentStatus.Start)
return ret;
if (this.SystemConfig2.EthernetOperationMode == 1 && this.smartTCPMultiServer.IsStart == true)
this.ChildFormMainDisplay.TimerDetectConnected(true);
// Save System File
this.SaveSystemConfigurationFile1(this.SystemConfig1);
// 생산속도 Clear
@ -7799,63 +7787,14 @@ namespace ITC81DB_0H.Forms
#endregion
#region Ethernet
public void ThreadCloseClientIP(string address)
public void IsUsingTimerEthernetPing(bool bValue)
{
this.smartTCPMultiServer.CloseClientIP(address);
}
public void TimerPingEnabled(int interval, bool bValue)
if (this.SystemConfig2.IsDisconnectDetection == true)
{
if (this.SystemConfig2.IsDisconnectDetection == false)
return;
if (bValue == true)
{
if (this.IsTimerPingEnableTrue == false)
{
this.timerEthernetPing.Enabled = false;
this.timerEthernetPing.Interval = interval;
if (this.PingFalseCount > 0)
this.PingFalseCount = 0;
this.timerEthernetPing.Enabled = true;
this.IsTimerPingEnableTrue = true;
}
this.timerEthernetPing.Enabled = bValue;
}
else
{
this.TimerPingDisabled();
}
}
public void TimerPingDisabled()
{
if (this.SystemConfig2.IsDisconnectDetection == false)
return;
if (this.IsTimerPingEnableTrue == true)
{
this.timerEthernetPing.Enabled = false;
this.IsTimerPingEnableTrue = false;
}
}
public void TimerWaitResponseEnabled(bool bValue)
{
if (this.SystemConfig2.IsDisconnectDetection == false)
return;
if (bValue == true)
{
if (this.IsTimerWaitResponseEnableTrue == false)
{
this.timerWaitResponse.Enabled = false;
this.timerWaitResponse.Enabled = true;
this.IsTimerWaitResponseEnableTrue = true;
}
}
else
{
this.timerWaitResponse.Enabled = false;
this.IsTimerWaitResponseEnableTrue = false;
}
}
#region Client
@ -7882,6 +7821,8 @@ namespace ITC81DB_0H.Forms
cpClientThread.IsBackground = true;
cpClientThread.Start();
this.IsUsingTimerEthernetPing(true);
}
catch
{
@ -7890,6 +7831,8 @@ namespace ITC81DB_0H.Forms
}
public void EthernetClientDisconnect()
{
this.IsUsingTimerEthernetPing(false);
this.IsEthernetThreadStop = true;
this.DelegateUISeverStatus(false);
if (null != this.EthernetStmReader)
@ -7941,16 +7884,6 @@ namespace ITC81DB_0H.Forms
char[] datas = new char[12];
int sum = 0;
//string strRecvMsg = this.EthernetStmReader.ReadLine();
this.TimerWaitResponseEnabled(false);
this.TimerPingDisabled();
if (this.ResponseFailCount > 0)
this.ResponseFailCount = 0;
try
{
this.EthernetStmReader.Read(datas, 0, datas.Length);
for (int i = 0; i < datas.Length; i++)
sum += datas[i];
@ -7971,12 +7904,6 @@ namespace ITC81DB_0H.Forms
this.DelegateTextStatusOut(strRecvMsg);
}
catch
{
this.DelegateTextStatusOut(">Server Out");
this.IsEthernetThreadStop = true;
}
}
}
catch
{
@ -8092,7 +8019,6 @@ namespace ITC81DB_0H.Forms
else
{
this.EthernetSendMessage((string)this.EthernetTransferData);
this.TimerWaitResponseEnabled(true);
}
}
public void EthernetWeightData(byte[] bytes)
@ -8105,7 +8031,6 @@ namespace ITC81DB_0H.Forms
else
{
this.EthernetSendMessage((byte[])this.EthernetTransferData);
this.TimerWaitResponseEnabled(true);
}
}
public void EthernetWeightData(byte temp)
@ -8118,7 +8043,6 @@ namespace ITC81DB_0H.Forms
else
{
this.EthernetSendMessage((byte)this.EthernetTransferData);
this.TimerWaitResponseEnabled(true);
}
}
public void EthernetWeightDataForModbus(byte[] bytes)
@ -8131,7 +8055,6 @@ namespace ITC81DB_0H.Forms
else
{
this.EthernetSendMessage(bytes);
this.TimerWaitResponseEnabled(true);
}
}
#endregion
@ -8141,6 +8064,7 @@ namespace ITC81DB_0H.Forms
{
if (this.smartTCPMultiServer.IsStart == false)
{
this.IsUsingTimerEthernetPing(true);
this.ChildFormMenu.CenterConfiEthernet.DisplayLabelLocalPort(false);
this.smartTCPMultiServer.Port = this.SystemConfig2.EthernetLocalPort;
this.smartTCPMultiServer.Start();
@ -8150,6 +8074,7 @@ namespace ITC81DB_0H.Forms
{
if (this.smartTCPMultiServer.IsStart == true)
{
this.IsUsingTimerEthernetPing(false);
this.ChildFormMenu.CenterConfiEthernet.DisplayLabelLocalPort(true);
this.smartTCPMultiServer.Stop();
}
@ -12083,109 +12008,6 @@ namespace ITC81DB_0H.Forms
}
#endregion
#region Thread
private void EthernetPing()
{
bool disconnect = false;
string address = "";
try
{
CIPSetting.PINGRESULTINFO pingResultInfo = new CIPSetting.PINGRESULTINFO();
if (this.SystemConfig2.EthernetOperationMode == 1) // 중량선별기 : Server
{
#region Server
address = this.smartTCPMultiServer.ClientInfoList[0].strIPAddress;
bool bValue = this.smartConfigs.IPSettings.PingIP(address, ref pingResultInfo);
if (bValue == false)
{
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.WriteString(string.Format("EthernetPing 'Server' ({0:yyyy-MM-dd HH:mm:ss}): {1}_Count {2}", DateTime.Now, bValue.ToString(), this.PingFalseCount.ToString()));
if (this.PingFalseCount >= 2)
{
this.PingFalseCount = 0;
if (address != "")
disconnect = this.smartTCPMultiServer.CloseClientIP(address);
this.DelegateUISeverStatus(false);
this.ChildFormMenu.CenterConfiEthernet.DelegateConnectedIPStatusOut("-");
}
else
{
this.PingFalseCount++;
}
}
else
this.PingFalseCount = 0;
#endregion
}
else // 중량선별기 : Client
{
#region Client
bool bValue = this.smartConfigs.IPSettings.PingIP(this.SystemConfig2.EthernetAddress, ref pingResultInfo);
if (bValue == true)
{
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.WriteString(string.Format("EthernetPing 'Client' ({0:yyyy-MM-dd HH:mm:ss}): {1}_Count {2}", DateTime.Now, bValue.ToString(), this.PingTrueCount.ToString()));
if (this.PingTrueCount >= 2)
{
this.TimerPingDisabled();
this.EthernetClientConnect();
this.PingTrueCount = 0;
}
else
{
this.PingTrueCount++;
}
}
else
{
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.WriteString(string.Format("EthernetPing 'Client' ({0:yyyy-MM-dd HH:mm:ss}): Ping False", DateTime.Now));
this.DelegateUISeverStatus(false);
this.ChildFormMenu.CenterConfiEthernet.DelegateConnectedIPStatusOut("-");
this.PingTrueCount = 0;
}
#endregion
}
}
catch
{
#region Catch
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.WriteString(string.Format("EthernetPing ({0:yyyy-MM-dd HH:mm:ss}): Catch", DateTime.Now));
this.DelegateUISeverStatus(false);
this.ChildFormMenu.CenterConfiEthernet.DelegateConnectedIPStatusOut("-");
if (this.SystemConfig2.EthernetOperationMode == 1) // 중량선별기 : Server
this.TimerPingDisabled();
else // 중량선별기 : Client
this.EthernetClientDisconnect();
#endregion
}
this.ThreadEthernetPing.Join();
//if (this.GCCount > 1800)
//{
// System.GC.Collect();
// System.GC.WaitForPendingFinalizers();
// this.GCCount = 0;
//}
//else
// this.GCCount++;
}
#endregion
#endregion
#region Override Member
@ -13574,34 +13396,72 @@ namespace ITC81DB_0H.Forms
this.CollectionBufferWeightData.Clear();
}
}
private void timerWaitResponse_Tick(object sender, EventArgs e)
{
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.WriteString(string.Format("Respons fail ({0:yyyy-MM-dd HH:mm:ss}): Count_{1}", DateTime.Now, this.ResponseFailCount));
if (this.ResponseFailCount >= 2)
{
this.ResponseFailCount = 0;
this.TimerWaitResponseEnabled(false);
this.EthernetClientDisconnect();
this.TimerPingEnabled(1000, true);
}
else
{
this.ResponseFailCount++;
if (this.SystemConfig2.EthernetCommMode == (int)DataStore.EthernetMode.f22_Modbus_TCP)
this.EthernetWeightDataForModbus(this.ClientSendDatabyteArray);
else
this.EthernetWeightData(this.ClientSendDataString);
}
}
private void timerEthernetPing_Tick(object sender, EventArgs e)
{
this.ThreadEthernetPing = new Thread(this.ThreadDelegate);
this.ThreadEthernetPing.Priority = ThreadPriority.Highest;
this.ThreadEthernetPing.Start();
try
{
CIPSetting.PINGRESULTINFO pingResultInfo = new CIPSetting.PINGRESULTINFO();
if (this.SystemConfig2.EthernetOperationMode == 1) // 중량선별기 : Server
{
try
{
bool bValue = this.smartConfigs.IPSettings.PingIP(this.smartTCPMultiServer.ClientInfoList[0].strIPAddress, ref pingResultInfo);
if (bValue == false)
{
this.ChildFormMainDisplay.UpdateEthernetStatusDisplay(false);
this.ChildFormMenu.CenterConfiEthernet.DelegateConnectedIPStatusOut("-");
bool disconnect = this.smartTCPMultiServer.CloseClientIP(this.smartTCPMultiServer.ClientInfoList[0].strIPAddress);
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.WriteString(string.Format("CloseClientIP ({0:yyyy-MM-dd HH:mm:ss}): {1}_{2}", DateTime.Now, disconnect.ToString()));
this.EthernetServerStart();
}
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.WriteString(string.Format("Connection ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, bValue.ToString()));
}
catch
{
this.ChildFormMainDisplay.UpdateEthernetStatusDisplay(false);
this.ChildFormMenu.CenterConfiEthernet.DelegateConnectedIPStatusOut("-");
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.WriteString(string.Format("Error ({0:yyyy-MM-dd HH:mm:ss}): Catch", DateTime.Now));
}
}
else // 중량선별기 : Client
{
try
{
if (this.smartConfigs.IPSettings.PingIP(this.SystemConfig2.EthernetAddress, ref pingResultInfo) == false)
{
this.EthernetClientDisconnect();
this.EthernetClientConnect();
}
}
catch
{
this.DelegateUISeverStatus(false);
this.ChildFormMenu.CenterConfiEthernet.DelegateConnectedIPStatusOut("-");
}
}
}
catch
{
if (this.SystemConfig2.EthernetOperationMode == 1) // 중량선별기 : Server
{
this.ChildFormMainDisplay.UpdateEthernetStatusDisplay(false);
}
else // 중량선별기 : Client
{
this.DelegateUISeverStatus(false);
this.EthernetClientDisconnect();
}
}
}
// 전송지연시간 관련

View File

@ -159,9 +159,6 @@
<metadata name="timerEthernetPing.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>399, 58</value>
</metadata>
<metadata name="timerWaitResponse.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>580, 59</value>
</metadata>
<metadata name="$this.FormFactorShadowProperty" xml:space="preserve">
<value>WEBPAD</value>
</metadata>

View File

@ -21,12 +21,6 @@ namespace ITC81DB_0H.Forms
#region Field
private FormMain m_ParentForm;
// Ethernet Connect단 Thread 처리
ThreadStart ThreadDelegate;
Thread ThreadClientConnected;
private int GCCount;
private DataStore.MainDisplayStore CurrentDisplay;
public ControlMainDisplayWeightBigScreen MainDisplayWeightBigScreen;
@ -207,8 +201,6 @@ namespace ITC81DB_0H.Forms
this.labelUserLevel.Visible = false;
this.buttonUser.Visible = false;
}
this.GCCount = 0;
}
private void DefaultSetting()
{
@ -227,8 +219,6 @@ namespace ITC81DB_0H.Forms
this.MainDisplayAlarm.Visible = false;
this.MainDisplayAlarm.BringToFront();
this.ThreadDelegate = new ThreadStart(this.ClientConnectCheck);
this.buttonPrint.Visible = this.ParentForm.SystemConfig1.IsPrinterEnable;
if (this.ParentForm.SystemConfig1.IsPrintPerProductEnable == true)
this.buttonPrint.ButtonDown();
@ -400,11 +390,13 @@ namespace ITC81DB_0H.Forms
{
if (bValue == true)
{
this.timerClientConnectCheck.Enabled = false;
//this.timerClientConnectCheck.Enabled = false;
if (this.timerClientConnectCheck.Enabled == false)
this.timerClientConnectCheck.Enabled = true;
}
else
{
if (this.timerClientConnectCheck.Enabled == true)
this.timerClientConnectCheck.Enabled = false;
}
}
@ -696,17 +688,6 @@ namespace ITC81DB_0H.Forms
this.MainDisplayWeightBigScreen.UpdateEthernetStatusDisplay(status);
if (this.MainDisplayWeightSmall != null)
this.MainDisplayWeightSmall.UpdateEthernetStatusDisplay(status);
if (status == true)
{
if (this.ParentForm.SystemConfig2.EthernetOperationMode == 1) // 중량선별기 : Server
this.ParentForm.TimerPingEnabled(2000, true);
}
else
{
if (this.ParentForm.SystemConfig2.EthernetOperationMode == 1) // 중량선별기 : Server
this.ParentForm.TimerPingDisabled();
}
}
public void UpdateModbusScreen()
@ -1016,90 +997,57 @@ namespace ITC81DB_0H.Forms
//this.buttonPrint.Enabled = true;
//this.buttonClear.Enabled = true;
}
private void ClientConnectCheck()
{
try
{
if (this.ParentForm.smartTCPMultiServer.IsStart == true)
{
if (this.ParentForm.smartTCPMultiServer.ClientInfoList == null)
{
this.ParentForm.DelegateUISeverStatus(false);
// 로그
if (this.ParentForm.IsCommunicationLogOpen == true)
this.ParentForm.smartFileCommunicationLog.WriteString(string.Format("ClientConnectCheck ({0:yyyy-MM-dd HH:mm:ss}): false", DateTime.Now));
}
else
{
this.ParentForm.DelegateUISeverStatus(true);
// 로그
if (this.ParentForm.IsCommunicationLogOpen == true)
this.ParentForm.smartFileCommunicationLog.WriteString(string.Format("ClientConnectCheck ({0:yyyy-MM-dd HH:mm:ss}): true", DateTime.Now));
}
this.ThreadClientConnected.Join();
//if (this.GCCount > 1800)
//{
// System.GC.Collect();
// System.GC.WaitForPendingFinalizers();
// this.GCCount = 0;
//}
//else
// this.GCCount++;
}
}
catch (Exception ex)
{
FormMain.Exception(ex);
}
}
private void timerClientConnectCheck_Tick(object sender, EventArgs e)
{
//this.ThreadClientConnected = new Thread(this.ThreadDelegate);
//this.ThreadClientConnected.Priority = ThreadPriority.Highest;
//this.ThreadClientConnected.Start();
try
{
if (this.ParentForm.smartTCPMultiServer.IsStart == true)
{
if (this.ParentForm.smartTCPMultiServer.ClientInfoList == null)
{
this.ParentForm.DelegateUISeverStatus(false);
// 로그
if (this.ParentForm.IsCommunicationLogOpen == true)
this.ParentForm.smartFileCommunicationLog.WriteString(string.Format("ClientConnectCheck ({0:yyyy-MM-dd HH:mm:ss}): false", DateTime.Now));
this.UpdateEthernetStatusDisplay(false);
}
else
{
this.ParentForm.DelegateUISeverStatus(true);
// 로그
if (this.ParentForm.IsCommunicationLogOpen == true)
this.ParentForm.smartFileCommunicationLog.WriteString(string.Format("ClientConnectCheck ({0:yyyy-MM-dd HH:mm:ss}): true", DateTime.Now));
this.UpdateEthernetStatusDisplay(true);
}
}
//this.ThreadClientConnected.Join();
//if (this.GCCount > 1800)
//try
//{
// System.GC.Collect();
// System.GC.WaitForPendingFinalizers();
// this.GCCount = 0;
// if (this.ParentForm.smartTCPMultiServer.IsStart == true)
// {
// if (this.ParentForm.smartTCPMultiServer.ClientInfoList == null)
// {
// this.ParentForm.DelegateUISeverStatus(false);
// // 로그
// if (this.ParentForm.IsCommunicationLogOpen == true)
// this.ParentForm.smartFileCommunicationLog.WriteString(string.Format("ClientConnectCheck ({0:yyyy-MM-dd HH:mm:ss}): false", DateTime.Now));
// }
// else
// this.GCCount++;
}
}
catch (Exception ex)
{
FormMain.Exception(ex);
}
// {
// this.ParentForm.DelegateUISeverStatus(true);
// // 로그
// if (this.ParentForm.IsCommunicationLogOpen == true)
// this.ParentForm.smartFileCommunicationLog.WriteString(string.Format("ClientConnectCheck ({0:yyyy-MM-dd HH:mm:ss}): true", DateTime.Now));
// }
// //this.ThreadClientConnected.Join();
// //if (this.GCCount > 1800)
// //{
// // System.GC.Collect();
// // System.GC.WaitForPendingFinalizers();
// // this.GCCount = 0;
// //}
// //else
// // this.GCCount++;
// }
//}
//catch (Exception ex)
//{
// FormMain.Exception(ex);
//}
}
private void pictureBoxIconAlarm_Click(object sender, EventArgs e)

View File

@ -12,6 +12,11 @@
기본형 컨베어 고정밀센서 계량기
*/
@ Ver 2.2.0 by CJY
- 2023.03.06
- Ver 2.1.3 Modify
- 끊김감지기능 관련 코드 삭제
@ Ver 2.1.3 by CJY
- 2023.03.04
- Ver 2.1.2 Modify