- Client 시나리오 정리 완료

main V8.19.1
DESKTOP-999R8N3\CJY 2023-12-28 15:24:51 +09:00
parent dec7152427
commit ea2021197a
16 changed files with 110 additions and 106 deletions

Binary file not shown.

View File

@ -628,8 +628,15 @@ namespace ITC81DB.Controls
#region Printer #region Printer
sb.Append("0001"); sb.Append("0001");
sb.Append(" Pass"); 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("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 #endregion
break; break;
case 4: case 4:

View File

@ -886,7 +886,9 @@ namespace ITC81DB.Controls
#region Printer #region Printer
sb.Append("0001"); sb.Append("0001");
sb.Append(" Pass"); 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("1234567890");
#endregion #endregion
break; break;

View File

@ -79,19 +79,15 @@ namespace ITC81DB.Controls
private void buttonConnect_Click(object sender, EventArgs e) 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) private void buttonDisconnect_Click(object sender, EventArgs e)
{ {
// 이더넷 // 이더넷
if (this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode == 2) this.ParentForm.ParentForm.IsEthernetTransferData = false;
{ this.ParentForm.ParentForm.IsClientConnectTryTimerStart = false;
this.ParentForm.ParentForm.IsEthernetTransferData = false; this.ParentForm.ParentForm.timerClientConnect.Enabled = false;
this.ParentForm.ParentForm.EthernetClientDisconnect(); this.ParentForm.ParentForm.EthernetClientDisconnect();
}
} }
private void labelTimer_Click(object sender, EventArgs e) private void labelTimer_Click(object sender, EventArgs e)
@ -116,15 +112,15 @@ namespace ITC81DB.Controls
} }
private void buttonTimerON_Click(object sender, EventArgs e) 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.timerClientConnect.Interval = int.Parse(this.labelTimer.Text);
this.ParentForm.ParentForm.timerClientConnect.Enabled = true;
this.ParentForm.ParentForm.TimerEnabled(true); this.ParentForm.ParentForm.IsClientConnectTryTimerStart = true;
} }
private void buttonTimerOFF_Click(object sender, EventArgs e) 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 #endregion
} }

View File

@ -338,7 +338,7 @@ namespace ITC81DB
} }
else if (this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode == 2) 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.pictureBoxEthernetDisconnection.Visible = false;
this.pictureBoxEthernetConnection.Visible = true; this.pictureBoxEthernetConnection.Visible = true;

View File

@ -339,7 +339,7 @@ namespace ITC81DB.Controls
} }
else if (this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode == 2) 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.pictureBoxEthernetDisconnection.Visible = false;
this.pictureBoxEthernetConnection.Visible = true; this.pictureBoxEthernetConnection.Visible = true;

View File

@ -215,7 +215,7 @@
// //
// timerClientConnect // timerClientConnect
// //
this.timerClientConnect.Interval = 3000; this.timerClientConnect.Interval = 1000;
this.timerClientConnect.Tick += new System.EventHandler(this.timerClientConnect_Tick); this.timerClientConnect.Tick += new System.EventHandler(this.timerClientConnect_Tick);
// //
// smartFile1 // smartFile1

View File

@ -24,8 +24,8 @@ namespace ITC81DB.Forms
public partial class FormMain : Form public partial class FormMain : Form
{ {
#region Field #region Field
public static string DisplayVersion = "8.19.0"; public static string DisplayVersion = "8.19.1";
public static string ReleaseDate = "2023.12.06"; public static string ReleaseDate = "2023.12.18";
public SmartSplash SmartSplashProgramLoad; public SmartSplash SmartSplashProgramLoad;
public bool IsCommunicationLogOpen; public bool IsCommunicationLogOpen;
@ -212,11 +212,11 @@ namespace ITC81DB.Forms
private int HMEthernet_Step; private int HMEthernet_Step;
// Ethernet // Ethernet
public bool IsEthernetThreadStart = false; public bool IsEthernetClientConnect = false;
public bool IsEthernetClientThreadStart = false;
public bool IsEthernetTransferData; public bool IsEthernetTransferData;
public bool IsEthernetStartMenu = false;
public object EthernetTransferData; public object EthernetTransferData;
public bool IsClientConnectTryTimerStart;
private TcpClient EthernetTcpClient; private TcpClient EthernetTcpClient;
@ -230,6 +230,7 @@ namespace ITC81DB.Forms
private delegate void TextStatusCallback(string strText); private delegate void TextStatusCallback(string strText);
private delegate void UIControlCallback(bool bEnable); private delegate void UIControlCallback(bool bEnable);
private delegate void UIServerStatusCallback(bool bEnable); private delegate void UIServerStatusCallback(bool bEnable);
private delegate void UITimerWorkCallback(bool bEnable);
#endregion #endregion
#region Constructor #region Constructor
@ -389,6 +390,7 @@ namespace ITC81DB.Forms
this.FlagComRetry3th = 0; this.FlagComRetry3th = 0;
this.MissingCommIDCount = 0; this.MissingCommIDCount = 0;
this.CommID = 0; this.CommID = 0;
this.IsClientConnectTryTimerStart = false;
this.QueueCommunicationRecive = new Queue<string>(); this.QueueCommunicationRecive = new Queue<string>();
this.CurrentAlarmList = new AlarmList(); this.CurrentAlarmList = new AlarmList();
@ -579,7 +581,8 @@ namespace ITC81DB.Forms
} }
else if (this.SystemConfig2.EthernetOperationMode == 2) else if (this.SystemConfig2.EthernetOperationMode == 2)
{ {
this.TimerEnabled(true); this.EthernetClientDisconnect();
this.UITimerWork(true);
} }
if (this.SystemConfig2.EthernetCommMode != (int)DataStore.EthernetMode.f0_None) if (this.SystemConfig2.EthernetCommMode != (int)DataStore.EthernetMode.f0_None)
@ -2573,10 +2576,10 @@ namespace ITC81DB.Forms
this.IsBootingComplete = true; this.IsBootingComplete = true;
this.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress.ParameterCount, ""); this.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress.ParameterCount, "");
if (this.SystemConfig2.EthernetOperationMode == 2) //if (this.SystemConfig2.EthernetOperationMode == 2)
{ //{
this.TimerEnabled(true); // this.TimerEnabled(true);
} //}
} }
else else
{ {
@ -4808,10 +4811,11 @@ namespace ITC81DB.Forms
sb.Append(string.Format("{0,8}", weight.JudgmentStatus)); sb.Append(string.Format("{0,8}", weight.JudgmentStatus));
if (isFillZero == true) 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 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(); sValue = weight.TotalCount.ToString();
sb.Append(sValue.PadLeft(10, ' ')); sb.Append(sValue.PadLeft(10, ' '));
@ -8465,28 +8469,20 @@ namespace ITC81DB.Forms
} }
#region Client #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() public void EthernetClientConnect()
{ {
if (this.IsEthernetThreadStart == true)
return; // Online 경우
if (this.SystemConfig2.IsEthernetEnable == false) if (this.SystemConfig2.IsEthernetEnable == false)
{ {
this.TextStatusOut("<Disable"); this.TextStatusOut("<Disable");
return; return;
} }
if (string.Compare(this.SystemConfig2.EthernetAddress, "0.0.0.0") == 0) if (string.Compare(this.SystemConfig2.EthernetAddress, "0.0.0.0") == 0)
{ {
this.TextStatusOut("<Addr Err"); this.TextStatusOut("<Addr Err");
return; return;
} }
if (this.IsEthernetClientConnect == true || this.IsEthernetClientThreadStart == true)
return; // Online 경우
try try
{ {
@ -8496,18 +8492,22 @@ namespace ITC81DB.Forms
cpClientThread.Start(); cpClientThread.Start();
this.IsUsingTimerEthernetPing(true); //this.IsUsingTimerEthernetPing(true);
} }
catch catch
{ {
TextStatusOut(">Thread Error"); this.DelegateUISeverStatus(false);
this.DelegateTextStatusOut(">Thread Error");
this.EthernetClientDisconnect();
} }
} }
public void EthernetClientDisconnect() public void EthernetClientDisconnect()
{ {
this.IsUsingTimerEthernetPing(false); //this.IsUsingTimerEthernetPing(false);
this.DelegateUISeverStatus(false); this.DelegateUISeverStatus(false);
this.DelegateTextStatusOut(">Disconnected");
if (null != this.EthernetStmReader) if (null != this.EthernetStmReader)
this.EthernetStmReader.Close(); this.EthernetStmReader.Close();
@ -8519,11 +8519,6 @@ namespace ITC81DB.Forms
if (null != this.EthernetTcpClient) if (null != this.EthernetTcpClient)
this.EthernetTcpClient.Close(); this.EthernetTcpClient.Close();
this.DelegateTextStatusOut(">Disconnected");
this.IsEthernetThreadStart = false;
this.TimerEnabled(true);
} }
private void EthernetClientReceiveThread() private void EthernetClientReceiveThread()
@ -8531,6 +8526,8 @@ namespace ITC81DB.Forms
int nConnectPort = Convert.ToInt32(this.SystemConfig2.EthernetHostPort); int nConnectPort = Convert.ToInt32(this.SystemConfig2.EthernetHostPort);
try try
{ {
this.IsEthernetClientThreadStart = true;
this.DelegateTextStatusOut(">Now Connecting.."); this.DelegateTextStatusOut(">Now Connecting..");
this.EthernetTcpClient = new TcpClient(this.SystemConfig2.EthernetAddress, nConnectPort); this.EthernetTcpClient = new TcpClient(this.SystemConfig2.EthernetAddress, nConnectPort);
@ -8540,9 +8537,7 @@ namespace ITC81DB.Forms
this.DelegateUISeverStatus(true); this.DelegateUISeverStatus(true);
this.DelegateTextStatusOut(">Connected Server"); this.DelegateTextStatusOut(">Connected Server");
this.DelegateUITimerWork(false);
this.IsEthernetThreadStart = true;
this.TimerEnabled(false);
// 판정 데이터 전송 // 판정 데이터 전송
if (this.IsEthernetTransferData == true) if (this.IsEthernetTransferData == true)
@ -8557,50 +8552,55 @@ namespace ITC81DB.Forms
this.DelegateTransferData((byte)this.EthernetTransferData); this.DelegateTransferData((byte)this.EthernetTransferData);
} }
while (this.IsEthernetThreadStart == true) while (this.IsEthernetClientConnect == true)
{ {
string strRecvMsg = this.EthernetStmReader.ReadLine(); string strRecvMsg = this.EthernetStmReader.ReadLine();
if (null == strRecvMsg) if (null == strRecvMsg)
{
this.DelegateTextStatusOut(">Server Out");
this.IsEthernetThreadStart = false;
this.TimerEnabled(true);
break; break;
}
this.DelegateTextStatusOut(strRecvMsg); this.DelegateTextStatusOut(strRecvMsg);
} }
this.DelegateTextStatusOut(">Server Out");
this.EthernetClientDisconnect();
this.DelegateUITimerWork(true);
} }
catch catch
{
this.DelegateTextStatusOut(">Connect Fail !");
}
finally
{ {
this.DelegateUISeverStatus(false); this.DelegateUISeverStatus(false);
this.DelegateTextStatusOut(">Disconnected");
if (null != this.EthernetStmReader)
this.EthernetStmReader.Close();
if (null != this.EthernetStmWriter) this.DelegateTextStatusOut(">Connect Fail !");
this.EthernetStmWriter.Close();
if (null != this.EthernetNetStream) this.EthernetClientDisconnect();
this.EthernetNetStream.Close(); this.DelegateUITimerWork(true);
if (null != this.EthernetTcpClient)
this.EthernetTcpClient.Close();
this.IsEthernetThreadStart = false;
this.TimerEnabled(true);
} }
this.IsEthernetClientThreadStart = false;
return; 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) private void UIServerStatus(bool status)
{ {
this.ChildFormMainDisplay.UpdateEthernetStatusDisplay(status); this.ChildFormMainDisplay.UpdateEthernetStatusDisplay(status);
@ -8612,8 +8612,15 @@ namespace ITC81DB.Forms
private void TextStatusOut(string value) private void TextStatusOut(string value)
{ {
if (value.Contains(">Connected Server") == true)
this.IsEthernetClientConnect = true;
else
this.IsEthernetClientConnect = false;
if (this.ChildFormMenu.CenterConfiEthernet != null) if (this.ChildFormMenu.CenterConfiEthernet != null)
this.ChildFormMenu.CenterConfiEthernet.UpdateEthernetStatusDisplay(value); 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) private void DelegateTextStatusOut(string value)
{ {
@ -8642,7 +8649,6 @@ namespace ITC81DB.Forms
catch catch
{ {
this.DelegateUISeverStatus(false); this.DelegateUISeverStatus(false);
this.DelegateTextStatusOut("> Disconnect");
} }
} }
public void EthernetSendMessage(byte[] msg) public void EthernetSendMessage(byte[] msg)
@ -8655,7 +8661,6 @@ namespace ITC81DB.Forms
catch catch
{ {
this.DelegateUISeverStatus(false); this.DelegateUISeverStatus(false);
this.DelegateTextStatusOut("> Disconnect");
} }
} }
public void EthernetSendMessage(byte msg) public void EthernetSendMessage(byte msg)
@ -8668,7 +8673,6 @@ namespace ITC81DB.Forms
catch catch
{ {
this.DelegateUISeverStatus(false); this.DelegateUISeverStatus(false);
this.DelegateTextStatusOut("> Disconnect");
} }
} }
public void EthernetWeightData(string strTemp) public void EthernetWeightData(string strTemp)
@ -8678,13 +8682,10 @@ namespace ITC81DB.Forms
try try
{ {
if (this.IsEthernetThreadStart == false) if (this.IsEthernetClientConnect == false)
{
this.EthernetClientConnect(); this.EthernetClientConnect();
this.EthernetSendMessage((string)this.EthernetTransferData);
} this.EthernetSendMessage((string)this.EthernetTransferData);
else
this.EthernetSendMessage((string)this.EthernetTransferData);
} }
catch catch
{ {
@ -8698,13 +8699,10 @@ namespace ITC81DB.Forms
try try
{ {
if (this.IsEthernetThreadStart == false) if (this.IsEthernetClientConnect == false)
{
this.EthernetClientConnect(); this.EthernetClientConnect();
this.EthernetSendMessage(bytes);
} this.EthernetSendMessage(bytes);
else
this.EthernetSendMessage(bytes);
} }
catch catch
{ {
@ -8718,13 +8716,10 @@ namespace ITC81DB.Forms
try try
{ {
if (this.IsEthernetThreadStart == false) if (this.IsEthernetClientConnect == false)
{
this.EthernetClientConnect(); this.EthernetClientConnect();
this.EthernetSendMessage(bytes);
} this.EthernetSendMessage(bytes);
else
this.EthernetSendMessage(bytes);
} }
catch catch
{ {
@ -16186,9 +16181,14 @@ namespace ITC81DB.Forms
private void timerClientConnect_Tick(object sender, EventArgs e) 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(); this.EthernetClientConnect();
//Console.Write("\n" + string.Format("{0:yyyy-MM-dd HH:mm:ss}: {1}", DateTime.Now, "timerClientConnect - Try connect"));
} }
} }

View File

@ -21,7 +21,7 @@ namespace ITC81DB.Forms
#region Field #region Field
private FormMain m_ParentForm; private FormMain m_ParentForm;
private DataStore.MainDisplayStore CurrentDisplay; public DataStore.MainDisplayStore CurrentDisplay;
public ControlMainAlarm MainAlarm; public ControlMainAlarm MainAlarm;
public ControlMainAverageTracking MainAverageTracking; public ControlMainAverageTracking MainAverageTracking;
@ -1095,8 +1095,6 @@ namespace ITC81DB.Forms
} }
public void DisplayBottomMain(DataStore.MainDisplayStore main) public void DisplayBottomMain(DataStore.MainDisplayStore main)
{ {
this.ParentForm.IsEthernetStartMenu = false;
switch (main) switch (main)
{ {
case DataStore.MainDisplayStore.SubMenu: case DataStore.MainDisplayStore.SubMenu:
@ -1106,7 +1104,6 @@ namespace ITC81DB.Forms
this.MainWeightSmallScreen.BringToFront(); this.MainWeightSmallScreen.BringToFront();
break; break;
case DataStore.MainDisplayStore.StartMenu: case DataStore.MainDisplayStore.StartMenu:
this.ParentForm.IsEthernetStartMenu = true;
this.UpdateDisplayMenuButton(DataStore.MainDisplayStore.StartMenu); this.UpdateDisplayMenuButton(DataStore.MainDisplayStore.StartMenu);
this.MainStartMenu.DisplayRefresh(this.ParentForm.CurrentSystemStatus); this.MainStartMenu.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
this.MainStartMenu.BringToFront(); this.MainStartMenu.BringToFront();
@ -1239,7 +1236,8 @@ namespace ITC81DB.Forms
this.DisplayBottomMain(this.CurrentDisplay); this.DisplayBottomMain(this.CurrentDisplay);
this.ParentForm.TimerEnabled(true); if (this.ParentForm.SystemConfig2.EthernetOperationMode == 2)
this.ParentForm.UITimerWork(true);
//this.CurrentDisplay = DataStore.MainDisplayStore.DisplayStartBarGraph; //this.CurrentDisplay = DataStore.MainDisplayStore.DisplayStartBarGraph;
//this.DisplayBottomMain(this.CurrentDisplay); //this.DisplayBottomMain(this.CurrentDisplay);
@ -1569,7 +1567,8 @@ namespace ITC81DB.Forms
{ {
if (this.ParentForm.CurrentSystemStatus.Equipment == DataStore.EquipmentStatus.Stop) 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); this.ParentForm.ChildFormMenu.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormMenu); ((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormMenu);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.