using DIT.SharedMemory;
|
using System;
|
using System.Threading;
|
|
//210924 hslee
|
using System.IO;
|
using System.Text;
|
using log4net;
|
using log4net.Appender;
|
using log4net.Layout;
|
using log4net.Repository.Hierarchy;
|
using System.Collections.Generic;
|
|
namespace SHARP_CLAS_UI
|
{
|
public class Equipment : IDisposable
|
{
|
#region Enum
|
|
#endregion
|
|
#region Define
|
public static string Registry_Path = @"SOFTWARE\SHARP_CLAS";
|
private static object _objLock = new object(); //210923 hslee
|
|
/// <summary>
|
/// Exception Log
|
/// </summary>
|
private ILog Exception_Log = LogManager.GetLogger("Exception");
|
|
/// <summary>
|
/// Exception Log Write
|
/// </summary>
|
/// <param name="Methodname">Method name of exception that occurred</param>
|
/// <param name="ex">exception</param>
|
public void Write_Exception_Log(string message)
|
{
|
if (Exception_Log != null) Exception_Log.Debug($"{message}");
|
}
|
|
/// <summary>
|
/// Panel Info Log
|
/// </summary>
|
private ILog Panel_Info_Log = LogManager.GetLogger("Panel_Info");
|
|
/// <summary>
|
/// Exception Log Write
|
/// </summary>
|
/// <param name="Methodname">Method name of exception that occurred</param>
|
/// <param name="ex">exception</param>
|
public void Write_Panel_Info_Log(string message)
|
{
|
if (Panel_Info_Log != null) Panel_Info_Log.Debug($"{message}");
|
}
|
|
/// <summary>
|
/// Tact Time Log
|
/// </summary>
|
private ILog Tact_Time_Log = LogManager.GetLogger("Tact_Time");
|
|
/// <summary>
|
/// Tact Time Log Write
|
/// </summary>
|
/// <param name="Methodname">Method name of exception that occurred</param>
|
/// <param name="ex">exception</param>
|
public void Write_Tact_Time_Log(string message)
|
{
|
if (Tact_Time_Log != null) Tact_Time_Log.Debug($"{message}");
|
}
|
|
/// <summary>
|
/// Tact Time Log
|
/// </summary>
|
private ILog Scanner_Log = LogManager.GetLogger("Scanner");
|
|
/// <summary>
|
/// Tact Time Log Write
|
/// </summary>
|
/// <param name="Methodname">Method name of exception that occurred</param>
|
/// <param name="ex">exception</param>
|
public void Write_Scanner_Log(string message)
|
{
|
if (Scanner_Log != null) Scanner_Log.Debug($"{message}");
|
}
|
|
/// <summary>
|
/// Panel Count Log
|
/// </summary>
|
private ILog Panel_Count_Log = LogManager.GetLogger("Panel_Count");
|
|
/// <summary>
|
/// Panel Count Log Write
|
/// </summary>
|
/// <param name="Methodname">Method name of exception that occurred</param>
|
/// <param name="ex">exception</param>
|
public void Write_Panel_Count_Log(string message)
|
{
|
if (Panel_Count_Log != null) Panel_Count_Log.Debug($"{message}");
|
}
|
#endregion
|
|
#region Logger
|
/// <summary>
|
/// Create excepton logger
|
/// </summary>
|
private void Create_Exception_logger()
|
{
|
Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();
|
RollingFileAppender rollingAppender = new RollingFileAppender();
|
|
PatternLayout layout = new PatternLayout();
|
hierarchy.Configured = true;
|
|
rollingAppender.Name = "Exception_RoolingFile";
|
rollingAppender.LockingModel = new RollingFileAppender.MinimalLock();
|
rollingAppender.File = $@"D:\Logger\Exception\";
|
rollingAppender.AppendToFile = true;
|
rollingAppender.DatePattern = "yyyy\\\\MM\\\\'Exception'_dd'.log'";
|
rollingAppender.RollingStyle = RollingFileAppender.RollingMode.Composite;
|
rollingAppender.MaxSizeRollBackups = 10;
|
rollingAppender.MaximumFileSize = "100MB";
|
rollingAppender.StaticLogFileName = false;
|
rollingAppender.Encoding = Encoding.UTF8;
|
rollingAppender.PreserveLogFileNameExtension = true;
|
layout = new PatternLayout("%d{yyyy/MM/dd HH:mm:ss.fff}, %m%n");
|
layout.ActivateOptions();
|
rollingAppender.Layout = layout;
|
rollingAppender.ActivateOptions();
|
|
hierarchy.GetLogger("Exception");
|
ILog log = LogManager.GetLogger("Exception");
|
Logger l = (Logger)log.Logger;
|
l.Level = log4net.Core.Level.Debug;
|
l.AddAppender(rollingAppender);
|
|
Exception_Log = LogManager.GetLogger("Exception");
|
}
|
|
/// <summary>
|
/// Create panel info logger
|
/// </summary>
|
private void Create_Panel_Info_logger()
|
{
|
Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();
|
RollingFileAppender rollingAppender = new RollingFileAppender();
|
|
PatternLayout layout = new PatternLayout();
|
hierarchy.Configured = true;
|
|
rollingAppender.Name = "Panel_Info_RoolingFile";
|
rollingAppender.LockingModel = new RollingFileAppender.MinimalLock();
|
rollingAppender.File = $@"D:\Logger\Panel_Info\";
|
rollingAppender.AppendToFile = true;
|
rollingAppender.DatePattern = "yyyy\\\\MM\\\\'Panel_Info'_dd'.csv'";
|
rollingAppender.RollingStyle = RollingFileAppender.RollingMode.Composite;
|
rollingAppender.MaxSizeRollBackups = 10;
|
rollingAppender.MaximumFileSize = "100MB";
|
rollingAppender.StaticLogFileName = false;
|
rollingAppender.Encoding = Encoding.UTF8;
|
rollingAppender.PreserveLogFileNameExtension = true;
|
layout = new PatternLayout("%d{yyyy/MM/dd HH:mm:ss.fff}, %m%n");
|
layout.ActivateOptions();
|
rollingAppender.Layout = layout;
|
rollingAppender.ActivateOptions();
|
|
hierarchy.GetLogger("Panel_Info");
|
ILog log = LogManager.GetLogger("Panel_Info");
|
Logger l = (Logger)log.Logger;
|
l.Level = log4net.Core.Level.Debug;
|
l.AddAppender(rollingAppender);
|
|
Panel_Info_Log = LogManager.GetLogger("Panel_Info");
|
}
|
|
/// <summary>
|
/// Create tact time logger
|
/// </summary>
|
private void Create_Tact_Time_logger()
|
{
|
Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();
|
RollingFileAppender rollingAppender = new RollingFileAppender();
|
|
PatternLayout layout = new PatternLayout();
|
hierarchy.Configured = true;
|
|
rollingAppender.Name = "Tact_Time_RoolingFile";
|
rollingAppender.LockingModel = new RollingFileAppender.MinimalLock();
|
rollingAppender.File = $@"D:\Logger\Tact_Time\";
|
rollingAppender.AppendToFile = true;
|
rollingAppender.DatePattern = "yyyy\\\\MM\\\\'Tact_Time'_dd'.csv'";
|
rollingAppender.RollingStyle = RollingFileAppender.RollingMode.Composite;
|
rollingAppender.MaxSizeRollBackups = 10;
|
rollingAppender.MaximumFileSize = "100MB";
|
rollingAppender.StaticLogFileName = false;
|
rollingAppender.Encoding = Encoding.UTF8;
|
rollingAppender.PreserveLogFileNameExtension = true;
|
layout = new PatternLayout("%d{yyyy/MM/dd}, %d{HH:mm:ss.fff}, %m%n");
|
layout.ActivateOptions();
|
rollingAppender.Layout = layout;
|
rollingAppender.ActivateOptions();
|
|
hierarchy.GetLogger("Tact_Time");
|
ILog log = LogManager.GetLogger("Tact_Time");
|
Logger l = (Logger)log.Logger;
|
l.Level = log4net.Core.Level.Debug;
|
l.AddAppender(rollingAppender);
|
|
Tact_Time_Log = LogManager.GetLogger("Tact_Time");
|
}
|
|
/// <summary>
|
/// Create Scanner logger
|
/// </summary>
|
private void Create_Scanner_logger()
|
{
|
Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();
|
RollingFileAppender rollingAppender = new RollingFileAppender();
|
|
PatternLayout layout = new PatternLayout();
|
hierarchy.Configured = true;
|
|
rollingAppender.Name = "Scanner_RoolingFile";
|
rollingAppender.LockingModel = new RollingFileAppender.MinimalLock();
|
rollingAppender.File = $@"D:\Logger\Scanner\";
|
rollingAppender.AppendToFile = true;
|
rollingAppender.DatePattern = "yyyy\\\\MM\\\\'Scanner'_dd'.csv'";
|
rollingAppender.RollingStyle = RollingFileAppender.RollingMode.Composite;
|
rollingAppender.MaxSizeRollBackups = 10;
|
rollingAppender.MaximumFileSize = "100MB";
|
rollingAppender.StaticLogFileName = false;
|
rollingAppender.Encoding = Encoding.UTF8;
|
rollingAppender.PreserveLogFileNameExtension = true;
|
layout = new PatternLayout("%d{yyyy/MM/dd}, %d{HH:mm:ss.fff}, %m%n");
|
layout.ActivateOptions();
|
rollingAppender.Layout = layout;
|
rollingAppender.ActivateOptions();
|
|
hierarchy.GetLogger("Scanner");
|
ILog log = LogManager.GetLogger("Scanner");
|
Logger l = (Logger)log.Logger;
|
l.Level = log4net.Core.Level.Debug;
|
l.AddAppender(rollingAppender);
|
|
Scanner_Log = LogManager.GetLogger("Scanner");
|
}
|
|
/// <summary>
|
/// Create Panel Count logger
|
/// </summary>
|
private void Create_panel_count_logger()
|
{
|
Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();
|
RollingFileAppender rollingAppender = new RollingFileAppender();
|
|
PatternLayout layout = new PatternLayout();
|
hierarchy.Configured = true;
|
|
rollingAppender.Name = "Panel_count_RoolingFile";
|
rollingAppender.LockingModel = new RollingFileAppender.MinimalLock();
|
rollingAppender.File = $@"D:\Logger\Panel_Count\";
|
rollingAppender.AppendToFile = true;
|
rollingAppender.DatePattern = "yyyy\\\\MM\\\\'Panel_count'_dd'.csv'";
|
rollingAppender.RollingStyle = RollingFileAppender.RollingMode.Composite;
|
rollingAppender.MaxSizeRollBackups = 10;
|
rollingAppender.MaximumFileSize = "100MB";
|
rollingAppender.StaticLogFileName = false;
|
rollingAppender.Encoding = Encoding.UTF8;
|
rollingAppender.PreserveLogFileNameExtension = true;
|
layout = new PatternLayout("%d{yyyy/MM/dd}, %d{HH:mm:ss.fff}, %m%n");
|
layout.ActivateOptions();
|
rollingAppender.Layout = layout;
|
rollingAppender.ActivateOptions();
|
|
hierarchy.GetLogger("Panel_Count");
|
ILog log = LogManager.GetLogger("Panel_Count");
|
Logger l = (Logger)log.Logger;
|
l.Level = log4net.Core.Level.Debug;
|
l.AddAppender(rollingAppender);
|
|
Panel_Count_Log = LogManager.GetLogger("Panel_Count");
|
}
|
#endregion
|
|
#region Property
|
public int LoaderOutTrayCount
|
{
|
get
|
{
|
int trayCount;
|
object value;
|
|
sm.Get_Value(Process_Memory_Address.LD_Tray_Empty_Count, out value);
|
int.TryParse($"{value}", out trayCount);
|
return trayCount;
|
}
|
set
|
{
|
sm.Set_Value(Process_Memory_Address.LD_Tray_Empty_Count, value);
|
}
|
}
|
|
public int LoaderInTrayCount
|
{
|
get
|
{
|
int trayCount;
|
object value;
|
|
sm.Get_Value(Process_Memory_Address.LD_Tray_In_Count, out value);
|
int.TryParse($"{value}", out trayCount);
|
return trayCount;
|
}
|
set
|
{
|
sm.Set_Value(Process_Memory_Address.LD_Tray_In_Count, value);
|
}
|
}
|
|
public int UnloaderInTrayCount
|
{
|
get
|
{
|
int trayCount;
|
object value;
|
|
sm.Get_Value(Process_Memory_Address.ULD_Tray_Empty_Count, out value);
|
int.TryParse($"{value}", out trayCount);
|
return trayCount;
|
}
|
set
|
{
|
sm.Set_Value(Process_Memory_Address.ULD_Tray_Empty_Count, value);
|
}
|
}
|
|
public int UnloaderOkTrayCount
|
{
|
get
|
{
|
int trayCount;
|
object value;
|
|
sm.Get_Value(Process_Memory_Address.ULD_Tray_Ok_Count, out value);
|
int.TryParse($"{value}", out trayCount);
|
return trayCount;
|
}
|
set
|
{
|
sm.Set_Value(Process_Memory_Address.ULD_Tray_Ok_Count, value);
|
}
|
}
|
|
public int UnloaderNgTrayCount
|
{
|
get
|
{
|
int trayCount;
|
object value;
|
|
sm.Get_Value(Process_Memory_Address.ULD_Tray_Ng_Count, out value);
|
int.TryParse($"{value}", out trayCount);
|
return trayCount;
|
}
|
set
|
{
|
sm.Set_Value(Process_Memory_Address.ULD_Tray_Ng_Count, value);
|
}
|
}
|
|
public Main_Recipe Cur_Main_Recipe
|
{
|
get
|
{
|
object value;
|
|
if (sm.Get_Value(Process_Memory_Address.Main_Recipe_Name, out value))
|
{
|
return Main_Recipe_Manager.Instance.Get_Recipe(value.ToString());
|
}
|
else
|
{
|
return null;
|
}
|
|
}
|
}
|
|
public Parameter_Mode Mode
|
{
|
get
|
{
|
return Parameter_System_Manager.Instance.Get_Mode();
|
}
|
}
|
|
public Parameter_Setting Setting
|
{
|
get
|
{
|
return Parameter_System_Manager.Instance.Get_Setting();
|
}
|
}
|
|
public Parameter_Power Power_Parameter
|
{
|
get
|
{
|
return Parameter_Power_Manager.Instance.Get_Power();
|
}
|
}
|
|
public Equipment_Info equipment_info
|
{
|
get
|
{
|
return Equipment_Info_Manager.Instance.Get_Info();
|
}
|
}
|
|
public Panel_Count_Info panel_count_info
|
{
|
get
|
{
|
if(_panelCountInfo == null)
|
{
|
_panelCountInfo = Panel_Count_Info_Manager.Instance.Get_Panel_Count();
|
}
|
|
return _panelCountInfo;
|
}
|
}
|
|
public En_Film_Judge_Mode Film_Judge_Mode
|
{
|
get
|
{
|
return Mode.Film_Judge_Mode ? En_Film_Judge_Mode.Pre_Align : En_Film_Judge_Mode.Tray_In;
|
}
|
}
|
|
public bool LD_Stop { get; set; }
|
|
public bool Door_Opened
|
{
|
get
|
{
|
return sm.Get_Bit(Input_Memory_Address.Safety_Door_Open_1) ||
|
sm.Get_Bit(Input_Memory_Address.Safety_Door_Open_2) ||
|
sm.Get_Bit(Input_Memory_Address.Safety_Door_Open_3) ||
|
sm.Get_Bit(Input_Memory_Address.Safety_Door_Open_4) ||
|
sm.Get_Bit(Input_Memory_Address.Safety_Door_Open_5) ||
|
sm.Get_Bit(Input_Memory_Address.Safety_Door_Open_6) ||
|
sm.Get_Bit(Input_Memory_Address.Safety_Door_Open_7) ||
|
sm.Get_Bit(Input_Memory_Address.Safety_Door_Open_8) ||
|
sm.Get_Bit(Input_Memory_Address.Safety_Door_Open_9) ||
|
sm.Get_Bit(Input_Memory_Address.Safety_Door_Open_10);
|
}
|
}
|
|
public bool Auto_Mode
|
{
|
get
|
{
|
return sm.Get_Bit(Input_Memory_Address.Safety_Mode_SW_Auto);
|
}
|
}
|
|
public bool Teach_Mode
|
{
|
get
|
{
|
return sm.Get_Bit(Input_Memory_Address.Safety_Mode_SW_Teach);
|
}
|
}
|
|
public bool CleaningMode
|
{
|
get
|
{
|
return _cleaningMode;
|
}
|
}
|
|
public User_Info User
|
{
|
get
|
{
|
return _user;
|
}
|
set
|
{
|
_user = value.Clone();
|
}
|
}
|
#endregion
|
|
#region Field
|
public En_Equipment_Mode equip_mode { get; private set; }
|
public En_Equipment_Status_Code equip_status_code { get; private set; }
|
public En_Equipment_Status equip_status { get; private set; }
|
|
public En_Cim_Mode cim_mode { get; set; }
|
|
public bool IsDisposed { get; private set; }
|
|
public SharedMemory sm;
|
public Sharp_Board_Control Board_Control;
|
|
public BCR_Module LD_Tray_BCR;
|
public BCR_Module Cell_ID_Left_BCR;
|
public BCR_Module Cell_ID_Right_BCR;
|
public BCR_Module ULD_Tray_BCR;
|
|
public Power_Meter power_meter;
|
|
public Scanner scanner;
|
|
public CIM_Server cim_server;
|
public CIM_Client cim_client;
|
|
public Client_Align Align_vision;
|
public Client_AOI Aoi_vision;
|
|
public Sequence_Loader loader;
|
public Sequence_Before before;
|
public Sequence_Process process;
|
public Sequence_After after;
|
public Sequence_Unloader unloader;
|
|
private Thread Data_Update_Th;
|
private Thread Interlock_Check_Th;
|
private Thread Status_Update_Th;
|
private Thread Seq_Logic_Th;
|
private Thread Tower_Lamp_Th;
|
private Thread Auto_Plasma_Set;
|
private Thread Auto_Ion_Set;
|
private Thread Auto_Laser_Set;
|
|
private List<Unit> units;
|
private bool _loaderResetButtonPush;
|
private bool _unloaderResetButtonPush;
|
private bool _keySwitchMode;
|
private bool _cleaningMode;
|
public bool Auto_Power_Bit;
|
|
private Panel_Count_Info _panelCountInfo;
|
private User_Info _user;
|
private SequenceTimer _modeChangeTime = new SequenceTimer();
|
|
private string _programVersion = "001.001.001";
|
#endregion
|
|
#region Construct
|
public Equipment()
|
{
|
IsDisposed = false;
|
sm = new SharedMemory("SHARP_CLAS", 10000, true);
|
sm.Open();
|
|
_user = new User_Info();
|
|
power_meter = new Power_Meter(this, "COM3");
|
power_meter.Open();
|
|
Create_Exception_logger();
|
Create_Panel_Info_logger();
|
Create_Tact_Time_logger();
|
Create_Scanner_logger();
|
Create_panel_count_logger();
|
|
_loaderResetButtonPush = false;
|
_unloaderResetButtonPush = false;
|
|
equip_mode = En_Equipment_Mode.Pause;
|
equip_status_code = En_Equipment_Status_Code.P1;
|
cim_mode = En_Cim_Mode.Offline;
|
|
Board_Control = new Sharp_Board_Control(this);
|
|
LD_Tray_BCR = new BCR_Module("126.100.100.101");
|
Cell_ID_Left_BCR = new BCR_Module("126.100.100.102");
|
Cell_ID_Right_BCR = new BCR_Module("126.100.100.103");
|
ULD_Tray_BCR = new BCR_Module("126.100.100.104");
|
|
scanner = new Scanner(this);
|
|
cim_server = new CIM_Server(this);
|
cim_server.Open();
|
|
cim_client = new CIM_Client(this);
|
|
Align_vision = new Client_Align(this, "126.100.100.11", 8119);
|
Aoi_vision = new Client_AOI(this, "126.100.100.12", 8119);
|
|
Align_vision.Connect();
|
Aoi_vision.Connect();
|
|
Unit_Init();
|
|
Write_Exception_Log("Program Start !");
|
|
_keySwitchMode = Board_Control.IO_manager.Get_Input(InputData.Safety_Mode_SW_Auto);
|
|
if(Cur_Main_Recipe != null)
|
{
|
if(Cur_Main_Recipe.process_info != null)
|
{
|
if(Cur_Main_Recipe.process_info.CTB_File_Path != null)
|
{
|
scanner.Initialize(Cur_Main_Recipe.process_info.CTB_File_Path);
|
}
|
}
|
}
|
|
_modeChangeTime.Start();
|
|
//210923 HSLEE
|
LoadTempGlassOutCnt();
|
Auto_Plasma_Set = new Thread(() => Set_Auto_Plasma());
|
Auto_Ion_Set = new Thread(() => Set_Auto_Ion());
|
Auto_Laser_Set = new Thread(() => Set_Auto_Laser());
|
|
Equipment_Info equip_info = equipment_info;
|
equip_info.Program_Version = _programVersion;
|
Equipment_Info_Manager.Instance.Save_Equipment_Info(equip_info);
|
Thread_Init();
|
Thread_Start();
|
}
|
#endregion
|
|
#region Base_Function
|
private void Unit_Init()
|
{
|
units = new List<Unit>();
|
units.Clear();
|
|
loader = new Sequence_Loader(this);
|
before = new Sequence_Before(this);
|
process = new Sequence_Process(this);
|
after = new Sequence_After(this);
|
unloader = new Sequence_Unloader(this);
|
|
units.Add(loader.ConveyorIn);
|
units.Add(loader.LiftIn);
|
units.Add(loader.ConveyorOut);
|
units.Add(loader.LiftOut);
|
units.Add(loader.TrayTransfer);
|
units.Add(loader.Handler1);
|
|
units.Add(before.ReverseStage);
|
units.Add(before.PreAlignStage);
|
units.Add(before.Handler2);
|
|
units.Add(process.ablation_stage_1);
|
units.Add(process.ablation_stage_2);
|
units.Add(process.fine_align);
|
units.Add(process.ablation);
|
units.Add(process.plasma);
|
|
units.Add(after.Handler2);
|
units.Add(after.ReverseStage);
|
units.Add(after.AoiStage);
|
|
units.Add(unloader.Handler1);
|
units.Add(unloader.LiftIn);
|
units.Add(unloader.LiftOk);
|
units.Add(unloader.LiftNg);
|
units.Add(unloader.ConveyorIn);
|
units.Add(unloader.ConveyorOut);
|
units.Add(unloader.TrayTransfer);
|
}
|
|
private void Thread_Init()
|
{
|
Data_Update_Th = new Thread(Data_Update_Th_Set);
|
Seq_Logic_Th = new Thread(Seq_Logic_Th_Set);
|
Status_Update_Th = new Thread(Status_Update_Th_Set);
|
Interlock_Check_Th = new Thread(Interlock_Check_Th_Set);
|
Tower_Lamp_Th = new Thread(TowerLamp_Th_Set);
|
}
|
|
private void Thread_Start()
|
{
|
Data_Update_Th.Start();
|
Seq_Logic_Th.Start();
|
Status_Update_Th.Start();
|
Interlock_Check_Th.Start();
|
Tower_Lamp_Th.Start();
|
}
|
|
public void Dispose()
|
{
|
IsDisposed = true;
|
Board_Control.Dispose();
|
Align_vision.Dispose();
|
Aoi_vision.Dispose();
|
cim_client.Dispose();
|
cim_server.Close();
|
sm.Close();
|
}
|
#endregion
|
|
#region Thread_Function
|
private void Data_Update_Th_Set()
|
{
|
while (!IsDisposed)
|
{
|
Thread.Sleep(50);
|
DateTime dt = DateTime.Now;
|
Data_Update();
|
TimeSpan ts = (DateTime.Now - dt);
|
}
|
}
|
|
private void Data_Update()
|
{
|
try
|
{
|
if(_loaderResetButtonPush != sm.Get_Bit(Input_Memory_Address.LD_Muting_Reset_PUSH_BUTTON))
|
{
|
_loaderResetButtonPush = sm.Get_Bit(Input_Memory_Address.LD_Muting_Reset_PUSH_BUTTON);
|
|
if(_loaderResetButtonPush)
|
{
|
Set_Load_Tray_Buzzer(false);
|
Board_Control.IO_manager.Set_Output(OutputData.Buzzer_1_Relay, false);
|
Alarm_Manager.Instance.Alarm_Clear();
|
}
|
}
|
|
if(_unloaderResetButtonPush != sm.Get_Bit(Input_Memory_Address.ULD_Muting_Reset_PUSH_BUTTON))
|
{
|
_unloaderResetButtonPush = sm.Get_Bit(Input_Memory_Address.ULD_Muting_Reset_PUSH_BUTTON);
|
|
if (_unloaderResetButtonPush)
|
{
|
if (sm.Get_Bit(Input_Memory_Address.ULD_Ng_Out_Shuttle_Bwd_Sensor) && sm.Get_Bit(Input_Memory_Address.ULD_Ng_Port_Tray_Detect_Sensor))
|
{
|
Interlock_Manager.Add_Interlock_Msg("NG Port Tray Is Exist!", "Tray Remove Please.");
|
}
|
else
|
{
|
if (unloader.LiftNg.MotorZ.MotionComplete)
|
{
|
Set_Unload_Tray_Buzzer(false);
|
Board_Control.IO_manager.Set_Output(OutputData.Buzzer_1_Relay, false);
|
Alarm_Manager.Instance.Alarm_Clear();
|
unloader.LiftNg.Shuttle.Forward();
|
}
|
}
|
}
|
}
|
|
if (sm.Get_Bit(Output_Memory_Address.Safety_Mode_SW_Unlock))
|
{
|
if (_keySwitchMode != sm.Get_Bit(Input_Memory_Address.Safety_Mode_SW_Auto))
|
{
|
_modeChangeTime.Restart();
|
_keySwitchMode = sm.Get_Bit(Input_Memory_Address.Safety_Mode_SW_Auto);
|
Board_Control.IO_manager.Set_Output(OutputData.Safety_Mode_SW_Unlock, false);
|
}
|
}
|
|
//날짜별 panel count 초기화
|
if((panel_count_info.Day_Time.Year != DateTime.Now.Year) || (panel_count_info.Day_Time.DayOfYear != DateTime.Now.DayOfYear))
|
{
|
Write_Panel_Count_Log($"DAY, OK Count,{panel_count_info.Day_ULD_OK_Count},NG Count, {panel_count_info.Day_ULD_NG_Count}");
|
|
panel_count_info.Day_Time = DateTime.Now;
|
panel_count_info.Day_ULD_OK_Count = 0;
|
panel_count_info.Day_ULD_NG_Count = 0;
|
|
Panel_Count_Info_Manager.Instance.Save_Panel_Count_Info(panel_count_info);
|
}
|
|
//30분마다 panel count 초기화
|
double _minute = Math.Abs((DateTime.Now - panel_count_info.Minute_Time).TotalMinutes);
|
if ((_minute >= 5 && (DateTime.Now.Minute == 0 || DateTime.Now.Minute == 30)) || _minute > 60)
|
{
|
Write_Panel_Count_Log($"MINUTE, OK Count,{panel_count_info.Minute_ULD_OK_Count},NG Count, {panel_count_info.Minute_ULD_NG_Count}");
|
|
panel_count_info.Minute_Time = DateTime.Now;
|
panel_count_info.Minute_ULD_OK_Count = 0;
|
panel_count_info.Minute_ULD_NG_Count = 0;
|
|
Panel_Count_Info_Manager.Instance.Save_Panel_Count_Info(panel_count_info);
|
|
//Cim과 설비 시간 동기화.
|
if (cim_mode == En_Cim_Mode.Online)
|
{
|
Set_Cim_Mode(cim_mode);
|
|
}
|
}
|
}
|
catch (Exception)
|
{
|
|
}
|
}
|
|
private void Seq_Logic_Th_Set()
|
{
|
while (!IsDisposed)
|
{
|
Thread.Sleep(10);
|
DateTime dt = DateTime.Now;
|
|
if (!Mode.Auto_Power_Skip && equip_mode == En_Equipment_Mode.Auto && !process.ablation.Is_Power_Measure && Auto_Power_Bit && !loader.Panel_Exist && !before.Panel_Exist && !process.Panel_Exist && !after.Panel_Exist && !unloader.Panel_Exist)
|
{
|
if (process.ablation.Auto_Power_Start())
|
{
|
Auto_Power_Bit = false;
|
}
|
}
|
|
if (Auto_Plasma_Set.ThreadState != ThreadState.Running && Auto_Ion_Set.ThreadState != ThreadState.Running && Auto_Laser_Set.ThreadState != ThreadState.Running)
|
{
|
Seq_Logic();
|
}
|
TimeSpan ts = (DateTime.Now - dt);
|
}
|
}
|
|
private void Seq_Logic()
|
{
|
if (Is_Interlock()) return;
|
|
loader.Seq_Logic();
|
before.Seq_Logic();
|
process.Seq_Logic();
|
after.Seq_Logic();
|
unloader.Seq_Logic();
|
}
|
|
private void Status_Update_Th_Set()
|
{
|
while (!IsDisposed)
|
{
|
Thread.Sleep(10);
|
DateTime dt = DateTime.Now;
|
Status_Update();
|
TimeSpan ts = (DateTime.Now - dt);
|
}
|
}
|
|
private void Status_Update()
|
{
|
if (Alarm_Manager.Instance.Alarm_Status == En_Alarm_Status.HEAVY)
|
{
|
Set_Equipment_Status(En_Equipment_Status.Fault);
|
|
if (equip_mode == En_Equipment_Mode.Auto)
|
{
|
Set_Equipment_Mode(En_Equipment_Mode.Pause);
|
}
|
}
|
else
|
{
|
if (Auto_Mode)
|
{
|
Set_Equipment_Status(En_Equipment_Status.Nomal);
|
}
|
else
|
{
|
Set_Equipment_Status(En_Equipment_Status.Pm);
|
}
|
}
|
|
if(!Mode.Auto_Power_Skip && !process.ablation.Is_Power_Measure && ((DateTime.Now - Power_Parameter.Measure_Date).TotalHours > Power_Parameter.Measurement_Cycle_Hour))
|
{
|
Auto_Power_Bit = true;
|
}
|
}
|
|
private void Interlock_Check_Th_Set()
|
{
|
while (!IsDisposed)
|
{
|
Thread.Sleep(50);
|
DateTime dt = DateTime.Now;
|
Interlock_Check();
|
TimeSpan ts = (DateTime.Now - dt);
|
}
|
}
|
|
private void Interlock_Check()
|
{
|
try
|
{
|
DateTime dt = DateTime.Now;
|
|
if (sm.Get_Bit(Input_Memory_Address.Safety_Door_Open_1)) Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0009_SAFETY_DOOR_1_OPEN);
|
if (sm.Get_Bit(Input_Memory_Address.Safety_Door_Open_2)) Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0010_SAFETY_DOOR_2_OPEN);
|
if (sm.Get_Bit(Input_Memory_Address.Safety_Door_Open_3)) Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0011_SAFETY_DOOR_3_OPEN);
|
if (sm.Get_Bit(Input_Memory_Address.Safety_Door_Open_4)) Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0012_SAFETY_DOOR_4_OPEN);
|
if (sm.Get_Bit(Input_Memory_Address.Safety_Door_Open_5)) Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0013_SAFETY_DOOR_5_OPEN);
|
if (sm.Get_Bit(Input_Memory_Address.Safety_Door_Open_6)) Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0014_SAFETY_DOOR_6_OPEN);
|
if (sm.Get_Bit(Input_Memory_Address.Safety_Door_Open_7)) Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0015_SAFETY_DOOR_7_OPEN);
|
if (sm.Get_Bit(Input_Memory_Address.Safety_Door_Open_8)) Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0016_SAFETY_DOOR_8_OPEN);
|
if (sm.Get_Bit(Input_Memory_Address.Safety_Door_Open_9)) Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0017_SAFETY_DOOR_9_OPEN);
|
if (sm.Get_Bit(Input_Memory_Address.Safety_Door_Open_10)) Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0018_SAFETY_DOOR_10_OPEN);
|
|
if (loader.ConveyorIn.MotorX.ContinuousMotion || loader.ConveyorOut.MotorX.ContinuousMotion)
|
{
|
if (!sm.Get_Bit(Input_Memory_Address.Loading_Light_Curtain_Det))
|
{
|
if(ConveyorInSteps.S0100_AGV_LOADING_START <= loader.ConveyorIn.Step && loader.ConveyorIn.Step <= ConveyorInSteps.S0999_AGV_LOADING_END)
|
{
|
|
}
|
else if(ConveyorOutSteps.S2000_AGV_UNLOADING_START <= loader.ConveyorOut.Step && loader.ConveyorOut.Step <= ConveyorOutSteps.S2999_AGV_UNLOADING_END)
|
{
|
|
}
|
else
|
{
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0052_LD_LIGHT_CURTAIN_ALARM);
|
}
|
}
|
}
|
|
if (unloader.ConveyorIn.MotorX.ContinuousMotion || unloader.ConveyorOut.MotorX.ContinuousMotion)
|
{
|
if (!sm.Get_Bit(Input_Memory_Address.UnLoading_Light_Curtain_Det))
|
{
|
if (ConveyorInSteps.S0100_AGV_LOADING_START <= unloader.ConveyorIn.Step && unloader.ConveyorIn.Step <= ConveyorInSteps.S0999_AGV_LOADING_END)
|
{
|
|
}
|
else if (ConveyorOutSteps.S2000_AGV_UNLOADING_START <= unloader.ConveyorOut.Step && unloader.ConveyorOut.Step <= ConveyorOutSteps.S2999_AGV_UNLOADING_END)
|
{
|
|
}
|
else
|
{
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0053_ULD_LIGHT_CURTAIN_ALARM);
|
}
|
}
|
}
|
|
if (!Align_vision.isConnected) Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0510_ALIGN_VISION_DISCONNECT);
|
if (!Aoi_vision.isConnected) Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0511_AOI_VISION_DISCONNECT);
|
if (!power_meter.isOpen && !Alarm_Manager.Instance.Occured_List.Exists(X => X.Code == En_Alarm_List.AL_0930_POWER_METER_DISCONNECTED)) { Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0930_POWER_METER_DISCONNECTED); power_meter.Open(); }
|
|
if (equip_mode == En_Equipment_Mode.Auto && dt.Second % 10 == 0 && (loader.Panel_Exist && before.Panel_Exist && process.Panel_Exist && after.Panel_Exist && unloader.Panel_Exist) && !units.Exists(x => x.sequenceChangedTime.Minute < 10))
|
{
|
Interlock_Manager.Add_Interlock_Msg("Sequence is Stop", "Please check equipment.");
|
}
|
|
if (panel_count_info.CleaningCount > Setting.Cleaning_Count)
|
{
|
Alarm_Manager.Instance.Occurred(En_Alarm_List.AL_0970_CLEANING_TIME);
|
LD_Stop = true;
|
panel_count_info.CleaningCount = 0;
|
Panel_Count_Info_Manager.Instance.Save_Panel_Count_Info(panel_count_info);
|
}
|
}
|
catch(Exception e)
|
{
|
|
}
|
}
|
|
private void TowerLamp_Th_Set()
|
{
|
while (!this.IsDisposed)
|
{
|
TowerLamp_Status();
|
Thread.Sleep(500);
|
}
|
}
|
|
private void TowerLamp_Status()
|
{
|
if (Board_Control.BoardMode != MMCE_Test.NMCSDKLib.EcMstMode.eMM_RUN) return;
|
|
// Red : 설비 Err 및 운전 불가능 (점등), 설비 Err 및 운전 가능 (점멸), 설비 Err 無 (소등)
|
if (equip_status == En_Equipment_Status.Fault)
|
{
|
//점등.
|
Board_Control.IO_manager.Set_Output(OutputData.Tower_Lamp_R, true);
|
}
|
else
|
{
|
if (Alarm_Manager.Instance.Alarm_Status == En_Alarm_Status.LIGHT)
|
{
|
//점멸.
|
Board_Control.IO_manager.Set_Output(OutputData.Tower_Lamp_R, !Board_Control.IO_manager.Get_Output(OutputData.Tower_Lamp_R));
|
}
|
else if (Alarm_Manager.Instance.Alarm_Status == En_Alarm_Status.NONE)
|
{
|
//소등.
|
Board_Control.IO_manager.Set_Output(OutputData.Tower_Lamp_R, false);
|
}
|
}
|
|
// Yellow : 수동 운전 모드(점등), 자동 운전 모드 (소등)
|
if (equip_mode == En_Equipment_Mode.Auto)
|
{
|
//소등
|
Board_Control.IO_manager.Set_Output(OutputData.Tower_Lamp_Y, false);
|
}
|
else
|
{
|
//점등.
|
Board_Control.IO_manager.Set_Output(OutputData.Tower_Lamp_Y, true);
|
|
}
|
|
//Green : 동작중 (점등), 대기중(점멸) (Auto에서 LD쪽 Tray X, 설비 내부 Panel X), 정지중(소등)
|
if (equip_status == En_Equipment_Status.Nomal)
|
{
|
if(equip_mode == En_Equipment_Mode.Auto)
|
{
|
//점등.
|
Board_Control.IO_manager.Set_Output(OutputData.Tower_Lamp_G, true);
|
}
|
else if (equip_mode == En_Equipment_Mode.Manual)
|
{
|
//점등.
|
Board_Control.IO_manager.Set_Output(OutputData.Tower_Lamp_G, !Board_Control.IO_manager.Get_Output(OutputData.Tower_Lamp_G));
|
}
|
}
|
else if (equip_status == En_Equipment_Status.Fault || equip_mode != En_Equipment_Mode.Auto)
|
{
|
//소등.
|
Board_Control.IO_manager.Set_Output(OutputData.Tower_Lamp_G, false);
|
}
|
|
// Blue : 온라인상태 (점등), 오프라인(소등)
|
if (cim_mode == En_Cim_Mode.Online)
|
Board_Control.IO_manager.Set_Output(OutputData.Tower_Lamp_B, true);
|
else
|
Board_Control.IO_manager.Set_Output(OutputData.Tower_Lamp_B, false);
|
|
if(sm.Get_Bit(Input_Memory_Address.LD_Tray_In_Conveyor_In_Sensor) || sm.Get_Bit(Input_Memory_Address.LD_Tray_In_Conveyor_In_Complete_Sensor) || sm.Get_Bit(Input_Memory_Address.LD_Tray_In_Conveyor_Lift_In_Sensor) || sm.Get_Bit(Input_Memory_Address.LD_Tray_In_Conveyor_Lift_In_Complete_Sensor))
|
{
|
if(!sm.Get_Bit(Output_Memory_Address.LD_Tray_In_Muting_PILOT_Lamp))
|
Board_Control.IO_manager.Set_Output(OutputData.LD_Tray_In_Muting_PILOT_Lamp, true);
|
}
|
else
|
{
|
if (sm.Get_Bit(Output_Memory_Address.LD_Tray_In_Muting_PILOT_Lamp))
|
Board_Control.IO_manager.Set_Output(OutputData.LD_Tray_In_Muting_PILOT_Lamp, false);
|
}
|
|
if(sm.Get_Bit(Input_Memory_Address.LD_Tray_Out_Conveyor_In_Sensor) || sm.Get_Bit(Input_Memory_Address.LD_Tray_Out_Conveyor_In_Complete_Sensor) || sm.Get_Bit(Input_Memory_Address.LD_Tray_Out_Conveyor_Lift_in_Sensor) || sm.Get_Bit(Input_Memory_Address.LD_Tray_Out_Conveyor_Lift_in_Complete_Sensor))
|
{
|
if (!sm.Get_Bit(Output_Memory_Address.LD_Tray_Out_Muting_PILOT_Lamp))
|
Board_Control.IO_manager.Set_Output(OutputData.LD_Tray_Out_Muting_PILOT_Lamp, true);
|
}
|
else
|
{
|
if (sm.Get_Bit(Output_Memory_Address.LD_Tray_Out_Muting_PILOT_Lamp))
|
Board_Control.IO_manager.Set_Output(OutputData.LD_Tray_Out_Muting_PILOT_Lamp, false);
|
}
|
|
if(sm.Get_Bit(Input_Memory_Address.ULD_Empty_In_Conveyor_In_Sensor) || sm.Get_Bit(Input_Memory_Address.ULD_Empty_In_Conveyor_In_Complete_Sensor) || sm.Get_Bit(Input_Memory_Address.ULD_Empty_In_Conveyor_Lift_In_Sensor) || sm.Get_Bit(Input_Memory_Address.ULD_Empty_In_Conveyor_Lift_In_Complete_Sensor))
|
{
|
if (!sm.Get_Bit(Output_Memory_Address.ULD_Tray_In_Muting_PILOT_Lamp))
|
Board_Control.IO_manager.Set_Output(OutputData.ULD_Tray_In_Muting_PILOT_Lamp, true);
|
}
|
else
|
{
|
if (sm.Get_Bit(Output_Memory_Address.ULD_Tray_In_Muting_PILOT_Lamp))
|
Board_Control.IO_manager.Set_Output(OutputData.ULD_Tray_In_Muting_PILOT_Lamp, false);
|
}
|
|
if (sm.Get_Bit(Input_Memory_Address.ULD_Ok_Out_Conveyor_In_Sensor) || sm.Get_Bit(Input_Memory_Address.ULD_Ok_Out_Conveyor_Out_Sensor) || sm.Get_Bit(Input_Memory_Address.ULD_Ok_Out_Conveyor_Lift_In_Sensor) || sm.Get_Bit(Input_Memory_Address.ULD_Ok_Out_Conveyor_Lift_Out_Sensor) ||
|
sm.Get_Bit(Output_Memory_Address.ULD_Ng_Tray_Shuttle_Bwd_Sol_Valve) || sm.Get_Bit(Input_Memory_Address.ULD_Ng_Out_Shuttle_Bwd_Sensor))
|
{
|
if (!sm.Get_Bit(Output_Memory_Address.ULD_Tray_Out_Muting_PILOT_Lamp))
|
Board_Control.IO_manager.Set_Output(OutputData.ULD_Tray_Out_Muting_PILOT_Lamp, true);
|
}
|
else
|
{
|
if (sm.Get_Bit(Output_Memory_Address.ULD_Tray_Out_Muting_PILOT_Lamp))
|
Board_Control.IO_manager.Set_Output(OutputData.ULD_Tray_Out_Muting_PILOT_Lamp, false);
|
}
|
|
if(sm.Get_Bit(Input_Memory_Address.Laser_Active) && !sm.Get_Bit(Output_Memory_Address.LASER_LED_Electronic_Board))
|
{
|
Board_Control.IO_manager.Set_Output(OutputData.LASER_LED_Electronic_Board, true);
|
}
|
else if (!sm.Get_Bit(Input_Memory_Address.Laser_Active) && sm.Get_Bit(Output_Memory_Address.LASER_LED_Electronic_Board))
|
{
|
Board_Control.IO_manager.Set_Output(OutputData.LASER_LED_Electronic_Board, false);
|
}
|
}
|
|
private void Set_Auto_Plasma()
|
{
|
int step = 10;
|
|
bool process = true;
|
while(process)
|
{
|
switch(step)
|
{
|
case 10:
|
{
|
if(Board_Control.IO_manager.Get_Output(OutputData.Plasma_Blower))
|
{
|
step = 30;
|
}
|
else
|
{
|
step = 20;
|
}
|
break;
|
}
|
case 20:
|
{
|
if(Board_Control.IO_manager.Set_Output(OutputData.Plasma_Blower, true))
|
{
|
step = 10;
|
}
|
break;
|
}
|
case 30:
|
{
|
if(Board_Control.IO_manager.Get_Output(OutputData.Plasma_EXT_Interlock_Relay))
|
{
|
step = 50;
|
}
|
else
|
{
|
step = 40;
|
}
|
break;
|
}
|
case 40:
|
{
|
if(Board_Control.IO_manager.Set_Output(OutputData.Plasma_EXT_Interlock_Relay, true))
|
{
|
step = 30;
|
}
|
break;
|
}
|
case 50:
|
{
|
if(Board_Control.IO_manager.Get_Output(OutputData.Plasma_Mode_Relay))
|
{
|
step = 70;
|
}
|
else
|
{
|
step = 60;
|
}
|
break;
|
}
|
case 60:
|
{
|
if(Board_Control.IO_manager.Set_Output(OutputData.Plasma_Mode_Relay, true))
|
{
|
step = 50;
|
}
|
break;
|
}
|
case 70:
|
{
|
process = false;
|
break;
|
}
|
}
|
}
|
}
|
|
private void Set_Auto_Ion()
|
{
|
int step = 10;
|
|
bool process = true;
|
|
while (process)
|
{
|
switch (step)
|
{
|
case 10:
|
{
|
if (Board_Control.IO_manager.Get_Output(OutputData.LD_Ion_Bar_Sol_Valve))
|
{
|
step = 20;
|
}
|
else
|
{
|
Board_Control.IO_manager.Set_Output(OutputData.LD_Ion_Bar_Sol_Valve, true);
|
}
|
break;
|
}
|
case 20:
|
{
|
if (Board_Control.IO_manager.Get_Output(OutputData.Ablation_Ion_Bar_Sol_Valve))
|
{
|
step = 30;
|
}
|
else
|
{
|
Board_Control.IO_manager.Set_Output(OutputData.Ablation_Ion_Bar_Sol_Valve, true);
|
}
|
break;
|
}
|
case 30:
|
{
|
if (Board_Control.IO_manager.Get_Output(OutputData.Plasma_Ion_Bar_Sol_Valve))
|
{
|
step = 40;
|
}
|
else
|
{
|
Board_Control.IO_manager.Set_Output(OutputData.Plasma_Ion_Bar_Sol_Valve, true);
|
}
|
break;
|
}
|
case 40:
|
{
|
if (Board_Control.IO_manager.Get_Output(OutputData.ULD_Ion_Bar_Sol_Valve))
|
{
|
step = 50;
|
}
|
else
|
{
|
Board_Control.IO_manager.Set_Output(OutputData.ULD_Ion_Bar_Sol_Valve, true);
|
}
|
break;
|
}
|
case 50:
|
{
|
if (Board_Control.IO_manager.Get_Output(OutputData.LD_Ion_Bar_On_Relay))
|
{
|
step = 60;
|
}
|
else
|
{
|
Board_Control.IO_manager.Set_Output(OutputData.LD_Ion_Bar_On_Relay, true);
|
}
|
break;
|
}
|
case 60:
|
{
|
if (Board_Control.IO_manager.Get_Output(OutputData.Ablation_Ion_Bar_On_Relay))
|
{
|
step = 70;
|
}
|
else
|
{
|
Board_Control.IO_manager.Set_Output(OutputData.Ablation_Ion_Bar_On_Relay, true);
|
}
|
break;
|
}
|
case 70:
|
{
|
if (Board_Control.IO_manager.Get_Output(OutputData.Plasma_Ion_Bar_On_Relay))
|
{
|
step = 80;
|
}
|
else
|
{
|
Board_Control.IO_manager.Set_Output(OutputData.Plasma_Ion_Bar_On_Relay, true);
|
}
|
break;
|
}
|
case 80:
|
{
|
if (Board_Control.IO_manager.Get_Output(OutputData.ULD_Ion_Bar_On_Relay))
|
{
|
step = 90;
|
}
|
else
|
{
|
Board_Control.IO_manager.Set_Output(OutputData.ULD_Ion_Bar_On_Relay, true);
|
}
|
break;
|
}
|
case 90:
|
{
|
Set_DustCollector(true);
|
step = 100;
|
break;
|
}
|
case 100:
|
{
|
process = false;
|
break;
|
}
|
}
|
}
|
}
|
|
private void Set_Auto_Laser()
|
{
|
int step = 0;
|
|
bool process = true;
|
|
while (process)
|
{
|
switch (step)
|
{
|
case 0:
|
{
|
if(this.process.ablation.Step > AblationSteps.S0000_WAIT)
|
{
|
step = 10;
|
}
|
else if(scanner.Initialize(Cur_Main_Recipe.process_info.CTB_File_Path))
|
{
|
step = 5;
|
}
|
break;
|
}
|
case 5:
|
{
|
if(scanner.Home())
|
{
|
step = 6;
|
}
|
break;
|
}
|
case 6:
|
{
|
short x, y;
|
if(scanner.Get_Position(out x, out y))
|
{
|
if(x == 0 && y == 0)
|
{
|
step = 10;
|
}
|
}
|
|
break;
|
}
|
case 10:
|
{
|
if (Board_Control.IO_manager.Get_Output(OutputData.Laser_Interlock))
|
{
|
step = 20;
|
}
|
else
|
{
|
Board_Control.IO_manager.Set_Output(OutputData.Laser_Interlock, true);
|
}
|
break;
|
}
|
case 20:
|
{
|
if (Board_Control.IO_manager.Get_Output(OutputData.Laser_Shutter_Open))
|
{
|
step = 30;
|
}
|
else
|
{
|
Board_Control.IO_manager.Set_Output(OutputData.Laser_Shutter_Open, true);
|
}
|
break;
|
}
|
case 30:
|
{
|
if (Board_Control.IO_manager.Get_Output(OutputData.Laser_Shutter_Open_Sensor))
|
{
|
step = 40;
|
}
|
else
|
{
|
Board_Control.IO_manager.Set_Output(OutputData.Laser_Shutter_Open_Sensor, true);
|
}
|
break;
|
}
|
case 40:
|
{
|
process = false;
|
break;
|
}
|
}
|
}
|
}
|
|
public void Set_DustCollector(bool onOff)
|
{
|
Board_Control.IO_manager.Set_Output(OutputData.Dust_Collector_On, onOff);
|
}
|
#endregion
|
|
#region Set_Function
|
public void Set_Load_Tray_Buzzer(bool value)
|
{
|
Board_Control.IO_manager.Set_Output(OutputData.Buzzer_3_Relay, value);
|
}
|
|
public void Set_Unload_Tray_Buzzer(bool value)
|
{
|
Board_Control.IO_manager.Set_Output(OutputData.Buzzer_4_Relay, value);
|
}
|
|
public bool Is_Home_Complete
|
{
|
get
|
{
|
return loader.Is_Home_Complete && before.Is_Home_Complete && process.Is_Home_Complete && after.Is_Home_Complete && unloader.Is_Home_Complete;
|
}
|
}
|
|
public bool Set_Equipment_Mode(En_Equipment_Mode mode)
|
{
|
if (mode == equip_mode) return true;
|
|
if(mode == En_Equipment_Mode.Auto)
|
{
|
if (equip_mode == En_Equipment_Mode.Stop)
|
{
|
Interlock_Manager.Add_Interlock_Msg("Can't Change auto mode.", "You can change auto mode in pause mode or manual mode.");
|
return false;
|
}
|
else if (equip_mode == En_Equipment_Mode.Pause || equip_mode == En_Equipment_Mode.Manual)
|
{
|
if(!Auto_Mode)
|
{
|
Interlock_Manager.Add_Interlock_Msg("Can't Change auto mode.", "Could change Key to Auto.");
|
return false;
|
}
|
|
if(!Is_Home_Complete)
|
{
|
Interlock_Manager.Add_Interlock_Msg("Can't Change auto mode.", "Please Set Home.");
|
return false;
|
}
|
|
if (Cur_Main_Recipe == null || Cur_Main_Recipe.tray_info == null || Cur_Main_Recipe.vision_info == null || Cur_Main_Recipe.panel_type_info == null || Cur_Main_Recipe.process_info == null)
|
{
|
Interlock_Manager.Add_Interlock_Msg("Can't Change auto mode.", "Please check main recipe.");
|
return false;
|
}
|
|
if(units.Exists(X=> X.UnitMode != equip_mode))
|
{
|
Interlock_Manager.Add_Interlock_Msg("Can't Change auto mode.", "Other Unit is not same mode.");
|
return false;
|
}
|
|
Auto_Plasma_Set = new Thread(() => Set_Auto_Plasma());
|
Auto_Plasma_Set.Start();
|
|
Auto_Ion_Set = new Thread(() => Set_Auto_Ion());
|
Auto_Ion_Set.Start();
|
|
Auto_Laser_Set = new Thread(() => Set_Auto_Laser());
|
Auto_Laser_Set.Start();
|
|
equip_mode = mode;
|
units.ForEach(x => x.UnitMode = mode);
|
|
sm.Set_Value(Data_Interpretation_Memory_Address.Machine_Status, (int)En_Equipment_Mode.Auto); //210916 hslee
|
return true;
|
}
|
}
|
else if(mode == En_Equipment_Mode.Pause)
|
{
|
if(equip_mode == En_Equipment_Mode.Auto || equip_mode == En_Equipment_Mode.Manual)
|
{
|
equip_mode = mode;
|
}
|
else
|
{
|
equip_mode = mode;
|
units.ForEach(x => x.UnitMode = mode);
|
}
|
|
sm.Set_Value(Data_Interpretation_Memory_Address.Machine_Status, (int)En_Equipment_Mode.Pause); //210916 hslee
|
return true;
|
}
|
else if(mode == En_Equipment_Mode.Manual)
|
{
|
if (equip_mode == En_Equipment_Mode.Stop)
|
{
|
Interlock_Manager.Add_Interlock_Msg("Can't Change manual mode.", "You can change manual mode in pause mode.");
|
return false;
|
}
|
else if (equip_mode == En_Equipment_Mode.Pause)
|
{
|
if (!Auto_Mode)
|
{
|
Interlock_Manager.Add_Interlock_Msg("Can't Change manual mode.", "Could change Key to Auto.");
|
return false;
|
}
|
|
if (!Is_Home_Complete)
|
{
|
Interlock_Manager.Add_Interlock_Msg("Can't Change manual mode.", "Please Set Home.");
|
return false;
|
}
|
|
if (Cur_Main_Recipe == null || Cur_Main_Recipe.tray_info == null || Cur_Main_Recipe.vision_info == null || Cur_Main_Recipe.panel_type_info == null || Cur_Main_Recipe.process_info == null)
|
{
|
Interlock_Manager.Add_Interlock_Msg("Can't Change manual mode.", "Please check main recipe.");
|
return false;
|
}
|
|
if (units.Exists(X => X.UnitMode != equip_mode))
|
{
|
Interlock_Manager.Add_Interlock_Msg("Can't Change manual mode.", "Other Unit is not same mode.");
|
return false;
|
}
|
|
Auto_Plasma_Set = new Thread(() => Set_Auto_Plasma());
|
Auto_Plasma_Set.Start();
|
|
Auto_Ion_Set = new Thread(() => Set_Auto_Ion());
|
Auto_Ion_Set.Start();
|
|
Auto_Laser_Set = new Thread(() => Set_Auto_Laser());
|
Auto_Laser_Set.Start();
|
|
equip_mode = mode;
|
units.ForEach(x => x.UnitMode = mode);
|
sm.Set_Value(Data_Interpretation_Memory_Address.Machine_Status, (int)En_Equipment_Mode.Manual); //210916 hslee
|
return true;
|
}
|
}
|
else if(mode == En_Equipment_Mode.Stop)
|
{
|
if(equip_mode != En_Equipment_Mode.Pause)
|
{
|
return false;
|
}
|
|
Set_DustCollector(false);
|
equip_mode = mode;
|
units.ForEach(x => x.UnitMode = mode);
|
sm.Set_Value(Data_Interpretation_Memory_Address.Machine_Status, (int)En_Equipment_Mode.Stop); //210916 hslee
|
return true;
|
}
|
else if (mode == En_Equipment_Mode.Home)
|
{
|
if (equip_mode != En_Equipment_Mode.Stop)
|
{
|
return false;
|
}
|
equip_mode = mode;
|
units.ForEach(x => x.UnitMode = mode);
|
sm.Set_Value(Data_Interpretation_Memory_Address.Machine_Status, (int)En_Equipment_Mode.Home); //210916 hslee
|
return true;
|
}
|
return false;
|
}
|
|
public bool Set_Equipment_Status(En_Equipment_Status status)
|
{
|
equip_status = status;
|
|
return true;
|
}
|
|
public bool Set_Equipment_Status_Code(En_Equipment_Status_Code code)
|
{
|
if (cim_mode != En_Cim_Mode.Online)
|
{
|
return true;
|
}
|
|
if (equip_status_code != code)
|
{
|
equip_status_code = code;
|
|
return cim_client.Send_Equipment_Status("E1234567");
|
}
|
|
return true;
|
}
|
|
public void Set_Cim_Mode(En_Cim_Mode mode)
|
{
|
if(mode == En_Cim_Mode.Online)
|
{
|
cim_client.Send_On_Line("E1234567", true);
|
}
|
else
|
{
|
cim_client.Send_On_Line("E1234567", false);
|
}
|
}
|
|
public void Set_All_Door_Open(bool open)
|
{
|
if (!Teach_Mode || _modeChangeTime.Seconds < 3) return;
|
|
Board_Control.IO_manager.Set_Output(OutputData.Safety_Door_Open_1, open);
|
Board_Control.IO_manager.Set_Output(OutputData.Safety_Door_Open_2, open);
|
Board_Control.IO_manager.Set_Output(OutputData.Safety_Door_Open_3, open);
|
Board_Control.IO_manager.Set_Output(OutputData.Safety_Door_Open_4, open);
|
Board_Control.IO_manager.Set_Output(OutputData.Safety_Door_Open_5, open);
|
Board_Control.IO_manager.Set_Output(OutputData.Safety_Door_Open_6, open);
|
Board_Control.IO_manager.Set_Output(OutputData.Safety_Door_Open_7, open);
|
Board_Control.IO_manager.Set_Output(OutputData.Safety_Door_Open_8, open);
|
Board_Control.IO_manager.Set_Output(OutputData.Safety_Door_Open_9, open);
|
Board_Control.IO_manager.Set_Output(OutputData.Safety_Door_Open_10, open);
|
}
|
|
public void Set_Cleaning_Position(bool Cleaning)
|
{
|
try
|
{
|
if (Cur_Main_Recipe == null) return;
|
|
if (Cleaning)
|
{
|
/*
|
-> 가공 스테이지 언로더 위치로
|
-> ULD Handler #2와 Plasma를 B2 위치로
|
-> fine Camera랑 LD Handler #2로 B2 위치로
|
220608 추가 Ablation 0 위치로
|
*/
|
before.Handler2.Move_X_Ablation_Stage_2_Position();
|
|
process.fine_align.Move_Cleaning_Position();
|
process.ablation_stage_1.Move_Y_Unload_Position();
|
process.ablation_stage_2.Move_Y_Unload_Position();
|
process.plasma.Move_Cleaning_Position();
|
process.ablation.Move_Cleaning_Position();
|
|
after.Handler2.Move_X_AOI_Position();
|
|
if (after.ReverseStage.IsStayPosition)
|
{
|
after.Handler2.Move_Y_AOI_Position();
|
}
|
|
_cleaningMode = true;
|
}
|
else
|
{
|
before.Handler2.Move_X_Stay_Position();
|
|
process.ablation_stage_1.Move_Y_Load_Position();
|
process.ablation_stage_2.Move_Y_Load_Position();
|
process.ablation.Stage1WaitPositionMove();
|
|
after.Handler2.Move_X_Stay_Position();
|
after.Handler2.Move_Y_Stay_Position();
|
|
_cleaningMode = false;
|
}
|
}
|
catch(Exception e)
|
{
|
|
}
|
}
|
#endregion
|
|
#region Get_Function
|
public bool Is_Interlock()
|
{
|
bool check = false;
|
|
if (Board_Control.BoardMode != MMCE_Test.NMCSDKLib.EcMstMode.eMM_RUN)
|
{
|
Interlock_Manager.Add_Interlock_Msg("Logic working Interlock ", "Board Control is Not Run Mode.");
|
check = true;
|
}
|
|
if(Cur_Main_Recipe == null || Cur_Main_Recipe.tray_info == null || Cur_Main_Recipe.vision_info == null || Cur_Main_Recipe.panel_type_info == null || Cur_Main_Recipe.process_info == null)
|
{
|
Interlock_Manager.Add_Interlock_Msg("Logic working Interlock ", "Recipe is Not Applied.");
|
check = true;
|
}
|
|
if (equip_mode == En_Equipment_Mode.Auto)
|
{
|
if (Auto_Plasma_Set == null || Auto_Ion_Set == null || Auto_Laser_Set == null)
|
check = true;
|
else
|
{
|
if (Auto_Plasma_Set.ThreadState == ThreadState.Running || Auto_Ion_Set.ThreadState == ThreadState.Running || Auto_Laser_Set.ThreadState == ThreadState.Running)
|
check = true;
|
}
|
}
|
return check;
|
}
|
|
public bool Is_Exist()
|
{
|
if(units.Exists(x => x.IsExist == true))
|
{
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
}
|
|
public bool Is_Clean_Position_Eanble()
|
{
|
if (units.Exists(x => (x == unloader.TrayTransfer || x == unloader.ConveyorIn || x == unloader.ConveyorOut || x == loader.ConveyorIn || x == loader.ConveyorOut || x == loader.LiftIn || x == loader.LiftOut || x == unloader.LiftIn || x == unloader.LiftOk || x == unloader.LiftNg) ? false : x.IsExist))
|
{
|
return false;
|
}
|
else
|
{
|
return true;
|
}
|
}
|
#endregion
|
|
#region ETC_hslee
|
public void SaveTempGlassOutCnt()
|
{
|
string strData = "";
|
object value1, value2, value3;
|
|
string strFilename = @"C:\SHARP_CLAS\Config\GLASS_DATA\TempOutCnt.csv";
|
string strFilePath = @"C:\SHARP_CLAS\Config\GLASS_DATA\";
|
|
Monitor.Enter(_objLock);
|
|
try
|
{
|
if (!Directory.Exists(strFilePath))
|
{
|
Directory.CreateDirectory(strFilePath);
|
}
|
|
if (!File.Exists(strFilename))
|
{
|
FileStream stream = File.Create(strFilename);
|
stream.Close();
|
}
|
|
using (FileStream fs = new FileStream(strFilename, FileMode.Truncate, FileAccess.ReadWrite, FileShare.ReadWrite))
|
{
|
using (StreamWriter sw = new StreamWriter(fs, Encoding.Default))
|
{
|
sm.Get_Value(Process_Memory_Address.Tray_Info_Recipe_Name, out value1);
|
sm.Get_Value(Data_Interpretation_Memory_Address.OK_Out_Cnt, out value2);
|
sm.Get_Value(Data_Interpretation_Memory_Address.NG_Out_Cnt, out value3);
|
strData = string.Format("{0}, {1}, {2}", value1.ToString(), value2.ToString(), value3.ToString());
|
sw.WriteLine(strData);
|
}
|
}
|
}
|
catch (Exception ee)
|
{
|
|
}
|
Monitor.Exit(_objLock);
|
}
|
|
public void LoadTempGlassOutCnt()
|
{
|
string sr_line = "";
|
string strFilename = @"C:\SHARP_CLAS\Config\GLASS_DATA\TempOutCnt.csv";
|
object value;
|
try
|
{
|
if (File.Exists(strFilename))
|
{
|
using (StreamReader read = new StreamReader(strFilename))
|
{
|
sr_line = read.ReadLine();
|
string[] readData = sr_line.Split(new Char[] { ',' });
|
sm.Get_Value(Process_Memory_Address.Tray_Info_Recipe_Name, out value);
|
if (readData[0] != value.ToString())
|
{
|
//Recipe가 다른 경우 0으로 리셋
|
sm.Set_Value(Data_Interpretation_Memory_Address.OK_Out_Cnt, 0);
|
sm.Set_Value(Data_Interpretation_Memory_Address.NG_Out_Cnt, 0);
|
sm.Set_Bit(Data_Interpretation_Memory_Address.RecipeChanged, true);
|
}
|
else
|
{
|
sm.Set_Value(Data_Interpretation_Memory_Address.OK_Out_Cnt, Convert.ToInt32(readData[1]));
|
sm.Set_Value(Data_Interpretation_Memory_Address.NG_Out_Cnt, Convert.ToInt32(readData[2]));
|
}
|
read.Dispose();
|
}
|
}
|
else
|
{
|
sm.Set_Value(Data_Interpretation_Memory_Address.OK_Out_Cnt, 0);
|
sm.Set_Value(Data_Interpretation_Memory_Address.NG_Out_Cnt, 0);
|
sm.Set_Bit(Data_Interpretation_Memory_Address.RecipeChanged, true);
|
}
|
}
|
catch (Exception ee)
|
{
|
sm.Set_Value(Data_Interpretation_Memory_Address.OK_Out_Cnt, 0);
|
sm.Set_Value(Data_Interpretation_Memory_Address.NG_Out_Cnt, 0);
|
sm.Set_Bit(Data_Interpretation_Memory_Address.RecipeChanged, true);
|
}
|
}
|
#endregion
|
}
|
}
|