1059 lines
53 KiB
C#
1059 lines
53 KiB
C#
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_2_ImageDll;
|
|
using ITC81DB_2.DialogForms;
|
|
using ITC81DB_2.Forms;
|
|
|
|
namespace ITC81DB_2.Controls
|
|
{
|
|
public partial class ControlMainDisplayNormal : UserControl
|
|
{
|
|
#region Field
|
|
private FormMainDisplay m_ParentForm;
|
|
#endregion
|
|
|
|
#region Constructor
|
|
public ControlMainDisplayNormal(FormMainDisplay parent)
|
|
{
|
|
InitializeComponent();
|
|
|
|
this.ParentForm = parent;
|
|
|
|
this.InitializeDesign();
|
|
this.DefaultSetting();
|
|
}
|
|
#endregion
|
|
|
|
#region Property
|
|
public FormMainDisplay 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.SystemConfig.Language == DataStore.LanguageID.English)
|
|
{
|
|
this.buttonOverRange1.DisableImage = this.buttonOverRange2.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayBargraphOverDisable));
|
|
this.buttonOverRange1.DownImage = this.buttonOverRange2.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayBargraphOverUp));
|
|
this.buttonOverRange1.UpImage = this.buttonOverRange2.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayBargraphOverUp));
|
|
this.buttonPassRange1.DisableImage = this.buttonPassRange2.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayBargraphPassDisable));
|
|
this.buttonPassRange1.DownImage = this.buttonPassRange2.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayBargraphPassUp));
|
|
this.buttonPassRange1.UpImage = this.buttonPassRange2.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayBargraphPassUp));
|
|
this.buttonUnderRange1.DisableImage = this.buttonUnderRange2.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayBargraphUnderDisable));
|
|
this.buttonUnderRange1.DownImage = this.buttonUnderRange2.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayBargraphUnderUp));
|
|
this.buttonUnderRange1.UpImage = this.buttonUnderRange2.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayBargraphUnderUp));
|
|
this.buttonTareRange1.DisableImage = this.buttonTareRange2.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayBargraphTareDisable));
|
|
this.buttonTareRange1.DownImage = this.buttonTareRange2.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayBargraphTareUp));
|
|
this.buttonTareRange1.UpImage = this.buttonTareRange2.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayBargraphTareUp));
|
|
}
|
|
else if (this.ParentForm.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese)
|
|
{
|
|
}
|
|
else if (this.ParentForm.ParentForm.SystemConfig.Language == DataStore.LanguageID.Czech)
|
|
{
|
|
}
|
|
else if (this.ParentForm.ParentForm.SystemConfig.Language == DataStore.LanguageID.Russian)
|
|
{
|
|
}
|
|
else
|
|
{
|
|
this.buttonOverRange1.DisableImage = this.buttonOverRange2.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainDisplayBargraphOverDisable));
|
|
this.buttonOverRange1.DownImage = this.buttonOverRange2.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainDisplayBargraphOverUp));
|
|
this.buttonOverRange1.UpImage = this.buttonOverRange2.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainDisplayBargraphOverUp));
|
|
this.buttonPassRange1.DisableImage = this.buttonPassRange2.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainDisplayBargraphPassDisable));
|
|
this.buttonPassRange1.DownImage = this.buttonPassRange2.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainDisplayBargraphPassUp));
|
|
this.buttonPassRange1.UpImage = this.buttonPassRange2.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainDisplayBargraphPassUp));
|
|
this.buttonUnderRange1.DisableImage = this.buttonUnderRange2.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainDisplayBargraphUnderDisable));
|
|
this.buttonUnderRange1.DownImage = this.buttonUnderRange2.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainDisplayBargraphUnderUp));
|
|
this.buttonUnderRange1.UpImage = this.buttonUnderRange2.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainDisplayBargraphUnderUp));
|
|
this.buttonTareRange1.DisableImage = this.buttonTareRange2.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainDisplayBargraphTareDisable));
|
|
this.buttonTareRange1.DownImage = this.buttonTareRange2.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainDisplayBargraphTareUp));
|
|
this.buttonTareRange1.UpImage = this.buttonTareRange2.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainDisplayBargraphTareUp));
|
|
}
|
|
}
|
|
private void DefaultSetting()
|
|
{
|
|
this.labelSpeed1.Text = this.labelSpeed2.Text = "0";
|
|
|
|
// Unit
|
|
this.labelUnit1.Text = this.ParentForm.ParentForm.SystemConfig.Unit;
|
|
this.labelUnit2.Text = this.ParentForm.ParentForm.SystemConfig.Unit;
|
|
}
|
|
|
|
public void RescaleProgressBar1()
|
|
{
|
|
int value = 0;
|
|
|
|
value = this.ParentForm.ParentForm.CurrentProductItem1.ProgressBarMaximum;
|
|
if (this.progressBar1.Maximum != value)
|
|
this.progressBar1.Maximum = value;
|
|
|
|
value = this.ParentForm.ParentForm.CurrentProductItem1.ProgressBarMinimum;
|
|
if (this.progressBar1.Minimum != value)
|
|
this.progressBar1.Minimum = value;
|
|
|
|
this.progressBar1.Value = this.progressBar1.Minimum;
|
|
}
|
|
public void RescaleProgressBar2()
|
|
{
|
|
int value = 0;
|
|
|
|
value = this.ParentForm.ParentForm.CurrentProductItem2.ProgressBarMaximum;
|
|
if (this.progressBar2.Maximum != value)
|
|
this.progressBar2.Maximum = value;
|
|
|
|
value = this.ParentForm.ParentForm.CurrentProductItem2.ProgressBarMinimum;
|
|
if (this.progressBar2.Minimum != value)
|
|
this.progressBar2.Minimum = value;
|
|
|
|
this.progressBar2.Value = this.progressBar2.Minimum;
|
|
}
|
|
private void SetProduct1(ProductItem item)
|
|
{
|
|
string underValue = "", passValue = "", overValue = "", tareValue = "";
|
|
|
|
switch (this.ParentForm.ParentForm.CurrentSystemStatus.CurrentWeightInputMode)
|
|
{
|
|
case DataStore.WeightInputMode.Weight:
|
|
underValue = Helper.StringToDecimalPlaces(item.UnderRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
passValue = Helper.StringToDecimalPlaces(item.PassRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
overValue = Helper.StringToDecimalPlaces(item.OverRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
tareValue = Helper.StringToDecimalPlaces(item.TareRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
break;
|
|
case DataStore.WeightInputMode.Deviation:
|
|
if (item.UnderRangDeviation == 0)
|
|
underValue = string.Format("-{0}", Helper.DoubleToString(0, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
|
|
else
|
|
underValue = Helper.StringToDecimalPlaces(item.UnderRangDeviation.ToString(), this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
passValue = Helper.StringToDecimalPlaces(item.PassRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
overValue = Helper.StringToDecimalPlaces(item.OverRangeDeviation.ToString(), this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
overValue = string.Format("+{0}", overValue);
|
|
tareValue = Helper.StringToDecimalPlaces(item.TareRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
if (this.buttonUnderRange1.Text != underValue)
|
|
this.buttonUnderRange1.Text = underValue;
|
|
|
|
if (this.buttonPassRange1.Text != passValue)
|
|
this.buttonPassRange1.Text = passValue;
|
|
|
|
if (this.buttonOverRange1.Text != overValue)
|
|
this.buttonOverRange1.Text = overValue;
|
|
|
|
if (this.buttonTareRange1.Text != tareValue)
|
|
this.buttonTareRange1.Text = tareValue;
|
|
|
|
// NET Icon 표시
|
|
this.UpdateDisplayIconNET1(item);
|
|
}
|
|
private void SetProduct2(ProductItem item)
|
|
{
|
|
string underValue = "", passValue = "", overValue = "", tareValue = "";
|
|
|
|
switch (this.ParentForm.ParentForm.CurrentSystemStatus.CurrentWeightInputMode)
|
|
{
|
|
case DataStore.WeightInputMode.Weight:
|
|
underValue = Helper.StringToDecimalPlaces(item.UnderRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
passValue = Helper.StringToDecimalPlaces(item.PassRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
overValue = Helper.StringToDecimalPlaces(item.OverRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
tareValue = Helper.StringToDecimalPlaces(item.TareRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
break;
|
|
case DataStore.WeightInputMode.Deviation:
|
|
if (item.UnderRangDeviation == 0)
|
|
underValue = string.Format("-{0}", Helper.DoubleToString(0, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
|
|
else
|
|
underValue = Helper.StringToDecimalPlaces(item.UnderRangDeviation.ToString(), this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
passValue = Helper.StringToDecimalPlaces(item.PassRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
overValue = Helper.StringToDecimalPlaces(item.OverRangeDeviation.ToString(), this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
overValue = string.Format("+{0}", overValue);
|
|
tareValue = Helper.StringToDecimalPlaces(item.TareRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
if (this.buttonUnderRange2.Text != underValue)
|
|
this.buttonUnderRange2.Text = underValue;
|
|
|
|
if (this.buttonPassRange2.Text != passValue)
|
|
this.buttonPassRange2.Text = passValue;
|
|
|
|
if (this.buttonOverRange2.Text != overValue)
|
|
this.buttonOverRange2.Text = overValue;
|
|
|
|
if (this.buttonTareRange2.Text != tareValue)
|
|
this.buttonTareRange2.Text = tareValue;
|
|
|
|
// NET Icon 표시
|
|
this.UpdateDisplayIconNET2(item);
|
|
}
|
|
private void SetCount1(WeightData data)
|
|
{
|
|
string value = "";
|
|
|
|
value = data.UnderCount.ToString();
|
|
if (this.labelUnderCount1.Text != value)
|
|
this.labelUnderCount1.Text = value;
|
|
|
|
value = data.PassCount.ToString();
|
|
if (this.labelPassCount1.Text != value)
|
|
this.labelPassCount1.Text = value;
|
|
|
|
value = data.OverCount.ToString();
|
|
if (this.labelOverCount1.Text != value)
|
|
this.labelOverCount1.Text = value;
|
|
|
|
value = data.ExNGCount.ToString();
|
|
if (this.labelExNgCount1.Text != value)
|
|
this.labelExNgCount1.Text = value;
|
|
|
|
value = data.TotalCount1.ToString();
|
|
if (this.labelTotalCount1.Text != value)
|
|
this.labelTotalCount1.Text = value;
|
|
}
|
|
private void SetCount2(WeightData data)
|
|
{
|
|
string value = "";
|
|
|
|
value = data.UnderCount.ToString();
|
|
if (this.labelUnderCount2.Text != value)
|
|
this.labelUnderCount2.Text = value;
|
|
|
|
value = data.PassCount.ToString();
|
|
if (this.labelPassCount2.Text != value)
|
|
this.labelPassCount2.Text = value;
|
|
|
|
value = data.OverCount.ToString();
|
|
if (this.labelOverCount2.Text != value)
|
|
this.labelOverCount2.Text = value;
|
|
|
|
value = data.ExNGCount.ToString();
|
|
if (this.labelExNgCount2.Text != value)
|
|
this.labelExNgCount2.Text = value;
|
|
|
|
value = data.TotalCount1.ToString();
|
|
if (this.labelTotalCount2.Text != value)
|
|
this.labelTotalCount2.Text = value;
|
|
}
|
|
private void SetProgressBarValue(SmartProgressBar progressBar, double weight, DataStore.JudgmentStatus judStatus, int decimalPlaces)
|
|
{
|
|
int value = 0;
|
|
|
|
if (decimalPlaces == 0)
|
|
value = int.Parse(string.Format("{0}", weight));
|
|
else if (decimalPlaces == 1)
|
|
value = int.Parse(string.Format("{0}", weight * 10));
|
|
else if (decimalPlaces == 2)
|
|
value = int.Parse(string.Format("{0}", weight * 100));
|
|
else if (decimalPlaces == 3)
|
|
value = int.Parse(string.Format("{0}", weight * 1000));
|
|
|
|
if (progressBar.Value != value)
|
|
progressBar.Value = value;
|
|
|
|
if (judStatus == DataStore.JudgmentStatus.Over)
|
|
{
|
|
if (progressBar.BarColor1 != Color.Yellow)
|
|
progressBar.BarColor1 = Color.Yellow;
|
|
}
|
|
else if (judStatus == DataStore.JudgmentStatus.Under || judStatus == DataStore.JudgmentStatus.Double || judStatus == DataStore.JudgmentStatus.Metal)
|
|
{
|
|
if (progressBar.BarColor1 != Color.Red)
|
|
progressBar.BarColor1 = Color.Red;
|
|
}
|
|
else
|
|
{
|
|
if (progressBar.BarColor1 != Color.Lime)
|
|
progressBar.BarColor1 = Color.Lime;
|
|
}
|
|
}
|
|
private void UpdateDisplayUser(UserItem user)
|
|
{
|
|
switch (user.Group)
|
|
{
|
|
case DataStore.UserGroup.LogOff:
|
|
this.buttonUnderRange1.Enabled = this.buttonUnderRange2.Enabled = false;
|
|
this.buttonPassRange1.Enabled = this.buttonPassRange2.Enabled = false;
|
|
this.buttonOverRange1.Enabled = this.buttonOverRange2.Enabled = false;
|
|
this.buttonTareRange1.Enabled = this.buttonTareRange2.Enabled = false;
|
|
break;
|
|
case DataStore.UserGroup.Level1Operator:
|
|
this.buttonUnderRange1.Enabled = this.buttonUnderRange2.Enabled = true;
|
|
this.buttonPassRange1.Enabled = this.buttonPassRange2.Enabled = true;
|
|
this.buttonOverRange1.Enabled = this.buttonOverRange2.Enabled = true;
|
|
this.buttonTareRange1.Enabled = this.buttonTareRange2.Enabled = true;
|
|
break;
|
|
case DataStore.UserGroup.Level2Engineer:
|
|
this.buttonUnderRange1.Enabled = this.buttonUnderRange2.Enabled = true;
|
|
this.buttonPassRange1.Enabled = this.buttonPassRange2.Enabled = true;
|
|
this.buttonOverRange1.Enabled = this.buttonOverRange2.Enabled = true;
|
|
this.buttonTareRange1.Enabled = this.buttonTareRange2.Enabled = true;
|
|
break;
|
|
case DataStore.UserGroup.Level3Manager:
|
|
this.buttonUnderRange1.Enabled = this.buttonUnderRange2.Enabled = true;
|
|
this.buttonPassRange1.Enabled = this.buttonPassRange2.Enabled = true;
|
|
this.buttonOverRange1.Enabled = this.buttonOverRange2.Enabled = true;
|
|
this.buttonTareRange1.Enabled = this.buttonTareRange2.Enabled = true;
|
|
break;
|
|
case DataStore.UserGroup.Level4Developer:
|
|
this.buttonUnderRange1.Enabled = this.buttonUnderRange2.Enabled = true;
|
|
this.buttonPassRange1.Enabled = this.buttonPassRange2.Enabled = true;
|
|
this.buttonOverRange1.Enabled = this.buttonOverRange2.Enabled = true;
|
|
this.buttonTareRange1.Enabled = this.buttonTareRange2.Enabled = true;
|
|
break;
|
|
default:
|
|
this.buttonUnderRange1.Enabled = this.buttonUnderRange2.Enabled = false;
|
|
this.buttonPassRange1.Enabled = this.buttonPassRange2.Enabled = false;
|
|
this.buttonOverRange1.Enabled = this.buttonOverRange2.Enabled = false;
|
|
this.buttonTareRange1.Enabled = this.buttonTareRange2.Enabled = false;
|
|
break;
|
|
}
|
|
}
|
|
private void UpdateDisplayStopWeight1(DataStore.EquipmentStatus status, WeightData data)
|
|
{
|
|
string value = "";
|
|
|
|
// 영점 표시
|
|
if (data.Status == DataStore.WeightStatus.WeightZero)
|
|
this.pictureBoxIconZero1.Visible = true;
|
|
else
|
|
this.pictureBoxIconZero1.Visible = false;
|
|
|
|
if (status == DataStore.EquipmentStatus.Stop)
|
|
{
|
|
// 중량
|
|
value = Helper.DoubleToString(data.Weight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
if (this.labelWeight1.Text != value)
|
|
this.labelWeight1.Text = value;
|
|
}
|
|
}
|
|
private void UpdateDisplayStopWeight2(DataStore.EquipmentStatus status, WeightData data)
|
|
{
|
|
string value = "";
|
|
|
|
// 영점 아이콘표시
|
|
if (data.Status == DataStore.WeightStatus.WeightZero)
|
|
this.pictureBoxIconZero2.Visible = true;
|
|
else
|
|
this.pictureBoxIconZero2.Visible = false;
|
|
|
|
if (status == DataStore.EquipmentStatus.Stop)
|
|
{
|
|
// 중량
|
|
value = Helper.DoubleToString(data.Weight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
if (this.labelWeight2.Text != value)
|
|
this.labelWeight2.Text = value;
|
|
}
|
|
}
|
|
private void UpdateDisplayIconNET1(ProductItem item)
|
|
{
|
|
double dValue = 0.0;
|
|
|
|
dValue = Helper.StringToWeight(item.TareRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
if (dValue != 0.0)
|
|
this.labelIconNET1.Visible = true;
|
|
else
|
|
this.labelIconNET1.Visible = false;
|
|
}
|
|
private void UpdateDisplayIconNET2(ProductItem item)
|
|
{
|
|
double dValue = 0.0;
|
|
|
|
dValue = Helper.StringToWeight(item.TareRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
if (dValue != 0.0)
|
|
this.labelIconNET2.Visible = true;
|
|
else
|
|
this.labelIconNET2.Visible = false;
|
|
}
|
|
|
|
public void UpdateEquipmentStatusDisplay(DataStore.EquipmentStatus status)
|
|
{
|
|
this.labelSpeed1.Text = this.labelSpeed2.Text = "0";
|
|
this.progressBar1.Value = this.progressBar1.Minimum;
|
|
this.progressBar2.Value = this.progressBar2.Minimum;
|
|
|
|
if (status == DataStore.EquipmentStatus.Start)
|
|
{
|
|
this.labelWeight1.Text = Helper.StringToDecimalPlaces("0", this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
this.labelWeight2.Text = Helper.StringToDecimalPlaces("0", this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
}
|
|
else
|
|
{
|
|
this.pictureBoxIconGap1.Visible = false;
|
|
this.pictureBoxIconGap2.Visible = false;
|
|
this.pictureBoxIconMetal1.Visible = false;
|
|
this.pictureBoxIconMetal2.Visible = false;
|
|
}
|
|
}
|
|
public void UpdateCurrentProductDisplay(DataStore.EquipmentStatus status, ProductItem pItem1,ProductItem pItem2, WeightData wData1, WeightData wData2)
|
|
{
|
|
this.SetProduct1(pItem1);
|
|
this.SetProduct2(pItem2);
|
|
this.SetCount1(wData1);
|
|
this.SetCount2(wData2);
|
|
|
|
this.RescaleProgressBar1();
|
|
this.RescaleProgressBar2();
|
|
}
|
|
public void UpdateStopWeightDisplay(DataStore.EquipmentStatus status, WeightData data1, WeightData data2)
|
|
{
|
|
this.UpdateDisplayStopWeight1(status, data1);
|
|
this.UpdateDisplayStopWeight2(status, data2);
|
|
}
|
|
public void UpdateStartWeightDisplay1(DataStore.EquipmentStatus status, WeightData data)
|
|
{
|
|
string value = "";
|
|
|
|
if (data.JudgmentStatus == DataStore.JudgmentStatus.Empty)
|
|
return;
|
|
|
|
// 중량
|
|
value = Helper.DoubleToString(data.Weight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
if (this.labelWeight1.Text != value)
|
|
this.labelWeight1.Text = value;
|
|
|
|
// GAP 아이콘 표시
|
|
if (data.JudgmentStatus == DataStore.JudgmentStatus.Double)
|
|
{
|
|
if (this.pictureBoxIconGap1.Visible != true)
|
|
this.pictureBoxIconGap1.Visible = true;
|
|
}
|
|
else
|
|
this.pictureBoxIconGap1.Visible = false;
|
|
|
|
// Metal 아이콘 표시
|
|
if (data.JudgmentStatus == DataStore.JudgmentStatus.Metal)
|
|
{
|
|
if (this.pictureBoxIconMetal1.Visible != true)
|
|
this.pictureBoxIconMetal1.Visible = true;
|
|
}
|
|
else
|
|
this.pictureBoxIconMetal1.Visible = false;
|
|
|
|
// 생산속도
|
|
value = data.ProductionSpeed.ToString();
|
|
if (this.labelSpeed1.Text != value)
|
|
this.labelSpeed1.Text = value;
|
|
|
|
this.SetProgressBarValue(this.progressBar1, data.Weight, data.JudgmentStatus, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
this.SetCount1(data);
|
|
}
|
|
public void UpdateStartWeightDisplay2(DataStore.EquipmentStatus status, WeightData data)
|
|
{
|
|
string value = "";
|
|
|
|
if (data.JudgmentStatus == DataStore.JudgmentStatus.Empty)
|
|
return;
|
|
|
|
// 중량
|
|
value = Helper.DoubleToString(data.Weight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
if (this.labelWeight2.Text != value)
|
|
this.labelWeight2.Text = value;
|
|
|
|
// GAP 아이콘 표시
|
|
if (data.JudgmentStatus == DataStore.JudgmentStatus.Double)
|
|
{
|
|
if (this.pictureBoxIconGap2.Visible != true)
|
|
this.pictureBoxIconGap2.Visible = true;
|
|
}
|
|
else
|
|
this.pictureBoxIconGap2.Visible = false;
|
|
|
|
// Metal 아이콘 표시
|
|
if (data.JudgmentStatus == DataStore.JudgmentStatus.Metal)
|
|
{
|
|
if (this.pictureBoxIconMetal2.Visible != true)
|
|
this.pictureBoxIconMetal2.Visible = true;
|
|
}
|
|
else
|
|
this.pictureBoxIconMetal2.Visible = false;
|
|
|
|
// 생산속도
|
|
value = data.ProductionSpeed.ToString();
|
|
if (this.labelSpeed2.Text != value)
|
|
this.labelSpeed2.Text = value;
|
|
|
|
this.SetProgressBarValue(this.progressBar2, data.Weight, data.JudgmentStatus, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
this.SetCount2(data);
|
|
}
|
|
|
|
public void Clear()
|
|
{
|
|
this.SetCount1(this.ParentForm.ParentForm.CurrentWeightData1);
|
|
this.SetCount2(this.ParentForm.ParentForm.CurrentWeightData2);
|
|
this.progressBar1.Value = this.progressBar1.Minimum;
|
|
this.progressBar2.Value = this.progressBar2.Minimum;
|
|
this.labelSpeed1.Text = "0";
|
|
this.labelSpeed2.Text = "0";
|
|
}
|
|
public void DisplayRefresh(SystemStatus status)
|
|
{
|
|
this.UpdateDisplayUser(status.CurrentUser);
|
|
|
|
this.SetProduct1(this.ParentForm.ParentForm.CurrentProductItem1);
|
|
this.SetProduct2(this.ParentForm.ParentForm.CurrentProductItem2);
|
|
this.SetCount1(this.ParentForm.ParentForm.CurrentWeightData1);
|
|
this.SetCount2(this.ParentForm.ParentForm.CurrentWeightData2);
|
|
|
|
// Unit
|
|
this.labelUnit1.Text = this.ParentForm.ParentForm.SystemConfig.Unit;
|
|
this.labelUnit2.Text = this.ParentForm.ParentForm.SystemConfig.Unit;
|
|
}
|
|
#endregion
|
|
|
|
#region Event Handler
|
|
private void buttonUnderRange1_Click(object sender, EventArgs e)
|
|
{
|
|
string value = "", sValue = "";
|
|
double dValue = 0.0;
|
|
int digit = 0;
|
|
|
|
if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 0)
|
|
digit = 4;
|
|
else if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 1)
|
|
digit = 5;
|
|
else if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 2)
|
|
digit = 6;
|
|
else
|
|
digit = 5;
|
|
|
|
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.buttonUnderRange1.Text, digit, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces,
|
|
false, this.ParentForm.ParentForm.SystemConfig.Language);
|
|
|
|
if (myKeyPad.ShowDialog() != DialogResult.OK)
|
|
return;
|
|
|
|
switch (this.ParentForm.ParentForm.CurrentSystemStatus.CurrentWeightInputMode)
|
|
{
|
|
case DataStore.WeightInputMode.Weight:
|
|
dValue = myKeyPad.doubleValue;
|
|
sValue = myKeyPad.StringValue;
|
|
break;
|
|
case DataStore.WeightInputMode.Deviation:
|
|
dValue = Helper.StringToWeight(this.ParentForm.ParentForm.CurrentProductItem1.PassRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces)
|
|
- Math.Abs(myKeyPad.doubleValue);
|
|
sValue = Helper.DoubleToString(dValue, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
break;
|
|
default:
|
|
dValue = myKeyPad.doubleValue;
|
|
sValue = myKeyPad.StringValue;
|
|
break;
|
|
}
|
|
|
|
if (dValue > Helper.StringToWeight(this.ParentForm.ParentForm.CurrentProductItem1.PassRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces) || dValue < 0)
|
|
{
|
|
// 입력범위를 확인하세요
|
|
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language);
|
|
myMsg.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
this.ParentForm.ParentForm.CurrentProductItem1.UnderRange = sValue.Replace(".", "");
|
|
|
|
switch (this.ParentForm.ParentForm.CurrentSystemStatus.CurrentWeightInputMode)
|
|
{
|
|
case DataStore.WeightInputMode.Weight:
|
|
value = myKeyPad.StringValue;
|
|
break;
|
|
case DataStore.WeightInputMode.Deviation:
|
|
if (myKeyPad.doubleValue == 0)
|
|
value = string.Format("-{0}", Helper.DoubleToString(0, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
|
|
else
|
|
value = myKeyPad.StringValue;
|
|
break;
|
|
default:
|
|
value = myKeyPad.StringValue;
|
|
break;
|
|
}
|
|
|
|
this.buttonUnderRange1.Text = value;
|
|
|
|
this.ParentForm.RescaleControl();
|
|
|
|
this.ParentForm.ParentForm.SaveProductFile1(this.ParentForm.ParentForm.CurrentProductItem1, this.ParentForm.ParentForm.SystemConfig.ProductNumber - 1);
|
|
|
|
value = Helper.StringZeroFillDigits7(this.ParentForm.ParentForm.CurrentProductItem1.UnderRange);
|
|
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._2002_UnderRange, value);
|
|
}
|
|
}
|
|
private void buttonPassRange1_Click(object sender, EventArgs e)
|
|
{
|
|
string value = "", underRange = "", overRange = "", viewValue = "";
|
|
int digit = 0, temp = 0, range = 0;
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 0)
|
|
digit = 4;
|
|
else if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 1)
|
|
digit = 5;
|
|
else if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 2)
|
|
digit = 6;
|
|
else
|
|
digit = 5;
|
|
|
|
if (this.ParentForm.ParentForm.CurrentWeightData1.Weight < 1)
|
|
viewValue = this.buttonPassRange1.Text;
|
|
else
|
|
viewValue = Helper.DoubleToString(this.ParentForm.ParentForm.CurrentWeightData1.Weight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
|
|
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(viewValue, digit, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces,
|
|
false, this.ParentForm.ParentForm.SystemConfig.Language);
|
|
|
|
if (myKeyPad.ShowDialog() != DialogResult.OK)
|
|
return;
|
|
|
|
this.ParentForm.ParentForm.CurrentProductItem1.PassRange = myKeyPad.StringValue.Replace(".", "");
|
|
|
|
temp = this.ParentForm.ParentForm.CurrentProductItem1.PassRangeInt + this.ParentForm.ParentForm.CurrentProductItem1.UnderRangDeviation;
|
|
if (temp < 0)
|
|
this.ParentForm.ParentForm.CurrentProductItem1.UnderRange = "0";
|
|
else
|
|
this.ParentForm.ParentForm.CurrentProductItem1.UnderRange = temp.ToString();
|
|
|
|
if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 2)
|
|
range = 1000000;
|
|
else if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 1)
|
|
range = 100000;
|
|
else
|
|
range = 10000;
|
|
temp = this.ParentForm.ParentForm.CurrentProductItem1.PassRangeInt + this.ParentForm.ParentForm.CurrentProductItem1.OverRangeDeviation;
|
|
if (temp >= range)
|
|
this.ParentForm.ParentForm.CurrentProductItem1.OverRange = this.ParentForm.ParentForm.CurrentProductItem1.PassRange;
|
|
else
|
|
this.ParentForm.ParentForm.CurrentProductItem1.OverRange = temp.ToString();
|
|
|
|
this.ParentForm.RescaleControl();
|
|
|
|
this.ParentForm.ParentForm.SaveProductFile1(this.ParentForm.ParentForm.CurrentProductItem1, this.ParentForm.ParentForm.SystemConfig.ProductNumber - 1);
|
|
|
|
sb.Append(Helper.StringZeroFillDigits7(this.ParentForm.ParentForm.CurrentProductItem1.UnderRange));
|
|
sb.Append(Helper.StringZeroFillDigits7(this.ParentForm.ParentForm.CurrentProductItem1.OverRange));
|
|
sb.Append(Helper.StringZeroFillDigits7(this.ParentForm.ParentForm.CurrentProductItem1.TareRange));
|
|
sb.Append(Helper.StringZeroFillDigits4(this.ParentForm.ParentForm.SystemConfig.ProductNumber.ToString()));
|
|
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._9003_ParameterWeightSetting, sb.ToString());
|
|
|
|
switch (this.ParentForm.ParentForm.CurrentSystemStatus.CurrentWeightInputMode)
|
|
{
|
|
case DataStore.WeightInputMode.Weight:
|
|
#region WeightMode
|
|
underRange = Helper.StringToDecimalPlaces(this.ParentForm.ParentForm.CurrentProductItem1.UnderRange.ToString(), this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
overRange = Helper.StringToDecimalPlaces(this.ParentForm.ParentForm.CurrentProductItem1.OverRange.ToString(), this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
#endregion
|
|
break;
|
|
case DataStore.WeightInputMode.Deviation:
|
|
#region DeviationMode
|
|
if (this.ParentForm.ParentForm.CurrentProductItem1.UnderRangDeviation == 0)
|
|
underRange = string.Format("-{0}", Helper.DoubleToString(0, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
|
|
else
|
|
underRange = Helper.StringToDecimalPlaces(this.ParentForm.ParentForm.CurrentProductItem1.UnderRangDeviation.ToString(), this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
overRange = Helper.StringToDecimalPlaces(this.ParentForm.ParentForm.CurrentProductItem1.OverRangeDeviation.ToString(), this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
overRange = string.Format("+{0}", overRange);
|
|
#endregion
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
this.buttonPassRange1.Text = myKeyPad.StringValue;
|
|
this.buttonUnderRange1.Text = underRange;
|
|
this.buttonOverRange1.Text = overRange;
|
|
}
|
|
private void buttonOverRange1_Click(object sender, EventArgs e)
|
|
{
|
|
string value = "", sValue = "";
|
|
double dValue = 0.0;
|
|
int digit = 0;
|
|
|
|
if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 0)
|
|
digit = 4;
|
|
else if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 1)
|
|
digit = 5;
|
|
else if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 2)
|
|
digit = 6;
|
|
else
|
|
digit = 5;
|
|
|
|
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.buttonOverRange1.Text, digit, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces,
|
|
false, this.ParentForm.ParentForm.SystemConfig.Language);
|
|
|
|
if (myKeyPad.ShowDialog() != DialogResult.OK)
|
|
return;
|
|
|
|
switch (this.ParentForm.ParentForm.CurrentSystemStatus.CurrentWeightInputMode)
|
|
{
|
|
case DataStore.WeightInputMode.Weight:
|
|
dValue = myKeyPad.doubleValue;
|
|
sValue = myKeyPad.StringValue;
|
|
break;
|
|
case DataStore.WeightInputMode.Deviation:
|
|
dValue = Helper.StringToWeight(this.ParentForm.ParentForm.CurrentProductItem1.PassRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces)
|
|
+ myKeyPad.doubleValue;
|
|
sValue = Helper.DoubleToString(dValue, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
break;
|
|
default:
|
|
dValue = myKeyPad.doubleValue;
|
|
sValue = myKeyPad.StringValue;
|
|
break;
|
|
}
|
|
|
|
if (dValue < Helper.StringToWeight(this.ParentForm.ParentForm.CurrentProductItem1.PassRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces) ||
|
|
dValue >= 10000)
|
|
{
|
|
// 입력범위를 확인하세요
|
|
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language);
|
|
myMsg.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
this.ParentForm.ParentForm.CurrentProductItem1.OverRange = sValue.Replace(".", "");
|
|
|
|
switch (this.ParentForm.ParentForm.CurrentSystemStatus.CurrentWeightInputMode)
|
|
{
|
|
case DataStore.WeightInputMode.Weight:
|
|
value = myKeyPad.StringValue;
|
|
break;
|
|
case DataStore.WeightInputMode.Deviation:
|
|
value = string.Format("+{0}", myKeyPad.StringValue);
|
|
break;
|
|
default:
|
|
value = myKeyPad.StringValue;
|
|
break;
|
|
}
|
|
this.buttonOverRange1.Text = value;
|
|
|
|
this.ParentForm.RescaleControl();
|
|
|
|
this.ParentForm.ParentForm.SaveProductFile1(this.ParentForm.ParentForm.CurrentProductItem1, this.ParentForm.ParentForm.SystemConfig.ProductNumber - 1);
|
|
|
|
value = Helper.StringZeroFillDigits7(this.ParentForm.ParentForm.CurrentProductItem1.OverRange);
|
|
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._2004_OverRange, value);
|
|
}
|
|
}
|
|
private void buttonTareRange1_Click(object sender, EventArgs e)
|
|
{
|
|
string value = "";
|
|
int digit = 0;
|
|
|
|
if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 0)
|
|
digit = 4;
|
|
else if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 1)
|
|
digit = 5;
|
|
else if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 2)
|
|
digit = 6;
|
|
else
|
|
digit = 5;
|
|
|
|
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.buttonTareRange1.Text, digit, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces,
|
|
false, this.ParentForm.ParentForm.SystemConfig.Language);
|
|
|
|
if (myKeyPad.ShowDialog() == DialogResult.OK)
|
|
{
|
|
if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 999.99)
|
|
{
|
|
// 입력범위를 확인하세요
|
|
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language);
|
|
myMsg.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
this.ParentForm.ParentForm.CurrentProductItem1.TareRange = myKeyPad.StringValue.Replace(".", "");
|
|
this.buttonTareRange1.Text = myKeyPad.StringValue;
|
|
|
|
this.ParentForm.ParentForm.SaveProductFile1(this.ParentForm.ParentForm.CurrentProductItem1, this.ParentForm.ParentForm.SystemConfig.ProductNumber - 1);
|
|
|
|
// NET Icon 표시
|
|
this.UpdateDisplayIconNET1(this.ParentForm.ParentForm.CurrentProductItem1);
|
|
|
|
value = Helper.StringZeroFillDigits7(this.ParentForm.ParentForm.CurrentProductItem1.TareRange);
|
|
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._2005_TareRange, value);
|
|
}
|
|
}
|
|
}
|
|
private void buttonUnderRange2_Click(object sender, EventArgs e)
|
|
{
|
|
string value = "", sValue = "";
|
|
double dValue = 0.0;
|
|
int digit = 0;
|
|
|
|
if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 0)
|
|
digit = 4;
|
|
else if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 1)
|
|
digit = 5;
|
|
else if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 2)
|
|
digit = 6;
|
|
else
|
|
digit = 5;
|
|
|
|
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.buttonUnderRange2.Text, digit, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces,
|
|
false, this.ParentForm.ParentForm.SystemConfig.Language);
|
|
|
|
if (myKeyPad.ShowDialog() != DialogResult.OK)
|
|
return;
|
|
|
|
switch (this.ParentForm.ParentForm.CurrentSystemStatus.CurrentWeightInputMode)
|
|
{
|
|
case DataStore.WeightInputMode.Weight:
|
|
dValue = myKeyPad.doubleValue;
|
|
sValue = myKeyPad.StringValue;
|
|
break;
|
|
case DataStore.WeightInputMode.Deviation:
|
|
dValue = Helper.StringToWeight(this.ParentForm.ParentForm.CurrentProductItem2.PassRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces)
|
|
- Math.Abs(myKeyPad.doubleValue);
|
|
sValue = Helper.DoubleToString(dValue, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
break;
|
|
default:
|
|
dValue = myKeyPad.doubleValue;
|
|
sValue = myKeyPad.StringValue;
|
|
break;
|
|
}
|
|
|
|
if (dValue > Helper.StringToWeight(this.ParentForm.ParentForm.CurrentProductItem2.PassRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces) || dValue < 0)
|
|
{
|
|
// 입력범위를 확인하세요
|
|
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language);
|
|
myMsg.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
this.ParentForm.ParentForm.CurrentProductItem2.UnderRange = sValue.Replace(".", "");
|
|
|
|
switch (this.ParentForm.ParentForm.CurrentSystemStatus.CurrentWeightInputMode)
|
|
{
|
|
case DataStore.WeightInputMode.Weight:
|
|
value = myKeyPad.StringValue;
|
|
break;
|
|
case DataStore.WeightInputMode.Deviation:
|
|
if (myKeyPad.doubleValue == 0)
|
|
value = string.Format("-{0}", Helper.DoubleToString(0, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
|
|
else
|
|
value = myKeyPad.StringValue;
|
|
break;
|
|
default:
|
|
value = myKeyPad.StringValue;
|
|
break;
|
|
}
|
|
|
|
this.buttonUnderRange2.Text = value;
|
|
|
|
this.ParentForm.RescaleControl();
|
|
|
|
this.ParentForm.ParentForm.SaveProductFile2(this.ParentForm.ParentForm.CurrentProductItem2, this.ParentForm.ParentForm.SystemConfig.ProductNumber - 1);
|
|
|
|
value = Helper.StringZeroFillDigits7(this.ParentForm.ParentForm.CurrentProductItem2.UnderRange);
|
|
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._2006_UnderRange, value);
|
|
}
|
|
}
|
|
private void buttonPassRange2_Click(object sender, EventArgs e)
|
|
{
|
|
string value = "", underRange = "", overRange = "", viewValue = "";
|
|
int digit = 0, temp = 0, range = 0;
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 0)
|
|
digit = 4;
|
|
else if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 1)
|
|
digit = 5;
|
|
else if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 2)
|
|
digit = 6;
|
|
else
|
|
digit = 5;
|
|
|
|
if (this.ParentForm.ParentForm.CurrentWeightData2.Weight < 1)
|
|
viewValue = this.buttonPassRange2.Text;
|
|
else
|
|
viewValue = Helper.DoubleToString(this.ParentForm.ParentForm.CurrentWeightData2.Weight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
|
|
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(viewValue, digit, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces,
|
|
false, this.ParentForm.ParentForm.SystemConfig.Language);
|
|
|
|
if (myKeyPad.ShowDialog() != DialogResult.OK)
|
|
return;
|
|
|
|
this.ParentForm.ParentForm.CurrentProductItem2.PassRange = myKeyPad.StringValue.Replace(".", "");
|
|
|
|
temp = this.ParentForm.ParentForm.CurrentProductItem2.PassRangeInt + this.ParentForm.ParentForm.CurrentProductItem2.UnderRangDeviation;
|
|
if (temp < 0)
|
|
this.ParentForm.ParentForm.CurrentProductItem2.UnderRange = "0";
|
|
else
|
|
this.ParentForm.ParentForm.CurrentProductItem2.UnderRange = temp.ToString();
|
|
|
|
if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 2)
|
|
range = 1000000;
|
|
else if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 1)
|
|
range = 100000;
|
|
else
|
|
range = 10000;
|
|
temp = this.ParentForm.ParentForm.CurrentProductItem2.PassRangeInt + this.ParentForm.ParentForm.CurrentProductItem2.OverRangeDeviation;
|
|
if (temp >= range)
|
|
this.ParentForm.ParentForm.CurrentProductItem2.OverRange = this.ParentForm.ParentForm.CurrentProductItem2.PassRange;
|
|
else
|
|
this.ParentForm.ParentForm.CurrentProductItem2.OverRange = temp.ToString();
|
|
|
|
this.ParentForm.RescaleControl();
|
|
|
|
this.ParentForm.ParentForm.SaveProductFile2(this.ParentForm.ParentForm.CurrentProductItem2, this.ParentForm.ParentForm.SystemConfig.ProductNumber - 1);
|
|
|
|
sb.Append(Helper.StringZeroFillDigits7(this.ParentForm.ParentForm.CurrentProductItem2.UnderRange));
|
|
sb.Append(Helper.StringZeroFillDigits7(this.ParentForm.ParentForm.CurrentProductItem2.OverRange));
|
|
sb.Append(Helper.StringZeroFillDigits7(this.ParentForm.ParentForm.CurrentProductItem2.TareRange));
|
|
sb.Append(Helper.StringZeroFillDigits4(this.ParentForm.ParentForm.SystemConfig.ProductNumber.ToString()));
|
|
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._9012_ParameterWeightSetting, sb.ToString());
|
|
|
|
switch (this.ParentForm.ParentForm.CurrentSystemStatus.CurrentWeightInputMode)
|
|
{
|
|
case DataStore.WeightInputMode.Weight:
|
|
#region WeightMode
|
|
underRange = Helper.StringToDecimalPlaces(this.ParentForm.ParentForm.CurrentProductItem2.UnderRange.ToString(), this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
overRange = Helper.StringToDecimalPlaces(this.ParentForm.ParentForm.CurrentProductItem2.OverRange.ToString(), this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
#endregion
|
|
break;
|
|
case DataStore.WeightInputMode.Deviation:
|
|
#region DeviationMode
|
|
if (this.ParentForm.ParentForm.CurrentProductItem2.UnderRangDeviation == 0)
|
|
underRange = string.Format("-{0}", Helper.DoubleToString(0, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
|
|
else
|
|
underRange = Helper.StringToDecimalPlaces(this.ParentForm.ParentForm.CurrentProductItem2.UnderRangDeviation.ToString(), this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
overRange = Helper.StringToDecimalPlaces(this.ParentForm.ParentForm.CurrentProductItem2.OverRangeDeviation.ToString(), this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
overRange = string.Format("+{0}", overRange);
|
|
#endregion
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
this.buttonPassRange2.Text = myKeyPad.StringValue;
|
|
this.buttonUnderRange2.Text = underRange;
|
|
this.buttonOverRange2.Text = overRange;
|
|
}
|
|
private void buttonOverRange2_Click(object sender, EventArgs e)
|
|
{
|
|
string value = "", sValue = "";
|
|
double dValue = 0.0;
|
|
int digit = 0;
|
|
|
|
if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 0)
|
|
digit = 4;
|
|
else if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 1)
|
|
digit = 5;
|
|
else if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 2)
|
|
digit = 6;
|
|
else
|
|
digit = 5;
|
|
|
|
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.buttonOverRange2.Text, digit, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces,
|
|
false, this.ParentForm.ParentForm.SystemConfig.Language);
|
|
|
|
if (myKeyPad.ShowDialog() != DialogResult.OK)
|
|
return;
|
|
|
|
switch (this.ParentForm.ParentForm.CurrentSystemStatus.CurrentWeightInputMode)
|
|
{
|
|
case DataStore.WeightInputMode.Weight:
|
|
dValue = myKeyPad.doubleValue;
|
|
sValue = myKeyPad.StringValue;
|
|
break;
|
|
case DataStore.WeightInputMode.Deviation:
|
|
dValue = Helper.StringToWeight(this.ParentForm.ParentForm.CurrentProductItem2.PassRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces)
|
|
+ myKeyPad.doubleValue;
|
|
sValue = Helper.DoubleToString(dValue, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
|
break;
|
|
default:
|
|
dValue = myKeyPad.doubleValue;
|
|
sValue = myKeyPad.StringValue;
|
|
break;
|
|
}
|
|
|
|
if (dValue < Helper.StringToWeight(this.ParentForm.ParentForm.CurrentProductItem2.PassRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces) ||
|
|
dValue >= 10000)
|
|
{
|
|
// 입력범위를 확인하세요
|
|
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language);
|
|
myMsg.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
this.ParentForm.ParentForm.CurrentProductItem2.OverRange = sValue.Replace(".", "");
|
|
|
|
switch (this.ParentForm.ParentForm.CurrentSystemStatus.CurrentWeightInputMode)
|
|
{
|
|
case DataStore.WeightInputMode.Weight:
|
|
value = myKeyPad.StringValue;
|
|
break;
|
|
case DataStore.WeightInputMode.Deviation:
|
|
value = string.Format("+{0}", myKeyPad.StringValue);
|
|
break;
|
|
default:
|
|
value = myKeyPad.StringValue;
|
|
break;
|
|
}
|
|
this.buttonOverRange2.Text = value;
|
|
|
|
this.ParentForm.RescaleControl();
|
|
|
|
this.ParentForm.ParentForm.SaveProductFile2(this.ParentForm.ParentForm.CurrentProductItem2, this.ParentForm.ParentForm.SystemConfig.ProductNumber - 1);
|
|
|
|
value = Helper.StringZeroFillDigits7(this.ParentForm.ParentForm.CurrentProductItem2.OverRange);
|
|
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._2008_OverRange, value);
|
|
}
|
|
}
|
|
private void buttonTareRange2_Click(object sender, EventArgs e)
|
|
{
|
|
string value = "";
|
|
int digit = 0;
|
|
|
|
if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 0)
|
|
digit = 4;
|
|
else if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 1)
|
|
digit = 5;
|
|
else if (this.ParentForm.ParentForm.SystemConfig.DecimalPlaces == 2)
|
|
digit = 6;
|
|
else
|
|
digit = 5;
|
|
|
|
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.buttonTareRange2.Text, digit, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces,
|
|
false, this.ParentForm.ParentForm.SystemConfig.Language);
|
|
|
|
if (myKeyPad.ShowDialog() == DialogResult.OK)
|
|
{
|
|
if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 999.99)
|
|
{
|
|
// 입력범위를 확인하세요
|
|
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language);
|
|
myMsg.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
this.ParentForm.ParentForm.CurrentProductItem2.TareRange = myKeyPad.StringValue.Replace(".", "");
|
|
this.buttonTareRange2.Text = myKeyPad.StringValue;
|
|
|
|
this.ParentForm.ParentForm.SaveProductFile2(this.ParentForm.ParentForm.CurrentProductItem2, this.ParentForm.ParentForm.SystemConfig.ProductNumber - 1);
|
|
|
|
// NET Icon 표시
|
|
this.UpdateDisplayIconNET2(this.ParentForm.ParentForm.CurrentProductItem2);
|
|
|
|
value = Helper.StringZeroFillDigits7(this.ParentForm.ParentForm.CurrentProductItem2.TareRange);
|
|
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._2009_TareRange, value);
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|