ITC81DB_V8/ITC81DB/Controls/CenterBasic/ControlCenterBasicProduct.cs

829 lines
38 KiB
C#

using System;
using System.Linq;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using ITC81DB.DialogForms;
using ITC81DB.Forms;
using ITC81DB_ImageDll;
namespace ITC81DB.Controls
{
public partial class ControlCenterBasicProduct : UserControl
{
#region Field
private FormMenu m_ParentForm;
public ControlBasicRandomMode ControlRandomMode;
public ControlBasicProductLotSetting ControlLotSetting;
private int SelectedProductNo;
private ProductItem SelectedProductItem;
#endregion
#region Constructor
public ControlCenterBasicProduct(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.engBackgroundProduct));
this.buttonItemNo.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engProductNoDisable));
this.buttonItemNo.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engProductNoDown));
this.buttonItemNo.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engProductNoUp));
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese)
{
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.chnBackgroundProduct));
this.buttonItemNo.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormProductNoDisable));
this.buttonItemNo.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormProductNoDown));
this.buttonItemNo.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormProductNoUp));
}
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.rusBackgroundProduct));
this.buttonItemNo.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engProductNoDisable));
this.buttonItemNo.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engProductNoDown));
this.buttonItemNo.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engProductNoUp));
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German)
{
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.gerBackgroundProduct));
this.buttonItemNo.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerProductNoDisable));
this.buttonItemNo.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerProductNoDown));
this.buttonItemNo.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerProductNoUp));
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish)
{
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundProduct));
this.buttonItemNo.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engProductNoDisable));
this.buttonItemNo.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engProductNoDown));
this.buttonItemNo.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engProductNoUp));
}
else
{
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.korBackgroundProduct));
this.buttonItemNo.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engProductNoDisable));
this.buttonItemNo.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engProductNoDown));
this.buttonItemNo.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engProductNoUp));
}
}
private void DefaultSetting()
{
this.ControlRandomMode = new ControlBasicRandomMode(this.ParentForm);
this.ControlLotSetting = new ControlBasicProductLotSetting(this.ParentForm);
this.Controls.Add(this.ControlRandomMode);
this.Controls.Add(this.ControlLotSetting);
this.ControlRandomMode.Location = new Point(0, 91);
this.ControlLotSetting.Location = new Point(19, 173);
this.ControlRandomMode.Visible = false;
this.ControlLotSetting.Visible = false;
this.SelectedProductNo = 1;
this.SelectedProductItem = new ProductItem();
if (this.listBoxProductList.Items.Count == 0)
{
this.listBoxProductList.SelectedIndexChanged -= new EventHandler(this.listBoxProductList_SelectedIndexChanged);
this.AddProductList();
this.listBoxProductList.SelectedIndex = this.SelectedProductNo - 1;
this.listBoxProductList.SelectedIndexChanged += new EventHandler(this.listBoxProductList_SelectedIndexChanged);
}
if (int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter1.SortingByProductNo) > 0)
this.VisibleButtonSort(true);
else
this.VisibleButtonSort(false);
}
private void AddProductList()
{
Collection<string> productNames = new Collection<string>();
this.ParentForm.ParentForm.LoadProductName(ref productNames);
this.listBoxProductList.Items.Clear();
if (this.ParentForm.ParentForm.SystemConfig2.Barcode != 0)
{
for (int i = 0; i < 990; i++)
this.listBoxProductList.Items.Add(productNames[i]);
this.listBoxProductList.Items.Add("NoRead");
this.listBoxProductList.Items.Add("NoMatch");
for (int i = 992; i < 995; i++) // 996~1000은 랜덤모드
this.listBoxProductList.Items.Add(productNames[i]);
}
else
{
//for (int i = 0; i < productNames.Count; i++)
for (int i = 0; i < 995; i++) // 996~1000은 랜덤모드
this.listBoxProductList.Items.Add(productNames[i]);
}
}
private void DisplayControls(ProductItem item)
{
int iValue = 0;
string sValue = "";
if (this.SelectedProductItem == null && item == null)
return;
sValue = item.Number.ToString();
if (this.buttonItemNo.Text != sValue)
this.buttonItemNo.Text = sValue;
sValue = item.Name;
if (this.textBoxProductName.Text != sValue)
this.textBoxProductName.Text = sValue;
sValue = item.LotNo;
if (this.textBoxLotNo.Text != sValue)
this.textBoxLotNo.Text = sValue;
sValue = Helper.StringToDecimalPlaces(item.OverRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
if (this.labelOverRange.Text != sValue)
this.labelOverRange.Text = sValue;
sValue = Helper.StringToDecimalPlaces(item.PassRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
if (this.labelPassRange.Text != sValue)
this.labelPassRange.Text = sValue;
sValue = Helper.StringToDecimalPlaces(item.UnderRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
if (this.labelUnderRange.Text != sValue)
this.labelUnderRange.Text = sValue;
sValue = Helper.StringToDecimalPlaces(item.TareRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
if (this.labelTareRange.Text != sValue)
this.labelTareRange.Text = sValue;
iValue = int.Parse(item.OverRange) - int.Parse(item.PassRange);
sValue = Helper.StringToDecimalPlaces(iValue.ToString(), this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
sValue = string.Format("+{0}", sValue);
if (this.labelDeviationOver.Text != sValue)
this.labelDeviationOver.Text = sValue;
iValue = int.Parse(item.PassRange) - int.Parse(item.UnderRange);
sValue = string.Format("-{0}", Helper.StringToDecimalPlaces(iValue.ToString(), this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces));
if (this.labelDeviationUnder.Text != sValue)
this.labelDeviationUnder.Text = sValue;
sValue = item.Sorting;
if (int.Parse(sValue) == 1)
{
this.buttonSortByProductNo.ButtonDown();
this.buttonSortByProductNo.Text = "B";
}
else
{
this.buttonSortByProductNo.ButtonUp();
this.buttonSortByProductNo.Text = "A";
}
}
public void VisibleButtonSort(bool bValue)
{
this.buttonSortByProductNo.Visible = bValue;
}
public void SaveLOTToProductItem(string lot)
{
if (this.SelectedProductNo != 991 && this.SelectedProductNo != 992)
{
this.textBoxLotNo.Text = lot;
this.SelectedProductItem.LotNo = lot;
this.ParentForm.ParentForm.CollectionProductItem[this.SelectedProductNo - 1].LotNo = lot;
if (this.ParentForm.ParentForm.SystemConfig2.Barcode != 0)
this.ParentForm.ParentForm.CurrentBarcode.SetLotNo(this.ParentForm.ParentForm.CollectionProductItem, this.ParentForm.ParentForm.ProductCount);
this.ParentForm.ParentForm.SaveProductFile(this.SelectedProductItem, this.SelectedProductNo - 1);
}
}
public void DisplayRefresh(SystemStatus status)
{
this.buttonItemNo.Visible = true;
this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = DataStore.DisplayStore.BasicProduct;
this.ParentForm.ParentForm.SetDisplayMode(DataStore.DisplayMode.Menu);
this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus);
this.smartKeyboard.Hide();
this.buttonItemNo.Enabled = true;
this.buttonNameEdit.Enabled = true;
this.buttonLotEdit.Enabled = true;
this.textBoxProductName.Enabled = true;
this.textBoxLotNo.Enabled = true;
this.listBoxProductList.Enabled = true;
this.buttonAddOn.Visible = false;
this.ControlLotSetting.Visible = false;
if(this.buttonAddOn.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN)
this.buttonAddOn.ButtonUp();
this.buttonItemNo.Text = this.ParentForm.ParentForm.SystemConfig1.ProductNumber.ToString();
this.SelectedProductNo = this.ParentForm.ParentForm.SystemConfig1.ProductNumber;
if (this.ParentForm.ParentForm.SystemConfig2.Barcode != 0)
{
#region 바코드 사용 시
this.buttonRandomMode.Visible = false;
if (this.SelectedProductNo == 991 || this.SelectedProductNo == 992)
{
this.buttonNameEdit.Enabled = false;
this.buttonLotEdit.Enabled = false;
}
else
{
this.buttonNameEdit.Enabled = true;
this.buttonLotEdit.Enabled = true;
}
if (this.ParentForm.ParentForm.SystemConfig2.Barcode > 0)
this.buttonAddOn.Visible = true;
#endregion
}
else
{
if (this.ControlRandomMode.Visible == true)
{
this.buttonItemNo.Visible = false;
this.ControlRandomMode.DisplayRefresh();
}
if (this.ParentForm.ParentForm.SystemConfig1.ProductNumber > 995)
{
this.buttonItemNo.Text = "995";
this.SelectedProductNo = 995;
}
this.buttonRandomMode.Visible = true;
}
this.listBoxProductList.SelectedIndexChanged -= new EventHandler(this.listBoxProductList_SelectedIndexChanged);
this.listBoxProductList.SelectedIndex = this.SelectedProductNo - 1;
this.listBoxProductList.SelectedIndexChanged += new EventHandler(this.listBoxProductList_SelectedIndexChanged);
this.ParentForm.ParentForm.LoadProductFile(ref this.SelectedProductItem, this.SelectedProductNo - 1);
this.DisplayControls(this.SelectedProductItem);
}
#endregion
#region Event Handler
private void buttonProductNo_Click(object sender, EventArgs e)
{
string message = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.buttonItemNo.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
myKeyPad.Location = new Point(280, 90);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 1 || myKeyPad.doubleValue > 995)
{
// 입력범위를 확인하세요
message = string.Format("1 ~ {0}", 995);
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language, message);
myMsg.ShowDialog();
}
else
{
this.buttonItemNo.Text = myKeyPad.StringValue;
this.SelectedProductNo = myKeyPad.IntValue;
this.listBoxProductList.SelectedIndexChanged -= new EventHandler(this.listBoxProductList_SelectedIndexChanged);
this.listBoxProductList.SelectedIndex = this.SelectedProductNo - 1;
this.listBoxProductList.SelectedIndexChanged += new EventHandler(this.listBoxProductList_SelectedIndexChanged);
if (this.SelectedProductNo == 991 || this.SelectedProductNo == 992)
{
this.buttonNameEdit.Enabled = false;
this.buttonLotEdit.Enabled = false;
}
else
{
this.buttonNameEdit.Enabled = true;
this.buttonLotEdit.Enabled = true;
}
this.ParentForm.ParentForm.LoadProductFile(ref this.SelectedProductItem, this.SelectedProductNo - 1);
this.DisplayControls(this.SelectedProductItem);
}
}
}
private void buttonNameEdit_Click(object sender, EventArgs e)
{
this.smartKeyboard.KeyboardType = SmartX.SmartKeyboard.KEYBOARDTYPES.NORMAL;
this.smartKeyboard.Location = new Point(9, 176);
this.smartKeyboard.Size = new Size(684, 274);
this.smartKeyboard.Hide();
this.smartKeyboard.TargetInputObject = this.textBoxProductName;
this.smartKeyboard.Show();
this.textBoxProductName.Select(this.textBoxProductName.Text.Length, 0);
this.buttonNameEdit.Enabled = false;
this.buttonLotEdit.Enabled = false;
this.textBoxLotNo.Enabled = false;
this.listBoxProductList.Enabled = false;
}
private void buttonLotEdit_Click(object sender, EventArgs e)
{
this.smartKeyboard.KeyboardType = SmartX.SmartKeyboard.KEYBOARDTYPES.NORMAL;
this.smartKeyboard.Location = new Point(9, 176);
this.smartKeyboard.Size = new Size(684, 274);
this.smartKeyboard.Hide();
this.smartKeyboard.TargetInputObject = this.textBoxLotNo;
this.smartKeyboard.Show();
this.textBoxLotNo.Select(this.textBoxLotNo.Text.Length, 0);
this.buttonNameEdit.Enabled = false;
this.buttonLotEdit.Enabled = false;
this.textBoxProductName.Enabled = false;
this.listBoxProductList.Enabled = false;
}
private void textBoxProductName_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r')
{
this.SelectedProductItem.Name = this.textBoxProductName.Text;
this.ParentForm.ParentForm.CollectionProductItem[this.SelectedProductNo - 1].Name = this.textBoxProductName.Text;
this.listBoxProductList.SelectedIndexChanged -= new EventHandler(this.listBoxProductList_SelectedIndexChanged);
this.listBoxProductList.Items.Insert(this.SelectedProductItem.Number - 1, this.textBoxProductName.Text);
this.listBoxProductList.Items.RemoveAt(this.SelectedProductItem.Number);
this.listBoxProductList.SelectedIndex = this.SelectedProductItem.Number - 1;
this.listBoxProductList.SelectedIndexChanged += new EventHandler(this.listBoxProductList_SelectedIndexChanged);
e.Handled = true;
this.smartKeyboard.Hide();
this.smartKeyboard.OnHanYoungKeyChange -= new EventHandler(this.smartKeyboard_OnHanYoungKeyChange);
if (this.ParentForm.ParentForm.IsCurrentKeyKorean == true)
{
this.smartKeyboard.HanYoungKeyToggle();
this.ParentForm.ParentForm.IsCurrentKeyKorean = false;
}
this.smartKeyboard.OnHanYoungKeyChange += new EventHandler(this.smartKeyboard_OnHanYoungKeyChange);
this.ParentForm.ParentForm.SaveProductFile(this.SelectedProductItem, this.SelectedProductNo - 1);
this.buttonNameEdit.Enabled = true;
this.buttonLotEdit.Enabled = true;
this.textBoxLotNo.Enabled = true;
this.listBoxProductList.Enabled = true;
this.ParentForm.ParentForm.ClearAlarm(0);
}
else if (e.KeyChar == 27)
{
e.Handled = true;
this.smartKeyboard.Hide();
this.smartKeyboard.OnHanYoungKeyChange -= new EventHandler(this.smartKeyboard_OnHanYoungKeyChange);
if (this.ParentForm.ParentForm.IsCurrentKeyKorean == true)
{
this.smartKeyboard.HanYoungKeyToggle();
this.ParentForm.ParentForm.IsCurrentKeyKorean = false;
}
this.smartKeyboard.OnHanYoungKeyChange += new EventHandler(this.smartKeyboard_OnHanYoungKeyChange);
this.ParentForm.ParentForm.LoadProductFile(ref this.SelectedProductItem, this.SelectedProductNo - 1);
this.DisplayControls(this.SelectedProductItem);
this.buttonNameEdit.Enabled = true;
this.buttonLotEdit.Enabled = true;
this.textBoxLotNo.Enabled = true;
this.listBoxProductList.Enabled = true;
}
else if (e.KeyChar == '<' || e.KeyChar == '>' || e.KeyChar == '|' || e.KeyChar == '"' || e.KeyChar == '?'
|| e.KeyChar == '*' || e.KeyChar == ':' || e.KeyChar == '/' || e.KeyChar == '\\')
{
e.Handled = true;
}
}
private void textBoxLotNo_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r')
{
this.SaveLOTToProductItem(this.textBoxLotNo.Text);
e.Handled = true;
this.smartKeyboard.Hide();
this.smartKeyboard.OnHanYoungKeyChange -= new EventHandler(this.smartKeyboard_OnHanYoungKeyChange);
if (this.ParentForm.ParentForm.IsCurrentKeyKorean == true)
{
this.smartKeyboard.HanYoungKeyToggle();
this.ParentForm.ParentForm.IsCurrentKeyKorean = false;
}
this.smartKeyboard.OnHanYoungKeyChange += new EventHandler(this.smartKeyboard_OnHanYoungKeyChange);
this.buttonNameEdit.Enabled = true;
this.buttonLotEdit.Enabled = true;
this.textBoxProductName.Enabled = true;
this.listBoxProductList.Enabled = true;
this.ParentForm.ParentForm.ClearAlarm(0);
}
else if (e.KeyChar == 27)
{
e.Handled = true;
this.smartKeyboard.Hide();
this.smartKeyboard.OnHanYoungKeyChange -= new EventHandler(this.smartKeyboard_OnHanYoungKeyChange);
if (this.ParentForm.ParentForm.IsCurrentKeyKorean == true)
{
this.smartKeyboard.HanYoungKeyToggle();
this.ParentForm.ParentForm.IsCurrentKeyKorean = false;
}
this.smartKeyboard.OnHanYoungKeyChange += new EventHandler(this.smartKeyboard_OnHanYoungKeyChange);
this.ParentForm.ParentForm.LoadProductFile(ref this.SelectedProductItem, this.SelectedProductNo - 1);
this.DisplayControls(this.SelectedProductItem);
this.buttonNameEdit.Enabled = true;
this.buttonLotEdit.Enabled = true;
this.textBoxProductName.Enabled = true;
this.listBoxProductList.Enabled = true;
}
else if (e.KeyChar == '<' || e.KeyChar == '>' || e.KeyChar == '|' || e.KeyChar == '"' || e.KeyChar == '?'
|| e.KeyChar == '*' || e.KeyChar == ':' || e.KeyChar == '/' || e.KeyChar == '\\')
{
e.Handled = true;
}
}
private void labelOverRange_Click(object sender, EventArgs e)
{
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelOverRange.Text, 5, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces,
false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < Helper.StringToWeight(this.SelectedProductItem.PassRange.ToString(), this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces))
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
myMsg.ShowDialog();
}
else
{
this.ParentForm.ParentForm.ClearAlarm(0);
this.labelOverRange.Text = myKeyPad.StringValue;
this.SelectedProductItem.OverRange = myKeyPad.StringValue.Replace(".", "");
this.ParentForm.ParentForm.CollectionProductItem[this.SelectedProductNo - 1].OverRange = myKeyPad.StringValue.Replace(".", "");
this.ParentForm.ParentForm.SaveProductFile(this.SelectedProductItem, this.SelectedProductNo - 1);
this.DisplayControls(this.SelectedProductItem);
}
}
}
private void labelPassRange_Click(object sender, EventArgs e)
{
int digit = 0, temp = 0, range = 0;
string value = "", feedbackValue = "";
int oldUnderRangeDeviation = this.SelectedProductItem.UnderRangeDeviation;
int oldOverRangeDeviation = this.SelectedProductItem.OverRangeDeviation;
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelPassRange.Text, 5, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces,
false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() != DialogResult.OK)
return;
this.ParentForm.ParentForm.ClearAlarm(0);
this.SelectedProductItem.PassRange = myKeyPad.StringValue.Replace(".", "");
this.ParentForm.ParentForm.CollectionProductItem[this.SelectedProductNo - 1].PassRange = myKeyPad.StringValue.Replace(".", "");
#region UnderRange
temp = this.SelectedProductItem.PassRangeInt + oldUnderRangeDeviation;
if (temp < 0)
value = "0";
else
value = temp.ToString();
this.SelectedProductItem.UnderRange = value;
this.ParentForm.ParentForm.CollectionProductItem[this.SelectedProductNo - 1].UnderRange = value;
#endregion
#region OverRange
if (this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces == 0)
range = 9999;
else
range = 99999;
// V6.2.0
//if (this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces == 2)
// range = 1000000;
//else if (this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces == 1)
// range = 100000;
//else
// range = 10000;
temp = this.SelectedProductItem.PassRangeInt + oldOverRangeDeviation;
if (temp >= range)
value = myKeyPad.StringValue.Replace(".", "");
else
value = temp.ToString();
this.SelectedProductItem.OverRange = value;
this.ParentForm.ParentForm.CollectionProductItem[this.SelectedProductNo - 1].OverRange = value;
#endregion
this.ParentForm.ParentForm.SaveProductFile(this.SelectedProductItem, this.SelectedProductNo - 1);
this.DisplayControls(this.SelectedProductItem);
}
private void labelUnderRange_Click(object sender, EventArgs e)
{
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelUnderRange.Text, 5, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces,
false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue > Helper.StringToWeight(this.SelectedProductItem.PassRange.ToString(), this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces))
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
myMsg.ShowDialog();
}
else
{
this.ParentForm.ParentForm.ClearAlarm(0);
this.labelUnderRange.Text = myKeyPad.StringValue;
this.SelectedProductItem.UnderRange = myKeyPad.StringValue.Replace(".", "");
this.ParentForm.ParentForm.CollectionProductItem[this.SelectedProductNo - 1].UnderRange = myKeyPad.StringValue.Replace(".", "");
this.ParentForm.ParentForm.SaveProductFile(this.SelectedProductItem, this.SelectedProductNo - 1);
this.DisplayControls(this.SelectedProductItem);
}
}
}
private void labelDeviationOver_Click(object sender, EventArgs e)
{
int digit = 0;
string sValue = "";
double dValue = 0.0;
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelDeviationOver.Text, 5, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces,
false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
dValue = Helper.StringToWeight(this.SelectedProductItem.PassRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)
+ myKeyPad.doubleValue;
sValue = Helper.DoubleToString(dValue, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
if (dValue < Helper.StringToWeight(this.SelectedProductItem.PassRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces))
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
myMsg.ShowDialog();
}
else
{
this.ParentForm.ParentForm.ClearAlarm(0);
this.labelDeviationOver.Text = myKeyPad.StringValue;
this.SelectedProductItem.OverRange = sValue.Replace(".", "");
this.ParentForm.ParentForm.CollectionProductItem[this.SelectedProductNo - 1].OverRange = sValue.Replace(".", "");
this.ParentForm.ParentForm.SaveProductFile(this.SelectedProductItem, this.SelectedProductNo - 1);
this.DisplayControls(this.SelectedProductItem);
}
}
}
private void labelDeviationUnder_Click(object sender, EventArgs e)
{
int digit = 0;
string sValue = "";
double dValue = 0.0;
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelDeviationUnder.Text, 5, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces,
false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
dValue = Helper.StringToWeight(this.SelectedProductItem.PassRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)
- Math.Abs(myKeyPad.doubleValue);
sValue = Helper.DoubleToString(dValue, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
if (dValue > Helper.StringToWeight(this.SelectedProductItem.PassRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces) || dValue < 0)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
myMsg.ShowDialog();
}
else
{
this.ParentForm.ParentForm.ClearAlarm(0);
this.labelDeviationUnder.Text = myKeyPad.StringValue;
this.SelectedProductItem.UnderRange = sValue.Replace(".", "");
this.ParentForm.ParentForm.CollectionProductItem[this.SelectedProductNo - 1].UnderRange = sValue.Replace(".", "");
this.ParentForm.ParentForm.SaveProductFile(this.SelectedProductItem, this.SelectedProductNo - 1);
this.DisplayControls(this.SelectedProductItem);
}
}
}
private void labelTareRange_Click(object sender, EventArgs e)
{
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelTareRange.Text, 5, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces,
false, this.ParentForm.ParentForm.SystemConfig1.Language);
myKeyPad.Location = new Point(100, 90);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 99999)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
myMsg.ShowDialog();
}
else
{
this.ParentForm.ParentForm.ClearAlarm(0);
this.labelTareRange.Text = myKeyPad.StringValue;
this.SelectedProductItem.TareRange = myKeyPad.StringValue.Replace(".", "");
this.ParentForm.ParentForm.CollectionProductItem[this.SelectedProductNo - 1].TareRange = myKeyPad.StringValue.Replace(".", "");
this.ParentForm.ParentForm.SaveProductFile(this.SelectedProductItem, this.SelectedProductNo - 1);
}
}
}
private void listBoxProductList_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.listBoxProductList.SelectedItem == null)
return;
this.ParentForm.ParentForm.ClearAlarm(0);
this.SelectedProductNo = this.listBoxProductList.SelectedIndex + 1;
this.buttonItemNo.Text = this.SelectedProductNo.ToString();
if (this.ParentForm.ParentForm.SystemConfig2.Barcode != 0)
{
if (this.SelectedProductNo == 991 || this.SelectedProductNo == 992)
{
this.buttonNameEdit.Enabled = false;
this.buttonLotEdit.Enabled = false;
}
else
{
this.buttonNameEdit.Enabled = true;
this.buttonLotEdit.Enabled = true;
}
}
this.ParentForm.ParentForm.LoadProductFile(ref this.SelectedProductItem, this.SelectedProductNo - 1);
this.DisplayControls(this.SelectedProductItem);
}
private void buttonSortByProductNo_Click(object sender, EventArgs e)
{
SmartX.SmartButton button = sender as SmartX.SmartButton;
if (button.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN)
{
this.SelectedProductItem.Sorting = "1";
button.Text = "B";
}
else
{
this.SelectedProductItem.Sorting = "0";
button.Text = "A";
}
this.ParentForm.ParentForm.SaveProductFile(this.SelectedProductItem, this.SelectedProductNo - 1);
this.ParentForm.ParentForm.ReLoadProductFile();
}
private void buttonRandomMode_Click(object sender, EventArgs e)
{
if (this.ControlRandomMode.Visible == false)
{
this.buttonItemNo.Visible = false;
this.ControlRandomMode.Visible = true;
this.ControlRandomMode.BringToFront();
this.ControlRandomMode.DisplayRefresh();
if(this.buttonSortByProductNo.Visible == true)
this.VisibleButtonSort(false);
}
else
{
this.buttonItemNo.Visible = true;
this.ControlRandomMode.Visible = false;
if (this.SelectedProductNo > 995)
this.SelectedProductNo = 995;
if (int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter1.SortingByProductNo) > 0)
this.VisibleButtonSort(true);
this.listBoxProductList.SelectedIndex = this.SelectedProductNo - 1;
this.ParentForm.ParentForm.LoadProductFile(ref this.SelectedProductItem, this.SelectedProductNo - 1);
this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = DataStore.DisplayStore.BasicProduct;
this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus);
}
}
private void smartKeyboard_OnHanYoungKeyChange(object sender, EventArgs e)
{
if (this.ParentForm.ParentForm.IsCurrentKeyKorean == false)
this.ParentForm.ParentForm.IsCurrentKeyKorean = true;
else
this.ParentForm.ParentForm.IsCurrentKeyKorean = false;
}
private void smartKeyboard_OnXKeyClick(object sender, EventArgs e)
{
this.smartKeyboard.Hide();
this.smartKeyboard.OnHanYoungKeyChange -= new EventHandler(this.smartKeyboard_OnHanYoungKeyChange);
if (this.ParentForm.ParentForm.IsCurrentKeyKorean == true)
{
this.smartKeyboard.HanYoungKeyToggle();
this.ParentForm.ParentForm.IsCurrentKeyKorean = false;
}
this.smartKeyboard.OnHanYoungKeyChange += new EventHandler(this.smartKeyboard_OnHanYoungKeyChange);
this.ParentForm.ParentForm.LoadProductFile(ref this.SelectedProductItem, this.SelectedProductNo - 1);
this.DisplayControls(this.SelectedProductItem);
this.buttonNameEdit.Enabled = true;
this.buttonLotEdit.Enabled = true;
this.textBoxProductName.Enabled = true;
this.textBoxLotNo.Enabled = true;
this.listBoxProductList.Enabled = true;
}
private void buttonAddOn_Click(object sender, EventArgs e)
{
if (this.ControlLotSetting.Visible == false)
{
this.buttonItemNo.Enabled = false;
this.buttonNameEdit.Enabled = false;
this.buttonLotEdit.Enabled = false;
this.buttonSortByProductNo.Enabled = false;
this.buttonRandomMode.Enabled = false;
//this.listBoxProductList.Enabled = false;
this.ControlLotSetting.Visible = true;
this.ControlLotSetting.BringToFront();
this.ControlLotSetting.DisplayRefresh();
}
else
{
this.buttonItemNo.Enabled = true;
this.buttonNameEdit.Enabled = true;
this.buttonLotEdit.Enabled = true;
this.buttonSortByProductNo.Enabled = true;
this.buttonRandomMode.Enabled = true;
//this.listBoxProductList.Enabled = true;
this.ControlLotSetting.Visible = false;
}
}
#endregion
}
}