using DIT.SharedMemory;
using log4net;
using System;
using System.Threading;
using System.Windows.Forms;
namespace SHARP_CLAS_UI
{
public partial class Form_Sequence_Viewer : Form
{
#region Enum
#endregion
#region Logger
///
/// Exception Log
///
private ILog ExceptionLog = LogManager.GetLogger("SHARP_CLAS_SEQUENCE_Exception");
///
/// Exception Log Write
///
/// Method name of exception that occurred
/// exception
public void WriteExceptionLog(string msg)
{
if (ExceptionLog != null) ExceptionLog.Debug(msg);
}
#endregion
#region Field
private delegate void UI_Update_Delegate();
private Thread UI_Update_Th;
Form_Frame _Parent;
bool update_check;
#endregion
#region Construct
public Form_Sequence_Viewer(Form_Frame _Parent)
{
InitializeComponent();
this._Parent = _Parent;
rb_Pause.Checked = true;
UI_Update_Th = new Thread(UI_Update_Th_Set);
UI_Update_Th.Start();
}
#endregion
#region Form Function
private void rb_Auto_CheckedChanged(object sender, EventArgs e)
{
RadioButton rb = (RadioButton)sender;
if (!rb.Checked) return;
switch (rb.Name)
{
case "rb_Auto":
{
_Parent._equip.Set_Equipment_Mode(En_Equipment_Mode.Auto);
break;
}
case "rb_Manual":
{
_Parent._equip.Set_Equipment_Mode(En_Equipment_Mode.Manual);
break;
}
case "rb_Pause":
{
_Parent._equip.Set_Equipment_Mode(En_Equipment_Mode.Pause);
break;
}
}
}
private void button1_Click(object sender, EventArgs e)
{
_Parent.sm.Set_Value(Process_Memory_Address.LD_Tray_In_Count, 0);
_Parent.sm.Set_Value(Process_Memory_Address.LD_Tray_Empty_Count, 0);
_Parent.sm.Set_Value(Process_Memory_Address.ULD_Tray_Empty_Count, 0);
_Parent.sm.Set_Value(Process_Memory_Address.ULD_Tray_Ok_Count, 0);
_Parent.sm.Set_Value(Process_Memory_Address.ULD_Tray_Ng_Count, 0);
//form.Set_Init();
//form.ShowDialog();
}
private void btn_LD_Conveyor_In_Load_Click(object sender, EventArgs e)
{
if (_Parent._equip.loader.ConveyorIn.Step == ConveyorInSteps.S0000_WAIT)
{
_Parent._equip.loader.ConveyorIn.Load();
}
}
private void btn_LD_Conveyor_In_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.loader.ConveyorIn.Init_Seq();
}
private void btn_LD_Tray_In_Load_Click(object sender, EventArgs e)
{
if (_Parent._equip.loader.LiftIn.Step == LiftInSteps.S0000_WAIT)
_Parent._equip.loader.LiftIn.Step = LiftInSteps.S1000_LIFT_LOAD_START;
}
private void btn_LD_Tray_In_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.loader.LiftIn.Init_Seq();
}
private void btn_LD_Tray_Empty_Start_Click(object sender, EventArgs e)
{
if (_Parent._equip.loader.LiftOut.Step == LiftOutSteps.S0000_WAIT)
_Parent._equip.loader.LiftOut.Step = LiftOutSteps.S1000_LIFT_MOVE_START;
}
private void btn_LD_Tray_Empty_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.loader.LiftOut.Init_Seq();
}
private void btn_LD_Tray_TR_Init_Click(object sender, EventArgs e)
{
if (_Parent._equip.loader.TrayTransfer.Step == TrayTransferSteps.S0000_WAIT)
_Parent._equip.loader.TrayTransfer.Step = TrayTransferSteps.S1000_MOVE_STAY_POSITION_START;
}
private void btn_LD_Tray_TR_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.loader.TrayTransfer.Init_Seq();
}
private void btn_LD_Handler_1_Init_Click(object sender, EventArgs e)
{
if (_Parent._equip.loader.Handler1.Step == LoaderHandler1Steps.S0000_WAIT)
_Parent._equip.loader.Handler1.Step = LoaderHandler1Steps.S1000_MOVE_STAY_POSITION_START;
}
private void btn_LD_Handler_1_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.loader.Handler1.Init_Seq();
}
private void btn_LD_Reverse_Init_Click(object sender, EventArgs e)
{
if (_Parent._equip.before.ReverseStage.Step == LoaderReverseStageSteps.S0000_WAIT)
_Parent._equip.before.ReverseStage.Step = LoaderReverseStageSteps.S1000_PANEL_LOAD_START;
}
private void btn_LD_Reverse_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.before.ReverseStage.Init_Seq();
}
private void btn_LD_Handler_2_Init_Click(object sender, EventArgs e)
{
//if (_Parent._equip.before.Handler2.Step == LoaderHandler2Steps.S0000_WAIT)
// _Parent._equip.before.Handler2.Step = LoaderHandler2Steps.S1000_MOVE_STAY_POSITION_START;
}
private void btn_LD_Handler_2_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.before.Handler2.Init_Seq();
}
private void btn_Pre_Align_Init_Click(object sender, EventArgs e)
{
_Parent._equip.before.PreAlignStage.Step = PreAlignSteps.S0000_WAIT;
}
private void btn_Pre_Align_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.before.PreAlignStage.Init_Seq();
}
private void btn_Ablation_Stage_1_Init_Click(object sender, EventArgs e)
{
if (_Parent._equip.process.ablation_stage_1.Step == AblationStageSteps.S0000_WAIT)
_Parent._equip.process.ablation_stage_1.Step = AblationStageSteps.S1000_PANEL_LOAD_START;
}
private void btn_Ablation_Stage_1_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.process.ablation_stage_1.Init_Seq();
}
private void btn_Ablation_Stage_2_Init_Click(object sender, EventArgs e)
{
if (_Parent._equip.process.ablation_stage_2.Step == AblationStageSteps.S0000_WAIT)
_Parent._equip.process.ablation_stage_2.Step = AblationStageSteps.S1000_PANEL_LOAD_START;
}
private void btn_Ablation_Stage_2_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.process.ablation_stage_2.Init_Seq();
}
private void btn_ULD_Reverse_Init_Click(object sender, EventArgs e)
{
if (_Parent._equip.after.ReverseStage.Step == UnloaderReverseStageSteps.S0000_WAIT)
_Parent._equip.after.ReverseStage.Step = UnloaderReverseStageSteps.S2000_PANEL_UNLOAD_START;
}
private void btn_ULD_Reverse_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.after.ReverseStage.Init_Seq();
}
private void btn_ULD_Handler_2_Init_Click(object sender, EventArgs e)
{
if (_Parent._equip.after.Handler2.Step == UnloaderHandler2Steps.S0000_WAIT)
_Parent._equip.after.Handler2.Step = UnloaderHandler2Steps.S1000_MOVE_STAY_POSITION_START;
}
private void btn_ULD_Handler_2_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.after.Handler2.Init_Seq();
}
private void btn_AOI_Init_Click(object sender, EventArgs e)
{
if (_Parent._equip.after.AoiStage.Step == AoiStageSteps.S0000_WAIT)
_Parent._equip.after.AoiStage.Step = AoiStageSteps.S3000_PANEL_UNLOAD_START;
}
private void btn_AOI_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.after.AoiStage.Init_Seq();
}
private void btn_ULD_Conveyor_Empty_Load_Click(object sender, EventArgs e)
{
if (_Parent._equip.unloader.ConveyorIn.Step == ConveyorInSteps.S0000_WAIT)
{
_Parent._equip.unloader.ConveyorIn.Load();
}
}
private void btn_ULD_Conveyor_Empty_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.unloader.ConveyorIn.Init_Seq();
}
private void btn_ULD_Tray_Empty_Load_Click(object sender, EventArgs e)
{
if (_Parent._equip.unloader.LiftIn.Step == LiftInSteps.S0000_WAIT)
_Parent._equip.unloader.LiftIn.Step = LiftInSteps.S1000_LIFT_LOAD_START;
}
private void btn_ULD_Tray_Empty_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.unloader.LiftIn.Init_Seq();
}
private void btn_ULD_Tray_Ok_Load_Click(object sender, EventArgs e)
{
if (_Parent._equip.unloader.LiftOk.Step == LiftOutSteps.S0000_WAIT)
_Parent._equip.unloader.LiftOk.Step = LiftOutSteps.S1000_LIFT_MOVE_START;
}
private void btn_ULD_Tray_Ok_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.unloader.LiftOk.Init_Seq();
}
private void btn_ULD_Tray_Ng_Load_Click(object sender, EventArgs e)
{
if (_Parent._equip.unloader.LiftNg.Step == LiftOutSteps.S0000_WAIT)
_Parent._equip.unloader.LiftNg.Step = LiftOutSteps.S1000_LIFT_MOVE_START;
}
private void btn_ULD_Tray_Ng_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.unloader.LiftNg.Init_Seq();
}
private void btn_ULD_Tray_TR_Init_Click(object sender, EventArgs e)
{
if (_Parent._equip.unloader.TrayTransfer.Step == TrayTransferSteps.S0000_WAIT)
_Parent._equip.unloader.TrayTransfer.Step = TrayTransferSteps.S1000_MOVE_STAY_POSITION_START;
}
private void btn_ULD_Tray_TR_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.unloader.TrayTransfer.Init_Seq();
}
private void btn_ULD_Handler_1_Init_Click(object sender, EventArgs e)
{
if (_Parent._equip.unloader.Handler1.Step == UnloaderHandler1Steps.S0000_WAIT)
_Parent._equip.unloader.Handler1.Step = UnloaderHandler1Steps.S1000_MOVE_TO_STAY_START;
}
private void btn_ULD_Handler_1_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.unloader.Handler1.Init_Seq();
}
private void btn_Vision_Click(object sender, EventArgs e)
{
}
private void btn_Fine_Align_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.process.fine_align.Step = FineAlignSteps.S0000_WAIT;
}
private void btn_Scanner_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.process.ablation.Step = AblationSteps.S0000_WAIT;
}
private void btn_Plasma_Stop_Click(object sender, EventArgs e)
{
_Parent._equip.process.plasma.Step = PlasmaStpes.S0000_WAIT;
}
#endregion
#region Function
public void MessageBoxShow(string msg)
{
MessageBox.Show(msg);
}
private void UI_Update_Th_Set()
{
while (!_Parent.IsDisposed)
{
Thread.Sleep(100);
if (!update_check)
{
update_check = true;
UI_Update();
}
}
}
private void UI_Update()
{
if (InvokeRequired)
{
BeginInvoke(new UI_Update_Delegate(UI_Update));
return;
}
else
{
try
{
tb_Board_Status.Text = _Parent._equip.Board_Control.BoardMode.ToString();
tb_Ld_Tray_Id.Text = _Parent._equip.loader.LiftIn.TrayID;
object value;
if (_Parent.sm.Get_Value(Process_Memory_Address.ULD_Tray_Ok_ID, out value))
tb_Uld_Tray_Ok_Id.Text = value.ToString();
tb_Uld_Tray_Ng_Id.Text = _Parent._equip.unloader.LiftNg.TrayID;
Update_Load_Sequence_UI();
Update_Befor_Sequence_UI();
Update_After_Sequence_UI();
}
catch (Exception ex)
{
}
finally
{
update_check = false;
}
}
}
private void Update_Load_Sequence_UI()
{
if (_Parent._equip.Cur_Main_Recipe == null || _Parent._equip.Cur_Main_Recipe.tray_info == null)
tb_Tray_Info_Name.Text = "";
else
tb_Tray_Info_Name.Text = _Parent._equip.Cur_Main_Recipe.tray_info.Name;
if (_Parent._equip.Cur_Main_Recipe == null || _Parent._equip.Cur_Main_Recipe.vision_info == null)
tb_Vision_Info_Name.Text = "";
else
tb_Vision_Info_Name.Text = _Parent._equip.Cur_Main_Recipe.vision_info.Name;
if (_Parent._equip.Cur_Main_Recipe == null || _Parent._equip.Cur_Main_Recipe.process_info == null)
tb_Process_Info_Name.Text = "";
else
tb_Process_Info_Name.Text = _Parent._equip.Cur_Main_Recipe.process_info.Name;
tb_LD_Tray_In_Tray_Cur_Count.Text = _Parent._equip.LoaderInTrayCount.ToString();
tb_LD_Tray_Empty_Tray_Cur_Count.Text = _Parent._equip.LoaderOutTrayCount.ToString();
tb_ULD_Tray_Ok_Tray_Cur_Count.Text = _Parent._equip.UnloaderOkTrayCount.ToString();
tb_ULD_Tray_Ng_Tray_Cur_Count.Text = _Parent._equip.UnloaderNgTrayCount.ToString();
tb_ULD_Tray_Empty_Tray_Cur_Count.Text = _Parent._equip.UnloaderInTrayCount.ToString();
if (_Parent._equip.Cur_Main_Recipe != null && _Parent._equip.Cur_Main_Recipe.tray_info != null)
{
tb_LD_Tray_In_Tray_Count.Text = _Parent._equip.Cur_Main_Recipe.tray_info.LD_Tray_In_Tray_Count.ToString();
tb_LD_Tray_Empty_Tray_Count.Text = _Parent._equip.Cur_Main_Recipe.tray_info.LD_Tray_Empty_Tray_Count.ToString();
tb_ULD_Tray_Ok_Tray_Count.Text = _Parent._equip.Cur_Main_Recipe.tray_info.ULD_Tray_Ok_Tray_Count.ToString();
tb_ULD_Tray_Ng_Tray_Count.Text = _Parent._equip.Cur_Main_Recipe.tray_info.ULD_Tray_Ng_Tray_Count.ToString();
tb_ULD_Tray_Empty_Tray_Count.Text = _Parent._equip.Cur_Main_Recipe.tray_info.ULD_Tray_Empty_Tray_Count.ToString();
}
tb_LD_Tray_In_Conveyor_Seq.Text = _Parent._equip.loader.ConveyorIn.Step.ToString();
tb_LD_Tray_In_Lift_Up_Seq.Text = _Parent._equip.loader.LiftIn.Step.ToString();
tb_LD_Tray_Empty_Seq.Text = _Parent._equip.loader.LiftOut.Step.ToString();
tb_LD_Tray_TR_Seq.Text = _Parent._equip.loader.TrayTransfer.Step.ToString();
tb_LD_Handler_1_Seq.Text = _Parent._equip.loader.Handler1.Step.ToString();
tb_LD_Reverse_Stage_Seq.Text = _Parent._equip.before.ReverseStage.Step.ToString();
tb_Pre_Align_Stage_Seq.Text = _Parent._equip.before.PreAlignStage.Step.ToString();
tb_LD_Handler_2_Seq.Text = _Parent._equip.before.Handler2.Step.ToString();
tb_Ablation_Stage_1_Seq.Text = _Parent._equip.process.ablation_stage_1.Step.ToString();
tb_Ablation_Stage_2_Seq.Text = _Parent._equip.process.ablation_stage_2.Step.ToString();
tb_Fine_Align_Seq.Text = _Parent._equip.process.fine_align.Step.ToString();
tb_Scanner_Seq.Text = _Parent._equip.process.ablation.Step.ToString();
tb_Plasma_Seq.Text = _Parent._equip.process.plasma.Step.ToString();
tb_ULD_Reverse_Stage_Seq.Text = _Parent._equip.after.ReverseStage.Step.ToString();
tb_AOI_Stage_Seq.Text = _Parent._equip.after.AoiStage.Step.ToString();
tb_ULD_Handler_2_Seq.Text = _Parent._equip.after.Handler2.Step.ToString();
tb_ULD_Tray_Empty_Conveyor_Seq.Text = _Parent._equip.unloader.ConveyorIn.Step.ToString();
tb_ULD_Tray_Empty_Seq .Text = _Parent._equip.unloader.LiftIn.Step.ToString();
tb_ULD_Tray_Ok_Seq.Text = _Parent._equip.unloader.LiftOk.Step.ToString();
tb_ULD_Tray_Ng_Seq.Text = _Parent._equip.unloader.LiftNg.Step.ToString();
tb_ULD_Tray_TR_Seq.Text = _Parent._equip.unloader.TrayTransfer.Step.ToString();
tb_ULD_Handler_1_Seq.Text = _Parent._equip.unloader.Handler1.Step.ToString();
}
private void Update_Befor_Sequence_UI()
{
}
private void Update_After_Sequence_UI()
{
}
#endregion
private void Form_Sequence_Viewer_FormClosing(object sender, FormClosingEventArgs e)
{
if (!_Parent.IsDisposed)
{
e.Cancel = true;
this.Hide();
}
}
}
}