|
|
#include "StdAfx.h"
|
|
|
#include "ProgramLaserTuiHuo.h"
|
|
|
#include "GlobalFunction.h"
|
|
|
#include "LogMgr.h"
|
|
|
#include "WorkTime.h"
|
|
|
#include "FileMgr.h"
|
|
|
#include "WorkFileMgr.h"
|
|
|
#include "Layer.h"
|
|
|
#include "ObjFillMgr.h"
|
|
|
#include "Laser.h"
|
|
|
#include "Propertie.h"
|
|
|
#include "PropertieMgr.h"
|
|
|
#include "AuthorityMgr.h"
|
|
|
#include "MsgBox.h"
|
|
|
#include "CStringFuc.h"
|
|
|
#include "Layer.h"
|
|
|
#include "PenParMgr.h"
|
|
|
#include "ObjBase.h"
|
|
|
#include "ObjContainer.h"
|
|
|
#include "ExceptionMsg.h"
|
|
|
#include "WorkRecord.h"
|
|
|
#include "WorkAreaMgr.h"
|
|
|
#include "PenParMgr.h"
|
|
|
#include "CommonFlowMgr.h"
|
|
|
#include "LaserPowCheckMgr.h"
|
|
|
#include "EncryptionMgr.h"
|
|
|
#include "TimingProgressMgr.h"
|
|
|
#include "AllThreadMgr.h"
|
|
|
#include "ObjPline.h"
|
|
|
#include "CommomText.h"
|
|
|
#include "WaferRecipeDataMgr.h"
|
|
|
#include "WarningMgr.h"
|
|
|
#include "AllThreadMgr.h"
|
|
|
#include "ModuleDeviceMgr.h"
|
|
|
|
|
|
|
|
|
|
|
|
#define CYCLIC_RUN_TIMES_FILE _T("\\CommPar\\CyclicRun.bin")
|
|
|
|
|
|
|
|
|
#define SCAN_AREA_FILE_PATH _T("\\ScanArea\\")
|
|
|
|
|
|
#define CUR_SOFT_VISION "v 2.1.5" //当前的软件版本
|
|
|
|
|
|
|
|
|
//工作流程控制线程(无限循环)
|
|
|
UINT AutoWorkFlowCtrlThread(LPVOID pParam)
|
|
|
{
|
|
|
CProgramLaserTuiHuo *p = (CProgramLaserTuiHuo *)pParam;
|
|
|
p->AutoWorkFlowCtrl();
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
//执行一个步骤的线程(执行一次)
|
|
|
UINT ExecuteStepThread(LPVOID pParam)
|
|
|
{
|
|
|
CProgramLaserTuiHuo *p = (CProgramLaserTuiHuo *)pParam;
|
|
|
p->ExecuteCurStep();
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
CProgramLaserTuiHuo *gProgramLaserTuiHuo = new CProgramLaserTuiHuo;
|
|
|
CProgramLaserTuiHuo::CProgramLaserTuiHuo(void)
|
|
|
{
|
|
|
m_pMeasureThread = NULL;//测量线程
|
|
|
m_bCheckLaserPar = true;//加工前检测实际激光参数是否匹配
|
|
|
|
|
|
m_BackTime2Mins = 300;//激光器休眠计时(关闭电源)(分钟)
|
|
|
m_CurAutoWorkStep = _AutoWork_Step_Stop;
|
|
|
m_OldAutoWorkStep = _AutoWork_Step_Stop;
|
|
|
m_bAutoWorking = false;//是否正在自动工作
|
|
|
m_bStopAfterThisCycle = false;//本次循环后停止
|
|
|
m_bAutoPowerMode = false;//功率自动匹配模式
|
|
|
m_bStopWork = false;//是否停止工作
|
|
|
m_bLockAllDlgPane = true;//锁定活动界面面板
|
|
|
m_bAutoTransferMode = false;//自动传片模式
|
|
|
m_bLastWaferEnd = false;//是否为最后一片正常结束
|
|
|
|
|
|
m_bLockCurRecipe = false;//锁定当前recipe 显示(保存值)
|
|
|
|
|
|
m_bCyclicRunMode = false;//是否正在CyclicRun 模式
|
|
|
m_bCyclicRunExcuting = false;//CyclicRun 是否正在执行
|
|
|
|
|
|
m_AllCyclicWaferCnt = 0;//CyclicRun Wafer 的数量
|
|
|
m_CurCyclicWaferCnt = 0;//CyclicRun Wafer 的数量
|
|
|
m_WaferScanType = 0;//wafer 扫描方式
|
|
|
m_RecoverScanIdxAdjust = 1;//恢复扫描路径从前面的第几条线开始(保存值)
|
|
|
|
|
|
m_CurLaserPathBmpId = IDB_BTN_IMG21;//当前光路背景图ID
|
|
|
m_CurAnnealPercent = 0;//当前的退火完成度
|
|
|
m_bSoftInitComplete = false;//软件初始化是否完成
|
|
|
|
|
|
m_DeviceID = "LA2540G";//当前设备的编号(显示在主界面)
|
|
|
|
|
|
m_CurSoftVision = CUR_SOFT_VISION;//当前的软件版本
|
|
|
|
|
|
m_LaipuLaserDataDir = "E:\\LaipuLaserData";//监控数据目录,比如E:\LaipuLaserData
|
|
|
}
|
|
|
CProgramLaserTuiHuo::~CProgramLaserTuiHuo(void)
|
|
|
{
|
|
|
}
|
|
|
CMFCPropertyGridProperty *CProgramLaserTuiHuo::CreatGridProperty()
|
|
|
{
|
|
|
CString PropertyName;//属性名称
|
|
|
CString Description;//描述
|
|
|
CString Path = GetParDirName();//存储路径
|
|
|
CString Name;
|
|
|
CString GroupName;
|
|
|
CString ModuleName;
|
|
|
//-------------------------------------------------------------------------------//
|
|
|
PropertyName = _T("激光退火设备");
|
|
|
GroupName = PropertyName;
|
|
|
CMFCPropertyGridProperty* pGroup = new CMFCPropertyGridProperty(PropertyName);
|
|
|
//-------------------------------------------------------------------------------//
|
|
|
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
|
|
|
{
|
|
|
|
|
|
{
|
|
|
//添加属性变量映射
|
|
|
Name = _T("m_bLockAllDlgPane");//变量名字
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
pPropertie->SetpVal((void*)&m_bLockAllDlgPane);
|
|
|
pPropertie->SetType(_PROP_TYPE_BOOL);
|
|
|
pPropertie->SetpModule(this);
|
|
|
pPropertie->SetPath(Path);
|
|
|
pPropertie->SetName(Name);
|
|
|
pPropertie->WriteRead(true);//读取保存的属性
|
|
|
//添加属性显示
|
|
|
PropertyName = _T("界面锁定");
|
|
|
Description = _T("锁定活动界面面板");
|
|
|
pPropertie->SetGroupName(GroupName);
|
|
|
pPropertie->SetShowName(PropertyName);
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bLockAllDlgPane, Description);
|
|
|
pGroup->AddSubItem(p1);
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
}
|
|
|
{
|
|
|
//添加属性变量映射
|
|
|
Name = _T("m_bLockCurRecipe");//变量名字
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
pPropertie->SetpVal((void*)&m_bLockCurRecipe);
|
|
|
pPropertie->SetType(_PROP_TYPE_BOOL);
|
|
|
pPropertie->SetpModule(this);
|
|
|
pPropertie->SetPath(Path);
|
|
|
pPropertie->SetName(Name);
|
|
|
pPropertie->WriteRead(true);//读取保存的属性
|
|
|
//添加属性显示
|
|
|
PropertyName = _T("锁定Recipe显示");
|
|
|
Description = _T("锁定当前工艺Recipe显示");
|
|
|
pPropertie->SetGroupName(GroupName);
|
|
|
pPropertie->SetShowName(PropertyName);
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bLockCurRecipe, Description);
|
|
|
pGroup->AddSubItem(p1);
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
}
|
|
|
{
|
|
|
//添加属性变量映射
|
|
|
Name = _T("m_LaipuLaserDataDir");//变量名字
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
pPropertie->SetpVal((void*)&m_LaipuLaserDataDir);
|
|
|
pPropertie->SetType(_PROP_TYPE_STRING);
|
|
|
pPropertie->SetpModule(this);
|
|
|
pPropertie->SetPath(Path);
|
|
|
pPropertie->SetName(Name);
|
|
|
pPropertie->WriteRead(true);//读取保存的属性
|
|
|
|
|
|
//添加属性显示
|
|
|
PropertyName = _T("软件数据目录");
|
|
|
Description = _T("软件数据存储目录(重启软件生效)");
|
|
|
|
|
|
pPropertie->SetGroupName(GroupName);
|
|
|
pPropertie->SetShowName(PropertyName);
|
|
|
pPropertie->SetModuleName(ModuleName);
|
|
|
CMFCPropertyGridProperty* p = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_LaipuLaserDataDir, Description);
|
|
|
pGroup->AddSubItem(p);
|
|
|
gDevicePropertieMgr.Insert(p, pPropertie);
|
|
|
}
|
|
|
{
|
|
|
//添加属性变量映射
|
|
|
Name = _T("m_ObjTxtFilePath");//变量名字
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
pPropertie->SetpVal((void*)&m_ObjTxtFilePath);
|
|
|
pPropertie->SetType(_PROP_TYPE_STRING);
|
|
|
pPropertie->SetpModule(this);
|
|
|
pPropertie->SetPath(Path);
|
|
|
pPropertie->SetName(Name);
|
|
|
pPropertie->WriteRead(true);//读取保存的属性
|
|
|
//添加属性显示
|
|
|
PropertyName = _T("Obj Txt 路径");
|
|
|
Description = _T("Obj Txt 路径");
|
|
|
pPropertie->SetGroupName(GroupName);
|
|
|
pPropertie->SetShowName(PropertyName);
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_ObjTxtFilePath, Description);
|
|
|
pGroup->AddSubItem(p1);
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
}
|
|
|
{
|
|
|
//添加属性变量映射
|
|
|
Name = _T("m_DeviceID");//变量名字
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
pPropertie->SetpVal((void*)&m_DeviceID);
|
|
|
pPropertie->SetType(_PROP_TYPE_STRING);
|
|
|
pPropertie->SetpModule(this);
|
|
|
pPropertie->SetPath(Path);
|
|
|
pPropertie->SetName(Name);
|
|
|
pPropertie->WriteRead(true);//读取保存的属性
|
|
|
//添加属性显示
|
|
|
PropertyName = _T("设备ID");
|
|
|
Description = _T("当前设备ID");
|
|
|
pPropertie->SetGroupName(GroupName);
|
|
|
pPropertie->SetShowName(PropertyName);
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_DeviceID, Description);
|
|
|
pGroup->AddSubItem(p1);
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
}
|
|
|
{
|
|
|
//添加属性变量映射
|
|
|
Name = _T("m_WorkRecordFilePath");//变量名字
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
pPropertie->SetpVal((void*)&m_WorkRecordFilePath);
|
|
|
pPropertie->SetType(_PROP_TYPE_STRING);
|
|
|
pPropertie->SetpModule(this);
|
|
|
pPropertie->SetPath(Path);
|
|
|
pPropertie->SetName(Name);
|
|
|
pPropertie->WriteRead(true);//读取保存的属性
|
|
|
//添加属性显示
|
|
|
PropertyName = _T("加工记录路径");
|
|
|
Description = _T("加工记录 文件路径");
|
|
|
pPropertie->SetGroupName(GroupName);
|
|
|
pPropertie->SetShowName(PropertyName);
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_WorkRecordFilePath, Description);
|
|
|
pGroup->AddSubItem(p1);
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
}
|
|
|
{
|
|
|
//添加属性变量映射
|
|
|
Name = _T("m_BackTime2Mins");//变量名字
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
pPropertie->SetpVal((void*)&m_BackTime2Mins);
|
|
|
pPropertie->SetType(_PROP_TYPE_INT);
|
|
|
pPropertie->SetpModule(this);
|
|
|
pPropertie->SetPath(Path);
|
|
|
pPropertie->SetName(Name);
|
|
|
pPropertie->WriteRead(true);//读取保存的属性
|
|
|
//添加属性显示
|
|
|
PropertyName = _T("激光器休眠计时");
|
|
|
Description = _T("激光器休眠计时(分钟)");
|
|
|
pPropertie->SetGroupName(GroupName);
|
|
|
pPropertie->SetShowName(PropertyName);
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_BackTime2Mins, Description);
|
|
|
pGroup->AddSubItem(p1);
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
}
|
|
|
{
|
|
|
//添加属性变量映射
|
|
|
Name = _T("m_WaferScanType");//变量名字
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
pPropertie->SetpVal((void*)&m_WaferScanType);
|
|
|
pPropertie->SetType(_PROP_TYPE_INT);
|
|
|
pPropertie->SetpModule(this);
|
|
|
pPropertie->SetPath(Path);
|
|
|
pPropertie->SetName(Name);
|
|
|
pPropertie->WriteRead(true);//读取保存的属性
|
|
|
//添加属性显示
|
|
|
PropertyName = _T("扫描方式");
|
|
|
Description = _T("0:S 左到右1:S 右到左2:单向上到下3:单向下到上4:S 上到下5:S 形下到上6:单向左到右7:单向右到左");
|
|
|
pPropertie->SetGroupName(GroupName);
|
|
|
pPropertie->SetShowName(PropertyName);
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_WaferScanType, Description);
|
|
|
pGroup->AddSubItem(p1);
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
}
|
|
|
{
|
|
|
//添加属性变量映射
|
|
|
Name = _T("m_RecoverScanIdxAdjust");//变量名字
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
pPropertie->SetpVal((void*)&m_RecoverScanIdxAdjust);
|
|
|
pPropertie->SetType(_PROP_TYPE_INT);
|
|
|
pPropertie->SetpModule(this);
|
|
|
pPropertie->SetPath(Path);
|
|
|
pPropertie->SetName(Name);
|
|
|
pPropertie->WriteRead(true);//读取保存的属性
|
|
|
//添加属性显示
|
|
|
PropertyName = _T("恢复扫描线调整");
|
|
|
Description = _T("恢复扫描路径从前面的第几条线开始");
|
|
|
pPropertie->SetGroupName(GroupName);
|
|
|
pPropertie->SetShowName(PropertyName);
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_RecoverScanIdxAdjust, Description);
|
|
|
pGroup->AddSubItem(p1);
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
}
|
|
|
}
|
|
|
//-------------------------------------------------------------------------------//
|
|
|
return pGroup;
|
|
|
}
|
|
|
//响应属性的变化
|
|
|
void CProgramLaserTuiHuo::OnPropertyChanged()
|
|
|
{
|
|
|
//锁定界面布局
|
|
|
GetFrame()->LockPane(m_bLockAllDlgPane);
|
|
|
m_pView->RefreshView();
|
|
|
|
|
|
}
|
|
|
#if 1
|
|
|
void CProgramLaserTuiHuo::OnAppInitialize()
|
|
|
{
|
|
|
CWorkTime WorkTime;
|
|
|
m_AppOpenTime = WorkTime.GetDateTime("/",":");//记录软件打开的时间
|
|
|
|
|
|
//保存当前的监控目录
|
|
|
//m_LaipuLaserDataDir要重启软件生效
|
|
|
m_CurLaipuLaserDataDir= m_LaipuLaserDataDir;
|
|
|
}
|
|
|
void CProgramLaserTuiHuo::OnExitApp()
|
|
|
{
|
|
|
}
|
|
|
//右上角退出按钮(检查是否可以关闭程序)
|
|
|
bool CProgramLaserTuiHuo::CloseAppCheck()
|
|
|
{
|
|
|
if(gAuthorityMgr->IsbLoginDlgOpen())
|
|
|
{
|
|
|
gLogMgr->WriteDebugLog("CloseAppCheck-->LoginDlgOpen");
|
|
|
return false;
|
|
|
}
|
|
|
CMsgBox MsgBox;
|
|
|
if(MsgBox.ConfirmOkCancel("关闭程序?")==false)
|
|
|
return false;
|
|
|
return true;//可以关闭
|
|
|
}
|
|
|
|
|
|
//是否为单向扫描
|
|
|
bool CProgramLaserTuiHuo::IsOneDirScanType()
|
|
|
{
|
|
|
if((m_WaferScanType==2) ||(m_WaferScanType==3)||(m_WaferScanType==6)||(m_WaferScanType==7))
|
|
|
return true;
|
|
|
return false;
|
|
|
}
|
|
|
//通过系统消息来关闭软件
|
|
|
void CProgramLaserTuiHuo::CloseAppBySysMsg()
|
|
|
{
|
|
|
gLogMgr->WriteDebugLog("Func--->CloseAppBySysMsg");
|
|
|
|
|
|
HWND hWnd;
|
|
|
CString WndName = "LaiPuDrawing - [无标题]";
|
|
|
hWnd = (HWND)::FindWindow(NULL,WndName);
|
|
|
if(hWnd != NULL)
|
|
|
{
|
|
|
::SendMessage(hWnd,WM_SYSCOMMAND, SC_CLOSE,0);
|
|
|
}
|
|
|
}
|
|
|
//重启软件
|
|
|
void CProgramLaserTuiHuo::ReStartApp()
|
|
|
{
|
|
|
gLogMgr->WriteDebugLog("Func--->ReStartApp");
|
|
|
//得到当前程序的路径
|
|
|
char strPath[100];
|
|
|
GetModuleFileName(NULL,strPath,100);
|
|
|
//创建守护进程,在启用新进程成功后发送WM_QUIT消息结束原来的进程;
|
|
|
STARTUPINFO startInfo;
|
|
|
PROCESS_INFORMATION processInfo;
|
|
|
ZeroMemory(&startInfo, sizeof(STARTUPINFO));
|
|
|
startInfo.cb = sizeof(STARTUPINFO);
|
|
|
if(CreateProcess(NULL,(LPTSTR)(LPCTSTR)strPath, NULL, NULL,FALSE, 0, NULL, NULL, &startInfo, &processInfo))
|
|
|
{
|
|
|
CloseHandle( processInfo.hProcess );
|
|
|
CloseHandle( processInfo.hThread );
|
|
|
PostQuitMessage(WM_CLOSE);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
#if 1
|
|
|
//启动加工(bAutoMode = true 自动传片模式=false 手动退火)
|
|
|
//Job start 后调用一次
|
|
|
bool CProgramLaserTuiHuo::StartWork(bool bAutoMode)
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
//加工前准备(并决定要执行的步骤)
|
|
|
bool CProgramLaserTuiHuo::StartWorkPrepare()
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
#if 1//自动工作流程管理
|
|
|
//设置当前的工作步骤
|
|
|
void CProgramLaserTuiHuo::SetCurAutoWorkStep(EAutoWorkStep Step)
|
|
|
{
|
|
|
//避免无法停止的情况
|
|
|
if(Step==_AutoWork_Step_Stop)
|
|
|
{
|
|
|
m_OldAutoWorkStep = _AutoWork_Step_NULL;
|
|
|
m_CurAutoWorkStep = _AutoWork_Step_NULL;
|
|
|
}
|
|
|
CString Log;
|
|
|
switch(Step)
|
|
|
{
|
|
|
case _AutoWork_Step_Transfer_Load://上料
|
|
|
Log = "_AutoWork_Step_Transfer_Load";
|
|
|
break;
|
|
|
case _AutoWork_Step_Tuihuo_Progress://退火过程
|
|
|
Log = "_AutoWork_Step_Tuihuo_Progress";
|
|
|
break;
|
|
|
case _AutoWork_Step_Transfer_UnLoad://下料
|
|
|
Log = "_AutoWork_Step_Transfer_UnLoad";
|
|
|
break;
|
|
|
case _AutoWork_Step_Stop://停止运行
|
|
|
Log = "_AutoWork_Step_Stop";
|
|
|
break;
|
|
|
case _AutoWork_Step_NULL://停止运行
|
|
|
Log = "_AutoWork_Step_NULL";
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
Log = "Flow---->SetCurAutoWorkStep : " + Log;
|
|
|
gLogMgr->WriteDebugLog(Log);
|
|
|
|
|
|
m_CurAutoWorkStep = Step;
|
|
|
}
|
|
|
//工作流程控制
|
|
|
void CProgramLaserTuiHuo::AutoWorkFlowCtrl()
|
|
|
{
|
|
|
while(1)
|
|
|
{
|
|
|
//软件结束时停止线程
|
|
|
if(gAllThreadMgr.IsbStopAllThread())
|
|
|
break;
|
|
|
//标记线程开始
|
|
|
gAllThreadMgr.SetThreadInfoState(_EThreadType_AutoWorkFlowCtrlThread,true);
|
|
|
Sleep(500);
|
|
|
|
|
|
if(m_CurAutoWorkStep == m_OldAutoWorkStep)//无变化
|
|
|
continue;
|
|
|
if(m_bAutoWorking)
|
|
|
{
|
|
|
//记录当前步骤
|
|
|
m_OldAutoWorkStep = m_CurAutoWorkStep;
|
|
|
if(m_CurAutoWorkStep != _AutoWork_Step_NULL)
|
|
|
{
|
|
|
//在新线程中执行每个步骤
|
|
|
AfxBeginThread(ExecuteStepThread,this);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//标记线程结束
|
|
|
gAllThreadMgr.SetThreadInfoState(_EThreadType_AutoWorkFlowCtrlThread,false);
|
|
|
}
|
|
|
//执行当前步骤
|
|
|
void CProgramLaserTuiHuo::ExecuteCurStep()
|
|
|
{
|
|
|
if(gExitApp)
|
|
|
return;
|
|
|
gAllThreadMgr.SetThreadInfoState(_EThreadType_ExecuteStepThread,true);
|
|
|
|
|
|
switch(m_CurAutoWorkStep)
|
|
|
{
|
|
|
case _AutoWork_Step_Transfer_Load://上料
|
|
|
OnLoadWaferToPlat();
|
|
|
break;
|
|
|
case _AutoWork_Step_Tuihuo_Progress://退火过程
|
|
|
OnTuiHuoProgress();
|
|
|
break;
|
|
|
case _AutoWork_Step_Transfer_UnLoad://下料
|
|
|
OnUnLoadPlatWaferToPod();
|
|
|
break;
|
|
|
case _AutoWork_Step_Stop://停止运行
|
|
|
OnWorkStop();
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
//当前步骤执行完终止自动运行
|
|
|
if(!m_bAutoWorking && m_CurAutoWorkStep!= _AutoWork_Step_Stop && m_CurAutoWorkStep!= _AutoWork_Step_NULL)
|
|
|
{
|
|
|
OnWorkStop();
|
|
|
}
|
|
|
gAllThreadMgr.SetThreadInfoState(_EThreadType_ExecuteStepThread,false);
|
|
|
}
|
|
|
//本次循环后停止
|
|
|
void CProgramLaserTuiHuo::StopAftrThisCycle()
|
|
|
{
|
|
|
m_bStopAfterThisCycle = true;
|
|
|
gLogMgr->WriteDebugLog("Func---->Stop After This Cycle");
|
|
|
}
|
|
|
#endif
|
|
|
#if 1//传片相关的辅助函数
|
|
|
//是否准备好Load
|
|
|
bool CProgramLaserTuiHuo::IsReadyToLoad()
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
//是否load 完成
|
|
|
bool CProgramLaserTuiHuo::IsLoadEnd()
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
//是否准备好Unload
|
|
|
bool CProgramLaserTuiHuo::IsReadyToUnload()
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
//是否unload 完成
|
|
|
bool CProgramLaserTuiHuo::IsUnloadEnd()
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
//是否还有未处理wafer
|
|
|
bool CProgramLaserTuiHuo::HasUntreatedWafer()
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
#endif
|
|
|
#if 1
|
|
|
//load wafer 到载盘
|
|
|
bool CProgramLaserTuiHuo::OnLoadWaferToPlat()
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
//加工(半自动模式直接进入这一步)
|
|
|
void CProgramLaserTuiHuo::OnTuiHuoProgress()
|
|
|
{
|
|
|
|
|
|
}
|
|
|
void CProgramLaserTuiHuo::OnTuiHuoProgressExt()
|
|
|
{
|
|
|
|
|
|
|
|
|
}
|
|
|
//将wafer 从载盘上传输到pod
|
|
|
bool CProgramLaserTuiHuo::OnUnLoadPlatWaferToPod()
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
//工作结束(Job 停止或者结束后调用)
|
|
|
void CProgramLaserTuiHuo::OnWorkStop()
|
|
|
{
|
|
|
|
|
|
}
|
|
|
#endif
|
|
|
#if 1
|
|
|
//手动上料
|
|
|
void CProgramLaserTuiHuo::ManualTransferLoad()
|
|
|
{
|
|
|
|
|
|
|
|
|
}
|
|
|
//手动下料
|
|
|
void CProgramLaserTuiHuo::ManualTransferUnLoad()
|
|
|
{
|
|
|
|
|
|
|
|
|
}
|
|
|
//手动将arm/准直器上的wafer 退回料盒
|
|
|
void CProgramLaserTuiHuo::ManualArmAlignerUnLoad()
|
|
|
{
|
|
|
|
|
|
}
|
|
|
//一键回收(载盘/Arm2 手臂的wafer)
|
|
|
void CProgramLaserTuiHuo::ManualRecoverAllWafer()
|
|
|
{
|
|
|
|
|
|
}
|
|
|
#endif
|
|
|
#if 1
|
|
|
UINT CyclicRunThread(LPVOID pParam)
|
|
|
{
|
|
|
CProgramLaserTuiHuo *p = (CProgramLaserTuiHuo *)pParam;
|
|
|
p->CyclicRun();
|
|
|
return 0;
|
|
|
}
|
|
|
//响应点击CyclicRun
|
|
|
void CProgramLaserTuiHuo::OnClickeCyclicRun()
|
|
|
{
|
|
|
|
|
|
}
|
|
|
//检查是否能进行CyclicRun
|
|
|
bool CProgramLaserTuiHuo::CheckCyclicRunCondition()
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
//启动CyclicRun
|
|
|
void CProgramLaserTuiHuo::StartCyclicRunThread()
|
|
|
{
|
|
|
gLogMgr->WriteDebugLog("Func---->StartCyclicRunThread");
|
|
|
m_bCyclicRunExcuting = true;
|
|
|
m_bCyclicRunMode = true;
|
|
|
//在新线程中执行
|
|
|
AfxBeginThread(CyclicRunThread,this);
|
|
|
}
|
|
|
//停止CyclicRun 模式
|
|
|
void CProgramLaserTuiHuo::StopCyclicRunThread()
|
|
|
{
|
|
|
gLogMgr->WriteDebugLog("Func---->StopCyclicRunThread");
|
|
|
m_bCyclicRunMode = false;
|
|
|
}
|
|
|
|
|
|
void CProgramLaserTuiHuo::CyclicRun()
|
|
|
{
|
|
|
gLogMgr->WriteDebugLog("Func---->CyclicRun");
|
|
|
while(1)
|
|
|
{
|
|
|
Sleep(CTRL_CYCLIC_RUN_DELAY);
|
|
|
if(gAllThreadMgr.IsbStopAllThread())
|
|
|
break;
|
|
|
if(!m_bCyclicRunMode)
|
|
|
break;
|
|
|
gAllThreadMgr.SetThreadInfoState(_EThreadType_CyclicRunThread,true);
|
|
|
|
|
|
CyclicRunExt();
|
|
|
}
|
|
|
|
|
|
gAllThreadMgr.SetThreadInfoState(_EThreadType_CyclicRunThread,false);
|
|
|
|
|
|
m_bCyclicRunExcuting = false;
|
|
|
gLogMgr->WriteDebugLog("Func---->CyclicRun End");
|
|
|
}
|
|
|
void CProgramLaserTuiHuo::CyclicRunExt()
|
|
|
{
|
|
|
|
|
|
}
|
|
|
void CProgramLaserTuiHuo::ClearCyclicWaferCnt()
|
|
|
{
|
|
|
CMsgBox MsgBox;
|
|
|
if(MsgBox.ConfirmOkCancel("Cur Run Times 数量清零?"))
|
|
|
{
|
|
|
m_CurCyclicWaferCnt = 0;
|
|
|
gLogMgr->WriteDebugLog("Func---->ClearCyclicWaferCnt");
|
|
|
}
|
|
|
}
|
|
|
//获取当前Cyclic 次数
|
|
|
CString CProgramLaserTuiHuo::GetCyclicWaferCnt()
|
|
|
{
|
|
|
return Int2CString(m_AllCyclicWaferCnt);
|
|
|
}
|
|
|
CString CProgramLaserTuiHuo::GetCurCyclicWaferCnt()
|
|
|
{
|
|
|
return Int2CString(m_CurCyclicWaferCnt);
|
|
|
}
|
|
|
|
|
|
//累加当前Cyclic 次数
|
|
|
void CProgramLaserTuiHuo::CyclicWaferInc()
|
|
|
{
|
|
|
if(!m_bCyclicRunMode)
|
|
|
return;
|
|
|
m_AllCyclicWaferCnt++;
|
|
|
m_CurCyclicWaferCnt++;
|
|
|
WriteCyclicWaferCntToFile(m_AllCyclicWaferCnt);
|
|
|
}
|
|
|
//Cyclic 次数写入文件
|
|
|
void CProgramLaserTuiHuo::WriteCyclicWaferCntToFile(int CyclicWaferCnt)
|
|
|
{
|
|
|
CString s;
|
|
|
s.Format("Func---->WriteCyclicWaferCntToFile : %ld",CyclicWaferCnt);
|
|
|
gLogMgr->WriteDebugLog(s);
|
|
|
|
|
|
CFileMgr FileMgr;
|
|
|
CString FilePath;
|
|
|
FileMgr.GetFullFilePath(FilePath,CYCLIC_RUN_TIMES_FILE);
|
|
|
|
|
|
ofstream FileStream;
|
|
|
FileStream.open(FilePath);
|
|
|
FileStream<<Int2CString(CyclicWaferCnt);
|
|
|
}
|
|
|
//从文件中恢复Cyclic 次数
|
|
|
void CProgramLaserTuiHuo::ReadCyclicWaferCntFromFile()
|
|
|
{
|
|
|
CFileMgr FileMgr;
|
|
|
CString FilePath;
|
|
|
FileMgr.GetFullFilePath(FilePath,CYCLIC_RUN_TIMES_FILE);
|
|
|
if(!FileMgr.IsFileExist(FilePath))
|
|
|
{
|
|
|
//文件不存在新建一个
|
|
|
WriteCyclicWaferCntToFile(0);
|
|
|
return;
|
|
|
}
|
|
|
vector<CString> StrVec;
|
|
|
FileMgr.ReadFileToStringVec(FilePath,StrVec);
|
|
|
if(StrVec.size()>0)
|
|
|
{
|
|
|
m_AllCyclicWaferCnt = CStringToInt(StrVec[0]);
|
|
|
CString s;
|
|
|
s.Format("Func---->ReadCyclicWaferCntFromFile : %ld",m_AllCyclicWaferCnt);
|
|
|
gLogMgr->WriteDebugLog(s);
|
|
|
}
|
|
|
}
|
|
|
#endif
|
|
|
#if 1
|
|
|
//类似"E:\\LaipuLaserData"
|
|
|
CString CProgramLaserTuiHuo::GetLaipuLaserDataDir(CString Path)
|
|
|
{
|
|
|
CString DataDir = m_CurLaipuLaserDataDir;
|
|
|
DataDir += Path;
|
|
|
return DataDir;
|
|
|
}
|
|
|
CString CProgramLaserTuiHuo::GetScanAreaFilePath()
|
|
|
{
|
|
|
CString ScanAreaFilePath = GetLaipuLaserDataDir(SCAN_AREA_FILE_PATH);
|
|
|
return ScanAreaFilePath;
|
|
|
}
|
|
|
|
|
|
#endif
|