ITC81DB_2H/ITC81DB_0H/Controls/MainDisplay/ControlMainDisplayStopDataS...

210 lines
7.7 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 ITC81DB_0H.Forms;
using ITC81DB_0H_ImageDll;
namespace ITC81DB_0H.Controls
{
public partial class ControlMainDisplayStopDataStatistics : UserControl
{
#region Field
private FormMainDisplay m_ParentForm;
#endregion
#region Constructor
public ControlMainDisplayStopDataStatistics(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.SystemConfig1.Language == DataStore.LanguageID.English)
{
this.pictureBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engMainStatScreen));
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese)
{
this.pictureBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.chnMainStatScreen));
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech)
{
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian)
{
this.pictureBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.rusMainStatScreen));
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German)
{
this.pictureBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.gerMainStatScreen));
}
else
{
this.pictureBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.korMainStatScreen));
}
}
private void DefaultSetting()
{
}
private void SetProduct(ProductItem item)
{
string underValue = "", passValue = "", overValue = "";
switch (this.ParentForm.ParentForm.CurrentSystemStatus.CurrentWeightInputMode)
{
case DataStore.WeightInputMode.Weight:
underValue = Helper.StringToDecimalPlaces(item.UnderRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
passValue = Helper.StringToDecimalPlaces(item.PassRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
overValue = Helper.StringToDecimalPlaces(item.OverRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
break;
case DataStore.WeightInputMode.Deviation:
underValue = Helper.StringToDecimalPlaces(item.UnderRangeDeviation.ToString(), this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
passValue = Helper.StringToDecimalPlaces(item.PassRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
overValue = Helper.StringToDecimalPlaces(item.OverRangeDeviation.ToString(), this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
overValue = string.Format("+{0}", overValue);
break;
default:
break;
}
if (this.labelUnderRange.Text != underValue)
this.labelUnderRange.Text = underValue;
if (this.labelPassRange.Text != passValue)
this.labelPassRange.Text = passValue;
if (this.labelOverRange.Text != overValue)
this.labelOverRange.Text = overValue;
}
private void SetCount(WeightData data)
{
string value = "";
#region Count
value = data.UnderCount.ToString();
if (this.labelUnderCount.Text != value)
this.labelUnderCount.Text = value;
value = data.PassCount.ToString();
if (this.labelPassCount.Text != value)
this.labelPassCount.Text = value;
value = data.OverCount.ToString();
if (this.labelOverCount.Text != value)
this.labelOverCount.Text = value;
value = data.TotalUnderOverCount.ToString();
if (this.labelNgCount.Text != value)
this.labelNgCount.Text = value;
value = data.ExNGCount.ToString();
if (this.labelExNgCount.Text != value)
this.labelExNgCount.Text = value;
value = data.TotalCount.ToString();
if (this.labelTotalCount.Text != value)
this.labelTotalCount.Text = value;
#endregion
#region SumWeight
value = data.UnderSumWeightKG;
if (this.labelUnderSumWeight.Text != value)
this.labelUnderSumWeight.Text = value;
value = data.PassSumWeightKG;
if (this.labelPassSumWeight.Text != value)
this.labelPassSumWeight.Text = value;
value = data.OverSumWeightKG;
if (this.labelOverSumWeight.Text != value)
this.labelOverSumWeight.Text = value;
#endregion
#region Average
value = Helper.DoubleToString(data.UnderAverage, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
if (this.labelUnderAverage.Text != value)
this.labelUnderAverage.Text = value;
value = Helper.DoubleToString(data.PassAverage, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
if (this.labelPassAverage.Text != value)
this.labelPassAverage.Text = value;
value = Helper.DoubleToString(data.OverAverage, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
if (this.labelOverAverage.Text != value)
this.labelOverAverage.Text = value;
#endregion
}
private void UpdateDisplayUser(UserItem user)
{
switch (user.Group)
{
case DataStore.UserGroup.LogOut:
break;
case DataStore.UserGroup.Level1Operator:
break;
case DataStore.UserGroup.Level2Engineer:
break;
case DataStore.UserGroup.Level3Manager:
break;
case DataStore.UserGroup.Level4Developer:
break;
default:
break;
}
}
public void UpdateEquipmentStatusDisplay(DataStore.EquipmentStatus status)
{
}
public void UpdateCurrentProductDisplay(DataStore.EquipmentStatus status, ProductItem pItem, WeightData wData)
{
this.SetProduct(pItem);
this.SetCount(wData);
}
public void UpdateStartWeightDisplay(DataStore.EquipmentStatus status, WeightData data)
{
this.SetCount(data);
}
public void Clear()
{
this.SetCount(this.ParentForm.ParentForm.CurrentWeightData);
}
public void DisplayRefresh(SystemStatus status)
{
this.UpdateDisplayUser(status.CurrentUser);
this.SetProduct(this.ParentForm.ParentForm.CurrentProductItem);
this.SetCount(this.ParentForm.ParentForm.CurrentWeightData);
}
#endregion
}
}