ITC81DB_V8/ITC81DB/Controls/MainDisplay/ControlMainSubMenu.cs

1068 lines
52 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using SmartX;
using ITC81DB.DialogForms;
using ITC81DB.Forms;
using ITC81DB_ImageDll;
namespace ITC81DB.Controls
{
public partial class ControlMainSubMenu : UserControl
{
#region Field
private FormMainDisplay m_ParentForm;
#endregion
#region Constructor
public ControlMainSubMenu(FormMainDisplay parent)
{
InitializeComponent();
this.ParentForm = parent;
this.InitializeDesign();
this.DefaultSetting();
}
#endregion
#region Property
public FormMainDisplay ParentForm
{
get { return this.m_ParentForm; }
set { this.m_ParentForm = value; }
}
#endregion
#region Method
public void InitializeDesign()
{
Class1 images = new Class1();
if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.English)
{
this.buttonBypassDirection.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korBypassOccasionDown));
this.buttonBypassDirection.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korBypassOccasionUp));
this.buttonBypassOnce.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engBypassCountDown));
this.buttonBypassOnce.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engBypassCountUp));
this.labelTitleBypass.Text = "Bypass";
this.labelTitleSorterSettings.Text = "Sorter settings";
this.labelTitleAutoZero.Text = "Auto Zero";
this.labelTitleSorterA.Text = "Sorter A";
this.labelTitleSorterB.Text = "Sorter B";
this.labelTitleSorterMode.Text = "Mode";
this.labelTitleSorterDelayTime.Text = "Delay time";
this.labelTitleSorterRunTime.Text = "Run time";
this.labelTitleMode1Time.Text = "Time";
this.labelTitleMode1Range.Text = "Range";
this.labelTitleMode1Variate.Text = "Variation";
this.radioButtonMode1High.Text = "High";
this.radioButtonMode1Middle.Text = "Middle";
this.radioButtonMode1Low.Text = "Low";
this.radioButtonMode1UserSetting.Text = "User Setting";
this.labelTitleDryContact1.Text = "Latch control1";
this.labelTitleDryContact2.Text = "Latch control2";
this.labelTitleDryContact3.Text = "Latch control3";
this.labelTitleDryContact4.Text = "Latch control4";
this.comboBoxSorterA.SelectedIndexChanged -= new EventHandler(this.comboBoxSorterA_SelectedIndexChanged);
this.comboBoxSorterA.Items.Clear();
this.comboBoxSorterA.Items.Add("None");
this.comboBoxSorterA.Items.Add("Over");
this.comboBoxSorterA.Items.Add("Under");
this.comboBoxSorterA.Items.Add("NG");
this.comboBoxSorterA.SelectedIndex = 1;
this.comboBoxSorterA.SelectedIndexChanged += new EventHandler(this.comboBoxSorterA_SelectedIndexChanged);
this.comboBoxSorterB.SelectedIndexChanged -= new EventHandler(this.comboBoxSorterB_SelectedIndexChanged);
this.comboBoxSorterB.Items.Clear();
this.comboBoxSorterB.Items.Add("None");
this.comboBoxSorterB.Items.Add("Over");
this.comboBoxSorterB.Items.Add("Under");
this.comboBoxSorterB.Items.Add("NG");
this.comboBoxSorterB.SelectedIndex = 2;
this.comboBoxSorterB.SelectedIndexChanged += new EventHandler(this.comboBoxSorterB_SelectedIndexChanged);
this.labelTitleDispDelayTime1.Text = "Delay 1 time";
this.labelTitleDispDelayTime2.Text = "Delay 2 time";
this.labelTitleDispenser.Text = "Dispenser";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese)
{
this.buttonBypassDirection.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnBypassOccasionDown));
this.buttonBypassDirection.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnBypassOccasionUp));
this.buttonBypassOnce.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnBypassCountDown));
this.buttonBypassOnce.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnBypassCountUp));
this.labelTitleBypass.Text = "旁路";
this.labelTitleSorterSettings.Text = "筛选设定";
this.labelTitleAutoZero.Text = "自动零点跟踪";
this.labelTitleSorterA.Text = "分类机A";
this.labelTitleSorterB.Text = "分类机B";
this.labelTitleSorterMode.Text = "模式";
this.labelTitleSorterDelayTime.Text = "延迟时间";
this.labelTitleSorterRunTime.Text = "运行时间";
this.labelTitleMode1Time.Text = "时间";
this.labelTitleMode1Range.Text = "范围";
this.labelTitleMode1Variate.Text = "变化";
this.radioButtonMode1High.Text = "高";
this.radioButtonMode1Middle.Text = "中间";
this.radioButtonMode1Low.Text = "低";
this.radioButtonMode1UserSetting.Text = "用户设置";
this.labelTitleDryContact1.Text = "闩锁控制1";
this.labelTitleDryContact2.Text = "闩锁控制2";
this.labelTitleDryContact3.Text = "闩锁控制3";
this.labelTitleDryContact4.Text = "闩锁控制4";
this.comboBoxSorterA.SelectedIndexChanged -= new EventHandler(this.comboBoxSorterA_SelectedIndexChanged);
this.comboBoxSorterA.Items.Clear();
this.comboBoxSorterA.Items.Add("不使用");
this.comboBoxSorterA.Items.Add("超过");
this.comboBoxSorterA.Items.Add("低于");
this.comboBoxSorterA.Items.Add("不良");
this.comboBoxSorterA.SelectedIndex = 1;
this.comboBoxSorterA.SelectedIndexChanged += new EventHandler(this.comboBoxSorterA_SelectedIndexChanged);
this.comboBoxSorterB.SelectedIndexChanged -= new EventHandler(this.comboBoxSorterB_SelectedIndexChanged);
this.comboBoxSorterB.Items.Clear();
this.comboBoxSorterB.Items.Add("不使用");
this.comboBoxSorterB.Items.Add("超过");
this.comboBoxSorterB.Items.Add("低于");
this.comboBoxSorterB.Items.Add("不良");
this.comboBoxSorterB.SelectedIndex = 2;
this.comboBoxSorterB.SelectedIndexChanged += new EventHandler(this.comboBoxSorterB_SelectedIndexChanged);
this.labelTitleDispDelayTime1.Text = "延迟1时间";
this.labelTitleDispDelayTime2.Text = "延迟2时间";
this.labelTitleDispenser.Text = "自动售货机";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech)
{
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian)
{
this.buttonBypassDirection.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusBypassOccasionDown));
this.buttonBypassDirection.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusBypassOccasionUp));
this.buttonBypassOnce.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusBypassCountDown));
this.buttonBypassOnce.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusBypassCountUp));
this.labelTitleBypass.Text = "Транспортера";
this.labelTitleSorterSettings.Text = "Настройка сортировки";
this.labelTitleAutoZero.Text = "Автоотслеживание нуля";
this.labelTitleSorterA.Font = this.labelTitleSorterB.Font = new Font("새굴림", 9, FontStyle.Regular);
this.labelTitleSorterA.Text = "Сортировщик А";
this.labelTitleSorterB.Text = "Сортировщик В";
this.labelTitleSorterMode.Text = "Режим";
this.labelTitleSorterDelayTime.Text = "задержки";
this.labelTitleSorterRunTime.Text = "выполнения";
this.labelTitleMode1Time.Text = "Время";
this.labelTitleMode1Range.Text = "Диапазон";
this.labelTitleMode1Variate.Text = "Регулировка";
this.radioButtonMode1High.Text = "Высокий";
this.radioButtonMode1Middle.Text = "Средний";
this.radioButtonMode1Low.Text = "Низкий";
this.radioButtonMode1UserSetting.Text = "Пользователя";
this.labelTitleDryContact1.Text = "контроль защелки1";
this.labelTitleDryContact2.Text = "контроль защелки2";
this.labelTitleDryContact3.Text = "контроль защелки3";
this.labelTitleDryContact4.Text = "контроль защелки4";
this.comboBoxSorterA.SelectedIndexChanged -= new EventHandler(this.comboBoxSorterA_SelectedIndexChanged);
this.comboBoxSorterA.Items.Clear();
this.comboBoxSorterA.Items.Add("Нет");
this.comboBoxSorterA.Items.Add("Много");
this.comboBoxSorterA.Items.Add("Мало");
this.comboBoxSorterA.Items.Add("Дефект");
this.comboBoxSorterA.SelectedIndex = 1;
this.comboBoxSorterA.SelectedIndexChanged += new EventHandler(this.comboBoxSorterA_SelectedIndexChanged);
this.comboBoxSorterB.SelectedIndexChanged -= new EventHandler(this.comboBoxSorterB_SelectedIndexChanged);
this.comboBoxSorterB.Items.Clear();
this.comboBoxSorterB.Items.Add("Нет");
this.comboBoxSorterB.Items.Add("Много");
this.comboBoxSorterB.Items.Add("Мало");
this.comboBoxSorterB.Items.Add("Дефект");
this.comboBoxSorterB.SelectedIndex = 2;
this.comboBoxSorterB.SelectedIndexChanged += new EventHandler(this.comboBoxSorterB_SelectedIndexChanged);
this.labelTitleDispDelayTime1.Text = "Время задержки1";
this.labelTitleDispDelayTime2.Text = "Время задержки2";
this.labelTitleDispenser.Text = "распылитель";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German)
{
this.buttonBypassDirection.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerBypassOccasionDown));
this.buttonBypassDirection.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerBypassOccasionUp));
this.buttonBypassOnce.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerBypassCountDown));
this.buttonBypassOnce.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerBypassCountUp));
this.labelTitleBypass.Text = "Bypass";
this.labelTitleSorterSettings.Text = "Sortierereinstellung";
this.labelTitleAutoZero.Text = "Automatische Nullung";
this.labelTitleSorterA.Text = "Sortierer A";
this.labelTitleSorterB.Text = "Sortierer B";
this.labelTitleSorterMode.Text = "Modus";
this.labelTitleSorterDelayTime.Text = "Vezögerung";
this.labelTitleSorterRunTime.Text = "Laufzeit";
this.labelTitleMode1Time.Text = "Zeit";
this.labelTitleMode1Range.Text = "Bereich";
this.labelTitleMode1Variate.Text = "Unterschied";
this.labelTitleDryContact1.Text = "Trockener Kontakt";
this.radioButtonMode1High.Text = "Hoch";
this.radioButtonMode1Middle.Text = "Mitte";
this.radioButtonMode1Low.Text = "Niedrig";
this.radioButtonMode1UserSetting.Text = "Nutzer";
this.labelTitleDryContact1.Text = "Verriegelungssteuerung1";
this.labelTitleDryContact2.Text = "Verriegelungssteuerung2";
this.labelTitleDryContact3.Text = "Verriegelungssteuerung3";
this.labelTitleDryContact4.Text = "Verriegelungssteuerung4";
this.comboBoxSorterA.SelectedIndexChanged -= new EventHandler(this.comboBoxSorterA_SelectedIndexChanged);
this.comboBoxSorterA.Items.Clear();
this.comboBoxSorterA.Items.Add("Keiner");
this.comboBoxSorterA.Items.Add("Max.");
this.comboBoxSorterA.Items.Add("Min.");
this.comboBoxSorterA.Items.Add("Schlecht");
this.comboBoxSorterA.SelectedIndex = 1;
this.comboBoxSorterA.SelectedIndexChanged += new EventHandler(this.comboBoxSorterA_SelectedIndexChanged);
this.comboBoxSorterB.SelectedIndexChanged -= new EventHandler(this.comboBoxSorterB_SelectedIndexChanged);
this.comboBoxSorterB.Items.Clear();
this.comboBoxSorterB.Items.Add("Keiner");
this.comboBoxSorterB.Items.Add("Max.");
this.comboBoxSorterB.Items.Add("Min.");
this.comboBoxSorterB.Items.Add("Schlecht");
this.comboBoxSorterB.SelectedIndex = 2;
this.comboBoxSorterB.SelectedIndexChanged += new EventHandler(this.comboBoxSorterB_SelectedIndexChanged);
this.labelTitleDispDelayTime1.Text = "Vezögerung 1";
this.labelTitleDispDelayTime2.Text = "Vezögerung 2";
this.labelTitleDispenser.Text = "Spender";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish)
{
this.buttonBypassDirection.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korBypassOccasionDown));
this.buttonBypassDirection.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korBypassOccasionUp));
this.buttonBypassOnce.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engBypassCountDown));
this.buttonBypassOnce.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engBypassCountUp));
this.labelTitleBypass.Text = "Bypass";
this.labelTitleSorterSettings.Text = "Clasificador";
this.labelTitleAutoZero.Text = "Seguimiento de cero";
this.labelTitleSorterA.Text = "Clasificador A";
this.labelTitleSorterB.Text = "Clasificador B";
this.labelTitleSorterMode.Text = "Modo";
this.labelTitleSorterDelayTime.Text = "Retardo";
this.labelTitleSorterRunTime.Text = "Ejecución";
this.labelTitleMode1Time.Text = "Tiempo";
this.labelTitleMode1Range.Text = "Distancia";
this.labelTitleMode1Variate.Text = "Variación";
this.radioButtonMode1High.Text = "Alto";
this.radioButtonMode1Middle.Text = "Medio";
this.radioButtonMode1Low.Text = "Bajo";
this.radioButtonMode1UserSetting.Text = "Usuario";
this.labelTitleDryContact1.Text = "Control de pestillo1";
this.labelTitleDryContact2.Text = "Control de pestillo2";
this.labelTitleDryContact3.Text = "Control de pestillo3";
this.labelTitleDryContact4.Text = "Control de pestillo4";
this.comboBoxSorterA.SelectedIndexChanged -= new EventHandler(this.comboBoxSorterA_SelectedIndexChanged);
this.comboBoxSorterA.Items.Clear();
this.comboBoxSorterA.Items.Add("Ninguna");
this.comboBoxSorterA.Items.Add("Superior");
this.comboBoxSorterA.Items.Add("Inferior");
this.comboBoxSorterA.Items.Add("NG");
this.comboBoxSorterA.SelectedIndex = 1;
this.comboBoxSorterA.SelectedIndexChanged += new EventHandler(this.comboBoxSorterA_SelectedIndexChanged);
this.comboBoxSorterB.SelectedIndexChanged -= new EventHandler(this.comboBoxSorterB_SelectedIndexChanged);
this.comboBoxSorterB.Items.Clear();
this.comboBoxSorterB.Items.Add("Ninguna");
this.comboBoxSorterB.Items.Add("Superior");
this.comboBoxSorterB.Items.Add("Inferior");
this.comboBoxSorterB.Items.Add("NG");
this.comboBoxSorterB.SelectedIndex = 2;
this.comboBoxSorterB.SelectedIndexChanged += new EventHandler(this.comboBoxSorterB_SelectedIndexChanged);
this.labelTitleDispDelayTime1.Text = "1 Tiempo de retardo";
this.labelTitleDispDelayTime2.Text = "2 Tiempo de retardo";
this.labelTitleDispenser.Text = "dispensador";
}
else
{
this.buttonBypassDirection.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korBypassOccasionDown));
this.buttonBypassDirection.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korBypassOccasionUp));
this.buttonBypassOnce.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korBypassCountDown));
this.buttonBypassOnce.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korBypassCountUp));
this.labelTitleBypass.Text = "Bypass";
this.labelTitleSorterSettings.Text = "선별기 설정";
this.labelTitleAutoZero.Text = "자동 영점";
this.labelTitleSorterA.Text = "선별부 A";
this.labelTitleSorterB.Text = "선별부 B";
this.labelTitleSorterMode.Text = "모드";
this.labelTitleSorterDelayTime.Text = "지연시간";
this.labelTitleSorterRunTime.Text = "동작시간";
this.labelTitleMode1Time.Text = "시간";
this.labelTitleMode1Range.Text = "범위";
this.labelTitleMode1Variate.Text = "변량";
this.radioButtonMode1High.Text = "High";
this.radioButtonMode1Middle.Text = "Middle";
this.radioButtonMode1Low.Text = "Low";
this.radioButtonMode1UserSetting.Text = "User Setting";
this.labelTitleDryContact1.Text = "시건장치 제어1";
this.labelTitleDryContact2.Text = "시건장치 제어2";
this.labelTitleDryContact3.Text = "시건장치 제어3";
this.labelTitleDryContact4.Text = "시건장치 제어4";
this.comboBoxSorterA.SelectedIndexChanged -= new EventHandler(this.comboBoxSorterA_SelectedIndexChanged);
this.comboBoxSorterA.Items.Clear();
this.comboBoxSorterA.Items.Add("사용안함");
this.comboBoxSorterA.Items.Add("과량");
this.comboBoxSorterA.Items.Add("경량");
this.comboBoxSorterA.Items.Add("불량");
this.comboBoxSorterA.SelectedIndex = 1;
this.comboBoxSorterA.SelectedIndexChanged += new EventHandler(this.comboBoxSorterA_SelectedIndexChanged);
this.comboBoxSorterB.SelectedIndexChanged -= new EventHandler(this.comboBoxSorterB_SelectedIndexChanged);
this.comboBoxSorterB.Items.Clear();
this.comboBoxSorterB.Items.Add("사용안함");
this.comboBoxSorterB.Items.Add("과량");
this.comboBoxSorterB.Items.Add("경량");
this.comboBoxSorterB.Items.Add("불량");
this.comboBoxSorterB.SelectedIndex = 2;
this.comboBoxSorterB.SelectedIndexChanged += new EventHandler(this.comboBoxSorterB_SelectedIndexChanged);
this.labelTitleDispDelayTime1.Text = "지연시간 1";
this.labelTitleDispDelayTime2.Text = "지연시간 2";
this.labelTitleDispenser.Text = "디스펜서";
}
}
private void DefaultSetting()
{
this.comboBoxMode1Variate.SelectedIndexChanged -= new EventHandler(this.comboBoxMode1Variate_SelectedIndexChanged);
this.comboBoxMode1Variate.Items.Clear();
this.comboBoxMode1Variate.Items.Add(0.1);
this.comboBoxMode1Variate.Items.Add(0.2);
this.comboBoxMode1Variate.Items.Add(0.5);
this.comboBoxMode1Variate.Items.Add(1.0);
this.comboBoxMode1Variate.SelectedIndex = 0;
this.comboBoxMode1Variate.SelectedIndexChanged += new EventHandler(this.comboBoxMode1Variate_SelectedIndexChanged);
}
private void ControlEnableMode1(bool time, bool range, bool variate)
{
if (time == true)
{
if (this.labelMode1Time.ForeColor != Color.Black)
this.labelMode1Time.ForeColor = Color.Black;
}
else
{
if (this.labelMode1Time.ForeColor != Color.DarkGray)
this.labelMode1Time.ForeColor = Color.DarkGray;
}
if (range == true)
{
if (this.labelMode1Range.ForeColor != Color.Black)
this.labelMode1Range.ForeColor = Color.Black;
}
else
{
if (this.labelMode1Range.ForeColor != Color.DarkGray)
this.labelMode1Range.ForeColor = Color.DarkGray;
}
if (this.labelMode1Time.Enabled != time)
this.labelMode1Time.Enabled = time;
if (this.labelMode1Range.Enabled != range)
this.labelMode1Range.Enabled = range;
if (this.comboBoxMode1Variate.Enabled != variate)
this.comboBoxMode1Variate.Enabled = variate;
}
public void UpdateEquipmentStatusDisplay(DataStore.EquipmentStatus status)
{
if (status == DataStore.EquipmentStatus.Stop)
{
this.labelDispDelayTime1.Enabled = true;
this.labelDispDelayTime2.Enabled = true;
this.labelDispDelayTime1.ForeColor = Color.Black;
this.labelDispDelayTime2.ForeColor = Color.Black;
}
else
{
this.labelDispDelayTime1.Enabled = false;
this.labelDispDelayTime2.Enabled = false;
this.labelDispDelayTime1.ForeColor = Color.DarkGray;
this.labelDispDelayTime2.ForeColor = Color.DarkGray;
}
}
private void UpdateDisplayUser(UserItem user)
{
switch (user.Group)
{
case DataStore.UserGroup.LogOut:
this.groupBoxSorter.Enabled = false;
this.groupBoxAutoZero.Enabled = false;
this.groupBoxBypass.Enabled = false;
break;
case DataStore.UserGroup.Level1Operator:
this.groupBoxSorter.Enabled = false;
this.groupBoxAutoZero.Enabled = false;
this.groupBoxBypass.Enabled = false;
break;
case DataStore.UserGroup.Level2Engineer:
this.groupBoxSorter.Enabled = true;
this.groupBoxAutoZero.Enabled = true;
this.groupBoxBypass.Enabled = true;
break;
case DataStore.UserGroup.Level3Manager:
this.groupBoxSorter.Enabled = true;
this.groupBoxAutoZero.Enabled = true;
this.groupBoxBypass.Enabled = true;
break;
case DataStore.UserGroup.Level4Developer:
this.groupBoxSorter.Enabled = true;
this.groupBoxAutoZero.Enabled = true;
this.groupBoxBypass.Enabled = true;
break;
case DataStore.UserGroup.NotLogin:
this.groupBoxSorter.Enabled = true;
this.groupBoxAutoZero.Enabled = true;
this.groupBoxBypass.Enabled = true;
break;
default:
this.groupBoxSorter.Enabled = false;
this.groupBoxAutoZero.Enabled = false;
this.groupBoxBypass.Enabled = false;
break;
}
this.UpdateDryContactControl(this.ParentForm.ParentForm.CurrentSystemParameter3, user.Group);
}
public void UpdateDryContactControl(SystemParameter3 item, DataStore.UserGroup userGroup)
{
int count = 0;
if (userGroup == DataStore.UserGroup.Level1Operator || userGroup == DataStore.UserGroup.LogOut)
{
this.buttonDry1.Enabled = false;
this.buttonDry2.Enabled = false;
this.buttonDry3.Enabled = false;
this.buttonDry4.Enabled = false;
}
else
{
this.buttonDry1.Enabled = true;
this.buttonDry2.Enabled = true;
this.buttonDry3.Enabled = true;
this.buttonDry4.Enabled = true;
}
if (item.ExternalOut1Mode == "10")
{
this.labelTitleDryContact1.Visible = true;
this.buttonDry1.Visible = true;
count++;
}
else
{
this.labelTitleDryContact1.Visible = false;
this.buttonDry1.Visible = false;
}
if (item.ExternalOut2Mode == "10")
{
if (count == 1)
{
this.labelTitleDryContact2.Location = new Point(388, 182);
this.buttonDry2.Location = new Point(624, 182);
}
else if (count == 0)
{
this.labelTitleDryContact2.Location = new Point(388, 146);
this.buttonDry2.Location = new Point(624, 146);
}
this.labelTitleDryContact2.Visible = true;
this.buttonDry2.Visible = true;
count++;
}
else
{
this.labelTitleDryContact2.Visible = false;
this.buttonDry2.Visible = false;
}
if (item.ExternalOut3Mode == "10")
{
if (count == 2)
{
this.labelTitleDryContact3.Location = new Point(388, 218);
this.buttonDry3.Location = new Point(624, 218);
}
else if (count == 1)
{
this.labelTitleDryContact3.Location = new Point(388, 182);
this.buttonDry3.Location = new Point(624, 182);
}
else if (count == 0)
{
this.labelTitleDryContact3.Location = new Point(388, 146);
this.buttonDry3.Location = new Point(624, 146);
}
this.labelTitleDryContact3.Visible = true;
this.buttonDry3.Visible = true;
count++;
}
else
{
this.labelTitleDryContact3.Visible = false;
this.buttonDry3.Visible = false;
}
if (item.ExternalOut4Mode == "10")
{
if (count == 3)
{
this.labelTitleDryContact4.Location = new Point(388, 254);
this.buttonDry4.Location = new Point(624, 254);
}
else if (count == 2)
{
this.labelTitleDryContact4.Location = new Point(388, 218);
this.buttonDry4.Location = new Point(624, 218);
}
else if (count == 1)
{
this.labelTitleDryContact4.Location = new Point(388, 182);
this.buttonDry4.Location = new Point(624, 182);
}
else if (count == 0)
{
this.labelTitleDryContact4.Location = new Point(388, 146);
this.buttonDry4.Location = new Point(624, 146);
}
this.labelTitleDryContact4.Visible = true;
this.buttonDry4.Visible = true;
}
else
{
this.labelTitleDryContact4.Visible = false;
this.buttonDry4.Visible = false;
}
}
public void UpdateControl(JudgmentSetItem item, SystemParameter4 parameter, ProductItem pItem)
{
int iValue = 0;
string value = "";
#region Sorter
this.comboBoxSorterA.SelectedIndexChanged -= new EventHandler(this.comboBoxSorterA_SelectedIndexChanged);
this.comboBoxSorterB.SelectedIndexChanged -= new EventHandler(this.comboBoxSorterB_SelectedIndexChanged);
// 선별기A 모드
iValue = item.Sorter1Mode;
if (this.comboBoxSorterA.SelectedIndex != iValue)
this.comboBoxSorterA.SelectedIndex = iValue;
// 선별기A 지연시간
iValue = item.Sorter1DelayTime;
if (this.labelSorterADelayTime.Text != iValue.ToString())
this.labelSorterADelayTime.Text = iValue.ToString();
// 선별기A 동작시간
iValue = item.Sorter1RunTime;
if (this.labelSorterARunTime.Text != iValue.ToString())
this.labelSorterARunTime.Text = iValue.ToString();
// 선별기B 모드
iValue = item.Sorter2Mode;
if (this.comboBoxSorterB.SelectedIndex != iValue)
this.comboBoxSorterB.SelectedIndex = iValue;
// 선별기B 지연시간
iValue = item.Sorter2DelayTime;
if (this.labelSorterBDelayTime.Text != iValue.ToString())
this.labelSorterBDelayTime.Text = iValue.ToString();
// 선별기B 동작시간
iValue = item.Sorter2RunTime;
if (this.labelSorterBRunTime.Text != iValue.ToString())
this.labelSorterBRunTime.Text = iValue.ToString();
#endregion
#region AutoZero
// Mode 1
//this.UpdateZero1ParameterDisplay(parameter);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress.ParameterRead4901, "");
#endregion
#region OptionBoard2
value = pItem.DispenserDelayTime1;
if (this.labelDispDelayTime1.Text != value)
this.labelDispDelayTime1.Text = value;
value = pItem.DispenserDelayTime2;
if (this.labelDispDelayTime2.Text != value)
this.labelDispDelayTime2.Text = value;
#endregion
}
public void UpdateZero1ParameterDisplay(SystemParameter4 item)
{
int iValue = 0;
string value = "";
// Mode 1
iValue = int.Parse(item.MainAutoZero1Mode.Trim());
if (iValue == 4)
{
this.ControlEnableMode1(true, true, true);
this.radioButtonMode1UserSetting.Checked = true;
}
else
{
this.ControlEnableMode1(false, false, false);
if (iValue == 1)
this.radioButtonMode1Low.Checked = true;
else if (iValue == 2)
this.radioButtonMode1Middle.Checked = true;
else if (iValue == 3)
this.radioButtonMode1High.Checked = true;
}
// Mode1 Time
value = item.MainAutoZero1Time.Trim();
if (this.labelMode1Time.Text != value)
this.labelMode1Time.Text = value;
// Mode1 Range
value = item.MainAutoZero1Range.Trim();
if (this.labelMode1Range.Text != value)
this.labelMode1Range.Text = value;
// Mode1 Variate
iValue = int.Parse(item.MainAutoZero1Variate.Trim());
this.comboBoxMode1Variate.SelectedIndexChanged -= new EventHandler(this.comboBoxMode1Variate_SelectedIndexChanged);
this.comboBoxMode1Variate.SelectedIndex = iValue;
this.comboBoxMode1Variate.SelectedIndexChanged += new EventHandler(this.comboBoxMode1Variate_SelectedIndexChanged);
}
public bool CurrentStatusButtonBypassRun()
{
bool bValue = false;
if (this.buttonBypassRun.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
bValue = true;
else
bValue = false;
return bValue;
}
public void ChangeEnableButtonBypassRun(bool bValue)
{
if (bValue == true)
{
this.buttonBypassRun.Enabled = true;
}
else
{
this.buttonBypassRun.Enabled = false;
}
}
public void DisplayRefresh(SystemStatus status)
{
this.UpdateDisplayUser(status.CurrentUser);
this.UpdateControl(this.ParentForm.ParentForm.CurrentJudgmentSetItem, this.ParentForm.ParentForm.CurrentSystemParameter4, this.ParentForm.ParentForm.CurrentProductItem);
// Option Board 2
if (this.ParentForm.ParentForm.CurrentSystemParameter1.OptionBoard == "0002")
this.groupBoxOB2.Visible = true;
else
this.groupBoxOB2.Visible = false;
}
#endregion
#region Event Handler
private void comboBoxSorterA_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void labelSorterDelayTime_Click(object sender, EventArgs e)
{
string value = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorterADelayTime.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 9999)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
myMsg.ShowDialog();
}
else
{
this.labelSorterADelayTime.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter1DelayTime = myKeyPad.IntValue;
this.ParentForm.ParentForm.SaveJudgmentSetFile(this.ParentForm.ParentForm.CurrentJudgmentSetItem, this.ParentForm.ParentForm.SystemConfig1.ProductNumber - 1);
value = Helper.StringZeroFillDigits4(this.labelSorterADelayTime.Text);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.Sorter1DelayTime, value);
}
}
}
private void labelSorterRunTime_Click(object sender, EventArgs e)
{
string value = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorterARunTime.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 9999)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
myMsg.ShowDialog();
}
else
{
this.labelSorterARunTime.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter1RunTime = myKeyPad.IntValue;
this.ParentForm.ParentForm.SaveJudgmentSetFile(this.ParentForm.ParentForm.CurrentJudgmentSetItem, this.ParentForm.ParentForm.SystemConfig1.ProductNumber - 1);
value = Helper.StringZeroFillDigits4(this.labelSorterARunTime.Text);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.Sorter1RunTime, value);
}
}
}
private void comboBoxSorterB_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void labelSorterBDelayTime_Click(object sender, EventArgs e)
{
string value = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorterBDelayTime.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 9999)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
myMsg.ShowDialog();
}
else
{
this.labelSorterBDelayTime.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter2DelayTime = myKeyPad.IntValue;
this.ParentForm.ParentForm.SaveJudgmentSetFile(this.ParentForm.ParentForm.CurrentJudgmentSetItem, this.ParentForm.ParentForm.SystemConfig1.ProductNumber - 1);
value = Helper.StringZeroFillDigits4(this.labelSorterBDelayTime.Text);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.Sorter2DelayTime, value);
}
}
}
private void labelSorterBRunTime_Click(object sender, EventArgs e)
{
string value = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSorterBRunTime.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 9999)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
myMsg.ShowDialog();
}
else
{
this.labelSorterBRunTime.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter2RunTime = myKeyPad.IntValue;
this.ParentForm.ParentForm.SaveJudgmentSetFile(this.ParentForm.ParentForm.CurrentJudgmentSetItem, this.ParentForm.ParentForm.SystemConfig1.ProductNumber - 1);
value = Helper.StringZeroFillDigits4(this.labelSorterBRunTime.Text);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.Sorter2RunTime, value);
}
}
}
private void radioButtonMode1_Click(object sender, EventArgs e)
{
string value = "";
SmartRadioButton button = sender as SmartRadioButton;
if (button == null)
return;
if (button == this.radioButtonMode1Low)
value = "0001";
else if (button == this.radioButtonMode1Middle)
value = "0002";
else if (button == this.radioButtonMode1High)
value = "0003";
else if (button == this.radioButtonMode1UserSetting)
value = "0004";
this.ParentForm.ParentForm.CurrentSystemParameter4.LCDAutoZero1Mode = value;
this.ParentForm.ParentForm.SaveSystemParameter4File(this.ParentForm.ParentForm.CurrentSystemParameter4);
this.ParentForm.ParentForm.TransferParameter4();
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress.ParameterRead4901, "");
}
private void comboBoxMode1Variate_SelectedIndexChanged(object sender, EventArgs e)
{
string value = "";
value = Helper.StringZeroFillDigits4(this.comboBoxMode1Variate.SelectedIndex.ToString());
this.ParentForm.ParentForm.CurrentSystemParameter4.LCDAutoZero1Variate = value;
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.Zero1Variate, value);
this.ParentForm.ParentForm.SaveSystemParameter4File(this.ParentForm.ParentForm.CurrentSystemParameter4);
}
private void labelMode1Range_Click(object sender, EventArgs e)
{
string value = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelMode1Range.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 1 || myKeyPad.doubleValue > 9999)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
myMsg.ShowDialog();
}
else
{
this.labelMode1Range.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.CurrentSystemParameter4.LCDAutoZero1Range = myKeyPad.StringValue;
value = Helper.StringZeroFillDigits4(this.ParentForm.ParentForm.CurrentSystemParameter4.LCDAutoZero1Range);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.Zero1Range, value);
this.ParentForm.ParentForm.SaveSystemParameter4File(this.ParentForm.ParentForm.CurrentSystemParameter4);
}
}
}
private void labelMode1Time_Click(object sender, EventArgs e)
{
string value = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelMode1Time.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 1 || myKeyPad.doubleValue > 9999)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
myMsg.ShowDialog();
}
else
{
this.labelMode1Time.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.CurrentSystemParameter4.LCDAutoZero1Time = myKeyPad.StringValue;
value = Helper.StringZeroFillDigits4(this.ParentForm.ParentForm.CurrentSystemParameter4.LCDAutoZero1Time);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.Zero1Time, value);
this.ParentForm.ParentForm.SaveSystemParameter4File(this.ParentForm.ParentForm.CurrentSystemParameter4);
}
}
}
private void buttonBypassDirection_Click(object sender, EventArgs e)
{
if (this.buttonBypassDirection.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
this.ParentForm.ParentForm.SystemConfig2.IsBypassDirectionPass = false;
else
this.ParentForm.ParentForm.SystemConfig2.IsBypassDirectionPass = true;
}
private void buttonBypassOnce_Click(object sender, EventArgs e)
{
if (this.buttonBypassOnce.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
{
this.ParentForm.ParentForm.SystemConfig2.IsBypassOnce = false;
this.buttonBypassRun.Mode = SmartButton.BUTTONMODE.PUSH;
}
else
{
this.ParentForm.ParentForm.SystemConfig2.IsBypassOnce = true;
this.buttonBypassRun.Mode = SmartButton.BUTTONMODE.NORMAL;
}
}
private void buttonBypassRun_Click(object sender, EventArgs e)
{
if (this.ParentForm.ParentForm.SystemConfig2.IsBypassOnce == true)
{
this.ParentForm.ParentForm.IsBypassOnce = true;
this.ParentForm.ParentForm.ChildFormMainDisplay.MainWeightBigScreen.ChangeToBypassImage();
this.ParentForm.ParentForm.ChildFormMainDisplay.MainWeightSmallScreen.ChangeToBypassImage();
this.ParentForm.ParentForm.ChildFormMainDisplay.MainWeightBigScreen.UpdateSpotOrBypassImageVisibleStatus(true);
this.ParentForm.ParentForm.ChildFormMainDisplay.MainWeightSmallScreen.UpdateSpotOrBypassImageVisibleStatus(true);
this.ParentForm.MainSpotCheck.ChangeEnableButtonSpotCheckRun(false);
if (this.ParentForm.ParentForm.SystemConfig2.IsBypassDirectionPass == true)
this.ParentForm.ParentForm.TransferData(CommunicationCommand.BypassOnce, CommunicationID.MainBoard);
else
this.ParentForm.ParentForm.TransferData(CommunicationCommand.ByNGOnce, CommunicationID.MainBoard);
}
else
{
if (this.buttonBypassRun.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
{
if (this.ParentForm.MainSpotCheck.CurrentStatusButtonSpotCheckRun() == false)
{
this.buttonBypassDirection.Enabled = false;
this.buttonBypassOnce.Enabled = false;
this.ParentForm.ParentForm.ChildFormMainDisplay.MainWeightBigScreen.ChangeToBypassImage();
this.ParentForm.ParentForm.ChildFormMainDisplay.MainWeightSmallScreen.ChangeToBypassImage();
this.ParentForm.ParentForm.ChildFormMainDisplay.MainWeightBigScreen.UpdateSpotOrBypassImageVisibleStatus(true);
this.ParentForm.ParentForm.ChildFormMainDisplay.MainWeightSmallScreen.UpdateSpotOrBypassImageVisibleStatus(true);
this.ParentForm.MainSpotCheck.ChangeEnableButtonSpotCheckRun(false);
if (this.ParentForm.ParentForm.SystemConfig2.IsBypassDirectionPass == true)
this.ParentForm.ParentForm.TransferData(CommunicationCommand.BypassON, CommunicationID.MainBoard);
else
this.ParentForm.ParentForm.TransferData(CommunicationCommand.ByNGON, CommunicationID.MainBoard);
}
else
{
this.buttonBypassRun.ButtonUp();
}
}
else
{
this.buttonBypassDirection.Enabled = true;
this.buttonBypassOnce.Enabled = true;
this.ParentForm.ParentForm.ChildFormMainDisplay.MainWeightBigScreen.UpdateSpotOrBypassImageVisibleStatus(false);
this.ParentForm.ParentForm.ChildFormMainDisplay.MainWeightSmallScreen.UpdateSpotOrBypassImageVisibleStatus(false);
this.ParentForm.MainSpotCheck.ChangeEnableButtonSpotCheckRun(true);
if (this.ParentForm.ParentForm.SystemConfig2.IsBypassDirectionPass == true)
this.ParentForm.ParentForm.TransferData(CommunicationCommand.BypassOFF, CommunicationID.MainBoard);
else
this.ParentForm.ParentForm.TransferData(CommunicationCommand.ByNGOFF, CommunicationID.MainBoard);
}
}
}
private void labelDelayTime1_Click(object sender, EventArgs e)
{
string value = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelDispDelayTime1.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 9999)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
myMsg.ShowDialog();
}
else
{
this.labelDispDelayTime1.Text = myKeyPad.StringValue;
value = Helper.StringZeroFillDigits4(this.labelDispDelayTime1.Text);
this.ParentForm.ParentForm.CurrentProductItem.DispenserDelayTime1 = myKeyPad.StringValue;
// File Save
this.ParentForm.ParentForm.SaveProductFile(this.ParentForm.ParentForm.CurrentProductItem, this.ParentForm.ParentForm.SystemConfig1.ProductNumber - 1);
// Setting
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.OPT2DelayTime1, value);
}
}
}
private void labelDelayTime2_Click(object sender, EventArgs e)
{
string value = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelDispDelayTime2.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 9999)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
myMsg.ShowDialog();
}
else
{
this.labelDispDelayTime2.Text = myKeyPad.StringValue;
value = Helper.StringZeroFillDigits4(this.labelDispDelayTime2.Text);
this.ParentForm.ParentForm.CurrentProductItem.DispenserDelayTime2 = myKeyPad.StringValue;
// File Save
this.ParentForm.ParentForm.SaveProductFile(this.ParentForm.ParentForm.CurrentProductItem, this.ParentForm.ParentForm.SystemConfig1.ProductNumber - 1);
// Setting
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.OPT2DelayTime2, value);
}
}
}
private void buttonDryContact_Click(object sender, EventArgs e)
{
SmartX.SmartButton button = sender as SmartX.SmartButton;
if (button == null)
return;
if (button == this.buttonDry1)
this.ParentForm.ParentForm.TransferData(CommunicationCommand.Output, CommunicationID.SubBoard1);
else if (button == this.buttonDry2)
this.ParentForm.ParentForm.TransferData(CommunicationCommand.Output, CommunicationID.SubBoard2);
else if (button == this.buttonDry3)
this.ParentForm.ParentForm.TransferData(CommunicationCommand.Output, CommunicationID.SubBoard3);
else if (button == this.buttonDry4)
this.ParentForm.ParentForm.TransferData(CommunicationCommand.Output, CommunicationID.SubBoard4);
}
#endregion
}
}