You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

468 lines
20 KiB
C++

#pragma once
#include "module.h"
#include "SecsEquip.h" //金南瓜头文件
#include "SecsEquip300.h"
#include "RecipeMgr.h"
#include "TransferArmMgr.h"
//发送给服务器的事件
enum eSecsEquipEvent
{
_SecsEvent_Null = 0,
_SecsEvent_PorcessStateChanged,//过程状态变化
_SecsEvent_Port1StatusChanged,//Port1 状态变化
_SecsEvent_Port2StatusChanged,//Port2 状态变化
_SecsEvent_FoupLoadMap_Start,
_SecsEvent_FoupLoadMap_End,
_SecsEvent_FoupUnload_Start,
_SecsEvent_FoupUnload_End,
_SecsEvent_LaserWarmup_Start,
_SecsEvent_LaserWarmup_End,
_SecsEvent_Wafer_FoupToArm1_Start,
_SecsEvent_Wafer_FoupToArm1_End,
_SecsEvent_Wafer_Arm1ToAligner_Start,
_SecsEvent_Wafer_Arm1ToAligner_End,
_SecsEvent_Wafer_Aligner_Start,
_SecsEvent_Wafer_Aligner_End,
_SecsEvent_Wafer_AlignerToArm2_Start,
_SecsEvent_Wafer_AlignerToArm2_End,
_SecsEvent_Wafer_Arm2ToAligner_Start,
_SecsEvent_Wafer_Arm2ToAligner_End,
_SecsEvent_Wafer_Arm2ToStage_Start,
_SecsEvent_Wafer_Arm2ToStage_End,
_SecsEvent_Wafer_StageToArm1_Start,
_SecsEvent_Wafer_StageToArm1_End,
_SecsEvent_Wafer_StageToArm2_Start,
_SecsEvent_Wafer_StageToArm2_End,
_SecsEvent_Wafer_AlignerToArm1_Start,
_SecsEvent_Wafer_AlignerToArm1_End,
_SecsEvent_Wafer_Arm1ToFoup_Start,
_SecsEvent_Wafer_Arm1ToFoup_End,
_SecsEvent_Wafer_Process_Start,
_SecsEvent_Wafer_Process_End,
_SecsEvent_Wafer_FoucsAdjust_Start,
_SecsEvent_Wafer_FoucsAdjust_End,
_SecsEvent_Wafer_EdiCheck_Start,
_SecsEvent_Wafer_EdiCheck_End,
_SecsEvent_Wafer_Anneal_Start,
_SecsEvent_Wafer_Anneal_End,
_SecsEvent_Beam_Check_Start,
_SecsEvent_Beam_Check_End,
_SecsEvent_Max,
};
//设备流程状态
enum ESecsProcessState
{
_ProcessState_INIT = 0,//初始化中
_ProcessState_IDLE,//待机状态
_ProcessState_IDLE_WITH_ALARMS,//待机(有报警)
//_ProcessState_READY,//准备完成(收到PP-SELECT 后,然后等待MAP-CASSETTE和START)
_ProcessState_SETTING_UP,//加工前准备(job start 之后load 之前的状态,设置激光参数...)
_ProcessState_LOAD,//上料
_ProcessState_PROCESSING,//加工中
_ProcessState_UNLOAD,//退料
_ProcessState_PAUSED,//已暂停
_ProcessState_ALARM_PAUSED,//已暂停,并且有报警
_ProcessState_Null,//未定义
};
//port 的状态
enum ESecsPortState
{
_PortState_NoCassette = 0,//没有检测到料盒
_PortState_Cassette,//料盒放上去
_PortState_Idle,//等待指令(可以接收PP-SELECT 指令)
_PortState_Mapping,//mapping
_PortState_MappingComplete,//mapping 完成
_PortState_Ready,//job 创建完成(waiting 状态),等待加工
_PortState_Processing,//加工中
_PortState_Paused,//暂停
_PortState_Stop,//结束
_PortState_Null,//未定义
};
//和服务器通信用的参数
class CSecsCommPar
{
public:
CSecsCommPar(void);
public:
CString m_SocketAddress;//Socket IP地址(服务器地址,被动模式不用设置)
int m_SocketPort;//Socket 端口号
bool m_bPassiveMode;//被动模式
CString m_EquipMDLN;//设备号(用来给host 识别用)
int m_Timeout1;//通信超时1
int m_Timeout2;//通信超时2
int m_Timeout3;//通信超时3
int m_Timeout4;//通信超时4
int m_Timeout5;//通信超时5
int m_Timeout6;//通信超时6
int m_Timeout7;//通信超时7
};
//RMS数据
class CPPFormatData
{
public:
CPPFormatData(void)
{
};
public:
CRecipe m_GetRecipe;//Eap 获取的recipe F7F25
CRecipe m_SetRecipe;//Eap 设置的recipe F7F23
set<int> m_RecipePPCodeSet;//记录当前设置过的PPCode
};
enum eOpPPFormatType
{
_OpPPFormatType_PreparePP_F7F25 = 0,//准备F7F25临时recipe
_OpPPFormatType_GetPPVal_F7F25,//获取F7F25 recipe 参数值
_OpPPFormatType_PreparePP_F7F23,//准备F7F23临时recipe
_OpPPFormatType_SetPPVal_F7F23,//设置F7F23 recipe 参数值
_OpPPFormatType_SetPPComplete_F7F23,//设置F7F23 recipe 完成
};
class COperatePPFormatDataPar
{
public:
COperatePPFormatDataPar(void)
{
m_nAck = ePPSuccess;
};
public:
eOpPPFormatType m_OpPPFormatType;
int m_PPCode;
vector<string> m_PPFormatVal;
PP_HANDLE_REPLY m_nAck;
CPPFormatData m_PPFormatData;
};
class CWafer;
//发送SecsEvent 的附带数据
class CSecsEventInfo
{
public:
CSecsEventInfo()
{
m_Wafer = NULL;
};
public:
eSecsEquipEvent m_EventType;
eWaferLoadPortType m_LoadPortType;
CWafer *m_Wafer;
};
//fdc保持参数(最近一次的值)
class CFDCKeepPar
{
public:
CFDCKeepPar()
{
m_BeamPar_Beam_Centroid_X = 0;
m_BeamPar_Beam_Centroid_Y = 0;
m_BeamPar_Dt_X = 0;
m_BeamPar_Dt_Y = 0;
m_BeamPar_Smoothing_factor_X = 0;
m_BeamPar_Smoothing_factor_Y = 0;
m_BeamPar_Uniformity_X = 0;
m_BeamPar_Uniformity_Y = 0;
m_BeamPar_Top_Uniformity_X = 0;
m_BeamPar_Top_Uniformity_Y = 0;
m_BeamPar_Edge_Gradient_X = 0;
m_BeamPar_Edge_Gradient_Y = 0;
m_DistanceVal = 0;//测距仪读数
m_StageLaser1Powermeter = 0;//平台功率计读数
m_StageLaser2Powermeter = 0;
m_StageLaser1Edi = 0;//复检时Edi 值
m_StageLaser2Edi = 0;//复检时Edi 值
//Ymtc Box Beam 计算参数
m_Beam_Check_alpha = 0;
m_Beam_Check_size_X = 0;
m_Beam_Check_size_Y = 0;
m_Beam_Check_centroid_X = 0;
m_Beam_Check_centroid_Y = 0;
m_Beam_Check_center_of_mass_X = 0;
m_Beam_Check_center_of_mass_Y = 0;
m_Beam_Check_unf_std_X = 0;
m_Beam_Check_unf_std_div_avg_X = 0;
m_Beam_Check_unf_etp_X = 0;
m_Beam_Check_unf_std_Y = 0;
m_Beam_Check_unf_std_div_avg_Y = 0;
m_Beam_Check_unf_etp_Y = 0;
m_Beam_Check_unf_std = 0;
m_Beam_Check_unf_std_div_avg = 0;
m_Beam_Check_unf_etp = 0;
m_Beam_Check_slope_left = 0;
m_Beam_Check_slope_right = 0;
m_Beam_Check_slope_up = 0;
m_Beam_Check_slope_down = 0;
m_Beam_Check_region1 = 0;
m_Beam_Check_region2 = 0;
m_Beam_Check_region3 = 0;
m_Beam_Check_region4 = 0;
m_Beam_Check_region5 = 0;
m_Beam_Check_Dt_X_954 = 0;
m_Beam_Check_Dt_Y_954 = 0;
m_Beam_Check_Clamp_limit = 0;
m_Beam_Check_Dt_X_865 = 0;
m_Beam_Check_Dt_X_865_Std = 0;
m_Beam_Check_Dt_X_865_Min = 0;
m_Beam_Check_Dt_X_865_Count = 0;
m_Beam_Check_Dt_Y_865 = 0;
m_Beam_Check_Dt_Y_865_Std = 0;
m_Beam_Check_Dt_Y_865_Min = 0;
m_Beam_Check_Dt_Y_865_Count = 0;
m_Edi_Check_Adjust_Times = 0;//功率密度复检的调整次数
m_Path_Power_Data_Cnt = 0;//path功率计数据点数
m_Path_Power_AMplitudeZCnt = 0;//path功率计正向波动点数
m_Path_Power_AMplitudeFCnt = 0;//path功率计负向波动点数
m_Path_Power_AMplitudeZAvg = 0;//path功率计正向波动平均值w
m_Path_Power_AMplitudeFAvg = 0;//path功率计正向波动平均值w
};
public:
//Beamgage软件采集数据
double m_BeamPar_Beam_Centroid_X;
double m_BeamPar_Beam_Centroid_Y;
double m_BeamPar_Dt_X;
double m_BeamPar_Dt_Y;
double m_BeamPar_Smoothing_factor_X;
double m_BeamPar_Smoothing_factor_Y;
double m_BeamPar_Uniformity_X;
double m_BeamPar_Uniformity_Y;
double m_BeamPar_Top_Uniformity_X;
double m_BeamPar_Top_Uniformity_Y;
double m_BeamPar_Edge_Gradient_X;
double m_BeamPar_Edge_Gradient_Y;
//测距仪读数
double m_DistanceVal;
//stage 功率计读数
double m_StageLaser1Powermeter;//Laser1 平台功率计读数
double m_StageLaser2Powermeter;//Laser1 平台功率计读数
double m_StageLaser1Edi;//复检时Edi 值
double m_StageLaser2Edi;//复检时Edi 值
double m_Edi_Check_Adjust_Times;//功率密度复检的调整次数
//path功率计
double m_Path_Power_Data_Cnt;//path功率计数据点数
double m_Path_Power_AMplitudeZCnt;//path功率计正向波动点数
double m_Path_Power_AMplitudeFCnt;//path功率计负向波动点数
double m_Path_Power_AMplitudeZAvg;//path功率计正向波动平均值w
double m_Path_Power_AMplitudeFAvg;//path功率计正向波动平均值w
//Ymtc Box Beam 计算参数(BeamResultPara.bin中的数量和顺序要一致)
CString m_Beam_Check_Lotid;
CString m_Beam_Check_Waferid;
double m_Beam_Check_alpha;
double m_Beam_Check_size_X;
double m_Beam_Check_size_Y;
double m_Beam_Check_centroid_X;
double m_Beam_Check_centroid_Y;
double m_Beam_Check_center_of_mass_X;
double m_Beam_Check_center_of_mass_Y;
double m_Beam_Check_unf_std_X;
double m_Beam_Check_unf_std_div_avg_X;
double m_Beam_Check_unf_etp_X;
double m_Beam_Check_unf_std_Y;
double m_Beam_Check_unf_std_div_avg_Y;
double m_Beam_Check_unf_etp_Y;
double m_Beam_Check_unf_std;
double m_Beam_Check_unf_std_div_avg;
double m_Beam_Check_unf_etp;
double m_Beam_Check_slope_left;
double m_Beam_Check_slope_right;
double m_Beam_Check_slope_up;
double m_Beam_Check_slope_down;
double m_Beam_Check_region1;
double m_Beam_Check_region2;
double m_Beam_Check_region3;
double m_Beam_Check_region4;
double m_Beam_Check_region5;
double m_Beam_Check_Dt_X_954;
double m_Beam_Check_Dt_Y_954;
double m_Beam_Check_Clamp_limit;
double m_Beam_Check_Dt_X_865;
double m_Beam_Check_Dt_X_865_Std;
double m_Beam_Check_Dt_X_865_Min;
double m_Beam_Check_Dt_X_865_Count;
double m_Beam_Check_Dt_Y_865;
double m_Beam_Check_Dt_Y_865_Std;
double m_Beam_Check_Dt_Y_865_Min;
double m_Beam_Check_Dt_Y_865_Count;
};
//半导体SEMI 通信协议管理
class CSemiSecsCommMgr :public CModule
{
public:
CSemiSecsCommMgr(void);
~CSemiSecsCommMgr(void);
virtual CMFCPropertyGridProperty *CreatGridProperty();
virtual void OnPropertyChanged();
virtual CString GetParDirName(){return "SemiSecs";};
virtual MODULE GetModuleType(){return _SEMI_SECS_PORP;};
virtual void OnAppInitialize();//软件打开时
virtual void OnExitApp();//退出软件时
void SetAlarmState(int AlarmID,bool bOn);
CString GetCurCommStateStr();
CString GetCurCtrlStateStr();
void OnCommStateChange(COMM_STATE State);
bool IsHostCommunicationSuc();
void OnCtrlStateChange(CONTROL_STATE State);
void ChangeCtrlMode(CONTROL_MODE CtrlMode);
const char* OnSecsGetVidVarValue(int varID);
const char* OnSecsGetECVidVarValue(int varID);
REMOTE_REPLY OnRemoteCmd(REMOTE_DATA rd);
ESecsProcessState GetCurProcessState(){return m_CurProcessState;};
void OnPPSelect(eWaferLoadPortType PortType);
void OnCancel(eWaferLoadPortType PortType);
void OnStart(eWaferLoadPortType PortType);
void SendEventToEap(CSecsEventInfo &EventInfo);
void SecsGetPPFormatValue(PP_FORMAT_HANDLE* pPpFormat);
void SecsSetPPFormatValue(PP_FORMAT_HANDLE* pPpFormat);
CString GetCurTerminalMsg(){return m_CurTerminalMsg;};
void SetCurTerminalMsg(CString s){m_CurTerminalMsg = s;};
void OnRecvTerminalMsg(CString s){m_CurTerminalMsg = s;};
void SendTerminalMsg(CString msg);
CONTROL_STATE GetCurCtrlState(){return m_CurCtrlState;};
bool IsbSecsInitSucc(){return m_bSecsInitSucc;};
CString GetCtrlModeStr(CONTROL_MODE CtrlMode);
void Port1EapCtrlFlow();
void Port2EapCtrlFlow();
CString OnEapFoupRfidCommit(int nPort, string pCarrier, CarrierIDStatus::Enum nState);
CString OnEapMapSlotCommit(int nPort, Carrier pCarrier);
CString OnEapCreatePJob(ProcessJob &pPJob);
CString OnEapCreateCJob(ControlJob &pCJob);
CString OnEapDeletePJob(CString PJobID);
CString OnEapDeleteCJob(CString JobID);
CString OnCJobCommand(ControlJobCommand pCJobCmd);
CString OnCMSCarrierAction(CarrierAction::Enum nAction, int nPort,string pCarrierID);
void DeleteSecsPJob(CString JobID);
void DeleteSecsCJob(CString JobID);
void SetCmsLoadPortUnloaded(int nPort);
void UpdateEapPJobState(CString JobID,int PJobState);
void UpdateEapCJobState(CString JobID,int JobState);
void UpdateEapPWaferState(CString WaferID,int WaferState);
bool IsbOnlineRemote();
void ChangeEapFlowStepState(eWaferLoadPortType LoadPortType);
CString GetTestFoupRfid(eWaferLoadPortType LoadPortType);
void UpdateEapAccessState(eWaferLoadPortType PortType,bool bAuto);
CString OnAccessModeChange(int nPort, LoadPortAccessMode::Enum nState);
void OperatePPFormatData(COperatePPFormatDataPar &OperatePar);
int GetCurFDCTimes(){return m_CurFDCTimes;};
void SetbSendAlarmToEap(bool b){m_bSendAlarmToEap = b;};
bool IsbSendAlarmToEap(){return m_bSendAlarmToEap;};
CFDCKeepPar &GetFDCKeepPar(){return m_FDCKeepPar;};
void SecsPPCtrl(PP_HANDLE_DATA* pPpHandle);
CString GetEquipMDLN();
private:
void SemiSecsCommInit();
void InitSecsVar();
void SetSecsCommPar();
void InitCallbackProc();
CString GetCommStateStr(COMM_STATE State);
CString GetCtrlStateStr(CONTROL_STATE State);
REMOTE_REPLY OnRemoteCmd_PPSelect(REMOTE_DATA RemoteData);
REMOTE_REPLY OnRemoteCmd_Cancel(REMOTE_DATA RemoteData);
REMOTE_REPLY OnRemoteCmd_CassetteClose(REMOTE_DATA RemoteData);
REMOTE_REPLY OnRemoteCmd_Start(REMOTE_DATA RemoteData);
void UpdateEventReportVar(CSecsEventInfo &EventInfo);
bool EnableGem300();
void InitCMS();
void InitPJob();
void InitCJob();
void StartEapCtrlFlowThread();
void PortEapCtrlFlowExt(eWaferLoadPortType PortType);
void EapFlowStep_Stop(eWaferLoadPortType PortType);
void EapFlowStep_CheckPortState(eWaferLoadPortType PortType);
void EapFlowStep_PortLoadReady(eWaferLoadPortType PortType);
void EapFlowStep_FoupLoading(eWaferLoadPortType PortType);
void EapFlowStep_FoupLoadEnd(eWaferLoadPortType PortType);
void EapFlowStep_ReadRfidEnd(eWaferLoadPortType PortType);
void EapFlowStep_EapFoupIdCommitEnd(eWaferLoadPortType PortType);
void EapFlowStep_FoupMappingEnd(eWaferLoadPortType PortType);
void EapFlowStep_EapMapInfoCommitEnd(eWaferLoadPortType PortType);
void EapFlowStep_EapJobCreatEnd(eWaferLoadPortType PortType);
void EapFlowStep_EapJobExcuting(eWaferLoadPortType PortType);
void EapFlowStep_EapJobExcuteEnd(eWaferLoadPortType PortType);
void EapFlowStep_PortUnloadReady(eWaferLoadPortType PortType);
void EapFlowStep_PortUnloading(eWaferLoadPortType PortType);
void EapFlowStep_PortUnloadEnd(eWaferLoadPortType PortType);
bool CheckPortStateExt(eWaferLoadPortType PortType);
void OnEapUnloadFoup(int nPort);
string GetPPFormat_String(list<string> listParament, string pDataFormat);
void GetEventInfo(eSecsEquipEvent SecsEvent,int &EventId,CString &EventName);
CString EapCancelCarrier(eWaferLoadPortType LoadPortType,CString FoupID);
void AnalysisPPParStrVec(vector<string> ListDataVec,vector<CString>&PPParStrVec);
bool IsSendConditionOk();
private:
// SECS
CSecsEquip300* m_pSecs;//用于secs 通信的对象指针
CSecsCommPar m_SecsCommPar;//Secs 通信用参数
COMM_STATE m_CurCommState;//当前的通信状态
CONTROL_STATE m_CurCtrlState;//当前的控制状态
int m_DeviceID;//设备识别ID
vCritical m_lockVarValue;// 变量值
bool m_bSecsInitSucc;//secs模块初始化是否成功
bool m_bUseSecsFunc;//是否使用secs 模块(保存值)
bool m_bCommEnable;//是否允许通信(保存值)
bool m_bCurCommEnable;//是否允许通信(临时值)
ESecsProcessState m_CurProcessState;//当前过程状态
ESecsProcessState m_PreProcessState;//之前的过程状态
ESecsPortState m_CurPort1State;//当前port1 的状态
ESecsPortState m_PrePort1State;//之前port1 的状态
ESecsPortState m_CurPort2State;//当前port2 的状态
ESecsPortState m_PrePort2State;//之前port2 的状态
CString m_CurTerminalMsg;//当前的host 远程消息
Carrier m_pCarrierPort1Map;//Port1的mapping 确认信息
Carrier m_pCarrierPort2Map;//Port1的mapping 确认信息
CString m_TestFoupRfid;//测试用FOUP ID
CString m_TestFoupRfid2;//测试用FOUP ID
int m_CheckFoupOnDelay;//检查放上foup 的时间s (避免料盒没有放稳)
int m_FoupRfidEapCommitDelay;//发送EAP foupid 后等待延时ms (保存值)
int m_CurWaitCommitDelay;//当前等待Commit 的延时ms
bool m_bUseFixPPListPath;//使用固定recipe 路径
CPPFormatData m_CurPPFormatData;//当前的PPFormat 数据
string m_CurPPFormatVal;//用于返回给EAP 的PP code 对应值
int m_CurFDCTimes;//当前FDC的采集次数,用来观察当前FDC 的采集情况
bool m_bSendAlarmToEap;//报警通知服务器
CFDCKeepPar m_FDCKeepPar;//最近一次的保持参数
bool m_bWriteEquipLog;//是否在D 盘输出日志(保存值)
CString m_CurSecsLogPath;//当前的secs log目录
CWafer *m_ReportWafer;//当前事件report 的wafer
eWaferLoadPortType m_ReportPortType;//当前事件report 的PortType
};
extern CSemiSecsCommMgr *gSemiSecsCommMgr;
extern void SetWindowsTime(SYSTEMTIME time);