ITC81DB_V8/ITC81DB/Controls/CenterSystem/ControlCenterSystemSorterSe...

620 lines
32 KiB
C#
Raw Normal View History

2023-07-11 01:56:01 +00:00
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 ITC81DB.Forms;
using ITC81DB_ImageDll;
using ITC81DB.DialogForms;
namespace ITC81DB.Controls
{
public partial class ControlCenterSystemSorterSetting : UserControl
{
#region Field
private FormMenu m_ParentForm;
#endregion
#region Constructor
public ControlCenterSystemSorterSetting(FormMenu parent)
{
InitializeComponent();
this.ParentForm = parent;
this.InitializeDesign();
this.DefaultSetting();
}
#endregion
#region Property
public FormMenu ParentForm
{
get { return this.m_ParentForm; }
private 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.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundSorterSetting));
this.radioButtonDoubleEntryNone.Text = this.radioButtonExternalInputNone.Text = this.radioButtonEtcNgNone.Text = "None";
this.buttonTestSorterA.Font = this.buttonTestSorterB.Font = new Font("새굴림", 16, FontStyle.Bold);
this.buttonTestSorterA.Text = "Sorter A";
this.buttonTestSorterB.Text = "Sorter B";
this.radioButtonDoubleEntrySorterA.Text = this.radioButtonExternalInputSorterA.Text = this.radioButtonEtcNgSorterA.Text = "Sorter A";
this.radioButtonDoubleEntrySorterB.Text = this.radioButtonExternalInputSorterB.Text = this.radioButtonEtcNgSorterB.Text = "Sorter B";
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.labelWarningRandomMode.Text = "※ When setting 996 ~ 1000, all setting values except for the delay time of sorter A are applied as the same value";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese)
{
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.chnBackgroundSorterSetting));
this.radioButtonDoubleEntryNone.Text = this.radioButtonExternalInputNone.Text = this.radioButtonEtcNgNone.Text = "不使用";
this.buttonTestSorterA.Font = this.buttonTestSorterB.Font = new Font("새굴림", 16, FontStyle.Bold);
this.buttonTestSorterA.Text = "分类机A";
this.buttonTestSorterB.Text = "分类机B";
this.radioButtonDoubleEntrySorterA.Text = this.radioButtonExternalInputSorterA.Text = this.radioButtonEtcNgSorterA.Text = "分类机A";
this.radioButtonDoubleEntrySorterB.Text = this.radioButtonExternalInputSorterB.Text = this.radioButtonEtcNgSorterB.Text = "分类机B";
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.labelWarningRandomMode.Text = "※ 设定 996 ~ 1000 时,除分拣机 A 的延迟时间以外的所有设定值都应用相同的值";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech)
{
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian)
{
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.rusBackgroundSorterSetting));
this.radioButtonDoubleEntryNone.Text = this.radioButtonExternalInputNone.Text = this.radioButtonEtcNgNone.Text = "Нет";
this.buttonTestSorterA.Font = this.buttonTestSorterB.Font = new Font("새굴림", 9, FontStyle.Bold);
this.buttonTestSorterA.Text = "СортировщикА";
this.buttonTestSorterB.Text = "СортировщикB";
this.radioButtonDoubleEntrySorterA.Text = this.radioButtonExternalInputSorterA.Text = this.radioButtonEtcNgSorterA.Text = "СортировщикА";
this.radioButtonDoubleEntrySorterB.Text = this.radioButtonExternalInputSorterB.Text = this.radioButtonEtcNgSorterB.Text = "СортировщикB";
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.labelWarningRandomMode.Text = "※ При настройке 996 ~ 1000 все значения настроек, кроме времени задержки сортировщика А, применяются как одно и то же значение.";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German)
{
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.gerBackgroundSorterSetting));
this.radioButtonDoubleEntryNone.Text = this.radioButtonExternalInputNone.Text = this.radioButtonEtcNgNone.Text = "Keiner";
this.buttonTestSorterA.Font = this.buttonTestSorterB.Font = new Font("새굴림", 16, FontStyle.Bold);
this.buttonTestSorterA.Text = "SortiererA";
this.buttonTestSorterB.Text = "SortiererB";
this.radioButtonDoubleEntrySorterA.Text = this.radioButtonExternalInputSorterA.Text = this.radioButtonEtcNgSorterA.Text = "SortiererA";
this.radioButtonDoubleEntrySorterB.Text = this.radioButtonExternalInputSorterB.Text = this.radioButtonEtcNgSorterB.Text = "SortiererB";
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.labelWarningRandomMode.Text = "※ Bei einer Einstellung von 996 ~ 1000 werden alle Einstellwerte mit Ausnahme der Verzögerungszeit von Sortierer A als derselbe Wert angewendet";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish)
{
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundSorterSetting));
this.radioButtonDoubleEntryNone.Text = this.radioButtonExternalInputNone.Text = this.radioButtonEtcNgNone.Text = "Ninguna";
this.buttonTestSorterA.Font = this.buttonTestSorterB.Font = new Font("새굴림", 11, FontStyle.Bold);
this.buttonTestSorterA.Text = "Clasificador A";
this.buttonTestSorterB.Text = "Clasificador B";
this.radioButtonDoubleEntrySorterA.Text = this.radioButtonExternalInputSorterA.Text = this.radioButtonEtcNgSorterA.Text = "Clasificador A";
this.radioButtonDoubleEntrySorterB.Text = this.radioButtonExternalInputSorterB.Text = this.radioButtonEtcNgSorterB.Text = "Clasificador B";
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.labelWarningRandomMode.Text = "※ Al configurar 996 ~ 1000, todos los valores de configuración excepto el tiempo de retraso del clasificador A se aplican como el mismo valor";
}
else
{
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.korBackgroundSorterSetting));
this.radioButtonDoubleEntryNone.Text = this.radioButtonExternalInputNone.Text = this.radioButtonEtcNgNone.Text = "사용안함";
this.buttonTestSorterA.Font = this.buttonTestSorterB.Font = new Font("새굴림", 16, FontStyle.Bold);
this.buttonTestSorterA.Text = "선별기A";
this.buttonTestSorterB.Text = "선별기B";
this.radioButtonDoubleEntrySorterA.Text = this.radioButtonExternalInputSorterA.Text = this.radioButtonEtcNgSorterA.Text = "선별기A";
this.radioButtonDoubleEntrySorterB.Text = this.radioButtonExternalInputSorterB.Text = this.radioButtonEtcNgSorterB.Text = "선별기B";
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("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("사용안함");
this.comboBoxSorterB.Items.Add("과량");
this.comboBoxSorterB.Items.Add("경량");
this.comboBoxSorterB.Items.Add("NG");
this.comboBoxSorterB.SelectedIndex = 2;
this.comboBoxSorterB.SelectedIndexChanged += new EventHandler(this.comboBoxSorterB_SelectedIndexChanged);
this.labelWarningRandomMode.Text = "※ 996 ~ 1000번 설정 시, 선별기A 지연시간을 제외한 모든 설정값은 동일값으로 적용됨";
}
}
private void DefaultSetting()
{
}
private void UpdateControlsDisplay(JudgmentSetItem item,SystemParameter1 parameter)
{
int value = 0;
if (this.labelProductNo.Text != this.ParentForm.ParentForm.SystemConfig1.ProductNumber.ToString())
this.labelProductNo.Text = this.ParentForm.ParentForm.SystemConfig1.ProductNumber.ToString();
if (this.ParentForm.ParentForm.SystemConfig1.ProductNumber >= 996)
this.labelWarningRandomMode.Visible = true;
else
this.labelWarningRandomMode.Visible = false;
this.buttonTestSorterB.ButtonUp();
this.buttonTestSorterA.ButtonDown();
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.SorterTest, "0000");
this.comboBoxSorterA.SelectedIndexChanged -= new EventHandler(this.comboBoxSorterA_SelectedIndexChanged);
this.comboBoxSorterB.SelectedIndexChanged -= new EventHandler(this.comboBoxSorterB_SelectedIndexChanged);
// 선별기A 모드
value = item.Sorter1Mode;
if (this.comboBoxSorterA.SelectedIndex != value)
this.comboBoxSorterA.SelectedIndex = value;
// 선별기A 지연시간
value = item.Sorter1DelayTime;
if (this.labelSorterADelayTime.Text != value.ToString())
this.labelSorterADelayTime.Text = value.ToString();
// 선별기A 동작시간
value = item.Sorter1RunTime;
if (this.labelSorterARunTime.Text != value.ToString())
this.labelSorterARunTime.Text = value.ToString();
// 선별기B 모드
value = item.Sorter2Mode;
if (this.comboBoxSorterB.SelectedIndex != value)
this.comboBoxSorterB.SelectedIndex = value;
// 선별기B 지연시간
value = item.Sorter2DelayTime;
if (this.labelSorterBDelayTime.Text != value.ToString())
this.labelSorterBDelayTime.Text = value.ToString();
// 선별기B 동작시간
value = item.Sorter2RunTime;
if (this.labelSorterBRunTime.Text != value.ToString())
this.labelSorterBRunTime.Text = value.ToString();
// 이중진입
value = int.Parse(parameter.SorterDoubleEntry);
if (value == 1)
this.radioButtonDoubleEntrySorterA.Checked = true;
else if (value == 2)
this.radioButtonDoubleEntrySorterB.Checked = true;
else
this.radioButtonDoubleEntryNone.Checked = true;
// 외부입력
value = int.Parse(parameter.SorterExternalNgInput);
if (value == 1)
this.radioButtonExternalInputSorterA.Checked = true;
else if (value == 2)
this.radioButtonExternalInputSorterB.Checked = true;
else
this.radioButtonExternalInputNone.Checked = true;
// 기타NG
value = int.Parse(parameter.SorterEtcNg);
if (value == 1)
this.radioButtonEtcNgSorterA.Checked = true;
else if (value == 2)
this.radioButtonEtcNgSorterB.Checked = true;
else
this.radioButtonEtcNgNone.Checked = true;
this.comboBoxSorterA.SelectedIndexChanged += new EventHandler(this.comboBoxSorterA_SelectedIndexChanged);
this.comboBoxSorterB.SelectedIndexChanged += new EventHandler(this.comboBoxSorterB_SelectedIndexChanged);
this.buttonSave.Visible = false;
}
public void UpdateEquipmentStatusDisplay(DataStore.EquipmentStatus status)
{
if (status == DataStore.EquipmentStatus.Start)
{
//this.pictureBoxStart.Visible = true;
//this.pictureBoxStop.Visible = false;
}
else
{
//this.pictureBoxStart.Visible = false;
//this.pictureBoxStop.Visible = true;
}
}
public void UpdateCurrentProductDisplay(DataStore.EquipmentStatus status, ProductItem pItem)
{
string value = "";
value = pItem.Number.ToString();
if (this.labelProductNo.Text != value)
this.labelProductNo.Text = value;
if (this.ParentForm.ParentForm.SystemConfig1.ProductNumber >= 996)
this.labelWarningRandomMode.Visible = true;
else
this.labelWarningRandomMode.Visible = false;
this.UpdateControlsDisplay(this.ParentForm.ParentForm.CurrentJudgmentSetItem, this.ParentForm.ParentForm.CurrentSystemParameter1);
}
public void DisplayRefresh(SystemStatus status)
{
this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = DataStore.DisplayStore.SystemSorterSetting;
this.ParentForm.ParentForm.SetDisplayMode(DataStore.DisplayMode.SorterTest);
this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus);
this.UpdateControlsDisplay(this.ParentForm.ParentForm.CurrentJudgmentSetItem, this.ParentForm.ParentForm.CurrentSystemParameter1);
}
#endregion
#region Event Handler
private void labelProductNo_Click(object sender, EventArgs e)
{
string message = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelProductNo.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 1 || myKeyPad.doubleValue > this.ParentForm.ParentForm.ProductCount)
{
// 입력범위를 확인하세요
message = string.Format("1 ~ {0}", this.ParentForm.ParentForm.ProductCount);
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language, message);
myMsg.ShowDialog();
}
else
{
this.labelProductNo.Text = myKeyPad.StringValue;
this.labelProductNo.Text = "**";
this.ParentForm.ParentForm.TransferProductParameter(myKeyPad.IntValue);
}
}
}
private void buttonTest_Click(object sender, EventArgs e)
{
string value = "";
if (this.buttonTestSorterA.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN)
value = "0000";
else if (this.buttonTestSorterB.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN)
value = "0001";
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.SorterTest, value);
}
private void labelSorterADelayTime_Click(object sender, EventArgs e)
{
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;
if (this.buttonSave.Visible != true)
this.buttonSave.Visible = true;
}
}
}
private void labelSorterARunTime_Click(object sender, EventArgs e)
{
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;
if (this.buttonSave.Visible != true)
this.buttonSave.Visible = true;
}
}
}
private void labelSorterBDelayTime_Click(object sender, EventArgs e)
{
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;
if (this.buttonSave.Visible != true)
this.buttonSave.Visible = true;
}
}
}
private void labelSorterBRunTime_Click(object sender, EventArgs e)
{
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;
if (this.buttonSave.Visible != true)
this.buttonSave.Visible = true;
}
}
}
private void buttonSave_Click(object sender, EventArgs e)
{
this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter1Mode = this.comboBoxSorterA.SelectedIndex;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter1DelayTime = int.Parse(this.labelSorterADelayTime.Text);
this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter1RunTime = int.Parse(this.labelSorterARunTime.Text);
this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter2Mode = this.comboBoxSorterB.SelectedIndex;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter2DelayTime = int.Parse(this.labelSorterBDelayTime.Text);
this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter2RunTime = int.Parse(this.labelSorterBRunTime.Text);
this.ParentForm.ParentForm.SaveJudgmentSetFile(this.ParentForm.ParentForm.CurrentJudgmentSetItem, this.ParentForm.ParentForm.SystemConfig1.ProductNumber - 1);
if (this.ParentForm.ParentForm.SystemConfig1.ProductNumber >= 996)
{
JudgmentSetItem jItem = new JudgmentSetItem();
for (int i = 995; i < 1000; i++)
{
jItem = this.ParentForm.ParentForm.CollectionJudgmentItem[i];
jItem.Sorter1Mode = this.comboBoxSorterA.SelectedIndex;
jItem.Sorter1RunTime = int.Parse(this.labelSorterARunTime.Text);
jItem.Sorter2Mode = this.comboBoxSorterB.SelectedIndex;
jItem.Sorter2DelayTime = int.Parse(this.labelSorterBDelayTime.Text);
jItem.Sorter2RunTime = int.Parse(this.labelSorterBRunTime.Text);
this.ParentForm.ParentForm.SaveJudgmentSetFile(jItem, i);
}
}
StringBuilder sb = new StringBuilder();
sb.Append(Helper.StringZeroFillDigits4(this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter1Mode.ToString()));
sb.Append(Helper.StringZeroFillDigits4(this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter1DelayTime.ToString()));
sb.Append(Helper.StringZeroFillDigits4(this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter1RunTime.ToString()));
sb.Append(Helper.StringZeroFillDigits4(this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter2Mode.ToString()));
sb.Append(Helper.StringZeroFillDigits4(this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter2DelayTime.ToString()));
sb.Append(Helper.StringZeroFillDigits4(this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter2RunTime.ToString()));
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.UserDefined1, sb.ToString());
this.buttonSave.Visible = false;
}
private void radioButtonDoubleEntry_Click(object sender, EventArgs e)
{
string value = "";
if (this.radioButtonDoubleEntryNone.Checked == true)
value = "0000";
else if (this.radioButtonDoubleEntrySorterA.Checked == true)
value = "0001";
else if (this.radioButtonDoubleEntrySorterB.Checked == true)
value = "0002";
else
value = "0000";
this.ParentForm.ParentForm.CurrentSystemParameter1.SorterDoubleEntry = value;
this.ParentForm.ParentForm.SaveSystemParameter1File(this.ParentForm.ParentForm.CurrentSystemParameter1);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.DoubleEnter, value);
}
private void radioButtonExternalInput_Click(object sender, EventArgs e)
{
string value = "";
if (this.radioButtonExternalInputNone.Checked == true)
value = "0000";
else if (this.radioButtonExternalInputSorterA.Checked == true)
value = "0001";
else if (this.radioButtonExternalInputSorterB.Checked == true)
value = "0002";
else
value = "0000";
this.ParentForm.ParentForm.CurrentSystemParameter1.SorterExternalNgInput = value;
this.ParentForm.ParentForm.SaveSystemParameter1File(this.ParentForm.ParentForm.CurrentSystemParameter1);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ExternalInput, value);
}
private void radioButtonEtcNg_Click(object sender, EventArgs e)
{
string value = "";
if (this.radioButtonEtcNgNone.Checked == true)
value = "0000";
else if (this.radioButtonEtcNgSorterA.Checked == true)
value = "0001";
else if (this.radioButtonEtcNgSorterB.Checked == true)
value = "0002";
else
value = "0000";
this.ParentForm.ParentForm.CurrentSystemParameter1.SorterEtcNg = value;
this.ParentForm.ParentForm.SaveSystemParameter1File(this.ParentForm.ParentForm.CurrentSystemParameter1);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ExternalNG, value);
}
private void comboBoxSorterA_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.comboBoxSorterA.Items.Count == 0 || this.comboBoxSorterB.Items.Count == 0)
return;
if (this.buttonSave.Visible != true)
this.buttonSave.Visible = true;
this.comboBoxSorterB.SelectedIndexChanged -= new EventHandler(this.comboBoxSorterB_SelectedIndexChanged);
if (this.comboBoxSorterA.SelectedIndex == 1)
this.comboBoxSorterB.SelectedIndex = 2;
else if (this.comboBoxSorterA.SelectedIndex == 2)
this.comboBoxSorterB.SelectedIndex = 1;
else if (this.comboBoxSorterA.SelectedIndex == 3)
this.comboBoxSorterB.SelectedIndex = 0;
this.comboBoxSorterB.SelectedIndexChanged += new EventHandler(this.comboBoxSorterB_SelectedIndexChanged);
}
private void comboBoxSorterB_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.comboBoxSorterA.Items.Count == 0 || this.comboBoxSorterB.Items.Count == 0)
return;
if (this.buttonSave.Visible != true)
this.buttonSave.Visible = true;
this.comboBoxSorterA.SelectedIndexChanged -= new EventHandler(this.comboBoxSorterA_SelectedIndexChanged);
if (this.comboBoxSorterB.SelectedIndex == 1)
this.comboBoxSorterA.SelectedIndex = 2;
else if (this.comboBoxSorterB.SelectedIndex == 2)
this.comboBoxSorterA.SelectedIndex = 1;
else if (this.comboBoxSorterB.SelectedIndex == 3)
this.comboBoxSorterA.SelectedIndex = 0;
this.comboBoxSorterA.SelectedIndexChanged += new EventHandler(this.comboBoxSorterA_SelectedIndexChanged);
}
#endregion
}
}