diff --git a/INT_PT002/Controls/System/ControlMenuSystemEthernet.cs b/INT_PT002/Controls/System/ControlMenuSystemEthernet.cs index 5e2ff1d..c9f4c50 100644 --- a/INT_PT002/Controls/System/ControlMenuSystemEthernet.cs +++ b/INT_PT002/Controls/System/ControlMenuSystemEthernet.cs @@ -276,6 +276,48 @@ namespace INT_PT002.Controls this.Invoke(new ConnetedIPStatusCallback(this.ConnectedIPStatusOut), value); } + private void ModbusSetting() + { + if (this.ParentForm.ParentForm.SystemConfig.ETHERNET_COMM_MODE == 1) + { + this.ParentForm.ParentForm.ChildFormMainDisplay.InitialEthernetIcon(); + + if (this.ParentForm.ParentForm.SystemConfig.ETHERNET_OP_MODE == 1) + { + this.ParentForm.ParentForm.ChildFormMainDisplay.MainButtonModbusAdd(true); + this.groupBoxModbusSetting.Visible = true; + + this.labelModbusRole.Text = "Slave"; + this.labelFunctions.Text = "04: Read input register"; + + this.labelTitleStartAddress.Visible = false; + this.labelStartAddress.Visible = false; + } + else if (this.ParentForm.ParentForm.SystemConfig.ETHERNET_OP_MODE == 2) + { + this.ParentForm.ParentForm.ChildFormMainDisplay.MainButtonModbusAdd(true); + this.groupBoxModbusSetting.Visible = true; + + this.labelModbusRole.Text = "Master"; + this.labelFunctions.Text = "16: Write multiple register"; + + this.labelTitleStartAddress.Visible = true; + this.labelStartAddress.Visible = true; + this.labelStartAddress.Text = this.ParentForm.ParentForm.SystemConfig.MODBUS_TCP_START_ADDRESS.ToString(); + } + else + { + this.ParentForm.ParentForm.ChildFormMainDisplay.MainButtonModbusAdd(false); + this.groupBoxModbusSetting.Visible = false; + } + } + else + { + this.ParentForm.ParentForm.ChildFormMainDisplay.MainButtonModbusAdd(false); + this.groupBoxModbusSetting.Visible = false; + } + } + public void DisplayRefresh() { this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplayMode = Define.E_DisplayModeStore.Ethernet; @@ -290,7 +332,7 @@ namespace INT_PT002.Controls this.comboBoxEthernetMode.SelectedIndexChanged += new EventHandler(this.comboBoxEthernetMode_SelectedIndexChanged); this.comboBoxEthernetOpMode.SelectedIndexChanged += new EventHandler(this.comboBoxEthernetOpMode_SelectedIndexChanged); - this.groupBoxModbusSetting.Visible = false; + this.ModbusSetting(); if (this.comboBoxEthernetOpMode.SelectedIndex == 1) { @@ -369,9 +411,6 @@ namespace INT_PT002.Controls this.ParentForm.ParentForm.SystemConfig.ETHERNET_OP_MODE = 1; afterOpMode = "Server"; - this.labelModbusRole.Text = "Slave"; - this.labelFunctions.Text = "04: Read input register"; - this.buttonStartServer.Enabled = true; this.buttonStopServer.Enabled = true; this.buttonStartClient.Enabled = false; @@ -387,9 +426,6 @@ namespace INT_PT002.Controls this.ParentForm.ParentForm.EthernetClientDisconnect(); afterOpMode = "Client"; - this.labelModbusRole.Text = "Master"; - this.labelFunctions.Text = "04: Read input register"; - this.ParentForm.ParentForm.ChildFormMainDisplay.TimerServer(false); this.labelConnectedIP.Text = "-"; @@ -423,19 +459,8 @@ namespace INT_PT002.Controls this.ParentForm.ParentForm.SystemConfig.ETHERNET_COMM_MODE = mode; afterComMode = this.ReturnCommunicationModeName(mode); - if (this.ParentForm.ParentForm.SystemConfig.ETHERNET_COMM_MODE == (int)Define.E_CommMode.f1_Modbus) - { - this.ParentForm.ParentForm.ChildFormMainDisplay.MainButtonModbusAdd(true); - this.groupBoxModbusSetting.Visible = true; - } - else - { - this.ParentForm.ParentForm.ChildFormMainDisplay.MainButtonModbusAdd(false); - this.groupBoxModbusSetting.Visible = false; - } - this.ParentForm.ParentForm.SaveSystemConfigurationFile(this.ParentForm.ParentForm.SystemConfig); - this.ParentForm.ParentForm.ChildFormMainDisplay.InitialEthernetIcon(); + this.ModbusSetting(); this.buttonSaveMode.Visible = false; diff --git a/INT_PT002/Forms/FormMain.cs b/INT_PT002/Forms/FormMain.cs index 3aec0f9..2b67b3b 100644 --- a/INT_PT002/Forms/FormMain.cs +++ b/INT_PT002/Forms/FormMain.cs @@ -247,6 +247,41 @@ namespace INT_PT002.Forms if (Directory.Exists(this.PathDataBackupFolder) == false) Directory.CreateDirectory(this.PathDataBackupFolder); } + private void DefaultSetting2() + { + // 이더넷 + if (this.SystemConfig.ETHERNET_OP_MODE == 1) + { + try + { + if (string.Compare(this.smartConfigs.IPSettings.DeviceIP, "0.0.0.0") != 0) + this.EthernetServerStart(); + + this.ChildFormMainDisplay.TimerServer(true); + } + catch + { + + } + } + else if (this.SystemConfig.ETHERNET_OP_MODE == 2) + { + this.EthernetClientDisconnect(); + } + + if (this.SystemConfig.ETHERNET_COMM_MODE != (int)Define.E_CommMode.f0_None) + { + switch (this.SystemConfig.ETHERNET_COMM_MODE) + { + case (int)Define.E_CommMode.f1_Modbus: + this.ChildFormMainDisplay.MainButtonModbusAdd(true); + break; + default: + break; + } + } + this.ChildFormMainDisplay.InitialEthernetIcon(); + } private void InitializeUserManager() { UserManager.UserListNewDataEvent += this.UserManager_UserListNewDataEvent; @@ -3727,7 +3762,7 @@ namespace INT_PT002.Forms } #endregion - #region Modbus + #region Modbus - Servo Motor public void ModbusOpen() { if (this.smartModbus.IsOpen == true) @@ -3854,6 +3889,9 @@ namespace INT_PT002.Forms // 초기 파라미터 전송 this.TransferSystemParameter9039(); + // 이더넷 설정 + this.DefaultSetting2(); + // timer1 Get user List Name //UserManager.UserManager_GetUserListName(); this.timerUserList.Enabled = true; diff --git a/INT_PT002/Forms/FormMainDisplay3.Designer.cs b/INT_PT002/Forms/FormMainDisplay3.Designer.cs index e8908d3..8783d53 100644 --- a/INT_PT002/Forms/FormMainDisplay3.Designer.cs +++ b/INT_PT002/Forms/FormMainDisplay3.Designer.cs @@ -713,7 +713,7 @@ this.labelExpireOfPassword.BackGroundColor = System.Drawing.Color.SkyBlue; this.labelExpireOfPassword.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(42)))), ((int)(((byte)(82))))); this.labelExpireOfPassword.BorderStyle = SmartX.SmartLabel.BorderStyles.None; - this.labelExpireOfPassword.Font = new System.Drawing.Font("New Gulim", 10F, System.Drawing.FontStyle.Bold); + this.labelExpireOfPassword.Font = new System.Drawing.Font("새굴림", 10F, System.Drawing.FontStyle.Bold); this.labelExpireOfPassword.LineSpacing = 0F; this.labelExpireOfPassword.Location = new System.Drawing.Point(786, 126); this.labelExpireOfPassword.Name = "labelExpireOfPassword"; diff --git a/INT_PT002/Forms/FormMainDisplay4.cs b/INT_PT002/Forms/FormMainDisplay4.cs deleted file mode 100644 index ed4d028..0000000 --- a/INT_PT002/Forms/FormMainDisplay4.cs +++ /dev/null @@ -1,1179 +0,0 @@ -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 - private int FlagIgnoreCNT; - - private string MessageBoxRange; - // 이전 단계 번호(Index 아님) 저장용 변수 - private Define.E_ProcessStatus PreviousStageNum; - - int testIndex; - private Define.E_ProcessStatus ProcessStatus; - - private Color ColorProgressOn; - private Size SizeProgressOn; - private Color ColorProgressOff; - private Size SizeProgressOff; - private Color ColorResultPass; - private Color ColorResultNG; - private Color ColorResultNone; - private Color ColorSensorNormal; - private Color ColorSensorError; - - private Collection CollectionLabelPoint; - private Collection CollectionLabelResult; - private Collection CollectionLabelProgress; - private Collection CollectionLabelProgress2; - private Collection CollectionPictureBoxSelected; - private Collection CollectionPictureBoxUnselected; - private Collection CollectionLabelPressure; - private Collection CollectionLabelLeakRatePerSec; - private Collection CollectionLabelSbAlarm; - - private FormMain m_ParentForm; - - private ControlMainDisplay ChildControl; - #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.FlagIgnoreCNT = 0; - this.MessageBoxRange = ""; - this.ProcessStatus = Define.E_ProcessStatus._0_None; - this.PreviousStageNum = Define.E_ProcessStatus._0_None; - - this.ColorProgressOff = Color.FromArgb(231, 231, 231); - this.SizeProgressOff = new Size(155, 140); - this.ColorProgressOn = Color.FromArgb(95, 196, 188); - this.SizeProgressOn = new Size(190, 170); - this.ColorResultPass = Color.FromArgb(39, 200, 64); - this.ColorResultNG = Color.FromArgb(254, 70, 70); - this.ColorResultNone = Color.FromArgb(42, 43, 45); - this.ColorSensorNormal = Color.FromArgb(39, 200, 64); - this.ColorSensorError = Color.FromArgb(254, 70, 70); - - this.CollectionLabelResult = new Collection(); - this.CollectionLabelResult.Clear(); - this.CollectionLabelResult.Add(this.labelResult1); - this.CollectionLabelResult.Add(this.labelResult2); - this.CollectionLabelResult.Add(this.labelResult3); - this.CollectionLabelResult.Add(this.labelResult4); - this.CollectionLabelResult.Add(this.labelResult5); - this.CollectionLabelResult.Add(this.labelResult6); - this.CollectionLabelResult.Add(this.labelResult7); - this.CollectionLabelResult.Add(this.labelResult8); - this.CollectionLabelResult.Add(this.labelResult9); - this.CollectionLabelResult.Add(this.labelResult10); - - // 배경 사각형 라벨 - this.CollectionLabelProgress = new Collection(); - this.CollectionLabelProgress.Clear(); - this.CollectionLabelProgress.Add(this.labelProgress0); - this.CollectionLabelProgress.Add(this.labelProgress1); - this.CollectionLabelProgress.Add(this.labelProgress2); - this.CollectionLabelProgress.Add(this.labelProgress3); - - // 기존 배경 라벨 사이즈 저장 - this.CollectionLabelPoint = new Collection(); - this.CollectionLabelPoint.Clear(); - for (int i = 0; i < this.CollectionLabelProgress.Count; i++) - this.CollectionLabelPoint.Add(new Point(this.CollectionLabelProgress[i].Location.X, this.CollectionLabelProgress[i].Location.Y)); - - // 문구가 적힌 라벨 - this.CollectionLabelProgress2 = new Collection(); - this.CollectionLabelProgress2.Clear(); - this.CollectionLabelProgress2.Add(this.labelProgress0_1); - this.CollectionLabelProgress2.Add(this.labelProgress1_1); - this.CollectionLabelProgress2.Add(this.labelProgress2_1); - this.CollectionLabelProgress2.Add(this.labelProgress3_1); - - // pictureBox - Selected - this.CollectionPictureBoxSelected = new Collection(); - this.CollectionPictureBoxSelected.Clear(); - this.CollectionPictureBoxSelected.Add(this.pictureBoxProgress0Selected); - this.CollectionPictureBoxSelected.Add(this.pictureBoxProgress1Selected); - this.CollectionPictureBoxSelected.Add(this.pictureBoxProgress2Selected); - this.CollectionPictureBoxSelected.Add(this.pictureBoxProgress3Selected); - - // pictureBox - Unselected - this.CollectionPictureBoxUnselected = new Collection(); - this.CollectionPictureBoxUnselected.Clear(); - this.CollectionPictureBoxUnselected.Add(this.pictureBoxProgress0); - this.CollectionPictureBoxUnselected.Add(this.pictureBoxProgress1); - this.CollectionPictureBoxUnselected.Add(this.pictureBoxProgress2); - this.CollectionPictureBoxUnselected.Add(this.pictureBoxProgress3); - - this.CollectionLabelPressure = new Collection(); - this.CollectionLabelPressure.Clear(); - this.CollectionLabelPressure.Add(this.labelPressure1); - this.CollectionLabelPressure.Add(this.labelPressure2); - this.CollectionLabelPressure.Add(this.labelPressure3); - this.CollectionLabelPressure.Add(this.labelPressure4); - this.CollectionLabelPressure.Add(this.labelPressure5); - this.CollectionLabelPressure.Add(this.labelPressure6); - this.CollectionLabelPressure.Add(this.labelPressure7); - this.CollectionLabelPressure.Add(this.labelPressure8); - this.CollectionLabelPressure.Add(this.labelPressure9); - this.CollectionLabelPressure.Add(this.labelPressure10); - - this.CollectionLabelLeakRatePerSec = new Collection(); - this.CollectionLabelLeakRatePerSec.Clear(); - this.CollectionLabelLeakRatePerSec.Add(this.labelLrSec1); - this.CollectionLabelLeakRatePerSec.Add(this.labelLrSec2); - this.CollectionLabelLeakRatePerSec.Add(this.labelLrSec3); - this.CollectionLabelLeakRatePerSec.Add(this.labelLrSec4); - this.CollectionLabelLeakRatePerSec.Add(this.labelLrSec5); - this.CollectionLabelLeakRatePerSec.Add(this.labelLrSec6); - this.CollectionLabelLeakRatePerSec.Add(this.labelLrSec7); - this.CollectionLabelLeakRatePerSec.Add(this.labelLrSec8); - this.CollectionLabelLeakRatePerSec.Add(this.labelLrSec9); - this.CollectionLabelLeakRatePerSec.Add(this.labelLrSec10); - - this.CollectionLabelSbAlarm = new Collection(); - this.CollectionLabelSbAlarm.Clear(); - this.CollectionLabelSbAlarm.Add(this.labelSbAlarm1); - this.CollectionLabelSbAlarm.Add(this.labelSbAlarm2); - this.CollectionLabelSbAlarm.Add(this.labelSbAlarm3); - this.CollectionLabelSbAlarm.Add(this.labelSbAlarm4); - this.CollectionLabelSbAlarm.Add(this.labelSbAlarm5); - this.CollectionLabelSbAlarm.Add(this.labelSbAlarm6); - this.CollectionLabelSbAlarm.Add(this.labelSbAlarm7); - this.CollectionLabelSbAlarm.Add(this.labelSbAlarm8); - this.CollectionLabelSbAlarm.Add(this.labelSbAlarm9); - this.CollectionLabelSbAlarm.Add(this.labelSbAlarm10); - - 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.buttonRecipeNo.ButtonText = this.ParentForm.SystemConfig.RECIPE_NUMBER.ToString(); - this.UpdateDisplayUser(this.ParentForm.CurrentSystemStatus.CurrentUser); - } - private void InitializeData() - { - for (int i = 0; i < this.ParentForm.SystemConfig.EQUIPMENT_LANE; i++) - { - this.CollectionLabelResult[i].Visible = false; - this.CollectionLabelPressure[i].Text = "0.0"; - this.CollectionLabelLeakRatePerSec[i].Text = "0.0"; - this.CollectionLabelSbAlarm[i].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 = "Product entry"; - this.labelProgress2_1.Text = "Measuring"; - this.labelProgress3_1.Text = "Discharge"; - break; - default: - break; - } - } - - private void SelectProcessLabelRefresh(int index) - { - this.CollectionLabelProgress[index].Location = new Point(this.CollectionLabelProgress[index].Location.X - 17, this.CollectionLabelProgress[index].Location.Y - 15); - this.CollectionLabelProgress[index].Size = this.SizeProgressOn; - this.CollectionLabelProgress[index].RoundRectFillColor = this.ColorProgressOn; - // 문구가 적히는 label - this.CollectionLabelProgress2[index].BackGroundColor = this.ColorProgressOn; - - this.CollectionPictureBoxSelected[index].Visible = true; - this.CollectionPictureBoxSelected[index].BringToFront(); - } - private void UnselectProcessLabelRefresh(int index) - { - this.CollectionLabelProgress[index].Location = this.CollectionLabelPoint[index]; - this.CollectionLabelProgress[index].Size = this.SizeProgressOff; - this.CollectionLabelProgress[index].RoundRectFillColor = this.ColorProgressOff; - // 문구가 적히는 label - this.CollectionLabelProgress2[index].BackGroundColor = this.ColorProgressOff; - - this.CollectionPictureBoxSelected[index].Visible = false; - //this.CollectionPictureBoxUnselected[index].BringToFront(); - } - private void InitializeProcessLabelRefresh() - { - for (int i = 0; i < this.CollectionLabelProgress.Count; i++) - this.CollectionLabelProgress[i].RoundRectFillColor = this.CollectionLabelProgress[i].RoundRectFillColor; - } - - 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 UpdateDisplayUser(UserItem user) - { - string id = "", group = ""; - - 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.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.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(); - - 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(); - - 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(); - - 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.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 = "-"; - - 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); - - if (this.labelUserLevel.Text != group) - this.labelUserLevel.Text = group; - if (this.labelUserID.Text != id) - this.labelUserID.Text = id; - } - private void Login() - { - DialogFormLogOn logOn = new DialogFormLogOn(this.ParentForm, false, false); - if (logOn.ShowDialog() == DialogResult.OK) - { - this.DisplayRefresh(); - this.buttonUser.ButtonDown(); - this.buttonUser.ButtonText = "Logout"; - //this.ParentForm.TimerAutomaticLogout(true, this.ParentForm.SystemConfig.AutomaticLogout); - - // Part 11 - this.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.Login, ""); - } - else - { - this.buttonUser.ButtonUp(); - } - } - public void Logout() - { - this.ParentForm.CurrentSystemStatus.CurrentUser.Group = Define.E_UserGroup.LogOut; - this.buttonUser.ButtonUp(); - this.buttonUser.ButtonText = "Login"; - this.DisplayRefresh(); - - // Part 11 - this.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.Logout, ""); - } - public void Part11AutomaticLogoutReset() - { - //UserManager.UserManager_AutoLogoutTimeoutReset(); - } - - 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._1_Initial: - // this.progressBar3.Visible = false; - // this.progressBar4.Visible = false; - // this.progressBar2.Visible = false; - // if (this.smartTimerProgressBar.IsStart == true) - // this.smartTimerProgressBar.Stop(); - // break; - // case Define.E_ProcessStatus._4_VacuumStart: - // this.progressBar3.Maximum = this.ParentForm.CurrentRecipe.VACUUM_RELIEF * 10; - // this.progressBar3.Value = this.progressBar3.Maximum; - - // this.progressBar3.Visible = true; - // this.smartTimerProgressBar.Start(); - // break; - // case Define.E_ProcessStatus._5_VacuumHold: - // this.progressBar4.Maximum = this.ParentForm.CurrentRecipe.VACUUM_HOLD1 * 10; - // this.progressBar4.Value = this.progressBar4.Maximum; - - // if (this.smartTimerProgressBar.IsStart == true) - // this.smartTimerProgressBar.Stop(); - // this.progressBar3.Visible = false; - // this.progressBar4.Visible = true; - // this.smartTimerProgressBar.Start(); - // break; - // case Define.E_ProcessStatus._7_VacuumBreak: - // this.progressBar2.Maximum = this.ParentForm.CurrentRecipe.VACUUM_BLOWOFF * 10; - // this.progressBar2.Value = this.progressBar2.Maximum; - - // if (this.smartTimerProgressBar.IsStart == true) - // this.smartTimerProgressBar.Stop(); - // this.progressBar4.Visible = false; - // this.progressBar2.Visible = true; - // this.smartTimerProgressBar.Start(); - // break; - // case Define.E_ProcessStatus._8_ChamberSeparation: - // if (this.smartTimerProgressBar.IsStart == true) - // this.smartTimerProgressBar.Stop(); - // this.progressBar2.Visible = false; - // break; - // default: - // break; - //} - } - private void ProgressBarSetting(Define.E_ProcessStatus2 status) - { - switch (status) - { - case Define.E_ProcessStatus2._1_Initial: - this.progressBar2.Visible = false; - if (this.smartTimerProgressBar.IsStart == true) - this.smartTimerProgressBar.Stop(); - break; - case Define.E_ProcessStatus2._2_MovementAndProductEntry: - break; - case Define.E_ProcessStatus2._3_Measuring: - this.progressBar2.Maximum = this.ParentForm.CurrentRecipe.VACUUM_HOLD1 * 10; - this.progressBar2.Value = this.progressBar2.Maximum; - - if (this.smartTimerProgressBar.IsStart == true) - this.smartTimerProgressBar.Stop(); - this.progressBar2.Visible = true; - this.smartTimerProgressBar.Start(); - break; - case Define.E_ProcessStatus2._4_DischargeAndReturnToOrigin: - if (this.smartTimerProgressBar.IsStart == true) - this.smartTimerProgressBar.Stop(); - break; - default: - break; - } - } - - public void UpdateProcessStatusDisplay(Define.E_ProcessStatus status) - { - this.ProcessStatus = status; - - switch (this.PreviousStageNum) - { - case Define.E_ProcessStatus._0_None: - break; - case Define.E_ProcessStatus._1_Initial: - for (int i = 0; i < this.CollectionLabelProgress.Count; i++) - this.CollectionLabelProgress[i].Location = this.CollectionLabelPoint[i]; - - this.UnselectProcessLabelRefresh(0); - break; - case Define.E_ProcessStatus._2_ProductEntry: - this.UnselectProcessLabelRefresh(1); - break; - case Define.E_ProcessStatus._3_ChamberConbined: - this.UnselectProcessLabelRefresh(2); - break; - case Define.E_ProcessStatus._4_VacuumStart: - this.UnselectProcessLabelRefresh(3); - break; - case Define.E_ProcessStatus._5_VacuumHold: - this.UnselectProcessLabelRefresh(4); - break; - case Define.E_ProcessStatus._6_Judgment: - break; - case Define.E_ProcessStatus._7_VacuumBreak: - this.UnselectProcessLabelRefresh(5); - break; - case Define.E_ProcessStatus._8_ChamberSeparation: - this.UnselectProcessLabelRefresh(6); - break; - case Define.E_ProcessStatus._9_ProductRelease: - this.UnselectProcessLabelRefresh(7); - break; - default: - break; - } - - switch (status) - { - case Define.E_ProcessStatus._0_None: - break; - case Define.E_ProcessStatus._1_Initial: - for (int i = 0; i < this.CollectionLabelProgress.Count; i++) - this.CollectionLabelProgress[i].Location = this.CollectionLabelPoint[i]; - - this.SelectProcessLabelRefresh(0); - break; - case Define.E_ProcessStatus._2_ProductEntry: - this.SelectProcessLabelRefresh(1); - break; - case Define.E_ProcessStatus._3_ChamberConbined: - this.SelectProcessLabelRefresh(2); - break; - case Define.E_ProcessStatus._4_VacuumStart: - this.SelectProcessLabelRefresh(3); - break; - case Define.E_ProcessStatus._5_VacuumHold: - this.SelectProcessLabelRefresh(4); - break; - case Define.E_ProcessStatus._6_Judgment: - break; - case Define.E_ProcessStatus._7_VacuumBreak: - this.SelectProcessLabelRefresh(5); - break; - case Define.E_ProcessStatus._8_ChamberSeparation: - this.SelectProcessLabelRefresh(6); - break; - case Define.E_ProcessStatus._9_ProductRelease: - this.SelectProcessLabelRefresh(7); - break; - default: - break; - } - - this.PreviousStageNum = status; - this.ProgressBarSetting(status); - } - 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 "; - - // SB Alarm - this.CollectionLabelSbAlarm[0].Visible = alarm.CollectionIsSensorBoardError[0]; - this.CollectionLabelSbAlarm[1].Visible = alarm.CollectionIsSensorBoardError[1]; - this.CollectionLabelSbAlarm[2].Visible = alarm.CollectionIsSensorBoardError[2]; - this.CollectionLabelSbAlarm[3].Visible = alarm.CollectionIsSensorBoardError[3]; - this.CollectionLabelSbAlarm[4].Visible = alarm.CollectionIsSensorBoardError[4]; - this.CollectionLabelSbAlarm[5].Visible = alarm.CollectionIsSensorBoardError[5]; - this.CollectionLabelSbAlarm[6].Visible = alarm.CollectionIsSensorBoardError[6]; - this.CollectionLabelSbAlarm[7].Visible = alarm.CollectionIsSensorBoardError[7]; - this.CollectionLabelSbAlarm[8].Visible = alarm.CollectionIsSensorBoardError[8]; - this.CollectionLabelSbAlarm[9].Visible = alarm.CollectionIsSensorBoardError[9]; - - 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); - } - } - public void UpdateDisplayDiffData(Collection datas) - { - for (int i = 0; i < this.ParentForm.SystemConfig.EQUIPMENT_LANE; i++) - this.CollectionLabelLeakRatePerSec[i].Text = datas[i].SecBufDiff; - } - public void UpdateDisplayDispData(Collection datas) - { - - } - public void UpdateDisplayPresData(Collection datas) - { - for (int i = 0; i < this.ParentForm.SystemConfig.EQUIPMENT_LANE; i++) - this.CollectionLabelPressure[i].Text = datas[i].WorkingChamber.Trim(); - } - public void UpdateDisplayJudgmentData(LeakData datas) - { - for (int i = 0; i < this.ParentForm.SystemConfig.EQUIPMENT_LANE; i++) - { - this.GetJudgmentResult(datas.CollJudgment[i], this.CollectionLabelResult[i]); - this.CollectionLabelResult[i].Visible = true; - } - - this.ParentForm.TrackingInspectionData(datas); - this.ChildControl.UpdateStartLeakDataDisplay(datas); - } - public void UpdateDisplayRecipeData(Recipe data) - { - this.buttonRecipeNo.ButtonText = data.NUMBER.ToString(); - } - public void UpdateDisplayTime() - { - this.labelTime.Text = DateTime.Now.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.InitializeProcessLabelRefresh(); - - this.UpdateDisplayUser(this.ParentForm.CurrentSystemStatus.CurrentUser); - } - #endregion - - #region Override Member - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - this.smartTimerLogin.Start(); - } - #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 = ""; - - 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 buttonDisplayGraph_Click(object sender, EventArgs e) - { - this.ChildControl.DisplayRefresh(1); - this.ChildControl.Visible = true; - } - private void buttonInspection_Click(object sender, EventArgs e) - { - this.ParentForm.TransferData(CommunicationCommand.CutInpupt, CommunicationID.MainBoard); - - this.InitializeData(); - this.ChildControl.ClearAllData(); - } - private void buttonUser_Click(object sender, EventArgs e) - { - 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.InitializeProcessLabelRefresh(); - } - private void buttonMenu_Click(object sender, EventArgs e) - { - if (this.ParentForm.CurrentSystemStatus.EquipmentStatus == Define.E_EquipmentStatus.Stop) - { - this.ParentForm.ChildFormMenu.DisplayRefresh(this.ParentForm.CurrentSystemStatus); - this.ParentForm.FormChange((int)Define.E_FormStore.FormMenu); - } - } - - 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) - { - //switch (this.ProcessStatus) - //{ - // case Define.E_ProcessStatus._4_VacuumStart: - // if (this.progressBar3.Value > 0) - // this.progressBar3.Value -= 10; - // else - // this.smartTimerProgressBar.Stop(); - // break; - // case Define.E_ProcessStatus._5_VacuumHold: - // if (this.progressBar4.Value > 0) - // this.progressBar4.Value -= 10; - // else - // this.smartTimerProgressBar.Stop(); - // break; - // case Define.E_ProcessStatus._7_VacuumBreak: - // if (this.progressBar2.Value > 0) - // this.progressBar2.Value -= 10; - // else - // this.smartTimerProgressBar.Stop(); - // break; - // default: - // break; - //} - } - #endregion - - private void smartButton1_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 smartButton2_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 smartButton3_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 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.UpdateProcessStatusDisplay(Define.E_ProcessStatus._1_Initial); - break; - case 1: - this.UpdateProcessStatusDisplay(Define.E_ProcessStatus._2_ProductEntry); - break; - case 2: - this.UpdateProcessStatusDisplay(Define.E_ProcessStatus._3_ChamberConbined); - break; - case 3: - this.UpdateProcessStatusDisplay(Define.E_ProcessStatus._4_VacuumStart); - break; - case 4: - this.UpdateProcessStatusDisplay(Define.E_ProcessStatus._5_VacuumHold); - break; - case 5: - this.UpdateProcessStatusDisplay(Define.E_ProcessStatus._7_VacuumBreak); - break; - case 6: - this.UpdateProcessStatusDisplay(Define.E_ProcessStatus._8_ChamberSeparation); - break; - case 7: - this.UpdateProcessStatusDisplay(Define.E_ProcessStatus._9_ProductRelease); - break; - default: - break; - } - - if (this.testIndex >= 7) - this.testIndex = 0; - else - this.testIndex++; - } - } -} \ No newline at end of file