using System; using System.Windows.Forms; namespace SHARP_CLAS_UI { public class Fine_Align : FineAlignUnit { #region Enum #endregion #region Property public override bool IsWorkEnd { get { if (Step == FineAlignSteps.S0000_WAIT) { return true; } else { return false; } } } public override bool IsStayPosition { get { return true; } } public FineAlignSteps Step { get { return _step; } set { _step = value; } } #endregion #region Field private FineAlignSteps _step; private FineAlignSteps _oldStep; public FineAignHomeSteps _homeStep; Tray_QR_Code_Command qr_code_user_command; Tray_QR_Code_Command cim_user_command; bool qr_code_user_command_show; bool cim_user_command_show; int Bcr_retry_cnt; int cim_retry_cnt; private Timer tmrUi = new Timer(); System.Threading.Thread BCR_Read_Th; string Left_BCR_Data; string Right_BCR_Data; readonly int cim_retry = 3; #endregion #region Construct public Fine_Align(Equipment equipment) : base(equipment, MotorAxis.Fine_Align_X) { Step = FineAlignSteps.S0000_WAIT; _oldStep = FineAlignSteps.S0000_WAIT; MotorX.Check_Jog_Interlock = Jog_Interlock; MotorX.Check_Move_Interlock = Move_Interlock; pauseDisableList.Add(FineAlignSteps.S1105_POSITION_CHECK); pauseDisableList.Add(FineAlignSteps.S2105_POSITION_CHECK); pauseDisableList.Add(FineAlignSteps.S3105_POSITION_CHECK); pauseDisableList.Add(FineAlignSteps.S4105_POSITION_CHECK); pauseDisableList.Add(FineAlignSteps.S5105_POSITION_CHECK); pauseDisableList.Add(FineAlignSteps.S6105_POSITION_CHECK); tmrUi.Tick += TmrUi_Tick; tmrUi.Interval = 5000; tmrUi.Start(); } #endregion #region Function private bool Move_Interlock() { if (equipment.User.Level != En_User_Level.Master && equipment.Door_Opened) { return true; } return false; } private bool Jog_Interlock(bool positive) { if (equipment.User.Level != En_User_Level.Master && equipment.Door_Opened) { return true; } return false; } private void TmrUi_Tick(object sender, EventArgs e) { if (qr_code_user_command_show && qr_code_user_command != null) { qr_code_user_command.Show(); qr_code_user_command_show = false; } if(cim_user_command_show && cim_user_command != null) { cim_user_command.Show(); cim_user_command_show = false; } } public void Init_Seq() { Step = FineAlignSteps.S0000_WAIT; _homeStep = FineAignHomeSteps.S0000_WAIT; } public void ExecuteAuto() { } public override void MonitoringStatus() { if (equipment.User.Level != En_User_Level.Master && equipment.Door_Opened) { if (MotorX.MotionComplete == false) { MotorX.Move_Stop(); } } } public override void ExecuteStep() { if (_oldStep != Step) { sequenceChangedTime.Restart(); _oldStep = Step; WriteSequenceLog(Step.ToString()); } if (UnitMode == En_Equipment_Mode.Stop) { Init_Seq(); isHomeComplete = false; return; } else if (UnitMode == En_Equipment_Mode.Pause) { sequenceChangedTime.Stop(); return; } else if (UnitMode == En_Equipment_Mode.Home) { if (IsHomeComplete == false) { ExecuteHome(); } return; } else if (UnitMode == En_Equipment_Mode.Auto || UnitMode == En_Equipment_Mode.Manual) { sequenceChangedTime.Start(); if (equipment.equip_mode == En_Equipment_Mode.Pause) { if (pauseDisableList.Contains(Step) == false) { UnitMode = En_Equipment_Mode.Pause; return; } } if (UnitMode == En_Equipment_Mode.Auto) ExecuteAuto(); Seq_ReadPanelIdAblationStage1(); Seq_FineAlignLeftAblationStage1(); Seq_FineAlignRightAblationStage1(); Seq_ReadPanelIdAblationStage2(); Seq_FineAlignLeftAblationStage2(); Seq_FineAlignRightAblationStage2(); } } public void ExecuteHome() { switch(_homeStep) { case FineAignHomeSteps.S0000_WAIT: { _homeStep = FineAignHomeSteps.S1000_STATUS_CHECK; break; } case FineAignHomeSteps.S1000_STATUS_CHECK: { if (MotorX.ErrorStop) { Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0311_FINE_ALIGN_X_ERROR_STOP); } else if (!MotorX.PowerOn) { Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0310_FINE_ALIGN_X_POWER_OFF); } else { _homeStep = FineAignHomeSteps.S2000_X_HOME_START; } break; } case FineAignHomeSteps.S2000_X_HOME_START: { if(MotorX.Home()) { homeCheckedTime.Restart(); _homeStep = FineAignHomeSteps.S2100_X_HOME_CHECK; } break; } case FineAignHomeSteps.S2100_X_HOME_CHECK: { if (homeCheckedTime.Seconds < 1) return; if (!MotorX.IsHomed) { if (MotorX.Homing == false && MotorX.ErrorStop) { Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0311_FINE_ALIGN_X_ERROR_STOP); } } else { _homeStep = FineAignHomeSteps.S9999_END; } break; } case FineAignHomeSteps.S9999_END: { isHomeComplete = true; _homeStep = FineAignHomeSteps.S0000_WAIT; break; } } } private void Seq_ReadPanelIdAblationStage1() { switch (Step) { case FineAlignSteps.S1000_ABLATION_STAGE_1_PANEL_ID_READ_START: { Step = FineAlignSteps.S1100_MOVE_BCR_POSITION; break; } case FineAlignSteps.S1100_MOVE_BCR_POSITION: { if (MotorX.Move_Absolute_Pos(equipment.Cur_Main_Recipe.vision_info.Ablation_MCR_1_X, 500)) Step = FineAlignSteps.S1105_POSITION_CHECK; break; } case FineAlignSteps.S1105_POSITION_CHECK: { if (MotorX.MotionComplete) { if (MotorX.Is_Inposition(equipment.Cur_Main_Recipe.vision_info.Ablation_MCR_1_X, equipment.Setting.Inposition_Offset)) { Bcr_retry_cnt = 0; Step = FineAlignSteps.S1110_ABLATION_STAGE_1_POSITION_CHECK; } else { Step = FineAlignSteps.S1100_MOVE_BCR_POSITION; } } break; } case FineAlignSteps.S1110_ABLATION_STAGE_1_POSITION_CHECK: { if (equipment.process.ablation_stage_1.MotorY.Is_Inposition(equipment.Cur_Main_Recipe.vision_info.Ablation_MCR_1_Y, equipment.Setting.Inposition_Offset)) { if(equipment.process.ablation_stage_1.IsExist) { if (equipment.process.ablation_stage_1.Stage1.IsExist) { Step = FineAlignSteps.S1200_LEFT_BCR_DATA_READ; } else if(equipment.process.ablation_stage_1.Stage2.IsExist) { Step = FineAlignSteps.S1400_RIGHT_BCR_DATA_READ; } } else { Step = FineAlignSteps.S1999_ABLATION_STAGE_1_PANEL_ID_READ_END; } } break; } case FineAlignSteps.S1200_LEFT_BCR_DATA_READ: { if (equipment.process.ablation_stage_1.Stage1.IsExist == false) { Step = FineAlignSteps.S1400_RIGHT_BCR_DATA_READ; } else { BCR_Read_Th = new System.Threading.Thread(() => Left_BCR_Read()); BCR_Read_Th.Start(); Step = FineAlignSteps.S1205_BCR_DATA_READ_WAIT; } break; } case FineAlignSteps.S1205_BCR_DATA_READ_WAIT: { if (BCR_Read_Th != null && BCR_Read_Th.ThreadState != System.Threading.ThreadState.Stopped) return; if (Left_BCR_Data != null && Left_BCR_Data.Length == 15) { Panel_Info panel = equipment.process.ablation_stage_1.Panel1; panel.Panel_ID = Left_BCR_Data; panel.IsPanelIdRead = true; panel.IsPanelIdReadWorked = true; equipment.process.ablation_stage_1.Panel1 = panel; Bcr_retry_cnt = 0; if (equipment.cim_mode == En_Cim_Mode.Online) { cim_retry_cnt = 0; Step = FineAlignSteps.S1210_BCR_CIM_SEND; } else { Step = FineAlignSteps.S1400_RIGHT_BCR_DATA_READ; } } else { if (Bcr_retry_cnt > equipment.Setting.Bcr_Retry_Count) { Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0861_STAGE_1_LEFT_PANEL_ID_READ_ERROR); Step = FineAlignSteps.S1300_BCR_USER_COMMAND_START; } else { Bcr_retry_cnt++; Step = FineAlignSteps.S1200_LEFT_BCR_DATA_READ; } } break; } case FineAlignSteps.S1210_BCR_CIM_SEND: { if (equipment.cim_client.Send_Panel_In_Check("E000000", Left_BCR_Data)) { Step = FineAlignSteps.S1215_BCR_CIM_WAIT; } break; } case FineAlignSteps.S1215_BCR_CIM_WAIT: { if (equipment.cim_mode != En_Cim_Mode.Online) { Step = FineAlignSteps.S1400_RIGHT_BCR_DATA_READ; } else { if (equipment.cim_client.Get_Command_Ack(En_Cim_Command.INCRQ) && equipment.cim_client.Get_Command_Result(En_Cim_Command.INCRQ)) { Step = FineAlignSteps.S1220_CIM_SERVER_RESULT_CHECK; } else if(sequenceChangedTime.Seconds > 10) { if (cim_retry_cnt <= cim_retry) { cim_retry_cnt++; Step = FineAlignSteps.S1210_BCR_CIM_SEND; } else { Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0920_CIM_COMMUNICATION_ERROR); cim_user_command = new Tray_QR_Code_Command("Ablation #1 Left Panel in Check Fail."); cim_user_command_show = true; Step = FineAlignSteps.S1230_BCR_CIM_COMMAND_CHECK; } } } break; } case FineAlignSteps.S1220_CIM_SERVER_RESULT_CHECK: { if (equipment.cim_mode != En_Cim_Mode.Online) { Step = FineAlignSteps.S1400_RIGHT_BCR_DATA_READ; } else { if (equipment.cim_server.Get_Command_Ack(En_Cim_Command.INCRT)) { if (equipment.cim_server.Get_Command_Result(En_Cim_Command.INCRT) && Left_BCR_Data == equipment.cim_server.Panel_ID) { Step = FineAlignSteps.S1400_RIGHT_BCR_DATA_READ; } else { Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0963_ABLATION_STAGE_1_1_PANEL_ID_MISS_MATCH_ERROR); cim_user_command = new Tray_QR_Code_Command("Ablation #1 Left Panel is NG."); cim_user_command_show = true; Step = FineAlignSteps.S1230_BCR_CIM_COMMAND_CHECK; } } else { if (sequenceChangedTime.Seconds > 10) { cim_retry_cnt++; Step = FineAlignSteps.S1210_BCR_CIM_SEND; } } } break; } case FineAlignSteps.S1230_BCR_CIM_COMMAND_CHECK: { if (cim_user_command.Command_Type == En_User_Command.Retry) { cim_retry_cnt = 0; Step = FineAlignSteps.S1210_BCR_CIM_SEND; } else if (cim_user_command.Command_Type == En_User_Command.Pass) { Step = FineAlignSteps.S1400_RIGHT_BCR_DATA_READ; } break; } case FineAlignSteps.S1300_BCR_USER_COMMAND_START: { qr_code_user_command = new Tray_QR_Code_Command("LEFT CELL ID QR CODE"); qr_code_user_command_show = true; Step = FineAlignSteps.S1305_BCR_USER_COMMAND_CHECK; break; } case FineAlignSteps.S1305_BCR_USER_COMMAND_CHECK: { if (qr_code_user_command.Command_Type == En_User_Command.Retry) { Bcr_retry_cnt = 0; Step = FineAlignSteps.S1200_LEFT_BCR_DATA_READ; } else if (qr_code_user_command.Command_Type == En_User_Command.Pass) { equipment.Cell_ID_Left_BCR.BCR_Stop(); DateTime dt = DateTime.Now; string panel_id = $"{dt.Year.ToString().Remove(0, 2)}{dt.Month:D2}{dt.Day:D2}{dt.Hour:D2}{dt.Minute:D2}{dt.Second:D2}000"; Panel_Info panel = equipment.process.ablation_stage_1.Panel1; panel.Panel_ID = panel_id; panel.Ablation_Run = false; panel.IsPanelIdReadWorked = true; equipment.process.ablation_stage_1.Panel1 = panel; Step = FineAlignSteps.S1400_RIGHT_BCR_DATA_READ; } break; } case FineAlignSteps.S1400_RIGHT_BCR_DATA_READ: { if (equipment.process.ablation_stage_1.Stage2.IsExist == false) { Step = FineAlignSteps.S1999_ABLATION_STAGE_1_PANEL_ID_READ_END; } else { BCR_Read_Th = new System.Threading.Thread(() => Right_BCR_Read()); BCR_Read_Th.Start(); Step = FineAlignSteps.S1405_BCR_DATA_READ_WAIT; } break; } case FineAlignSteps.S1405_BCR_DATA_READ_WAIT: { if (BCR_Read_Th != null && BCR_Read_Th.ThreadState != System.Threading.ThreadState.Stopped) return; if (Right_BCR_Data != null && Right_BCR_Data.Length == 15) { Panel_Info panel = equipment.process.ablation_stage_1.Panel2; panel.Panel_ID = Right_BCR_Data; panel.IsPanelIdRead = true; panel.IsPanelIdReadWorked = true; equipment.process.ablation_stage_1.Panel2 = panel; Bcr_retry_cnt = 0; if (equipment.cim_mode == En_Cim_Mode.Online) { cim_retry_cnt = 0; Step = FineAlignSteps.S1410_BCR_CIM_SEND; } else { Step = FineAlignSteps.S1999_ABLATION_STAGE_1_PANEL_ID_READ_END; } } else { if (Bcr_retry_cnt > equipment.Setting.Bcr_Retry_Count) { Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0862_STAGE_1_RIGHT_PANEL_ID_READ_ERROR); Step = FineAlignSteps.S1500_BCR_USER_COMMAND_START; } else { Bcr_retry_cnt++; Step = FineAlignSteps.S1400_RIGHT_BCR_DATA_READ; } } break; } case FineAlignSteps.S1410_BCR_CIM_SEND: { if (equipment.cim_client.Send_Panel_In_Check("E000000", Right_BCR_Data)) { Step = FineAlignSteps.S1415_BCR_CIM_WAIT; } break; } case FineAlignSteps.S1415_BCR_CIM_WAIT: { if (equipment.cim_mode != En_Cim_Mode.Online) { Step = FineAlignSteps.S1999_ABLATION_STAGE_1_PANEL_ID_READ_END; } else { if (equipment.cim_client.Get_Command_Ack(En_Cim_Command.INCRQ) && equipment.cim_client.Get_Command_Result(En_Cim_Command.INCRQ)) { Step = FineAlignSteps.S1420_CIM_SERVER_RESULT_CHECK; } else if (sequenceChangedTime.Seconds > 10) { if (cim_retry_cnt <= cim_retry) { cim_retry_cnt++; Step = FineAlignSteps.S1410_BCR_CIM_SEND; } else { Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0920_CIM_COMMUNICATION_ERROR); cim_user_command = new Tray_QR_Code_Command("Ablation #1 Right Panel in Check Fail."); cim_user_command_show = true; Step = FineAlignSteps.S1430_BCR_CIM_COMMAND_CHECK; } } } break; } case FineAlignSteps.S1420_CIM_SERVER_RESULT_CHECK: { if (equipment.cim_mode != En_Cim_Mode.Online) { Step = FineAlignSteps.S1999_ABLATION_STAGE_1_PANEL_ID_READ_END; } else { if (equipment.cim_server.Get_Command_Ack(En_Cim_Command.INCRT)) { if (equipment.cim_server.Get_Command_Result(En_Cim_Command.INCRT) && Right_BCR_Data == equipment.cim_server.Panel_ID) { Step = FineAlignSteps.S1999_ABLATION_STAGE_1_PANEL_ID_READ_END; } else { Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0964_ABLATION_STAGE_1_2_PANEL_ID_MISS_MATCH_ERROR); cim_user_command = new Tray_QR_Code_Command("Ablation #1 Right Panel is NG."); cim_user_command_show = true; Step = FineAlignSteps.S1430_BCR_CIM_COMMAND_CHECK; } } else { if (sequenceChangedTime.Seconds > 10) { cim_retry_cnt++; Step = FineAlignSteps.S1410_BCR_CIM_SEND; } } } break; } case FineAlignSteps.S1430_BCR_CIM_COMMAND_CHECK: { if (cim_user_command.Command_Type == En_User_Command.Retry) { cim_retry_cnt = 0; Step = FineAlignSteps.S1410_BCR_CIM_SEND; } else if (cim_user_command.Command_Type == En_User_Command.Pass) { Step = FineAlignSteps.S1999_ABLATION_STAGE_1_PANEL_ID_READ_END; } break; } case FineAlignSteps.S1500_BCR_USER_COMMAND_START: { qr_code_user_command = new Tray_QR_Code_Command("RIGHT CELL ID QR CODE"); qr_code_user_command_show = true; Step = FineAlignSteps.S1505_BCR_USER_COMMAND_CHECK; break; } case FineAlignSteps.S1505_BCR_USER_COMMAND_CHECK: { if (qr_code_user_command.Command_Type == En_User_Command.Retry) { Bcr_retry_cnt = 0; Step = FineAlignSteps.S1400_RIGHT_BCR_DATA_READ; } else if (qr_code_user_command.Command_Type == En_User_Command.Pass) { equipment.Cell_ID_Right_BCR.BCR_Stop(); DateTime dt = DateTime.Now; string panel_id = $"{dt.Year.ToString().Remove(0, 2)}{dt.Month:D2}{dt.Day:D2}{dt.Hour:D2}{dt.Minute:D2}{dt.Second:D2}001"; Panel_Info panel = equipment.process.ablation_stage_1.Panel2; panel.Panel_ID = panel_id; panel.Ablation_Run = false; panel.IsPanelIdReadWorked = true; equipment.process.ablation_stage_1.Panel2 = panel; Step = FineAlignSteps.S1999_ABLATION_STAGE_1_PANEL_ID_READ_END; } break; } case FineAlignSteps.S1999_ABLATION_STAGE_1_PANEL_ID_READ_END: { Step = FineAlignSteps.S0000_WAIT; break; } } } private void Seq_FineAlignLeftAblationStage1() { switch (Step) { case FineAlignSteps.S2000_ABLATION_1_FINE_ALIGN_LEFT_START: { Step = FineAlignSteps.S2100_MOVE_FINE_ALIGN_LEFT_POS; break; } case FineAlignSteps.S2100_MOVE_FINE_ALIGN_LEFT_POS: { if (MotorX.Move_Absolute_Pos(equipment.Cur_Main_Recipe.vision_info.Fine_Align_1_Left_X, 500)) { Step = FineAlignSteps.S2105_POSITION_CHECK; } break; } case FineAlignSteps.S2105_POSITION_CHECK: { if (MotorX.MotionComplete) { if (MotorX.Is_Inposition(equipment.Cur_Main_Recipe.vision_info.Fine_Align_1_Left_X, equipment.Setting.Inposition_Offset)) { Step = FineAlignSteps.S2110_ABLATION_1_POSITION_CHECK; } else { Step = FineAlignSteps.S2100_MOVE_FINE_ALIGN_LEFT_POS; } } break; } case FineAlignSteps.S2110_ABLATION_1_POSITION_CHECK: { if (equipment.process.ablation_stage_1.MotorY.Is_Inposition(equipment.Cur_Main_Recipe.vision_info.Fine_Align_1_Left_Y, equipment.Setting.Inposition_Offset)) { Step = FineAlignSteps.S2200_LEFT_CAMERA_GRAB_READY; } break; } case FineAlignSteps.S2200_LEFT_CAMERA_GRAB_READY: { Panel_Info info = equipment.process.ablation_stage_1.Panel1; if (equipment.process.ablation_stage_1.Stage1.IsExist == false || info.Fine_Align_Result) { Step = FineAlignSteps.S2210_RIGHT_CAMERA_GRAB_READY; } else if (equipment.Align_vision.Send_Fine_Align_Grab_Ready(0, 0, 0, 0, info.Tray_Num, info.Panel_Num, info.Panel_ID)) { Step = FineAlignSteps.S2205_LEFT_CAMERA_GRAB_READY_WAIT; } break; } case FineAlignSteps.S2205_LEFT_CAMERA_GRAB_READY_WAIT: { if (equipment.sm.Get_Bit(Vision_Address.Fine_Align_Grab_Ready_Ack)) { Step = FineAlignSteps.S2210_RIGHT_CAMERA_GRAB_READY; } else if (sequenceChangedTime.Seconds > equipment.Setting.Vision_Timeout) { Step = FineAlignSteps.S2200_LEFT_CAMERA_GRAB_READY; } break; } case FineAlignSteps.S2210_RIGHT_CAMERA_GRAB_READY: { if (sequenceChangedTime.Seconds < 0.1) break; Panel_Info info = equipment.process.ablation_stage_1.Panel2; if (equipment.process.ablation_stage_1.Stage2.IsExist == false || info.Fine_Align_Result) { Step = FineAlignSteps.S2300_LEFT_CAMERA_MARK_1_GRAB_START; return; } else if (equipment.Align_vision.Send_Fine_Align_Grab_Ready(1, 0, 0, 1, info.Tray_Num, info.Panel_Num, info.Panel_ID)) { Step = FineAlignSteps.S2215_RIGHT_CAMERA_GRAB_READY_WAIT; } break; } case FineAlignSteps.S2215_RIGHT_CAMERA_GRAB_READY_WAIT: { if (equipment.sm.Get_Bit(Vision_Address.Fine_Align_Grab_Ready_Ack)) { Step = FineAlignSteps.S2300_LEFT_CAMERA_MARK_1_GRAB_START; } else if (sequenceChangedTime.Seconds > equipment.Setting.Vision_Timeout) { Step = FineAlignSteps.S2200_LEFT_CAMERA_GRAB_READY; } break; } case FineAlignSteps.S2300_LEFT_CAMERA_MARK_1_GRAB_START: { if (sequenceChangedTime.Seconds < equipment.Setting.Vision_Move_Delay) return; Panel_Info info = equipment.process.ablation_stage_1.Panel1; if (equipment.process.ablation_stage_1.Stage1.IsExist == false || info.Fine_Align_Result) { Step = FineAlignSteps.S2310_RIGHT_CAMERA_MARK_1_GRAB_START; } else if (equipment.Align_vision.Send_Fine_Align_Grab_Start(0, 0, MotorX.Position, equipment.process.ablation_stage_1.MotorY.Position)) { Step = FineAlignSteps.S2305_LEFT_CAMERA_MARK_1_GRAB_WAIT; } break; } case FineAlignSteps.S2305_LEFT_CAMERA_MARK_1_GRAB_WAIT: { if (equipment.sm.Get_Bit(Vision_Address.Fine_Align_Grab_Start_Left_Ack)) { Step = FineAlignSteps.S2310_RIGHT_CAMERA_MARK_1_GRAB_START; } else if (sequenceChangedTime.Seconds > equipment.Setting.Vision_Timeout) { Step = FineAlignSteps.S2200_LEFT_CAMERA_GRAB_READY; } break; } case FineAlignSteps.S2310_RIGHT_CAMERA_MARK_1_GRAB_START: { if (sequenceChangedTime.Seconds < 0.1) return; Panel_Info info = equipment.process.ablation_stage_1.Panel2; if (equipment.process.ablation_stage_1.Stage2.IsExist == false || info.Fine_Align_Result) { Step = FineAlignSteps.S2999_ABLATION_1_FINE_ALIGN_LEFT_END; } else if (equipment.Align_vision.Send_Fine_Align_Grab_Start(1, 0, MotorX.Position, equipment.process.ablation_stage_1.MotorY.Position)) { Step = FineAlignSteps.S2315_RIGHT_CAMERA_MARK_1_GRAB_WAIT; } break; } case FineAlignSteps.S2315_RIGHT_CAMERA_MARK_1_GRAB_WAIT: { if (equipment.sm.Get_Bit(Vision_Address.Fine_Align_Grab_Start_Right_Ack)) { Step = FineAlignSteps.S2999_ABLATION_1_FINE_ALIGN_LEFT_END; } else if (sequenceChangedTime.Seconds > equipment.Setting.Vision_Timeout) { Step = FineAlignSteps.S2200_LEFT_CAMERA_GRAB_READY; } break; } case FineAlignSteps.S2999_ABLATION_1_FINE_ALIGN_LEFT_END: { Step = FineAlignSteps.S0000_WAIT; break; } } } private void Seq_FineAlignRightAblationStage1() { switch (Step) { case FineAlignSteps.S3000_ABLATION_1_FINE_ALIGN_RIGHT_START: { Step = FineAlignSteps.S3100_MOVE_FINE_ALIGN_RIGHT_POS; break; } case FineAlignSteps.S3100_MOVE_FINE_ALIGN_RIGHT_POS: { if (MotorX.Move_Absolute_Pos(equipment.Cur_Main_Recipe.vision_info.Fine_Align_1_Right_X, 500)) { Step = FineAlignSteps.S3105_POSITION_CHECK; } break; } case FineAlignSteps.S3105_POSITION_CHECK: { if (MotorX.MotionComplete) { if (MotorX.Is_Inposition(equipment.Cur_Main_Recipe.vision_info.Fine_Align_1_Right_X, equipment.Setting.Inposition_Offset)) { Step = FineAlignSteps.S3110_ABLATION_1_POSITION_CHECK; } else { Step = FineAlignSteps.S3100_MOVE_FINE_ALIGN_RIGHT_POS; } } break; } case FineAlignSteps.S3110_ABLATION_1_POSITION_CHECK: { if (equipment.process.ablation_stage_1.MotorY.Is_Inposition(equipment.Cur_Main_Recipe.vision_info.Fine_Align_1_Left_Y, equipment.Setting.Inposition_Offset)) { Step = FineAlignSteps.S3200_LEFT_CAMERA_MARK_2_GRAB_START; } break; } case FineAlignSteps.S3200_LEFT_CAMERA_MARK_2_GRAB_START: { if (sequenceChangedTime.Seconds < equipment.Setting.Vision_Move_Delay) return; Panel_Info info = equipment.process.ablation_stage_1.Panel1; if (equipment.process.ablation_stage_1.Stage1.IsExist == false || info.Fine_Align_Result) { Step = FineAlignSteps.S3210_RIGHT_CAMERA_MARK_2_GRAB_START; return; } else if (equipment.Align_vision.Send_Fine_Align_Grab_Start(0, 1, MotorX.Position, equipment.process.ablation_stage_1.MotorY.Position)) { Step = FineAlignSteps.S3205_LEFT_CAMERA_MARK_2_GRAB_WAIT; } break; } case FineAlignSteps.S3205_LEFT_CAMERA_MARK_2_GRAB_WAIT: { if (equipment.sm.Get_Bit(Vision_Address.Fine_Align_Grab_Start_Left_Ack)) { Step = FineAlignSteps.S3210_RIGHT_CAMERA_MARK_2_GRAB_START; } else if (sequenceChangedTime.Seconds > equipment.Setting.Vision_Timeout) { Step = FineAlignSteps.S3999_ABLATION_1_FINE_ALIGN_RIGHT_END; } break; } case FineAlignSteps.S3210_RIGHT_CAMERA_MARK_2_GRAB_START: { if (sequenceChangedTime.Seconds < 0.1) return; Panel_Info info = equipment.process.ablation_stage_1.Panel2; if (equipment.process.ablation_stage_1.Stage2.IsExist == false || info.Fine_Align_Result) { Step = FineAlignSteps.S3999_ABLATION_1_FINE_ALIGN_RIGHT_END; return; } else if (equipment.Align_vision.Send_Fine_Align_Grab_Start(1, 1, MotorX.Position, equipment.process.ablation_stage_1.MotorY.Position)) { Step = FineAlignSteps.S3215_RIGHT_CAMERA_MARK_2_GRAB_WAIT; } break; } case FineAlignSteps.S3215_RIGHT_CAMERA_MARK_2_GRAB_WAIT: { if (equipment.sm.Get_Bit(Vision_Address.Fine_Align_Grab_Start_Right_Ack)) { Step = FineAlignSteps.S3999_ABLATION_1_FINE_ALIGN_RIGHT_END; } else if (sequenceChangedTime.Seconds > equipment.Setting.Vision_Timeout) { Step = FineAlignSteps.S3999_ABLATION_1_FINE_ALIGN_RIGHT_END; } break; } case FineAlignSteps.S3999_ABLATION_1_FINE_ALIGN_RIGHT_END: { Step = FineAlignSteps.S0000_WAIT; break; } } } private void Seq_ReadPanelIdAblationStage2() { switch (Step) { case FineAlignSteps.S4000_ABLATION_STAGE_2_PANEL_ID_READ_START: { Step = FineAlignSteps.S4100_MOVE_TO_BCR_2; break; } case FineAlignSteps.S4100_MOVE_TO_BCR_2: { if (MotorX.Move_Absolute_Pos(equipment.Cur_Main_Recipe.vision_info.Ablation_MCR_2_X, 500)) { Step = FineAlignSteps.S4105_POSITION_CHECK; } break; } case FineAlignSteps.S4105_POSITION_CHECK: { if (MotorX.MotionComplete) { if (MotorX.Is_Inposition(equipment.Cur_Main_Recipe.vision_info.Ablation_MCR_2_X, equipment.Setting.Inposition_Offset)) { Bcr_retry_cnt = 0; Step = FineAlignSteps.S4110_ABLATION_STAGE_2_POSITION_CHECK; } else { Step = FineAlignSteps.S4100_MOVE_TO_BCR_2; } } break; } case FineAlignSteps.S4110_ABLATION_STAGE_2_POSITION_CHECK: { if (equipment.process.ablation_stage_2.MotorY.Is_Inposition(equipment.Cur_Main_Recipe.vision_info.Ablation_MCR_2_Y, equipment.Setting.Inposition_Offset)) { if (equipment.process.ablation_stage_2.IsExist) { if (equipment.process.ablation_stage_2.Stage1.IsExist) { Step = FineAlignSteps.S4200_LEFT_BCR_DATA_READ; } else if (equipment.process.ablation_stage_2.Stage2.IsExist) { Step = FineAlignSteps.S4400_RIGHT_BCR_DATA_READ; } } else { Step = FineAlignSteps.S4999_ABLATION_STAGE_2_PANEL_ID_READ_END; } } break; } case FineAlignSteps.S4200_LEFT_BCR_DATA_READ: { if (equipment.process.ablation_stage_2.Stage1.IsExist == false) { Step = FineAlignSteps.S4200_LEFT_BCR_DATA_READ; } else { BCR_Read_Th = new System.Threading.Thread(() => Left_BCR_Read()); BCR_Read_Th.Start(); Step = FineAlignSteps.S4205_BCR_DATA_READ_WAIT; } break; } case FineAlignSteps.S4205_BCR_DATA_READ_WAIT: { if (BCR_Read_Th != null && BCR_Read_Th.ThreadState != System.Threading.ThreadState.Stopped) return; if (Left_BCR_Data != null && Left_BCR_Data.Length == 15) { Panel_Info panel = equipment.process.ablation_stage_2.Panel1; panel.Panel_ID = Left_BCR_Data; panel.IsPanelIdRead = true; panel.IsPanelIdReadWorked = true; equipment.process.ablation_stage_2.Panel1 = panel; Bcr_retry_cnt = 0; if (equipment.cim_mode == En_Cim_Mode.Online) { cim_retry_cnt = 0; Step = FineAlignSteps.S4210_BCR_CIM_SEND; } else { Step = FineAlignSteps.S4400_RIGHT_BCR_DATA_READ; } } else { if (Bcr_retry_cnt > equipment.Setting.Bcr_Retry_Count) { Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0864_STAGE_2_RIGHT_PANEL_ID_READ_ERROR); Step = FineAlignSteps.S4300_BCR_USER_COMMAND_START; } else { Bcr_retry_cnt++; Step = FineAlignSteps.S4200_LEFT_BCR_DATA_READ; } } break; } case FineAlignSteps.S4210_BCR_CIM_SEND: { if (equipment.cim_client.Send_Panel_In_Check("E000000", Left_BCR_Data)) { Step = FineAlignSteps.S4215_BCR_CIM_WAIT; } break; } case FineAlignSteps.S4215_BCR_CIM_WAIT: { if (equipment.cim_mode != En_Cim_Mode.Online) { Step = FineAlignSteps.S4400_RIGHT_BCR_DATA_READ; } else { if (equipment.cim_client.Get_Command_Ack(En_Cim_Command.INCRQ) && equipment.cim_client.Get_Command_Result(En_Cim_Command.INCRQ)) { Step = FineAlignSteps.S4220_CIM_SERVER_RESULT_CHECK; } else if(sequenceChangedTime.Seconds > 10) { if (cim_retry_cnt <= cim_retry) { cim_retry_cnt++; Step = FineAlignSteps.S4210_BCR_CIM_SEND; } else { Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0920_CIM_COMMUNICATION_ERROR); cim_user_command = new Tray_QR_Code_Command("Ablation #2 Left Panel in Check Fail."); cim_user_command_show = true; Step = FineAlignSteps.S4230_BCR_CIM_COMMAND_CHECK; } } } break; } case FineAlignSteps.S4220_CIM_SERVER_RESULT_CHECK: { if (equipment.cim_mode != En_Cim_Mode.Online) { Step = FineAlignSteps.S4400_RIGHT_BCR_DATA_READ; return; } if (equipment.cim_server.Get_Command_Ack(En_Cim_Command.INCRT)) { if (equipment.cim_server.Get_Command_Result(En_Cim_Command.INCRT) && Left_BCR_Data == equipment.cim_server.Panel_ID) { Step = FineAlignSteps.S4400_RIGHT_BCR_DATA_READ; } else { Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0965_ABLATION_STAGE_2_1_PANEL_ID_MISS_MATCH_ERROR); cim_user_command = new Tray_QR_Code_Command("Ablation #2 Left Panel is NG."); cim_user_command_show = true; Step = FineAlignSteps.S4230_BCR_CIM_COMMAND_CHECK; } } else { if (sequenceChangedTime.Seconds > 10) { cim_retry_cnt++; Step = FineAlignSteps.S4210_BCR_CIM_SEND; } } break; } case FineAlignSteps.S4230_BCR_CIM_COMMAND_CHECK: { if (cim_user_command.Command_Type == En_User_Command.Retry) { cim_retry_cnt = 0; Step = FineAlignSteps.S4210_BCR_CIM_SEND; } else if (cim_user_command.Command_Type == En_User_Command.Pass) { Step = FineAlignSteps.S4400_RIGHT_BCR_DATA_READ; } break; } case FineAlignSteps.S4300_BCR_USER_COMMAND_START: { qr_code_user_command = new Tray_QR_Code_Command("LEFT CELL ID QR CODE"); qr_code_user_command_show = true; Step = FineAlignSteps.S4305_BCR_USER_COMMAND_CHECK; break; } case FineAlignSteps.S4305_BCR_USER_COMMAND_CHECK: { if (qr_code_user_command.Command_Type == En_User_Command.Retry) { Bcr_retry_cnt = 0; Step = FineAlignSteps.S4200_LEFT_BCR_DATA_READ; } else if (qr_code_user_command.Command_Type == En_User_Command.Pass) { equipment.Cell_ID_Left_BCR.BCR_Stop(); DateTime dt = DateTime.Now; string panel_id = $"{dt.Year.ToString().Remove(0, 2)}{dt.Month:D2}{dt.Day:D2}{dt.Hour:D2}{dt.Minute:D2}{dt.Second:D2}002"; Panel_Info panel = equipment.process.ablation_stage_2.Panel1; panel.Panel_ID = panel_id; panel.Ablation_Run = false; panel.IsPanelIdReadWorked = true; equipment.process.ablation_stage_2.Panel1 = panel; Step = FineAlignSteps.S4400_RIGHT_BCR_DATA_READ; } break; } case FineAlignSteps.S4400_RIGHT_BCR_DATA_READ: { if (equipment.process.ablation_stage_2.Stage2.IsExist == false) { Step = FineAlignSteps.S4999_ABLATION_STAGE_2_PANEL_ID_READ_END; } else { BCR_Read_Th = new System.Threading.Thread(() => Right_BCR_Read()); BCR_Read_Th.Start(); Step = FineAlignSteps.S4405_BCR_DATA_READ_WAIT; } break; } case FineAlignSteps.S4405_BCR_DATA_READ_WAIT: { if (BCR_Read_Th != null && BCR_Read_Th.ThreadState != System.Threading.ThreadState.Stopped) return; if (Right_BCR_Data != null && Right_BCR_Data.Length == 15) { Panel_Info panel = equipment.process.ablation_stage_2.Panel2; panel.Panel_ID = Right_BCR_Data; panel.IsPanelIdRead = true; panel.IsPanelIdReadWorked = true; equipment.process.ablation_stage_2.Panel2 = panel; Bcr_retry_cnt = 0; if (equipment.cim_mode == En_Cim_Mode.Online) { cim_retry_cnt = 0; Step = FineAlignSteps.S4410_BCR_CIM_SEND; } else { Step = FineAlignSteps.S4999_ABLATION_STAGE_2_PANEL_ID_READ_END; } } else { if (Bcr_retry_cnt > equipment.Setting.Bcr_Retry_Count) { Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0863_STAGE_2_LEFT_PANEL_ID_READ_ERROR); Step = FineAlignSteps.S4500_BCR_USER_COMMAND_START; } else { Bcr_retry_cnt++; Step = FineAlignSteps.S4400_RIGHT_BCR_DATA_READ; } } break; } case FineAlignSteps.S4410_BCR_CIM_SEND: { if (equipment.cim_client.Send_Panel_In_Check("E000000", Right_BCR_Data)) { Step = FineAlignSteps.S4415_BCR_CIM_WAIT; } break; } case FineAlignSteps.S4415_BCR_CIM_WAIT: { if (equipment.cim_mode != En_Cim_Mode.Online) { Step = FineAlignSteps.S4999_ABLATION_STAGE_2_PANEL_ID_READ_END; } else { if (equipment.cim_client.Get_Command_Ack(En_Cim_Command.INCRQ) && equipment.cim_client.Get_Command_Result(En_Cim_Command.INCRQ)) { Step = FineAlignSteps.S4420_CIM_SERVER_RESULT_CHECK; } else if (sequenceChangedTime.Seconds > 10) { if (cim_retry_cnt <= cim_retry) { cim_retry_cnt++; Step = FineAlignSteps.S4410_BCR_CIM_SEND; } else { Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0920_CIM_COMMUNICATION_ERROR); cim_user_command = new Tray_QR_Code_Command("Ablation #2 Right Panel in Check Fail."); cim_user_command_show = true; Step = FineAlignSteps.S4500_BCR_USER_COMMAND_START; } } } break; } case FineAlignSteps.S4420_CIM_SERVER_RESULT_CHECK: { if (equipment.cim_mode != En_Cim_Mode.Online) { Step = FineAlignSteps.S4999_ABLATION_STAGE_2_PANEL_ID_READ_END; } else { if (equipment.cim_server.Get_Command_Ack(En_Cim_Command.INCRT)) { if (equipment.cim_server.Get_Command_Result(En_Cim_Command.INCRT) && Right_BCR_Data == equipment.cim_server.Panel_ID) { Step = FineAlignSteps.S4999_ABLATION_STAGE_2_PANEL_ID_READ_END; } else { Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0966_ABLATION_STAGE_2_2_PANEL_ID_MISS_MATCH_ERROR); cim_user_command = new Tray_QR_Code_Command("Ablation #2 Right Panel is NG."); cim_user_command_show = true; Step = FineAlignSteps.S4430_BCR_CIM_COMMAND_CHECK; } } else { if (sequenceChangedTime.Seconds > 10) { cim_retry_cnt++; Step = FineAlignSteps.S4410_BCR_CIM_SEND; } } } break; } case FineAlignSteps.S4430_BCR_CIM_COMMAND_CHECK: { if (cim_user_command.Command_Type == En_User_Command.Retry) { cim_retry_cnt = 0; Step = FineAlignSteps.S4410_BCR_CIM_SEND; } else if (cim_user_command.Command_Type == En_User_Command.Pass) { Step = FineAlignSteps.S4999_ABLATION_STAGE_2_PANEL_ID_READ_END; } break; } case FineAlignSteps.S4500_BCR_USER_COMMAND_START: { qr_code_user_command = new Tray_QR_Code_Command("RIGHT CELL ID QR CODE"); qr_code_user_command_show = true; Step = FineAlignSteps.S4505_BCR_USER_COMMAND_CHECK; break; } case FineAlignSteps.S4505_BCR_USER_COMMAND_CHECK: { if (qr_code_user_command.Command_Type == En_User_Command.Retry) { Bcr_retry_cnt = 0; Step = FineAlignSteps.S4400_RIGHT_BCR_DATA_READ; } else if (qr_code_user_command.Command_Type == En_User_Command.Pass) { equipment.Cell_ID_Right_BCR.BCR_Stop(); DateTime dt = DateTime.Now; string panel_id = $"{dt.Year.ToString().Remove(0, 2)}{dt.Month:D2}{dt.Day:D2}{dt.Hour:D2}{dt.Minute:D2}{dt.Second:D2}003"; Panel_Info panel = equipment.process.ablation_stage_2.Panel2; panel.Panel_ID = panel_id; panel.Ablation_Run = false; panel.IsPanelIdReadWorked = true; equipment.process.ablation_stage_2.Panel2 = panel; Bcr_retry_cnt = 0; Step = FineAlignSteps.S4999_ABLATION_STAGE_2_PANEL_ID_READ_END; } break; } case FineAlignSteps.S4999_ABLATION_STAGE_2_PANEL_ID_READ_END: { Step = FineAlignSteps.S0000_WAIT; break; } } } private void Seq_FineAlignLeftAblationStage2() { switch (Step) { case FineAlignSteps.S5000_ABLATION_2_FINE_ALIGN_LEFT_START: { Step = FineAlignSteps.S5100_MOVE_FINE_ALIGN_LEFT_POS; break; } case FineAlignSteps.S5100_MOVE_FINE_ALIGN_LEFT_POS: { if (MotorX.Move_Absolute_Pos(equipment.Cur_Main_Recipe.vision_info.Fine_Align_2_Left_X, 500)) { Step = FineAlignSteps.S5105_POSITION_CHECK; } break; } case FineAlignSteps.S5105_POSITION_CHECK: { if (MotorX.MotionComplete) { if (MotorX.Is_Inposition(equipment.Cur_Main_Recipe.vision_info.Fine_Align_2_Left_X, equipment.Setting.Inposition_Offset)) { Step = FineAlignSteps.S5110_ABLATION_2_POSITION_CHECK; } else { Step = FineAlignSteps.S5100_MOVE_FINE_ALIGN_LEFT_POS; } } break; } case FineAlignSteps.S5110_ABLATION_2_POSITION_CHECK: { if (equipment.process.ablation_stage_2.MotorY.Is_Inposition(equipment.Cur_Main_Recipe.vision_info.Fine_Align_2_Left_Y, equipment.Setting.Inposition_Offset)) { Step = FineAlignSteps.S5200_LEFT_CAMERA_GRAB_READY; } break; } case FineAlignSteps.S5200_LEFT_CAMERA_GRAB_READY: { Panel_Info info = equipment.process.ablation_stage_2.Panel1; if (equipment.process.ablation_stage_2.Stage1.IsExist == false || info.Fine_Align_Result) { Step = FineAlignSteps.S5210_RIGHT_CAMERA_GRAB_READY; return; } else if (equipment.Align_vision.Send_Fine_Align_Grab_Ready(0, 0, 0, 2, info.Tray_Num, info.Panel_Num, info.Panel_ID)) { Step = FineAlignSteps.S5205_LEFT_CAMERA_GRAB_READY_WAIT; } break; } case FineAlignSteps.S5205_LEFT_CAMERA_GRAB_READY_WAIT: { if (equipment.sm.Get_Bit(Vision_Address.Fine_Align_Grab_Ready_Ack)) { Step = FineAlignSteps.S5210_RIGHT_CAMERA_GRAB_READY; } else if (sequenceChangedTime.Seconds > equipment.Setting.Vision_Timeout) { Step = FineAlignSteps.S5200_LEFT_CAMERA_GRAB_READY; } break; } case FineAlignSteps.S5210_RIGHT_CAMERA_GRAB_READY: { if (sequenceChangedTime.Seconds < 0.1) break; Panel_Info info = equipment.process.ablation_stage_2.Panel2; if (equipment.process.ablation_stage_2.Stage2.IsExist == false || info.Fine_Align_Result) { Step = FineAlignSteps.S5300_LEFT_CAMERA_MARK_1_GRAB_START; } else if (equipment.Align_vision.Send_Fine_Align_Grab_Ready(1, 0, 0, 3, info.Tray_Num, info.Panel_Num, info.Panel_ID)) { Step = FineAlignSteps.S5215_RIGHT_CAMERA_GRAB_READY_WAIT; } break; } case FineAlignSteps.S5215_RIGHT_CAMERA_GRAB_READY_WAIT: { if (equipment.sm.Get_Bit(Vision_Address.Fine_Align_Grab_Ready_Ack)) { Step = FineAlignSteps.S5300_LEFT_CAMERA_MARK_1_GRAB_START; } if (sequenceChangedTime.Seconds > equipment.Setting.Vision_Timeout) { Step = FineAlignSteps.S5200_LEFT_CAMERA_GRAB_READY; } break; } case FineAlignSteps.S5300_LEFT_CAMERA_MARK_1_GRAB_START: { if (sequenceChangedTime.Seconds < equipment.Setting.Vision_Move_Delay) return; Panel_Info info = equipment.process.ablation_stage_2.Panel1; if (equipment.process.ablation_stage_2.Stage1.IsExist == false || info.Fine_Align_Result) { Step = FineAlignSteps.S5310_RIGHT_CAMERA_MARK_1_GRAB_START; } else if (equipment.Align_vision.Send_Fine_Align_Grab_Start(0, 0, MotorX.Position, equipment.process.ablation_stage_2.MotorY.Position)) { Step = FineAlignSteps.S5305_LEFT_CAMERA_MARK_1_GRAB_WAIT; } break; } case FineAlignSteps.S5305_LEFT_CAMERA_MARK_1_GRAB_WAIT: { if (equipment.sm.Get_Bit(Vision_Address.Fine_Align_Grab_Start_Left_Ack)) { Step = FineAlignSteps.S5310_RIGHT_CAMERA_MARK_1_GRAB_START; } else if (sequenceChangedTime.Seconds > equipment.Setting.Vision_Timeout) { Step = FineAlignSteps.S5200_LEFT_CAMERA_GRAB_READY; } break; } case FineAlignSteps.S5310_RIGHT_CAMERA_MARK_1_GRAB_START: { if (sequenceChangedTime.Seconds < 0.1) return; Panel_Info info = equipment.process.ablation_stage_2.Panel2; if (equipment.process.ablation_stage_2.Stage2.IsExist == false || info.Fine_Align_Result) { Step = FineAlignSteps.S5999_ABLATION_2_FINE_ALIGN_LEFT_END; } else if (equipment.Align_vision.Send_Fine_Align_Grab_Start(1, 0, MotorX.Position, equipment.process.ablation_stage_2.MotorY.Position)) { Step = FineAlignSteps.S5315_RIGHT_CAMERA_MARK_1_GRAB_WAIT; } break; } case FineAlignSteps.S5315_RIGHT_CAMERA_MARK_1_GRAB_WAIT: { if (equipment.sm.Get_Bit(Vision_Address.Fine_Align_Grab_Start_Right_Ack)) { Step = FineAlignSteps.S5999_ABLATION_2_FINE_ALIGN_LEFT_END; } else if (sequenceChangedTime.Seconds > equipment.Setting.Vision_Timeout) { Step = FineAlignSteps.S5200_LEFT_CAMERA_GRAB_READY; } break; } case FineAlignSteps.S5999_ABLATION_2_FINE_ALIGN_LEFT_END: { Step = FineAlignSteps.S0000_WAIT; break; } } } private void Seq_FineAlignRightAblationStage2() { switch (Step) { case FineAlignSteps.S6000_ABLATION_2_FINE_ALIGN_RIGHT_START: { Step = FineAlignSteps.S6100_MOVE_FINE_ALIGN_RIGHT_POS; break; } case FineAlignSteps.S6100_MOVE_FINE_ALIGN_RIGHT_POS: { if (MotorX.Move_Absolute_Pos(equipment.Cur_Main_Recipe.vision_info.Fine_Align_2_Right_X, 500)) Step = FineAlignSteps.S6105_POSITION_CHECK; break; } case FineAlignSteps.S6105_POSITION_CHECK: { if (MotorX.MotionComplete) { if (MotorX.Is_Inposition(equipment.Cur_Main_Recipe.vision_info.Fine_Align_2_Right_X, equipment.Setting.Inposition_Offset)) { Step = FineAlignSteps.S6110_ABLATION_2_POSITION_CHECK; } else { Step = FineAlignSteps.S6100_MOVE_FINE_ALIGN_RIGHT_POS; } } break; } case FineAlignSteps.S6110_ABLATION_2_POSITION_CHECK: { if (equipment.process.ablation_stage_2.MotorY.Is_Inposition(equipment.Cur_Main_Recipe.vision_info.Fine_Align_2_Left_Y, equipment.Setting.Inposition_Offset)) { Step = FineAlignSteps.S6200_LEFT_CAMERA_MARK_2_GRAB_START; } break; } case FineAlignSteps.S6200_LEFT_CAMERA_MARK_2_GRAB_START: { if (sequenceChangedTime.Seconds < equipment.Setting.Vision_Move_Delay) return; Panel_Info info = equipment.process.ablation_stage_2.Panel1; if (equipment.process.ablation_stage_2.Stage1.IsExist == false || info.Fine_Align_Result) { Step = FineAlignSteps.S6210_RIGHT_CAMERA_MARK_2_GRAB_START; } else if (equipment.Align_vision.Send_Fine_Align_Grab_Start(0, 1, MotorX.Position, equipment.process.ablation_stage_2.MotorY.Position)) { Step = FineAlignSteps.S6205_LEFT_CAMERA_MARK_2_GRAB_WAIT; } break; } case FineAlignSteps.S6205_LEFT_CAMERA_MARK_2_GRAB_WAIT: { if (equipment.sm.Get_Bit(Vision_Address.Fine_Align_Grab_Start_Left_Ack)) { Step = FineAlignSteps.S6210_RIGHT_CAMERA_MARK_2_GRAB_START; } else if (sequenceChangedTime.Seconds > equipment.Setting.Vision_Timeout) { Step = FineAlignSteps.S6999_ABLATION_2_FINE_ALIGN_RIGHT_END; } break; } case FineAlignSteps.S6210_RIGHT_CAMERA_MARK_2_GRAB_START: { if (sequenceChangedTime.Seconds < 0.1) return; Panel_Info info = equipment.process.ablation_stage_2.Panel2; if (equipment.process.ablation_stage_2.Stage2.IsExist == false || info.Fine_Align_Result) { Step = FineAlignSteps.S6999_ABLATION_2_FINE_ALIGN_RIGHT_END; } else if (equipment.Align_vision.Send_Fine_Align_Grab_Start(1, 1, MotorX.Position, equipment.process.ablation_stage_2.MotorY.Position)) { Step = FineAlignSteps.S6215_RIGHT_CAMERA_MARK_2_GRAB_WAIT; } break; } case FineAlignSteps.S6215_RIGHT_CAMERA_MARK_2_GRAB_WAIT: { if (equipment.sm.Get_Bit(Vision_Address.Fine_Align_Grab_Start_Left_Ack)) { Step = FineAlignSteps.S6999_ABLATION_2_FINE_ALIGN_RIGHT_END; } else if (sequenceChangedTime.Seconds > equipment.Setting.Vision_Timeout) { Step = FineAlignSteps.S6999_ABLATION_2_FINE_ALIGN_RIGHT_END; } break; } case FineAlignSteps.S6999_ABLATION_2_FINE_ALIGN_RIGHT_END: { Step = FineAlignSteps.S0000_WAIT; break; } } } private void Left_BCR_Read() { Left_BCR_Data = equipment.Cell_ID_Left_BCR.BCR_Read(); } private void Right_BCR_Read() { Right_BCR_Data = equipment.Cell_ID_Right_BCR.BCR_Read(); } public bool Stage1PanelIdReadStart() { if (Step != FineAlignSteps.S0000_WAIT) { return false; } else { Step = FineAlignSteps.S1000_ABLATION_STAGE_1_PANEL_ID_READ_START; return true; } } public bool Stage1FineAlignLeftStart() { if (Step != FineAlignSteps.S0000_WAIT) { return false; } else { Step = FineAlignSteps.S2000_ABLATION_1_FINE_ALIGN_LEFT_START; return true; } } public bool Stage1FineAlignRightStart() { if (Step != FineAlignSteps.S0000_WAIT) { return false; } else { Step = FineAlignSteps.S3000_ABLATION_1_FINE_ALIGN_RIGHT_START; return true; } } public bool Stage2PanelIdReadStart() { if (Step != FineAlignSteps.S0000_WAIT) { return false; } else { Step = FineAlignSteps.S4000_ABLATION_STAGE_2_PANEL_ID_READ_START; return true; } } public bool Stage2FineAlignLeftStart() { if (Step != FineAlignSteps.S0000_WAIT) { return false; } else { Step = FineAlignSteps.S5000_ABLATION_2_FINE_ALIGN_LEFT_START; return true; } } public bool Stage2FineAlignRightStart() { if (Step != FineAlignSteps.S0000_WAIT) { return false; } else { Step = FineAlignSteps.S6000_ABLATION_2_FINE_ALIGN_RIGHT_START; return true; } } public void Stage1WaitPositionMove() { MotorX.Move_Absolute_Pos(equipment.Cur_Main_Recipe.vision_info.Ablation_MCR_1_X, 500); } public void Stage2WaitPositionMove() { MotorX.Move_Absolute_Pos(equipment.Cur_Main_Recipe.vision_info.Ablation_MCR_2_X, 500); } public bool Move_Cleaning_Position() { return MotorX.Move_Absolute_Pos(equipment.Cur_Main_Recipe.vision_info.Fine_Align_2_Right_X, 100); } #endregion } }