using SA_LTT;
|
using System;
|
using System.Collections.Generic;
|
using System.Text.RegularExpressions;
|
using System.Threading;
|
using System.Windows.Forms;
|
|
namespace SA_LTT_UI.Viewer
|
{
|
public partial class SequenceViewer : Form
|
{
|
MainFrame _mainFrame;
|
|
Queue<string> _processDescriptions = new Queue<string>();
|
|
Thread t_UIUpdate;
|
|
bool updateCheck;
|
|
List<Label> _tmcLabels = new List<Label>();
|
List<Label> _pmcLabels = new List<Label>();
|
List<Label> _measureEnergyLabels = new List<Label>();
|
|
object _queueLock = new object();
|
|
private bool _isShown;
|
protected override CreateParams CreateParams
|
{
|
get
|
{
|
CreateParams MyCp = base.CreateParams;
|
MyCp.ExStyle |= 0x02000000;
|
|
return MyCp;
|
}
|
}
|
|
public SequenceViewer(MainFrame mainFrame)
|
{
|
InitializeComponent();
|
|
_mainFrame = mainFrame;
|
|
InitializeLabels();
|
EquipmentLogManager.Instance.ProcessLogAdded += Instance_ProcessLogAdded;
|
|
t_UIUpdate = new Thread(UIUpdateTh);
|
t_UIUpdate.Start();
|
}
|
|
private void Instance_ProcessLogAdded(string logData)
|
{
|
DateTime dt = DateTime.Now;
|
AddDescription($"{dt.ToString("yyyy/MM/dd HH:mm:ss.fff")} " + logData);
|
}
|
|
private void InitializeLabels()
|
{
|
foreach (Control control in gb_TmcSequence.Controls)
|
{
|
if (control.GetType() == typeof(Label) && control.Name.Contains("Tmc"))
|
{
|
_tmcLabels.Add((Label)control);
|
}
|
}
|
|
Label[] sortedData = SortLabels(_tmcLabels.ToArray());
|
_tmcLabels.Clear();
|
_tmcLabels.AddRange(sortedData);
|
|
foreach(Label label in _tmcLabels)
|
{
|
string str = label.Name;
|
string kk = Regex.Replace(label.Name, @"\D", "");
|
}
|
|
foreach (Control control in gb_PmcSequence.Controls)
|
{
|
if (control.GetType() == typeof(Label) && control.Name.Contains("Pmc"))
|
{
|
_pmcLabels.Add((Label)control);
|
}
|
}
|
|
sortedData = SortLabels(_pmcLabels.ToArray());
|
_pmcLabels.Clear();
|
_pmcLabels.AddRange(sortedData);
|
|
foreach (Label label in _pmcLabels)
|
{
|
string str = label.Name;
|
string kk = Regex.Replace(label.Name, @"\D", "");
|
}
|
|
foreach (Control control in gb_MeasureEnergySequence.Controls)
|
{
|
if (control.GetType() == typeof(Label) && control.Name.Contains("Measure"))
|
{
|
_measureEnergyLabels.Add((Label)control);
|
}
|
}
|
|
sortedData = SortLabels(_measureEnergyLabels.ToArray());
|
_measureEnergyLabels.Clear();
|
_measureEnergyLabels.AddRange(sortedData);
|
|
foreach (Label label in _measureEnergyLabels)
|
{
|
string str = label.Name;
|
string kk = Regex.Replace(label.Name, @"\D", "");
|
}
|
}
|
|
private Label[] SortLabels(Label[] labels)
|
{
|
Label[] sortedLabel = new Label[labels.Length];
|
|
for(int i = 0; i < labels.Length; i++)
|
{
|
int location = 0;
|
|
for(int j = 0; j < labels.Length; j++)
|
{
|
int valueI = int.Parse(Regex.Replace(labels[i].Name, @"\D", ""));
|
int valueJ = int.Parse(Regex.Replace(labels[j].Name, @"\D", ""));
|
|
if(valueJ < valueI)
|
{
|
location++;
|
}
|
}
|
|
sortedLabel[location] = labels[i];
|
}
|
|
foreach(Label l in sortedLabel)
|
{
|
string str = l.Name;
|
}
|
|
return sortedLabel;
|
}
|
|
private void UIUpdateTh()
|
{
|
while (_mainFrame.equipment.IsDisposed == false)
|
{
|
Thread.Sleep(100);
|
|
if (updateCheck == false)
|
{
|
updateCheck = true;
|
UIUpdate();
|
}
|
}
|
}
|
|
private void UIUpdate()
|
{
|
if (InvokeRequired)
|
{
|
BeginInvoke(new UIUpdateDelegate(UIUpdate));
|
return;
|
}
|
else
|
{
|
try
|
{
|
UpdateDescription();
|
|
if (Visible)
|
{
|
UpdateTmcSequence();
|
UpdatePmcSequence();
|
UpdateMeasureEnergySequence();
|
}
|
}
|
catch (Exception e)
|
{
|
EquipmentLogManager.Instance.WriteExceptionLog(e.StackTrace);
|
}
|
finally
|
{
|
updateCheck = false;
|
}
|
}
|
}
|
|
private void UpdateDescription()
|
{
|
if (_processDescriptions.Count > 0)
|
{
|
lock (_queueLock)
|
{
|
if(_isShown)
|
{
|
string description = _processDescriptions.Dequeue();
|
|
tb_Description.AppendText(description + "\r\n");
|
}
|
}
|
}
|
}
|
|
private void AddDescription(string description)
|
{
|
lock(_queueLock)
|
{
|
_processDescriptions.Enqueue(description);
|
}
|
}
|
|
private void UpdateTmcSequence()
|
{
|
int i = 0;
|
int endCount = 0;
|
|
if(_mainFrame.equipment.TmcStep <= Sequence.TmcSteps.Wait)
|
{
|
|
}
|
else if (_mainFrame.equipment.TmcStep <= Sequence.TmcSteps.ProcessDataCheck)
|
{
|
endCount = 1;
|
}
|
else if (_mainFrame.equipment.TmcStep <= Sequence.TmcSteps.CheckGetLoadPort)
|
{
|
endCount = 2;
|
}
|
else if (_mainFrame.equipment.TmcStep <= Sequence.TmcSteps.CheckBeforePutPreAlignerFlip)
|
{
|
endCount = 3;
|
}
|
else if (_mainFrame.equipment.TmcStep <= Sequence.TmcSteps.BeforeAlignWait)
|
{
|
endCount = 4;
|
}
|
else if (_mainFrame.equipment.TmcStep <= Sequence.TmcSteps.CheckBeforeGetPreAligner)
|
{
|
endCount = 5;
|
}
|
else if (_mainFrame.equipment.TmcStep <= Sequence.TmcSteps.ChamberStatusCheck)
|
{
|
endCount = 6;
|
}
|
else if (_mainFrame.equipment.TmcStep <= Sequence.TmcSteps.CheckPutChamber)
|
{
|
endCount = 7;
|
}
|
else if (_mainFrame.equipment.TmcStep <= Sequence.TmcSteps.MeltingWait)
|
{
|
endCount = 8;
|
}
|
else if (_mainFrame.equipment.TmcStep <= Sequence.TmcSteps.CheckGetChamber)
|
{
|
endCount = 9;
|
}
|
else if (_mainFrame.equipment.TmcStep <= Sequence.TmcSteps.CheckAfterPutPreAlignerFlip)
|
{
|
endCount = 10;
|
}
|
else if (_mainFrame.equipment.TmcStep <= Sequence.TmcSteps.AfterAlignWait)
|
{
|
endCount = 11;
|
}
|
else if (_mainFrame.equipment.TmcStep <= Sequence.TmcSteps.CheckAfterGetPreAligner)
|
{
|
endCount = 12;
|
}
|
else if (_mainFrame.equipment.TmcStep <= Sequence.TmcSteps.CheckPutLoadPort)
|
{
|
endCount = 13;
|
}
|
|
for (i = 0; i < endCount; i++)
|
{
|
_tmcLabels[i].BackColor = System.Drawing.Color.Lime;
|
}
|
|
for (; i < _tmcLabels.Count; i++)
|
{
|
_tmcLabels[i].BackColor = System.Drawing.Color.Green;
|
}
|
}
|
|
private void UpdatePmcSequence()
|
{
|
int i = 0;
|
int endCount = 0;
|
|
if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.Wait)
|
{
|
|
}
|
else if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.WaferPutWait)
|
{
|
endCount = 1;
|
}
|
else if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.BeforeVacuumOn)
|
{
|
endCount = 2;
|
}
|
else if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.BeforePinDown)
|
{
|
endCount = 3;
|
}
|
else if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.BeforeGateClose)
|
{
|
endCount = 4;
|
}
|
else if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.CheckCenterPosition)
|
{
|
endCount = 5;
|
}
|
else if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.GetRecipeData)
|
{
|
endCount = 6;
|
}
|
else if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.CoordTransform)
|
{
|
endCount = 7;
|
}
|
else if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.CheckAttenuator)
|
{
|
endCount = 8;
|
}
|
else if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.ProcessEnd)
|
{
|
endCount = 9;
|
}
|
else if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.CheckAfterLoadPosition)
|
{
|
endCount = 10;
|
}
|
else if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.AfterGateOpen)
|
{
|
endCount = 11;
|
}
|
else if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.AfterVacuumOff)
|
{
|
endCount = 12;
|
}
|
else if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.AfterPinUp)
|
{
|
endCount = 13;
|
}
|
|
for (i = 0; i < endCount; i++)
|
{
|
if (_mainFrame.equipment.modeParameterManager.ModeParameter.EnergyMeasurementUse == false && i == 7)
|
{
|
_pmcLabels[i].BackColor = System.Drawing.Color.Green;
|
}
|
else
|
{
|
_pmcLabels[i].BackColor = System.Drawing.Color.Lime;
|
}
|
}
|
|
for (; i < _pmcLabels.Count; i++)
|
{
|
_pmcLabels[i].BackColor = System.Drawing.Color.Green;
|
}
|
}
|
|
private void UpdateMeasureEnergySequence()
|
{
|
int i = 0;
|
int endCount = 0;
|
|
if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.MovePowerMeterPosition)
|
{
|
|
}
|
else if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.CheckPowerMeterPosition)
|
{
|
endCount = 1;
|
}
|
else if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.CalDataCheckAttenuator)
|
{
|
endCount = 2;
|
}
|
else if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.MeasurementEnd)
|
{
|
endCount = 3;
|
}
|
else if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.MeasurrmentDataCheck)
|
{
|
endCount = 4;
|
}
|
else if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.CheckAttenuator)
|
{
|
endCount = 5;
|
}
|
else if (_mainFrame.equipment.PmcStep <= Sequence.PmcSteps.End)
|
{
|
endCount = 5;
|
}
|
|
if (_mainFrame.equipment.modeParameterManager.ModeParameter.EnergyMeasurementUse == false)
|
{
|
endCount = 0;
|
}
|
|
for (i = 0; i < endCount; i++)
|
{
|
_measureEnergyLabels[i].BackColor = System.Drawing.Color.Lime;
|
}
|
|
for (; i < _measureEnergyLabels.Count; i++)
|
{
|
_measureEnergyLabels[i].BackColor = System.Drawing.Color.Green;
|
}
|
}
|
|
private void btn_Close_Click(object sender, EventArgs e)
|
{
|
this.Hide();
|
}
|
|
private void SequenceViewer_FormClosing(object sender, FormClosingEventArgs e)
|
{
|
e.Cancel = true;
|
this.Hide();
|
}
|
|
private void btn_Clear_Click(object sender, EventArgs e)
|
{
|
tb_Description.Text = string.Empty;
|
}
|
|
private void SequenceViewer_Shown(object sender, EventArgs e)
|
{
|
_isShown = true;
|
}
|
}
|
}
|