INT_PT002/INT_PT002/Controls/System/ControlMenuSystemStatus.cs

539 lines
23 KiB
C#

using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using SmartX;
using INT_PT002.Forms;
using INT_PT002.DataStore;
namespace INT_PT002.Controls
{
public partial class ControlMenuSystemStatus : UserControl
{
#region Field
private FormMenu m_ParentForm;
private Define.E_ProcessStatus PreviousStageNum;
private Color ColorProgressOn;
private Color ColorProgressOff;
private Color ColorResultPass;
private Color ColorResultNG;
private Color ColorResultNone;
private Collection<SmartLabel> CollectionLabelResult;
private Collection<SmartLabel> CollectionLabelProgress;
private Collection<SmartLabel> CollectionDispRData;
private Collection<SmartLabel> CollectionDispMData;
private Collection<SmartLabel> CollectionDispMDataDiff;
private Collection<SmartLabel> CollectionDispSTD;
private Collection<SmartLabel> CollectionDiffMadc;
private Collection<SmartLabel> CollectionDiffSecDiff;
private Collection<SmartLabel> CollectionDiffSecSum;
private Collection<SmartLabel> CollectionDiffMean;
private Collection<SmartLabel> CollectionPressureWork;
private Collection<SmartLabel> CollectionPressureMaster;
#endregion
#region Constructor
public ControlMenuSystemStatus(FormMenu parent)
{
InitializeComponent();
this.ParentForm = parent;
this.Initialize();
this.InitializeData();
}
#endregion
#region Property
public FormMenu ParentForm
{
get { return this.m_ParentForm; }
private set { this.m_ParentForm = value; }
}
#endregion
#region Method
private void Initialize()
{
this.smartGroupBox1.Text = "System > Equipment";
this.ColorProgressOff = Color.Azure;
this.ColorProgressOn = Color.Lime;
this.ColorResultPass = Color.Green;
this.ColorResultNG = Color.Red;
this.ColorResultNone = Color.Black;
this.CollectionLabelProgress = new Collection<SmartLabel>();
this.CollectionLabelProgress.Clear();
this.CollectionLabelProgress.Add(this.labelProgress0);
this.CollectionLabelProgress.Add(this.labelProgress1);
this.CollectionLabelProgress.Add(this.labelProgress2);
this.CollectionLabelProgress.Add(this.labelProgress3);
this.CollectionLabelProgress.Add(this.labelProgress4);
this.CollectionLabelProgress.Add(this.labelProgress6);
this.CollectionLabelProgress.Add(this.labelProgress7);
this.CollectionLabelProgress.Add(this.labelProgress8);
this.CollectionLabelResult = new Collection<SmartLabel>();
this.CollectionLabelResult.Add(this.labelResult1);
this.CollectionLabelResult.Add(this.labelResult2);
this.CollectionLabelResult.Add(this.labelResult3);
this.CollectionLabelResult.Add(this.labelResult4);
this.CollectionLabelResult.Add(this.labelResult5);
this.CollectionLabelResult.Add(this.labelResult6);
this.CollectionLabelResult.Add(this.labelResult7);
this.CollectionLabelResult.Add(this.labelResult8);
this.CollectionLabelResult.Add(this.labelResult9);
this.CollectionLabelResult.Add(this.labelResult10);
this.CollectionDispRData = new Collection<SmartLabel>();
this.CollectionDispRData.Add(this.labelDispRData1);
this.CollectionDispRData.Add(this.labelDispRData2);
this.CollectionDispRData.Add(this.labelDispRData3);
this.CollectionDispRData.Add(this.labelDispRData4);
this.CollectionDispRData.Add(this.labelDispRData5);
this.CollectionDispRData.Add(this.labelDispRData6);
this.CollectionDispRData.Add(this.labelDispRData7);
this.CollectionDispRData.Add(this.labelDispRData8);
this.CollectionDispRData.Add(this.labelDispRData9);
this.CollectionDispRData.Add(this.labelDispRData10);
this.CollectionDispMData = new Collection<SmartLabel>();
this.CollectionDispMData.Add(this.labelDispMData1);
this.CollectionDispMData.Add(this.labelDispMData2);
this.CollectionDispMData.Add(this.labelDispMData3);
this.CollectionDispMData.Add(this.labelDispMData4);
this.CollectionDispMData.Add(this.labelDispMData5);
this.CollectionDispMData.Add(this.labelDispMData6);
this.CollectionDispMData.Add(this.labelDispMData7);
this.CollectionDispMData.Add(this.labelDispMData8);
this.CollectionDispMData.Add(this.labelDispMData9);
this.CollectionDispMData.Add(this.labelDispMData10);
this.CollectionDispMDataDiff = new Collection<SmartLabel>();
this.CollectionDispMDataDiff.Add(this.labelDispMDataDiff1);
this.CollectionDispMDataDiff.Add(this.labelDispMDataDiff2);
this.CollectionDispMDataDiff.Add(this.labelDispMDataDiff3);
this.CollectionDispMDataDiff.Add(this.labelDispMDataDiff4);
this.CollectionDispMDataDiff.Add(this.labelDispMDataDiff5);
this.CollectionDispMDataDiff.Add(this.labelDispMDataDiff6);
this.CollectionDispMDataDiff.Add(this.labelDispMDataDiff7);
this.CollectionDispMDataDiff.Add(this.labelDispMDataDiff8);
this.CollectionDispMDataDiff.Add(this.labelDispMDataDiff9);
this.CollectionDispMDataDiff.Add(this.labelDispMDataDiff10);
this.CollectionDispSTD = new Collection<SmartLabel>();
this.CollectionDispSTD.Add(this.labelDispSTD1);
this.CollectionDispSTD.Add(this.labelDispSTD2);
this.CollectionDispSTD.Add(this.labelDispSTD3);
this.CollectionDispSTD.Add(this.labelDispSTD4);
this.CollectionDispSTD.Add(this.labelDispSTD5);
this.CollectionDispSTD.Add(this.labelDispSTD6);
this.CollectionDispSTD.Add(this.labelDispSTD7);
this.CollectionDispSTD.Add(this.labelDispSTD8);
this.CollectionDispSTD.Add(this.labelDispSTD9);
this.CollectionDispSTD.Add(this.labelDispSTD10);
this.CollectionDiffMadc = new Collection<SmartLabel>();
this.CollectionDiffMadc.Add(this.labelDiffMadc1);
this.CollectionDiffMadc.Add(this.labelDiffMadc2);
this.CollectionDiffMadc.Add(this.labelDiffMadc3);
this.CollectionDiffMadc.Add(this.labelDiffMadc4);
this.CollectionDiffMadc.Add(this.labelDiffMadc5);
this.CollectionDiffMadc.Add(this.labelDiffMadc6);
this.CollectionDiffMadc.Add(this.labelDiffMadc7);
this.CollectionDiffMadc.Add(this.labelDiffMadc8);
this.CollectionDiffMadc.Add(this.labelDiffMadc9);
this.CollectionDiffMadc.Add(this.labelDiffMadc10);
this.CollectionDiffSecDiff = new Collection<SmartLabel>();
this.CollectionDiffSecDiff.Add(this.labelDiffSecDiff1);
this.CollectionDiffSecDiff.Add(this.labelDiffSecDiff2);
this.CollectionDiffSecDiff.Add(this.labelDiffSecDiff3);
this.CollectionDiffSecDiff.Add(this.labelDiffSecDiff4);
this.CollectionDiffSecDiff.Add(this.labelDiffSecDiff5);
this.CollectionDiffSecDiff.Add(this.labelDiffSecDiff6);
this.CollectionDiffSecDiff.Add(this.labelDiffSecDiff7);
this.CollectionDiffSecDiff.Add(this.labelDiffSecDiff8);
this.CollectionDiffSecDiff.Add(this.labelDiffSecDiff9);
this.CollectionDiffSecDiff.Add(this.labelDiffSecDiff10);
this.CollectionDiffSecSum = new Collection<SmartLabel>();
this.CollectionDiffSecSum.Add(this.labelDiffSecSum1);
this.CollectionDiffSecSum.Add(this.labelDiffSecSum2);
this.CollectionDiffSecSum.Add(this.labelDiffSecSum3);
this.CollectionDiffSecSum.Add(this.labelDiffSecSum4);
this.CollectionDiffSecSum.Add(this.labelDiffSecSum5);
this.CollectionDiffSecSum.Add(this.labelDiffSecSum6);
this.CollectionDiffSecSum.Add(this.labelDiffSecSum7);
this.CollectionDiffSecSum.Add(this.labelDiffSecSum8);
this.CollectionDiffSecSum.Add(this.labelDiffSecSum9);
this.CollectionDiffSecSum.Add(this.labelDiffSecSum10);
this.CollectionDiffMean = new Collection<SmartLabel>();
this.CollectionDiffMean.Add(this.labelDiffMean1);
this.CollectionDiffMean.Add(this.labelDiffMean2);
this.CollectionDiffMean.Add(this.labelDiffMean3);
this.CollectionDiffMean.Add(this.labelDiffMean4);
this.CollectionDiffMean.Add(this.labelDiffMean5);
this.CollectionDiffMean.Add(this.labelDiffMean6);
this.CollectionDiffMean.Add(this.labelDiffMean7);
this.CollectionDiffMean.Add(this.labelDiffMean8);
this.CollectionDiffMean.Add(this.labelDiffMean9);
this.CollectionDiffMean.Add(this.labelDiffMean10);
this.CollectionPressureWork = new Collection<SmartLabel>();
this.CollectionPressureWork.Add(this.labelPressureWork1);
this.CollectionPressureWork.Add(this.labelPressureWork2);
this.CollectionPressureWork.Add(this.labelPressureWork3);
this.CollectionPressureWork.Add(this.labelPressureWork4);
this.CollectionPressureWork.Add(this.labelPressureWork5);
this.CollectionPressureWork.Add(this.labelPressureWork6);
this.CollectionPressureWork.Add(this.labelPressureWork7);
this.CollectionPressureWork.Add(this.labelPressureWork8);
this.CollectionPressureWork.Add(this.labelPressureWork9);
this.CollectionPressureWork.Add(this.labelPressureWork10);
this.CollectionPressureMaster = new Collection<SmartLabel>();
this.CollectionPressureMaster.Add(this.labelPressureMaster1);
this.CollectionPressureMaster.Add(this.labelPressureMaster2);
this.CollectionPressureMaster.Add(this.labelPressureMaster3);
this.CollectionPressureMaster.Add(this.labelPressureMaster4);
this.CollectionPressureMaster.Add(this.labelPressureMaster5);
this.CollectionPressureMaster.Add(this.labelPressureMaster6);
this.CollectionPressureMaster.Add(this.labelPressureMaster7);
this.CollectionPressureMaster.Add(this.labelPressureMaster8);
this.CollectionPressureMaster.Add(this.labelPressureMaster9);
this.CollectionPressureMaster.Add(this.labelPressureMaster10);
}
private void InitializeData()
{
for (int i = 0; i < this.ParentForm.ParentForm.CurrentSystemStatus.EquipmentColumn; i++)
{
this.CollectionLabelResult[i].Text = "-";
this.CollectionLabelResult[i].TextColor = this.ColorResultNone;
this.CollectionDispRData[i].Text = "0.00";
this.CollectionDispMData[i].Text = "0.00";
this.CollectionDispMDataDiff[i].Text = "0.00";
this.CollectionDispSTD[i].Text = "0.00";
this.CollectionDiffMadc[i].Text = "0.00";
this.CollectionDiffSecDiff[i].Text = "0.00";
this.CollectionDiffSecSum[i].Text = "0.00";
this.CollectionDiffMean[i].Text = "0.00";
this.CollectionPressureWork[i].Text = "0.0";
this.CollectionPressureMaster[i].Text = "0.0";
}
}
private void GetJudgmentResult(Define.E_JudgmentStatus judg, SmartLabel label2)
{
string value = "";
switch (judg)
{
case Define.E_JudgmentStatus.None:
value = "-";
label2.TextColor = this.ColorResultNone;
label2.Font = new Font("New Gulim", 20, FontStyle.Bold);
break;
case Define.E_JudgmentStatus.Pass:
value = "Pass";
label2.TextColor = this.ColorResultPass;
label2.Font = new Font("New Gulim", 20, FontStyle.Bold);
break;
case Define.E_JudgmentStatus.Ng:
value = "Leak";
label2.TextColor = this.ColorResultNG;
label2.Font = new Font("New Gulim", 20, FontStyle.Bold);
break;
case Define.E_JudgmentStatus.Error:
value = "Empty";
label2.TextColor = this.ColorResultNone;
label2.Font = new Font("New Gulim", 20, FontStyle.Bold);
break;
default:
break;
}
if (label2.Text != value)
label2.Text = value;
}
private void SelectProcessLabelRefresh(int index)
{
this.CollectionLabelProgress[index].BackGroundColor = this.ColorProgressOn;
}
private void UnselectProcessLabelRefresh(int index)
{
this.CollectionLabelProgress[index].BackGroundColor = this.ColorProgressOff;
}
public void UpdateProcessStatusDisplay(Define.E_ProcessStatus status)
{
switch (this.PreviousStageNum)
{
case Define.E_ProcessStatus._0_None:
break;
case Define.E_ProcessStatus._1_Initial:
this.UnselectProcessLabelRefresh(0);
break;
case Define.E_ProcessStatus._2_ProductEntry:
this.UnselectProcessLabelRefresh(1);
break;
case Define.E_ProcessStatus._3_ChamberConbined:
this.UnselectProcessLabelRefresh(2);
break;
case Define.E_ProcessStatus._4_VacuumStart:
this.UnselectProcessLabelRefresh(3);
break;
case Define.E_ProcessStatus._5_VacuumHold:
this.UnselectProcessLabelRefresh(4);
break;
case Define.E_ProcessStatus._6_Judgment:
break;
case Define.E_ProcessStatus._7_VacuumBreak:
this.UnselectProcessLabelRefresh(5);
break;
case Define.E_ProcessStatus._8_ChamberSeparation:
this.UnselectProcessLabelRefresh(6);
break;
case Define.E_ProcessStatus._9_ProductRelease:
this.UnselectProcessLabelRefresh(7);
break;
default:
break;
}
switch (status)
{
case Define.E_ProcessStatus._0_None:
break;
case Define.E_ProcessStatus._1_Initial:
this.UnselectProcessLabelRefresh(this.CollectionLabelProgress.Count - 1);
this.SelectProcessLabelRefresh(0);
this.timerOn.Stop();
this.timerOff.Stop();
//if (this.CollectionLabelResult[0].Text == "Measuring..")
//{
// for (int i = 0; i < this.ParentForm.ParentForm.CurrentSystemStatus.EquipmentColumn; i++)
// {
// this.CollectionLabelResult[i].Visible = true;
// this.CollectionLabelResult[i].Text = "-";
// this.CollectionLabelResult[i].TextColor = this.ColorResultNone;
// this.CollectionLabelResult[i].Font = new Font("New Gulim", 48, FontStyle.Bold);
// }
//}
break;
case Define.E_ProcessStatus._2_ProductEntry:
this.SelectProcessLabelRefresh(1);
break;
case Define.E_ProcessStatus._3_ChamberConbined:
this.SelectProcessLabelRefresh(2);
break;
case Define.E_ProcessStatus._4_VacuumStart:
this.SelectProcessLabelRefresh(3);
break;
case Define.E_ProcessStatus._5_VacuumHold:
this.SelectProcessLabelRefresh(4);
break;
case Define.E_ProcessStatus._6_Judgment:
break;
case Define.E_ProcessStatus._7_VacuumBreak:
this.SelectProcessLabelRefresh(5);
break;
case Define.E_ProcessStatus._8_ChamberSeparation:
this.SelectProcessLabelRefresh(6);
break;
case Define.E_ProcessStatus._9_ProductRelease:
this.SelectProcessLabelRefresh(7);
break;
default:
break;
}
this.PreviousStageNum = status;
}
private void UpdateDisplayDotGraphDiff(SmartDraw draw, DiffData diff)
{
int iValue = 0;
double dValue = 0.0;
// 값 표시 범위
// 15.000 ~ -2.000 (17.000 ~ 0)
// 그래프 영역 높이 102
// 17000 / 102 = 166.666666~
//dValue = (int.Parse(data.CurrentValueSign + data.CurrentValue) + 2000) / 166.66666;
if (dValue > 110)
dValue = 110;
if (dValue < 1)
dValue = 1;
iValue = int.Parse(string.Format("{0:f0}", dValue));
draw.Chart.PutData(iValue);
}
private void UpdateDisplayDotGraphDisp(SmartDraw draw, DispData disp)
{
int iValue = 0;
double dValue = 0.0;
// 값 표시 범위
// 15.000 ~ -2.000 (17.000 ~ 0)
// 그래프 영역 높이 102
// 17000 / 102 = 166.666666~
//dValue = (int.Parse(data.CurrentValueSign + data.CurrentValue) + 2000) / 166.66666;
if (dValue > 110)
dValue = 110;
if (dValue < 1)
dValue = 1;
iValue = int.Parse(string.Format("{0:f0}", dValue));
draw.Chart.PutData(iValue);
}
public void UpdateEquipmentStatusDisplay(Define.E_EquipmentStatus status)
{
if (status == Define.E_EquipmentStatus.Start)
{
#region Start
//this.labelStart.Visible = true;
//this.labelStop.Visible = false;
#endregion
}
else
{
#region Stop
//this.labelStart.Visible = false;
//this.labelStop.Visible = true;
#endregion
}
}
public void UpdateDisplayDiffData(Collection<DiffData> datas)
{
string value = "";
bool bValue = false;
for (int i = 0; i < this.ParentForm.ParentForm.CurrentSystemStatus.EquipmentColumn; i++)
{
value = datas[i].MAdc;
if (this.CollectionDiffMadc[i].Text != value)
this.CollectionDiffMadc[i].Text = value;
value = datas[i].SecBufDiff;
if (this.CollectionDiffSecDiff[i].Text != value)
this.CollectionDiffSecDiff[i].Text = value;
value = datas[i].SecBufSum;
if (this.CollectionDiffSecSum[i].Text != value)
this.CollectionDiffSecSum[i].Text = value;
value = datas[i].DiffMean;
if (this.CollectionDiffMean[i].Text != value)
this.CollectionDiffMean[i].Text = value;
}
}
public void UpdateDisplayDispData(Collection<DispData> datas)
{
string value = "";
for (int i = 0; i < this.ParentForm.ParentForm.CurrentSystemStatus.EquipmentColumn; i++)
{
value = datas[i].RData;
if (this.CollectionDispRData[i].Text != value)
this.CollectionDispRData[i].Text = value;
value = datas[i].MData;
if (this.CollectionDispMData[i].Text != value)
this.CollectionDispMData[i].Text = value;
value = datas[i].MDataDiff;
if (this.CollectionDispMDataDiff[i].Text != value)
this.CollectionDispMDataDiff[i].Text = value;
value = datas[i].STD;
if (this.CollectionDispSTD[i].Text != value)
this.CollectionDispSTD[i].Text = value;
}
}
public void UpdateDisplayPresData(Collection<PressureData> datas)
{
string value = "";
for (int i = 0; i < this.ParentForm.ParentForm.CurrentSystemStatus.EquipmentColumn; i++)
{
value = datas[i].WorkingChamber;
if (this.CollectionPressureWork[i].Text != value)
this.CollectionPressureWork[i].Text = value;
value = datas[i].MasterChamber;
if (this.CollectionPressureMaster[i].Text != value)
this.CollectionPressureMaster[i].Text = value;
}
}
public void UpdateDisplayAlarmView(AlarmList alarm)
{
}
public void UpdateDisplayJudgmentData(LeakData datas)
{
this.timerOn.Stop();
this.timerOff.Stop();
for (int i = 0; i < this.ParentForm.ParentForm.CurrentSystemStatus.EquipmentColumn; i++)
{
this.GetJudgmentResult(datas.CollJudgment[i], this.CollectionLabelResult[i]);
this.CollectionLabelResult[i].Visible = true;
}
}
public void DisplayRefresh()
{
this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplayMode = Define.E_DisplayModeStore.Equipment;
this.ParentForm.ParentForm.SetDisplayMode(Define.E_EquipmentMode.Normal);
}
#endregion
#region Event Handler
private void buttonInspection_Click(object sender, EventArgs e)
{
this.InitializeData();
this.ParentForm.ParentForm.TransferData(CommunicationCommand.CutInpupt, CommunicationID.MainBoard);
}
private void timerOn_Tick(object sender, EventArgs e)
{
this.timerOn.Stop();
for (int i = 0; i < this.ParentForm.ParentForm.CurrentSystemStatus.EquipmentColumn; i++)
this.CollectionLabelResult[i].Visible = false;
this.timerOff.Start();
}
private void timerOff_Tick(object sender, EventArgs e)
{
this.timerOff.Stop();
for (int i = 0; i < this.ParentForm.ParentForm.CurrentSystemStatus.EquipmentColumn; i++)
this.CollectionLabelResult[i].Visible = true;
this.timerOn.Start();
}
#endregion
}
}