INT_PT002/INT_PT002/Forms/FormMainDisplay4.cs

1267 lines
50 KiB
C#

using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using SmartX;
using INT_PT002.DataStore;
using INT_PT002.Controls;
using INT_PT002.Part11_UserManager;
using INT_PT002.DialogForms;
namespace INT_PT002.Forms
{
public partial class FormMainDisplay4 : Form
{
#region Field
public string ChangeID;
private bool BeforeEthernetStatus;
private int FlagIgnoreCNT;
private string MessageBoxRange;
private int testIndex;
private Define.E_ProcessStatus CurrentProcessStatus;
private bool IsTestMode;
private Color ColorProgressOn;
private Color ColorProgressOff;
private Color ColorProgressTextOn;
private Color ColorProgressTextOff;
private Color ColorResultPass;
private Color ColorResultNG;
private Color ColorResultNone;
private Color ColorSensorNormal;
private Color ColorSensorError;
private Color ColorNumberSelected;
private Color ColorNumberUnSelected;
private FormMain m_ParentForm;
private ControlMainDisplay ChildControl;
public ControlMainModbus ChildModbus;
#endregion
#region Constructor
public FormMainDisplay4(FormMain parent)
{
InitializeComponent();
this.ParentForm = parent;
this.DefaultSetting();
this.InitializeData();
this.InitializeLanguage();
}
#endregion
#region Property
public FormMain ParentForm
{
get { return this.m_ParentForm; }
private set { this.m_ParentForm = value; }
}
#endregion
#region Method
private void DefaultSetting()
{
int testIndex = 0;
this.BeforeEthernetStatus = false;
this.IsTestMode = false;
this.FlagIgnoreCNT = 0;
this.MessageBoxRange = "";
this.CurrentProcessStatus = Define.E_ProcessStatus._0_None;
this.ColorProgressOff = Color.FromArgb(231, 231, 231);
this.ColorProgressOn = Color.FromArgb(95, 196, 188);
this.ColorProgressTextOff = Color.Black;
this.ColorProgressTextOn = Color.Black;
this.ColorResultPass = Color.FromArgb(39, 200, 64);
this.ColorResultNG = Color.FromArgb(254, 70, 70);
this.ColorResultNone = Color.FromArgb(52, 51, 65);
this.ColorSensorNormal = Color.FromArgb(39, 200, 64);
this.ColorSensorError = Color.FromArgb(254, 70, 70);
this.ColorNumberSelected = Color.Teal;
this.ColorNumberUnSelected = Color.FromArgb(80, 92, 118);
this.ChildControl = new ControlMainDisplay(this.ParentForm);
this.Controls.Add(this.ChildControl);
this.ChildControl.Location = new Point(0, 118);
this.ChildControl.BringToFront();
this.ChildControl.Visible = false;
//this.ChildModbus = new ControlMainModbus(this);
//this.Controls.Add(this.ChildModbus);
//this.ChildModbus.Location = new Point(0, 155);
//this.ChildModbus.BringToFront();
//this.ChildModbus.Visible = false;
this.buttonRecipeNo.ButtonText = this.ParentForm.SystemConfig.RECIPE_NUMBER.ToString();
this.UpdateDisplayUser(this.ParentForm.CurrentSystemStatus.CurrentUser);
}
private void InitializeData()
{
this.labelResult1.Visible = false;
this.labelPressureWorking1.Text = "0.0";
this.labelPressureMaster1.Text = "0.0";
this.labelLrSec1.Text = "0.0";
this.labelSbAlarm1.Visible = false;
}
private void InitializeLanguage()
{
switch (this.ParentForm.SystemConfig.LANGUAGE)
{
case Define.E_LanguageID.Korean:
this.labelProgress0_1.Text = "초기상태";
this.labelProgress1_1.Text = "진공시작";
this.labelProgress2_1.Text = "측정 중";
this.labelProgress3_1.Text = "진공파기";
break;
case Define.E_LanguageID.English:
this.labelProgress0_1.Text = "Ready";
this.labelProgress1_1.Text = "Vacuum start";
this.labelProgress2_1.Text = "Measuring";
this.labelProgress3_1.Text = "Vacuum breaking";
break;
default:
break;
}
}
private void InitializeProcessStatus()
{
this.ProcessStatusStep1();
this.pictureBoxProgress0.Visible = false;
this.pictureBoxProgress0_1.Visible = true;
this.pictureBoxProgress1.Visible = true;
this.pictureBoxProgress1_1.Visible = false;
this.pictureBoxProgress2.Visible = true;
this.pictureBoxProgress2_1.Visible = false;
this.pictureBoxProgress3.Visible = true;
this.pictureBoxProgress3_1.Visible = false;
this.progressBar1.Value = this.progressBar1.Minimum;
this.SetLabelRoundRectFillColor(this.labelProgress0, this.ColorProgressOff);
this.SetLabelRoundRectFillColor(this.labelProgress1, this.ColorProgressOff);
this.SetLabelRoundRectFillColor(this.labelProgress2, this.ColorProgressOff);
this.SetLabelRoundRectFillColor(this.labelProgress3, this.ColorProgressOff);
this.SetLabelBackGroundColor(this.labelProgress0_1, this.ColorProgressOff);
this.SetLabelBackGroundColor(this.labelProgress1_1, this.ColorProgressOff);
this.SetLabelBackGroundColor(this.labelProgress2_1, this.ColorProgressOff);
this.SetLabelBackGroundColor(this.labelProgress3_1, this.ColorProgressOff);
this.SetLabelTextColor(this.labelProgress0_1, this.ColorProgressTextOff);
this.SetLabelTextColor(this.labelProgress1_1, this.ColorProgressTextOff);
this.SetLabelTextColor(this.labelProgress2_1, this.ColorProgressTextOff);
this.SetLabelTextColor(this.labelProgress3_1, this.ColorProgressTextOff);
}
private bool UI_Invoke(ThreadStart invoker)
{
try
{
if (this.InvokeRequired)
{
if (this.IsDisposed)
return true;
this.Invoke(invoker);
}
else
{
invoker();
}
return true;
}
catch (Exception e)
{
return false;
}
}
private void SetLabelBackGroundColor(SmartLabel label, Color c)
{
if (label.BackGroundColor != c)
label.BackGroundColor = c;
}
private void SetLabelRoundRectFillColor(SmartLabel label, Color c)
{
if (label.RoundRectFillColor != c)
label.RoundRectFillColor = c;
}
private void SetLabelTextColor(SmartLabel label, Color c)
{
if (label.TextColor != c)
label.TextColor = c;
}
private void UpdateDisplayUser(UserItem user)
{
string id = "", group = "", expireDate = "";
switch (user.Group)
{
case Define.E_UserGroup.None:
break;
case Define.E_UserGroup.Level1:
id = user.ID;
group = user.Group.ToString();
if (this.labelUserLevel.TextColor != this.ParentForm.ColorLogOn)
this.labelUserLevel.TextColor = this.labelUserID.TextColor = this.ParentForm.ColorLogOn;
this.labelExpireOfPassword.Visible = true;
this.buttonUser.ButtonDown();
this.buttonRecipeNo.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayProductChange;
this.buttonClear.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayClear;
this.buttonInspection.Enabled = true;
this.buttonMenu.Enabled = true;
break;
case Define.E_UserGroup.Level2:
id = user.ID;
group = user.Group.ToString();
if (this.labelUserLevel.TextColor != this.ParentForm.ColorLogOn)
this.labelUserLevel.TextColor = this.labelUserID.TextColor = this.ParentForm.ColorLogOn;
this.labelExpireOfPassword.Visible = true;
this.buttonUser.ButtonDown();
this.buttonRecipeNo.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayProductChange;
this.buttonClear.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayClear;
this.buttonInspection.Enabled = true;
this.buttonMenu.Enabled = true;
break;
case Define.E_UserGroup.Level3:
id = user.ID;
group = user.Group.ToString();
this.labelExpireOfPassword.Visible = true;
if (this.labelUserLevel.TextColor != this.ParentForm.ColorLogOn)
this.labelUserLevel.TextColor = this.labelUserID.TextColor = this.ParentForm.ColorLogOn;
this.buttonUser.ButtonDown();
this.buttonRecipeNo.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayProductChange;
this.buttonClear.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayClear;
this.buttonInspection.Enabled = true;
this.buttonMenu.Enabled = true;
break;
case Define.E_UserGroup.Admin:
id = user.ID;
group = user.Group.ToString();
this.labelExpireOfPassword.Visible = false;
if (this.labelUserLevel.TextColor != this.ParentForm.ColorLogOn)
this.labelUserLevel.TextColor = this.labelUserID.TextColor = this.ParentForm.ColorLogOn;
this.buttonUser.ButtonDown();
this.buttonRecipeNo.Enabled = true;
this.buttonClear.Enabled = true;
this.buttonInspection.Enabled = true;
this.buttonMenu.Enabled = true;
break;
case Define.E_UserGroup.Developer:
id = user.ID;
group = user.Group.ToString();
this.labelExpireOfPassword.Visible = true;
if (this.labelUserLevel.TextColor != this.ParentForm.ColorLogOn)
this.labelUserLevel.TextColor = this.labelUserID.TextColor = this.ParentForm.ColorLogOn;
this.buttonUser.ButtonDown();
this.buttonRecipeNo.Enabled = true;
this.buttonClear.Enabled = true;
this.buttonInspection.Enabled = true;
this.buttonMenu.Enabled = true;
break;
case Define.E_UserGroup.NotLogin:
id = "";
group = "";
this.labelExpireOfPassword.Visible = false;
this.buttonRecipeNo.Enabled = true;
this.buttonClear.Enabled = true;
this.buttonInspection.Enabled = true;
this.buttonMenu.Enabled = true;
break;
case Define.E_UserGroup.LogOut:
id = "Log Off";
group = "-";
this.labelExpireOfPassword.Visible = false;
if (this.labelUserLevel.TextColor != this.ParentForm.ColorLogOff)
this.labelUserLevel.TextColor = this.labelUserID.TextColor = this.ParentForm.ColorLogOff;
this.buttonUser.ButtonUp();
this.buttonRecipeNo.Enabled = false;
this.buttonClear.Enabled = false;
this.buttonInspection.Enabled = false;
this.buttonMenu.Enabled = false;
break;
default:
break;
}
this.buttonRecipeNo.ButtonColor = this.ParentForm.ButtonColorChange(this.buttonRecipeNo.Enabled);
this.buttonClear.ButtonColor = this.ParentForm.ButtonColorChange(this.buttonClear.Enabled);
this.buttonInspection.ButtonColor = this.ParentForm.ButtonColorChange(this.buttonInspection.Enabled);
this.buttonMenu.ButtonColor = this.ParentForm.ButtonColorChange(this.buttonMenu.Enabled);
expireDate = this.DisplayExpireOfPassword(user.Group);
if (expireDate != "-")
{
int intExpireDate = int.Parse(expireDate);
if (intExpireDate == 0)
{
this.labelExpireOfPassword.TextColor = this.ParentForm.ColorLogOff;
this.labelExpireOfPassword.Text = "D-0";
}
else if (intExpireDate < 0)
{
if (intExpireDate * -1 > this.ParentForm.CurrentSystemStatus.CurrentUser.ExpirePassword)
expireDate = "-" + (this.ParentForm.CurrentSystemStatus.CurrentUser.ExpirePassword - 1).ToString();
this.labelExpireOfPassword.Text = "D" + expireDate;
if (intExpireDate >= -10)
this.labelExpireOfPassword.TextColor = this.ParentForm.ColorLogOff;
else
this.labelExpireOfPassword.TextColor = this.ParentForm.ColorLogOn;
}
else
{
this.labelExpireOfPassword.TextColor = this.ParentForm.ColorLogOn;
this.labelExpireOfPassword.Text = "D+" + expireDate;
}
}
else
{
this.labelExpireOfPassword.TextColor = this.ParentForm.ColorLogOn;
this.labelExpireOfPassword.Text = "-";
}
if (this.labelUserLevel.Text != group)
this.labelUserLevel.Text = group;
if (this.labelUserID.Text != id)
this.labelUserID.Text = id;
}
private void Login()
{
int extract = 0;
DialogResult result;
DialogFormLogOn logOn = new DialogFormLogOn(this.ParentForm, false, false);
result = logOn.ShowDialog();
if (result == DialogResult.OK)
{
if (this.ParentForm.CurrentSystemStatus.CurrentUser.Group == Define.E_UserGroup.Level1 ||
this.ParentForm.CurrentSystemStatus.CurrentUser.Group == Define.E_UserGroup.Level2 ||
this.ParentForm.CurrentSystemStatus.CurrentUser.Group == Define.E_UserGroup.Level3)
{
// 비밀번호 만료일 10일 미만 체크 후 비밀번호 변경
this.PasswordExpirationCheck(this.ParentForm.CurrentSystemStatus.CurrentUser);
}
//this.ParentForm.ChildFormMenu.CenterEquipUserGroupEditor.UpdateAllMenu(this.ParentForm.CurrentSystemStatus);
this.DisplayRefresh();
this.buttonUser.ButtonDown();
this.ParentForm.ChildFormMenu.UpdateDisplayUser(this.ParentForm.CurrentSystemStatus.CurrentUser);
}
else if (result == DialogResult.Abort)
{
// 비밀 번호 변경 띄우기
DialogFormLogOn logOn1 = new DialogFormLogOn(this.ParentForm, false, true);
if (logOn1.ShowDialog() == DialogResult.OK)
{
//this.ParentForm.ChildFormMenu.CenterEquipUserGroupEditor.UpdateAllMenu(this.ParentForm.CurrentSystemStatus);
this.DisplayRefresh();
this.buttonUser.ButtonDown();
this.ParentForm.ChildFormMenu.UpdateDisplayUser(this.ParentForm.CurrentSystemStatus.CurrentUser);
}
else
this.buttonUser.ButtonUp();
}
else
{
this.buttonUser.ButtonUp();
}
}
public void Logout()
{
this.ParentForm.CurrentSystemStatus.CurrentUser.Group = Define.E_UserGroup.LogOut;
this.buttonUser.ButtonUp();
this.buttonUser.ButtonText = "Login";
this.ChangeID = "";
// Part 11
this.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.Logout, "");
this.DisplayRefresh();
}
private void PasswordExpirationCheck(UserItem user)
{
int expiryDay = 0;
// 만료일 -10 일때 메시지 띄우기
expiryDay = user.GetPasswordExpiryDday();
if (expiryDay >= -10)
{
//Console.WriteLine("password : " + expiryDay.ToString());
if (expiryDay < 0)
expiryDay *= -1;
DialogFormYesNo myDlg = new DialogFormYesNo(this.ParentForm.SystemConfig.LANGUAGE, 2, expiryDay.ToString());
if (myDlg.ShowDialog() == DialogResult.Yes)
{
// 비밀 번호 변경 띄우기
DialogFormLogOn logOn = new DialogFormLogOn(this.ParentForm, true, true);
if (logOn.ShowDialog() == DialogResult.OK)
{
}
}
}
}
public void Part11AutomaticLogoutReset()
{
//UserManager.UserManager_AutoLogoutTimeoutReset();
}
public string DisplayExpireOfPassword(Define.E_UserGroup group)
{
string ret = "";
if (group == Define.E_UserGroup.Admin || group == Define.E_UserGroup.Developer)
ret = "-";
else
{
//TimeSpan resultTime = DateTime.Now - this.ParentForm.CurrentSystemStatus.CurrentUser.DateExpireRegister;
TimeSpan dayDiff = DateTime.Now.Date - this.ParentForm.CurrentSystemStatus.CurrentUser.DatePasswordExpire.Date;
ret = dayDiff.Days.ToString();
}
return ret;
}
public void CallBackUserListModifyInfoData(UserManager.UserMgr_user_info_t user)
{
this.ParentForm.CurrentSystemStatus.CurrentUser.DatePasswordExpire = DateTime.Now.AddDays(this.ParentForm.CurrentSystemStatus.CurrentUser.ExpirePassword - 1);
this.DisplayExpireOfPassword(this.ParentForm.CurrentSystemStatus.CurrentUser.Group);
}
public void CallBackUserListLoginTimeoutDataEvent(UserManager.UserMgr_login_timeout_t user)
{
string code = "", message1 = "", message2 = "";
int warningTime = 0;
if (user.remainder_time != 0)
{
switch (this.ParentForm.SystemConfig.LANGUAGE)
{
case Define.E_LanguageID.Korean:
code = "로그인";
message1 = "잠시 후에 로그아웃 됩니다";
message2 = "";
break;
case Define.E_LanguageID.English:
code = "Login";
message1 = "You will be logged out after a while";
message2 = "";
break;
default:
break;
}
warningTime = this.ParentForm.FlagAutomaticLogoutWarningTime - 2;
this.UI_Invoke(delegate
{
DialogFormMessage msg = new DialogFormMessage(Define.E_MessageBoxIcon.Asterisk, code, message1, message2, warningTime);
msg.ShowDialog();
});
}
else
{
switch (this.ParentForm.SystemConfig.LANGUAGE)
{
case Define.E_LanguageID.Korean:
code = "Login";
message1 = "자동 로그아웃 되었습니다";
message2 = "";
break;
case Define.E_LanguageID.English:
code = "Login";
message1 = "automatically logged out";
message2 = "";
break;
default:
break;
}
// User Logout
UserManager.UserManager_UserLogout();
this.UI_Invoke(delegate
{
this.Logout();
});
this.UI_Invoke(delegate
{
DialogFormMessage msg = new DialogFormMessage(Define.E_MessageBoxIcon.Asterisk, code, message1, message2, 0);
msg.ShowDialog();
});
}
}
private void GetJudgmentResult(Define.E_JudgmentStatus judg, SmartLabel label)
{
string value = "";
switch (judg)
{
case Define.E_JudgmentStatus.None:
value = "-";
label.BackGroundColor = this.ColorResultNone;
break;
case Define.E_JudgmentStatus.Pass:
value = "Pass";
label.BackGroundColor = this.ColorResultPass;
break;
case Define.E_JudgmentStatus.Ng:
value = "Leak";
label.BackGroundColor = this.ColorResultNG;
break;
case Define.E_JudgmentStatus.Error:
value = "Empty";
label.BackGroundColor = this.ColorResultNone;
break;
default:
break;
}
if (label.Text != value)
label.Text = value;
}
private void ProgressBarSetting(Define.E_ProcessStatus status)
{
//switch (status)
//{
// case Define.E_ProcessStatus._6_VacuumStart:
// this.smartTimerProgressBar.Start();
// break;
// case Define.E_ProcessStatus._7_VacuumHold:
// this.progressBar1.Value = 30;
// break;
// case Define.E_ProcessStatus._8_Judgment:
// this.progressBar1.Value = 60;
// break;
// case Define.E_ProcessStatus._9_VacuumBreak:
// this.progressBar1.Value = this.progressBar1.Maximum;
// this.smartTimerProgressBar.Stop();
// break;
// default:
// break;
//}
}
public void InitialEthernetIcon()
{
// 이더넷
if (this.ParentForm.SystemConfig.IsEthernetEnable == true)
{
this.pictureBoxEthernetDisable.Visible = false;
this.pictureBoxEthernetDisconnection.Visible = true;
this.pictureBoxEthernetConnection.Visible = false;
}
else
{
this.pictureBoxEthernetDisable.Visible = true;
this.pictureBoxEthernetDisconnection.Visible = false;
this.pictureBoxEthernetConnection.Visible = false;
}
}
public void UpdateEthernetStatusDisplay(bool status)
{
//Console.Write("\n" + string.Format("UpdateEthernetStatusDisplay {0:yyyy-MM-dd HH:mm:ss}: {1}", DateTime.Now, status.ToString()));
if (this.BeforeEthernetStatus == status)
return;
else
this.BeforeEthernetStatus = status;
if (status == true)
{
this.pictureBoxEthernetConnection.Visible = true;
this.pictureBoxEthernetDisconnection.Visible = false;
}
else
{
this.pictureBoxEthernetConnection.Visible = false;
this.pictureBoxEthernetDisconnection.Visible = true;
}
}
public void TimerServer(bool value)
{
if (value == false)
{
if (this.timerServer.IsStart == true)
this.timerServer.Stop();
}
else
{
if (this.timerServer.IsStart == false)
this.timerServer.Start();
}
}
public void MainButtonModbusAdd(bool bValue)
{
this.buttonModbus.Visible = bValue;
}
private void UpdateDisplayDotGraphDiff(SmartDraw draw, DiffData diff)
{
int iValue = 0;
double dValue = 0.0;
// 값 표시 범위
// 15.000 ~ -2.000 (17.000 ~ 0)
// 그래프 영역 높이 102
// 17000 / 102 = 166.666666~
//dValue = (int.Parse(data.CurrentValueSign + data.CurrentValue) + 2000) / 166.66666;
if (dValue > 110)
dValue = 110;
if (dValue < 1)
dValue = 1;
iValue = int.Parse(string.Format("{0:f0}", dValue));
draw.Chart.PutData(iValue);
}
private void UpdateDisplayDotGraphDisp(SmartDraw draw, DispData disp)
{
int iValue = 0;
double dValue = 0.0;
// 값 표시 범위
// 15.000 ~ -2.000 (17.000 ~ 0)
// 그래프 영역 높이 102
// 17000 / 102 = 166.666666~
//dValue = (int.Parse(data.CurrentValueSign + data.CurrentValue) + 2000) / 166.66666;
if (dValue > 110)
dValue = 110;
if (dValue < 1)
dValue = 1;
iValue = int.Parse(string.Format("{0:f0}", dValue));
draw.Chart.PutData(iValue);
}
public void UpdateEquipmentStatusDisplay(Define.E_EquipmentStatus status)
{
if (status == Define.E_EquipmentStatus.Start)
{
#region Start
this.labelStart.Visible = true;
this.labelStop.Visible = false;
#endregion
}
else
{
#region Stop
this.labelStart.Visible = false;
this.labelStop.Visible = true;
this.InitializeData();
#endregion
}
}
public void UpdateDisplayAlarmView(AlarmList alarm)
{
string value = "";
// ServoEmergencyStop
if (alarm.IsServoEmergencyStop == true)
value = "a1_Servo emergency stop ";
// Servo1Alarm
if (alarm.IsServo1Alarm == true)
value += "a2_Servo1 ";
// Servo2Alarm
if (alarm.IsServo2Alarm == true)
value += "a3_Servo2 ";
// ServoTorque1AlarmTorque
if (alarm.IsServoTorque1AlarmTorque == true)
value += "a4_Servo1 Torque ";
// ServoTorque2AlarmTorque
if (alarm.IsServoTorque2AlarmTorque == true)
value += "a5_Servo2 Torque ";
// PressureError
if (alarm.IsPressureError == true)
value += "a6_Pressure ";
value = value.Trim();
this.labelAlarm.Size = new Size(value.Length * 9, 30);
this.labelAlarm.Text = value;
if (this.labelAlarm.Width > 400)
{
if (this.labelAlarm.Text != "")
this.smartTimerAlarm.Start();
}
else
{
this.smartTimerAlarm.Stop();
this.labelAlarm.Location = new Point(3, 26);
}
}
// 진행상태 데이터
private void ProcessStatusStep1()
{
this.smartTimerProgressBar.Stop();
this.progressBar1.Value = this.progressBar1.Minimum;
this.SetLabelRoundRectFillColor(this.labelProgress0, this.ColorProgressOn);
this.SetLabelRoundRectFillColor(this.labelProgress1, this.ColorProgressOff);
this.SetLabelRoundRectFillColor(this.labelProgress2, this.ColorProgressOff);
this.SetLabelRoundRectFillColor(this.labelProgress3, this.ColorProgressOff);
this.SetLabelBackGroundColor(this.labelProgress0_1, this.ColorProgressOn);
this.SetLabelBackGroundColor(this.labelProgress1_1, this.ColorProgressOff);
this.SetLabelBackGroundColor(this.labelProgress2_1, this.ColorProgressOff);
this.SetLabelBackGroundColor(this.labelProgress3_1, this.ColorProgressOff);
this.SetLabelTextColor(this.labelProgress0_1, this.ColorProgressTextOn);
this.SetLabelTextColor(this.labelProgress1_1, this.ColorProgressTextOff);
this.SetLabelTextColor(this.labelProgress2_1, this.ColorProgressTextOff);
this.SetLabelTextColor(this.labelProgress3_1, this.ColorProgressTextOff);
}
private void ProcessStatusStep2(Define.E_ProcessStatus status)
{
this.smartTimerProgressBar.Stop();
this.progressBar1.Value = this.progressBar1.Minimum;
this.SetLabelRoundRectFillColor(this.labelProgress0, this.ColorProgressOff);
this.SetLabelRoundRectFillColor(this.labelProgress1, this.ColorProgressOn);
this.SetLabelRoundRectFillColor(this.labelProgress2, this.ColorProgressOff);
this.SetLabelRoundRectFillColor(this.labelProgress3, this.ColorProgressOff);
this.SetLabelBackGroundColor(this.labelProgress0_1, this.ColorProgressOff);
this.SetLabelBackGroundColor(this.labelProgress1_1, this.ColorProgressOn);
this.SetLabelBackGroundColor(this.labelProgress2_1, this.ColorProgressOff);
this.SetLabelBackGroundColor(this.labelProgress3_1, this.ColorProgressOff);
this.SetLabelTextColor(this.labelProgress0_1, this.ColorProgressTextOff);
this.SetLabelTextColor(this.labelProgress1_1, this.ColorProgressTextOn);
this.SetLabelTextColor(this.labelProgress2_1, this.ColorProgressTextOff);
this.SetLabelTextColor(this.labelProgress3_1, this.ColorProgressTextOff);
}
private void ProcessStatusStep3(Define.E_ProcessStatus status)
{
this.SetLabelRoundRectFillColor(this.labelProgress0, this.ColorProgressOff);
this.SetLabelRoundRectFillColor(this.labelProgress1, this.ColorProgressOff);
this.SetLabelRoundRectFillColor(this.labelProgress2, this.ColorProgressOn);
this.SetLabelRoundRectFillColor(this.labelProgress3, this.ColorProgressOff);
this.SetLabelBackGroundColor(this.labelProgress0_1, this.ColorProgressOff);
this.SetLabelBackGroundColor(this.labelProgress1_1, this.ColorProgressOff);
this.SetLabelBackGroundColor(this.labelProgress2_1, this.ColorProgressOn);
this.SetLabelBackGroundColor(this.labelProgress3_1, this.ColorProgressOff);
this.SetLabelTextColor(this.labelProgress0_1, this.ColorProgressTextOff);
this.SetLabelTextColor(this.labelProgress1_1, this.ColorProgressTextOff);
this.SetLabelTextColor(this.labelProgress2_1, this.ColorProgressTextOn);
this.SetLabelTextColor(this.labelProgress3_1, this.ColorProgressTextOff);
this.ProgressBarSetting(status);
}
private void ProcessStatusStep4(Define.E_ProcessStatus status)
{
this.smartTimerProgressBar.Stop();
this.progressBar1.Value = this.progressBar1.Minimum;
this.SetLabelRoundRectFillColor(this.labelProgress0, this.ColorProgressOff);
this.SetLabelRoundRectFillColor(this.labelProgress1, this.ColorProgressOff);
this.SetLabelRoundRectFillColor(this.labelProgress2, this.ColorProgressOff);
this.SetLabelRoundRectFillColor(this.labelProgress3, this.ColorProgressOn);
this.SetLabelBackGroundColor(this.labelProgress0_1, this.ColorProgressOff);
this.SetLabelBackGroundColor(this.labelProgress1_1, this.ColorProgressOff);
this.SetLabelBackGroundColor(this.labelProgress2_1, this.ColorProgressOff);
this.SetLabelBackGroundColor(this.labelProgress3_1, this.ColorProgressOn);
this.SetLabelTextColor(this.labelProgress0_1, this.ColorProgressTextOff);
this.SetLabelTextColor(this.labelProgress1_1, this.ColorProgressTextOff);
this.SetLabelTextColor(this.labelProgress2_1, this.ColorProgressTextOff);
this.SetLabelTextColor(this.labelProgress3_1, this.ColorProgressTextOn);
}
public void UpdateDisplayProcessStatus(Define.E_ProcessStatus status)
{
this.CurrentProcessStatus = status;
switch (status)
{
case Define.E_ProcessStatus._0_None:
break;
case Define.E_ProcessStatus._1_Ready:
this.ProcessStatusStep1();
//this.InitializeData();
this.pictureBoxProgress0.Visible = false;
this.pictureBoxProgress0_1.Visible = true;
this.pictureBoxProgress1.Visible = true;
this.pictureBoxProgress1_1.Visible = false;
this.pictureBoxProgress2.Visible = true;
this.pictureBoxProgress2_1.Visible = false;
this.pictureBoxProgress3.Visible = true;
this.pictureBoxProgress3_1.Visible = false;
break;
case Define.E_ProcessStatus._2_ProductEntry:
case Define.E_ProcessStatus._3_MoveToLeak:
case Define.E_ProcessStatus._4_MoveToCheck:
case Define.E_ProcessStatus._5_ChamberMerge:
this.ProcessStatusStep1();
this.InitializeData();
this.pictureBoxProgress0.Visible = false;
this.pictureBoxProgress0_1.Visible = true;
this.pictureBoxProgress1.Visible = true;
this.pictureBoxProgress1_1.Visible = false;
this.pictureBoxProgress2.Visible = true;
this.pictureBoxProgress2_1.Visible = false;
this.pictureBoxProgress3.Visible = true;
this.pictureBoxProgress3_1.Visible = false;
break;
case Define.E_ProcessStatus._6_VacuumStart:
this.ProcessStatusStep2(status);
this.pictureBoxProgress0.Visible = true;
this.pictureBoxProgress0_1.Visible = false;
this.pictureBoxProgress1.Visible = false;
this.pictureBoxProgress1_1.Visible = true;
this.pictureBoxProgress2.Visible = true;
this.pictureBoxProgress2_1.Visible = false;
this.pictureBoxProgress3.Visible = true;
this.pictureBoxProgress3_1.Visible = false;
break;
case Define.E_ProcessStatus._7_VacuumHold:
case Define.E_ProcessStatus._8_Judgment:
this.ProcessStatusStep3(status);
this.pictureBoxProgress0.Visible = true;
this.pictureBoxProgress0_1.Visible = false;
this.pictureBoxProgress1.Visible = true;
this.pictureBoxProgress1_1.Visible = false;
this.pictureBoxProgress2.Visible = false;
this.pictureBoxProgress2_1.Visible = true;
this.pictureBoxProgress3.Visible = true;
this.pictureBoxProgress3_1.Visible = false;
break;
case Define.E_ProcessStatus._9_VacuumBreak:
case Define.E_ProcessStatus._10_ChamberRelease:
case Define.E_ProcessStatus._11_MoveToReady:
this.ProcessStatusStep4(status);
this.pictureBoxProgress0.Visible = true;
this.pictureBoxProgress0_1.Visible = false;
this.pictureBoxProgress1.Visible = true;
this.pictureBoxProgress1_1.Visible = false;
this.pictureBoxProgress2.Visible = true;
this.pictureBoxProgress2_1.Visible = false;
this.pictureBoxProgress3.Visible = false;
this.pictureBoxProgress3_1.Visible = true;
break;
default:
break;
}
}
// 차압센서 데이터
public void UpdateDisplayDiffData1(LeakData1 data)
{
this.labelLrSec1.Text = data.DiffData.SecBufDiff;
}
// 변위센서 데이터
public void UpdateDisplayDispData1(LeakData1 data)
{
}
// 압력센서 데이터
public void UpdateDisplayPresData1(LeakData1 data)
{
this.labelPressureWorking1.Text = data.PresData.WorkingChamber.Trim();
this.labelPressureMaster1.Text = data.PresData.MasterChamber.Trim();
}
// 판정결과
public void UpdateDisplayJudgmentData1(LeakData1 data)
{
this.GetJudgmentResult(data.Judgment, this.labelResult1);
this.labelResult1.Visible = true;
this.ChildControl.UpdateStartLeakDataDisplay1(data);
this.ParentForm.TrackingInspectionData(this.ParentForm.CurrentLeakDatas);
}
public void UpdateDisplayJudgmentTrackingData(Collection<LeakData1> items)
{
this.ParentForm.TrackingInspectionData(items);
}
public void UpdateDisplayRecipeData(Recipe data)
{
this.buttonRecipeNo.ButtonText = data.NUMBER.ToString();
}
public void UpdateDisplayTime(DateTime time)
{
this.labelTime.Text = time.ToString("yyyy-MM-dd HH:mm:ss");
}
public void DisplayRefresh()
{
this.ParentForm.CurrentSystemStatus.CurrentForm = Define.E_FormStore.FormMainDisplay;
this.ParentForm.CurrentSystemStatus.CurrentDisplayMode = Define.E_DisplayModeStore.MainDisplay;
this.ParentForm.SetDisplayMode(Define.E_EquipmentMode.Normal);
this.buttonRecipeNo.ButtonText = this.ParentForm.CurrentRecipe.NUMBER.ToString();
this.InitializeProcessStatus();
//this.ChildModbus.Visible = false;
this.UpdateDisplayUser(this.ParentForm.CurrentSystemStatus.CurrentUser);
}
#endregion
#region Override Member
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
this.smartTimerLogin.Start();
this.InitializeProcessStatus();
}
#endregion
#region Event Handler
private void labelStop_Click(object sender, EventArgs e)
{
this.ParentForm.TransferData(CommunicationCommand.Start, CommunicationID.MainBoard);
this.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.EquipmentStart, "");
}
private void labelStart_Click(object sender, EventArgs e)
{
this.ParentForm.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.EquipmentStop, "");
}
private void buttonProductNo_Click(object sender, EventArgs e)
{
string before = "", after = "";
this.Part11AutomaticLogoutReset();
before = this.buttonRecipeNo.ButtonText;
DialogFormNumKeyPad myKeypad = new DialogFormNumKeyPad("NUMBER", this.buttonRecipeNo.ButtonText, 4, 0, false);
if (myKeypad.ShowDialog() == DialogResult.OK)
{
if (myKeypad.IntValue < 1 || myKeypad.IntValue > 1000)
{
this.MessageBoxRange = "1 ~ 1000";
this.buttonRecipeNo.ButtonText = before;
this.smartTimerMessageShow.Start();
return;
}
this.buttonRecipeNo.ButtonText = "**";
this.ParentForm.TransferRecipeParameter9043(myKeypad.IntValue);
after = myKeypad.StringValue;
this.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.RecipeNumber, "", before, after);
}
}
private void buttonInspection_Click(object sender, EventArgs e)
{
this.Part11AutomaticLogoutReset();
this.ParentForm.TransferData(CommunicationCommand.CutInpupt, CommunicationID.MainBoard);
//this.InitializeData();
this.ChildControl.ClearAllData();
}
private void buttonUser_Click(object sender, EventArgs e)
{
this.Part11AutomaticLogoutReset();
if (this.ParentForm.CurrentSystemStatus.CurrentUser.Group == Define.E_UserGroup.LogOut)
{
this.Login();
}
else
{
DialogFormYesNo msg = new DialogFormYesNo(this.ParentForm.SystemConfig.LANGUAGE, 12);
if (msg.ShowDialog() == DialogResult.Yes)
{
this.Logout();
}
}
this.InitializeProcessStatus();
}
private void buttonMenu_Click(object sender, EventArgs e)
{
this.Part11AutomaticLogoutReset();
if (this.ParentForm.CurrentSystemStatus.EquipmentStatus == Define.E_EquipmentStatus.Stop)
{
UserManager.UserManager_AutoLogoutTimeoutPause();
this.ParentForm.ChildFormMenu.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
this.ParentForm.FormChange((int)Define.E_FormStore.FormMenu);
}
}
private void buttonModbus_Click(object sender, EventArgs e)
{
this.Part11AutomaticLogoutReset();
if (this.ChildModbus.Visible == true)
{
this.ChildModbus.Visible = false;
}
else
{
this.ChildModbus.DisplayRefresh();
this.ChildModbus.BringToFront();
this.ChildModbus.Visible = true;
}
}
private void smartDraw1_Click(object sender, EventArgs e)
{
this.ChildControl.DisplayRefresh(1);
this.ChildControl.Visible = true;
}
private void smartDraw2_Click(object sender, EventArgs e)
{
this.ChildControl.DisplayRefresh(2);
this.ChildControl.Visible = true;
}
private void smartDraw3_Click(object sender, EventArgs e)
{
this.ChildControl.DisplayRefresh(3);
this.ChildControl.Visible = true;
}
private void smartDraw4_Click(object sender, EventArgs e)
{
this.ChildControl.DisplayRefresh(4);
this.ChildControl.Visible = true;
}
private void smartDraw5_Click(object sender, EventArgs e)
{
this.ChildControl.DisplayRefresh(5);
this.ChildControl.Visible = true;
}
private void smartDraw6_Click(object sender, EventArgs e)
{
this.ChildControl.DisplayRefresh(6);
this.ChildControl.Visible = true;
}
private void smartDraw7_Click(object sender, EventArgs e)
{
this.ChildControl.DisplayRefresh(7);
this.ChildControl.Visible = true;
}
private void smartDraw8_Click(object sender, EventArgs e)
{
this.ChildControl.DisplayRefresh(8);
this.ChildControl.Visible = true;
}
private void smartDraw9_Click(object sender, EventArgs e)
{
this.ChildControl.DisplayRefresh(9);
this.ChildControl.Visible = true;
}
private void smartDraw10_Click(object sender, EventArgs e)
{
this.ChildControl.DisplayRefresh(10);
this.ChildControl.Visible = true;
}
private void buttonClear_Click(object sender, EventArgs e)
{
this.InitializeData();
this.ChildControl.ClearAllData();
}
private void buttonExit_Click(object sender, EventArgs e)
{
this.ParentForm.CloseSmartUartLink();
this.ParentForm.Dispose();
this.ParentForm.Close();
}
private void smartTimerAlarm_Tick(object sender, EventArgs e)
{
this.labelAlarm.Left = this.labelAlarm.Left - 5;
if (this.labelAlarm.Left < 0 - this.labelAlarm.Width - 20)
this.labelAlarm.Left = this.smartGroupBox1.Width - 10;
}
private void smartTimerMessageShow_Tick(object sender, EventArgs e)
{
this.smartTimerMessageShow.Stop();
DialogFormMessage msg = new DialogFormMessage(1, this.ParentForm.SystemConfig.LANGUAGE, this.MessageBoxRange);
msg.ShowDialog();
}
private void smartTimerLogin_Tick(object sender, EventArgs e)
{
this.smartTimerLogin.Stop();
//this.Login();
}
private void smartTimerProgressBar_Tick(object sender, EventArgs e)
{
if (this.CurrentProcessStatus == Define.E_ProcessStatus._6_VacuumStart)
{
if (this.progressBar1.Value < 30)
this.progressBar1.Value++;
}
else if (this.CurrentProcessStatus == Define.E_ProcessStatus._7_VacuumHold)
{
if (this.progressBar1.Value < 60)
this.progressBar1.Value++;
}
else if (this.CurrentProcessStatus == Define.E_ProcessStatus._8_Judgment)
{
if (this.progressBar1.Value == this.progressBar1.Maximum)
this.smartTimerProgressBar.Stop();
else
this.progressBar1.Value++;
}
}
private void timerServer_Tick(object sender, EventArgs e)
{
if (this.ParentForm.smartTCPMultiServer.IsStart == true)
{
if (this.ParentForm.smartTCPMultiServer.ClientInfoList == null)
this.UpdateEthernetStatusDisplay(false);
else
this.UpdateEthernetStatusDisplay(true);
}
}
private void buttonTest_Click(object sender, EventArgs e)
{
if (this.buttonTest.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
{
//this.InitializeData();
this.ParentForm.TransferData(CommunicationCommand.CutInpupt, CommunicationID.MainBoard);
this.smartTimerTest.Start();
this.IsTestMode = true;
}
else
{
this.smartTimerTest.Stop();
this.IsTestMode = false;
}
}
private void smartTimerTest_Tick(object sender, EventArgs e)
{
//this.InitializeData();
this.ParentForm.TransferData(CommunicationCommand.CutInpupt, CommunicationID.MainBoard);
}
#endregion
private void smartButton4_Click(object sender, EventArgs e)
{
string value = "";
this.smartTimerAlarm.Stop();
value = "a1_Servo emergency stop ";
value += "a2_Servo1 ";
value += "a3_Servo2 ";
value += "a4_Servo1 Torque ";
value += "a5_Servo2 Torque ";
//value += "a6_Pressure ";
value = value.Trim();
this.labelAlarm.Size = new Size(value.Length * 8, 20);
this.labelAlarm.Text = value;
if (this.labelAlarm.Width > 400)
{
if (this.labelAlarm.Text != "")
this.smartTimerAlarm.Start();
}
else
{
this.smartTimerAlarm.Stop();
this.labelAlarm.Location = new Point(3, 26);
}
}
private void smartButton5_Click(object sender, EventArgs e)
{
switch (this.testIndex)
{
case 0:
this.UpdateDisplayProcessStatus(Define.E_ProcessStatus._1_Ready);
break;
case 1:
this.UpdateDisplayProcessStatus(Define.E_ProcessStatus._2_ProductEntry);
break;
case 2:
this.UpdateDisplayProcessStatus(Define.E_ProcessStatus._3_MoveToLeak);
break;
case 3:
this.UpdateDisplayProcessStatus(Define.E_ProcessStatus._4_MoveToCheck);
break;
case 4:
this.UpdateDisplayProcessStatus(Define.E_ProcessStatus._5_ChamberMerge);
break;
case 5:
this.UpdateDisplayProcessStatus(Define.E_ProcessStatus._6_VacuumStart);
break;
case 6:
this.UpdateDisplayProcessStatus(Define.E_ProcessStatus._7_VacuumHold);
break;
case 7:
this.UpdateDisplayProcessStatus(Define.E_ProcessStatus._8_Judgment);
break;
case 8:
this.UpdateDisplayProcessStatus(Define.E_ProcessStatus._9_VacuumBreak);
break;
case 9:
this.UpdateDisplayProcessStatus(Define.E_ProcessStatus._10_ChamberRelease);
break;
case 10:
this.UpdateDisplayProcessStatus(Define.E_ProcessStatus._11_MoveToReady);
break;
default:
break;
}
if (this.testIndex >= 10)
this.testIndex = 0;
else
this.testIndex++;
}
}
}