diff --git a/LaiPuLaser/LaiPuLaser/DeviceStateMgr.cpp b/LaiPuLaser/LaiPuLaser/DeviceStateMgr.cpp index b9ec36b..4ee021a 100644 --- a/LaiPuLaser/LaiPuLaser/DeviceStateMgr.cpp +++ b/LaiPuLaser/LaiPuLaser/DeviceStateMgr.cpp @@ -124,6 +124,12 @@ UINT CtrlSoftWareRunHeartBeatThread(LPVOID pParam) p->SoftWareRunHeartBeat(); return 0; } +UINT UpDataSecsProcessStateThread(LPVOID pParam) +{ + CDeviceStateMgr *p = (CDeviceStateMgr *)pParam; + p->UpDataSecsProcessState(); + return 0; +} CDeviceStateMgr *gDeviceStateMgr = new CDeviceStateMgr; CDeviceStateMgr::CDeviceStateMgr(void) { @@ -245,6 +251,8 @@ void CDeviceStateMgr::OnAppInitialize() pThread = AfxBeginThread(ReadAptDeviceStateThread, this); Sleep(100); pThread = AfxBeginThread(CtrlSoftWareRunHeartBeatThread, this); + Sleep(100); + pThread = AfxBeginThread(UpDataSecsProcessStateThread, this); } void CDeviceStateMgr::OnDeviceInit() { @@ -481,6 +489,58 @@ void CDeviceStateMgr::SoftWareRunHeartBeat() } } +void CDeviceStateMgr::UpDataSecsProcessState() +{ + //第一次检查前的延时 + Sleep(FIRST_OPEN_DELAY); + while (1) + { + if (gAllThreadMgr.IsbStopAllThread()) + break; + set StateSet1; + StateSet1.insert(_PJobState_QUEUED); + + set StateSet2; + StateSet2.insert(_PJobState_PROCESSING); + //刷新状态的顺序需要按照紧急级别排列 + if (!IsDeviceInitialize()) + { + gSemiSecsCommMgr->SetCurProcessState(_ProcessState_INIT); + } + else if (gCommonFlowMgr->GetJobStopType()>_JobStopType_Null + &&gJobQueueMgr->HasJob()) + { + gSemiSecsCommMgr->SetCurProcessState(_ProcessState_PAUSED); + } + else if (gCmdInvoker_WaferAneal.IsbExcuting()&&gAnnealMonitoringMgr->IsAnnealProcessExt()) + { + gSemiSecsCommMgr->SetCurProcessState(_ProcessState_PROCESSING); + } + else if (gCommonFlowMgr->IsbAutoRunning()&&gJobQueueMgr->HasRunningPJob()) + { + gSemiSecsCommMgr->SetCurProcessState(_ProcessState_SETTING_UP); + } + else if ((gJobQueueMgr->CheckLoadPortJob_ByStateSet(_LoadPortType_Port1, StateSet1) + || gJobQueueMgr->CheckLoadPortJob_ByStateSet(_LoadPortType_Port2, StateSet1)) + && !gJobQueueMgr->HasRunningPJob()) + { + gSemiSecsCommMgr->SetCurProcessState(_ProcessState_READY); + } + else if (_FoupState_OFF==gFoupLoadPortMgr->GetFoupState(_LoadPortType_Port1) + && _FoupState_OFF == gFoupLoadPortMgr->GetFoupState(_LoadPortType_Port2) + &&gWarningMgr->HasWarningMsg(_WarningType_Warning)) + { + gSemiSecsCommMgr->SetCurProcessState(_ProcessState_IDLE_WITH_ALARMS); + } + else if (_FoupState_OFF == gFoupLoadPortMgr->GetFoupState(_LoadPortType_Port1) + && _FoupState_OFF == gFoupLoadPortMgr->GetFoupState(_LoadPortType_Port2) + && !gWarningMgr->HasWarningMsg(_WarningType_Warning)) + { + gSemiSecsCommMgr->SetCurProcessState(_ProcessState_IDLE); + } + Sleep(1000); + } +} #endif #if 1 //更新常用IO 的状态(这个函数只是读取相应的值,不进行具体的通信操作) diff --git a/LaiPuLaser/LaiPuLaser/DeviceStateMgr.h b/LaiPuLaser/LaiPuLaser/DeviceStateMgr.h index 184dd36..9157388 100644 --- a/LaiPuLaser/LaiPuLaser/DeviceStateMgr.h +++ b/LaiPuLaser/LaiPuLaser/DeviceStateMgr.h @@ -149,6 +149,7 @@ public: void ReadLoadport2State(); void ReadAptDeviceState(); void SoftWareRunHeartBeat(); + void UpDataSecsProcessState(); void BeamGageCtrl(); bool CheckStateDuringProcessing(); void SetIOState(CCommonIOState IOState){m_IOState = IOState;}; diff --git a/LaiPuLaser/LaiPuLaser/FoupLoadPortMgr.cpp b/LaiPuLaser/LaiPuLaser/FoupLoadPortMgr.cpp index 0b97e02..395d747 100644 --- a/LaiPuLaser/LaiPuLaser/FoupLoadPortMgr.cpp +++ b/LaiPuLaser/LaiPuLaser/FoupLoadPortMgr.cpp @@ -1380,6 +1380,12 @@ void CTdkFoupLoadPortMgr::ClearComBuf() gCriticalSection_LoadPort2.Unlock(); } } +eFoupState CTdkFoupLoadPortMgr::GetFoupState(eWaferLoadPortType PortType) +{ + if (_LoadPortType_Port1 == PortType) + return m_FoupLoadPort1.m_FoupState; + return m_FoupLoadPort2.m_FoupState; +} bool CTdkFoupLoadPortMgr::ReadLoadPortStateExt(eWaferLoadPortType LoadPortType,eReadLoadPortType ReadLoadPortType) { //多次读取失败才算 diff --git a/LaiPuLaser/LaiPuLaser/FoupLoadPortMgr.h b/LaiPuLaser/LaiPuLaser/FoupLoadPortMgr.h index 5f3e0ef..a1166ce 100644 --- a/LaiPuLaser/LaiPuLaser/FoupLoadPortMgr.h +++ b/LaiPuLaser/LaiPuLaser/FoupLoadPortMgr.h @@ -312,6 +312,7 @@ public: void UpdateFoupOnStateExt(eWaferLoadPortType LoadPortType); void FoupStatuReadReaLTimeCtl(bool bStart); void ClearComBuf(); + eFoupState GetFoupState(eWaferLoadPortType PortType); private: CString GetCmdTypeStr(eTdkCmdType CmdType); CString GetCmdStr(eTdkCmdType CmdType); diff --git a/LaiPuLaser/LaiPuLaser/SemiSecsCommMgr.cpp b/LaiPuLaser/LaiPuLaser/SemiSecsCommMgr.cpp index d22d972..92392f2 100644 --- a/LaiPuLaser/LaiPuLaser/SemiSecsCommMgr.cpp +++ b/LaiPuLaser/LaiPuLaser/SemiSecsCommMgr.cpp @@ -1005,6 +1005,8 @@ void CSemiSecsCommMgr::InitSecsVar() m_pSecs->VariableSetMethod(k,OnVarValueProc); for(int k=42101;k<=42119;k++) m_pSecs->VariableSetMethod(k,OnVarValueProc); + for (int k = 42201; k <= 42210; k++) + m_pSecs->VariableSetMethod(k, OnVarValueProc); for(int k=5000001;k<=5000286;k++)//Ec List m_pSecs->VariableSetMethod(k,OnVarValueProc); } @@ -1703,6 +1705,11 @@ const char* CSemiSecsCommMgr::OnSecsGetVidVarValue(int varID) result = Db2CString(LaserDeviceState.m_Laser2DevicePower); } break; + case 42201://ESecsProcessState + { + result = Int2CString(m_CurProcessState); + } + break; #if 1//给Event Report 用的值------------START case 50001://STP_PORT_NUMBER { diff --git a/LaiPuLaser/LaiPuLaser/SemiSecsCommMgr.h b/LaiPuLaser/LaiPuLaser/SemiSecsCommMgr.h index 9e75856..9574e28 100644 --- a/LaiPuLaser/LaiPuLaser/SemiSecsCommMgr.h +++ b/LaiPuLaser/LaiPuLaser/SemiSecsCommMgr.h @@ -60,17 +60,14 @@ enum eSecsEquipEvent //设备流程状态 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,//未定义 + _ProcessState_INIT = 0,//初始化中或未初始化 + _ProcessState_Null,//未定义 + _ProcessState_IDLE,//待机状态(Loadport无料盒放置) + _ProcessState_PAUSED,//已暂停(有Job处于暂停,暂停并不能继续,终止状态) + _ProcessState_SETTING_UP,//加工前准备(job start 之后工艺之前的状态,传片....) + _ProcessState_READY,//准备完成(当前机台有队列中的PJOB,可以Start) + _ProcessState_PROCESSING,//加工中 + _ProcessState_IDLE_WITH_ALARMS,//待机(有报警) }; //port 的状态 enum ESecsPortState @@ -330,6 +327,7 @@ public: const char* OnSecsGetECVidVarValue(int varID); REMOTE_REPLY OnRemoteCmd(REMOTE_DATA rd); ESecsProcessState GetCurProcessState(){return m_CurProcessState;}; + void SetCurProcessState(ESecsProcessState State) { m_CurProcessState = State; }; void OnPPSelect(eWaferLoadPortType PortType); void OnCancel(eWaferLoadPortType PortType); void OnStart(eWaferLoadPortType PortType);