#include "StdAfx.h" #include "SequenceProcessor_CPJT.h" #include "CameraControlAlign.h" #include "CameraController.h" #include "CHReviewSetting/NetworkInfo.h" #include "CHReviewResult/GlassResult.h" #include "CameraControlAlign.h" #include "CHSignalControls/SignalControl.h" #include "CHMotorControls/MotorControl.h" #include "CHAfmControls/AfmControl.h" #include "CHPathScheduler/PathScheduler.h" //#include "MeasureScheduler.h" #include "CHMotorControls/MotorControl.h" #include "CHReviewSetting/SystemInfo.h" #include "CoordCalibrator.h" #include "CHMotorControls/MotorControlInfo.h" #include "ReviewProcessor.h" #include "CHReviewRecipe/RsRecipeManager.h" #include "CHReviewRecipe/RsRcpReviewInfo.h" #include "CHReviewRecipe/RsRcpAlignInfo.h" #include "CHReviewSetting/GlassTypeInfo.h" #include "CHReviewSetting/Sys_AlignManager.h" #include "CHReviewPrioritySorter/PrioritySorter.h" #include "CHReviewRecipe/RsRcpMeasureInfo.h" #include "DlgResultGraph.h" #include "ChartGlassData.h" #include "CHDefectPicker/DefectPicker.h" #include "ReviewProcessor_CPJT.h" #include "CameraControlReview.h" #include "CHWsiControls/WsiControl.h" #include "CHReviewRecipe/Rcp_RsReviewManager.h" #include "ReviewInterface.h" #include "DlgModuleInfo.h" #include #include "DitGlassRawStruct.h" #include "akCore/akFileUtil.h" #include "akGridData.h" #include #include #include #define GLASS_GD_FILE_PATH _T("GD") #define SIGNAL_SEND_RESULT_SUCCESS _T("OK") #define SIGNAL_SEND_RESULT_FAIL _T("NG") #define SIGNAL_ON_TIME_INFINITY 0 #define AOIRAWBIN_PATH "\\\\126.100.100.1\\d\\DIT_ResultData\\RawBin" #define AOIRAWBIN_TEST_PATH "d:\\DIT_ResultData\\RawBin" #define AOIRAWBIN_NETWORK_DRIVE_PATH "Y:\\RawBin" enum CPJT_MeasureMode { CPJT_ModeAuto = 0, CPJT_ModeManual }; // [2017:4:18]-[WEZASW] : WSI Module enum CPJT_PlanType { CPJT_PlanReview = 0, CPJT_PlanUser, CPJT_PlanWSI, CPJT_PlanMeasure, CPJT_PlanReflow, CPJT_PlanWsiReflow, CPJT_PlanWsiUser,CPJT_PlanWsiMultiShot }; enum CPJT_InsepectionType{REVIEW_REFLOW = 0, WSI_REFLOW, REV_WSI,WSIUSER, USER,WSIMULTISHOT}; enum WSI_REFLOW_POINTINDEX { LEFTTOP=0, TOP, RIGHTTOP, LEFT, RIGHT, LEFTBOTTOM, BOTTOM, RIGHTBOTTOM, LEFTNOTCH, RIGHTNOTCH}; enum WSI_REFLOW_CELLSIDE_INDX { CELL_TOP=0, CELL_LEFT, CELL_RIGHT, CELL_LEFTTOP, CELL_RIGHTTOP, CELL_LEFTBOTTOM, CELL_RIGHTBOTTOM, CELL_BOTTOM, CELL_LEFTNOTCH, CELL_RIGHTNOTCH}; enum CPJT_GANTRY_TYPE { GantryType_Left, GantryType_Right }; enum Judgement_CPJT { Judge_OK_CPJT = 0, Judge_RP_CPJT, Judge_NG_CPJT, Judge_TR_CPJT, Judge_PR_CPJT, Judge_PT_CPJT, Judge_Review_CPJT, Judge_RC_CPJT, Judge_Size_CPJT, Judge_VI_CPJT, Judge_Rework_CPJT, Judge_Unknown_CPJT }; enum JudgeCode_CPJT { TRDF_CPJT = 0, BATR_CPJT, DOBB_CPJT, DOBS_CPJT, DOWW_CPJT, DOWB_CPJT, DOWS_CPJT }; enum GlassDataType_CPJT2 { GLASS_DATA_PROD_ID_CPJT = 0, GLASS_DATA_OPER_ID_CPJT, GLASS_DATA_LOT_ID_CPJT, GLASS_DATA_LOT_SEQUENCE_NUMBER_CPJT, GLASS_DATA_JOB_TYPE_CPJT, GLASS_DATA_JOB_ID_CPJT, //GLASS_DATA_PPID_CPJT, GLASS_DATA_GLASS_SCAN_SCHEDULE_CPJT, GLASS_DATA_PPID_RECIPE_CPJT, GLASS_DATA_SLOT_SEQUENCE_NUMBER_CPJT, GLASS_DATA_PROPERTY_CODE_CPJT, GLASS_DATA_JOB_JUDGE_CODE_CPJT, GLASS_DATA_JOB_GRADE_CODE_CPJT, GLASS_DATA_SUBSTRATE_TYPE_CPJT, GLASS_DATA_PROCESSING_FLAG_CPJT, GLASS_DATA_INSPECTION_FLAG_CPJT, GLASS_DATA_SKIP_FLAG_CPJT, GLASS_DATA_JOB_SIZE_CPJT, GLASS_DATA_GLASS_THICKNESS_CPJT, GLASS_DATA_JOB_ANGLE_CPJT, GLASS_DATA_JOB_FLIP_CPJT, GLASS_DATA_CUTTING_GLASS_TYPE_CPJT, GLASS_DATA_PROCESSING_COUNT_CPJT, GLASS_DATA_INSPECTION_JUDGE_DATA_CPJT, GLASS_DATA_PAIR_JOB_ID_CPJT, GLASS_DATA_PAIR_FLAG_CPJT, GLASS_DATA_OPTION_VALUE_CPJT, //GLASS_DATA_RESERVED_CPJT }; enum GlassDataType_CPJT { GLASS_DATA_H_PANELID_CPJT = 0, GLASS_DATA_E_PANELID_CPJT, GLASS_DATA_PROCESSID_CPJT, GLASS_DATA_PRODCUTID_CPJT, GLASS_DATA_STEPID_CPJT, GLASS_DATA_BATCHID_CPJT, GLASS_DATA_PROD_TYPE_CPJT, GLASS_DATA_PROD_KIND_CPJT, GLASS_DATA_PPID_CPJT, GLASS_DATA_FLOWID_CPJT, GLASS_DATA_PANEL_SIZE_CPJT, GLASS_DATA_THICKNESS_CPJT, GLASS_DATA_COMP_COUNT_CPJT, GLASS_DATA_PANEL_STATE_CPJT, GLASS_DATA_READING_FLAG_CPJT, GLASS_DATA_INS_FLAG_CPJT, GLASS_DATA_PANEL_POSITION_CPJT, GLASS_DATA_JUDGEMENT_CPJT, GLASS_DATA_CODE_CPJT, GLASS_DATA_FLOW_HISTORY_CPJT, GLASS_DATA_UNIQUEID_CPJT, GLASS_DATA_COUNT1_CPJT, GLASS_DATA_COUNT2_CPJT, GLASS_DATA_GRADE_CPJT, GLASS_DATA_MULTI_USE_CPJT, GLASS_DATA_BIT_SIGNAL_CPJT, GLASS_DATA_PAIR_H_PANELID_CPJT, GLASS_DATA_PAIR_E_PANELID_CPJT, GLASS_DATA_PAIR_PRODUCTID_CPJT, GLASS_DATA_PAIR_GRADE_CPJT, GLASS_DATA_FLOW_GROUP_CPJT, GLASS_DATA_DBR_RECIPE_CPJT, GLASS_DATA_RESERVED_CPJT, GLASS_DATA_RERFER_DATA }; enum DVDataType_CPJT { DV_DATA_ALIGN1_MACH_VALUE_CPJT = 0, DV_DATA_ALIGN2_MACH_VALUE_CPJT, DV_DATA_ALIGN1_GRAY_VALUE_CPJT, DV_DATA_ALIGN2_GRAY_VALUE_CPJT, DV_DATA_LIGHT_VALUE_CPJT, DV_DATA_LENS_MAGNIFY_CPJT, DV_DATA_REVIEW_DEFECT_DATA_CPJT, DV_DATA_WSI_DEFECT_DATA_CPJT }; BOOL CSequenceProcessor_CPJT::CompareFuction(CModuleStatus* i, CModuleStatus* j) { if(i->GetMotorPosition()->dGlassPosX == j->GetMotorPosition()->dGlassPosX) return i->GetMotorPosition()->dGlassPosY < j->GetMotorPosition()->dGlassPosY; else return i->GetMotorPosition()->dGlassPosX < j->GetMotorPosition()->dGlassPosX; } BOOL CSequenceProcessor_CPJT::GantrySorting(CReviewResult i, CReviewResult j) { return i.GetModuleIndex() < j.GetModuleIndex(); } CSequenceProcessor_CPJT::CSequenceProcessor_CPJT(void) : CSequenceProcessor() { m_bUseAFMHomePosition = TRUE; m_nGlassCount = 0; CDitGlassRawClient* pDitGlassRaw = CDitGlassRawClient::GetInstance(); if(pDitGlassRaw->ConnectServer() == FALSE) { g_pLog->DisplayMessage(_T("(Shared memory Access Fail)")); } } CSequenceProcessor_CPJT::~CSequenceProcessor_CPJT(void) { m_bUseAFMHomePosition = TRUE; } BOOL CSequenceProcessor_CPJT::SetProcessStatus(int nProcessStatus) { EnterCriticalSection(&m_csProcessStatus); BOOL bReturn = FALSE; //if (nProcessStatus!=m_nProcessStatus || nProcessStatus==0) if (1)//nProcessStatus!=m_nProcessStatus || nProcessStatus==0) { //if (nProcessStatus==0) //{ // bReturn = TRUE; //} // else if (nProcessStatus==(m_nProcessStatus+1)) // { // bReturn = TRUE; // } bReturn = TRUE; //if (nProcessStatus == m_nProcessStatus) //{ // bReturn = FALSE; //} if (bReturn) { CSequenceProcessData* pThreadData = new CSequenceProcessData(this); if (pThreadData) { pThreadData->nProcessStatus = nProcessStatus; bReturn = CreateWorkThread(pThreadData); if(bReturn) { g_pLog->DisplayMessage(_T("[0] nProcessStatus : %d , m_nProcessStatus : %d"), nProcessStatus, m_nProcessStatus); } else { g_pLog->DisplayMessage(_T("[1] nProcessStatus : %d , m_nProcessStatus : %d"), nProcessStatus, m_nProcessStatus); } } else { g_pLog->DisplayMessage(_T("[2] nProcessStatus : %d , m_nProcessStatus : %d"), nProcessStatus, m_nProcessStatus); } } else if(nProcessStatus==2){ CSequenceProcessData* pThreadData = new CSequenceProcessData(this); if (pThreadData) { pThreadData->nProcessStatus = nProcessStatus; bReturn = CreateWorkThread(pThreadData); if(bReturn) { g_pLog->DisplayMessage(_T("[0] nProcessStatus : %d , m_nProcessStatus : %d"), nProcessStatus, m_nProcessStatus); } else { g_pLog->DisplayMessage(_T("[1] nProcessStatus : %d , m_nProcessStatus : %d"), nProcessStatus, m_nProcessStatus); } } else { g_pLog->DisplayMessage(_T("[2] nProcessStatus : %d , m_nProcessStatus : %d"), nProcessStatus, m_nProcessStatus); } } else { g_pLog->DisplayMessage(_T("[3] nProcessStatus : %d , m_nProcessStatus : %d"), nProcessStatus, m_nProcessStatus); } } else { g_pLog->DisplayMessage(_T("[4] nProcessStatus : %d , m_nProcessStatus : %d"), nProcessStatus, m_nProcessStatus); } LeaveCriticalSection(&m_csProcessStatus); return bReturn; } void CSequenceProcessor_CPJT::RecvWSIResult(int nModuleIndex, const SWsiResult& measureResut) { SReviewResult wisResult; if (m_pSP2P==NULL) goto RESULT_FAIL; CGlassResult *pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult(); if (pGlassResult==NULL) goto RESULT_FAIL; g_pLog->DisplayMessage(_T("[WSI_%d]MeasureResult index %d => code %d"), nModuleIndex, measureResut.nResultIndex, measureResut.nResultCode); DWORD dwCurTick = GetTickCount(); CReviewResult* pWsiResult = pGlassResult->GetWsiResult(nModuleIndex); if (pWsiResult==NULL) goto RESULT_FAIL; int nCurResultIdx = pWsiResult->GetLastSReviewResultIndex() + 1; // last index + 1 int nStartResultIdx = pWsiResult->GetStartSReviewResultIndex(); int nEndResultIdx = pWsiResult->GetEndSReviewResultIndex(); // get grab position const SMotorPosition *pPosition = Module_GetMotorPosition(nModuleIndex); if (pPosition==NULL) goto RESULT_FAIL; int nPosX = int(pPosition->dGlassPosX * 1000.0); int nPosY = int(pPosition->dGlassPosY * 1000.0); int nMPosX = int(pPosition->dMotorPosX * 1000.0); int nMPosY = int(pPosition->dMotorPosY * 1000.0); double dTime = (double) m_ProcessTimer.GetDurationMilliSecond(); if (measureResut.nResultIndex != nCurResultIdx) { goto RESULT_FAIL; } // measureResut if(pWsiResult->GetSReviewResultCount() == 0) return ; SReviewResult* pSWsiResult = pWsiResult->GetSReviewResult(nCurResultIdx); wisResult.nUMOriginX = pSWsiResult->nUMOriginX;//nPosX; wisResult.nUMOriginY = pSWsiResult->nUMOriginY;//nPosY; wisResult.dTargetMotorX = pSWsiResult->dTargetMotorX;//pPosition->dMotorPosX; wisResult.dTargetMotorY = pSWsiResult->dTargetMotorY;//pPosition->dMotorPosY; wisResult.dDurationTime = dTime; wisResult.nWsi_ResultCode = measureResut.nResultCode; wisResult.nWsi_Type = measureResut.nResultType; wisResult.nWsi_SlopeWarn = measureResut.nXSlopeWarn; wisResult.bBigSizeDefect = measureResut.bBigSizeDefect; memcpy(wisResult.pWsi_ResultData, measureResut.pResultData, sizeof(measureResut.pResultData)); pGlassResult->SetWsiResultData(nModuleIndex, nCurResultIdx, wisResult, nPosX, nPosY, nMPosX, nMPosY, dTime); // set last result idx pWsiResult->SetLastSReviewResultIndex(nCurResultIdx); if(nCurResultIdx==nEndResultIdx && nCurResultIdx<=pWsiResult->GetSReviewResultCount()) { nStartResultIdx = nCurResultIdx + 1; nEndResultIdx = nStartResultIdx + MAX_MOTOR_ADDRESS_SIZE - 1; nEndResultIdx = min(nEndResultIdx, (pWsiResult->GetSReviewResultCount()-1)); g_pLog->DisplayMessage(_T("RemainWsi Started view[%d] start[%d] end[%d]"), nModuleIndex, nStartResultIdx, nEndResultIdx); pWsiResult->SetStartSReviewResultIndex(nStartResultIdx); pWsiResult->SetEndSReviewResultIndex(nEndResultIdx); ::Sleep(3000); // Process_RemainWsiPoint(nModuleIndex); } // update view m_pSP2P->ISP2P_UpdateReviewResult(nModuleIndex, pGlassResult); RESULT_FAIL: return; } void CSequenceProcessor_CPJT::RecvWSIUserResult(int nModuleIndex, const SWsiResult& measureResut) { SReviewResult wisUserResult; if (m_pSP2P==NULL) goto RESULT_FAIL; CGlassResult *pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult(); if (pGlassResult==NULL) goto RESULT_FAIL; g_pLog->DisplayMessage(_T("[WSI_%d]MeasureResult index %d => code %d"), nModuleIndex, measureResut.nResultIndex, measureResut.nResultCode); DWORD dwCurTick = GetTickCount(); CReviewResult* pWsiResult = pGlassResult->GetWsiUserResult(nModuleIndex); if (pWsiResult==NULL) goto RESULT_FAIL; int nCurResultIdx = pWsiResult->GetLastSReviewResultIndex() + 1; // last index + 1 int nStartResultIdx = pWsiResult->GetStartSReviewResultIndex(); int nEndResultIdx = pWsiResult->GetEndSReviewResultIndex(); // get grab position const SMotorPosition *pPosition = Module_GetMotorPosition(nModuleIndex); if (pPosition==NULL) goto RESULT_FAIL; int nPosX = int(pPosition->dGlassPosX * 1000.0); int nPosY = int(pPosition->dGlassPosY * 1000.0); int nMPosX = int(pPosition->dMotorPosX * 1000.0); int nMPosY = int(pPosition->dMotorPosY * 1000.0); double dTime = (double) m_ProcessTimer.GetDurationMilliSecond(); if (measureResut.nResultIndex != nCurResultIdx) { goto RESULT_FAIL; } // measureResut if(pWsiResult->GetSReviewResultCount() == 0) return ; SReviewResult* pSWsiResult = pWsiResult->GetSReviewResult(nCurResultIdx); wisUserResult.nUMOriginX = pSWsiResult->nUMOriginX;//nPosX; wisUserResult.nUMOriginY = pSWsiResult->nUMOriginY;//nPosY; wisUserResult.dTargetMotorX = pSWsiResult->dTargetMotorX;//pPosition->dMotorPosX; wisUserResult.dTargetMotorY = pSWsiResult->dTargetMotorY;//pPosition->dMotorPosY; wisUserResult.dDurationTime = dTime; wisUserResult.nWsi_ResultCode = measureResut.nResultCode; wisUserResult.nWsi_Type = measureResut.nResultType; wisUserResult.nWsi_SlopeWarn = measureResut.nXSlopeWarn; memcpy(wisUserResult.pWsi_ResultData, measureResut.pResultData, sizeof(measureResut.pResultData)); pGlassResult->SetUserWsiResultData(nModuleIndex, nCurResultIdx, wisUserResult, nPosX, nPosY, nMPosX, nMPosY, dTime); // set last result idx pWsiResult->SetLastSReviewResultIndex(nCurResultIdx); if(nCurResultIdx==nEndResultIdx && nCurResultIdx<=pWsiResult->GetSReviewResultCount()) { nStartResultIdx = nCurResultIdx + 1; nEndResultIdx = nStartResultIdx + MAX_MOTOR_ADDRESS_SIZE - 1; nEndResultIdx = min(nEndResultIdx, (pWsiResult->GetSReviewResultCount()-1)); g_pLog->DisplayMessage(_T("RemainWsi Started view[%d] start[%d] end[%d]"), nModuleIndex, nStartResultIdx, nEndResultIdx); pWsiResult->SetStartSReviewResultIndex(nStartResultIdx); pWsiResult->SetEndSReviewResultIndex(nEndResultIdx); ::Sleep(3000); // Process_RemainWsiPoint(nModuleIndex); } // update view m_pSP2P->ISP2P_UpdateReviewResult(nModuleIndex, pGlassResult); RESULT_FAIL: return; } void CSequenceProcessor_CPJT::RecvAlignResult(const CAlignResult* pCurAlignResult) { if (m_pSP2P==NULL || pCurAlignResult==NULL) return; CGlassResult *pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult(); if (pGlassResult==NULL) { g_pLog->DisplayMessage(_T("[AlignResult] Glass Result is NULL!")); SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_FAIL); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Fail Signal!")); AlignCamera_CameraControl(CameraControlStop); // 210805 Align Camera Sequence ���� return; } SAlignResult sAlignResult; CAlignResult *pAlignResult = &pGlassResult->m_AlignResult; CAlignRecipe *pAlignRecipe = &pGlassResult->m_AlignRecipe; CRsRcpAlignInfo *pRsRcpAlignInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpAlignInfo(); if (pRsRcpAlignInfo!=NULL && pRsRcpAlignInfo->m_bAutoProcess) { if (pCurAlignResult->nAutoLightResult[0]==LightProcessComplete) { pRsRcpAlignInfo->m_dFirstCamExposure = pCurAlignResult->dExposureTime[0]; } if (pCurAlignResult->nAutoLightResult[1]==LightProcessComplete) { pRsRcpAlignInfo->m_dSecondCamExposure = pCurAlignResult->dExposureTime[1]; } //m_pDoc->Recipe_WriteRecipeFile(); } BOOL bLastAlignResult = FALSE; CCoordCalibrator *pCoordCalibrator = m_pSP2P->ISP2P_GetCoordCalibrator(); if (pCoordCalibrator && pCurAlignResult->nResultCode==Align_Success) { g_pLog->DisplayMessage(_T("[AlignResult] Align Find Success!")); *pAlignResult = *pCurAlignResult; pCoordCalibrator->SetFirstMarkPos(pAlignResult->dFindPositionX[0], pAlignResult->dFindPositionY[0], pAlignRecipe->dGlassPositionX[0], pAlignRecipe->dGlassPositionY[0]); pCoordCalibrator->SetSecondMarkPos(pAlignResult->dFindPositionX[1], pAlignResult->dFindPositionY[1], pAlignRecipe->dGlassPositionX[1], pAlignRecipe->dGlassPositionY[1]); if(pCoordCalibrator->CalculateAlignResult() == TRUE) { sAlignResult = pCoordCalibrator->GetAlignResult(); g_pLog->DisplayMessage(_T("[AlignResult] Origin Pos: %.03lf, %.03lf, Degree: %.08lf"), sAlignResult.dOriginX, sAlignResult.dOriginY, sAlignResult.dDegree); bLastAlignResult = !pAlignRecipe->bRotateProcess; } CCameraControlAlign *pAlignCameraControl = m_pSP2P->ISP2P_GetAlignCameraControl(); SThetaMotorInfo* pThetaMotorInfo = m_pSP2P->ISP2P_GetThetaMotorInfo(); CMotorControl* pMotorControl = m_pSP2P->ISP2P_GetMotorControl(); if (pAlignRecipe->bRotateProcess && pAlignCameraControl && pMotorControl && pThetaMotorInfo) { if (fabs(sAlignResult.dDegree) <= pAlignRecipe->dGlassAngleMin) { bLastAlignResult = TRUE; g_pLog->DisplayMessage(_T("[AlignResult] Success! Last Glass Angle : %.8lf degree, Retry Count : %d ea"), sAlignResult.dDegree, pCurAlignResult->nFindCount); } else if (fabs(sAlignResult.dDegree) > pAlignRecipe->dGlassAngleMax) { bLastAlignResult = FALSE; g_pLog->DisplayMessage(_T("[AlignResult] FAIL! Last Glass Angle : %.8lf degree, Retry Count : %d ea"), sAlignResult.dDegree, pCurAlignResult->nFindCount); } else if (pCurAlignResult->nFindCount < pAlignRecipe->nRetryCount) { g_pLog->DisplayMessage(_T("[AlignResult] Current Glass Angle : %.8lf degree, Retry Count : %d ea"), sAlignResult.dDegree, pCurAlignResult->nFindCount); double dCalAngle = sAlignResult.dDegree; dCalAngle = pThetaMotorInfo->dPosition - dCalAngle ; g_pLog->DisplayMessage(_T("[AlignResult] Move Rotate Glass Angle : %.8lf degree"), dCalAngle); pMotorControl->AxisThetaManualGoEnd(dCalAngle); ::Sleep(100); if (pAlignCameraControl->AlignProcess()) { g_pLog->DisplayMessage(_T("[AlignResult] Align Find Process ReStarted!")); return; } } } } else { g_pLog->DisplayMessage(_T("[AlignResult] Align Find FAIL!")); *pAlignResult = *pCurAlignResult; } g_pLog->DisplayMessage(_T("[AlignResult] Align Result: %d, Match Rate: %.3lf, %.3lf"), pAlignResult->nResultCode, pAlignResult->dFindScore[0], pAlignResult->dFindScore[1]); g_pLog->DisplayMessage(_T("[AlignResult] 1st Align Pixel: %.3lf, %.3lf, 2nd Align Pixel: %.3lf, %.3lf"), pAlignResult->dFindPixelX[0], pAlignResult->dFindPixelY[0], pAlignResult->dFindPixelX[1], pAlignResult->dFindPixelY[1]); g_pLog->DisplayMessage(_T("[AlignResult] 1st Align Mot: %.3lf, %.3lf, 2nd Align Mot: %.3lf, %.3lf"), pAlignResult->dFindPositionX[0], pAlignResult->dFindPositionY[0], pAlignResult->dFindPositionX[1], pAlignResult->dFindPositionY[1]); AlignNetwork_SendAlignResult(pGlassResult); if(pCoordCalibrator) { sAlignResult = pCoordCalibrator->GetAlignResult(); //m_pView->SetAlignResult(pAlignResult->nResultCode, sAlignResult.dOriginX, sAlignResult.dOriginY, sAlignResult.dDegree); } if (bLastAlignResult) { SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Success Data!")); } else { SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_FAIL); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Fail Data!")); } AlignCamera_CameraControl(CameraControlStop); // 210805 Align Camera Sequence 변경 SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_AlignComplete_CPJT); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Complete Signal!")); // LJY-20180905 m_pSP2P->ISP2P_UpdateAlignResultStatus(0, pGlassResult); } BOOL CSequenceProcessor_CPJT::RecvSignalToSignalControl( int nSignalIndex, int nSignalValue, BOOL bSignalOn/*=TRUE*/ ) { BOOL bResult = FALSE; switch(nSignalIndex) { case PCControlRecvSignalIndex_State: bResult = ProcessSignal_State(nSignalValue, bSignalOn); break; //case PCControlRecvSignalIndex_StateSub: // bResult = ProcessSignal_StateSub(nSignalValue, bSignalOn); // break; case PCControlRecvSignalIndex_Seq: bResult = ProcessSignal_Seq(nSignalValue, bSignalOn); break; case PCControlRecvSignalIndex_Ack: bResult = ProcessSignal_Ack(nSignalValue, bSignalOn); break; // case PCControlRecvSignalWsiState: // bResult = ProcessSignal_WSI_State(nSignalValue, bSignalOn); // break; case PCControlRecvSignalAutoDignosis: if (bSignalOn == 1 || bSignalOn == 0) { bResult = ProcessSignal_Seq2(PCControlRecv_Autodiagnosis, bSignalOn); } break; case PCControlRecvSignalAutoDignosisComplet: if (bSignalOn == 1 || bSignalOn == 0) { bResult = ProcessSignal_Seq2(RCControlRecv_AutoDiagnosisComplete, bSignalOn); } break; case PCControlRecvSignalTime: if (bSignalOn == 1 || bSignalOn == 0) { bResult = ProcessSignal_Seq2(PCControlRecv_TIME_SET, bSignalOn); } break; } return bResult; } void CSequenceProcessor_CPJT::CompletePlanIndex(int nReviewStatus, int nPlanIndex) { CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if(pRsRcpReviewInfo == NULL) return; CGlassResult *pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult(); if(pGlassResult == NULL) return; CRcpPlanInfo *BfpPlanInfo = pRsRcpReviewInfo->GetRcpPlanInfo(nPlanIndex); int nBeforePlanIndex = BfpPlanInfo->m_nReviewType; switch(nReviewStatus) { case ReviewProcessStatus_ReviewEnd: m_pSP2P->ISP2P_DisplayMessage(_T("[CompletePlanIndex] ProcessSatus Review End / PlanIndex : %02d"),nPlanIndex); break; case ReviewProcessStatus_MeasureEnd: m_pSP2P->ISP2P_DisplayMessage(_T("[CompletePlanIndex] ProcessSatus Measure End / PlanIndex : %02d"),nPlanIndex); break; case ReviewProcessStatus_UserEnd: m_pSP2P->ISP2P_DisplayMessage(_T("[CompletePlanIndex] ProcessSatus User End / PlanIndex : %02d"),nPlanIndex); break; case ReviewProcessStatus_WSIEnd: m_pSP2P->ISP2P_DisplayMessage(_T("[CompletePlanIndex] ProcessSatus WSI End / PlanIndex : %02d"),nPlanIndex); break; case ReviewProcessStatus_ReflowEnd: m_pSP2P->ISP2P_DisplayMessage(_T("[CompletePlanIndex] ProcessSatus Reflow End / PlanIndex : %02d"),nPlanIndex); break; case ReviewProcessStatus_WSIReflowEnd: m_pSP2P->ISP2P_DisplayMessage(_T("[CompletePlanIndex] ProcessSatus Wsi Reflow End / PlanIndex : %02d"),nPlanIndex); break; case ReviewProcessStatus_WSIMultiShotEnd: m_pSP2P->ISP2P_DisplayMessage(_T("[CompletePlanIndex] ProcessSatus Wsi MultiShot End / PlanIndex : %02d"), nPlanIndex); break; } // next plan nPlanIndex++; CRcpPlanInfo *pPlanInfo = pRsRcpReviewInfo->GetRcpPlanInfo(nPlanIndex); // last plan? if (pPlanInfo==NULL) { SetLastPointCheck(TRUE); m_pSP2P->ISP2P_DisplayMessage(_T("[CompletePlanIndex] LastPlan Complete")); m_pSP2P->ISP2P_DisplayMessage(_T("[CompletePlanIndex] SEND WSI SAFE POS")); //if (m_pSP2P->ISP2P_GetWSIControl(0) != NULL) //{ // m_pSP2P->ISP2P_GetWSIControl(0)->SendWsiAfmSafePosMove(); // m_pSP2P->ISP2P_GetWSIControl(1)->SendWsiAfmSafePosMove(); //} //Sleep(5000); SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS); SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewComplete_CPJT); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Success Signal!")); m_pSP2P->ISP2P_UpdateReviewProcessStatus(ReviewProcessStatus_None, nPlanIndex); AFM_SetAFMTracking(FALSE); return; } if(nBeforePlanIndex== CPJT_PlanWSI||nBeforePlanIndex== CPJT_PlanWsiReflow||nBeforePlanIndex== CPJT_PlanWsiUser) { if(pPlanInfo->m_nReviewType == CPJT_PlanWSI ||pPlanInfo->m_nReviewType == CPJT_PlanWsiReflow||pPlanInfo->m_nReviewType== CPJT_PlanWsiUser || pPlanInfo->m_nReviewType == CPJT_PlanWsiMultiShot) { DWORD dwTick = GetTickCount(); if(GetCheckWSIEnd() == 0) { while(1) { if(GetCheckWSIEnd() == 1) { m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] Wsi end Check Success! WSI TYPE[%d]"),pPlanInfo->m_nReviewType); break; } else if(GetTickCount()-dwTick >=4000) { m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] Wsi End Recv Fail! OverTime WSI TYPE[%d]"),pPlanInfo->m_nReviewType); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Fail Signal!")); break; } } } } } if(nBeforePlanIndex== CPJT_PlanWSI ||nBeforePlanIndex== CPJT_PlanWsiReflow||nBeforePlanIndex== CPJT_PlanWsiUser) { if( pPlanInfo->m_nReviewType == CPJT_PlanReview|| pPlanInfo->m_nReviewType == CPJT_PlanUser|| pPlanInfo->m_nReviewType == CPJT_PlanMeasure|| pPlanInfo->m_nReviewType == CPJT_PlanReflow) { CTotalPitchMeasure* pTotapPithMeasure = m_pSP2P->ISP2P_GetTotalPitchMeasure(); const CMotorControlInfo* pSystemMotorInfo = m_pSP2P->ISP2P_System_GetMotorInfo(); if(pSystemMotorInfo !=NULL) { if( SendReviewStartMotorPosition(0,pSystemMotorInfo->GetStartMotorXpos(),pSystemMotorInfo->GetStartMotorYpos(),0)) { Sleep(2000); if(pTotapPithMeasure->GetMotorEnable()) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send StartMotorPosition! BP:%d CP :%d"),nBeforePlanIndex,pPlanInfo->m_nReviewType); Sleep(3000); } } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send StartMotorPosition Fail!!!! BP:%d CP :%d"),nBeforePlanIndex,pPlanInfo->m_nReviewType); } } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send StartMotorPosition pSystemMotorInfo is null")); } } } // execute next plan DWORD nWaitTime = 3000; int nTotalCount = 0; int temp = 0; BOOL bExcute = FALSE; int nPlanCount = pRsRcpReviewInfo->GetRcpPlanInfoCount(); for (int nPlanIdx=nPlanIndex; nPlanIdxGetRcpPlanInfo(nPlanIdx); if(pPlanInfo == NULL) continue; //210325 if (GetProcessStatus() == ProcessReviewEnd_CPJT || GetProcessStatus() == ProcessReviewUnloding_CPJT) { g_pLog->DisplayMessage(_T("[ProcessStop] StartProcessing Sequence Stop Status : %d"), GetProcessStatus()); return ; } // plan motion switch(pPlanInfo->m_nReviewType) { case CPJT_PlanReview: if (( nTotalCount += pGlassResult->GetTotalSReviewResultCount()) > 0) { m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] Review Plan Start!")); //LYW DCOLL �ӽ���ġ CDitGlassRawClient *pDitRawClient = CDitGlassRawClient::GetInstance(); if (pDitRawClient->isConnect() == TRUE) { _grmDefectData* pSharedDefect = pDitRawClient->GetDefectData(0);//pReviewResult->nDefectidx2 _grmDefectReviewData * pSharedDefectReview = &pSharedDefect->m_ReviewDefect; //size_t CharactersConverted; //wcstombs_s(&CharactersConverted, pSharedDefectReview->m_strRevImageName, pReviewResult->strImgFileName, _TRUNCATE); strcpy(pSharedDefectReview->m_strRevImageName, ""); } //LYW DCOLL �ӽ���ġ ::Sleep(nWaitTime); m_pSP2P->ISP2P_GetReviewProcessor()->ResetGantryDone(); bExcute = ReviewStartProcessing(pGlassResult, nPlanIdx); m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] Review Plan End!")); } break; case CPJT_PlanUser: if (( nTotalCount += pGlassResult->GetTotalSUserResultCount()) > 0) { m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] User Plan Start!")); ::Sleep(nWaitTime); m_pSP2P->ISP2P_GetReviewProcessor()->ResetGantryDone(); bExcute = UserStartProcessing(pGlassResult, nPlanIdx); m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] User Plan End!")); } break; case CPJT_PlanWSI: if (( nTotalCount += pGlassResult->GetTotalSWsiResultCount()) > 0) { m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] WSI Plan Start!")); ::Sleep(nWaitTime); m_pSP2P->ISP2P_GetReviewProcessor()->ResetGantryDone(); bExcute = WsiStartProcessing(pGlassResult, nPlanIdx); m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] WSI Plan End!")); } break; case CPJT_PlanMeasure: if (( nTotalCount += pGlassResult->GetTotalSMeasureResultCount()) > 0) { ::Sleep(nWaitTime); m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] Measure Plan Start!")); bExcute = MeasureStartProcessing(pGlassResult, nPlanIdx); m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] Measure Plan End!")); } break; case CPJT_PlanReflow: if (( nTotalCount += pGlassResult->GetTotalSReflowResultCount()) > 0) { ::Sleep(nWaitTime); m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] Reflow Plan Start!")); bExcute = ReflowStartProcessing(pGlassResult, nPlanIdx); m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] Reflow Plan End!")); } break; case CPJT_PlanWsiReflow: if (( nTotalCount += pGlassResult->GetTotalSWsiReflowResultCount()) > 0) { ::Sleep(nWaitTime); m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] WsiReflow Plan Start!")); bExcute = WsiReflowStartProcessing(pGlassResult, nPlanIdx); m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] WsiReflow Plan End!")); } break; case CPJT_PlanWsiUser: if (( nTotalCount += pGlassResult->GetTotalSWsiUserResultCount()) > 0) { ::Sleep(nWaitTime); m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] WsiUser Plan Start!")); bExcute = WsiUserStartProcessing(pGlassResult, nPlanIdx); m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] WsiUser Plan End!")); } break; case CPJT_PlanWsiMultiShot: if ((nTotalCount += pGlassResult->GetWsiMultiShotResultCount()) > 0) { ::Sleep(nWaitTime); m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] MultiShot Plan Start!")); bExcute = WsiMultiShotStartProcessing(pGlassResult, nPlanIdx); m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] MultiShot Plan End!")); } break; } if (nTotalCount>0) break; } if (nTotalCount>0 && bExcute==FALSE) { SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_FAIL); SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewComplete_CPJT); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Fail Signal!")); } else if (nTotalCount==0) { SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS); SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewComplete_CPJT); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Success Signal!")); } } void CSequenceProcessor_CPJT::WorkThreadProcess(PVOID pParameter) { if (m_pSP2P==NULL || pParameter==NULL) return; CSequenceProcessData* pProcessData = static_cast(pParameter); m_nProcessStatus = pProcessData->nProcessStatus; switch(pProcessData->nProcessStatus) { case ProcessLoading_CPJT: Process_Loading(); break; case ProcessAlignStart_CPJT: Process_AlignStart(); break; case ProcessReadRawFile_CPJT: Process_ReadRawFile(); break; case ProcessReviewStart_CPJT: Process_ReviewStart(); break; case ProcessReviewEnd_CPJT: Process_ReviewEnd(); break; case ProcessReviewUnloding_CPJT: Process_ReviewUnloading(); break; } //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 ADD START SetSimulationMode(FALSE); //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 ADD END return; } void CSequenceProcessor_CPJT::Process_Loading() { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::IN] Loading!")); AllAckSignalOff(); m_pSP2P->ISP2P_GetReviewProcessor()->ResetGantryDone(); SetCheckWSIEnd(-1); //190726 SetWsiType(-1); //wsi reflow SetLastPointCheck(FALSE); bFileFind = FALSE; m_pSP2P->ISP2P_GetDiagnosisHistory(); m_pSP2P->ISP2P_SetFirstReviewLeft(TRUE); m_pSP2P->ISP2P_SetFirstReviewRight(TRUE); //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START if (GetSimulationMode() == FALSE) { if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_LoadingAck_CPJT)) m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading Ack Signal!")); } //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END //Original // if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_LoadingAck_CPJT)) // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading Ack Signal!")); // read config file if(!m_pSP2P->ISP2P_System_ReadConfigFile()) m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor] System Value Loading FAIL!")); m_nWsiTotalCount = 0; // make new glass result int nGlassResultCount = 0; CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetNewGlassResult(nGlassResultCount); if (pGlassResult==NULL) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Glass Result Create FAIL!")); return; } m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Glass Result Count : %d ea"), nGlassResultCount); pGlassResult->ResetDefocusCount(); CTime time = CTime::GetCurrentTime(); pGlassResult->m_strResultDate.Format(_T("%04d.%02d.%02d"), time.GetYear(), time.GetMonth(), time.GetDay()); //if(Revolver_SetGoHome(0)) //{ // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Revolver Set GoHome Success!")); //} //#3357 KYH Align Image ADD START CCameraControlAlign* pAlignCameraControl = m_pSP2P->ISP2P_GetAlignCameraControl(); if (pAlignCameraControl != NULL) { pAlignCameraControl->SetAlignClearImage(); g_pLog->DisplayMessage(_T("[Align] Align Image Clear")); } //#3357 KYH Align Image ADD END // get transfer data int nResultCode = 0; STransferData* pTransferData = m_pSP2P->ISP2P_GetCurrentTransferData(); if (pTransferData==NULL) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Transfer Data Read FAIL!")); nResultCode = 1; } // read transfer data if (pTransferData) { // read transfer data if (ReadTransferDataFromSignalControl(pTransferData)==FALSE) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Transfer Data Read FAIL!")); nResultCode = 2; } else { CDitGlassRawClient *pDitRawClient = CDitGlassRawClient::GetInstance(); if (pDitRawClient->isConnect()==FALSE) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] DitRawClient Connect Fail ")); int nReconnect=0; while (1) { if (nReconnect == 3) { //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START if (GetSimulationMode() == FALSE) { SendResultToSignalControl(PCControlSendData_LoadingResult_CPJT, SIGNAL_SEND_RESULT_FAIL); } //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END //original /*SendResultToSignalControl(PCControlSendData_LoadingResult_CPJT, SIGNAL_SEND_RESULT_FAIL);*/ m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading FAIL Signal!")); break; } pDitRawClient->ConnectServer(); Sleep(1000); if (pDitRawClient->isConnect() == FALSE) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading]DitRawClient Connect Fail Count[%d]"), nReconnect); } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading]DitRawClient Connect Success")); break; } nReconnect += 1; } } // #3381 LYW CF AOI Review FDC TackTime ADD START pDitRawClient->GetGlassData()->m_tmReviewLoading = CTime::GetCurrentTime(); // #3381 LYW CF AOI Review FDC TackTime ADD END CString strGlassIDTemp = NULL; CString strGlassStepIdTemp = NULL; CString strFileName = NULL; strGlassIDTemp = pTransferData->strGlassID; strGlassStepIdTemp = pTransferData->strStepID; strGlassIDTemp = pTransferData->strGlassID; strcpy(pDitRawClient->GetGlassData()->m_strGlassID, strGlassIDTemp); strcpy(pDitRawClient->GetGlassData()->m_strStepID, strGlassStepIdTemp); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading Success Signal!")); strFileName.Format(_T("%s_%s"), strGlassIDTemp, strGlassStepIdTemp); //������Ʈ�� //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START if (GetSimulationMode() == FALSE) { bFileFind = FindRawBinFile(strFileName); } else { bFileFind = TRUE; } //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END //original /*bFileFind = FindRawBinFile(strFileName);*/ pDitRawClient->SetReviewStart(); Sleep(1000); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Transfer Data Read Success!")); UpdateGlassResultFromTransferData(pGlassResult, pTransferData); CreateResultDirectory(pTransferData->strJobID, pGlassResult->m_strResultDate); SetSaveImageBasePathToReviewProcessor(pTransferData->strJobID, pGlassResult->m_strResultDate); SetSaveImageBasePathToAlignCameraControl(pTransferData->strJobID); CString strRecipefile = _T(""); if(ReadRecipeDataFromRecipeFile(pTransferData->strPPID, strRecipefile) == 0) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Recipe File Read FAIL!")); nResultCode = 3; } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Recipe File Read Success![ %s ]"), strRecipefile, pTransferData->strPPID); } m_pSP2P->ISP2P_DisplayMessage(_T("[Glass Loading] Current Apply Recipe Name : %s"), strRecipefile); // recipe data apply if(ApplyRecipeDataToGlassResult(pGlassResult)==FALSE) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Apply Recipe Data To GlassResult FAIL!")); nResultCode = 4; } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Align First File name %s"),pGlassResult->m_AlignRecipe.strFirstImageFile); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Align Second File name %s"),pGlassResult->m_AlignRecipe.strSecondImageFile); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Apply Recipe Data To GlassResult Success!")); } } } //// 190725 chm ASCEND alarm const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); const CRcpSortingInfo *pSortingInfo = pRsRcpReviewInfo->GetRcpReviewSortInfo(); if(pSortingInfo->m_nSortData== 1) // RCP_SORT_DATA_ORDER_ASCEND == 1 { SendSignalToSignalControl(PCControlSendSignalIndex_State,PCControlSend_RecipeASCEND,1000);// g_pLog->DisplayMessage(_T("[SequenceProcessor::GlassLoading] Recipe Is ASCEND!!")); //SendSignalOffToSignalControl(PCControlSendSignalIndex_State,PCControlSend_RecipeASCEND); //190723 recipe ASCEND bit off } //// m_pSP2P->ISP2P_GlassPositionUpdate(); ////190618 if(GetUseAfmHomePosition()) { g_pLog->DisplayMessage(_T("[AFM] AFM Home Position Start!!!")); if(!MoveAFMHomePosition()) g_pLog->DisplayMessage(_T("[AFM] AFM Home Position Fail")); } CDitGlassRawClient* pDitSharedGlassRaw = CDitGlassRawClient::GetInstance(); if (pDitSharedGlassRaw->isConnect() == FALSE) { m_pSP2P->ISP2P_DisplayMessage(_T("[DitGlassRawClient] Shared Memory Connect Fail")); if (pDitSharedGlassRaw->ConnectServer()) { m_pSP2P->ISP2P_DisplayMessage(_T("[DitGlassRawClient] Shared Memory Reconnect!")); } } CRsRcpReviewInfo* pRecipeinfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if(pRecipeinfo == NULL) return; int nWsiTypecount = 0; // if (m_pSP2P->ISP2P_GetWSIControl(0) != NULL) { // m_pSP2P->ISP2P_GetWSIControl(0)->SendWsiAfmSafePosMove(); // m_pSP2P->ISP2P_GetWSIControl(1)->SendWsiAfmSafePosMove(); //} //pProtocolData->m_ModuleData[nModuleIdx].m_nPlanDefectCount += pScheduleResult->GetPathSchedulerResultCount(); /*for (int i=0;iGetPathSchedulerResultCount();i++) { pNode = pScheduleResult->GetPathSchedulerResult(i); pProtocolData->SetPlanReviewPos(nModuleIdx,nStIndex+i, 0, 0); } */ //if(!ChangeUserReviewAxisCenterPosition(pGlassResult)) m_pSP2P->ISP2P_DisplayMessage(_T("[ChangeUserReviewPosition] Change Fail!!")); RemoveMotorCount(); // review camera stop ReviewCamera_CameraControl(CameraControlStop); AlignCamera_CameraControl(CameraControlStop); // 210805 Align Camera Sequence ���� //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START // send signal to plc if (GetSimulationMode() == FALSE) { if (nResultCode == 0) { SendResultToSignalControl(PCControlSendData_LoadingResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading Success Signal!")); } else { SendResultToSignalControl(PCControlSendData_LoadingResult_CPJT, SIGNAL_SEND_RESULT_FAIL); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading FAIL Signal!")); } } //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END //original // send signal to plc // if (nResultCode==0) // { // SendResultToSignalControl(PCControlSendData_LoadingResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS); // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading Success Signal!")); // } // else // { // SendResultToSignalControl(PCControlSendData_LoadingResult_CPJT, SIGNAL_SEND_RESULT_FAIL); // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading FAIL Signal!")); // } // send cell data to review processorm_pDitGlass CReviewProcessor* pReviewProcessor = m_pSP2P->ISP2P_GetReviewProcessor(); if(pReviewProcessor == NULL) return ; pReviewProcessor->SetCellData(pGlassResult); pReviewProcessor->SetReviewCount(0); pReviewProcessor->SetPlanReviewCount(0); pReviewProcessor->SetPlanWSICount(0); // Process Status Update if(pGlassResult) { g_pLog->DisplayMessage(_T("[SequenceProcess_CPJT] m_pGlassResult = %d"), pGlassResult); m_pSP2P->ISP2P_UpdateProcessStatus(GetProcessStatus(), pGlassResult); //m_pSP2P->ISP2P_UpdateReviewResult(0, pGlassResult); for (int nModuleindex =0; nModuleindex<2; nModuleindex++) { m_pSP2P->ISP2P_UpdateReviewResult(nModuleindex, pGlassResult); } const SDefectFilter *pDefectFilter = m_pSP2P->ISP2P_GetDefectFilter(); m_pSP2P->ISP2P_UpdateDefectFilter(pDefectFilter); } //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START if (GetSimulationMode() == FALSE) { SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_LoadingComplete_CPJT); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading Complete Signal!")); } //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END //original // SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_LoadingComplete_CPJT); // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading Complete Signal!")); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::OUT] Loading!")); //pDitSharedGlassRaw->SetReviewStart(); if(pRecipeinfo->m_bDefocusUse){ m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Set Defocus Value : [%f]"),pRecipeinfo->m_dDefocusValue); } } void CSequenceProcessor_CPJT::Process_AlignStart() { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::IN] AlignStart!")); AlignCamera_CameraControl(CameraControlLive); // 210805 Align Camera Sequence ���� Sleep(300); //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START if (GetSimulationMode() == FALSE) { if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_AlignStartAck_CPJT)) m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Start Ack!")); } //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END //original // if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_AlignStartAck_CPJT)) // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Start Ack!")); // 1. get current glass result CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult(); if (pGlassResult==NULL) { Sleep(350); AlignCamera_CameraControl(CameraControlStop); // 210805 Align Camera Sequence ���� return; } const CRsRcpAlignInfo* pRsRcpAlignInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpAlignInfo(); if (pRsRcpAlignInfo == NULL) { Sleep(350); AlignCamera_CameraControl(CameraControlStop); // 210805 Align Camera Sequence ���� return; } // 2. get align camera control CCameraControlAlign* pAlignCameraControl = m_pSP2P->ISP2P_GetAlignCameraControl(); // 3. align process if(pRsRcpAlignInfo->m_bAlignSkipMode) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Align Skip Mode !!!!!!!")); //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START if (GetSimulationMode() == FALSE) { SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align SUCCESS Data!")); SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_AlignComplete_CPJT); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Complete Signal!")); //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END } //original // SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS); // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align SUCCESS Data!")); // SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_AlignComplete_CPJT); // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Complete Signal!")); Sleep(350); AlignCamera_CameraControl(CameraControlStop); // 210805 Align Camera Sequence ���� } else { // 190710 SJB Align Camera Disconnect Check, Align Step if(pAlignCameraControl) { if(pAlignCameraControl->AlignCameraDisconnectCheck() == FALSE) { //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START if (GetSimulationMode() == FALSE) { SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_FAIL); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Algin Camera Disconnect!!!!")); } //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END //original // SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_FAIL); // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Algin Camera Disconnect!!!!")); } } else { Sleep(350); AlignCamera_CameraControl(CameraControlStop); // 210805 Align Camera Sequence ���� } if (pGlassResult && pAlignCameraControl && pAlignCameraControl->AlignProcess()) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Align Find Process Started!")); } else { Sleep(1000); { //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START if (GetSimulationMode() == FALSE) { SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align SUCCESS Data!")); SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_AlignComplete_CPJT); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Complete Signal!")); } //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END //original // SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS); // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align SUCCESS Data!")); // SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_AlignComplete_CPJT); // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Complete Signal!")); } Sleep(350); AlignCamera_CameraControl(CameraControlStop); // 210805 Align Camera Sequence ���� //�ּ� Ǯ�� // 4. send align fail signal to plc //SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_FAIL); //m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Fail Data!")); //SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_AlignComplete_CPJT); //m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Complete Signal!")); } } ReviewCamera_CameraControl(CameraControlStart); m_pSP2P->ISP2P_UpdateProcessStatus(GetProcessStatus(), pGlassResult); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::OUT] AlignStart!")); } void CSequenceProcessor_CPJT::Process_ReadRawFile() { CDitGlassRawClient *pDitRawClient = CDitGlassRawClient::GetInstance(); //pDitRawClient->SetReviewStart(); Sleep(500); //CString strJudgeData; m_pSP2P->ISP2P_GetSignalControl()->WriteData(_T("17110"), sizeof(pDitRawClient->GetGlassData()->m_strGlassJudge), pDitRawClient->GetGlassData()->m_strGlassJudge); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::IN] ReadRawFile!")); //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START if (GetSimulationMode() == FALSE) { if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReadRawFileAck_CPJT)) m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Send Read Raw File Ack!")); } //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END //original // if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReadRawFileAck_CPJT)) // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Send Read Raw File Ack!")); if (bFileFind == FALSE) { //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START if (GetSimulationMode() == FALSE) { SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_FAIL); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Find Raw File Fail")); } //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END //original // SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_FAIL); // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Find Raw File Fail")); return; } // get current glass result CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult(); if (pGlassResult==NULL) return; CDitGlassRawClient* pDitSharedGlassRaw = CDitGlassRawClient::GetInstance(); if(pDitSharedGlassRaw->isConnect() == FALSE) m_pSP2P->ISP2P_DisplayMessage(_T("[DitGlassRawClient] Shared Memory Connect Fail")); if(!UpdateMemoryUserReflowPlanInfo(pDitSharedGlassRaw)) m_pSP2P->ISP2P_DisplayMessage(_T("[User,ReflowPlan Shared Memory] Update Fail!!")); // read aoi result CProcessTimer processTimer; processTimer.Start(); if(ReadAOIMemory(pGlassResult)) // 190201 SJB, Read AOI Memory { processTimer.End(); m_pSP2P->ISP2P_DisplayMessage(_T("[ReadRawFile] AOI Result File Read Completed![%.3f ms]"), processTimer.GetDurationMilliSecond()); pGlassResult->m_bReadRawFile = TRUE; CString strMessage = _T(""); strMessage.Format(_T("[Read Raw File] Total: %d [Crack: %d, Mask: %d, Pad: %d, Common: %d, Align: %d, Active: %d]"), pGlassResult->GetDefectResultCount(), pGlassResult->GetCrackDefectResultCount(), pGlassResult->GetMaskDefectResultCount(), pGlassResult->GetPadDefectResultCount(), pGlassResult->GetCommonDefectResultCount(), pGlassResult->GetAlignDefectResultCount(), pGlassResult->GetActiveDefectResultCount()); m_pSP2P->ISP2P_DisplayMessage(strMessage); // calculate motion plan int nTotalPlanCount = CalculatePlanData(pGlassResult); m_pSP2P->ISP2P_DisplayMessage(_T("[Read Raw File] Review All Plan Total Count : %d"), nTotalPlanCount); Sleep(1000); // send review ready //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START if (GetSimulationMode() == FALSE) { SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS); SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewReady_CPJT); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Send Review Ready Signal!")); } //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END //original // SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS); // SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewReady_CPJT); // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Send Review Ready Signal!")); } else { processTimer.End(); m_pSP2P->ISP2P_DisplayMessage(_T("[ReadRawFile] AOI Result File Read Fail![%.3f ms]"), processTimer.GetDurationMilliSecond()); //{ // // send review ready // SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS); // SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewReady_CPJT); // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Send Review Ready Signal!")); //} int nCurPlanIndex = 0; CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if(pRsRcpReviewInfo) { CRcpPlanInfo *pPlanInfo = pRsRcpReviewInfo->GetRcpPlanInfo(nCurPlanIndex); if (pPlanInfo) { if (pPlanInfo->m_nReviewType== CPJT_PlanUser) { // calculate motion plan int nTotalPlanCount = CalculatePlanData(pGlassResult); m_pSP2P->ISP2P_DisplayMessage(_T("[Read Raw File] Review All Plan Total Count : %d"), nTotalPlanCount); // send review ready //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START if (GetSimulationMode() == FALSE) { SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewReady_CPJT); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Send Review Ready Signal!")); } //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END //original // SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewReady_CPJT); // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Send Review Ready Signal!")); } } } } const CNetworkInfo *pNetworkInfo = m_pSP2P->ISP2P_System_GetNetworkInfo(); CString strPath = _T(""); //if(pNetworkInfo && pNetworkInfo->m_strUploadImagePath.IsEmpty() == FALSE) //{ // strPath.Format(_T("%s\\%s"), pNetworkInfo->m_strUploadImagePath, *pGlassResult->GetJobID());// pGlassResult->GetGlassID() -> pGlassResult->GetJobID() // CreateDirectory(strPath, NULL); //} CReviewProcessor* pReviewProcessor = m_pSP2P->ISP2P_GetReviewProcessor(); strPath = pReviewProcessor->GetUploadImagePath(); CFileFind Uploadfile, RTMSUploadPath; if (CDitGlassRawClient::GetInstance()->GetGlassData() == NULL) return; if(Uploadfile.FindFile(strPath)==FALSE) { CTime tmServerLoadingTime = CDitGlassRawClient::GetInstance()->GetGlassData()->m_tmGlassLoading; strPath.Format(_T("%s\\%s_%04d%02d%02d%02d%02d%02d"), pNetworkInfo->m_strUploadImagePath, pGlassResult->m_strJobID, tmServerLoadingTime.GetYear(), tmServerLoadingTime.GetMonth(), tmServerLoadingTime.GetDay(), tmServerLoadingTime.GetHour(), tmServerLoadingTime.GetMinute(), tmServerLoadingTime.GetSecond()); CreateDirectory(strPath, NULL); pReviewProcessor->SetUploadImagePath(strPath); CreateDirectory(pReviewProcessor->GetRTMSUploadImagePath(),NULL); } if(pGlassResult) m_pSP2P->ISP2P_UpdateProcessStatus(GetProcessStatus(), pGlassResult); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile_OUT] ReadRawFile!")); } void CSequenceProcessor_CPJT::Process_ReviewStart() { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::IN] ReviewStart!")); DWORD dwTime = GetTickCount(); dwRevStartTickCount = dwTime; SetLastPointCheck(FALSE); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::IN] %d Tick Count"), dwTime); //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START if (GetSimulationMode() == FALSE) { if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewStartAck_CPJT)) m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Start Ack!")); } //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END //original // if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewStartAck_CPJT)) // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Start Ack!")); const CRsRcpAlignInfo* pRsRcpAlignInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpAlignInfo(); if(pRsRcpAlignInfo == NULL) return; CTotalPitchMeasure* pTotapPithMeasure = m_pSP2P->ISP2P_GetTotalPitchMeasure(); // 190708 SJB TotalPithchMeasure Start //if(pRsRcpAlignInfo->m_bTotalPitchMeasure && pTotapPithMeasure) //{ // ReviewCamera_CameraControl(CameraControlLive); // Sleep(100); // AFM_SetAFMTracking(TRUE); // pTotapPithMeasure->Reset(); // if(pTotapPithMeasure->StartTotalPitchMeasure()) // { // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor] TotalPitchMeasure Result Success!")); // CDitGlassRawClient *pDitRawClient = CDitGlassRawClient::GetInstance(); // if(pDitRawClient) // { // _grmCellData* pCellData = pDitRawClient->GetCellData(0); // if(pCellData) // { // // pCellData->m_nTotalPitchData[0] = int(pTotapPithMeasure->GetTotalPitchBD() * 1000); // // pCellData->m_nTotalPitchData[1] = int(pTotapPithMeasure->GetTotalPitchAC() * 1000); // // pCellData->m_nTotalPitchData[2] = int(pTotapPithMeasure->GetTotalPitchAB() * 1000); // // pCellData->m_nTotalPitchData[3] = int(pTotapPithMeasure->GetTotalPitchCD() * 1000); // } // } // } // else // { // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor] TotalPitchMeasure Result Fail!")); // // if(!pTotapPithMeasure->GetMotorEnable()) // { // SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_FAIL); // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor] MotionEnable Check Fail!!! Review Fail Signal")); // } // } // ReviewCamera_CameraControl(CameraControlStop); // Sleep(200); //} // review camera Start ReviewCamera_CameraControl(CameraControlStart); CGlassResult *pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult(); if (pGlassResult==NULL) return; SetReviewCount(0); if(FirstReviewPlanStart() <= 0) { //Sleep(1000); //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START if (GetSimulationMode() == FALSE) { SendResultToSignalControl(PCControlSendData_ReviewComplete_CPJT, SIGNAL_SEND_RESULT_SUCCESS); SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewComplete_CPJT); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Success Signal!")); } //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END //original // SendResultToSignalControl(PCControlSendData_ReviewComplete_CPJT, SIGNAL_SEND_RESULT_SUCCESS); // SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewComplete_CPJT); // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Success Signal!")); } else { //Sleep(1000); //SendResultToSignalControl(PCControlSendData_ReviewComplete_CPJT, SIGNAL_SEND_RESULT_SUCCESS); //SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewComplete_CPJT); //m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Success Signal!")); } // Process Status Update if(pGlassResult) { m_pSP2P->ISP2P_UpdateProcessStatus(GetProcessStatus(), pGlassResult); } m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::OUT] ReviewStart!")); } void CSequenceProcessor_CPJT::Process_ReviewEnd() { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::IN] ReviewEnd!")); //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START if (GetSimulationMode() == FALSE) { if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewEndAck_CPJT)) m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] Send Review End Ack!")); } //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END //original // if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewEndAck_CPJT)) // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] Send Review End Ack!")); CDitGlassRawClient* m_pDitGlassRaw = CDitGlassRawClient::GetInstance(); if (m_pSP2P->ISP2P_GetWSIControl(0)!=NULL) { m_pSP2P->ISP2P_GetWSIControl(0)->SetWsiTimeOver(); m_pSP2P->ISP2P_GetWSIControl(1)->SetWsiTimeOver(); } if (GetLastPointCheck() == FALSE) { Sleep(1000); } ReJudgeProcessing(m_pDitGlassRaw); m_pDitGlassRaw->GetGlassData()->m_tmReviewEnd = CTime::GetCurrentTime(); if (m_pDitGlassRaw->isConnect() != FALSE) { m_pDitGlassRaw->SetReviewEnd(); m_pDitGlassRaw->WriteReviewRawBinFile(); } m_pDitGlassRaw->GetGlassData()->m_nReviewNum = m_pSP2P->ISP2P_GetReviewProcessor()->GetPlanReviewCount(); //SendDVDataToSignalControl(); if (GetLastPointCheck() == FALSE) { //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START if (GetSimulationMode() == FALSE) { SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS); SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewComplete_CPJT); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Success Signal!")); } //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END //original // SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS); // SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewComplete_CPJT); // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Success Signal!")); } CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult(); if (pGlassResult==NULL) return; // review camera stop ReviewCamera_CameraControl(CameraControlStop); SetReviewCount(0); CReviewProcessor* pReviewProcessor = m_pSP2P->ISP2P_GetReviewProcessor(); if (pReviewProcessor == NULL) return; pReviewProcessor->SetPlanReviewCount(0); pReviewProcessor->SetPlanWSICount(0); //SetMotionStop(); AFM_SetAFMTracking(FALSE); if (m_pSP2P->ISP2P_GetWSIControl(0) != NULL) { m_pSP2P->ISP2P_GetWSIControl(0)->SendWsiAfmSafePosMove(); m_pSP2P->ISP2P_GetWSIControl(1)->SendWsiAfmSafePosMove(); } if(m_pDitGlassRaw->isConnect()==FALSE) WriteRawData(pGlassResult); if(pGlassResult->m_nDeFocusCount >0) { SendSignalToSignalControl(PCControlSendSignalIndex_State,PCControlSend_Defoucs,1000); CTime time =CTime::GetCurrentTime(); CString strTime = _T(""); strTime.Format(_T("%04d-%02d-%02d %02d:%02d:%02d"), time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond()); CDlgDefocusList::GetInstance()->SetDefocusTotalCount(pGlassResult->m_nDeFocusCount); CDlgDefocusList::GetInstance()->SetDefocusData(strTime,pGlassResult->m_strGlassID,pGlassResult->m_nDeFocusCount); } g_pLog->DisplayMessage(_T("History map Start")); int nGlassResultCount = 0; CGlassResult* pHistoryResult = m_pSP2P->ISP2P_GetNewHistoryResult(nGlassResultCount); //taek 210201 g_pLog->DisplayMessage(_T("History map Copy")); ReadAOIMemory2(pHistoryResult); g_pLog->DisplayMessage(_T("History map TransferData")); UpdateHistoryResultFromTransferData(pHistoryResult, pGlassResult); g_pLog->DisplayMessage(_T("History Button Enable")); m_pSP2P->ISP2P_GetDiagnosisHistory2(); /*int nModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(); for (int nModuleIdx = 0; nModuleIdx < nModuleCount; nModuleIdx++) { { ReviewLight_SetLightLevel(nModuleIdx, 0); g_pLog->DisplayMessage(_T("Module[%d] LightLevel"), nModuleIdx); } }*/ //5. PCControl if (pGlassResult) { m_pSP2P->ISP2P_UpdateProcessStatus(GetProcessStatus(), pGlassResult); g_pLog->DisplayMessage(_T("PCControl Update Signal")); } //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START if (GetSimulationMode() == FALSE) { SendResultToSignalControl(PCControlSendData_ReviewResultFileCreateComplete_CPJT, SIGNAL_SEND_RESULT_SUCCESS); SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ResultDataComplete_CPJT); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] Send ResultData Complete Signal!")); } //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END // SendResultToSignalControl(PCControlSendData_ReviewResultFileCreateComplete_CPJT, SIGNAL_SEND_RESULT_SUCCESS); // SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ResultDataComplete_CPJT); // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] Send ResultData Complete Signal!")); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::OUT] ReviewEnd!")); } void CSequenceProcessor_CPJT::Process_ReviewUnloading() { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::IN] Review Unloading!")); //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START if (GetSimulationMode() == FALSE) { if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewUnloadingAck_CPJT)) m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Unloading Ack!")); } //original //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END // if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewUnloadingAck_CPJT)) // m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Unloading Ack!")); } BOOL CSequenceProcessor_CPJT::ReJudgeProcessing(CDitGlassRawClient* pRawData) { CGlassResult* pResultdata= m_pSP2P->ISP2P_GetCurrentGlassResult(); CRsRcpReviewInfo* pRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); //m_pSP2P->ISP2P_Recipe_GetRsRecipeManager(); int nZoneIndex = 0; double dWsiDefectHeight = 0; double dWsiRedHeight = 0; double dWsiGreenHeight = 0; double dWsiBlueHeight = 0; double dWsiCSHeight = 0; double dJudgeHight = 0; CString strCode = _T(""); int nDefectCount = pRawData->GetGlassData()->m_nDefectNum; int nJudgeCount = pRcpReviewInfo->GetRcpZoneFilterInfoCount(); int nFilterType = 0; int nJudgeType = 0; int nZoneNumber = 0; int nReJudge = 0; int nJudge = 0; int nJudgeTRCount = 0; int nJudgeOKCount = 0; int nJudgeCellTRCount = 0; int nJudgeCellOKCount = 0; int nPixelSize = 0; int nPixelFilterSize = 0; //1 wsi, 3 CS, 4 R, 5 G, 6 B //pRawData->GetDefectData(nDefectIdx)->m_ReviewDefect.m_fWsi_ResultData[1];//Defect //pRawData->GetDefectData(nDefectIdx)->m_ReviewDefect.m_fWsi_ResultData[3];//cs //pRawData->GetDefectData(nDefectIdx)->m_ReviewDefect.m_fWsi_ResultData[4];//R //pRawData->GetDefectData(nDefectIdx)->m_ReviewDefect.m_fWsi_ResultData[5];//G //pRawData->GetDefectData(nDefectIdx)->m_ReviewDefect.m_fWsi_ResultData[6];//B /*int k = 0;*/ m_pSP2P->ISP2P_DisplayMessage(_T("[ReviewEnd] Start DefectRejudge")); // 0 OK 1 TR for (int nDefectIdx = 0; nDefectIdx < nDefectCount; nDefectIdx++) { #pragma region Align fail if (m_pSP2P->ISP2P_GetCurrentGlassResult()->GetAlignResult()->nResultCode != Align_Success) { m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] Align Fail WSI Rejudge Cancel")); break; } #pragma endregion #pragma region WSITYPE if (pRawData->GetDefectData(nDefectIdx)->m_ReviewDefect.m_nWsi_Type == 2) { } else { continue; } #pragma endregion #pragma region AOIFixelFilter if (pRcpReviewInfo->GetJudgeFilterAoiFixel() < 0) { nPixelFilterSize = 0; } else { nPixelFilterSize = pRcpReviewInfo->GetJudgeFilterAoiFixel(); } if (pRawData->GetDefectData(nDefectIdx)->m_nPixelSize < 0) { nPixelSize = 0; } else { nPixelSize = pRawData->GetDefectData(nDefectIdx)->m_nPixelSize; } if (nPixelFilterSize <= nPixelSize && nPixelFilterSize != 0) { m_pSP2P->ISP2P_DisplayMessage(_T("[ReviewEnd] Size filtering Pixel Size[%d] nPixelFilterSize [%d]"), nPixelSize,nPixelFilterSize); continue; } #pragma endregion #pragma region TRJUDGE ////////////////////////////////////////////// for (int nJudgeindex = 0; nJudgeindex < nJudgeCount; nJudgeindex++) { //nZoneType = GetZoneType(); dJudgeHight = pRcpReviewInfo->GetRcpZoneFilteringInfo(nJudgeindex)->GetJudgeHeight(); nFilterType = pRcpReviewInfo->GetRcpZoneFilteringInfo(nJudgeindex)->m_nFilterType; //ZONE nJudge = pRcpReviewInfo->GetRcpZoneFilteringInfo(nJudgeindex)->m_nFilterJudge; //OK TR //nZoneNumber = pRcpReviewInfo->GetRcpZoneInfo(nFilterType)->m_vecZoneNumber[0]; if (pRawData->GetDefectData(nDefectIdx)->m_ReviewDefect.m_nWsi_Type == 2) // 210330 kyh { BOOL isZoneValue = FALSE; for(nZoneIndex = 0; nZoneIndex < pRcpReviewInfo->GetRcpZoneInfo(nFilterType)->m_vecZoneNumber.size();nZoneIndex++) { nZoneNumber = pRcpReviewInfo->GetRcpZoneInfo(nFilterType)->m_vecZoneNumber[nZoneIndex]; if (pRawData->GetDefectData(nDefectIdx)->m_sZonePixelCount[nZoneNumber] <= 0) { continue; } else { m_pSP2P->ISP2P_DisplayMessage(_T("[WSIZoneCheck] Zone[%d], DefectIndex[%d]"), nZoneNumber, pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx); //210330 kyh isZoneValue = TRUE; //break; } } if (isZoneValue == FALSE) { m_pSP2P->ISP2P_DisplayMessage(_T("[WSIZoneCheck] NoFail DefectIndex[%d]"), pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx); //210330 kyh continue; } nJudgeType = ReJugdeWSIType(nFilterType); float fWsiData = pRawData->GetDefectData(nDefectIdx)->m_ReviewDefect.m_fWsi_ResultData[nJudgeType]; if (fWsiData >= dJudgeHight) { //if (nJudge == 1)//TR { if (pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement == DEFECT_JUDGE_CPJT_OK) { int nJudgement = pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement; pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement = DEFECT_JUDGE_CPJT_TR; if (pRawData->GetDefectData(nDefectIdx)->m_DefectBDType == 0) { pRawData->GetGlassData()->m_nDefectNumJudgeOKWhite -= 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeOKWhite -= 1; pRawData->GetGlassData()->m_nDefectNumJudgeTR += 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeTR += 1; } else { pRawData->GetGlassData()->m_nDefectNumJudgeOKBlack -= 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeOKBlack -= 1; pRawData->GetGlassData()->m_nDefectNumJudgeTR += 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeTR += 1; } m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] WSI TYPE[%d] H:%0.3lf J.H:%0.3lf ReJudge [%d]Defect Grade! [%d]->[%s] cell[%d]"), nJudgeType, fWsiData, dJudgeHight,pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx, nJudgement, _T("TR"),pRawData->GetDefectData(nDefectIdx)->m_nCellIdx); } else if (pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement == DEFECT_JUDGE_CPJT_PR) { int nJudgement = pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement; pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement = DEFECT_JUDGE_CPJT_TR; { pRawData->GetGlassData()->m_nDefectNumJudgePR -= 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgePR -= 1; pRawData->GetGlassData()->m_nDefectNumJudgeTR += 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeTR += 1; } m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] WSI TYPE[%d] H:%0.3lf J.H:%0.3lf ReJudge [%d]Defect Grade! [%d]->[%s] cell[%d]"), nJudgeType, fWsiData, dJudgeHight, pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx, nJudgement, _T("TR"), pRawData->GetDefectData(nDefectIdx)->m_nCellIdx); } else { m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] WSI TYPE[%d] ReJudge Defect Grade! [%s]->[%s]"), nJudgeType,_T("TR"), _T("TR")); } } } else if (fWsiData<=0) { m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] WSI TYPE[%d] WSI Height[%0.3lf] <= 0 Cancel Rejudge"), nJudgeType, fWsiData); } else { //20210419 TR //if (nJudge == 1)//TR -> OK //{ if (pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement == DEFECT_JUDGE_CPJT_OK || pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement == DEFECT_JUDGE_CPJT_Unknown) { m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] WSI TYPE[%d] ReJudge Defect Grade!! [%s]->[%s]"), nJudgeType, _T("OK"), _T("OK")); } else if (pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement == DEFECT_JUDGE_CPJT_PR) { int nJudgement = pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement; pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement = DEFECT_JUDGE_CPJT_OK; if (pRawData->GetDefectData(nDefectIdx)->m_DefectBDType == 0) { pRawData->GetGlassData()->m_nDefectNumJudgeOKWhite += 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeOKWhite += 1; pRawData->GetGlassData()->m_nDefectNumJudgePR -= 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgePR -= 1; } else { pRawData->GetGlassData()->m_nDefectNumJudgeOKBlack += 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeOKBlack += 1; pRawData->GetGlassData()->m_nDefectNumJudgePR -= 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgePR -= 1; } m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] WSI TYPE[%d] H:%0.3lf J.H:%0.3lf ReJudge [%d]Defect Grade! [%d]->[%s] cell[%d]"), nJudgeType, fWsiData, dJudgeHight, pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx, nJudgement, _T("OK"), pRawData->GetDefectData(nDefectIdx)->m_nCellIdx); } else { int nJudgement = pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement; pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement = DEFECT_JUDGE_CPJT_OK; if (pRawData->GetDefectData(nDefectIdx)->m_DefectBDType == 0) { pRawData->GetGlassData()->m_nDefectNumJudgeOKWhite += 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeOKWhite += 1; pRawData->GetGlassData()->m_nDefectNumJudgeTR -= 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeTR -= 1; } else { pRawData->GetGlassData()->m_nDefectNumJudgeOKBlack += 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeOKBlack += 1; pRawData->GetGlassData()->m_nDefectNumJudgeTR -= 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeTR -= 1; } m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] WSI TYPE[%d] H:%0.3lf J.H:%0.3lf ReJudge [%d]Defect Grade! [%d]->[%s] cell[%d]"), nJudgeType, fWsiData, dJudgeHight, pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx, nJudgement, _T("OK"), pRawData->GetDefectData(nDefectIdx)->m_nCellIdx); } } } else //WSI TYPE { continue; } //TR Judge forEnd } #pragma endregion #pragma region PRJUDGE ////////////////////////////////////////////// nJudgeCount = pRcpReviewInfo->GetRcpZoneFilterInfoCount_PR(); for (int nJudgeindex = 0; nJudgeindex < nJudgeCount; nJudgeindex++) { //nZoneType = GetZoneType(); dJudgeHight = pRcpReviewInfo->GetRcpZoneFilteringInfo_PR(nJudgeindex)->GetJudgeHeight(); nFilterType = pRcpReviewInfo->GetRcpZoneFilteringInfo_PR(nJudgeindex)->m_nFilterType; //ZONE nJudge = pRcpReviewInfo->GetRcpZoneFilteringInfo_PR(nJudgeindex)->m_nFilterJudge; //OK TR //nZoneNumber = pRcpReviewInfo->GetRcpZoneInfo(nFilterType)->m_vecZoneNumber[0]; if (pRawData->GetDefectData(nDefectIdx)->m_ReviewDefect.m_nWsi_Type == 2) // 210330 { BOOL isZoneValue = FALSE; for (nZoneIndex = 0; nZoneIndex < pRcpReviewInfo->GetRcpZoneInfo(nFilterType)->m_vecZoneNumber.size(); nZoneIndex++) { nZoneNumber = pRcpReviewInfo->GetRcpZoneInfo(nFilterType)->m_vecZoneNumber[nZoneIndex]; if (pRawData->GetDefectData(nDefectIdx)->m_sZonePixelCount[nZoneNumber] <= 0) { continue; } else { m_pSP2P->ISP2P_DisplayMessage(_T("[WSIZoneCheck] Zone[%d], DefectIndex[%d]"), nZoneNumber, pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx); //210330 kyh isZoneValue = TRUE; //break; } } if (isZoneValue == FALSE) { m_pSP2P->ISP2P_DisplayMessage(_T("[WSIZoneCheck] NoFail DefectIndex[%d]"), pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx); //210330 kyh continue; } nJudgeType = ReJugdeWSIType(nFilterType); float fWsiData = pRawData->GetDefectData(nDefectIdx)->m_ReviewDefect.m_fWsi_ResultData[nJudgeType]; if (fWsiData <= dJudgeHight) { //PR { //OK if (pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement == DEFECT_JUDGE_CPJT_OK|| pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement == DEFECT_JUDGE_CPJT_Unknown) { int nJudgement = pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement; pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement = DEFECT_JUDGE_CPJT_PR; if (pRawData->GetDefectData(nDefectIdx)->m_DefectBDType == 0) { pRawData->GetGlassData()->m_nDefectNumJudgeOKWhite -= 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeOKWhite -= 1; pRawData->GetGlassData()->m_nDefectNumJudgePR+= 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgePR += 1; } else { pRawData->GetGlassData()->m_nDefectNumJudgeOKBlack -= 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeOKBlack -= 1; pRawData->GetGlassData()->m_nDefectNumJudgePR += 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgePR += 1; } m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] WSI TYPE[%d] H:%0.3lf J.H:%0.3lf ReJudge [%d]Defect Grade! [%d]->[%s] cell[%d]"), nJudgeType, fWsiData, dJudgeHight, pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx, nJudgement, _T("PR"), pRawData->GetDefectData(nDefectIdx)->m_nCellIdx); } else if(pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement == DEFECT_JUDGE_CPJT_TR)//TR { int nJudgement = pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement; pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement = DEFECT_JUDGE_CPJT_PR; { pRawData->GetGlassData()->m_nDefectNumJudgeTR -= 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeTR -= 1; pRawData->GetGlassData()->m_nDefectNumJudgePR += 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgePR += 1; } m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] WSI TYPE[%d] H:%0.3lf J.H:%0.3lf ReJudge [%d]Defect Grade! [%d]->[%s] cell[%d]"), nJudgeType, fWsiData, dJudgeHight, pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx, nJudgement, _T("PR"), pRawData->GetDefectData(nDefectIdx)->m_nCellIdx); } else { m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] WSI TYPE[%d] ReJudge Defect Grade! [%s]->[%s]"), nJudgeType, _T("PR"), _T("PR")); } } } else { //if (nJudge == 1)//TR -> OK //{ if (pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement == DEFECT_JUDGE_CPJT_OK || pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement == DEFECT_JUDGE_CPJT_Unknown) { m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] WSI TYPE[%d] ReJudge Defect Grade!! [%s]->[%s]"), nJudgeType, _T("OK"), _T("OK")); } else if (pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement == DEFECT_JUDGE_CPJT_TR) { int nJudgement = pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement; pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement = DEFECT_JUDGE_CPJT_OK; if (pRawData->GetDefectData(nDefectIdx)->m_DefectBDType == 0) { pRawData->GetGlassData()->m_nDefectNumJudgeOKWhite += 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeOKWhite += 1; pRawData->GetGlassData()->m_nDefectNumJudgeTR -= 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeTR -= 1; } else { pRawData->GetGlassData()->m_nDefectNumJudgeOKBlack += 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeOKBlack += 1; pRawData->GetGlassData()->m_nDefectNumJudgeTR -= 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeTR -= 1; } m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] WSI TYPE[%d] H:%0.3lf J.H:%0.3lf ReJudge [%d]Defect Grade! [%d]->[%s] cell[%d]"), nJudgeType, fWsiData, dJudgeHight, pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx, nJudgement, _T("OK"), pRawData->GetDefectData(nDefectIdx)->m_nCellIdx); } else // PR { int nJudgement = pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement; pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement = DEFECT_JUDGE_CPJT_OK; if (pRawData->GetDefectData(nDefectIdx)->m_DefectBDType == 0) { pRawData->GetGlassData()->m_nDefectNumJudgeOKWhite += 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeOKWhite += 1; pRawData->GetGlassData()->m_nDefectNumJudgePR -= 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgePR -= 1; } else { pRawData->GetGlassData()->m_nDefectNumJudgeOKBlack += 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeOKBlack += 1; pRawData->GetGlassData()->m_nDefectNumJudgePR -= 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeTR -= 1; } m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] WSI TYPE[%d] H:%0.3lf J.H:%0.3lf ReJudge [%d]Defect Grade! [%d]->[%s] cell[%d]"), nJudgeType, fWsiData, dJudgeHight, pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx, nJudgement, _T("OK"), pRawData->GetDefectData(nDefectIdx)->m_nCellIdx); } } } else //WSI TYPE { continue; } //TR Judge forEnd } #pragma endregion #pragma region CODEJUDGE nJudgeCount = pRcpReviewInfo->GetRcpZoneFilterInfoCount_CODE(); for (int nJudgeindex = 0; nJudgeindex < nJudgeCount; nJudgeindex++) { strCode =pRcpReviewInfo->GetRcpZoneFilteringInfo_CODE(nJudgeindex)->m_FilterCode; if (pRawData->GetDefectData(nDefectIdx)->m_ReviewDefect.m_nWsi_Type == 2) // 210330 { nJudgeType = ReJugdeWSIType(nFilterType); float fWsiData = pRawData->GetDefectData(nDefectIdx)->m_ReviewDefect.m_fWsi_ResultData[nJudgeType]; if (strcmp(strCode,pRawData->GetDefectData(nDefectIdx)->m_strDefectCode) == 0) { //if (nJudge == 1)//TR { if (pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement != DEFECT_JUDGE_CPJT_TR) { int nJudgement = pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement; pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement = DEFECT_JUDGE_CPJT_TR; if (pRawData->GetDefectData(nDefectIdx)->m_DefectBDType == 0) { pRawData->GetGlassData()->m_nDefectNumJudgeOKWhite -= 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeOKWhite -= 1; pRawData->GetGlassData()->m_nDefectNumJudgeTR += 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeTR += 1; } else { pRawData->GetGlassData()->m_nDefectNumJudgeOKBlack -= 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeOKBlack -= 1; pRawData->GetGlassData()->m_nDefectNumJudgeTR += 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeTR += 1; } m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] CODE JUDGE WSI TYPE[%d] CODE[%s] H:%0.3lf J.H:%0.3lf ReJudge [%d]Defect Grade! [%d]->[%s] cell[%d]"), nJudgeType, pRawData->GetDefectData(nDefectIdx)->m_strDefectCode, fWsiData, dJudgeHight, pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx, nJudgement, _T("TR"), pRawData->GetDefectData(nDefectIdx)->m_nCellIdx); } else if (pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement != DEFECT_JUDGE_CPJT_PR) { int nJudgement = pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement; pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement = DEFECT_JUDGE_CPJT_TR; { pRawData->GetGlassData()->m_nDefectNumJudgePR -= 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgePR -= 1; pRawData->GetGlassData()->m_nDefectNumJudgeTR += 1; pRawData->GetCellData(pRawData->GetDefectData(nDefectIdx)->m_nCellIdx)->m_nDefectNumJudgeTR += 1; } m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] CODE JUDGE WSI TYPE[%d] CODE[%s] H:%0.3lf J.H:%0.3lf ReJudge [%d]Defect Grade! [%d]->[%s] cell[%d]"), nJudgeType, pRawData->GetDefectData(nDefectIdx)->m_strDefectCode, fWsiData, dJudgeHight, pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx, nJudgement, _T("TR"), pRawData->GetDefectData(nDefectIdx)->m_nCellIdx); } else { m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] CODE JUDGE WSI TYPE[%d] CODE[%s] ReJudge Defect Grade! [%s]->[%s]"), nJudgeType, pRawData->GetDefectData(nDefectIdx)->m_strDefectCode, _T("TR"), _T("TR")); } } } else { m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] CODE JUDGE WSI TYPE[%d] Defect CODE [%s] != [%s]"), nJudgeType, strCode, pRawData->GetDefectData(nDefectIdx)->m_strDefectCode); } } else //WSI TYPE { continue; } //TR Judge forEnd } #pragma endregion } #pragma region CELLJUDGE int nCellCount = pRawData->GetGlassData()->m_nCellNum; int nCount = pRcpReviewInfo->GetRcpJudgeCellDefectCount(); int nOK; int nCellTRJudge = 0, nCelllOKJuge = 0, nCelllPRJuge = 0; m_pSP2P->ISP2P_DisplayMessage(_T("[ReviewEnd] Start Cell Defect Rejudge")); for (int nCellIndex = 0; nCellIndex < nCellCount; nCellIndex++) { if (pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_TR_CPJT) { nCellTRJudge = nCellTRJudge + 1; } else if (pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_OK_CPJT) { nCelllOKJuge = nCelllOKJuge + 1; } //taek 21.01.25 else if (pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_PR_CPJT) { nCelllPRJuge = nCelllPRJuge + 1; } BOOL bReJudge = FALSE, bSubReJudge = FALSE; for (int nIdx = 0; nIdx < nCount; nIdx++) { bReJudge = bSubReJudge = FALSE; CRcpJudgeInfo* pRcpJudgeInfo = pRcpReviewInfo->GetRcpJudgeCellDefectInfo(nIdx); if (pRcpJudgeInfo == NULL) continue; switch (pRcpJudgeInfo->GetJudgeType()) { case JudgeType_T8_None: break; case JudgeType_T8_OK: nOK =pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgeOKBlack + pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgeOKWhite; if (nOK >= pRcpJudgeInfo->GetJudgeCount()) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell Defect OK Count[%d] >= [%d]"), nCellIndex, nOK, pRcpJudgeInfo->GetJudgeCount()); bReJudge = TRUE; } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE CellDefect OK Count[%d] [%d]"), nCellIndex, nOK, pRcpJudgeInfo->GetJudgeCount()); } break; case JudgeType_T8_TR: if (pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgeTR >= 0) { if (pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgeTR >= pRcpJudgeInfo->GetJudgeCount()) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell DefectTRCount[%d] >= [%d]"), nCellIndex, pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgeTR, pRcpJudgeInfo->GetJudgeCount()); bReJudge = TRUE; } { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE Cell DefectTRCount[%d] [%d]"), nCellIndex, pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgeTR, pRcpJudgeInfo->GetJudgeCount()); } } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] Count Number is minus! [%02d]Cell DefectTRCount[%d] >= [%d]"), nCellIndex, pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgeTR, pRcpJudgeInfo->GetJudgeCount()); } break; case JudgeType_T8_PR: if (pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgePR >= pRcpJudgeInfo->GetJudgeCount()) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell DefectPRCount[%d] >= [%d]"), nCellIndex, pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgePR, pRcpJudgeInfo->GetJudgeCount()); bReJudge = TRUE; } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE Cell DefectPRCount[%d] [%d]"), nCellIndex, pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgePR, pRcpJudgeInfo->GetJudgeCount()); } break; } // 2nd condition switch (pRcpJudgeInfo->GetSubJudgeType()) { case JudgeType_T8_None: bSubReJudge = TRUE; break; case JudgeType_T8_OK: nOK = pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgeOKBlack + pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgeOKWhite; if (nOK <= pRcpJudgeInfo->GetSubJudgeCount()) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell Defect OK Count[%d] <= [%d]"), nCellIndex, nOK, pRcpJudgeInfo->GetJudgeCount()); bSubReJudge = TRUE; } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE CellDefect OK Count[%d] [%d]"), nCellIndex, nOK, pRcpJudgeInfo->GetJudgeCount()); } break; case JudgeType_T8_TR: if (pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgeTR >= 0) { if (pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgeTR <= pRcpJudgeInfo->GetSubJudgeCount()) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell DefectTRCount[%d] <= [%d]"), nCellIndex, pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgeTR, pRcpJudgeInfo->GetSubJudgeCount()); bSubReJudge = TRUE; } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE Cell DefectTRCount[%d] [%d]"), nCellIndex, pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgeTR, pRcpJudgeInfo->GetSubJudgeCount()); } } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] Count Number is minus! [%02d]Cell DefectTRCount[%d] <= [%d]"), nCellIndex, pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgeTR, pRcpJudgeInfo->GetSubJudgeCount()); } break; case JudgeType_T8_PR: if (pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgePR <= pRcpJudgeInfo->GetSubJudgeCount()) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell DefectPRCount[%d] <= [%d]"), nCellIndex, pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgePR, pRcpJudgeInfo->GetSubJudgeCount()); bSubReJudge = TRUE; } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE Cell DefectPRCount[%d] [%d]"), nCellIndex, pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgePR, pRcpJudgeInfo->GetSubJudgeCount()); } break; } if (bReJudge & bSubReJudge) { if (pRcpJudgeInfo->GetReJudgeType() == JudgeType_T8_TR)//TR { if (pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_OK_CPJT) { int nbfJudge = pRawData->GetCellData(nCellIndex)->m_nJudgement; pRawData->GetCellData(nCellIndex)->m_nJudgement = Judge_TR_CPJT; m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition : ReJudge Cell Defect Grade! [%d]->[%s]") , nCellIndex, nIdx, nbfJudge, pRcpJudgeInfo->GetReJudgeCode()); nCelllOKJuge -= 1; nCellTRJudge += 1; if (nCelllOKJuge < 0) { nCelllOKJuge = 0; } m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d]") , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge,nCelllPRJuge); } else if (pRawData->GetCellData(nCellIndex)->m_nJudgement==Judge_PR_CPJT) { int nbfJudge = pRawData->GetCellData(nCellIndex)->m_nJudgement; pRawData->GetCellData(nCellIndex)->m_nJudgement = Judge_TR_CPJT; m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition : ReJudge Cell Defect Grade! [%d]->[%s]") , nCellIndex, nIdx, nbfJudge, pRcpJudgeInfo->GetReJudgeCode()); nCelllPRJuge -= 1; nCellTRJudge += 1; if (nCelllPRJuge < 0) { nCelllPRJuge = 0; } m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d]") , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge); } else { m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd][%02d]Cell [%02d] ReJudge Cell Defect Grade! [%s]->[%s]"), nCellIndex, nIdx,_T("TR"), _T("TR")); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d]") , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge); } } else if (pRcpJudgeInfo->GetReJudgeType() == JudgeType_T8_PR) { if (pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_OK_CPJT) { int nbfJudge = pRawData->GetCellData(nCellIndex)->m_nJudgement; pRawData->GetCellData(nCellIndex)->m_nJudgement = Judge_PR_CPJT; m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition : ReJudge Cell Defect Grade! [%d]->[%s]") , nCellIndex, nIdx, nbfJudge, pRcpJudgeInfo->GetReJudgeCode()); nCelllOKJuge -= 1; nCelllPRJuge += 1; if (nCelllOKJuge < 0) { nCelllOKJuge = 0; } m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d]") , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge); } if (pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_TR_CPJT) { int nbfJudge = pRawData->GetCellData(nCellIndex)->m_nJudgement; pRawData->GetCellData(nCellIndex)->m_nJudgement = Judge_PR_CPJT; m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition : ReJudge Cell Defect Grade! [%d]->[%s]") , nCellIndex, nIdx, nbfJudge, pRcpJudgeInfo->GetReJudgeCode()); nCellTRJudge -= 1; nCelllPRJuge += 1; if (nCellTRJudge < 0) { nCellTRJudge = 0; } m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d]") , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge); } else { m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd][%02d]Cell [%02d] ReJudge Cell Defect Grade! [%s]->[%s]"), nCellIndex, nIdx, _T("PR"), _T("PR")); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d]") , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge); } } else//OK { if (pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_OK_CPJT || pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_Unknown_CPJT) { m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd][%02d]Cell [%02d] ReJudge Cell Defect Grade! [%s]->[%s]"), nCellIndex, nIdx,_T("OK"), _T("OK")); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d]") , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge); } else { pRawData->GetCellData(nCellIndex)->m_nJudgement = 0; m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition : ReJudge Cell Defect Grade! [%s]->[%s]") , nCellIndex, nIdx, _T("OK"), pRcpJudgeInfo->GetReJudgeCode()); if (pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_TR_CPJT) { nCelllOKJuge += 1; nCellTRJudge -= 1; if (nCellTRJudge < 0) { nCellTRJudge = 0; } } else if (pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_PR_CPJT) { nCelllOKJuge += 1; nCelllPRJuge -= 1; if (nCelllPRJuge < 0) { nCelllPRJuge = 0; } } m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d]") , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge); } } } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition : Keep ReJudge Cell Defect Grade!") , nCellIndex, nIdx); } } } m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] CELL COUNT OK:[%d] TR[%d] PR[%d]"), nCelllOKJuge, nCellTRJudge, nCelllPRJuge); #pragma endregion #pragma region GLASSJUDGE CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if (pRsRcpReviewInfo == NULL) return FALSE; // check recipe defect judge BOOL bReJudge = FALSE, bSubReJudge = FALSE; nCount = pRsRcpReviewInfo->GetRcpJudgeGlassDefectCount(); #pragma region GLASSJUDGE_Defect m_pSP2P->ISP2P_DisplayMessage(_T("[ReviewEnd] Start GLASS Defect Rejudge")); for (int nIdx = 0; nIdx < nCount; nIdx++) { bReJudge = bSubReJudge = FALSE; const CRcpJudgeInfo* pRcpJudgeInfo = pRsRcpReviewInfo->GetRcpJudgeGlassDefectInfo(nIdx); if (pRcpJudgeInfo == NULL) continue; // 1st condition switch (pRcpJudgeInfo->GetJudgeType()) { case JudgeType_T8_None: break; case JudgeType_T8_OK: nOK = pRawData->GetGlassData()->m_nDefectNumJudgeOKBlack + pRawData->GetGlassData()->m_nDefectNumJudgeOKWhite; if (nOK >= pRcpJudgeInfo->GetJudgeCount()) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]GLASS Defect OK Count[%d] >= [%d]"), nIdx, nOK, pRcpJudgeInfo->GetJudgeCount()); bReJudge = TRUE; } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE GLASS Defect OK Count[%d] [%d]"), nIdx, nOK, pRcpJudgeInfo->GetJudgeCount()); } break; case JudgeType_T8_TR: if (pRawData->GetGlassData()->m_nDefectNumJudgeTR>=0) { if (pRawData->GetGlassData()->m_nDefectNumJudgeTR >= pRcpJudgeInfo->GetJudgeCount()) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]GLASS Defect TR Count[%d] >= [%d]"), nIdx, pRawData->GetGlassData()->m_nDefectNumJudgeTR, pRcpJudgeInfo->GetJudgeCount()); bReJudge = TRUE; } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE GLASS Defect TR Count[%d] [%d]"), nIdx, pRawData->GetGlassData()->m_nDefectNumJudgeTR, pRcpJudgeInfo->GetJudgeCount()); } } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] TR Count is minus [%02d]GLASS Defect TR Count[%d] >= [%d]"), nIdx, pRawData->GetGlassData()->m_nDefectNumJudgeTR, pRcpJudgeInfo->GetJudgeCount()); } break; case JudgeType_T8_PR: if (pRawData->GetGlassData()->m_nDefectNumJudgePR >= pRcpJudgeInfo->GetJudgeCount()) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]GLASS Defect PR Count[%d] >= [%d]"), nIdx, pRawData->GetGlassData()->m_nDefectNumJudgePR, pRcpJudgeInfo->GetJudgeCount()); bReJudge = TRUE; } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE GLASS Defect PR Count[%d] [%d]"), nIdx, pRawData->GetGlassData()->m_nDefectNumJudgePR, pRcpJudgeInfo->GetJudgeCount()); } break; } // 2nd condition switch (pRcpJudgeInfo->GetSubJudgeType()) { case JudgeType_T8_None: bSubReJudge = TRUE; break; case JudgeType_T8_OK: nOK = pRawData->GetGlassData()->m_nDefectNumJudgeOKBlack + pRawData->GetGlassData()->m_nDefectNumJudgeOKWhite; if (nOK <= pRcpJudgeInfo->GetSubJudgeCount()) { bSubReJudge = TRUE; m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]GLASS Defect OK Count[%d] <= [%d]"), nIdx,nOK, pRcpJudgeInfo->GetSubJudgeCount()); } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE GLASS Defect OK Count[%d] [%d]"), nIdx, nOK, pRcpJudgeInfo->GetSubJudgeCount()); } break; case JudgeType_T8_TR: if (pRawData->GetGlassData()->m_nDefectNumJudgeTR >= 0) { if (pRawData->GetGlassData()->m_nDefectNumJudgeTR <= pRcpJudgeInfo->GetSubJudgeCount()) { bSubReJudge = TRUE; m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]GLASS Defect TR Count[%d] <= [%d]"), nIdx, pRawData->GetGlassData()->m_nDefectNumJudgeTR, pRcpJudgeInfo->GetSubJudgeCount()); } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE GLASS Defect TR Count[%d] [%d]"), nIdx, pRawData->GetGlassData()->m_nDefectNumJudgeTR, pRcpJudgeInfo->GetSubJudgeCount()); } } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd]TR Count is minus [%02d]GLASS Defect TR Count[%d] <= [%d]"), nIdx, pRawData->GetGlassData()->m_nDefectNumJudgeTR, pRcpJudgeInfo->GetSubJudgeCount()); } break; case JudgeType_T8_PR: if (pRawData->GetGlassData()->m_nDefectNumJudgePR <= pRcpJudgeInfo->GetSubJudgeCount()) { bSubReJudge = TRUE; m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]GLASS Defect PR Count[%d] <= [%d]"), nIdx, pRawData->GetGlassData()->m_nDefectNumJudgePR, pRcpJudgeInfo->GetSubJudgeCount()); } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE GLASS Defect PR Count[%d] [%d]"), nIdx, pRawData->GetGlassData()->m_nDefectNumJudgePR, pRcpJudgeInfo->GetSubJudgeCount()); } break; } if (bReJudge & bSubReJudge) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [DefectJudge] [%02d]Condition : ReJudge Glass Defect Grade! [%s]->[%s]") , nIdx, pRawData->GetGlassData()->m_strGlassJudge, pRcpJudgeInfo->GetReJudgeCode()); strcpy(pRawData->GetGlassData()->m_strGlassJudge, pRcpJudgeInfo->GetReJudgeCode()); CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl(); if (pSignalControl != NULL && pSignalControl->IsConnected()) { if (m_pSP2P->ISP2P_GetSignalControl()->WriteData(_T("17110"), sizeof(pRawData->GetGlassData()->m_strGlassJudge), pRawData->GetGlassData()->m_strGlassJudge)) m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [DefectJudge] Glass Defect Write ReJudge [%s]"), pRawData->GetGlassData()->m_strGlassJudge); else m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [DefectJudge] Glass Defect Write ReJudge FAIL! [%s]"), pRawData->GetGlassData()->m_strGlassJudge); } } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [DefectJudge] [%02d]Condition : Keep ReJudge Glass Defect Grade!") , nIdx); } } #pragma endregion #pragma region GLASSJUDGE_CELL m_pSP2P->ISP2P_DisplayMessage(_T("[ReviewEnd] Start GLASS CELL Rejudge")); // check recipe cell judge bReJudge = bSubReJudge = FALSE; nCount = pRsRcpReviewInfo->GetRcpJudgeGlassCellCount(); for (int nIdx = 0; nIdx < nCount; nIdx++) { bReJudge = bSubReJudge = FALSE; const CRcpJudgeInfo* pRcpJudgeInfo = pRsRcpReviewInfo->GetRcpJudgeGlassCellInfo(nIdx); if (pRcpJudgeInfo == NULL) continue; // 1st condition switch (pRcpJudgeInfo->GetJudgeType()) { case JudgeType_T8_None: break; case JudgeType_T8_OK: nOK = nCelllOKJuge; if (nCelllOKJuge >= pRcpJudgeInfo->GetJudgeCount()) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]GLASS CELL OK Count[%d] >= [%d]"), nIdx, nOK, pRcpJudgeInfo->GetJudgeCount()); bReJudge = TRUE; } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE GLASS CELL OK Count[%d] [%d]"), nIdx, nOK, pRcpJudgeInfo->GetJudgeCount()); } break; case JudgeType_T8_TR: if (/*pRawData->GetGlassData()->m_nDefectNumJudgeTR*/nCellTRJudge >= pRcpJudgeInfo->GetJudgeCount()) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]GLASS CELL TR Count[%d] >= [%d]"), nIdx, nCellTRJudge, pRcpJudgeInfo->GetJudgeCount()); bReJudge = TRUE; } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE GLASS CELL TR Count[%d] [%d]"), nIdx, nCellTRJudge, pRcpJudgeInfo->GetJudgeCount()); } break; case JudgeType_T8_PR: if (nCelllPRJuge >= pRcpJudgeInfo->GetJudgeCount()) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]GLASS CELL PR Count[%d] >= [%d]"), nIdx, nCelllPRJuge, pRcpJudgeInfo->GetJudgeCount()); bReJudge = TRUE; } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE GLASS CELL PR Count[%d] [%d]"), nIdx, nCelllPRJuge, pRcpJudgeInfo->GetJudgeCount()); } break; } // 2nd condition switch (pRcpJudgeInfo->GetSubJudgeType()) { case JudgeType_T8_None: bSubReJudge = TRUE; break; case JudgeType_T8_OK: /*nOK = pRawData->GetGlassData()->m_nDefectNumJudgeOKBlack + pRawData->GetGlassData()->m_nDefectNumJudgeOKWhite;*/ nOK = nCelllOKJuge; if (nOK <= pRcpJudgeInfo->GetSubJudgeCount()) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]GLASS CELL OK Count[%d] <= [%d]"), nOK, pRcpJudgeInfo->GetSubJudgeCount()); bSubReJudge = TRUE; } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE GLASS CELL OK Count[%d] [%d]"), nOK, pRcpJudgeInfo->GetSubJudgeCount()); } break; case JudgeType_T8_TR: if (/*pRawData->GetGlassData()->m_nDefectNumJudgeTR*/nCellTRJudge <= pRcpJudgeInfo->GetSubJudgeCount()) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]GLASS CELL TR Count[%d] <= [%d]"), nCellTRJudge, pRcpJudgeInfo->GetSubJudgeCount()); bSubReJudge = TRUE; } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE GLASS CELL TR Count[%d] [%d]"), nCellTRJudge, pRcpJudgeInfo->GetSubJudgeCount()); } break; case JudgeType_T8_PR: if (nCelllPRJuge <= pRcpJudgeInfo->GetSubJudgeCount()) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]GLASS CELL PR Count[%d] <= [%d]"), nCelllPRJuge, pRcpJudgeInfo->GetSubJudgeCount()); bSubReJudge = TRUE; } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE GLASS CELL PR Count[%d] [%d]"), nCelllPRJuge, pRcpJudgeInfo->GetSubJudgeCount()); } break; } if (bReJudge & bSubReJudge) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [CellJudge] ReJudge Glass Cell Grade! [%s]->[%s]") , pRawData->GetGlassData()->m_strGlassJudge, pRcpJudgeInfo->GetReJudgeCode()); strcpy(pRawData->GetGlassData()->m_strGlassJudge, pRcpJudgeInfo->GetReJudgeCode()); CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl(); if (pSignalControl != NULL && pSignalControl->IsConnected()) { if (m_pSP2P->ISP2P_GetSignalControl()->WriteData(_T("17110"), sizeof(pRawData->GetGlassData()->m_strGlassJudge), pRawData->GetGlassData()->m_strGlassJudge)) m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [CellJudge] Glass Cell Write ReJudge [%s]"), pRawData->GetGlassData()->m_strGlassJudge); else m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [CellJudge] Glass Cell Write ReJudge FAIL! [%s]"), pRawData->GetGlassData()->m_strGlassJudge); } } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [CellJudge] Keep ReJudge Glass Cell Grade!")); } } #pragma endregion #pragma endregion //CString strJudgeData; //m_pSP2P->ISP2P_GetSignalControl()->WriteData(_T("17100"), sizeof(pRawData->GetGlassData()->m_strGlassJudge), pRawData->GetGlassData()->m_strGlassJudge); return TRUE; } BOOL CSequenceProcessor_CPJT::FindRawBinFile(CString strFileName) { //210128 CString strFilePath = _T(""); //pData->GetGlassData()->m_strFileName; //strcpy(pData->GetGlassData()->m_strPath, AOIRAWBIN_PATH); //strcpy(pData->GetGlassData()->m_strPath, LOCAL_AOIRAWBIN_PATH); strFilePath = AOIRAWBIN_PATH; CString strFindFile; int nCloseTime = 600 * 100000;//sec int nReTryTime = 30; { CTime tmReviewLoading = CTime::GetCurrentTime(); CString strWild; //strWild.Format("%s\\%s_*.bin", strFilePath, strFileName); CakFileUtil akFileFinder; while (nReTryTime--) { //#3359_LYW CF AOI Review REVIEW_LOADING_COMPLETE_TIMEOVER START if (nReTryTime%2 == 0) { strFilePath = AOIRAWBIN_PATH; } else strFilePath = AOIRAWBIN_NETWORK_DRIVE_PATH; strWild.Format("%s\\%s_*.bin", strFilePath, strFileName); akFileFinder.FindFile(strWild.GetBuffer(0), FALSE); //LYW LOG g_pLog->DisplayMessage(_T("[GlassLoading][FindRawBinFile] Find Path = %s, RetryCount = %d, ResultCode = [%d]"), strFilePath, 30-nReTryTime, GetLastError()); //#3359_LYW CF AOI Review REVIEW_LOADING_COMPLETE_TIMEOVER END VECFINDDATA* pFindData = akFileFinder.getFindData(); int nFileNamePos = strlen(akFileFinder.getProcessPath()); std::map mapSpanFileName; for (int i = 0; i < pFindData->size(); i++) { char* pFileName = &((*pFindData)[i]).name[nFileNamePos]; { CakParser parser; parser.process(pFileName, "_."); if (parser.getTokNum() < 4) continue; if (parser.getTokNum() >= 6) continue; // 0401 int nDataTime[8] = {}; { int nTokIndex = 0; const char* pGlassId = parser.getTokStr(nTokIndex++); const char* pStepId = parser.getTokStr(nTokIndex++); char* pDate = &pFileName[parser.getTokPos(nTokIndex++)]; char* pTime = &pFileName[parser.getTokPos(nTokIndex++)]; nDataTime[0] = (pDate[0] - '0') * 1000 + (pDate[1] - '0') * 100 + (pDate[2] - '0') * 10 + (pDate[3] - '0') * 1; nDataTime[1] = (pDate[4] - '0') * 10 + (pDate[5] - '0') * 1; nDataTime[2] = (pDate[6] - '0') * 10 + (pDate[7] - '0') * 1; nDataTime[3] = (pTime[0] - '0') * 10 + (pTime[1] - '0') * 1; nDataTime[4] = (pTime[2] - '0') * 10 + (pTime[3] - '0') * 1; nDataTime[5] = (pTime[4] - '0') * 10 + (pTime[5] - '0') * 1; } CTime tmTemp(nDataTime[0], nDataTime[1], nDataTime[2], nDataTime[3], nDataTime[4], nDataTime[5]); CTimeSpan tmSpan = tmReviewLoading - tmTemp; mapSpanFileName.insert(std::make_pair(tmSpan.GetTotalSeconds(), pFileName)); } } if (mapSpanFileName.empty() == FALSE) { if (mapSpanFileName.begin()->first < nCloseTime) { strFindFile = mapSpanFileName.begin()->second; break; } } akFileFinder.clear(); Sleep(100); } } if (strFindFile.IsEmpty()) return FALSE; return TRUE; } int CSequenceProcessor_CPJT::ReJugdeWSIType(int nWsiType) { int nResultDataIndex=0; switch (nWsiType) { case 0: nResultDataIndex = 1; //DEFECT break; case 1: nResultDataIndex = 3; //CS break; case 2: nResultDataIndex = 4; //RED break; case 3: nResultDataIndex = 5; //GREEN break; case 4: nResultDataIndex = 6; //BLUE break; default: nResultDataIndex = 1; break; } return nResultDataIndex; } BOOL CSequenceProcessor_CPJT::ReadTransferDataFromSignalControl(STransferData* pTransferData)//cmark { if (pTransferData==NULL) return FALSE; pTransferData->Reset(); CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl(); if (pSignalControl==NULL) return FALSE; if (pSignalControl->IsConnected() == FALSE) return FALSE; const CSignalControlInfo* pSignalInfo = m_pSP2P->ISP2P_System_GetPCControlInfo(); if (pSignalInfo==NULL) return FALSE; int nPCControlReadDataCount = pSignalInfo->GetReadDataAddressCount(); // [2017:1:9]-[WEZASW] : PCControl GlassData if(pSignalInfo->GetUseContinuousReadAddress()) { CString strReadAddress = _T(""); int nReadTotalSize = 0; for(int i=0; iGetReadDataAddress(i); if (pInfo==NULL) continue; if (i==0) strReadAddress = pInfo->strAddr; nReadTotalSize += pInfo->nSize; } CString strData = _T(""); char cData[28] = {}; if (pSignalControl->ReadData(strReadAddress, nReadTotalSize, strData)) { pSignalControl->ReadData(strReadAddress, nReadTotalSize, cData); m_pSP2P->ISP2P_DisplayMessage(_T("[ReadTransferData] Addr: %s, Size: %d, Data: %s"), strReadAddress, nReadTotalSize, strData); } else { m_pSP2P->ISP2P_DisplayMessage(_T("[ReadTransferData] Read Fail! Addr: %s"), strReadAddress); } int nReadSize = 0; int nData = 0; CString strTemp = strData; for(int i=0; iGetReadDataAddress(i); if (pInfo==NULL) continue; nReadSize = pInfo->nSize; if(i == nPCControlReadDataCount - 1) { strData = strTemp; } else { strData = strTemp.Left(nReadSize*2); strTemp = strTemp.Mid(nReadSize*2); } switch(i) { //case GLASS_DATA_PROD_ID_CPJT: // pTransferData->strLotID = strData.TrimRight(_T(" ")); // break; //case GLASS_DATA_OPER_ID_CPJT: // pTransferData->strOperID = strData.TrimRight(_T(" ")); // break; //case GLASS_DATA_LOT_ID_CPJT: // pTransferData->strLotID = strData.TrimRight(_T(" ")); // break; //case GLASS_DATA_PPID_CPJT: //strData.TrimRight(_T(" ")); // if (strData.Compare(_T("")) != 0) // { // nData = strData.GetAt(1); // nData <<= 8; // nData |= strData.GetAt(0); // pTransferData->strPPID.Format(_T("%d"), nData); // } // else // pTransferData->strPPID = strData.TrimRight(_T(" ")); // break; //case GLASS_DATA_PPID_RECIPE_CPJT: // pTransferData->strPPID_RC = strData.TrimRight(_T(""));; // //strData.TrimRight(_T(" ")); // break; //case GLASS_DATA_JOB_TYPE_CPJT: // pTransferData->strJobType = strData.TrimRight(_T(" ")); // break; //case GLASS_DATA_JOB_ID_CPJT: // pTransferData->strJobID = strData.TrimRight(_T(" ")); // break; //case GLASS_DATA_LOT_SEQUENCE_NUMBER_CPJT: // break; //case GLASS_DATA_SLOT_SEQUENCE_NUMBER_CPJT: // break; //case GLASS_DATA_PROPERTY_CODE_CPJT: // break; //case GLASS_DATA_JOB_JUDGE_CODE_CPJT: // break; //case GLASS_DATA_JOB_GRADE_CODE_CPJT: // break; //case GLASS_DATA_SUBSTRATE_TYPE_CPJT: // break; //case GLASS_DATA_PROCESSING_FLAG_CPJT: // break; //case GLASS_DATA_INSPECTION_FLAG_CPJT: // break; //case GLASS_DATA_SKIP_FLAG_CPJT: // break; //case GLASS_DATA_JOB_SIZE_CPJT: // break; //case GLASS_DATA_GLASS_THICKNESS_CPJT: // break; //case GLASS_DATA_JOB_ANGLE_CPJT: // break; //case GLASS_DATA_JOB_FLIP_CPJT: // break; //case GLASS_DATA_CUTTING_GLASS_TYPE_CPJT: // break; //case GLASS_DATA_PROCESSING_COUNT_CPJT: // break; //case GLASS_DATA_INSPECTION_JUDGE_DATA_CPJT: // break; //case GLASS_DATA_PAIR_JOB_ID_CPJT: // break; //case GLASS_DATA_PAIR_FLAG_CPJT: // break; //case GLASS_DATA_OPTION_VALUE_CPJT: // break; //case GLASS_DATA_RESERVED_CPJT: // break; //case GLASS_DATA_GLASS_SCAN_SCHEDULE_CPJT: // pTransferData->strGlassScanSchedule = strData.TrimRight(_T(" ")); // break; // } } } else { CString strReadAddress = _T(""); CString strReadData = _T(""); int nReadSize = 0; int readData = 0; int nData = 0; char chReadData[2048] = {0}; for(int i=0; iGetReadDataAddress(i); if (pInfo==NULL) continue; strReadAddress = pInfo->strAddr; //nReadSize = pInfo->nSize*2; nReadSize = pInfo->nSize; memset(chReadData, 0, sizeof(chReadData)); readData = 0; switch(i) { case GLASS_DATA_H_PANELID_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strGlassID = strReadData.Left(nReadSize); pTransferData->strJobID = pTransferData->strGlassID; strReadData = pTransferData->strGlassID; break; case GLASS_DATA_E_PANELID_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strEGlassID = strReadData.Left(nReadSize); strReadData = pTransferData->strEGlassID; break; case GLASS_DATA_PROCESSID_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strProcessID = strReadData.Left(nReadSize); strReadData = pTransferData->strProcessID; break; case GLASS_DATA_PRODCUTID_CPJT : pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strProductID = strReadData.Left(nReadSize); strReadData = pTransferData->strProductID; break; case GLASS_DATA_STEPID_CPJT : pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strStepID = strReadData.Left(nReadSize); strReadData = pTransferData->strStepID; break; case GLASS_DATA_BATCHID_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strBatchID = strReadData.Left(nReadSize); strReadData = pTransferData->strBatchID; break; case GLASS_DATA_PROD_TYPE_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strProdType = strReadData.Left(nReadSize); strReadData = pTransferData->strProdType; break; case GLASS_DATA_PROD_KIND_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strProdKind = strReadData.Left(nReadSize); strReadData = pTransferData->strProdKind; break; case GLASS_DATA_PPID_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strPPID = strReadData.Left(nReadSize); pTransferData->strPPID_RC = pTransferData->strPPID; strReadData = pTransferData->strPPID; break; case GLASS_DATA_FLOWID_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strFlowID = strReadData.Left(nReadSize); strReadData = pTransferData->strFlowID; break; case GLASS_DATA_PANEL_SIZE_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, chReadData); memcpy(&nData, chReadData, 2); pTransferData->strPanelSize.Format(_T("%d"), nData); strReadData = pTransferData->strPanelSize; break; case GLASS_DATA_THICKNESS_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, chReadData); memcpy(&nData, chReadData, 2); pTransferData->strGlassThickness.Format(_T("%d"), nData); strReadData = pTransferData->strGlassThickness; break; case GLASS_DATA_COMP_COUNT_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, chReadData); memcpy(&nData, chReadData, 2); pTransferData->strCompCount.Format(_T("%d"), nData); strReadData = pTransferData->strCompCount; break; case GLASS_DATA_PANEL_STATE_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, chReadData); memcpy(&nData, chReadData, 2); pTransferData->strPanelState.Format(_T("%d"), nData); strReadData = pTransferData->strPanelState; break; case GLASS_DATA_READING_FLAG_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strReadingFlag = strReadData.Left(nReadSize); strReadData = pTransferData->strReadingFlag; break; case GLASS_DATA_INS_FLAG_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strInspectionFlag = strReadData.Left(nReadSize); strReadData = pTransferData->strInspectionFlag; break; case GLASS_DATA_PANEL_POSITION_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strPanelPosition = strReadData.Left(nReadSize); strReadData = pTransferData->strPanelPosition; break; case GLASS_DATA_JUDGEMENT_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strGlassJudgeCode = strReadData.Left(nReadSize); strReadData = pTransferData->strGlassJudgeCode; break; case GLASS_DATA_CODE_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strGlassCode = strReadData.Left(nReadSize); strReadData = pTransferData->strGlassCode; break; case GLASS_DATA_FLOW_HISTORY_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, chReadData); memcpy(&nData, chReadData, 2); pTransferData->strFlowHistory.Format(_T("%d"), nData); strReadData = pTransferData->strFlowHistory; break; case GLASS_DATA_UNIQUEID_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, chReadData); memcpy(&nData, chReadData, 2); pTransferData->strUnIqueID.Format(_T("%d"), nData); strReadData = pTransferData->strUnIqueID; break; case GLASS_DATA_COUNT1_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strCount1 = strReadData.Left(nReadSize); strReadData = pTransferData->strCount1; break; case GLASS_DATA_COUNT2_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strCount2 = strReadData.Left(nReadSize); strReadData = pTransferData->strCount2; break; case GLASS_DATA_GRADE_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, chReadData); memcpy(&nData, chReadData, 2); pTransferData->strGlassGradeCode.Format(_T("%d"), nData); strReadData = pTransferData->strGlassGradeCode; break; case GLASS_DATA_MULTI_USE_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strMultiUse = strReadData.Left(nReadSize); strReadData = pTransferData->strMultiUse; break; case GLASS_DATA_BIT_SIGNAL_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strGlassDataBigSig = strReadData.Left(nReadSize); strReadData = pTransferData->strGlassDataBigSig; break; case GLASS_DATA_PAIR_H_PANELID_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strPairID = strReadData.Left(nReadSize); strReadData = pTransferData->strPairID; break; case GLASS_DATA_PAIR_E_PANELID_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strEPairID = strReadData.Left(nReadSize); strReadData = pTransferData->strEPairID; break; case GLASS_DATA_PAIR_PRODUCTID_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strPairProductID = strReadData.Left(nReadSize); strReadData = pTransferData->strPairProductID; break; case GLASS_DATA_PAIR_GRADE_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strPairGrade = strReadData.Left(nReadSize); strReadData = pTransferData->strPairGrade; break; case GLASS_DATA_FLOW_GROUP_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strFlowGroup = strReadData.Left(nReadSize); strReadData = pTransferData->strFlowGroup; break; case GLASS_DATA_DBR_RECIPE_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strDBR_RECIPE = strReadData.Left(nReadSize); strReadData = pTransferData->strDBR_RECIPE; break; case GLASS_DATA_RESERVED_CPJT: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strReserved = strReadData.Left(nReadSize); strReadData = pTransferData->strReserved; break; case GLASS_DATA_RERFER_DATA: pSignalControl->ReadData(strReadAddress, nReadSize, strReadData); memcpy(&readData, chReadData, 2); pTransferData->strRerferData = strReadData.Left(nReadSize); strReadData = pTransferData->strRerferData; break; } // m_pSP2P->ISP2P_DisplayMessage(_T("[ReadTransferData] Name: %s, Addr: %s, Size: %d, Data: %s"), pInfo->strName, strReadAddress, nReadSize, strReadData); //0517 } } return TRUE; } void CSequenceProcessor_CPJT::UpdateGlassResultFromTransferData(CGlassResult *pGlassResult, STransferData* pTransferData) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Transfer Data Read!")); if (pGlassResult==NULL || pTransferData==NULL) return; // [2017:1:9]-[WEZASW] : PCControl GlassData // transfer data is not exist if (pTransferData->strLotID.GetLength()<1) { pTransferData->strLotID = _T("LOTID"); } if (pTransferData->strJobID.GetLength()<1) { pTransferData->strJobID = _T("glass00"); } if (pTransferData->strOperID.GetLength()<1) { pTransferData->strOperID = _T("12345"); } if (pTransferData->strGlassCode.GetLength()<1) { pTransferData->strGlassCode = _T("12"); } if (pTransferData->strPPID_RC.GetLength()<1) { pTransferData->strPPID_RC = _T("Default"); } if (pTransferData->strGlassLastName.GetLength()<1) { pTransferData->strGlassLastName = _T("A"); } if (pTransferData->strStepID.GetLength() < 1) { pTransferData->strStepID = _T("stepid"); } if (pTransferData->strProcessID.GetLength() < 1) { pTransferData->strProcessID = _T("processid"); } // update transfer data to glass result pGlassResult->m_strGlassLastName = pTransferData->strGlassLastName; pGlassResult->m_strGlassID = pTransferData->strGlassID; pGlassResult->m_strGlassCode = pTransferData->strGlassCode; pGlassResult->m_strMode = pTransferData->strMode; pGlassResult->m_strGlassType = pTransferData->strGlassType; pGlassResult->m_strDummyType = pTransferData->strDummyType; pGlassResult->m_strProdID = pTransferData->strProdID; pGlassResult->m_strOperID = pTransferData->strOperID; pGlassResult->m_strLotID = pTransferData->strLotID; pGlassResult->m_strPPID = pTransferData->strPPID; pGlassResult->m_strPPID_RC = pTransferData->strPPID_RC; pGlassResult->m_strJobType = pTransferData->strJobType; pGlassResult->m_strJobID = pTransferData->strJobID; pGlassResult->m_strLotSeqNum = pTransferData->strLotSeqNum; pGlassResult->m_strSlotSeqNum = pTransferData->strSlotSeqNum; pGlassResult->m_strPropertyCode = pTransferData->strPropertyCode; pGlassResult->m_strJobJudgeCode = pTransferData->strJobJudgeCode; pGlassResult->m_strJobGradeCode = pTransferData->strJobGradeCode; pGlassResult->m_strSubstrateType = pTransferData->strSubstrateType; pGlassResult->m_strProcessingFlag = pTransferData->strProcessingFlag; pGlassResult->m_strInspectionFlag = pTransferData->strInspectionFlag; pGlassResult->m_strSkipFlag = pTransferData->strSkipFlag; pGlassResult->m_strJobSize = pTransferData->strJobSize; pGlassResult->m_strGlassThickness = pTransferData->strGlassThickness; pGlassResult->m_strJobAngle = pTransferData->strJobAngle; pGlassResult->m_strJobFlip = pTransferData->strJobFlip; pGlassResult->m_strCuttingGlassType = pTransferData->strCuttingGlassType; pGlassResult->m_strProcessingCount = pTransferData->strProcessingCount; pGlassResult->m_strInspectionJudgeData = pTransferData->strInspectionJudgeData; pGlassResult->m_strPairJobID = pTransferData->strPairJobID; pGlassResult->m_strPairFlag = pTransferData->strPairFlag; pGlassResult->m_strOptionValue = pTransferData->strOptionValue; pGlassResult->m_strReserved = pTransferData->strReserved; pGlassResult->strGlassScanSchedule = pTransferData->strGlassScanSchedule;//cmark pGlassResult->m_strRTMSStepID = pTransferData->strStepID; //taek 210126 m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Transfer Data END!")); } void CSequenceProcessor_CPJT::UpdateHistoryResultFromTransferData(CGlassResult *pHistoryResult, CGlassResult* pGlassResult) { if (pHistoryResult == NULL || pGlassResult == NULL) return; CTime time = CTime::GetCurrentTime(); CString strTime = _T(""); strTime.Format(_T("%04d-%02d-%02d %02d:%02d:%02d"), time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond()); // update transfer data to glass result pHistoryResult->m_nGlassSizeX = pGlassResult->m_nGlassSizeX; pHistoryResult->m_nGlassSizeY = pGlassResult->m_nGlassSizeY; pHistoryResult->m_nCollisionDistanceX = pGlassResult->m_nCollisionDistanceX; pHistoryResult->m_nCollisionDistanceY = pGlassResult->m_nCollisionDistanceY; pHistoryResult->m_nCollisionXPos1 = pGlassResult->m_nCollisionXPos1; pHistoryResult->m_nCollisionXPos2 = pGlassResult->m_nCollisionXPos2; pHistoryResult->m_nOriginDir = pGlassResult->m_nOriginDir; pHistoryResult->m_strResultDate = pGlassResult->m_strResultDate; pHistoryResult->m_vecReviewScheduleResult = pGlassResult->m_vecReviewScheduleResult; pHistoryResult->m_nCornerCutDir = pGlassResult->m_nCornerCutDir; pHistoryResult->m_bReadRawFile = pGlassResult->m_bReadRawFile; pHistoryResult->m_vecReviewResult = pGlassResult->m_vecReviewResult; pHistoryResult->m_strGlassLastName = pGlassResult->m_strGlassLastName; pHistoryResult->m_strGlassID = pGlassResult->m_strGlassID; pHistoryResult->m_strGlassCode = pGlassResult->m_strGlassCode; pHistoryResult->m_strMode = pGlassResult->m_strMode; pHistoryResult->m_strGlassType = pGlassResult->m_strGlassType; pHistoryResult->m_strDummyType = pGlassResult->m_strDummyType; pHistoryResult->m_strProdID = pGlassResult->m_strProdID; pHistoryResult->m_strOperID = pGlassResult->m_strOperID; pHistoryResult->m_strLotID = pGlassResult->m_strLotID; pHistoryResult->m_strPPID = pGlassResult->m_strPPID; pHistoryResult->m_strPPID_RC = pGlassResult->m_strPPID_RC; pHistoryResult->m_strJobType = pGlassResult->m_strJobType; pHistoryResult->m_strJobID = pGlassResult->m_strJobID; pHistoryResult->m_strLotSeqNum = pGlassResult->m_strLotSeqNum; pHistoryResult->m_strSlotSeqNum = pGlassResult->m_strSlotSeqNum; pHistoryResult->m_strPropertyCode = pGlassResult->m_strPropertyCode; pHistoryResult->m_strJobJudgeCode = pGlassResult->m_strJobJudgeCode; pHistoryResult->m_strJobGradeCode = pGlassResult->m_strJobGradeCode; pHistoryResult->m_strSubstrateType = pGlassResult->m_strSubstrateType; pHistoryResult->m_strProcessingFlag = pGlassResult->m_strProcessingFlag; pHistoryResult->m_strInspectionFlag = pGlassResult->m_strInspectionFlag; pHistoryResult->m_strSkipFlag = pGlassResult->m_strSkipFlag; pHistoryResult->m_strJobSize = pGlassResult->m_strJobSize; pHistoryResult->m_strGlassThickness = pGlassResult->m_strGlassThickness; pHistoryResult->m_strJobAngle = pGlassResult->m_strJobAngle; pHistoryResult->m_strJobFlip = pGlassResult->m_strJobFlip; pHistoryResult->m_strCuttingGlassType = pGlassResult->m_strCuttingGlassType; pHistoryResult->m_strProcessingCount = pGlassResult->m_strProcessingCount; pHistoryResult->m_strInspectionJudgeData = pGlassResult->m_strInspectionJudgeData; pHistoryResult->m_strPairJobID = pGlassResult->m_strPairJobID; pHistoryResult->m_strPairFlag = pGlassResult->m_strPairFlag; pHistoryResult->m_strOptionValue = pGlassResult->m_strOptionValue; pHistoryResult->m_strReserved = pGlassResult->m_strReserved; pHistoryResult->strGlassScanSchedule = pGlassResult->strGlassScanSchedule;// cmark pHistoryResult->m_strStepID = pGlassResult->m_strRTMSStepID; //taek 210126 pHistoryResult->m_strEquipID = pGlassResult->m_strEquipID; pHistoryResult->m_strProcessID = pGlassResult->m_strProcessID; pHistoryResult->m_strUploadImgFileName = pGlassResult->m_strUploadImgFileName; pHistoryResult->m_strUnLoadingTime = strTime; pHistoryResult->m_mapDefectResult = pGlassResult->m_mapDefectResult; pHistoryResult->m_AlignResult = pGlassResult->m_AlignResult; } void CSequenceProcessor_CPJT::CreateResultDirectory(const CString& strGlassID, const CString& strDate) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Make Directory Start")); if (m_pSP2P==NULL) return; const CNetworkInfo *pNetworkInfo = m_pSP2P->ISP2P_System_GetNetworkInfo(); if(pNetworkInfo == NULL) return; CString strPath = _T(""); if (strDate.GetLength()>0) { // raw path if(pNetworkInfo->m_strLocalRawPath.IsEmpty() == FALSE && strGlassID.IsEmpty() == FALSE) { strPath.Format(_T("%s\\%s"), pNetworkInfo->m_strLocalRawPath, strDate); CreateDirectory(strPath, NULL); } // raw backup path if(pNetworkInfo->m_strLocalRawPath.IsEmpty() == FALSE && strGlassID.IsEmpty() == FALSE) { strPath.Format(_T("%sBackup\\%s"), pNetworkInfo->m_strLocalRawPath, strDate); CreateDirectory(strPath, NULL); } // image path if(pNetworkInfo->m_strLocalImagePath.IsEmpty() == FALSE && strGlassID.IsEmpty() == FALSE) { strPath.Format(_T("%s\\%s"), pNetworkInfo->m_strLocalImagePath, strDate); CreateDirectory(strPath, NULL); } } else { // image path if(pNetworkInfo->m_strLocalImagePath.IsEmpty() == FALSE && strGlassID.IsEmpty() == FALSE) { strPath.Format(_T("%s\\%s"), pNetworkInfo->m_strLocalImagePath, strGlassID); CreateDirectory(strPath, NULL); } } if(pNetworkInfo->m_strAlignImagePath.IsEmpty() == FALSE && strGlassID.IsEmpty() == FALSE) { strPath.Format(_T("%s\\%s"),pNetworkInfo->m_strAlignImagePath, strGlassID); CreateDirectory(strPath, NULL); } m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Make directory End")); } void CSequenceProcessor_CPJT::SetSaveImageBasePathToReviewProcessor(const CString& strGlassID, const CString& strResultDate) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Make image path start")); const CNetworkInfo *pNetworkInfo = m_pSP2P->ISP2P_System_GetNetworkInfo(); if(pNetworkInfo == NULL) return; CReviewProcessor* pReviewProcessor = m_pSP2P->ISP2P_GetReviewProcessor(); if(pReviewProcessor == NULL) return; CString strPath = _T(""); CString strImagePath = _T(""); if(pNetworkInfo->m_strLocalImagePath.IsEmpty() == FALSE && strGlassID.IsEmpty() == FALSE) { CTime snapTime = CTime::GetCurrentTime(); CString strSnapTime = _T(""); strSnapTime.Format(_T("_%04d%02d%02d%02d%02d%02d"), snapTime.GetYear(), snapTime.GetMonth(), snapTime.GetDay(), snapTime.GetHour(), snapTime.GetMinute(), snapTime.GetSecond()); // snap_time // Local if (strResultDate.GetLength()>0) { strPath.Format(_T("%s\\%s\\%s"), pNetworkInfo->m_strLocalImagePath, strResultDate, CDitGlassRawClient::GetInstance()->GetGlassData()->m_strGlassID + strSnapTime); } else { strPath.Format(_T("%s\\%s"), pNetworkInfo->m_strLocalImagePath, CDitGlassRawClient::GetInstance()->GetGlassData()->m_strGlassID + strSnapTime); } CreateDirectory(strPath, NULL); pReviewProcessor->SetSaveImageBasePath(strPath); int nReconnect = 0; if (CDitGlassRawClient::GetInstance()->isConnect() == FALSE) { while (1) { if (nReconnect == 3) { SendResultToSignalControl(PCControlSendData_LoadingResult_CPJT, SIGNAL_SEND_RESULT_FAIL); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading FAIL Signal!")); break; } CDitGlassRawClient::GetInstance()->ConnectServer(); Sleep(1000); if (CDitGlassRawClient::GetInstance()->isConnect() == FALSE) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading]access Shared Memory Fail!! Count[%d]"), nReconnect); } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading]access Shared Memory Success")); break; } nReconnect += 1; } } CTime tmServerLoadingTime = CDitGlassRawClient::GetInstance()->GetGlassData()->m_tmGlassLoading; if (tmServerLoadingTime != NULL) { strPath.Format(_T("%s\\%s_%04d%02d%02d%02d%02d%02d"), pNetworkInfo->m_strUploadImagePath, strGlassID, tmServerLoadingTime.GetYear(), tmServerLoadingTime.GetMonth(), tmServerLoadingTime.GetDay(), tmServerLoadingTime.GetHour(), tmServerLoadingTime.GetMinute(), tmServerLoadingTime.GetSecond()); strImagePath.Format(_T("%s_%04d%02d%02d%02d%02d%02d"), strGlassID, tmServerLoadingTime.GetYear(), tmServerLoadingTime.GetMonth(), tmServerLoadingTime.GetDay(), tmServerLoadingTime.GetHour(), tmServerLoadingTime.GetMinute(), tmServerLoadingTime.GetSecond()); CreateDirectory(strPath, NULL); pReviewProcessor->SetUploadImagePath(strPath); pReviewProcessor->SetReviewImagePath(strImagePath); } else { tmServerLoadingTime = CTime::GetCurrentTime(); m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] access Shared Memory Fail")); strPath.Format(_T("%s\\%s_%04d%02d%02d%02d%02d%02d"), pNetworkInfo->m_strUploadImagePath, strGlassID, tmServerLoadingTime.GetYear(), tmServerLoadingTime.GetMonth(), tmServerLoadingTime.GetDay(), tmServerLoadingTime.GetHour(), tmServerLoadingTime.GetMinute(), tmServerLoadingTime.GetSecond()); strImagePath.Format(_T("%s\\%s_%04d%02d%02d%02d%02d%02d"), strGlassID, tmServerLoadingTime.GetYear(), tmServerLoadingTime.GetMonth(), tmServerLoadingTime.GetDay(), tmServerLoadingTime.GetHour(), tmServerLoadingTime.GetMinute(), tmServerLoadingTime.GetSecond()); CreateDirectory(strPath, NULL); pReviewProcessor->SetUploadImagePath(strPath); pReviewProcessor->SetReviewImagePath(strImagePath); } } m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Make image path End")); } void CSequenceProcessor_CPJT::SetSaveImageBasePathToAlignCameraControl(const CString& strGlassID) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Make Align image path Start")); const CNetworkInfo *pNetworkInfo = m_pSP2P->ISP2P_System_GetNetworkInfo(); if(pNetworkInfo == NULL) return; CCameraControlAlign* pAlignCameraControl = m_pSP2P->ISP2P_GetAlignCameraControl(); if(pAlignCameraControl == NULL) return; CString strPath = _T(""); if(pNetworkInfo->m_strAlignImagePath.IsEmpty() == FALSE && strGlassID.IsEmpty() == FALSE) { strPath.Format(_T("%s\\%s"), pNetworkInfo->m_strAlignImagePath, strGlassID); pAlignCameraControl->SetSaveImageBasePath(strPath); } m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Make Align image path End ")); } BOOL CSequenceProcessor_CPJT::ReadRecipeDataFromRecipeFile(const CString& strPPID_RC, CString& strRecipeName)// const CString& strPPID, CString& strRecipeName { CRsRecipeManager *pRsRecipeManager = m_pSP2P->ISP2P_Recipe_GetRsRecipeManager(); if(pRsRecipeManager == NULL) { return FALSE; } pRsRecipeManager->SetRecipeReadStatus(RCP_READ_STATUS_NONE); strRecipeName = _T(""); // find recipe file if(FindRecipeFileName(strPPID_RC, strRecipeName) == FALSE) { strRecipeName.Format(_T("Default")); } // read recipe file if(pRsRecipeManager->ReadRecipeFile(strRecipeName) == FALSE) { pRsRecipeManager->SetRecipeReadStatus(RCP_READ_STATUS_FAIL); return FALSE; } pRsRecipeManager->SetRecipeReadStatus(RCP_READ_STATUS_SUCCESS); return TRUE; } BOOL CSequenceProcessor_CPJT::FindRecipeFileName(const CString& strPPID_RC, CString& strRecipeName/*const CString& strPPID, CString& strRecipeName*/) { BOOL bRet = FALSE, bFind; CFileFind finder; CString strSearchPath; //if(strPPID.IsEmpty() == TRUE) return bRet; if(strPPID_RC.IsEmpty() == TRUE) return bRet; CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult(); if(pGlassResult == NULL) return FALSE; const CString* strStepID = pGlassResult->GetStepID(); strSearchPath.Format(_T("%s\\%s.rcp"), _REVIEW_RECIPE_PATH_, strPPID_RC); bFind = finder.FindFile(strSearchPath); while(bFind) { bFind = finder.FindNextFile(); if(finder.IsDots()) continue; if(finder.IsDirectory()) continue; strRecipeName = finder.GetFileTitle(); bRet = TRUE; break; } finder.Close(); return bRet; } BOOL CSequenceProcessor_CPJT::ApplyRecipeDataToGlassResult(CGlassResult *pGlassResult) { if(pGlassResult == NULL) return FALSE; const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if (pRsRcpReviewInfo==NULL) return FALSE; // system info const CSystemInfo* pSystemInfo = m_pSP2P->ISP2P_System_GetSystemInfo(); STransferData* pTransferData = m_pSP2P->ISP2P_GetCurrentTransferData(); if (pTransferData==NULL) return FALSE; int nGlassTypeInfoIndex = 0; { nGlassTypeInfoIndex = pRsRcpReviewInfo->m_nGlassTypeIdx; if(_ttoi(pTransferData->strGlassScanSchedule) == 1) { nGlassTypeInfoIndex = pRsRcpReviewInfo->m_nGlassTypeIdx + 1; } } const CGlassTypeInfo* pGlassTypeInfo = m_pSP2P->ISP2P_System_GetGlassTypeInfo(nGlassTypeInfoIndex); if (pGlassTypeInfo == NULL) return FALSE; m_pSP2P->ISP2P_DisplayMessage(_T("GlassTypeName : %s,GlassTypeIdx : %s"),pGlassTypeInfo->m_strGlassTypeName,pTransferData->strGlassScanSchedule); const CMotorControlInfo *pMotorInfo = m_pSP2P->ISP2P_System_GetMotorInfo(); CCoordCalibrator* pCoordCalibrator = m_pSP2P->ISP2P_GetCoordCalibrator(); if (pSystemInfo && pGlassTypeInfo && pMotorInfo && pCoordCalibrator) { // Get Direction int nDirectionX = GetDirectionX(pGlassTypeInfo->m_nOriginDirection, pMotorInfo->GetOriginDirection()); int nDirectionY = GetDirectionY(pGlassTypeInfo->m_nOriginDirection, pMotorInfo->GetOriginDirection()); pCoordCalibrator->SetTransDirection(nDirectionX, nDirectionY); pCoordCalibrator->SetOriginMotorPosition(pGlassTypeInfo->m_dOriginMotorX, pGlassTypeInfo->m_dOriginMotorY); if (fabs(pGlassTypeInfo->m_dAlignAngle) > 0.0000001) { pCoordCalibrator->SetRotationInfo(pGlassTypeInfo->m_dFirstAlignMotorX, pGlassTypeInfo->m_dFirstAlignMotorY, pGlassTypeInfo->m_dFirstAlignGlassX, pGlassTypeInfo->m_dFirstAlignGlassY, pGlassTypeInfo->m_dAlignAngle); } pGlassResult->SetGlassSize(pGlassTypeInfo->m_nGlassSizeX * 1000, pGlassTypeInfo->m_nGlassSizeY * 1000); pGlassResult->SetGlassOriginDirection(pGlassTypeInfo->m_nOriginDirection); pGlassResult->SetCornerCutDirection(pGlassTypeInfo->m_nCornerCutDirection); pGlassResult->SetGlassCenterCoordinate(pGlassTypeInfo->m_bUseCenterCoodinateSystem); pGlassResult->SetGlassInverseCoordinate(pGlassTypeInfo->m_bUseInverseCoordinate); pGlassResult->SetCollisionDistanceX(int(pSystemInfo->m_dCollisionDistance*1000.)); } const CRsRcpAlignInfo* pRsRcpAlignInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpAlignInfo(); if (pGlassTypeInfo && pRsRcpAlignInfo) { pGlassResult->m_AlignRecipe.m_nUseAlignPosMove = pGlassTypeInfo->m_nUseAlignPosMove; pGlassResult->m_AlignRecipe.dOriginPixelX[0] = pGlassTypeInfo->m_nFirstAlignFindPixelX; pGlassResult->m_AlignRecipe.dOriginPixelY[0] = pGlassTypeInfo->m_nFirstAlignFindPixelY; pGlassResult->m_AlignRecipe.dOriginPixelX[1] = pGlassTypeInfo->m_nSecondAlignFindPixelX; pGlassResult->m_AlignRecipe.dOriginPixelY[1] = pGlassTypeInfo->m_nSecondAlignFindPixelY; pGlassResult->m_AlignRecipe.dOriginPositionX[0] = pGlassTypeInfo->m_dFirstAlignMotorX; pGlassResult->m_AlignRecipe.dOriginPositionY[0] = pGlassTypeInfo->m_dFirstAlignMotorY; pGlassResult->m_AlignRecipe.dOriginPositionX[1] = pGlassTypeInfo->m_dSecondAlignMotorX; pGlassResult->m_AlignRecipe.dOriginPositionY[1] = pGlassTypeInfo->m_dSecondAlignMotorY; pGlassResult->m_AlignRecipe.dGlassPositionX[0] = pGlassTypeInfo->m_dFirstAlignGlassX; pGlassResult->m_AlignRecipe.dGlassPositionY[0] = pGlassTypeInfo->m_dFirstAlignGlassY; pGlassResult->m_AlignRecipe.dGlassPositionX[1] = pGlassTypeInfo->m_dSecondAlignGlassX; pGlassResult->m_AlignRecipe.dGlassPositionY[1] = pGlassTypeInfo->m_dSecondAlignGlassY; // Align Recipe // Align Skip Mode pGlassResult->m_AlignRecipe.bAlignSkipMode = pRsRcpAlignInfo->m_bAlignSkipMode; pGlassResult->m_AlignRecipe.bUseTotalPitchMeasure = pRsRcpAlignInfo->m_bTotalPitchMeasure; // image matching pGlassResult->m_AlignRecipe.bUseImage = pRsRcpAlignInfo->m_bUseImage; pGlassResult->m_AlignRecipe.dMatchingRate = pRsRcpAlignInfo->m_dMatchingRate; pGlassResult->m_AlignRecipe.strFirstImageFile = pRsRcpAlignInfo->m_strFirstImageFile; pGlassResult->m_AlignRecipe.strSecondImageFile = pRsRcpAlignInfo->m_strSecondImageFile; pGlassResult->m_AlignRecipe.strTotalPitchImageFile = pRsRcpAlignInfo->m_strTotalPitchImageFile; // edge find param pGlassResult->m_AlignRecipe.bUseEdge = pRsRcpAlignInfo->m_bUseEdge; pGlassResult->m_AlignRecipe.nEdgeWidth = pRsRcpAlignInfo->m_nEdgeWidth; pGlassResult->m_AlignRecipe.nEdgeHeight = pRsRcpAlignInfo->m_nEdgeHeight; pGlassResult->m_AlignRecipe.nEdgeThreshold = pRsRcpAlignInfo->m_nEdgeThreshold; pGlassResult->m_AlignRecipe.nMergeRange = pRsRcpAlignInfo->m_nMergeRange; pGlassResult->m_AlignRecipe.dEdgeRate = pRsRcpAlignInfo->m_dEdgeRate; pGlassResult->m_AlignRecipe.bManualProcess = pRsRcpAlignInfo->m_bManualProcess; pGlassResult->m_AlignRecipe.dFirstCamExposure = pRsRcpAlignInfo->m_dFirstCamExposure; pGlassResult->m_AlignRecipe.dSecondCamExposure = pRsRcpAlignInfo->m_dSecondCamExposure; pGlassResult->m_AlignRecipe.bAutoProcess = pRsRcpAlignInfo->m_bAutoProcess; pGlassResult->m_AlignRecipe.dTargetMin = pRsRcpAlignInfo->m_dTargetMin; pGlassResult->m_AlignRecipe.dTargetMax = pRsRcpAlignInfo->m_dTargetMax; pGlassResult->m_AlignRecipe.dExposureMin = pRsRcpAlignInfo->m_dExposureMin; pGlassResult->m_AlignRecipe.dExposureMax = pRsRcpAlignInfo->m_dExposureMax; pGlassResult->m_AlignRecipe.bRotateProcess = pRsRcpAlignInfo->m_bRotateProcess; pGlassResult->m_AlignRecipe.nRetryCount = pRsRcpAlignInfo->m_nRetryCount; pGlassResult->m_AlignRecipe.dGlassAngleMin = pRsRcpAlignInfo->m_dGlassAngleMin; pGlassResult->m_AlignRecipe.dGlassAngleMax = pRsRcpAlignInfo->m_dGlassAngleMax; int nAlignCameraInfoCount = 2; for(int nAlignCameraIdx = 0; nAlignCameraIdx < nAlignCameraInfoCount; nAlignCameraIdx++) { int nLightValue = 0; if(pRsRcpAlignInfo->m_bManualProcess == 1) { nLightValue = (nAlignCameraIdx==0) ? (int)pRsRcpAlignInfo->m_dFirstCamExposure: (int)pRsRcpAlignInfo->m_dSecondCamExposure; const CAlignCameraInfo *pCameraInfo = m_pSP2P->ISP2P_System_GetAlignCameraInfo(nAlignCameraIdx); CLightControl *pLightControl = NULL; const CLightControlInfo *AlignLightinfo = pCameraInfo->GetLightContorlInfo(); if (AlignLightinfo) { if (AlignLightinfo->GetMaster()==1&& nAlignCameraIdx==1) { pLightControl = m_pSP2P->ISP2P_GetAlignLightControl(0); } else { pLightControl = m_pSP2P->ISP2P_GetAlignLightControl(nAlignCameraIdx); } } else { pLightControl = m_pSP2P->ISP2P_GetAlignLightControl(nAlignCameraIdx); } if (pLightControl) { if (pLightControl->SetLightLevel(nLightValue,nAlignCameraIdx)) { if (nAlignCameraIdx==0) m_pSP2P->ISP2P_DisplayMessage(_T("[ApplyRecipeData] 1st AlignCamera Light Level Change %d Success!"), nLightValue); else if (nAlignCameraIdx==1) m_pSP2P->ISP2P_DisplayMessage(_T("[ApplyRecipeData] 2nd AlignCamera Light Level Change %d Success!"), nLightValue); } else { if (nAlignCameraIdx==0) m_pSP2P->ISP2P_DisplayMessage(_T("[ApplyRecipeData] 1st AlignCamera Light Level Change %d Fail!"), nLightValue); else if (nAlignCameraIdx==1) m_pSP2P->ISP2P_DisplayMessage(_T("[ApplyRecipeData] 2nd AlignCamera Light Level Change %d Fail!"), nLightValue); } } } const CAlignCameraInfo *pCameraInfo = m_pSP2P->ISP2P_System_GetAlignCameraInfo(nAlignCameraIdx); if (pCameraInfo) { const CCameraControlInfo_Plus* pCameraControlInfo = pCameraInfo->GetCameraControlInfo(); if(pCameraControlInfo) { pGlassResult->m_AlignRecipe.dCameraResolution[nAlignCameraIdx] = pCameraControlInfo->GetPixelResolution(); if(pCameraControlInfo->GetAxisDirectionX() == CAMERA_DIRECTION_FORWARD) { pGlassResult->m_AlignRecipe.nCameraDirX[nAlignCameraIdx] = 1; } else { pGlassResult->m_AlignRecipe.nCameraDirX[nAlignCameraIdx] = -1; } if(pCameraControlInfo->GetAxisDirectionY() == CAMERA_DIRECTION_FORWARD) { pGlassResult->m_AlignRecipe.nCameraDirY[nAlignCameraIdx] = 1; } else { pGlassResult->m_AlignRecipe.nCameraDirY[nAlignCameraIdx] = -1; } } } if((int)pGlassTypeInfo->m_vecTemplateImagePath.size() == nAlignCameraInfoCount) { pGlassResult->m_AlignRecipe.strTemplateName[nAlignCameraIdx] = pGlassTypeInfo->m_vecTemplateImagePath[nAlignCameraIdx]; } } } if (pRsRcpReviewInfo) { int nModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(); CString strRecipeName = *pGlassResult->GetPPID(); for (int nModuleIdx=0; nModuleIdxGetRcpLightInfo(nModuleIdx); if (pRcpReviewLightInfo) { ReviewLight_SetLightLevel(nModuleIdx, pRcpReviewLightInfo->m_nLightLevel); } const CRcpAFMRecipeInfo *pRcpReviewAFMInfo = pRsRcpReviewInfo->GetRcpAFMRecipeInfo(nModuleIdx); if (pRcpReviewAFMInfo) { int nRealAFMIndex = pRcpReviewAFMInfo->m_nRecipeIndex; if(nRealAFMIndex == -1) { nRealAFMIndex = GetRealMagnification(nModuleIdx, pRcpReviewAFMInfo->m_nZoomIndex); } AFM_SetAFMRecipeName(nModuleIdx, strRecipeName, nRealAFMIndex); if(pRcpReviewAFMInfo->m_bAFMHomeOffMode==TRUE) //190618AFM { SetUseAfmHomePosition(FALSE); } else { SetUseAfmHomePosition(TRUE); } } } } CReviewProcessor* pReviewProcessor = m_pSP2P->ISP2P_GetReviewProcessor(); const CRsRcpDefectFindInfo* pRsRcpDefectFindInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpDefectFindInfo(); if(pReviewProcessor && pRsRcpDefectFindInfo) { pReviewProcessor->SetDefectFindInfo(pRsRcpDefectFindInfo); } // EdgeAlign Check CCameraControlAlign* pCameraControlAlign = m_pSP2P->ISP2P_GetAlignCameraControl(); if(pCameraControlAlign) { pCameraControlAlign->SetAlignType(pRsRcpAlignInfo->m_bEdgeAlignProcess); g_pLog->DisplayMessage(_T("[ApplyRecipeDataToGlassResult] EdgeAlignCheck")); } // range info CRsRcpReviewInfo* pRsRcpReviewInfo2 = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if (pRsRcpReviewInfo2) { CRcpSchedulingInfo* pScheduleInfo = pRsRcpReviewInfo2->GetRcpSchedulingInfo(); if (pScheduleInfo) { if (pScheduleInfo->GetUseRangeCntInfo()) { // pointer re init m_pSP2P->ISP2P_GetDefectPicker(PICKER_IDX_RANGE); m_pSP2P->ISP2P_GetReviewScheduler(PICKER_IDX_RANGE); // add range info for (int nIdx=0; nIdxGetRangePointInfo(nIdx); if (pRangeInfo == NULL) continue; GetRangeName(nIdx, pRangeInfo); GetRangeSize(nIdx, pRangeInfo); } GetRangeStartEnd(pScheduleInfo); } } } return TRUE; } BOOL CSequenceProcessor_CPJT::ReadAOIRawFileToGlassResult(CGlassResult *pGlassResult) { BOOL bRet = FALSE; CString strRawTDPath=_T(""), strRawCDPath=_T(""), strRawSDPath=_T(""); FindAOIRawFilePath(pGlassResult, &strRawTDPath, &strRawCDPath, &strRawSDPath); bRet = m_pSP2P->ISP2P_ReadAOIRawFileToGlassResult(strRawTDPath); return bRet; } BOOL CSequenceProcessor_CPJT::FindAOIRawFilePath(CGlassResult *pGlassResult, CString* pRawTDPath, CString* pRawCDPath, CString* pRawSDPath) { *pRawTDPath = _T(""); *pRawCDPath = _T(""); *pRawSDPath = _T(""); CString strGlassID = *pGlassResult->GetJobID(); if (strGlassID.IsEmpty()) { m_pSP2P->ISP2P_DisplayMessage(_T("Glass ID is not Exist!")); return FALSE; } const CNetworkInfo *pNetworkInfo = m_pSP2P->ISP2P_System_GetNetworkInfo(); if(pNetworkInfo == NULL) return 0; CString strAOIRawPath = pNetworkInfo->m_strAOIRawPath; CString strLocalRawPath = pNetworkInfo->m_strLocalRawPath; if (strAOIRawPath.IsEmpty() || strLocalRawPath.IsEmpty() ) { m_pSP2P->ISP2P_DisplayMessage(_T("%s ResultFile Search Fail!"), strGlassID); return FALSE; } // set find name CString strSearchPath; strSearchPath.Format(_T("%s\\%s*"), strAOIRawPath, strGlassID); // find file CTime timeLastWrite; CString strFileName, strFileGlassID, strFileWriteTime, strFileExtension, strExtTemp; SRawFile sRawFile; VectorSRawFile vectorSRowFile; int nIdx = -1; CFileFind finder; BOOL bRet = finder.FindFile(strSearchPath); while(bRet) { sRawFile.Reset(); bRet = finder.FindNextFile(); if(finder.IsDots()) continue; if(finder.IsDirectory()) continue; // [2017:5:16]-[WEZASW] : AOI Server sRawFile.strFileName = finder.GetFileName(); strExtTemp = sRawFile.strFileName; int nIdx = strExtTemp.Remove('.'); AfxExtractSubString(strFileExtension, sRawFile.strFileName, nIdx, '.'); //if(strFileExtension.Compare(_T("hgl")) != 0 ) continue; finder.GetLastWriteTime(timeLastWrite); sRawFile.dWriteTime = (double)timeLastWrite.GetTime(); vectorSRowFile.push_back(sRawFile); } finder.Close(); // find file size check if(vectorSRowFile.size() < 1) { m_pSP2P->ISP2P_DisplayMessage(_T("%s ResultFile Search Fail!"), strGlassID); return FALSE; } // sorting find file SortingFindAOIRawFile(vectorSRowFile, RESULT_SORTING_DESCENDING); CString strSourcePath, strTargetPath; strFileName.Format(_T("%s"), vectorSRowFile[0].strFileName); strSourcePath.Format(_T("%s\\%s"), strAOIRawPath, strFileName); strTargetPath.Format(_T("%s\\%s"), strLocalRawPath, strFileName); //TD if (CopyFile(strSourcePath, strTargetPath, FALSE)) { CString strSrcFilePath, strDstFilePath, strFileTemp; bRet = TRUE; pGlassResult->m_strLocalRawFilePath = strTargetPath; pGlassResult->m_strAOIRawFileName = strFileName; pGlassResult->m_strAOIRawFilePath = strSourcePath; m_pSP2P->ISP2P_DisplayMessage(_T("%s -> %s"), strSourcePath, strTargetPath); m_pSP2P->ISP2P_DisplayMessage(_T("[TD] ResultFile Copy Success!")); // Backup strSourcePath = strTargetPath; if (pGlassResult->m_strResultDate.GetLength()>0) { strTargetPath.Format(_T("%sBackup\\%s\\%s"), strLocalRawPath, pGlassResult->m_strResultDate, strFileName); // here mch } else { strTargetPath.Format(_T("%sBackup\\%s"), strLocalRawPath, strFileName); // here mch } CopyFile(strSourcePath, strTargetPath, FALSE); *pRawTDPath = pGlassResult->m_strLocalRawFilePath; } else { bRet = FALSE; pGlassResult->m_strLocalRawFilePath = _T(""); pGlassResult->m_strAOIRawFileName = _T(""); pGlassResult->m_strAOIRawFilePath = _T(""); m_pSP2P->ISP2P_DisplayMessage(_T("[TD] %s ResultFile Copy Fail!"), strTargetPath); } return bRet; } BOOL CSequenceProcessor_CPJT::ReviewStartProcessing(CGlassResult *pGlassResult, int nPlanIndex) { // clear frame index int nCameraControlCount = m_pSP2P->ISP2P_GetReviewCameraControlCount(); for(int nCameraControlIdx = 0; nCameraControlIdx < nCameraControlCount; nCameraControlIdx++) { CCameraControlReview* pCameraControl = m_pSP2P->ISP2P_GetReviewCameraControl(nCameraControlIdx); if(pCameraControl == NULL) continue ; SCameraControl* SCameraCon = Module_GetCameraControl(nCameraControlIdx); SCameraCon->bSelected = TRUE; pCameraControl->Camera_ClearIndex(); } // AFM Tracking OFF //AFM_SetAFMTracking(TRUE); // set Mag (Revolver, AFM) if(!AllChangeMagnification(0, ZoomLevel_Auto_CPJT, CPJT_PlanReview)) { g_pLog->DisplayMessage(_T("[Revolver] Magnification Change Fail")); } // set Light Value CRsRcpReviewInfo *pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if (pRsRcpReviewInfo) { int nModuleCount = Module_GetModuleStatusCount(); for (int nModuleIdx=0; nModuleIdxGetRcpLightInfo(nModuleIdx); if (pRcpLightInfo) { ReviewLight_SetLightLevel(nModuleIdx, pRcpLightInfo->m_nLightLevel); } BOOL isTopReview = pRsRcpReviewInfo->GetRcpAFMRecipeInfo(nModuleIdx)->GetAFMOffMode(); if (!isTopReview) { // AFM Tracking ON AFM_SetAFMTracking(nModuleIdx, TRUE); } } } CReviewProcessor* pReviewProcessor = m_pSP2P->ISP2P_GetReviewProcessor(); if(pGlassResult && pReviewProcessor) { // ReviewStart pReviewProcessor->SetJobID(pGlassResult->m_strJobID);//pGlassResult->m_strGlassID -> pGlassResult->m_strJobID pReviewProcessor->SetOperID(pGlassResult->m_strOperID); m_pSP2P->ISP2P_UpdateReviewProcessStatus(ReviewProcessStatus_ReviewStart, nPlanIndex); // Send ReviewPos to motor m_pSP2P->ISP2P_DisplayMessage(_T("[Motor] Send Review Point to Motor Started!")); SendReviewPositionToMotorControl(pGlassResult); m_pSP2P->ISP2P_DisplayMessage(_T("[Motor] Send Review Point to Motor Ended!")); return TRUE; } return FALSE; } int CSequenceProcessor_CPJT::SendReviewPositionToMotorControl(CGlassResult *pGlassResult) { CMotorControl *pMotorControl = m_pSP2P->ISP2P_GetMotorControl(); if(pMotorControl == NULL) return 0; const CSystemInfo *pSystemInfo = m_pSP2P->ISP2P_System_GetSystemInfo(); if(pSystemInfo == NULL) return -1; const CMotorControlInfo* pMotorInfo = m_pSP2P->ISP2P_System_GetMotorInfo(); if (pMotorInfo == NULL) return -2; const CCoordCalibrator* pCoordCalibrator = m_pSP2P->ISP2P_GetCoordCalibrator(); if (pMotorInfo == NULL) return -3; // set move count zero for(int i=0; iGetGantryInfoCount(); i++) { pMotorControl->GantrySetMoveCount(i, 0); } // set move delay time pMotorControl->CommonSetAfDelayTime(pMotorInfo->GetAfDelayTime()); pMotorControl->CommonSetImageDelayTime(pMotorInfo->GetImageDelayTime()); pMotorControl->CommonSetWsiDelayTime(pMotorInfo->GetWsiDelayTime()); // get direction int nDirectionX, nDirectionY; pCoordCalibrator->GetTransDirection(nDirectionX, nDirectionY); int nTotalCount = 0; double dDefectPosX, dDefectPosY; VectorDouble vectorCollisionPosX; vectorCollisionPosX.clear(); // review result count for (int nModuleIdx=0; nModuleIdxGetReviewResult(nModuleIdx); if (pReviewResult==NULL) continue; const SCoordInfo* pCoordInfo = Module_GetCoordInfo(nModuleIdx); if (pCoordInfo==NULL) continue; CModuleStatus* pModuleStatus = Module_GetModuleStatus(nModuleIdx); if (pModuleStatus == NULL) continue; { double dCollisionPosX = pReviewResult->GetCollisionPositionX() / 1000.0; double dCollisionPosY = 0.0; vectorCollisionPosX.push_back(dCollisionPosX); pCoordCalibrator->TransGlass2Motor(pCoordInfo, dCollisionPosX, dCollisionPosY); int type; if (m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->GetSingleGantryPath() == 2) { type = 1; } else if (m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->GetSingleGantryPath() == 1) { type = 0; } else { type = 1; } if (pMotorControl->GantrySetCollisionPosition(pModuleStatus->GetGantryIndex(), dCollisionPosX, dCollisionPosY, type)) { int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex()); g_pLog->DisplayMessage(_T("[Review_CollisionPos] %d Module, Addr: %d, PosX: %.3lf mm"), nModuleIdx, XAddr, dCollisionPosX); //pGlassResult->SetCollisionXPos(nModuleIdx, dCollisionPosX); } else { int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex()); g_pLog->DisplayMessage(_T("[Collision Position Set Fail] %d Module, Addr: %d, PosX: %.3lfmm"), nModuleIdx, XAddr, dCollisionPosX); return 0; } } pMotorControl->GantrySetTwoGantrySyncModeSend(0); // set result index int nStartIdx = pReviewResult->GetStartSReviewResultIndex(); int nEndIdx = pReviewResult->GetEndSReviewResultIndex(); nEndIdx = min(nEndIdx, (pReviewResult->GetSReviewResultCount()-1)) + 1; // End Index double xpostemp, ypostemp; // get review pos VectorDouble vectorPosX, vectorPosY; for (int nResultIdx=nStartIdx; nResultIdxGetSReviewResult(nResultIdx); if (pReview==NULL) continue; //200 if (pReview->bCheckSendToMotor == FALSE) { pReview->bCheckSendToMotor = TRUE; } else { continue; } // set defect pos dDefectPosX = double(pReview->nUMOriginX) / 1000.0; dDefectPosY = double(pReview->nUMOriginY) / 1000.0; // trans glass to motor pos pCoordCalibrator->TransGlass2Motor(pCoordInfo, dDefectPosX, dDefectPosY); // set offset ApplyMotorOffset(pReview->nModuleIdx, pReview->nZoomIdx, MotorOffsetCamera + MotorOffsetMag+MotorOffset_Glass, dDefectPosX, dDefectPosY); //xpostemp = dDefectPosX; //ypostemp = dDefectPosY; m_pSP2P->GetOffSetValue(nModuleIdx, pReview->nAOICameraIdx, pReview->nAOIScanIdx, pReview->nUMOriginX/1000.0, xpostemp, ypostemp); xpostemp = floor(xpostemp * 1000); ypostemp = floor(ypostemp * 1000); //ypostemp = ypostemp * -1; dDefectPosX += xpostemp/1000; dDefectPosY += ypostemp/1000; g_pLog->DisplayMessage(_T("[ReviewPath] Module [%d] PosX: %lfmm PosY: %lfmm X:%.03lf Y%.03lf"), nModuleIdx, dDefectPosX, dDefectPosY, xpostemp, ypostemp); // calibration CalibrateMotorPos(pReview->nModuleIdx,dDefectPosX,dDefectPosY); // add review result if((int)vectorPosX.size() < MAX_MOTOR_ADDRESS_SIZE) { pReview->dTargetMotorX = dDefectPosX; pReview->dTargetMotorY = dDefectPosY; vectorPosX.push_back(dDefectPosX); vectorPosY.push_back(dDefectPosY); } } if (vectorPosX.empty() ==TRUE) { g_pLog->DisplayMessage(_T("[GantryAutoGo] No Exist Send Point "), vectorPosX.size()); g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Fail"), pModuleStatus->GetGantryIndex()); //taek 210128 } else { if (m_pSP2P->ISP2P_GetReviewProcessor()->CheckMotionComplete() == FALSE) { g_pLog->DisplayMessage(_T("[GantryAutoGo] Motor IS Not Ready ")); } // move path to motor // FALSE->TRUE(HSJ TEST) if (pMotorControl->GantryAutoGo(pModuleStatus->GetGantryIndex(), vectorPosX, vectorPosY, TRUE)) { nTotalCount += (int)vectorPosX.size(); g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Success! Point[%d]"), pModuleStatus->GetGantryIndex(), int(vectorPosX.size())); //cmark } else { int nPathSendRetry = 0; BOOL bOverTime = FALSE; g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Fail"), pModuleStatus->GetGantryIndex()); int nTickCount = GetTickCount(); while (1) { if ((GetTickCount() - nTickCount) > 5000) { bOverTime = TRUE; break; } if (pMotorControl->IsGantryMotionEnd(pModuleStatus->GetGantryIndex()) == TRUE) { if (pMotorControl->GantryAutoGo(pModuleStatus->GetGantryIndex(), vectorPosX, vectorPosY, TRUE)) { nTotalCount += (int)vectorPosX.size(); g_pLog->DisplayMessage(_T("[GantryAutoGo] Motion End üũ (%d)Gantry Path Send Success! Point[%d]"), pModuleStatus->GetGantryIndex(), int(vectorPosX.size())); break; } else { g_pLog->DisplayMessage(_T("[GantryAutoGo] Motion End üũ (%d)Gantry Path Send Fail"), pModuleStatus->GetGantryIndex()); } break; } } if (bOverTime == TRUE) { for (int i = 0; i < 3; i++) { Sleep(1000); if (pMotorControl->GantryAutoGo(pModuleStatus->GetGantryIndex(), vectorPosX, vectorPosY, TRUE)) { nTotalCount += (int)vectorPosX.size(); g_pLog->DisplayMessage(_T("[GantryAutoGo] Retry[%d] (%d)Gantry Path Send Success! Point[%d]"), nPathSendRetry, pModuleStatus->GetGantryIndex(), int(vectorPosX.size())); break; } else { g_pLog->DisplayMessage(_T("[GantryAutoGo] Retry[%d] (%d)Gantry Path Send Fail"), nPathSendRetry, pModuleStatus->GetGantryIndex()); } nPathSendRetry += 1; } } } } } // all auto go // HSJ TEST if (pMotorControl->CommonSetAutoGoAll()==FALSE) { g_pLog->DisplayMessage(_T("[GantryAutoGo] All Gantry AutoReview Fail!")); return 0; } g_pLog->DisplayMessage(_T("[GantryAutoGo] All Gantry AutoReview Success!")); return nTotalCount; } BOOL CSequenceProcessor_CPJT::UserStartProcessing(CGlassResult *pGlassResult, int nPlanIndex) { // clear frame index int nCameraControlCount = m_pSP2P->ISP2P_GetReviewCameraControlCount(); for(int nCameraControlIdx = 0; nCameraControlIdx < nCameraControlCount; nCameraControlIdx++) { CCameraControlReview* pCameraControl = m_pSP2P->ISP2P_GetReviewCameraControl(nCameraControlIdx); if(pCameraControl == NULL) continue ; pCameraControl->Camera_ClearIndex(); } // AFM Tracking OFF AFM_SetAFMTracking(FALSE); // set Mag (Revolver, AFM) if(!AllChangeMagnification(0, ZoomLevel_Auto_CPJT, CPJT_PlanUser)) { g_pLog->DisplayMessage(_T("[Revolver] Magnification Change Fail")); } // set Light Value const CRsRcpReviewInfo *pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if (pRsRcpReviewInfo) { int nModuleCount = Module_GetModuleStatusCount(); for (int nModuleIdx=0; nModuleIdxGetRcpUserLightInfo(nModuleIdx); if (pRcpLightInfo) { ReviewLight_SetLightLevel(nModuleIdx, pRcpLightInfo->m_nLightLevel); } } } // AFM Tracking ON AFM_SetAFMTracking(TRUE); CReviewProcessor* pReviewProcessor = m_pSP2P->ISP2P_GetReviewProcessor(); if(pGlassResult && pReviewProcessor) { // UserStart pReviewProcessor->SetJobID(pGlassResult->m_strJobID); //pGlassResult->m_strGlassID -> pGlassResult->m_strJobID pReviewProcessor->SetOperID(pGlassResult->m_strOperID); m_pSP2P->ISP2P_UpdateReviewProcessStatus(ReviewProcessStatus_UserStart, nPlanIndex); // Send UserPos to motor m_pSP2P->ISP2P_DisplayMessage(_T("[Motor] Send User Point to Motor Started!")); SendUserPositionToMotorControl(pGlassResult); m_pSP2P->ISP2P_DisplayMessage(_T("[Motor] Send User Point to Motor Ended!")); return TRUE; } return FALSE; } int CSequenceProcessor_CPJT::SendUserPositionToMotorControl(CGlassResult *pGlassResult) { CMotorControl *pMotorControl = m_pSP2P->ISP2P_GetMotorControl(); if (pMotorControl == NULL) return 0; const CSystemInfo *pSystemInfo = m_pSP2P->ISP2P_System_GetSystemInfo(); if (pSystemInfo == NULL) return -1; const CMotorControlInfo* pMotorInfo = m_pSP2P->ISP2P_System_GetMotorInfo(); if (pMotorInfo == NULL) return -2; const CCoordCalibrator* pCoordCalibrator = m_pSP2P->ISP2P_GetCoordCalibrator(); if (pMotorInfo == NULL) return -3; // set move count zero for (int i = 0; i < pSystemInfo->GetGantryInfoCount(); i++) { pMotorControl->GantrySetMoveCount(i, 0); } // set move delay time pMotorControl->CommonSetAfDelayTime(pMotorInfo->GetAfDelayTime()); pMotorControl->CommonSetImageDelayTime(pMotorInfo->GetImageDelayTime()); pMotorControl->CommonSetWsiDelayTime(pMotorInfo->GetWsiDelayTime()); // get direction int nDirectionX, nDirectionY; pCoordCalibrator->GetTransDirection(nDirectionX, nDirectionY); int nTotalCount = 0; double dDefectPosX, dDefectPosY; VectorDouble vectorCollisionPosX; vectorCollisionPosX.clear(); // review result count for (int nModuleIdx = 0; nModuleIdx < Module_GetModuleStatusCount(); nModuleIdx++) { // get UserResult CReviewResult* pReviewResult = pGlassResult->GetUserResult(nModuleIdx); if (pReviewResult == NULL) continue; const SCoordInfo* pCoordInfo = Module_GetCoordInfo(nModuleIdx); if (pCoordInfo == NULL) continue; CModuleStatus* pModuleStatus = Module_GetModuleStatus(nModuleIdx); if (pModuleStatus == NULL) continue; { double dCollisionPosX = pReviewResult->GetCollisionPositionX() / 1000.0; double dCollisionPosY = 0.0; vectorCollisionPosX.push_back(dCollisionPosX); pCoordCalibrator->TransGlass2Motor(pCoordInfo, dCollisionPosX, dCollisionPosY); int type; if (m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->GetSingleGantryPath() == 2) { type = 1; } else if (m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->GetSingleGantryPath() == 1) { type = 0; } else { type = 1; } if (pMotorControl->GantrySetCollisionPosition(pModuleStatus->GetGantryIndex(), dCollisionPosX, dCollisionPosY, type)) { int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex()); g_pLog->DisplayMessage(_T("[Review_CollisionPos] %d Module, Addr: %d, PosX: %.3lf mm"), nModuleIdx, XAddr, dCollisionPosX); //pGlassResult->SetCollisionXPos(nModuleIdx, dCollisionPosX); } else { int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex()); g_pLog->DisplayMessage(_T("[Collision Position Set Fail] %d Module, Addr: %d, PosX: %.3lfmm"), nModuleIdx, XAddr, dCollisionPosX); return 0; } } // set result index int nStartIdx = pReviewResult->GetStartSReviewResultIndex(); int nEndIdx = pReviewResult->GetEndSReviewResultIndex(); nEndIdx = min(nEndIdx, (pReviewResult->GetSReviewResultCount() - 1)) + 1; // End Index // [2017:3:8]-[WEZASW] : CameraOffset (-1~1 => -5~5) double m_dMinOffset = -5.0; double m_dMaxOffset = 5.0; double xpostemp, ypostemp; // get user pos VectorDouble vectorPosX, vectorPosY; for (int nResultIdx = nStartIdx; nResultIdx < nEndIdx; nResultIdx++) { SReviewResult* pReview = pReviewResult->GetSReviewResult(nResultIdx); if (pReview == NULL) continue; //200 if (pReview->bCheckSendToMotor == FALSE) { pReview->bCheckSendToMotor = TRUE; } else { continue; } // set defect pos dDefectPosX = double(pReview->nUMOriginX) / 1000.0; dDefectPosY = double(pReview->nUMOriginY) / 1000.0; // trans glass to motor pos pCoordCalibrator->TransGlass2Motor(pCoordInfo, dDefectPosX, dDefectPosY); // set offset ApplyMotorOffset(pReview->nModuleIdx, pReview->nZoomIdx, MotorOffsetCamera + MotorOffsetMag + MotorOffset_Glass, dDefectPosX, dDefectPosY); //xpostemp = dDefectPosX; //ypostemp = dDefectPosY; //m_pSP2P->GetOffSetValue(nModuleIdx, pReview->nAOICameraIdx, pReview->nAOIScanIdx, dDefectPosX, xpostemp, ypostemp); // xpostemp = floor(xpostemp * 1000); // ypostemp = floor(ypostemp * 1000); //ypostemp = ypostemp * -1; // dDefectPosX += xpostemp/1000; // dDefectPosY += ypostemp/1000; xpostemp = 0; ypostemp = 0; g_pLog->DisplayMessage(_T("[UserReviewPath] Module [%d] PosX: %lfmm PosY: %lfmm X:%.03lf Y%.03lf"), pReview->nModuleIdx, dDefectPosX, dDefectPosY, xpostemp, ypostemp); // calibration CalibrateMotorPos(pReview->nModuleIdx, dDefectPosX, dDefectPosY); // push move pos if ((int)vectorPosX.size() < MAX_MOTOR_ADDRESS_SIZE) { pReview->dTargetMotorX = dDefectPosX; pReview->dTargetMotorY = dDefectPosY; vectorPosX.push_back(dDefectPosX); vectorPosY.push_back(dDefectPosY); } } if (vectorPosX.empty() == TRUE) { g_pLog->DisplayMessage(_T("[GantryAutoGo] No Exist Send Point "), vectorPosX.size()); g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Fail"), pModuleStatus->GetGantryIndex()); //taek 210128 } else { if (m_pSP2P->ISP2P_GetReviewProcessor()->CheckMotionComplete() == FALSE) { g_pLog->DisplayMessage(_T("[GantryAutoGo] Motor IS Not Ready ")); } // move path to motor // FALSE->TRUE(HSJ TEST) if (pMotorControl->GantryAutoGo(pModuleStatus->GetGantryIndex(), vectorPosX, vectorPosY, TRUE)) { nTotalCount += (int)vectorPosX.size(); g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Success! Point[%d]"), pModuleStatus->GetGantryIndex(), int(vectorPosX.size())); //cmark } else { g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Fail"), pModuleStatus->GetGantryIndex()); } } } // all auto go // HSJ TEST if (pMotorControl->CommonSetAutoGoAll() == FALSE) { g_pLog->DisplayMessage(_T("[GantryAutoGo] All Gantry AutoUser Fail!")); return 0; } g_pLog->DisplayMessage(_T("[GantryAutoGo] All Gantry AutoUser Success!")); return nTotalCount; } BOOL CSequenceProcessor_CPJT::WsiStartProcessing(CGlassResult *pGlassResult, int nPlanIndex) { if (GetProcessStatus() == ProcessReviewEnd_CPJT || GetProcessStatus() == ProcessReviewUnloding_CPJT) { g_pLog->DisplayMessage(_T("[ProcessStop] WSI StartProcessing Sequence Stop Status : %d"), GetProcessStatus()); return TRUE; } AFM_SetAFMTracking(FALSE); // send wsi start SetWsiType(0); WSIAllReadySignal(1); Sleep(1000); if(!WSIAllStartSignal()) { g_pLog->DisplayMessage(_T("[WSI] WSI Start Fail!!")); } CReviewProcessor* pReviewProcessor = m_pSP2P->ISP2P_GetReviewProcessor(); if(pGlassResult && pReviewProcessor) { // WsiStart pReviewProcessor->SetJobID(pGlassResult->m_strJobID); // pGlassResult->m_strGlassID -> pGlassResult->m_strJobID pReviewProcessor->SetOperID(pGlassResult->m_strOperID); m_pSP2P->ISP2P_UpdateReviewProcessStatus(ReviewProcessStatus_WSIStart, nPlanIndex); // Send WsiPos to Motor m_pSP2P->ISP2P_DisplayMessage(_T("[Motor] Send Wsi Point to Motor Started!")); SendWsiPositionToMotorControl(pGlassResult); m_pSP2P->ISP2P_DisplayMessage(_T("[Motor] Send Wsi Point to Motor Ended!")); MakeWSIUpLoadDirectory(pReviewProcessor->GetUploadImagePath()); //20190219 chm pReviewProcessor->SetReviewCount(0); return TRUE; } return FALSE; } void CSequenceProcessor_CPJT::MakeWSIUpLoadDirectory(CString strPath) { strPath = strPath + _T("\\WSI"); if(CreateDirectory(strPath,NULL)==FALSE) { //LYW LOG g_pLog->DisplayMessage(_T("[MakeWSIUpLoadDirectory]Directory Create Fail %s, ERROR CODE = %d "),strPath, GetLastError()); } } int CSequenceProcessor_CPJT::SendWsiPositionToMotorControl(CGlassResult* pGlassResult) { CMotorControl *pMotorControl = m_pSP2P->ISP2P_GetMotorControl(); if(pMotorControl == NULL) return 0; const CSystemInfo *pSystemInfo = m_pSP2P->ISP2P_System_GetSystemInfo(); if(pSystemInfo == NULL) return -1; const CMotorControlInfo* pMotorInfo = m_pSP2P->ISP2P_System_GetMotorInfo(); if (pMotorInfo == NULL) return -2; const CCoordCalibrator* pCoordCalibrator = m_pSP2P->ISP2P_GetCoordCalibrator(); if (pMotorInfo == NULL) return -3; // set move count zero for(int i=0; iGetGantryInfoCount(); i++) { pMotorControl->GantrySetMoveCount(i, 0); } // set move delay time pMotorControl->CommonSetAfDelayTime(pMotorInfo->GetAfDelayTime()); pMotorControl->CommonSetImageDelayTime(pMotorInfo->GetImageDelayTime()); pMotorControl->CommonSetWsiDelayTime(pMotorInfo->GetWsiDelayTime()); // get direction int nDirectionX, nDirectionY; pCoordCalibrator->GetTransDirection(nDirectionX, nDirectionY); int nTotalCount = 0; double dDefectPosX, dDefectPosY; VectorDouble vectorCollisionPosX; vectorCollisionPosX.clear(); //WSI pMotorControl->GantrySetTwoGantrySyncModeSend(1); // WSI result count for (int nModuleIdx = 0; nModuleIdx < Module_GetModuleStatusCount(); nModuleIdx++) { CReviewResult* pWsiResult = pGlassResult->GetWsiResult(nModuleIdx); if (pWsiResult == NULL) continue; const SCoordInfo* pCoordInfo = Module_GetCoordInfo(nModuleIdx); if (pCoordInfo == NULL) continue; CModuleStatus* pModuleStatus = Module_GetModuleStatus(nModuleIdx); if (pModuleStatus == NULL) continue; { double dCollisionPosX = pWsiResult->GetCollisionPositionX() / 1000.0; double dCollisionPosY = 0.0; vectorCollisionPosX.push_back(dCollisionPosX); pCoordCalibrator->TransGlass2Motor(pCoordInfo, dCollisionPosX, dCollisionPosY); int type = 0; if (m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->GetSingleGantryPath() == 2) { type = 1; } else if (m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->GetSingleGantryPath() == 1) { type = 0; } else { type = 1; } if (pMotorControl->GantrySetCollisionPosition(pModuleStatus->GetGantryIndex(), dCollisionPosX, dCollisionPosY, type)) { int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex()); g_pLog->DisplayMessage(_T("[Review_CollisionPos] %d Module, Addr: %d, PosX: %.3lf mm"), nModuleIdx, XAddr, dCollisionPosX); ///pGlassResult->SetCollisionXPos(nModuleIdx, dCollisionPosX); } else { int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex()); g_pLog->DisplayMessage(_T("[Collision Position Set Fail] %d Module, Addr: %d, PosX: %.3lfmm"), nModuleIdx, XAddr, dCollisionPosX); return 0; } } // get result index int nStartIdx = pWsiResult->GetStartSReviewResultIndex(); int nEndIdx = pWsiResult->GetEndSReviewResultIndex(); nEndIdx = min(nEndIdx, (pWsiResult->GetSReviewResultCount() - 1)) + 1; // set End Index // [2017:3:8]-[WEZASW] : CameraOffset (-1~1 => -5~5) double m_dMinOffset = -5.0; double m_dMaxOffset = 5.0; // get wsi pos VectorDouble vectorPosX, vectorPosY; double xpostemp, ypostemp; for (int nResultIdx = nStartIdx; nResultIdx < nEndIdx; nResultIdx++) { SReviewResult* pWsi = pWsiResult->GetSReviewResult(nResultIdx); if (pWsi == NULL) continue; //200 if (pWsi->bCheckWSISendToMotor == FALSE) { pWsi->bCheckWSISendToMotor = TRUE; } else { continue; } // set defect pos dDefectPosX = double(pWsi->nUMOriginX) / 1000.0; dDefectPosY = double(pWsi->nUMOriginY) / 1000.0; // trans glass to motor pos pCoordCalibrator->TransGlass2Motor(pCoordInfo, dDefectPosX, dDefectPosY); // set offset ApplyMotorOffset(pWsi->nModuleIdx, -1, MotorOffsetCamera + MotorOffsetWSI + MotorOffset_Glass, dDefectPosX, dDefectPosY); m_pSP2P->GetOffSetValue(nModuleIdx, pWsi->nAOICameraIdx, pWsi->nAOIScanIdx, pWsi->nUMOriginX / 1000.0, xpostemp, ypostemp); xpostemp = floor(xpostemp * 1000); ypostemp = floor(ypostemp * 1000); //ypostemp = ypostemp * -1; dDefectPosX += xpostemp / 1000; dDefectPosY += ypostemp / 1000; g_pLog->DisplayMessage(_T("[ReviewPath] Module [%d] PosX: %lfmm PosY: %lfmm X:%.03lf Y%.03lf"), nModuleIdx, dDefectPosX, dDefectPosY, xpostemp, ypostemp); // calibration // motor calibrate CalibrateMotorPos(pWsi->nModuleIdx, dDefectPosX, dDefectPosY); // add move pos if ((int)vectorPosX.size() < MAX_MOTOR_ADDRESS_SIZE) { pWsi->dTargetMotorX = dDefectPosX; pWsi->dTargetMotorY = dDefectPosY; vectorPosX.push_back(dDefectPosX); vectorPosY.push_back(dDefectPosY); } } if (vectorPosX.empty() == TRUE) { //3360 LYW_ CF AOI QD Review WSI XY MotorMoving Error START g_pLog->DisplayMessage(_T("[GantryAutoGo] No Exist Send Point,TwoGantrySyncMode OFF!"), vectorPosX.size()); g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Fail"), pModuleStatus->GetGantryIndex()); //taek 210128 pMotorControl->GantrySetTwoGantrySyncModeSend(0); //3360 LYW_ CF AOI QD Review WSI XY MotorMoving Error END } else { if (m_pSP2P->ISP2P_GetReviewProcessor()->CheckMotionComplete() == FALSE) { g_pLog->DisplayMessage(_T("[GantryAutoGo] Motor IS Not Ready ")); } if (pMotorControl->GantryWsiAutoGo(pModuleStatus->GetGantryIndex(), vectorPosX, vectorPosY, TRUE)) { nTotalCount += (int)vectorPosX.size(); g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Success! PointCount : %d"), pModuleStatus->GetGantryIndex(), (int)vectorPosX.size()); } else { g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Fail"), pModuleStatus->GetGantryIndex()); int nPathSendRetry = 0; BOOL bOverTime = FALSE; int nTickCount = GetTickCount(); while (1) { if ((GetTickCount() - nTickCount) > 5000) { bOverTime = TRUE; break; } //End üũ if (pMotorControl->IsGantryMotionEnd(pModuleStatus->GetGantryIndex()) == TRUE) { if (pMotorControl->GantryAutoGo(pModuleStatus->GetGantryIndex(), vectorPosX, vectorPosY, TRUE)) { nTotalCount += (int)vectorPosX.size(); g_pLog->DisplayMessage(_T("[GantryAutoGo] Motion End üũ (%d)Gantry Path Send Success! Point[%d]"), pModuleStatus->GetGantryIndex(), int(vectorPosX.size())); break; } else { g_pLog->DisplayMessage(_T("[GantryAutoGo] Motion End üũ (%d)Gantry Path Send Fail"), pModuleStatus->GetGantryIndex()); } break; } } if (bOverTime == TRUE) { for (int i = 0; i < 3; i++) { Sleep(1000); if (pMotorControl->GantryAutoGo(pModuleStatus->GetGantryIndex(), vectorPosX, vectorPosY, TRUE)) { nTotalCount += (int)vectorPosX.size(); g_pLog->DisplayMessage(_T("[GantryAutoGo] Retry[%d] (%d)Gantry Path Send Success! Point[%d]"), nPathSendRetry, pModuleStatus->GetGantryIndex(), int(vectorPosX.size())); break; } else { g_pLog->DisplayMessage(_T("[GantryAutoGo] Retry[%d] (%d)Gantry Path Send Fail"), nPathSendRetry, pModuleStatus->GetGantryIndex()); } nPathSendRetry += 1; } } } } } // all auto go if (pMotorControl->CommonSetAutoWsiGoAll()==FALSE) { g_pLog->DisplayMessage(_T("[GantryAutoGo] All Gantry AutoWsi Fail!")); return 0; } g_pLog->DisplayMessage(_T("[GantryAutoGo] All Gantry AutoWsi Success!")); return nTotalCount; } BOOL CSequenceProcessor_CPJT::ReflowStartProcessing( CGlassResult *pGlassResult, int nPlanIndex/*=0*/ ) { // clear frame index int nCameraControlCount = m_pSP2P->ISP2P_GetReviewCameraControlCount(); for(int nCameraControlIdx = 0; nCameraControlIdx < nCameraControlCount; nCameraControlIdx++) { CCameraControlReview* pCameraControl = m_pSP2P->ISP2P_GetReviewCameraControl(nCameraControlIdx); if(pCameraControl == NULL) continue ; pCameraControl->Camera_ClearIndex(); } // AFM Tracking OFF AFM_SetAFMTracking(FALSE); // set Mag (Revolver, AFM) if(!AllChangeMagnification(0, ZoomLevel_Auto_CPJT, CPJT_PlanReflow)) { g_pLog->DisplayMessage(_T("[Revolver] Magnification Change Fail")); } // set Light Value const CRsRcpReviewInfo *pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if (pRsRcpReviewInfo) { int nModuleCount = Module_GetModuleStatusCount(); for (int nModuleIdx=0; nModuleIdxGetRcpUserLightInfo(nModuleIdx); if (pRcpLightInfo) { ReviewLight_SetLightLevel(nModuleIdx, pRcpLightInfo->m_nLightLevel); } } } // AFM Tracking ON AFM_SetAFMTracking(TRUE); CReviewProcessor* pReviewProcessor = m_pSP2P->ISP2P_GetReviewProcessor(); if(pGlassResult && pReviewProcessor) { // UserStart pReviewProcessor->SetJobID(pGlassResult->m_strJobID); pReviewProcessor->SetOperID(pGlassResult->m_strOperID); m_pSP2P->ISP2P_UpdateReviewProcessStatus(ReviewProcessStatus_ReflowStart, nPlanIndex); // Send UserPos to motor m_pSP2P->ISP2P_DisplayMessage(_T("[Motor] Send Reflow Point to Motor Started!")); SendReflowPositionToMotorControl(pGlassResult); m_pSP2P->ISP2P_DisplayMessage(_T("[Motor] Send Reflow Point to Motor Ended!")); return TRUE; } return FALSE; } int CSequenceProcessor_CPJT::SendReflowPositionToMotorControl( CGlassResult* pGlassResult ) { CMotorControl *pMotorControl = m_pSP2P->ISP2P_GetMotorControl(); if(pMotorControl == NULL) return 0; const CSystemInfo *pSystemInfo = m_pSP2P->ISP2P_System_GetSystemInfo(); if(pSystemInfo == NULL) return -1; const CMotorControlInfo* pMotorInfo = m_pSP2P->ISP2P_System_GetMotorInfo(); if (pMotorInfo == NULL) return -2; const CCoordCalibrator* pCoordCalibrator = m_pSP2P->ISP2P_GetCoordCalibrator(); if (pMotorInfo == NULL) return -3; // set move count zero for(int i=0; iGetGantryInfoCount(); i++) { pMotorControl->GantrySetMoveCount(i, 0); } // set move delay time pMotorControl->CommonSetAfDelayTime(pMotorInfo->GetAfDelayTime()); pMotorControl->CommonSetImageDelayTime(pMotorInfo->GetImageDelayTime()); pMotorControl->CommonSetWsiDelayTime(pMotorInfo->GetWsiDelayTime()); // get direction int nDirectionX, nDirectionY; pCoordCalibrator->GetTransDirection(nDirectionX, nDirectionY); int nTotalCount = 0; double dDefectPosX, dDefectPosY; // review result count for (int nModuleIdx=0; nModuleIdxGetReflowResult(nModuleIdx); if (pReviewResult==NULL) continue; const SCoordInfo* pCoordInfo = Module_GetCoordInfo(nModuleIdx); if (pCoordInfo==NULL) continue; CModuleStatus* pModuleStatus = Module_GetModuleStatus(nModuleIdx); if (pModuleStatus == NULL) continue; // get result index int nStartIdx = pReviewResult->GetStartSReviewResultIndex(); int nEndIdx = pReviewResult->GetEndSReviewResultIndex(); nEndIdx = min(nEndIdx, (pReviewResult->GetSReviewResultCount()-1)) + 1; // End Index // [2017:3:8]-[WEZASW] : CameraOffset (-1~1 => -5~5) double m_dMinOffset = -5.0; double m_dMaxOffset = 5.0; // get reflow pos VectorDouble vectorPosX, vectorPosY; for (int nResultIdx=nStartIdx; nResultIdxGetSReviewResult(nResultIdx); if (pReview==NULL) continue; // set defect pos dDefectPosX = double(pReview->nUMOriginX) / 1000.0; dDefectPosY = double(pReview->nUMOriginY) / 1000.0; g_pLog->DisplayMessage(_T("[ReflowStart] %d Module, %d Point, Glass: %.3lf mm, %.3lf mm"), nModuleIdx, nResultIdx, dDefectPosX, dDefectPosY); // trans glass to motor pos pCoordCalibrator->TransGlass2Motor(pCoordInfo, dDefectPosX, dDefectPosY); // set offset ApplyMotorOffset(pReview->nModuleIdx, pReview->nZoomIdx, MotorOffsetCamera + MotorOffsetMag, dDefectPosX, dDefectPosY); CalibrateMotorPos(pReview->nModuleIdx, dDefectPosX, dDefectPosY); // push move pos if((int)vectorPosX.size() < MAX_MOTOR_ADDRESS_SIZE) { pReview->dTargetMotorX = dDefectPosX; pReview->dTargetMotorY = dDefectPosY; vectorPosX.push_back(dDefectPosX); vectorPosY.push_back(dDefectPosY); g_pLog->DisplayMessage(_T("[ReflowStart] %d Module, %d Point, Motor: %.3lf mm, %.3lf mm"), nModuleIdx, nResultIdx, dDefectPosX, dDefectPosY); } } // move path to motor if (pMotorControl->GantryAutoGo(pModuleStatus->GetGantryIndex(), vectorPosX, vectorPosY, TRUE))// { nTotalCount += (int)vectorPosX.size(); g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Success!"), pModuleStatus->GetGantryIndex()); } else { g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Fail"), pModuleStatus->GetGantryIndex()); } } // all auto go if (pMotorControl->CommonSetAutoGoAll()==FALSE) { g_pLog->DisplayMessage(_T("[GantryAutoGo] All Gantry AutoReflow Fail!")); return 0; } g_pLog->DisplayMessage(_T("[GantryAutoGo] All Gantry AutoReflow Success!")); return nTotalCount; } BOOL CSequenceProcessor_CPJT::MeasureStartProcessing(CGlassResult *pGlassResult, int nPlanIndex) { // Check Glass per MeausreRecipeGlassCount const CRsRcpMeasureInfo *pRsRcpMeasureInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpMeasureInfo(); // clear frame index int nCameraControlCount = m_pSP2P->ISP2P_GetReviewCameraControlCount(); for(int nCameraControlIdx = 0; nCameraControlIdx < nCameraControlCount; nCameraControlIdx++) { CCameraControlReview* pCameraControl = m_pSP2P->ISP2P_GetReviewCameraControl(nCameraControlIdx); if(pCameraControl == NULL) continue ; pCameraControl->Camera_ClearIndex(); } // AFM Tracking OFF AFM_SetAFMTracking(FALSE); // set Mag (Revolver, AFM) if(!AllChangeMagnification(0, ZoomLevel_Auto_CPJT, CPJT_PlanMeasure)) { g_pLog->DisplayMessage(_T("[Revolver] Magnification Change Fail")); } if (pRsRcpMeasureInfo) { int nModuleCount = Module_GetModuleStatusCount(); int nLightIndex = 0; for (int nModuleIdx=0; nModuleIdxGetRcpMeasureInfo(nLightIndex); ReviewLight_SetLightLevel(nModuleIdx, pMeasureInfo->GetLightLevel()); nLightIndex += pRsRcpMeasureInfo->GetResultCount(); } } // AFM Tracking ON AFM_SetAFMTracking(TRUE); CReviewProcessor* pReviewProcessor = m_pSP2P->ISP2P_GetReviewProcessor(); if(pGlassResult && pReviewProcessor) { // MeasureStart pReviewProcessor->SetJobID(pGlassResult->m_strJobID); // pGlassResult->m_strGlassID -> pGlassResult->m_strJobID pReviewProcessor->SetOperID(pGlassResult->m_strOperID); m_pSP2P->ISP2P_UpdateReviewProcessStatus(ReviewProcessStatus_MeasureStart, nPlanIndex); // Send MeasurePos to Motor m_pSP2P->ISP2P_DisplayMessage(_T("[Motor] Send Measure Point to Motor Started!")); SendMeasurePositionToMotorControl(pGlassResult); m_pSP2P->ISP2P_DisplayMessage(_T("[Motor] Send Measure Point to Motor Ended!")); return TRUE; } return FALSE; } int CSequenceProcessor_CPJT::SendMeasurePositionToMotorControl(CGlassResult *pGlassResult) { CMotorControl *pMotorControl = m_pSP2P->ISP2P_GetMotorControl(); if(pMotorControl == NULL) return 0; const CSystemInfo *pSystemInfo = m_pSP2P->ISP2P_System_GetSystemInfo(); if(pSystemInfo == NULL) return -1; const CMotorControlInfo* pMotorInfo = m_pSP2P->ISP2P_System_GetMotorInfo(); if (pMotorInfo == NULL) return -2; const CCoordCalibrator* pCoordCalibrator = m_pSP2P->ISP2P_GetCoordCalibrator(); if (pCoordCalibrator == NULL) return -3; const CRsRcpMeasureInfo* pRsRcpMeasureInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpMeasureInfo(); if (pRsRcpMeasureInfo==NULL) return -4; // set move count zero int nGantryCount = pSystemInfo->GetGantryInfoCount(); for (int nGantryIdx=0; nGantryIdxGantrySetMoveCount(nGantryIdx, 0); } // set move delay time pMotorControl->CommonSetAfDelayTime(pMotorInfo->GetAfDelayTime()); pMotorControl->CommonSetImageDelayTime(pMotorInfo->GetAfDelayTime()); pMotorControl->CommonSetWsiDelayTime(pMotorInfo->GetWsiDelayTime()); // get direction // int nDirectionX, nDirectionY; // pCoordCalibrator->GetTransDirection(nDirectionX, nDirectionY); int nTotalCount = 0; double dDefectPosX, dDefectPosY; int nResultCount = pRsRcpMeasureInfo->GetResultCount(); for (int nGantryIdx=0; nGantryIdxISP2P_GetModuleStatusCount(); nModuleIdx++) { const CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIdx); if (pModuleStatus==NULL) continue; // check gantry idx if (nGantryIdx!=pModuleStatus->GetGantryIndex()) continue; // get measure result SReviewResult* pSReviewResult = pGlassResult->GetSMeasureResult(nModuleIdx, nResultIdx); if (pSReviewResult==NULL) continue; const SCoordInfo* pCoordInfo = Module_GetCoordInfo(nModuleIdx); if(pCoordInfo == NULL) continue; // [2017:3:8]-[WEZASW] : CameraOffset (-1~1 => -5~5) double m_dMinOffset = -5.0; double m_dMaxOffset = 5.0; dDefectPosX = double(pSReviewResult->nUMOriginX) / 1000.0; dDefectPosY = double(pSReviewResult->nUMOriginY) / 1000.0; // trans glass to motor pos pCoordCalibrator->TransGlass2Motor(pCoordInfo, dDefectPosX, dDefectPosY); // set offset ApplyMotorOffset(nModuleIdx, pSReviewResult->nZoomIdx, MotorOffsetCamera+MotorOffsetMag+MotorOffset_Glass, dDefectPosX, dDefectPosY); // motor calibrator CalibrateMotorPos(nModuleIdx, dDefectPosX, dDefectPosY); // last motor pos pSReviewResult->dTargetMotorX = dDefectPosX; pSReviewResult->dTargetMotorY = dDefectPosY; if (pModuleStatus->GetHeaderIndex()==0) // main header { vecTempPos.push_back(dDefectPosX); // X1 vecTempPos.push_back(dDefectPosY); // Y1 } else // sub header { vecTempPos.push_back(dDefectPosY); // Y2 double dSxPos = dDefectPosX - vecTempPos[0]; // X2 - X1 vecTempPos.push_back(dSxPos); } } // end for module CString strValue = _T(""); strValue.Format(_T("[%d_Gantry_%d_Pos] "), nGantryIdx, nResultIdx); CString strTemp = _T(""); for (VectorDoubleIt it=vecTempPos.begin(); it!=vecTempPos.end(); it++) { strTemp.Format(_T("%.3lf , "), *it); strValue += strTemp; vecGantryPos.push_back(*it); } g_pLog->DisplayMessage(strValue); } // end for result // send measure pos & count if(pMotorControl->GantryMeasureAutoGo(nGantryIdx, vecGantryPos, TRUE)) { nTotalCount += (int)vecGantryPos.size(); g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Success! %d ea"), nGantryIdx, (int)vecGantryPos.size()); } else { g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Fail!"), nGantryIdx); } } // all gantry measure command if (pMotorControl->CommonSetAutoMeasureGoAll()==FALSE) { g_pLog->DisplayMessage(_T("[GantryAutoGo] All Gantry AutoMeasure Fail!")); return 0; } g_pLog->DisplayMessage(_T("[GantryAutoGo] All Gantry AutoMeasure Success!")); return nTotalCount; } int CSequenceProcessor_CPJT::SendMeasurePositionToMotorControl_Old(CGlassResult *pGlassResult) { CMotorControl *pMotorControl = m_pSP2P->ISP2P_GetMotorControl(); if(pMotorControl == NULL) return 0; const CSystemInfo *pSystemInfo = m_pSP2P->ISP2P_System_GetSystemInfo(); if(pSystemInfo == NULL) return -1; const CMotorControlInfo* pMotorInfo = m_pSP2P->ISP2P_System_GetMotorInfo(); if (pMotorInfo == NULL) return -2; const CCoordCalibrator* pCoordCalibrator = m_pSP2P->ISP2P_GetCoordCalibrator(); if (pMotorInfo == NULL) return -3; // set move count zero for(int i=0; iGetGantryInfoCount(); i++) { pMotorControl->GantrySetMoveCount(i, 0); } // set move delay time pMotorControl->CommonSetAfDelayTime(pMotorInfo->GetAfDelayTime()); pMotorControl->CommonSetImageDelayTime(pMotorInfo->GetImageDelayTime()); pMotorControl->CommonSetWsiDelayTime(pMotorInfo->GetWsiDelayTime()); // get direction int nDirectionX, nDirectionY; pCoordCalibrator->GetTransDirection(nDirectionX, nDirectionY); int nTotalCount = 0; double dDefectPosX, dDefectPosY; std::vector SortedModuleStatus; for(int nModuleIdx = 0; nModuleIdx < m_pSP2P->ISP2P_GetModuleStatusCount(); nModuleIdx++) { SortedModuleStatus.push_back(m_pSP2P->ISP2P_GetModuleStatus(nModuleIdx)); } // y sort => x sort std::sort(SortedModuleStatus.begin(), SortedModuleStatus.end(), CompareFuction); //std::vector vecReviewResult; VectorReviewResult* vecReviewResult = pGlassResult->GetVectorMeasureResult(); std::vector vecGantryReviewResult; vecGantryReviewResult.resize(pSystemInfo->GetGantryInfoCount()); for(int nReviewResultIdx = 0; nReviewResultIdx < vecReviewResult->size(); nReviewResultIdx++) { int nModuleStatusIdx = vecReviewResult->at(nReviewResultIdx).GetModuleIndex(); CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleStatusIdx); if(pModuleStatus == NULL) continue; vecGantryReviewResult.at(pModuleStatus->GetGantryIndex()).push_back(vecReviewResult->at(nReviewResultIdx)); } for(int nGantryIdx = 0; nGantryIdx < pSystemInfo->GetGantryInfoCount(); nGantryIdx++) { std::sort(vecGantryReviewResult.at(nGantryIdx).begin(), vecGantryReviewResult.at(nGantryIdx).begin(), GantrySorting); } for(int nGantryIdx = 0; nGantryIdx < pSystemInfo->GetGantryInfoCount(); nGantryIdx++) { VectorDouble vectorPos; VectorReviewResult* pVectorReviewResult = &vecGantryReviewResult.at(nGantryIdx); if(pVectorReviewResult == NULL) continue; if(pVectorReviewResult->size() == 0) continue; int nStartIdx = pVectorReviewResult->at(0).GetStartSReviewResultIndex(); int nEndIdx = pVectorReviewResult->at(0).GetEndSReviewResultIndex(); for(int nSReviewResultIdx = nStartIdx; nSReviewResultIdx < nEndIdx; nSReviewResultIdx++) { for(int nHeaderIdx = 0; nHeaderIdx < vecGantryReviewResult.at(nGantryIdx).size(); nHeaderIdx++) { CReviewResult* pReviewResult = &pVectorReviewResult->at(nHeaderIdx); if(pReviewResult == NULL) { m_pSP2P->ISP2P_DisplayMessage(_T("[Measure Error]Gantry[%d] ReviewResult is NULL"), pReviewResult->GetModuleIndex()); break; } const SCoordInfo* pCoordInfo = Module_GetCoordInfo(pReviewResult->GetModuleIndex()); if(pCoordInfo == NULL) continue; // [2017:3:8]-[WEZASW] : CameraOffset (-1~1 => -5~5) double m_dMinOffset = -5.0; double m_dMaxOffset = 5.0; SReviewResult* pSReviewResult = pReviewResult->GetSReviewResult(nSReviewResultIdx); if(pSReviewResult == NULL) continue; dDefectPosX = double(pSReviewResult->nUMOriginX) / 1000.0; dDefectPosY = double(pSReviewResult->nUMOriginY) / 1000.0; // trans glass to motor pos pCoordCalibrator->TransGlass2Motor(pCoordInfo, dDefectPosX, dDefectPosY); // set offset ApplyMotorOffset(pSReviewResult->nModuleIdx, pSReviewResult->nZoomIdx, MotorOffsetCamera + MotorOffsetMag+MotorOffset_Glass, dDefectPosX, dDefectPosY); // motor calibrator CalibrateMotorPos(pSReviewResult->nModuleIdx, dDefectPosX, dDefectPosY); if(nHeaderIdx == 0) { if((int)vectorPos.size() < MAX_MOTOR_ADDRESS_SIZE) { pSReviewResult->dTargetMotorX = dDefectPosX; pSReviewResult->dTargetMotorY = dDefectPosY; vectorPos.push_back(dDefectPosX); vectorPos.push_back(dDefectPosY); } } else { if((int)vectorPos.size() < MAX_MOTOR_ADDRESS_SIZE) { pSReviewResult->dTargetMotorX = dDefectPosX; pSReviewResult->dTargetMotorY = dDefectPosY; vectorPos.push_back(dDefectPosY); CReviewResult* pFirstReviewResult = &pVectorReviewResult->at(0); SReviewResult* pFirstSReviewResult = pFirstReviewResult->GetSReviewResult(nSReviewResultIdx); double dSXsize = double(pSReviewResult->nUMOriginX - pFirstSReviewResult->nUMOriginX); // pCoordCalibrator->TransGlass2Motor(pCoordInfo, dSXsize, dDefectPosY); vectorPos.push_back(dSXsize); } } } } if(pMotorControl->GantryMeasureAutoGo(nGantryIdx, vectorPos, TRUE)) { nTotalCount += (int)vectorPos.size(); g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Success!"), nGantryIdx); } else { g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Success!"), nGantryIdx); } } // all gantry measure command if (pMotorControl->CommonSetAutoMeasureGoAll()==FALSE) { g_pLog->DisplayMessage(_T("[GantryAutoGo] All Gantry AutoMeasure Fail!")); return 0; } g_pLog->DisplayMessage(_T("[GantryAutoGo] All Gantry AutoMeasure Success!")); return nTotalCount; } void CSequenceProcessor_CPJT::ReviewScheduler_ResizeReviewResult(CPathSchedulerResult* pScheduleResult, CReviewResult* pReviewResult, CDefectPicker* pDefectPicker, int nSize) { pReviewResult->Reset(); int nResultIdx = 0; int nModuleIdx = pReviewResult->GetModuleIndex(); CModuleStatus *pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIdx); if (pModuleStatus==NULL) return; CRsRcpReviewInfo *pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if (pRsRcpReviewInfo==NULL) return; CRcpAFMRecipeInfo *pRcpAFMRecipeInfo = pRsRcpReviewInfo->GetRcpAFMRecipeInfo(nModuleIdx); if (pRcpAFMRecipeInfo==NULL) return; int nZoomIdx = GetRealMagnification(nModuleIdx, pRcpAFMRecipeInfo->m_nZoomIndex); SMagnificInfo *pMagnificInfo = pModuleStatus->GetMagnificInfo(nZoomIdx); SCameraInfo *pCameraInfo = pModuleStatus->GetCameraInfo(0); if (pMagnificInfo==NULL) return; if (pCameraInfo==NULL) return; for (int i=0; iGetPathSchedulerResult(i); if (pNode==NULL) continue; SReviewResult* sResult = pDefectPicker->GetPickingResult(pNode->nTotalIndex); if(sResult == NULL) continue; sResult->nReviewType = ReviewType_Review; sResult->nModuleIdx = nModuleIdx; sResult->nResultIdx = nResultIdx; sResult->nZoomIdx = nZoomIdx; sResult->dMagnification = pMagnificInfo->dMagnification; sResult->dMeasureResolution = pCameraInfo->dResolution / sResult->dMagnification; sResult->bDigitalZoom = FALSE; pReviewResult->AddSReviewResult(*sResult); nResultIdx++; } pScheduleResult->ResizeScheduleResult(nSize); } void CSequenceProcessor_CPJT::ReviewScheduler_ResizeUserResult(CPathSchedulerResult* pScheduleResult, CReviewResult* pReviewResult, CPrioritySorter* pPrioritySorter, int nSize) { pReviewResult->Reset(); int nResultIdx = 0; int nModuleIdx = pScheduleResult->GetModuleIndex(); pReviewResult->SetModuleIndex(nModuleIdx); CModuleStatus *pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIdx); if (pModuleStatus==NULL) return; CRsRcpReviewInfo *pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if (pRsRcpReviewInfo==NULL) return; CRcpAFMRecipeInfo *pRcpAFMRecipeInfo = pRsRcpReviewInfo->GetRcpUserAFMRecipeInfo(nModuleIdx);//pRsRcpReviewInfo->GetRcpAFMRecipeInfo(nModuleIdx); if (pRcpAFMRecipeInfo==NULL) return; int nZoomIdx = GetRealMagnification(nModuleIdx, pRcpAFMRecipeInfo->m_nZoomIndex); SMagnificInfo *pMagnificInfo = pModuleStatus->GetMagnificInfo(nZoomIdx); SCameraInfo *pCameraInfo = pModuleStatus->GetCameraInfo(0); if (pMagnificInfo==NULL) return; if (pCameraInfo==NULL) return; for (int i=0; iGetPathSchedulerResult(i); if (pNode==NULL) continue; SReviewResult* sResult = pPrioritySorter->GetSortingResultUser(pNode->nTotalIndex); if(sResult == NULL) continue; sResult->nReviewType = ReviewType_User; sResult->nModuleIdx = nModuleIdx; sResult->nResultIdx = nResultIdx; sResult->nZoomIdx = nZoomIdx; sResult->dMagnification = pMagnificInfo->dMagnification; sResult->dMeasureResolution = pCameraInfo->dResolution / sResult->dMagnification; sResult->bDigitalZoom = FALSE; pReviewResult->AddSReviewResult(*sResult); nResultIdx++; } pScheduleResult->ResizeScheduleResult(nSize); } void CSequenceProcessor_CPJT::ReviewScheduler_ResizeWsiResult(CPathSchedulerResult* pScheduleResult, CReviewResult* pWsiResult, CDefectPicker* pDefectPicker, int nSize) { pWsiResult->Reset(); int nResultIdx = 0; int nModuleIdx = pScheduleResult->GetModuleIndex(); pWsiResult->SetModuleIndex(nModuleIdx); CModuleStatus *pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIdx); if (pModuleStatus==NULL) return; CRsRcpReviewInfo *pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if (pRsRcpReviewInfo==NULL) return; CRcpAFMRecipeInfo *pRcpAFMRecipeInfo = pRsRcpReviewInfo->GetRcpAFMRecipeInfo(nModuleIdx); if (pRcpAFMRecipeInfo==NULL) return; int nZoomIdx = GetRealMagnification(nModuleIdx, pRcpAFMRecipeInfo->m_nZoomIndex); SMagnificInfo *pMagnificInfo = pModuleStatus->GetMagnificInfo(nZoomIdx); SCameraInfo *pCameraInfo = pModuleStatus->GetCameraInfo(0); if (pMagnificInfo==NULL) return; if (pCameraInfo==NULL) return; for (int i=0; iGetPathSchedulerResult(i); if (pNode==NULL) continue; SReviewResult* sResult = pDefectPicker->GetPickingResultWsi(pNode->nTotalIndex); if(sResult == NULL) continue; sResult->nReviewType = ReviewType_Wsi; sResult->nModuleIdx = nModuleIdx; sResult->nResultIdx = nResultIdx; // sResult->nZoomIdx = nZoomIdx; // sResult->dMagnification = pMagnificInfo->dMagnification; // sResult->dMeasureResolution = pCameraInfo->dResolution / sResult->dMagnification; // sResult->bDigitalZoom = FALSE; pWsiResult->AddSReviewResult(*sResult); nResultIdx++; } pScheduleResult->ResizeScheduleResult(nSize); } void CSequenceProcessor_CPJT::ReviewScheduler_ResizeReflowResult( CPathSchedulerResult* pScheduleResult, CReviewResult* pReviewResult, CPrioritySorter* pPrioritySorter, int nSize) { pReviewResult->Reset(); int nResultIdx = 0; int nModuleIdx = pScheduleResult->GetModuleIndex(); pReviewResult->SetModuleIndex(nModuleIdx); CModuleStatus *pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIdx); if (pModuleStatus==NULL) return; CRsRcpReviewInfo *pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if (pRsRcpReviewInfo==NULL) return; CRcpUserDefectInfo* pRcpUserDefectInfo; CRcpAFMRecipeInfo *pRcpAFMRecipeInfo = pRsRcpReviewInfo->GetRcpAFMRecipeInfo(nModuleIdx); if (pRcpAFMRecipeInfo==NULL) return; int nZoomIdx = GetRealMagnification(nModuleIdx, pRcpAFMRecipeInfo->m_nZoomIndex); SMagnificInfo *pMagnificInfo = pModuleStatus->GetMagnificInfo(nZoomIdx); SCameraInfo *pCameraInfo = pModuleStatus->GetCameraInfo(0); if (pMagnificInfo==NULL) return; if (pCameraInfo==NULL) return; CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult(); if(pGlassResult ==NULL) return; CString strGlassLastName = pGlassResult->m_strGlassLastName; for (int i=0; iGetPathSchedulerResult(i); if (pNode==NULL) continue; SReviewResult* sResult = pPrioritySorter->GetSortingResultReflow(pNode->nTotalIndex); if(sResult == NULL) continue; sResult->nReviewType = ReviewType_Reflow; sResult->nModuleIdx = nModuleIdx; sResult->nResultIdx = nResultIdx; sResult->nZoomIdx = nZoomIdx; sResult->dMagnification = pMagnificInfo->dMagnification; sResult->dMeasureResolution = pCameraInfo->dResolution / sResult->dMagnification; sResult->bDigitalZoom = FALSE; pRcpUserDefectInfo = pRsRcpReviewInfo->GetRcpUserDefectInfo(pNode->nTotalIndex); if (pRcpUserDefectInfo == NULL) continue; if(strGlassLastName.Compare(_T("B")) == 0 || strGlassLastName.Compare(_T("b")) == 0) sResult->strCellID = pRcpUserDefectInfo->GetCellId2(); else sResult->strCellID = pRcpUserDefectInfo->GetCellId(); sResult->nReflow_CellIndex = pRcpUserDefectInfo->m_nReflowCellIndex; pReviewResult->AddSReviewResult(*sResult); nResultIdx++; } pScheduleResult->ResizeScheduleResult(nSize); } int CSequenceProcessor_CPJT::GetCorrectMoudleStatusIdex(CPathSchedulerResult* pReviewScheduleResult, int nModuleType) { int nModuleStatusCount = m_pSP2P->ISP2P_GetModuleStatusCount(); std::vector vecModuleIdx; std::vector vecGantryIdx; std::vector vecGantryPointX; std::vector vecHeaderIdx; for(int nModuleIdx = 0; nModuleIdx < nModuleStatusCount; nModuleIdx++) { CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIdx); if(pModuleStatus == NULL) continue; if(pModuleStatus->GetModuleType() == nModuleType) { vecModuleIdx.push_back(nModuleIdx); } } for(int nIdx = 0; nIdx < vecModuleIdx.size(); nIdx++) { CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nIdx); if(pModuleStatus == NULL) continue; //pModuleStatus->GetGantryIndex() if(!IntVectorFinder(vecGantryIdx, pModuleStatus->GetGantryIndex())) { vecGantryIdx.push_back(pModuleStatus->GetGantryIndex()); vecGantryPointX.push_back( (int)pModuleStatus->GetMotorPosition()->dGlassPosX ); } // if(!IntVectorFinder(vecHeaderIdx, pModuleStatus->GetHeaderIndex())) // { // vecHeaderIdx.push_back(pModuleStatus->GetHeaderIndex()); // } } // Gantry Sorting int nMinPoint; int nMinIdx; for(int nIdx = 0; nIdx < vecGantryIdx.size(); nIdx++) { nMinPoint = vecGantryPointX.at(nIdx); nMinIdx = nIdx; for(int nIdx2 = nIdx; nIdx2 < vecGantryIdx.size(); nIdx2++) { if(vecGantryPointX.at(nIdx2) < nMinPoint) { nMinPoint = vecGantryPointX.at(nIdx2); nMinIdx = nIdx2; } } std::swap(vecGantryPointX.at(nIdx), vecGantryPointX.at(nMinIdx)); std::swap(vecGantryIdx.at(nIdx), vecGantryIdx.at(nMinIdx)); } return 1; } BOOL CSequenceProcessor_CPJT::IntVectorFinder(std::vector TargetData, int FindData) { for(std::vector::iterator It = TargetData.begin(); It != TargetData.end(); It++) { if(FindData == *It) return TRUE; } return FALSE; } /*bool CSequenceProcessor_CPJT::sortstruct::CompareModuleStatusX(int i, int j) { CModuleStatus* pLeftModuleStatus = pSequenceProcessor->m_pSP2P->ISP2P_GetModuleStatus(i); CModuleStatus* pRightModuleStatus = pSequenceProcessor->m_pSP2P->ISP2P_GetModuleStatus(j); if(pLeftModuleStatus == NULL || pRightModuleStatus == NULL) { return false; } double LGlassX = pLeftModuleStatus->GetMotorPosition()->dGlassPosX; double RGlassX = pRightModuleStatus->GetMotorPosition()->dGlassPosX; if(LGlassX < RGlassX) return true; else return false; }*/ bool CSequenceProcessor_CPJT::CompareModuleStatusX::operator()(int i, int j) { CModuleStatus* pLeftModuleStatus = pSequenceProcessor->m_pSP2P->ISP2P_GetModuleStatus(i); CModuleStatus* pRightModuleStatus = pSequenceProcessor->m_pSP2P->ISP2P_GetModuleStatus(j); if(pLeftModuleStatus == NULL || pRightModuleStatus == NULL) { return false; } double LGlassX = pLeftModuleStatus->GetMotorPosition()->dGlassPosX; double RGlassX = pRightModuleStatus->GetMotorPosition()->dGlassPosX; CGlassResult* pGlassResult = pSequenceProcessor->m_pSP2P->ISP2P_GetCurrentGlassResult(); if(pGlassResult == NULL) return false; if(pGlassResult->GetOriginDir() == 0 || pGlassResult->GetOriginDir() == 2) { if(LGlassX < RGlassX) return true; else return false; } else { if(LGlassX > RGlassX) return true; else return false; } } bool CSequenceProcessor_CPJT::CompareModuleStatusY::operator()(int i, int j) { CModuleStatus* pLeftModuleStatus = pSequenceProcessor->m_pSP2P->ISP2P_GetModuleStatus(i); CModuleStatus* pRightModuleStatus = pSequenceProcessor->m_pSP2P->ISP2P_GetModuleStatus(j); if(pLeftModuleStatus == NULL || pRightModuleStatus == NULL) { return false; } double LGlassY = pLeftModuleStatus->GetMotorPosition()->dGlassPosY; double RGlassY = pRightModuleStatus->GetMotorPosition()->dGlassPosY; //if(LGlassY < RGlassY) return true; //else return false; CGlassResult* pGlassResult = pSequenceProcessor->m_pSP2P->ISP2P_GetCurrentGlassResult(); if(pGlassResult == NULL) return false; if(pGlassResult->GetOriginDir() == 2 || pGlassResult->GetOriginDir() == 3) { if(LGlassY < RGlassY) return true; else return false; } else { if(LGlassY > RGlassY) return true; else return false; } } bool CSequenceProcessor_CPJT::CompareReviewResultX::operator()(CReviewResult i, CReviewResult j) { SReviewResult* pLeftReviewResult = i.GetSReviewResult(0); SReviewResult* pRightReviewResult = j.GetSReviewResult(0); if(pLeftReviewResult == NULL || pRightReviewResult == NULL) { return false; } int LPointX = pLeftReviewResult->nUMOriginX; int RPointX = pRightReviewResult->nUMOriginX; // if(LPointX < RPointX) return true; // return false; CGlassResult* pGlassResult = pSequenceProcessor->m_pSP2P->ISP2P_GetCurrentGlassResult(); if(pGlassResult == NULL) return false; if(pGlassResult->GetOriginDir() == 0 || pGlassResult->GetOriginDir() == 2) { if(LPointX < RPointX) return true; else return false; } else { if(LPointX > RPointX) return true; else return false; } } bool CSequenceProcessor_CPJT::CompareReviewResultY::operator()(CReviewResult i, CReviewResult j) { SReviewResult* pLeftReviewResult = i.GetSReviewResult(0); SReviewResult* pRightReviewResult = j.GetSReviewResult(0); if(pLeftReviewResult == NULL || pRightReviewResult == NULL) { return false; } int LPointY = pLeftReviewResult->nUMOriginY; int RPointY = pRightReviewResult->nUMOriginY; // if(LPointY < RPointY) return true; // return false; CGlassResult* pGlassResult = pSequenceProcessor->m_pSP2P->ISP2P_GetCurrentGlassResult(); if(pGlassResult == NULL) return false; if(pGlassResult->GetOriginDir() == 2 || pGlassResult->GetOriginDir() == 3) { if(LPointY < RPointY) return true; else return false; } else { if(LPointY > RPointY) return true; else return false; } } bool CSequenceProcessor_CPJT::CompareWsiResultX::operator()(CReviewResult i, CReviewResult j) { SReviewResult* pLeftReviewResult = i.GetSReviewResult(0); SReviewResult* pRightReviewResult = j.GetSReviewResult(0); if(pLeftReviewResult == NULL || pRightReviewResult == NULL) { return false; } int LPointX = pLeftReviewResult->nUMOriginX; int RPointX = pRightReviewResult->nUMOriginX; // if(LPointX < RPointX) return true; // return false; CGlassResult* pGlassResult = pSequenceProcessor->m_pSP2P->ISP2P_GetCurrentGlassResult(); if(pGlassResult == NULL) return false; if(pGlassResult->GetOriginDir() == 0 || pGlassResult->GetOriginDir() == 2) { if(LPointX < RPointX) return true; else return false; } else { if(LPointX > RPointX) return true; else return false; } } bool CSequenceProcessor_CPJT::CompareWsiResultY::operator()(CReviewResult i, CReviewResult j) { SReviewResult* pLeftReviewResult = i.GetSReviewResult(0); SReviewResult* pRightReviewResult = j.GetSReviewResult(0); if(pLeftReviewResult == NULL || pRightReviewResult == NULL) { return false; } int LPointY = pLeftReviewResult->nUMOriginY;//.nUMOriginY; int RPointY = pRightReviewResult->nUMOriginY; // if(LPointY < RPointY) return true; // return false; CGlassResult* pGlassResult = pSequenceProcessor->m_pSP2P->ISP2P_GetCurrentGlassResult(); if(pGlassResult == NULL) return false; if(pGlassResult->GetOriginDir() == 2 || pGlassResult->GetOriginDir() == 3) { if(LPointY < RPointY) return true; else return false; } else { if(LPointY > RPointY) return true; else return false; } } void CSequenceProcessor_CPJT::SetModuleStatusSReviewProcessor(CReviewResult* pReviewResult, int nModuleIdx) { int nSReviewResultCount = pReviewResult->GetSReviewResultCount(); for(int nSReviewIndx = 0; nSReviewIndx < nSReviewResultCount; nSReviewIndx++) { SReviewResult* pSReviewResult = pReviewResult->GetSReviewResult(nSReviewIndx); if(pSReviewResult == NULL) continue ; pSReviewResult->nModuleIdx = nModuleIdx; } } void CSequenceProcessor_CPJT::SetModuleStatusSWsiProcessor(CReviewResult* pWsiResult, int nModuleIdx) { int nSWsiResultCount = pWsiResult->GetSReviewResultCount(); for(int nSWsiIndx = 0; nSWsiIndx < nSWsiResultCount; nSWsiIndx++) { SReviewResult* pSWsiResult = pWsiResult->GetSReviewResult(nSWsiIndx); if(pSWsiResult == NULL) continue ; pSWsiResult->nModuleIdx = nModuleIdx; } } int CSequenceProcessor_CPJT::SetModuleStatusForReviewResult(VectorReviewResult* pVecReviewResult, int nModuleType) { if(pVecReviewResult->size() < 2) return 0; int nModuleStatusCount = m_pSP2P->ISP2P_GetModuleStatusCount(nModuleType); std::vector vecModuleIdx; std::vector vecReviewIdx; std::vector vecGantryIdx; std::vector vecHeaderIdx; //sortstruct CompareFcuntions(this); for(int nModuleIdx = 0; nModuleIdx < m_pSP2P->ISP2P_GetModuleStatusCount(); nModuleIdx++) { CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIdx); if(pModuleStatus == NULL) continue; if(pModuleStatus->GetModuleType() & nModuleType) { vecModuleIdx.push_back(nModuleIdx); } } // Get Gantry, Header Count for(int nIdx = 0; nIdx < vecModuleIdx.size(); nIdx++) { CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(vecModuleIdx.at(nIdx)); if(pModuleStatus == NULL) continue; //pModuleStatus->GetGantryIndex() if(!IntVectorFinder(vecGantryIdx, pModuleStatus->GetGantryIndex())) { vecGantryIdx.push_back(pModuleStatus->GetGantryIndex()); } if(!IntVectorFinder(vecHeaderIdx, pModuleStatus->GetHeaderIndex())) { vecHeaderIdx.push_back(pModuleStatus->GetHeaderIndex()); } } // Gantry Sorting std::sort(vecModuleIdx.begin(), vecModuleIdx.end(), CompareModuleStatusX(this)); //std::sort(vecModuleIdx.begin(), vecModuleIdx.end()); // Header Sorting for(int nIdx = 0; nIdx < nModuleStatusCount; nIdx += (int)vecHeaderIdx.size()) { std::vector vecTmp; for(int nCount = 0; nCount < vecHeaderIdx.size(); nCount++) { vecTmp.push_back(vecModuleIdx.at(nIdx + nCount)); } std::sort(vecTmp.begin(), vecTmp.end(), CompareModuleStatusY(this)); for(int nCount = 0; nCount < vecHeaderIdx.size(); nCount++) { vecModuleIdx.at(nIdx + nCount) = vecTmp.at(nCount); } } //pVecReviewResult->at(0).GetSReviewResult(0)->nUMOriginX; std::sort(pVecReviewResult->begin(), pVecReviewResult->end(), CompareReviewResultX(this)); for(int nIdx = 0; nIdx < nModuleStatusCount; nIdx += (int)vecHeaderIdx.size()) { VectorReviewResult vecTmp; for(int nCount = 0; nCount < vecHeaderIdx.size(); nCount++) { vecTmp.push_back(pVecReviewResult->at(nIdx + nCount)); } std::sort(vecTmp.begin(), vecTmp.end(), CompareReviewResultY(this)); for(int nCount = 0; nCount < vecHeaderIdx.size(); nCount++) { pVecReviewResult->at(nIdx + nCount) = vecTmp.at(nCount); } } for(int nIdx = 0; nIdx < nModuleStatusCount; nIdx++) { pVecReviewResult->at(nIdx).SetModuleIndex(vecModuleIdx.at(nIdx)); SetModuleStatusSReviewProcessor(&pVecReviewResult->at(nIdx), vecModuleIdx.at(nIdx)); } return 1; } int CSequenceProcessor_CPJT::SetModuleStatusForWsiResult(VectorReviewResult* pVecWsiResult, int nModuleType) { if(pVecWsiResult->size() < 2) return 0; int nModuleStatusCount = m_pSP2P->ISP2P_GetModuleStatusCount(nModuleType); std::vector vecModuleIdx; std::vector vecReviewIdx; std::vector vecGantryIdx; std::vector vecHeaderIdx; //sortstruct CompareFcuntions(this); for(int nModuleIdx = 0; nModuleIdx < m_pSP2P->ISP2P_GetModuleStatusCount(); nModuleIdx++) { CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIdx); if(pModuleStatus == NULL) continue; if(pModuleStatus->GetModuleType() & nModuleType) { vecModuleIdx.push_back(nModuleIdx); } } // Get Gantry, Header Count for(int nIdx = 0; nIdx < vecModuleIdx.size(); nIdx++) { CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(vecModuleIdx.at(nIdx)); if(pModuleStatus == NULL) continue; //pModuleStatus->GetGantryIndex() if(!IntVectorFinder(vecGantryIdx, pModuleStatus->GetGantryIndex())) { vecGantryIdx.push_back(pModuleStatus->GetGantryIndex()); } if(!IntVectorFinder(vecHeaderIdx, pModuleStatus->GetHeaderIndex())) { vecHeaderIdx.push_back(pModuleStatus->GetHeaderIndex()); } } // Gantry Sorting std::sort(vecModuleIdx.begin(), vecModuleIdx.end(), CompareModuleStatusX(this)); //std::sort(vecModuleIdx.begin(), vecModuleIdx.end()); // Header Sorting for(int nIdx = 0; nIdx < nModuleStatusCount; nIdx += (int)vecHeaderIdx.size()) { std::vector vecTmp; for(int nCount = 0; nCount < vecHeaderIdx.size(); nCount++) { vecTmp.push_back(vecModuleIdx.at(nIdx + nCount)); } std::sort(vecTmp.begin(), vecTmp.end(), CompareModuleStatusY(this)); for(int nCount = 0; nCount < vecHeaderIdx.size(); nCount++) { vecModuleIdx.at(nIdx + nCount) = vecTmp.at(nCount); } } //pVecReviewResult->at(0).GetSReviewResult(0)->nUMOriginX; std::sort(pVecWsiResult->begin(), pVecWsiResult->end(), CompareWsiResultX(this)); for(int nIdx = 0; nIdx < nModuleStatusCount; nIdx += (int)vecHeaderIdx.size()) { VectorReviewResult vecTmp; for(int nCount = 0; nCount < vecHeaderIdx.size(); nCount++) { vecTmp.push_back(pVecWsiResult->at(nIdx + nCount)); } std::sort(vecTmp.begin(), vecTmp.end(), CompareWsiResultY(this)); for(int nCount = 0; nCount < vecHeaderIdx.size(); nCount++) { pVecWsiResult->at(nIdx + nCount) = vecTmp.at(nCount); } } for(int nIdx = 0; nIdx < nModuleStatusCount; nIdx++) { pVecWsiResult->at(nIdx).SetModuleIndex(vecModuleIdx.at(nIdx)); SetModuleStatusSWsiProcessor(&pVecWsiResult->at(nIdx), vecModuleIdx.at(nIdx)); } return 1; } BOOL CSequenceProcessor_CPJT::CalculateReviewPathPlan(CDefectPicker* pDefectPicker, CGlassResult *pGlassResult) { CPathScheduler *pReviewScheduler = m_pSP2P->ISP2P_GetReviewScheduler(SchedulerType_Dual_Active_TSP); if (pGlassResult == NULL || pReviewScheduler == NULL || pDefectPicker == NULL) return FALSE; int nTotalModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(); int nReviewModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(ModuleType_Review); int nPointCount = pDefectPicker->GetPickingResultCount(); // point is zero? if (nPointCount == 0) return TRUE; // get current glass pos review cameras VectorPathData vecStartPathData; vecStartPathData.resize(nTotalModuleCount); for(int nIdx=0 ; nIdxGetModuleType() & ModuleType_Review) != ModuleType_Review) continue; const SMotorPosition* pMotorPosition = pModuleStatus->GetMotorPosition(); if (pMotorPosition == NULL) continue; SPathData ptStartPath; ptStartPath.nIndex = pModuleStatus->GetModuleIndex(); ptStartPath.nPosX = (LONG)(pMotorPosition->dGlassPosX * 1000); ptStartPath.nPosY = (LONG)(pMotorPosition->dGlassPosY * 1000); ptStartPath.bSelected = pModuleStatus->GetSelected(); if (pModuleStatus->GetGantryIndex() == GantryType_Left) { SPathData leftPath = vecStartPathData.at(0); leftPath.nIndex = ptStartPath.nIndex; leftPath.nPosX = ptStartPath.nPosX; leftPath.nPosY = ptStartPath.nPosY; leftPath.bSelected = ptStartPath.bSelected; vecStartPathData.erase(vecStartPathData.begin()); vecStartPathData.insert(vecStartPathData.begin(), leftPath); } else if (pModuleStatus->GetGantryIndex() == GantryType_Right) { SPathData rightPath = vecStartPathData.at(1); rightPath.nIndex = ptStartPath.nIndex; rightPath.nPosX = ptStartPath.nPosX; rightPath.nPosY = ptStartPath.nPosY; rightPath.bSelected = ptStartPath.bSelected; vecStartPathData.erase(vecStartPathData.end() - 1); vecStartPathData.insert(vecStartPathData.end(), rightPath); /* ptStartPath.nIndex = 1; ptStartPath.nPosX = (LONG)(3000 * 1000); ptStartPath.nPosY = (LONG)(1400 * 1000); ptStartPath.bSelected = pModuleStatus->GetSelected(); vecStartPathData.push_back(ptStartPath); */ } else { if (pModuleStatus->GetSelected()) { ptStartPath.nIndex = nIdx; ptStartPath.nPosX = (LONG)(pMotorPosition->dGlassPosX * 1000); ptStartPath.nPosY = (LONG)(pMotorPosition->dGlassPosY * 1000); //------------------------------------------------------------------------------------------------- // [2019/04/04 09:09:09 by jylee] related Center Coordinate if (ptStartPath.nPosX < 0) ptStartPath.nPosX = 1; if (ptStartPath.nPosY < 0) ptStartPath.nPosY = 1; // Move coordinates if center coordinate system if (pGlassResult->GetGlassCenterCoordinate()) { ptStartPath.nPosX = -(pGlassResult->GetGlassSizeX() / 2 - (LONG)(pMotorPosition->dGlassPosX * 1000)); ptStartPath.nPosY = (LONG)(pMotorPosition->dGlassPosY * 1000) - pGlassResult->GetGlassSizeY() / 2; } ptStartPath.bSelected = pModuleStatus->GetSelected(); vecStartPathData.push_back(ptStartPath); } } } // get review point result VectorPathData vecPathData; for (int nPosIdx = 0; nPosIdx < nPointCount; nPosIdx++) { const SReviewResult *pSReviewResult = pDefectPicker->GetPickingResult(nPosIdx); if (pSReviewResult == NULL) continue; SPathData pathData(pSReviewResult->nUMOriginX, pSReviewResult->nUMOriginY, pSReviewResult->nResultIdx); vecPathData.push_back(pathData); } // calculate path int nSchedulingCount = 0; int type = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->GetSingleGantryPath(); pReviewScheduler->GetPathSchedulerParam()->SetSelectModuleType(type); nSchedulingCount = pReviewScheduler->PathScheduling(vecPathData, vecStartPathData); if (nSchedulingCount>0) { m_pSP2P->ISP2P_DisplayMessage(_T("[ReviewScheduler] CalculatePath")); for(int nModuleIdx=0; nModuleIdxGetPathSchedulerResultCount(); nSIdx++) { pScheduleResult = pReviewScheduler->GetPathSchedulerResult(nSIdx); if (pScheduleResult == NULL) continue; if (pScheduleResult->GetModuleIndex() == nModuleIdx) break; else pScheduleResult = NULL; } if (pScheduleResult == NULL) continue; // add review result pGlassResult->AddReviewResult(CReviewResult(nModuleIdx)); // get review result CReviewResult *pReviewResult = pGlassResult->GetReviewResult(nModuleIdx); if (pReviewResult == NULL) return FALSE; // set review result ReviewScheduler_ResizeReviewResult(pScheduleResult, pReviewResult, pDefectPicker, pScheduleResult->GetPathSchedulerResultCount()); m_pSP2P->ISP2P_DisplayMessage(_T("[ReviewScheduler] %02d Schedule Move Time: %.3lf ms, Count : %d"), nModuleIdx, pScheduleResult->GetTotalSchedulerTime(), pScheduleResult->GetPathSchedulerResultCount()); // 181218 SJB, Collision XPosition Set pReviewResult->SetCollisionPostionX(pScheduleResult->GetCollisionPositionX()); // add review schedule result pGlassResult->AddReviewScheduleResult(*pScheduleResult); double dCollisionPosX = pReviewResult->GetCollisionPositionX(); double dCollisionPosY = 0.0; pGlassResult->SetCollisionXPos(nModuleIdx, dCollisionPosX); } } else { return FALSE; } return TRUE; } BOOL CSequenceProcessor_CPJT::CalculateReviewPathPlan(CDefectPicker* pDefectPicker, CGlassResult *pGlassResult, int nPlanIdx) { CPathScheduler *pReviewScheduler = m_pSP2P->ISP2P_GetReviewScheduler(SchedulerType_Dual_Active_TSP); if (pGlassResult == NULL || pReviewScheduler == NULL || pDefectPicker == NULL) return FALSE; int nTotalModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(); int nReviewModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(ModuleType_Review); int nPointCount = pDefectPicker->GetPickingResultCount(); // point is zero? if (nPointCount == 0) return TRUE; // get current glass pos review cameras VectorPathData vecStartPathData; vecStartPathData.resize(nTotalModuleCount); for (int nIdx = 0; nIdx < nTotalModuleCount; nIdx++) { const CModuleStatus *pModuleStatus = Module_GetModuleStatus(nIdx); if (pModuleStatus == NULL) continue; if ((pModuleStatus->GetModuleType() & ModuleType_Review) != ModuleType_Review) continue; const SMotorPosition* pMotorPosition = pModuleStatus->GetMotorPosition(); if (pMotorPosition == NULL) continue; SPathData ptStartPath; ptStartPath.nIndex = pModuleStatus->GetModuleIndex(); ptStartPath.nPosX = (LONG)(pMotorPosition->dGlassPosX * 1000); ptStartPath.nPosY = (LONG)(pMotorPosition->dGlassPosY * 1000); ptStartPath.bSelected = pModuleStatus->GetSelected(); if (pModuleStatus->GetGantryIndex() == GantryType_Left) { SPathData leftPath = vecStartPathData.at(0); leftPath.nIndex = ptStartPath.nIndex; leftPath.nPosX = ptStartPath.nPosX; leftPath.nPosY = ptStartPath.nPosY; leftPath.bSelected = ptStartPath.bSelected; vecStartPathData.erase(vecStartPathData.begin()); vecStartPathData.insert(vecStartPathData.begin(), leftPath); /* ptStartPath.nIndex = 0; ptStartPath.nPosX = (LONG)(1500 * 1000); // lmk here wait pos hard coding ptStartPath.nPosY = (LONG)(1400 * 1000); ptStartPath.bSelected = pModuleStatus->GetSelected(); vecStartPathData.push_back(ptStartPath); */ } else if (pModuleStatus->GetGantryIndex() == GantryType_Right) { SPathData rightPath = vecStartPathData.at(1); rightPath.nIndex = ptStartPath.nIndex; rightPath.nPosX = ptStartPath.nPosX; rightPath.nPosY = ptStartPath.nPosY; rightPath.bSelected = ptStartPath.bSelected; vecStartPathData.erase(vecStartPathData.end() - 1); vecStartPathData.insert(vecStartPathData.end(), rightPath); /* ptStartPath.nIndex = 1; ptStartPath.nPosX = (LONG)(3000 * 1000); ptStartPath.nPosY = (LONG)(1400 * 1000); ptStartPath.bSelected = pModuleStatus->GetSelected(); vecStartPathData.push_back(ptStartPath); */ } else { if (pModuleStatus->GetSelected()) { ptStartPath.nIndex = nIdx; ptStartPath.nPosX = (LONG)(pMotorPosition->dGlassPosX * 1000); ptStartPath.nPosY = (LONG)(pMotorPosition->dGlassPosY * 1000); //------------------------------------------------------------------------------------------------- // [2019/04/04 09:09:09 by jylee] related Center Coordinate if (ptStartPath.nPosX < 0) ptStartPath.nPosX = 1; if (ptStartPath.nPosY < 0) ptStartPath.nPosY = 1; // Move coordinates if center coordinate system if (pGlassResult->GetGlassCenterCoordinate()) { ptStartPath.nPosX = -(pGlassResult->GetGlassSizeX() / 2 - (LONG)(pMotorPosition->dGlassPosX * 1000)); ptStartPath.nPosY = (LONG)(pMotorPosition->dGlassPosY * 1000) - pGlassResult->GetGlassSizeY() / 2; } // If the previous plan is User, set the last point of the user as the starting position. if (nPlanIdx > 0) { // Get Recipe Plan Count and Check Doing plan CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if (pRsRcpReviewInfo) { CReviewResult* pReviewResult = pGlassResult->GetUserResult(0); // First module UserResult CRcpPlanInfo* pRcpPlanInfo = pRsRcpReviewInfo->GetRcpPlanInfo(nPlanIdx - 1); if (pRcpPlanInfo && pReviewResult && pRcpPlanInfo->m_nReviewType == CPJT_PlanUser) { int nUserResultCount = pReviewResult->GetSReviewResultCount(); SReviewResult* pSReviewResult = pReviewResult->GetSReviewResult(nUserResultCount - 1); if (pSReviewResult) // Set the entered coordinates. { ptStartPath.nPosX = int(pSReviewResult->nUMOriginX); ptStartPath.nPosY = int(pSReviewResult->nUMOriginY); } } } } //------------------------------------------------------------------------------------------------- ptStartPath.bSelected = pModuleStatus->GetSelected(); vecStartPathData.push_back(ptStartPath); } } } // get review point result VectorPathData vecPathData; for (int nPosIdx = 0; nPosIdx < nPointCount; nPosIdx++) { const SReviewResult *pSReviewResult = pDefectPicker->GetPickingResult(nPosIdx); if (pSReviewResult == NULL) continue; SPathData pathData(pSReviewResult->nUMOriginX, pSReviewResult->nUMOriginY, pSReviewResult->nResultIdx); vecPathData.push_back(pathData); } // calculate path int nSchedulingCount = 0; nSchedulingCount = pReviewScheduler->PathScheduling(vecPathData, vecStartPathData); if (nSchedulingCount > 0) { m_pSP2P->ISP2P_DisplayMessage(_T("[ReviewScheduler] CalculatePath")); for (int nModuleIdx = 0; nModuleIdx < nReviewModuleCount; nModuleIdx++) { CPathSchedulerResult *pScheduleResult = NULL; for (int nSIdx = 0; nSIdx < pReviewScheduler->GetPathSchedulerResultCount(); nSIdx++) { pScheduleResult = pReviewScheduler->GetPathSchedulerResult(nSIdx); if (pScheduleResult == NULL) continue; if (pScheduleResult->GetModuleIndex() == nModuleIdx) break; else pScheduleResult = NULL; } if (pScheduleResult == NULL) continue; // add review result pGlassResult->AddReviewResult(CReviewResult(nModuleIdx)); // get review result CReviewResult *pReviewResult = pGlassResult->GetReviewResult(nModuleIdx); if (pReviewResult == NULL) return FALSE; // set review result ReviewScheduler_ResizeReviewResult(pScheduleResult, pReviewResult, pDefectPicker, pScheduleResult->GetPathSchedulerResultCount()); m_pSP2P->ISP2P_DisplayMessage(_T("[ReviewScheduler] %02d Schedule Move Time: %.3lf ms, Count : %d"), nModuleIdx, pScheduleResult->GetTotalSchedulerTime(), pScheduleResult->GetPathSchedulerResultCount()); // 181218 SJB, Collision XPosition Set pReviewResult->SetCollisionPostionX(pScheduleResult->GetCollisionPositionX()); // add review schedule result pGlassResult->AddReviewScheduleResult(*pScheduleResult); // [2019/03/04 17:56:58 by jylee] related Change csv filepath, filename /* CString strFilename = _T(""); strFilename.Format(_T("c:\\%d_module_review_path.csv"), nModuleIdx); */ /*CString strFilename = _T(""); CString strRawFileName = _T(""); CString strTempFileName = _T(""); strRawFileName = pGlassResult->m_strAOIRawFileName; strTempFileName = strRawFileName.Mid(0, strRawFileName.GetLength() - 4); if (pGlassResult->m_strResultDate.GetLength() > 0) strFilename.Format(_T("D:\\ResultData\\RAWBackup\\%s\\%s_%d_module_review_path.csv"), pGlassResult->m_strResultDate, strTempFileName, nModuleIdx); else strFilename.Format(_T("D:\\ResultData\\RAWBackup\\%s_%d_module_review_path.csv"), strTempFileName, nModuleIdx); CPathSchedulerResult::SaveResult(strFilename, *pScheduleResult);*/ double dCollisionPosX = pReviewResult->GetCollisionPositionX(); double dCollisionPosY = 0.0; pGlassResult->SetCollisionXPos(nModuleIdx, dCollisionPosX); } } else { return FALSE; } return TRUE; } BOOL CSequenceProcessor_CPJT::CalculateUserPathPlan(CPrioritySorter* pPrioritySorter, CGlassResult *pGlassResult) { CPathScheduler *pReviewScheduler = m_pSP2P->ISP2P_GetReviewScheduler(SchedulerType_Dual_Active_TSP); //CPathScheduler *pReviewScheduler = m_pSP2P->ISP2P_GetReviewScheduler(); if (pGlassResult==NULL || pReviewScheduler==NULL || pPrioritySorter==NULL) return FALSE; int nTotalModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(); int nReviewModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(ModuleType_Review); int nPointCount = pPrioritySorter->GetSortingResultUserCount(); // point is zero? if (nPointCount==0) return TRUE; // get current glass pos review cameras VectorPathData vecStartPathData; vecStartPathData.resize(nTotalModuleCount); for(int nIdx=0 ; nIdxGetModuleType() & ModuleType_Review) != ModuleType_Review) { continue; } const SMotorPosition* pMotorPosition = pModuleStatus->GetMotorPosition(); if (pMotorPosition==NULL) continue; SPathData ptStartPath; //ptStartPath.nIndex = nIdx; // module index ptStartPath.nIndex = pModuleStatus->GetModuleIndex(); ptStartPath.nPosX = (LONG)(pMotorPosition->dGlassPosX * 1000); ptStartPath.nPosY = (LONG)(pMotorPosition->dGlassPosY * 1000); ptStartPath.bSelected = pModuleStatus->GetSelected(); if (pModuleStatus->GetGantryIndex() == GantryType_Left) { SPathData leftPath = vecStartPathData.at(0); leftPath.nIndex = ptStartPath.nIndex; leftPath.nPosX = ptStartPath.nPosX; leftPath.nPosY = ptStartPath.nPosY; leftPath.bSelected = ptStartPath.bSelected; vecStartPathData.erase(vecStartPathData.begin()); vecStartPathData.insert(vecStartPathData.begin(), leftPath); } else if (pModuleStatus->GetGantryIndex() == GantryType_Right) { SPathData rightPath = vecStartPathData.at(1); rightPath.nIndex = ptStartPath.nIndex; rightPath.nPosX = ptStartPath.nPosX; rightPath.nPosY = ptStartPath.nPosY; rightPath.bSelected = ptStartPath.bSelected; vecStartPathData.erase(vecStartPathData.end() - 1); vecStartPathData.insert(vecStartPathData.end(), rightPath); /* ptStartPath.nIndex = 1; ptStartPath.nPosX = (LONG)(3000 * 1000); ptStartPath.nPosY = (LONG)(1400 * 1000); ptStartPath.bSelected = pModuleStatus->GetSelected(); vecStartPathData.push_back(ptStartPath); */ } else { if (pModuleStatus->GetSelected()) { ptStartPath.nIndex = nIdx; ptStartPath.nPosX = (LONG)(pMotorPosition->dGlassPosX * 1000); ptStartPath.nPosY = (LONG)(pMotorPosition->dGlassPosY * 1000); //------------------------------------------------------------------------------------------------- // [2019/04/04 09:09:09 by jylee] related Center Coordinate if (ptStartPath.nPosX < 0) ptStartPath.nPosX = 1; if (ptStartPath.nPosY < 0) ptStartPath.nPosY = 1; // Move coordinates if center coordinate system if (pGlassResult->GetGlassCenterCoordinate()) { ptStartPath.nPosX = -(pGlassResult->GetGlassSizeX() / 2 - (LONG)(pMotorPosition->dGlassPosX * 1000)); ptStartPath.nPosY = (LONG)(pMotorPosition->dGlassPosY * 1000) - pGlassResult->GetGlassSizeY() / 2; } ptStartPath.bSelected = pModuleStatus->GetSelected(); vecStartPathData.push_back(ptStartPath); } } } const CSystemInfo *pSystemInfo = m_pSP2P->ISP2P_System_GetSystemInfo(); int nMachine = pSystemInfo->m_nMachineType; const CModuleStatus *pModuleStatus = Module_GetModuleStatus(0); const SCameraControl *pCameraControl = pModuleStatus->GetCameraControl(); const SMagnificInfo *pModuleMag = pModuleStatus->GetMagnificInfo(pCameraControl->nZoomLevel); int nPositionX; int nPositionY; // get user point result VectorPathData vecPathData; for (int nPosIdx=0; nPosIdxGetSortingResultUser(nPosIdx); if (pSReviewResult==NULL) continue; nPositionX = pSReviewResult->nUMOriginX; nPositionY = pSReviewResult->nUMOriginY; SPathData pathData( nPositionX,nPositionY,pSReviewResult->nResultIdx); vecPathData.push_back(pathData); } // calculate path int nSchedulingCount = 0; int type = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->GetSingleGantryPath(); pReviewScheduler->GetPathSchedulerParam()->SetSelectModuleType(type); // calculate shortest path if (pReviewScheduler->PathScheduling(vecPathData, vecStartPathData)>0) { m_pSP2P->ISP2P_DisplayMessage(_T("[ReviewScheduler] CalculatePath")); for(int nModuleIdx=0; nModuleIdxGetPathSchedulerResult(nModuleIdx); if (pScheduleResult==NULL) continue; /*for (int nSIdx = 0; nSIdx < pScheduleResult->GetPathSchedulerResultCount(); nSIdx++) { pScheduleResult = pReviewScheduler->GetPathSchedulerResult(nSIdx); if (pScheduleResult == NULL) continue; if (pScheduleResult->GetModuleIndex() == nModuleIdx) break; else pScheduleResult = NULL; }*/ if (pScheduleResult == NULL) continue; // add user result pGlassResult->AddUserResult(CReviewResult(nModuleIdx)); // get user result CReviewResult *pReviewResult = pGlassResult->GetUserResult(nModuleIdx); if(pReviewResult == NULL) return FALSE; // get sreviewresult ReviewScheduler_ResizeUserResult(pScheduleResult, pReviewResult, pPrioritySorter, pScheduleResult->GetPathSchedulerResultCount()); // add user schedule result { CakAOISharedSystem* pAOIShared = CReviewInterface::GetInstance(); //20191017 if (pAOIShared != NULL) { pProtocolData =pAOIShared->getReviewProtocol(); if (pProtocolData != NULL) { int nStIndex = pProtocolData->m_ModuleData[nModuleIdx].m_nPlanDefectCount; pProtocolData->m_ModuleData[nModuleIdx].m_nPlanDefectCount += pScheduleResult->GetPathSchedulerResultCount(); SSchedulerResult *pNode; for (int i=0;iGetPathSchedulerResultCount();i++) { pNode = pScheduleResult->GetPathSchedulerResult(i); pProtocolData->SetPlanReviewPos(nModuleIdx,nStIndex+i, int(pNode->dPositionX*1000), int(pNode->dPositionY*1000)); } } } } // 181218 SJB, Collision XPosition Set pReviewResult->SetCollisionPostionX(pScheduleResult->GetCollisionPositionX()); // add review schedule result //pGlassResult->AddReviewScheduleResult(*pScheduleResult); pGlassResult->AddUserScheduleResult(*pScheduleResult); double dCollisionPosX = pReviewResult->GetCollisionPositionX(); double dCollisionPosY = 0.0; pGlassResult->SetCollisionXPos(nModuleIdx, dCollisionPosX); // CString strFilename = _T(""); // strFilename.Format(_T("c:\\%d_module_user_path.csv"), nModuleIdx); // CPathSchedulerResult::SaveResult(strFilename, *pScheduleResult); } } else { return FALSE; } return TRUE; } BOOL CSequenceProcessor_CPJT::CalculateWsiPathPlan(CDefectPicker* pDefectPicker, CGlassResult *pGlassResult) { CPathScheduler *pReviewScheduler = m_pSP2P->ISP2P_GetReviewScheduler(); if (pGlassResult==NULL || pReviewScheduler==NULL || pDefectPicker==NULL) return FALSE; int nTotalModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(); int nReviewModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(ModuleType_Wsi); int nPointCount = pDefectPicker->GetPickingResultWsiCount(); // point is zero? if (nPointCount==0) return TRUE; // get current glass pos review cameras VectorPathData vecStartPathData; for(int nIdx=0 ; nIdxGetModuleType() & ModuleType_Wsi) != ModuleType_Wsi) { continue; } const SMotorPosition* pMotorPosition = pModuleStatus->GetMotorPosition(); if (pMotorPosition==NULL) continue; SPathData ptStartPath; ptStartPath.nIndex = nIdx; // module index ptStartPath.nPosX = (LONG)(pMotorPosition->dGlassPosX * 1000); ptStartPath.nPosY = (LONG)(pMotorPosition->dGlassPosY * 1000); vecStartPathData.push_back(ptStartPath); if (pModuleStatus->GetGantryIndex() == GantryType_Left) { SPathData leftPath = vecStartPathData.at(0); leftPath.nIndex = ptStartPath.nIndex; leftPath.nPosX = ptStartPath.nPosX; leftPath.nPosY = ptStartPath.nPosY; leftPath.bSelected = ptStartPath.bSelected; vecStartPathData.erase(vecStartPathData.begin()); vecStartPathData.insert(vecStartPathData.begin(), leftPath); } else if (pModuleStatus->GetGantryIndex() == GantryType_Right) { SPathData rightPath = vecStartPathData.at(1); rightPath.nIndex = ptStartPath.nIndex; rightPath.nPosX = ptStartPath.nPosX; rightPath.nPosY = ptStartPath.nPosY; rightPath.bSelected = ptStartPath.bSelected; vecStartPathData.erase(vecStartPathData.end() - 1); vecStartPathData.insert(vecStartPathData.end(), rightPath); } else { if (pModuleStatus->GetSelected()) { ptStartPath.nIndex = nIdx; ptStartPath.nPosX = (LONG)(pMotorPosition->dGlassPosX * 1000); ptStartPath.nPosY = (LONG)(pMotorPosition->dGlassPosY * 1000); //------------------------------------------------------------------------------------------------- // [2019/04/04 09:09:09 by jylee] related Center Coordinate if (ptStartPath.nPosX < 0) ptStartPath.nPosX = 1; if (ptStartPath.nPosY < 0) ptStartPath.nPosY = 1; // Move coordinates if center coordinate system if (pGlassResult->GetGlassCenterCoordinate()) { ptStartPath.nPosX = -(pGlassResult->GetGlassSizeX() / 2 - (LONG)(pMotorPosition->dGlassPosX * 1000)); ptStartPath.nPosY = (LONG)(pMotorPosition->dGlassPosY * 1000) - pGlassResult->GetGlassSizeY() / 2; } ptStartPath.bSelected = pModuleStatus->GetSelected(); vecStartPathData.push_back(ptStartPath); } } } // get wsi point result VectorPathData vecPathData; for (int nPosIdx=0; nPosIdxGetPickingResultWsi(nPosIdx); if (pSWsiResult==NULL) continue; SPathData pathData(pSWsiResult->nUMOriginX, pSWsiResult->nUMOriginY, pSWsiResult->nResultIdx); vecPathData.push_back(pathData); } // calculate path int nSchedulingCount = 0; int type = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->GetSingleGantryPath(); pReviewScheduler->GetPathSchedulerParam()->SetSelectModuleType(type); nSchedulingCount = pReviewScheduler->PathScheduling(vecPathData, vecStartPathData); if (nSchedulingCount>0) { m_pSP2P->ISP2P_DisplayMessage(_T("[ReviewScheduler] CalculatePath")); for(int nModuleIdx=0; nModuleIdxGetPathSchedulerResultCount(); nSIdx++) { pScheduleResult = pReviewScheduler->GetPathSchedulerResult(nSIdx); if (pScheduleResult == NULL) continue; if (pScheduleResult->GetModuleIndex() == nModuleIdx) break; else pScheduleResult = NULL; } if (pScheduleResult == NULL) continue; // add wsi result pGlassResult->AddWsiResult(CReviewResult(nModuleIdx)); // get wsi result CReviewResult *pWsiResult = pGlassResult->GetWsiResult(nModuleIdx); if(pWsiResult == NULL) return FALSE; m_pSP2P->ISP2P_DisplayMessage(_T("[ReviewScheduler] %02d Schedule Move Time: %.3lf ms, Count : %d"), nModuleIdx, pScheduleResult->GetTotalSchedulerTime(), pScheduleResult->GetPathSchedulerResultCount()); // 181218 SJB, Collision XPosition Set pWsiResult->SetCollisionPostionX(pScheduleResult->GetCollisionPositionX()); // get swsiresult ReviewScheduler_ResizeWsiResult(pScheduleResult, pWsiResult, pDefectPicker, pScheduleResult->GetPathSchedulerResultCount()); // add wsi schedule result pGlassResult->AddWsiScheduleResult(*pScheduleResult); double dCollisionPosX = pWsiResult->GetCollisionPositionX(); double dCollisionPosY = 0.0; pGlassResult->SetCollisionXPos(nModuleIdx, dCollisionPosX); } } else { return FALSE; } return TRUE; } BOOL CSequenceProcessor_CPJT::CalculateReflowPathPlan( CPrioritySorter* pPrioritySorter, CGlassResult *pGlassResult ) { CPathScheduler *pReviewScheduler = m_pSP2P->ISP2P_GetReviewScheduler(); if (pGlassResult==NULL || pReviewScheduler==NULL || pPrioritySorter==NULL) return FALSE; int nTotalModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(); int nReviewModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(ModuleType_Review); int nPointCount = pPrioritySorter->GetSortingResultReflowCount(); // point is zero? if (nPointCount==0) return TRUE; CRsRcpReviewInfo *pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if (pRsRcpReviewInfo == NULL) { return -1; } // get current glass pos review cameras VectorPathData vecStartPathData; for(int nIdx=0 ; nIdxGetModuleType() & ModuleType_Review) != ModuleType_Review) { continue; } const SMotorPosition* pMotorPosition = pModuleStatus->GetMotorPosition(); if (pMotorPosition==NULL) continue; SPathData ptStartPath; ptStartPath.nIndex = nIdx; // module index ptStartPath.nPosX = (LONG)(pMotorPosition->dGlassPosX * 1000); ptStartPath.nPosY = (LONG)(pMotorPosition->dGlassPosY * 1000); vecStartPathData.push_back(ptStartPath); } // get user point result VectorPathData vecPathData; for (int nPosIdx=0; nPosIdxGetSortingResultReflow(nPosIdx); if (pSReviewResult==NULL) continue; SPathData pathData(pSReviewResult->nUMOriginX, pSReviewResult->nUMOriginY, pSReviewResult->nResultIdx); vecPathData.push_back(pathData); } // calculate shortest path if (pReviewScheduler->PathScheduling(vecPathData, vecStartPathData)>0) { m_pSP2P->ISP2P_DisplayMessage(_T("[ReviewScheduler] CalculatePath")); for(int nModuleIdx=0; nModuleIdxGetPathSchedulerResult(nModuleIdx); if (pScheduleResult==NULL) continue; // add reflow result pGlassResult->AddReflowResult(CReviewResult(nModuleIdx)); // get user result CReviewResult *pReviewResult = pGlassResult->GetReflowResult(nModuleIdx); if(pReviewResult == NULL) return FALSE; // get sreview result ReviewScheduler_ResizeReflowResult(pScheduleResult, pReviewResult, pPrioritySorter, pScheduleResult->GetPathSchedulerResultCount()); // add user schedule result pGlassResult->AddReflowScheduleRedult(*pScheduleResult); // CString strFilename = _T(""); // strFilename.Format(_T("c:\\%d_module_reflow_path.csv"), nModuleIdx); // CPathSchedulerResult::SaveResult(strFilename, *pScheduleResult); } } else { return FALSE; } return TRUE; } void CSequenceProcessor_CPJT::GetAxisDirection(int nOrgGlass, int nOrgRecipe, int &nDirX, int& nDirY) { nDirX = 1; // same dir if ( (nOrgGlass==GlassOriginDir_LeftTop || nOrgGlass==GlassOriginDir_LeftBottom) && (nOrgRecipe==GlassOriginDir_LeftTop || nOrgRecipe==GlassOriginDir_LeftBottom) ) { nDirX = 1; } else if ( (nOrgGlass==GlassOriginDir_RightTop || nOrgGlass==GlassOriginDir_RightBottom) && (nOrgRecipe==GlassOriginDir_RightTop || nOrgRecipe==GlassOriginDir_RightBottom) ) { nDirX = 1; } else { nDirX = -1; } nDirY = 1; // same dir if ( (nOrgGlass==GlassOriginDir_LeftTop || nOrgGlass==GlassOriginDir_RightTop) && (nOrgRecipe==GlassOriginDir_LeftTop || nOrgRecipe==GlassOriginDir_RightTop) ) { nDirY = 1; } else if ( (nOrgGlass==GlassOriginDir_LeftBottom || nOrgGlass==GlassOriginDir_RightBottom) && (nOrgRecipe==GlassOriginDir_LeftBottom || nOrgRecipe==GlassOriginDir_RightBottom) ) { nDirY = 1; } else { nDirY = -1; } } void CSequenceProcessor_CPJT::GetMeasureModuleIndex(int nDirX, int nDirY, int& nModuleIdx) { if (nDirX==-1 && nDirY==-1) { switch(nModuleIdx) { case 0: nModuleIdx = 3; break; case 1: nModuleIdx = 2; break; case 2: nModuleIdx = 1; break; case 3: nModuleIdx = 0; break; } } else if (nDirX==-1) { switch(nModuleIdx) { case 0: nModuleIdx = 2; break; case 1: nModuleIdx = 3; break; case 2: nModuleIdx = 0; break; case 3: nModuleIdx = 1; break; } } else if (nDirY==-1) { switch(nModuleIdx) { case 0: nModuleIdx = 1; break; case 1: nModuleIdx = 0; break; case 2: nModuleIdx = 3; break; case 3: nModuleIdx = 2; break; } } } BOOL CSequenceProcessor_CPJT::CalculateMeasurePathPlan(CPrioritySorter* pPrioritySorter, CGlassResult *pGlassResult) { // CMeasureScheduler *pMeasureScheduler = m_pSP2P->ISP2P_GetMeasureScheduler(); CRsRcpMeasureInfo* pRsRcpMeasureInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpMeasureInfo(); if (pGlassResult==NULL || pPrioritySorter==NULL || pRsRcpMeasureInfo==NULL) return FALSE; int nPointCount = pPrioritySorter->GetSortingResultMeasureCount(); if (nPointCount<1) return TRUE; // add measure result int nSystemModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(ModuleType_Measure); int nRecipeModuleCount = pRsRcpMeasureInfo->GetModuleCount(); int nResultCount = pRsRcpMeasureInfo->GetResultCount(); if (nSystemModuleCount!=nRecipeModuleCount) return FALSE; // add measure result to glass result for (int nModuleIdx=0; nModuleIdxAddMeasureResult(CReviewResult(nModuleIdx)); CReviewResult *pReviewResult = pGlassResult->GetMeasureResult(nModuleIdx); pReviewResult->ResizeReviewResult(nResultCount); } // add measure point to measure result int nGlassDir = pGlassResult->GetOriginDir(); int nRecipeDir = pRsRcpMeasureInfo->GetGlassOriginDir(); int nAxisXDir = 1; int nAxisYDir = 1; GetAxisDirection(nGlassDir, nRecipeDir, nAxisXDir, nAxisYDir); for (int nPointIdx=0; nPointIdxGetSortingResultMeasure(nPointIdx); if (pSourceResult==NULL) continue; int nModuleIdx = pSourceResult->nModuleIdx; // change module index from axis direction GetMeasureModuleIndex(nAxisXDir, nAxisYDir, nModuleIdx); SReviewResult *pTargetResult = pGlassResult->GetSMeasureResult(nModuleIdx, pSourceResult->nResultIdx); if (pTargetResult==NULL) continue; // copy *pTargetResult = *pSourceResult; // add recipe info CModuleStatus *pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIdx); if (pModuleStatus==NULL) continue; // get zoom info int nZoomIdx = GetRealMagnification(nModuleIdx, pTargetResult->nZoomIdx); SMagnificInfo *pMagnificInfo = pModuleStatus->GetMagnificInfo(nZoomIdx); SCameraInfo *pCameraInfo = pModuleStatus->GetCameraInfo(0); if (pMagnificInfo==NULL || pCameraInfo==NULL) continue; // set info pTargetResult->nZoomIdx = nZoomIdx; pTargetResult->dMagnification = pMagnificInfo->dMagnification; pTargetResult->dMeasureResolution = pCameraInfo->dResolution / pTargetResult->dMagnification; pTargetResult->bDigitalZoom = FALSE; } return TRUE; } BOOL CSequenceProcessor_CPJT::CalculateWsiMultiShotPathPlan(CDefectPicker* pDefectPicker, CGlassResult *pGlassResult) { CPathScheduler *pReviewScheduler = m_pSP2P->ISP2P_GetReviewScheduler(); if (pGlassResult == NULL || pReviewScheduler == NULL || pDefectPicker == NULL) return FALSE; int nTotalModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(); int nReviewModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(ModuleType_Wsi); int nPointCount = pDefectPicker->GetPickingResultWsiMultiShotCount(); // point is zero? if (nPointCount == 0) return TRUE; // get current glass pos review cameras VectorPathData vecStartPathData; for (int nIdx = 0; nIdx < nTotalModuleCount; nIdx++) { const CModuleStatus *pModuleStatus = Module_GetModuleStatus(nIdx); if (pModuleStatus == NULL) continue; if ((pModuleStatus->GetModuleType() & ModuleType_Wsi) != ModuleType_Wsi) { continue; } const SMotorPosition* pMotorPosition = pModuleStatus->GetMotorPosition(); if (pMotorPosition == NULL) continue; SPathData ptStartPath; ptStartPath.nIndex = nIdx; // module index ptStartPath.nPosX = (LONG)(pMotorPosition->dGlassPosX * 1000); ptStartPath.nPosY = (LONG)(pMotorPosition->dGlassPosY * 1000); vecStartPathData.push_back(ptStartPath); if (pModuleStatus->GetGantryIndex() == GantryType_Left) { SPathData leftPath = vecStartPathData.at(0); leftPath.nIndex = ptStartPath.nIndex; leftPath.nPosX = ptStartPath.nPosX; leftPath.nPosY = ptStartPath.nPosY; leftPath.bSelected = ptStartPath.bSelected; vecStartPathData.erase(vecStartPathData.begin()); vecStartPathData.insert(vecStartPathData.begin(), leftPath); } else if (pModuleStatus->GetGantryIndex() == GantryType_Right) { SPathData rightPath = vecStartPathData.at(1); rightPath.nIndex = ptStartPath.nIndex; rightPath.nPosX = ptStartPath.nPosX; rightPath.nPosY = ptStartPath.nPosY; rightPath.bSelected = ptStartPath.bSelected; vecStartPathData.erase(vecStartPathData.end() - 1); vecStartPathData.insert(vecStartPathData.end(), rightPath); /* ptStartPath.nIndex = 1; ptStartPath.nPosX = (LONG)(3000 * 1000); ptStartPath.nPosY = (LONG)(1400 * 1000); ptStartPath.bSelected = pModuleStatus->GetSelected(); vecStartPathData.push_back(ptStartPath); */ } else { if (pModuleStatus->GetSelected()) { ptStartPath.nIndex = nIdx; ptStartPath.nPosX = (LONG)(pMotorPosition->dGlassPosX * 1000); ptStartPath.nPosY = (LONG)(pMotorPosition->dGlassPosY * 1000); //------------------------------------------------------------------------------------------------- // [2019/04/04 09:09:09 by jylee] related Center Coordinate if (ptStartPath.nPosX < 0) ptStartPath.nPosX = 1; if (ptStartPath.nPosY < 0) ptStartPath.nPosY = 1; // Move coordinates if center coordinate system if (pGlassResult->GetGlassCenterCoordinate()) { ptStartPath.nPosX = -(pGlassResult->GetGlassSizeX() / 2 - (LONG)(pMotorPosition->dGlassPosX * 1000)); ptStartPath.nPosY = (LONG)(pMotorPosition->dGlassPosY * 1000) - pGlassResult->GetGlassSizeY() / 2; } ptStartPath.bSelected = pModuleStatus->GetSelected(); vecStartPathData.push_back(ptStartPath); } } } // get wsi point result VectorPathData vecPathData; for (int nPosIdx = 0; nPosIdx < nPointCount; nPosIdx++) { const SReviewResult *pSWsiResult = pDefectPicker->GetPickingResultWsiMultiShot(nPosIdx); if (pSWsiResult == NULL) continue; SPathData pathData(pSWsiResult->nUMOriginX, pSWsiResult->nUMOriginY, pSWsiResult->nResultIdx); vecPathData.push_back(pathData); } // calculate path int nSchedulingCount = 0; nSchedulingCount = pReviewScheduler->PathScheduling(vecPathData, vecStartPathData); if (nSchedulingCount > 0) { m_pSP2P->ISP2P_DisplayMessage(_T("[ReviewScheduler] CalculatePath")); for (int nModuleIdx = 0; nModuleIdx < nReviewModuleCount; nModuleIdx++) { CPathSchedulerResult *pScheduleResult = NULL; for (int nSIdx = 0; nSIdx < pReviewScheduler->GetPathSchedulerResultCount(); nSIdx++) { pScheduleResult = pReviewScheduler->GetPathSchedulerResult(nSIdx); if (pScheduleResult == NULL) continue; if (pScheduleResult->GetModuleIndex() == nModuleIdx) break; else pScheduleResult = NULL; } if (pScheduleResult == NULL) continue; // add wsi result pGlassResult->AddWsiMultiShotResult(CReviewResult(nModuleIdx)); // get wsi result CReviewResult *pWsiMultiShotResult = pGlassResult->GetWsiMultiShotResult(nModuleIdx); if (pWsiMultiShotResult == NULL) return FALSE; // 181218 SJB, Collision XPosition Set pWsiMultiShotResult->SetCollisionPostionX(pScheduleResult->GetCollisionPositionX()); // get swsiresult ReviewScheduler_ResizeWsiMultiShotResult(pScheduleResult, pWsiMultiShotResult, pDefectPicker, pScheduleResult->GetPathSchedulerResultCount()); m_pSP2P->ISP2P_DisplayMessage(_T("[ReviewScheduler] %02d Schedule Move Time: %.3lf ms, Count : %d"), nModuleIdx, pScheduleResult->GetTotalSchedulerTime(), pScheduleResult->GetPathSchedulerResultCount()); // add wsi schedule result pGlassResult->AddWsiMultiShotScheduleResult(*pScheduleResult); double dCollisionPosX = pWsiMultiShotResult->GetCollisionPositionX(); double dCollisionPosY = 0.0; pGlassResult->SetCollisionXPos(nModuleIdx, dCollisionPosX); } } else { return FALSE; } return TRUE; } BOOL CSequenceProcessor_CPJT::MotorMotionEnd() { BOOL bMotionEnd = FALSE; const CMotorControlInfo* pMotorInfo = m_pSP2P->ISP2P_System_GetMotorInfo(); if(pMotorInfo == NULL) return FALSE; CMotorControl* pMotorControl = m_pSP2P->ISP2P_GetMotorControl(); if(pMotorControl == NULL) return FALSE; while(!bMotionEnd) { int nGantryCount = pMotorInfo->GetMotorGantryAddrCount(); bMotionEnd = TRUE; for(int nGantryIdx = 0; nGantryIdx < nGantryCount; nGantryIdx++) { const CMotorGantryAddr* pMotorGantryAddr = pMotorInfo->GetMotorGantryAddr(nGantryIdx); if(pMotorGantryAddr == NULL) continue ; int nAxisCount = pMotorGantryAddr->GetMotorAxisAddrCount(); for(int nAxisIdx = 0; nAxisIdx < nAxisCount; nAxisIdx++) { const CMotorAxisAddr* pMotorAxisAddr = pMotorGantryAddr->GetMotorAxisAddr(nAxisIdx); if(pMotorAxisAddr == NULL) continue ; int nCheckAddrass = pMotorAxisAddr->m_nStatusAddr; long data = 0; pMotorControl->ReadAddressValue(nCheckAddrass, data); bMotionEnd = 1 & data; if(!bMotionEnd) break; } if(!bMotionEnd) break; } } g_pLog->DisplayMessage(_T("[Motor] Motion End!!")); return TRUE; } BOOL CSequenceProcessor_CPJT::AllChangeMagnification(int nZoomIdx, int nCmd, int nPlanMode) { CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult(); if(pGlassResult == NULL) return FALSE; CRsRcpReviewInfo* pRsRcpReviewInfo = NULL; CRsRcpMeasureInfo* pRsRcpMeasureInfo = NULL; switch(nPlanMode) { case CPJT_PlanReview: case CPJT_PlanUser: case CPJT_PlanWSI: pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); break; case CPJT_PlanReflow: pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); break; case CPJT_PlanMeasure: pRsRcpMeasureInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpMeasureInfo(); break; } if (nPlanMode!=CPJT_PlanMeasure && pRsRcpReviewInfo==NULL) return FALSE; if (nPlanMode==CPJT_PlanMeasure && pRsRcpMeasureInfo==NULL) return FALSE; int nModuleStatusCount = m_pSP2P->ISP2P_GetModuleStatusCount(); for(int nModuleIdx = 0; nModuleIdx < nModuleStatusCount; nModuleIdx++) { int nZoomIndex = -1; switch(nPlanMode) { case CPJT_PlanReview: { const CRcpAFMRecipeInfo* pRcpAFMRecipeInfo = pRsRcpReviewInfo->GetRcpAFMRecipeInfo(nModuleIdx); if(pRcpAFMRecipeInfo == NULL) { g_pLog->DisplayMessage(_T("[AllChangeMagnification] pRcpAFMRecipeInfo NULL Error !!")); } nZoomIndex = pRcpAFMRecipeInfo->GetZoomIndex(); break; } case CPJT_PlanUser: { const CRcpAFMRecipeInfo* pRcpAFMRecipeInfo = pRsRcpReviewInfo->GetRcpUserAFMRecipeInfo(nModuleIdx); if(pRcpAFMRecipeInfo == NULL) { g_pLog->DisplayMessage(_T("[AllChangeMagnification] pRcpAFMRecipeInfo NULL Error !!")); } nZoomIndex = pRcpAFMRecipeInfo->GetZoomIndex(); break; } case CPJT_PlanWSI: { const CRcpAFMRecipeInfo* pRcpAFMRecipeInfo = pRsRcpReviewInfo->GetRcpWsiAFMRecipeInfo(nModuleIdx); if(pRcpAFMRecipeInfo == NULL) { g_pLog->DisplayMessage(_T("[AllChangeMagnification] pRcpAFMRecipeInfo NULL Error !!")); } else { nZoomIndex = pRcpAFMRecipeInfo->GetZoomIndex(); } break; } break; case CPJT_PlanMeasure: { const CRcpMeasureInfo *pRcpMeasureInfo = pRsRcpMeasureInfo->GetRcpMeasureInfo(0); if(pRcpMeasureInfo == NULL) { g_pLog->DisplayMessage(_T("[AllChangeMagnification] pRcpAFMRecipeInfo NULL Error !!")); } if (pRsRcpMeasureInfo) { nZoomIndex = pRcpMeasureInfo->GetMagnificationIdx(); } break; } case CPJT_PlanReflow: { const CRcpAFMRecipeInfo* pRcpAFMRecipeInfo = pRsRcpReviewInfo->GetRcpUserAFMRecipeInfo(nModuleIdx); if(pRcpAFMRecipeInfo == NULL) { g_pLog->DisplayMessage(_T("[AllChangeMagnification] pRcpAFMRecipeInfo NULL Error !!")); } nZoomIndex = pRcpAFMRecipeInfo->GetZoomIndex(); break; } } int nRealMagIndex = -1; if(nCmd == ZoomLevel_Auto_CPJT) { nRealMagIndex = GetRealMagnification(nModuleIdx, nZoomIndex); } else { nRealMagIndex = nZoomIdx; } Revolver_SetRevolverLevel(nModuleIdx, nRealMagIndex); CString strRecipeName = *pGlassResult->GetPPID(); AFM_SetAFMRecipeName(nModuleIdx, strRecipeName, nRealMagIndex); } return TRUE; } BOOL CSequenceProcessor_CPJT::SetDelayTimeToMotor() { const CMotorControlInfo* pMotorInfo = m_pSP2P->ISP2P_System_GetMotorInfo(); if(pMotorInfo == NULL) return FALSE; CMotorControl* pMotorControl = m_pSP2P->ISP2P_GetMotorControl(); if(pMotorControl == NULL) return FALSE; if(!pMotorControl->WriteAddressValue(pMotorInfo->GetMotorCommonAddr()->m_nWsiDelayTimeAddr, (long)pMotorInfo->GetWsiDelayTime())) { return FALSE; } if(pMotorControl->WriteAddressValue(pMotorInfo->GetMotorCommonAddr()->m_nAfDelayTimeAddr, (long)pMotorInfo->GetAfDelayTime())) { return FALSE; } if(!pMotorControl->WriteAddressValue(pMotorInfo->GetMotorCommonAddr()->m_nImageDelayTimeAddr, (long)pMotorInfo->GetImageDelayTime())) { return FALSE; } return TRUE; } int CSequenceProcessor_CPJT::GetDirectionX(int nGlassDirection, int nMotorDirection) { if(nGlassDirection == GlassOriginDir_LeftTop || nGlassDirection == GlassOriginDir_LeftBottom) { if(nMotorDirection == MotorOriginDir_LeftTop || nMotorDirection == MotorOriginDir_LeftBottom) { return COORDINATE_DIRECTION_FORWARD; } else { return COORDINATE_DIRECTION_BACKWARD; } } if(nGlassDirection == GlassOriginDir_RightTop || nGlassDirection == GlassOriginDir_RightBottom) { if(nMotorDirection == MotorOriginDir_RightTop || nMotorDirection == MotorOriginDir_RightBottom) { return COORDINATE_DIRECTION_FORWARD; } else { return COORDINATE_DIRECTION_BACKWARD; } } return COORDINATE_DIRECTION_BACKWARD; } int CSequenceProcessor_CPJT::GetDirectionY(int nGlassDirection, int nMotorDirection) { if(nGlassDirection == GlassOriginDir_LeftTop || nGlassDirection == GlassOriginDir_RightTop) { if(nMotorDirection == MotorOriginDir_LeftTop || nMotorDirection == MotorOriginDir_RightTop) { return COORDINATE_DIRECTION_FORWARD; } else { return COORDINATE_DIRECTION_BACKWARD; } } if(nGlassDirection == GlassOriginDir_LeftBottom || nGlassDirection == GlassOriginDir_RightBottom) { if(nMotorDirection == MotorOriginDir_LeftBottom || nMotorDirection == MotorOriginDir_RightBottom) { return COORDINATE_DIRECTION_FORWARD; } else { return COORDINATE_DIRECTION_BACKWARD; } } return COORDINATE_DIRECTION_BACKWARD; } //CIM DV Data BOOL CSequenceProcessor_CPJT::SendDVDataToSignalControl() { CGlassResult *pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult(); if (pGlassResult==NULL) return FALSE; CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl(); if (pSignalControl==NULL) return FALSE; if (pSignalControl->IsConnected() == FALSE) return FALSE; const CSignalControlInfo* pSignalInfo = m_pSP2P->ISP2P_System_GetPCControlInfo(); if (pSignalInfo==NULL) return FALSE; const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if (pRsRcpReviewInfo==NULL) return FALSE; char DVData[5000]={}; int nSize = MakeDVData(pGlassResult, DVData); //pSignalControl->WritePacketData(_T("15100"), nSize, (short*)&DVData); g_pLog->DisplayMessage(_T("[SequenceProcessor] DVData writing succeeded. Addr: %s, size: %d"), PC_ADDR_DCOLL_DATA, nSize); return TRUE; } int CSequenceProcessor_CPJT::MakeDVData(CGlassResult *pGlassResult, char* pDVData, int nIndex) { g_pLog->DisplayMessage(_T("[SequenceProcessor] SendDVDataToSignalControl->MakeDVData IN.")); if (pGlassResult == NULL) return FALSE; const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if (pRsRcpReviewInfo == NULL) return FALSE; // Review const CRcpLightInfo *pReviewLightInfo = pRsRcpReviewInfo->GetRcpLightInfo(nIndex); // Review AFM const CRcpAFMRecipeInfo *pReviewAFMInfo = pRsRcpReviewInfo->GetRcpAFMRecipeInfo(nIndex); // Review Align Info const CAlignResult* pAlignResult = pGlassResult->GetAlignResult(); // Review Defect Info const CReviewResult* pReviewResult = pGlassResult->GetReviewResult(nIndex); // Review const CModuleStatus* pModuleStatus = Module_GetModuleStatus(nIndex); const SMagnificInfo* pSMagnificInfo = pModuleStatus->GetMagnificInfo(pReviewAFMInfo->GetZoomIndex()); CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl(); if (pSignalControl == NULL) return FALSE; if (pSignalControl->IsConnected() == FALSE) return FALSE; const SReviewResult* pSReviewResult = pGlassResult->GetSReviewResult(nIndex, 0); //int nReviewResultCount = min(_countof(DVDataPack.reviewDefectData), pGlassResult->GetSReviewResultCount(nIndex)); //int nReviewResultCount = pGlassResult->GetSReviewResultCount(nIndex); //int nWSIResultCount = pGlassResult->GetSWsiResultCount(nIndex); int nEqpID = m_pSP2P->ISP2P_System_GetSystemInfo()->m_nMachineType; int nReviewResultCount = 0; int nWSIResultCount = 0; int offset = 0; int nSize = 0; int nWritePacketDataLimitPlag = 0; ////////////////////////////////////////////////////////////////////////// // Write DVData Packet //_DVDataPack_B7_8ver DVDataPack; //**Review //INLINE : 10 //TFE-OFF : 20 //Hcut : 50 //LAMI : 5 //**WSI //10 /////////////////////////////////////////////////////////////////////////// //_DVDataPack_B7_8ver DVDataPack; //_DVDataPack_Hcut DVDataPackhcut; //_DVDataPack_TFEOFF DVDataPacktfeoff; __DVDataPack_C_PJT DVDataPack_CPJT; char DVData[1000] = { }; nReviewResultCount = 10; nSize = 1000; nWritePacketDataLimitPlag = 1; memset(&DVDataPack_CPJT, 0, sizeof(DVDataPack_CPJT)); STransferData* pTransferData = m_pSP2P->ISP2P_GetCurrentTransferData(); char SVData[4] = { }; int nRev_Cam1_Image_Contrast; //16144 int nRev_Cam2_Image_Contrast; //16146 int nRev_PC_HDD_CHECK; //16222 int nWSI1_PC_HDD_CHECK; int nWSI2_PC_HDD_CHECK; int nAlignResult00; int nAlignResult01; int nReviewVersion = 20201112; int nWSI00Version = 20201112; int nWSI01Version = 202011120; int nReviewAliveCamera00 = 0; int nReviewAliveCamera01 = 0; //foucs nRev_Cam1_Image_Contrast = m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast * 1000; nRev_Cam2_Image_Contrast = m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview01ImageContrast * 1000; //nRev_PC_HDD_CHECK = GetDiskUsage() * 1000; //nWSI1_PC_HDD_CHECK = nRev_PC_HDD_CHECK;//GetDiskUsage() * 1000; //nWSI2_PC_HDD_CHECK = nRev_PC_HDD_CHECK;//GetDiskUsage() * 1000; //nAlignResult = 1; //nAlignResult00 = pAlignResult->nFindAlign[0] * 1000; //nAlignResult01 = pAlignResult->nFindAlign[1] * 1000; //nAlignResult00 = pAlignResult->dFindScore[0]; //nAlignResult01 = pAlignResult->dFindScore[1]; CCameraControlAlign* pAlignCameraControl = m_pSP2P->ISP2P_GetAlignCameraControl(); if (pAlignCameraControl != NULL) { nAlignResult00 = pAlignCameraControl->GetCameraControl(0)->GetConnected() * 1000; nAlignResult01 = pAlignCameraControl->GetCameraControl(1)->GetConnected() * 1000; } else { nAlignResult00 = 0; nAlignResult01 = 0; } nReviewAliveCamera00 = ReviewCamera_GetReviewCameraControl(0)->GetConnected() * 1000; nReviewAliveCamera01 = ReviewCamera_GetReviewCameraControl(1)->GetConnected() * 1000; ULARGE_INTEGER avail, total, free; avail.QuadPart = 0L; total.QuadPart = 0L; free.QuadPart = 0L; DWORD dwDrive = GetLogicalDrives(); DWORD dwDriveCh = 0x0001; TCHAR DriveText[3] = { 0 }; for (TCHAR Drive = 'A'; Drive <= 'Z'; Drive++) { wsprintf(DriveText, TEXT("%C:"), Drive); UINT type = GetDriveType(DriveText); if ((dwDrive & dwDriveCh) && (type == DRIVE_REMOVABLE || type == DRIVE_FIXED || type == DRIVE_RAMDISK)) { ULARGE_INTEGER i64FreeBytesToCaller = { 0 }, i64TotalBytes = { 0 }, i64FreeBytes = { 0 }; BOOL bRsult = GetDiskFreeSpaceEx(DriveText, (PULARGE_INTEGER)&i64FreeBytesToCaller, (PULARGE_INTEGER)&i64TotalBytes, (PULARGE_INTEGER)&i64FreeBytes); if (bRsult) { float ra = 1.0f - (float)(int)(i64FreeBytes.QuadPart >> 20) / (float)(int)(i64TotalBytes.QuadPart >> 20); //tmpLog.Format(TEXT("%c: %I64d MB / %I64d MB(%d%%)\r\n"), Drive, i64FreeBytes.QuadPart >> 20, i64TotalBytes.QuadPart >> 20, (int)(ra * 100)); //m_strEditOutput += tmpLog; if (Drive == 'D') { nRev_PC_HDD_CHECK = (ra*100) * 1000; } if (Drive == 'W') { nWSI1_PC_HDD_CHECK= (ra * 100) * 1000; } if (Drive == 'Y') { nWSI2_PC_HDD_CHECK = (ra * 100) * 1000; } } } dwDriveCh <<= 1; } //sprintf(SVData, "%d", nRev_PC_HDD_CHECK); pSignalControl->WritePacketData(_T("16100"), sizeof(nAlignResult00), (short*)&nAlignResult00); pSignalControl->WritePacketData(_T("16104"), sizeof(nAlignResult01), (short*)&nAlignResult01); pSignalControl->WritePacketData(_T("16108"), sizeof(nReviewAliveCamera00), (short*)&nReviewAliveCamera00); pSignalControl->WritePacketData(_T("16112"), sizeof(nReviewAliveCamera01), (short*)&nReviewAliveCamera01); pSignalControl->WritePacketData(_T("16116"), sizeof(nRev_Cam1_Image_Contrast), (short*)&nRev_Cam1_Image_Contrast); pSignalControl->WritePacketData(_T("16120"), sizeof(nRev_Cam2_Image_Contrast), (short*)&nRev_Cam2_Image_Contrast); pSignalControl->WritePacketData(_T("16124"), sizeof(nRev_PC_HDD_CHECK), (short*)&nRev_PC_HDD_CHECK); pSignalControl->WritePacketData(_T("16128"), sizeof(nWSI1_PC_HDD_CHECK), (short*)&nWSI1_PC_HDD_CHECK); pSignalControl->WritePacketData(_T("16132"), sizeof(nWSI2_PC_HDD_CHECK), (short*)&nWSI2_PC_HDD_CHECK); pSignalControl->WritePacketData(_T("16136"), sizeof(nReviewVersion), (short*)&nReviewVersion); pSignalControl->WritePacketData(_T("16140"), sizeof(nWSI00Version), (short*)&nWSI00Version); pSignalControl->WritePacketData(_T("16144"), sizeof(nWSI01Version), (short*)&nWSI01Version); //CCHImageData pImageData; //CCHImageData pImageData2; //pImageData.LoadImageA("E:\\1.bmp"); //double av; //pImageData.SaveImage("E:\\2.bmp"); //CCHImageProcess::ImageConvert(&pImageData, &pImageData2, 1); //CCHImageProcess::ImageAverage(&pImageData2, av); g_pLog->DisplayMessage(_T("[SequenceProcessor] SendDVDataToSignalControl->MakeDVData OUT.")); // return nPackSize; return sizeof(DVDataPack_CPJT); /* for (int j = 0; j < pTransferData->strGlassID.GetLength(); j++) { if (pTransferData->strGlassID.GetAt(j) == NULL) { break; } DVDataPack_CPJT.H_PanelID[j] = pTransferData->strGlassID.GetAt(j); } for (int j = 0; j < pTransferData->strEGlassID.GetLength(); j++) { if (pTransferData->strEGlassID.GetAt(j) == NULL) { break; } DVDataPack_CPJT.E_PanelID[j] = pTransferData->strEGlassID.GetAt(j); } for (int j = 0; j < pTransferData->strProcessID.GetLength(); j++) { if (pTransferData->strProcessID.GetAt(j) == NULL) { break; } DVDataPack_CPJT.ProcessID[j] = pTransferData->strProcessID.GetAt(j); } for (int j = 0; j < pTransferData->strProductID.GetLength(); j++) { if (pTransferData->strProductID.GetAt(j) == NULL) { break; } DVDataPack_CPJT.ProdcutID[j] = pTransferData->strProductID.GetAt(j); } for (int j = 0; j < pTransferData->strStepID.GetLength(); j++) { if (pTransferData->strStepID.GetAt(j) == NULL) { break; } DVDataPack_CPJT.StepID[j] = pTransferData->strStepID.GetAt(j); } for (int j = 0; j < pTransferData->strBatchID.GetLength(); j++) { if (pTransferData->strBatchID.GetAt(j) == NULL) { break; } DVDataPack_CPJT.BATCHID[j] = pTransferData->strBatchID.GetAt(j); } for (int j = 0; j < pTransferData->strProdType.GetLength(); j++) { if (pTransferData->strProdType.GetAt(j) == NULL) { break; } DVDataPack_CPJT.PROD_TYPE[j] = pTransferData->strProdType.GetAt(j); } for (int j = 0; j < pTransferData->strProdKind.GetLength(); j++) { if (pTransferData->strProdKind.GetAt(j) == NULL) { break; } DVDataPack_CPJT.PROD_KIND[j] = pTransferData->strProdKind.GetAt(j); } for (int j = 0; j < pTransferData->strPPID.GetLength(); j++) { if (pTransferData->strPPID.GetAt(j) == NULL) { break; } DVDataPack_CPJT.PPID[j] = pTransferData->strPPID.GetAt(j); } for (int j = 0; j < pTransferData->strFlowID.GetLength(); j++) { if (pTransferData->strFlowID.GetAt(j) == NULL) { break; } DVDataPack_CPJT.FLOWID[j] = pTransferData->strFlowID.GetAt(j); } for (int j = 0; j < pTransferData->strPanelSize.GetLength(); j++) { if (pTransferData->strPanelSize.GetAt(j) == NULL) { break; } DVDataPack_CPJT.PANEL_SIZE[j] = pTransferData->strPanelSize.GetAt(j); } for (int j = 0; j < pTransferData->strGlassThickness.GetLength(); j++) { if (pTransferData->strGlassThickness.GetAt(j) == NULL) { break; } DVDataPack_CPJT.THICKNESS[j] = pTransferData->strGlassThickness.GetAt(j); } for (int j = 0; j < pTransferData->strCompCount.GetLength(); j++) { if (pTransferData->strCompCount.GetAt(j) == NULL) { break; } DVDataPack_CPJT.COMP_COUNT[j] = pTransferData->strCompCount.GetAt(j); } for (int j = 0; j < pTransferData->strPanelState.GetLength(); j++) { if (pTransferData->strPanelState.GetAt(j) == NULL) { break; } DVDataPack_CPJT.PANEL_STATE[j] = pTransferData->strPanelState.GetAt(j); } for (int j = 0; j < pTransferData->strReadingFlag.GetLength(); j++) { if (pTransferData->strReadingFlag.GetAt(j) == NULL) { break; } DVDataPack_CPJT.READING_FLAG[j] = pTransferData->strReadingFlag.GetAt(j); } for (int j = 0; j < pTransferData->strReadingFlag.GetLength(); j++) { if (pTransferData->strReadingFlag.GetAt(j) == NULL) { break; } DVDataPack_CPJT.READING_FLAG[j] = pTransferData->strReadingFlag.GetAt(j); } for (int j = 0; j < pTransferData->strInspectionFlag.GetLength(); j++) { if (pTransferData->strInspectionFlag.GetAt(j) == NULL) { break; } DVDataPack_CPJT.INS_FLAG[j] = pTransferData->strInspectionFlag.GetAt(j); } for (int j = 0; j < pTransferData->strPanelPosition.GetLength(); j++) { if (pTransferData->strPanelPosition.GetAt(j) == NULL) { break; } DVDataPack_CPJT.PANEL_POSITION[j] = pTransferData->strPanelPosition.GetAt(j); } for (int j = 0; j < pTransferData->strGlassJudgeCode.GetLength(); j++) { if (pTransferData->strGlassJudgeCode.GetAt(j) == NULL) { break; } DVDataPack_CPJT.JUDGEMENT[j] = pTransferData->strGlassJudgeCode.GetAt(j); } for (int j = 0; j < pTransferData->strGlassCode.GetLength(); j++) { if (pTransferData->strGlassCode.GetAt(j) == NULL) { break; } DVDataPack_CPJT.CODE[j] = pTransferData->strGlassCode.GetAt(j); } for (int j = 0; j < pTransferData->strFlowHistory.GetLength(); j++) { if (pTransferData->strFlowHistory.GetAt(j) == NULL) { break; } DVDataPack_CPJT.FLOW_HISTORY[j] = pTransferData->strFlowHistory.GetAt(j); } for (int j = 0; j < pTransferData->strUnIqueID.GetLength(); j++) { if (pTransferData->strUnIqueID.GetAt(j) == NULL) { break; } DVDataPack_CPJT.UNIQUEID[j] = pTransferData->strUnIqueID.GetAt(j); } for (int j = 0; j < pTransferData->strCount1.GetLength(); j++) { if (pTransferData->strCount1.GetAt(j) == NULL) { break; } DVDataPack_CPJT.COUNT1[j] = pTransferData->strCount1.GetAt(j); } for (int j = 0; j < pTransferData->strCount2.GetLength(); j++) { if (pTransferData->strCount2.GetAt(j) == NULL) { break; } DVDataPack_CPJT.COUNT2[j] = pTransferData->strCount2.GetAt(j); } for (int j = 0; j < pTransferData->strGlassGradeCode.GetLength(); j++) { if (pTransferData->strGlassGradeCode.GetAt(j) == NULL) { break; } DVDataPack_CPJT.GRADE[j] = pTransferData->strGlassGradeCode.GetAt(j); } for (int j = 0; j < pTransferData->strGlassGradeCode.GetLength(); j++) { if (pTransferData->strGlassGradeCode.GetAt(j) == NULL) { break; } DVDataPack_CPJT.GRADE[j] = pTransferData->strGlassGradeCode.GetAt(j); } for (int j = 0; j < pTransferData->strMultiUse.GetLength(); j++) { if (pTransferData->strMultiUse.GetAt(j) == NULL) { break; } DVDataPack_CPJT.MULTI_USE[j] = pTransferData->strMultiUse.GetAt(j); } for (int j = 0; j < pTransferData->strGlassDataBigSig.GetLength(); j++) { if (pTransferData->strGlassDataBigSig.GetAt(j) == NULL) { break; } DVDataPack_CPJT.GlassDataBitSignal[j] = pTransferData->strGlassDataBigSig.GetAt(j); } for (int j = 0; j < pTransferData->strPairID.GetLength(); j++) { if (pTransferData->strPairID.GetAt(j) == NULL) { break; } DVDataPack_CPJT.PAIR_H_PANELID[j] = pTransferData->strPairID.GetAt(j); } for (int j = 0; j < pTransferData->strEPairID.GetLength(); j++) { if (pTransferData->strEPairID.GetAt(j) == NULL) { break; } DVDataPack_CPJT.PAIR_E_PANELID[j] = pTransferData->strEPairID.GetAt(j); } for (int j = 0; j < pTransferData->strPairProductID.GetLength(); j++) { if (pTransferData->strPairProductID.GetAt(j) == NULL) { break; } DVDataPack_CPJT.PAIR_PRODUCTID[j] = pTransferData->strPairProductID.GetAt(j); } for (int j = 0; j < pTransferData->strPairGrade.GetLength(); j++) { if (pTransferData->strPairGrade.GetAt(j) == NULL) { break; } DVDataPack_CPJT.PAIR_GRADE[j] = pTransferData->strPairGrade.GetAt(j); } for (int j = 0; j < pTransferData->strFlowGroup.GetLength(); j++) { if (pTransferData->strFlowGroup.GetAt(j) == NULL) { break; } DVDataPack_CPJT.FLOW_GROUP[j] = pTransferData->strFlowGroup.GetAt(j); } for (int j = 0; j < pTransferData->strDBR_RECIPE.GetLength(); j++) { if (pTransferData->strDBR_RECIPE.GetAt(j) == NULL) { break; } DVDataPack_CPJT.DBR_RECIPE[j] = pTransferData->strDBR_RECIPE.GetAt(j); } for (int j = 0; j < pTransferData->strReserved.GetLength(); j++) { if (pTransferData->strReserved.GetAt(j) == NULL) { break; } DVDataPack_CPJT.Reserved[j] = pTransferData->strReserved.GetAt(j); } for (int j = 0; j < pTransferData->strRerferData.GetLength(); j++) { if (pTransferData->strRerferData.GetAt(j) == NULL) { break; } DVDataPack_CPJT.RERFER_DATA[j] = pTransferData->strRerferData.GetAt(j); } memcpy(DVData, &DVDataPack_CPJT, sizeof(DVDataPack_CPJT)); pSignalControl->WritePacketData(_T("15100"), sizeof(DVDataPack_CPJT), (short*)&DVData);*/ } //#3358 KYH FDC ADD START void CSequenceProcessor_CPJT::MakeDVData2() { const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); const CRcpLightInfo *pReviewLightInfo = NULL; const CRcpAFMRecipeInfo *pReviewAFMInfo = NULL; if (pRsRcpReviewInfo == NULL) { } else { // Review pReviewLightInfo = pRsRcpReviewInfo->GetRcpLightInfo(0); // Review AFM pReviewAFMInfo = pRsRcpReviewInfo->GetRcpAFMRecipeInfo(0); } CGlassResult *pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult(); const CAlignResult* pAlignResult = NULL; const CReviewResult* pReviewResult = NULL; const SReviewResult* pSReviewResult = NULL; if (pGlassResult == NULL) { } else { // Review Align Info pAlignResult = pGlassResult->GetAlignResult(); // Review Defect Info pReviewResult = pGlassResult->GetReviewResult(0); pSReviewResult = pGlassResult->GetSReviewResult(0, 0); } // Review const CModuleStatus* pModuleStatus = Module_GetModuleStatus(0); const SMagnificInfo* pSMagnificInfo = NULL; if (pModuleStatus == NULL) { } else { if (pReviewAFMInfo == NULL) { } else { pSMagnificInfo = pModuleStatus->GetMagnificInfo(pReviewAFMInfo->GetZoomIndex()); } } CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl(); if (pSignalControl == NULL) return ; if (pSignalControl->IsConnected() == NULL) return ; //int nReviewResultCount = min(_countof(DVDataPack.reviewDefectData), pGlassResult->GetSReviewResultCount(nIndex)); //int nReviewResultCount = pGlassResult->GetSReviewResultCount(nIndex); //int nWSIResultCount = pGlassResult->GetSWsiResultCount(nIndex); int nEqpID = 0; if (m_pSP2P->ISP2P_System_GetSystemInfo()) { nEqpID =m_pSP2P->ISP2P_System_GetSystemInfo()->m_nMachineType; } int nReviewResultCount = 0; int nWSIResultCount = 0; int offset = 0; int nSize = 0; int nWritePacketDataLimitPlag = 0; nReviewResultCount = 10; nSize = 1000; nWritePacketDataLimitPlag = 1; STransferData* pTransferData = m_pSP2P->ISP2P_GetCurrentTransferData(); char SVData[4] = { }; int nRev_Cam1_Image_Contrast=0; //16144 int nRev_Cam2_Image_Contrast=0; //16146 int nRev_PC_HDD_CHECK; //16222 int nWSI1_PC_HDD_CHECK; int nWSI2_PC_HDD_CHECK; int nAlignResult00=1000; int nAlignResult01=1000; int nReviewVersion = 20210422; int nWSI00Version = 20210422; int nWSI01Version = 20210422; int nReviewAliveCamera00 = 1000; int nReviewAliveCamera01 = 1000; //foucs if (m_pSP2P != NULL) { if (m_pSP2P->ISP2P_GetCurrentGlassResult() != NULL) { nRev_Cam1_Image_Contrast = m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast * 1000; nRev_Cam2_Image_Contrast = m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview01ImageContrast * 1000; if (m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast <=-2 || m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast >=999) { nRev_Cam1_Image_Contrast = 0 * 1000; } if (m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast <=-2|| m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast >=999) { nRev_Cam2_Image_Contrast = 0 * 1000; } } else { nRev_Cam1_Image_Contrast = 0; nRev_Cam2_Image_Contrast = 0; } } //nRev_PC_HDD_CHECK = GetDiskUsage() * 1000; //nWSI1_PC_HDD_CHECK = nRev_PC_HDD_CHECK;//GetDiskUsage() * 1000; //nWSI2_PC_HDD_CHECK = nRev_PC_HDD_CHECK;//GetDiskUsage() * 1000; //nAlignResult = 1; //nAlignResult00 = pAlignResult->nFindAlign[0] * 1000; //nAlignResult01 = pAlignResult->nFindAlign[1] * 1000; //nAlignResult00 = pAlignResult->dFindScore[0]; //nAlignResult01 = pAlignResult->dFindScore[1]; CCameraControlAlign* pAlignCameraControl = NULL; if (m_pSP2P->ISP2P_GetAlignCameraControl()) { pAlignCameraControl = m_pSP2P->ISP2P_GetAlignCameraControl(); } if (pAlignCameraControl != NULL) { if (pAlignCameraControl->GetCameraControl(0) != NULL) { nAlignResult00 = pAlignCameraControl->GetCameraControl(0)->GetConnected() * 1000; } else { nAlignResult00 = 1000; } if (pAlignCameraControl->GetCameraControl(1) != NULL) { nAlignResult01 = pAlignCameraControl->GetCameraControl(1)->GetConnected() * 1000; } else { nAlignResult01 = 1000; } } else { nAlignResult00 = 1000; nAlignResult01 = 1000; } if (ReviewCamera_GetReviewCameraControl(0) != NULL) { nReviewAliveCamera00 = ReviewCamera_GetReviewCameraControl(0)->GetConnected() * 1000; } else { nReviewAliveCamera00 = 1000; } if (ReviewCamera_GetReviewCameraControl(1) != NULL) { nReviewAliveCamera01 = ReviewCamera_GetReviewCameraControl(1)->GetConnected() * 1000; } else { nReviewAliveCamera01 = 1000; } ULARGE_INTEGER avail, total, free; avail.QuadPart = 0L; total.QuadPart = 0L; free.QuadPart = 0L; DWORD dwDrive = GetLogicalDrives(); DWORD dwDriveCh = 0x0001; TCHAR DriveText[3] = { 0 }; for (TCHAR Drive = 'A'; Drive <= 'Z'; Drive++) { wsprintf(DriveText, TEXT("%C:"), Drive); UINT type = GetDriveType(DriveText); if ((dwDrive & dwDriveCh) && (type == DRIVE_REMOVABLE || type == DRIVE_FIXED || type == DRIVE_RAMDISK)) { ULARGE_INTEGER i64FreeBytesToCaller = { 0 }, i64TotalBytes = { 0 }, i64FreeBytes = { 0 }; BOOL bRsult = GetDiskFreeSpaceEx(DriveText, (PULARGE_INTEGER)&i64FreeBytesToCaller, (PULARGE_INTEGER)&i64TotalBytes, (PULARGE_INTEGER)&i64FreeBytes); if (bRsult) { float ra = 1.0f - (float)(int)(i64FreeBytes.QuadPart >> 20) / (float)(int)(i64TotalBytes.QuadPart >> 20); //tmpLog.Format(TEXT("%c: %I64d MB / %I64d MB(%d%%)\r\n"), Drive, i64FreeBytes.QuadPart >> 20, i64TotalBytes.QuadPart >> 20, (int)(ra * 100)); //m_strEditOutput += tmpLog; if (Drive == 'D') { nRev_PC_HDD_CHECK = (ra * 100) * 1000; } if (Drive == 'W') { nWSI1_PC_HDD_CHECK = (ra * 100) * 1000; } if (Drive == 'Y') { nWSI2_PC_HDD_CHECK = (ra * 100) * 1000; } } } dwDriveCh <<= 1; } //sprintf(SVData, "%d", nRev_PC_HDD_CHECK); pSignalControl->WritePacketData(_T("16100"), sizeof(nAlignResult00), (short*)&nAlignResult00); pSignalControl->WritePacketData(_T("16104"), sizeof(nAlignResult01), (short*)&nAlignResult01); pSignalControl->WritePacketData(_T("16108"), sizeof(nReviewAliveCamera00), (short*)&nReviewAliveCamera00); pSignalControl->WritePacketData(_T("16112"), sizeof(nReviewAliveCamera01), (short*)&nReviewAliveCamera01); pSignalControl->WritePacketData(_T("16116"), sizeof(nRev_Cam1_Image_Contrast), (short*)&nRev_Cam1_Image_Contrast); pSignalControl->WritePacketData(_T("16120"), sizeof(nRev_Cam2_Image_Contrast), (short*)&nRev_Cam2_Image_Contrast); pSignalControl->WritePacketData(_T("16124"), sizeof(nRev_PC_HDD_CHECK), (short*)&nRev_PC_HDD_CHECK); pSignalControl->WritePacketData(_T("16128"), sizeof(nWSI1_PC_HDD_CHECK), (short*)&nWSI1_PC_HDD_CHECK); pSignalControl->WritePacketData(_T("16132"), sizeof(nWSI2_PC_HDD_CHECK), (short*)&nWSI2_PC_HDD_CHECK); pSignalControl->WritePacketData(_T("16136"), sizeof(nReviewVersion), (short*)&nReviewVersion); pSignalControl->WritePacketData(_T("16140"), sizeof(nWSI00Version), (short*)&nWSI00Version); pSignalControl->WritePacketData(_T("16144"), sizeof(nWSI01Version), (short*)&nWSI01Version); return; } //#3358 KYH FDC ADD END DWORD CSequenceProcessor_CPJT::GetDiskUsage() { DWORD dwDiskUse = 0; static PDH_HQUERY hQuery = NULL; static PDH_HCOUNTER hCounter = NULL; if (hQuery == NULL && hCounter == NULL) { PdhOpenQuery(NULL, NULL, &hQuery); PdhAddCounter(hQuery, "\\LogicalDisk(_Total)\\% Free Space", NULL, &hCounter); PdhCollectQueryData(hQuery); } PDH_FMT_COUNTERVALUE counterVal; PdhCollectQueryData(hQuery); PdhGetFormattedCounterValue(hCounter, PDH_FMT_DOUBLE, NULL, &counterVal); dwDiskUse = static_cast(counterVal.doubleValue); return dwDiskUse; } // [2017:4:13]-[WEZASW] : CIM Signal. BOOL CSequenceProcessor_CPJT::RecvCIMSignalToSignalControl(int nAddrIndex, int nSignalIndex) { CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl(); if (pSignalControl==NULL) return FALSE; if (pSignalControl->IsConnected() == FALSE) return FALSE; BOOL bResult = FALSE; // PCControl D2300 switch(nSignalIndex) { case PCControlRecv_TimeChange: g_pLog->DisplayMessage(_T("[PCControl_Signal] CIM IF Signal => PCControlRecv_TimeChange.")); bResult = ChangeReviewSystemTime(); break; } return bResult; } BOOL CSequenceProcessor_CPJT::SendCIMSignalToSignalControl(int nAddrIndex, int nSignalIndex) { CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl(); if (pSignalControl == NULL) return FALSE; if (pSignalControl->IsConnected() == FALSE) return FALSE; if (pSignalControl->Write_SendSignal(nAddrIndex, nSignalIndex, 1, 1000) == FALSE) { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Send Fail! ")); return FALSE; } switch (nAddrIndex) { case PCControlSend_D2320: if (nSignalIndex == PCControlSend_ReviewAlive) { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] CIM IF Signal => %d"), nSignalIndex); } break; } return TRUE; } // Change System Time BOOL CSequenceProcessor_CPJT::ChangeReviewSystemTime() { g_pLog->DisplayMessage(_T("[SequenceProcessor] ChangeReviewSystemTime IN")); SYSTEMTIME CurrentTime, ChangedTime; GetLocalTime(&CurrentTime); ChangedTime = CurrentTime; int nReadData = 0; int nReadSize = 1; int nAddrCount = 0; if (!ReadCIMTimeData(PCControl_ADDR_TIME_DATA, nAddrCount++, nReadData)) return FALSE; ChangedTime.wYear = nReadData; if (!ReadCIMTimeData(PCControl_ADDR_TIME_DATA, nAddrCount++, nReadData)) return FALSE; ChangedTime.wMonth = nReadData; if (!ReadCIMTimeData(PCControl_ADDR_TIME_DATA, nAddrCount++, nReadData)) return FALSE; ChangedTime.wDay = nReadData; if (!ReadCIMTimeData(PCControl_ADDR_TIME_DATA, nAddrCount++, nReadData)) return FALSE; ChangedTime.wHour = nReadData; if (!ReadCIMTimeData(PCControl_ADDR_TIME_DATA, nAddrCount++, nReadData)) return FALSE; ChangedTime.wMinute = nReadData; if (!ReadCIMTimeData(PCControl_ADDR_TIME_DATA, nAddrCount++, nReadData)) return FALSE; ChangedTime.wSecond = nReadData; if (!ReadCIMTimeData(PCControl_ADDR_TIME_DATA, nAddrCount++, nReadData)) return FALSE; if (SetLocalTime(&ChangedTime)) { g_pLog->DisplayMessage(_T("[SequenceProcessor] Success! SetLocalTime(), Current: %04d-%02d-%02d %02d-%02d-%02d, Changed: %04d-%02d-%02d %02d-%02d-%02d"), CurrentTime.wYear, CurrentTime.wMonth, CurrentTime.wDay, CurrentTime.wHour, CurrentTime.wMinute, CurrentTime.wSecond, ChangedTime.wYear, ChangedTime.wMonth, ChangedTime.wDay, ChangedTime.wHour, ChangedTime.wMinute, ChangedTime.wSecond); // AFM & WSI TIME SendSystemTime(ChangedTime); } else { g_pLog->DisplayMessage(_T("[SequenceProcessor] Fail! SetLocalTime()")); } g_pLog->DisplayMessage(_T("[SequenceProcessor] ChangeReviewSystemTime OUT")); return TRUE; } BOOL CSequenceProcessor_CPJT::ReadCIMTimeData(CString strAddr, int nAddrCnt, int& nData) { CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl(); if (pSignalControl==NULL) return FALSE; if (pSignalControl->IsConnected() == FALSE) return FALSE; CString strReadAddr = _T(""); char readData[8] = {0}; strReadAddr.Format(_T("D%d"), _ttoi(strAddr) + nAddrCnt); if (pSignalControl->ReadData(strReadAddr, 1, readData) == FALSE) return FALSE; memcpy(&nData, readData, 2); return TRUE; } // Local System BOOL CSequenceProcessor_CPJT::SendSystemTime(SYSTEMTIME sysTime) { SYSTEMTIME CurrentTime; int nWSIControlCount = m_pSP2P->ISP2P_GetWSIControlCount(); for(int nWSIControlIdx = 0; nWSIControlIdx < nWSIControlCount; nWSIControlIdx++) { CWsiControl* pWSIControl = m_pSP2P->ISP2P_GetWSIControl(nWSIControlIdx); if(pWSIControl == NULL) continue; GetLocalTime(&CurrentTime); pWSIControl->SetSystemTime(CurrentTime); } int nAFMControlCount = m_pSP2P->ISP2P_GetAFMControlCount(); for(int nAFMControlIdx = 0; nAFMControlIdx < nAFMControlCount; nAFMControlIdx++) { CAfmControl* pAFMControl = m_pSP2P->ISP2P_GetAFMControl(nAFMControlIdx); if(pAFMControl == NULL) continue; GetLocalTime(&CurrentTime); pAFMControl->SetSystemTime(CurrentTime); } return TRUE; } BOOL CSequenceProcessor_CPJT::SendSignalOffToSignalControl( int nSignalIndex, int nSignalValue ) { CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl(); if (pSignalControl == NULL) return FALSE; if (pSignalControl->IsConnected() == FALSE) return FALSE; int nAddrIdx = 0; if (pSignalControl->Write_SendSignal(nSignalIndex, nSignalValue, 0,SIGNAL_ON_TIME_INFINITY) == FALSE) { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Send Fail! ")); return FALSE; } if (nSignalIndex==PCControlSendSignalIndex_State) { switch(nSignalValue) { case PCControlSend_RecipeASCEND: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Recipe ASCEND Bit OFF! => %d"),0); break; case PCControlSend_WSIError: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] WSIError Bit OFF! => %d"),0); break; } } else if (nSignalIndex==PCControlSendSignalIndex_Seq) { switch(nSignalValue) { case PCControlSend_LoadingComplete_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Loading Complete Off! => %d"), 0); break; case PCControlSend_AlignComplete_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Align Complete Off! => %d"), 0); break; case PCControlSend_ReviewReady_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Review Ready Off! => %d"), 0); break; case PCControlSend_ReviewComplete_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Review Complete Off! => %d"), 0); break; case PCControlSend_ResultDataComplete_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Result Data Complete Off! => %d"), 0); break; } } else if (nSignalIndex==PCControlSendSignalIndex_Ack) { switch(nSignalValue) { case PCControlSend_LoadingAck_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Loading Ack Off! => %d"), 0); break; case PCControlSend_AlignStartAck_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Align Start Ack Off! => %d"), 0); break; case PCControlSend_ReadRawFileAck_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Read Raw File Ack Off! => %d"), 0); break; case PCControlSend_ReviewStartAck_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Review Start Ack Off! => %d"), 0); break; case PCControlSend_ResultDataComplete_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Result Data Complete Off! => %d"), 0); break; } } else if (nSignalIndex == PCControlSendSignalIndex_DiagnoAck) { switch (nSignalValue) { case 0: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Diagno Ack Off! => %d"), 0); break; } } return TRUE; } BOOL CSequenceProcessor_CPJT::SendSignalToSignalControl( int nSignalIndex, int nSignalValue ) { CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl(); if (pSignalControl == NULL) return FALSE; if (pSignalControl->IsConnected() == FALSE) return FALSE; int nAddrIdx = 0; if (pSignalControl->Write_SendSignal(nSignalIndex, nSignalValue, 1, SIGNAL_ON_TIME_INFINITY) == FALSE) { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Send Fail! ")); return FALSE; } switch(nSignalIndex) { case PCControlSendSignalIndex_State: { switch(nSignalValue) { case PCControlSend_RecipeASCEND: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Recipe Is ASCEND! => %d"),1); break; case PCControlSend_WSIError: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] WSIError! => %d"),0); break; case PCControlSend_Defoucs: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Defoucs! => %d"),0); break; case PCControlSend_Diagnosis: // 0412 m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Diagnosis! => %d"), 0); break; } } break; case PCControlSendSignalIndex_Seq: { switch(nSignalValue) { case PCControlSend_LoadingComplete_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Loading Complete! => %d"), 1); break; case PCControlSend_AlignComplete_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Align Complete! => %d"), 1); break; case PCControlSend_ReviewReady_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Review Ready! => %d"), 1); break; case PCControlSend_ReviewComplete_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Review Complete! => %d"), 1); break; case PCControlSend_ResultDataComplete_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Result Data Complete! => %d"), 1); break; } } break; case PCControlSendSignalIndex_Ack: { switch(nSignalValue) { case PCControlSend_LoadingAck_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Loading Ack! => %d"), 1); break; case PCControlSend_AlignStartAck_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Align Start Ack! => %d"), 1); break; case PCControlSend_ReadRawFileAck_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Read Raw File Ack! => %d"), 1); break; case PCControlSend_ReviewStartAck_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Review Start Ack! => %d"), 1); break; case PCControlSend_ResultDataComplete_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Result Data Complete! => %d"), 1); break; } } break; case PCControlSendSignalIndex_DiagnoAck: { switch (nSignalValue) { case 0: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Diagnosis start Ack! => %d"), 1); break; } } case PCControlSendSignalIndex_DiagnoComplete: { switch (nSignalValue) { case 0: m_pSP2P->ISP2P_GetDlgDiagnosis()->ShowWindow(SW_HIDE); m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Diagnosis Complete! => %d"), 1); break; } } } return TRUE; } BOOL CSequenceProcessor_CPJT::SendSignalToSignalControl( int nSignalIndex, int nSignalValue,int nSignalOnTime ) { CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl(); if (pSignalControl == NULL) return FALSE; if (pSignalControl->IsConnected() == FALSE) return FALSE; int nAddrIdx = 0; if (pSignalControl->Write_SendSignal(nSignalIndex, nSignalValue, 1, nSignalOnTime) == FALSE) { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Send Fail! ")); return FALSE; } switch(nSignalIndex) { case PCControlSendSignalIndex_State: { switch(nSignalValue) { case PCControlSend_RecipeASCEND: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Recipe Is ASCEND! => %d"),1); break; case PCControlSend_WSIError: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] WSIError! => %d"),0); break; case PCControlSend_Defoucs: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Defoucs! => %d"),0); break; case PCControlSend_Diagnosis: // 0412 m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Diagnosis! => %d"), 0); break; } } break; case PCControlSendSignalIndex_Seq: { switch(nSignalValue) { case PCControlSend_LoadingComplete_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Loading Complete! => %d"), 1); break; case PCControlSend_AlignComplete_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Align Complete! => %d"), 1); break; case PCControlSend_ReviewReady_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Review Ready! => %d"), 1); break; case PCControlSend_ReviewComplete_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Review Complete! => %d"), 1); break; case PCControlSend_ResultDataComplete_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Result Data Complete! => %d"), 1); break; } } break; case PCControlSendSignalIndex_Ack: { switch(nSignalValue) { case PCControlSend_LoadingAck_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Loading Ack! => %d"), 1); break; case PCControlSend_AlignStartAck_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Align Start Ack! => %d"), 1); break; case PCControlSend_ReadRawFileAck_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Read Raw File Ack! => %d"), 1); break; case PCControlSend_ReviewStartAck_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Review Start Ack! => %d"), 1); break; case PCControlSend_ResultDataComplete_CPJT: m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Result Data Complete! => %d"), 1); break; } } break; case PCControlSendSignalIndex_DiagnoComplete: { switch (nSignalValue) { case 0: m_pSP2P->ISP2P_GetDlgDiagnosis()->ShowWindow(SW_HIDE); m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] DiagnoComplete => %d"), 1); break; } } } return TRUE; } BOOL CSequenceProcessor_CPJT::ProcessSignal_State( int nSignalValue, BOOL bSignalOn ) { BOOL bResult = FALSE; if (bSignalOn==FALSE) return TRUE; switch(nSignalValue) { case PCControlRecv_ByPassMode_CPJT: // bypass mode on { if (m_nProcessMode == ProcessBypassMode_CPJT) { } else { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Mode] BY-PASS Mode")); bResult = SetProcessMode(ProcessBypassMode_CPJT); if (bResult==FALSE) m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Mode] BY-PASS Mode Error!")); } } break; case PCControlRecv_AutoMode_CPJT: // auto mode on { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Mode] Auto Mode")); bResult = SetProcessMode(ProcessAutoMode_CPJT); if (bResult==FALSE) m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Mode] Auto Mode Error!")); } break; case PCControlRecv_ManualMode_CPJT: // manual mode on { m_pSP2P->ISP2P_GetDiagnosisHistory2(); m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Mode] Manual Mode")); bResult = SetProcessMode(ProcessManualMode_CPJT); if (bResult==FALSE) m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Mode] Manual Mode Error!")); // lmk simul manual camera,motor stop //ReviewCamera_CameraControl(CameraControlStop); CMotorControl* pMotorControl = m_pSP2P->ISP2P_GetMotorControl(); if(pMotorControl) pMotorControl->CommonSetAutoStop(); } break; case PCControlRecv_ReviewManualMode_CPJT: // review mode on { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Mode] Review Mode")); bResult = SetProcessMode(ProcessReviewMode_CPJT); if (bResult==FALSE) m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Mode] Review Mode Error!")); } break; default: return FALSE; break; } return bResult; } BOOL CSequenceProcessor_CPJT::ProcessSignal_Seq( int nSignalValue, BOOL bSignalOn ) { BOOL bResult = FALSE; switch(nSignalValue) { case PCControlRecv_Loading_CPJT: // loading on { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Glass Loading! => %d"), bSignalOn); if (bSignalOn) bResult = SetProcessStatus(ProcessLoading_CPJT); else bResult = SendSignalOffToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_LoadingAck_CPJT); if (bResult==FALSE) m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Glass Loading Error!")); } break; case PCControlRecv_AlignStart_CPJT: // align start on { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Align Start! => %d"), bSignalOn); if (bSignalOn) bResult = SetProcessStatus(ProcessAlignStart_CPJT); else bResult = SendSignalOffToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_AlignStartAck_CPJT); if (bResult==FALSE) m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Align Start Error!")); } break; case PCControlRecv_ReadRawFile_CPJT: // read raw file on { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Read Raw File! => %d"), bSignalOn); if (bSignalOn) bResult = SetProcessStatus(ProcessReadRawFile_CPJT); else bResult = SendSignalOffToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReadRawFileAck_CPJT); if (bResult==FALSE) m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Read Raw File Error!")); } break; case PCControlRecv_ReviewStart_CPJT: // review start on { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Review Start! => %d"), bSignalOn); if (bSignalOn) bResult = SetProcessStatus(ProcessReviewStart_CPJT); else bResult = SendSignalOffToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewStartAck_CPJT); if (bResult==FALSE) m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Review Start Error!")); } break; case PCControlRecv_ReviewEnd_CPJT: // review end on { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Review End! => %d"), bSignalOn); if (bSignalOn) bResult = SetProcessStatus(ProcessReviewEnd_CPJT); else bResult = SendSignalOffToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewEndAck_CPJT); if (bResult==FALSE) m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Review End Error!")); } break; case PCControlRecv_ReviewUnloading_CPJT: { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Review Unloading! => %d"), bSignalOn); if (bSignalOn) bResult = SetProcessStatus(ProcessReviewUnloding_CPJT); else bResult = SendSignalOffToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewUnloadingAck_CPJT); if (bResult == FALSE) m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Review Unloading Error!")); } case PCControlRecv_AFM_Home_Move_CPJT: // AFM Home Move On { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] AFM Home Move! => %d"), bSignalOn); if (bSignalOn) bResult = SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_AFMHomeMoveAck_CPJT); else bResult = SendSignalOffToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_AFMHomeMoveAck_CPJT); m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Send AFM Home Move Ack!")); } break; case PCControlRecv_WSI_Home_Move_CPJT: // WSI Home Move ON { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] WSI Home Move!")); if (bSignalOn) { bResult = SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_WSIHomeMoveAck_CPJT); if (m_pSP2P->ISP2P_GetWSIControl(0) != NULL) { m_pSP2P->ISP2P_GetWSIControl(0)->SendWsiAfmSafePosMove(); m_pSP2P->ISP2P_GetWSIControl(1)->SendWsiAfmSafePosMove(); } } else bResult = SendSignalOffToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_WSIHomeMoveAck_CPJT); m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Send WSI Home Move Ack!")); } break; default: return FALSE; break; } return bResult; } BOOL CSequenceProcessor_CPJT::ProcessSignal_Seq2(int nSignalValue, BOOL bSignalOn) { BOOL bResult = FALSE; switch (nSignalValue) { case PCControlRecv_TIME_SET: { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal]time set")); if (bSignalOn) { bResult = SendSignalToSignalControl(PCControlSendSignalIndex_Time, 0); CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl(); //char strTime[14] = { 0 }; int time; CString strtime; pSignalControl->ReadData(_T("11100"), 14, strtime); int nYear, nMonth, nDate, nHour, nMin, nSec; char sTimeSync[20] = {}; nYear = atoi(strtime.Left(2).GetBuffer(0)); nYear += 2000; nMonth = atoi(strtime.Mid(2, 2).GetBuffer(0)); nDate = atoi(strtime.Mid(4, 2).GetBuffer(0)); nHour = atoi(strtime.Mid(6, 2).GetBuffer(0)); nMin = atoi(strtime.Mid(8, 2).GetBuffer(0)); nSec = atoi(strtime.Mid(10, 2).GetBuffer(0)); int nValue = 0; SYSTEMTIME sTime; GetLocalTime(&sTime); sTime.wYear = nYear; sTime.wMonth = nMonth; sTime.wDay = nDate; sTime.wHour = nHour; sTime.wMinute = nMin; sTime.wSecond = nSec; if (SetLocalTime(&sTime)) { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] TymeSync Success %s"), strtime); } else m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] TymeSync Fail %s"), strtime); //memcpy(&time, strTime, 2); //sttime.Format(_T("%d"), time); m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] time %s"), strtime); } else bResult = SendSignalOffToSignalControl(PCControlSendSignalIndex_Time, 0); m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Send time set off")); } break; case PCControlRecv_Autodiagnosis: { //#3514_LYW_CF AOI Review �ڰ����� ��� ����_START CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl(); CString strDiagnosisMode; pSignalControl->ReadData(_T("11160"), 2, strDiagnosisMode); int nDiagnosisMode = atoi(strDiagnosisMode); //#3514_LYW_CF AOI Review �ڰ����� ��� ����_END m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Diagno start => %d, DiagnosisMode => %d"), bSignalOn, nDiagnosisMode); if (bSignalOn) { bResult = SendSignalToSignalControl(PCControlSendSignalIndex_DiagnoAck, 0); m_pSP2P->ISP2P_GetDlgDiagnosis()->ShowWindow(SW_SHOW); m_pSP2P->ISP2P_GetDiagnosisManager()->RecvSignalToSignalControl(0, nDiagnosisMode); } //#3514_LYW_CF AOI Review �ڰ����� ��� ����_END else bResult = SendSignalOffToSignalControl(PCControlSendSignalIndex_DiagnoAck, 0); m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Send Diagno Ack!")); } break; case RCControlRecv_AutoDiagnosisComplete: { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] DiagnoComplete => %d"), bSignalOn); if (bSignalOn==1) { m_pSP2P->ISP2P_GetDlgDiagnosis()->ShowWindow(SW_HIDE); m_pSP2P->ISP2P_GetDiagnosisManager()->RecvSignalToSignalControl(0, 0,0); } } break; default: return FALSE; break; } return bResult; } BOOL CSequenceProcessor_CPJT::ProcessSignal_WSI_State(int nSignalValue, BOOL bSignalOn) { BOOL bResult = FALSE; switch (nSignalValue) { case PCControlRecv_WSI_ALIVE: // review mode on { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Mode] WSI IS ALIVE")); if (bSignalOn == TRUE) { m_bWSI_ALIVE = TRUE; } else { m_bWSI_ALIVE = FALSE; } } break; case PCControlRecv_WSI_AFM_SAFE_POS: // review mode on { if (bSignalOn == TRUE) { m_bWSI_AFM_SAFE_POS = TRUE; m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Mode] WSI IS SAFE POS")); } else { m_bWSI_AFM_SAFE_POS = FALSE; m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Mode] WSI IS NOT!! SAFE POS!!")); } } break; default: return FALSE; break; } return bResult; } BOOL CSequenceProcessor_CPJT::ProcessSignal_Ack( int nSignalValue, BOOL bSignalOn ) { BOOL bResult = FALSE; if (bSignalOn==FALSE) return TRUE; switch(nSignalValue) { case PCControlRecv_LoadingCompleteAck_CPJT: // Loading complete ack on m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Loading Complete Ack!")); bResult = SendSignalOffToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_LoadingComplete_CPJT); if (bResult) m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Loading Complete Off!")); else m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Loading Complete Off Fail!")); break; case PCControlRecv_AlignCompleteAck_CPJT: // align complete ack on m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Align Complete Ack!")); bResult = SendSignalOffToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_AlignComplete_CPJT); if (bResult) m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Align Complete Off!")); else m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Align Complete Off Fail!")); break; case PCControlRecv_ReviewReadyAck_CPJT: // review ready ack on m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Review Ready Ack!")); bResult = SendSignalOffToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewReady_CPJT); if (bResult) m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Review Ready Off!")); else m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Review Ready Off Fail!")); break; case PCControlRecv_ReviewCompleteAck_CPJT: // review complete ack on m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Review Complete Ack!")); bResult = SendSignalOffToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewComplete_CPJT); if (bResult) m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Review Complete Off!")); else m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Review Complete Off Fail!")); break; case PCControlRecv_ResultDataCompleteAck_CPJT: // result data complete ack on m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Result Data Complete Ack!")); bResult = SendSignalOffToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ResultDataComplete_CPJT); if (bResult) m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Result Data Complete Off!")); else m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Result Data Complete Off Fail!")); break; default: return FALSE; break; } return bResult; } BOOL CSequenceProcessor_CPJT::SendResultToSignalControl( int nSingalIdx, int nResultValue ) { CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl(); if (pSignalControl == NULL) return FALSE; if (pSignalControl->IsConnected() == FALSE) return FALSE; const CSignalControlInfo* pSignalControlInfo = m_pSP2P->ISP2P_System_GetPCControlInfo(); if (pSignalControlInfo==NULL) return FALSE; if (nSingalIdx<0 || nSingalIdx>=pSignalControlInfo->GetSendDataAddressCount()) return FALSE; const SSignalSettingData* pSSignalSendAddr = pSignalControlInfo->GetSendDataAddress(nSingalIdx); if (pSSignalSendAddr==NULL) return FALSE; if (pSignalControl->WriteWordData(pSSignalSendAddr->strAddr, pSSignalSendAddr->nSize, nResultValue)==FALSE) { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Write Result Fail! ")); return FALSE; } m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Write Result : Name[%s], Addr[%s], Data[%d]"), pSSignalSendAddr->strName, pSSignalSendAddr->strAddr, nResultValue); return TRUE; } BOOL CSequenceProcessor_CPJT::SendResultToSignalControl( int nSingalIdx, CString strResultValue ) { CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl(); if (pSignalControl == NULL) return FALSE; if (pSignalControl->IsConnected() == FALSE) return FALSE; const CSignalControlInfo* pSignalControlInfo = m_pSP2P->ISP2P_System_GetPCControlInfo(); if (pSignalControlInfo==NULL) return FALSE; if (nSingalIdx<0 || nSingalIdx>=pSignalControlInfo->GetSendDataAddressCount()) return FALSE; const SSignalSettingData* pSSignalSendAddr = pSignalControlInfo->GetSendDataAddress(nSingalIdx); if (pSSignalSendAddr==NULL) return FALSE; if (pSignalControl->WriteData(pSSignalSendAddr->strAddr, pSSignalSendAddr->nSize, strResultValue)==FALSE) { m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Write Result Fail! ")); return FALSE; } m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Write Result : Name[%s], Addr[%s], Data[%s]"), pSSignalSendAddr->strName, pSSignalSendAddr->strAddr, strResultValue); return TRUE; } void CSequenceProcessor_CPJT::RecvWSIReflowResult( int nModuleIndex, const SWsiResult& measureResut ) { return; } void CSequenceProcessor_CPJT::RecvWSIMultiShotResult(int nModuleIndex, const SWsiResult& measureResut) { SReviewResult WisMultiShotResult; if (m_pSP2P == NULL) goto RESULT_FAIL; CGlassResult *pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult(); if (pGlassResult == NULL) goto RESULT_FAIL; g_pLog->DisplayMessage(_T("[WSI_%d]MeasureResult index %d => code %d"), nModuleIndex, measureResut.nResultIndex, measureResut.nResultCode); DWORD dwCurTick = GetTickCount(); CReviewResult* pWsiMultiShotResult = pGlassResult->GetWsiMultiShotResult(nModuleIndex); if (pWsiMultiShotResult == NULL) goto RESULT_FAIL; int nCurResultIdx = pWsiMultiShotResult->GetLastSReviewResultIndex() + 1; // last index + 1 int nStartResultIdx = pWsiMultiShotResult->GetStartSReviewResultIndex(); int nEndResultIdx = pWsiMultiShotResult->GetEndSReviewResultIndex(); // get grab position const SMotorPosition *pPosition = Module_GetMotorPosition(nModuleIndex); if (pPosition == NULL) goto RESULT_FAIL; int nPosX = int(pPosition->dGlassPosX * 1000.0); int nPosY = int(pPosition->dGlassPosY * 1000.0); int nMPosX = int(pPosition->dMotorPosX * 1000.0); int nMPosY = int(pPosition->dMotorPosY * 1000.0); double dTime = (double)m_ProcessTimer.GetDurationMilliSecond(); if (measureResut.nResultIndex != nCurResultIdx) { goto RESULT_FAIL; } // measureResut if (pWsiMultiShotResult->GetSReviewResultCount() == 0) return; SReviewResult* pSWsiResult = pWsiMultiShotResult->GetSReviewResult(nCurResultIdx); WisMultiShotResult.nUMOriginX = pSWsiResult->nUMOriginX;//nPosX; WisMultiShotResult.nUMOriginY = pSWsiResult->nUMOriginY;//nPosY; WisMultiShotResult.dTargetMotorX = pSWsiResult->dTargetMotorX;//pPosition->dMotorPosX; WisMultiShotResult.dTargetMotorY = pSWsiResult->dTargetMotorY;//pPosition->dMotorPosY; WisMultiShotResult.dDurationTime = dTime; WisMultiShotResult.nWsi_ResultCode = measureResut.nResultCode; WisMultiShotResult.nWsi_Type = measureResut.nResultType; WisMultiShotResult.nWsi_SlopeWarn = measureResut.nXSlopeWarn; memcpy(WisMultiShotResult.pWsi_ResultData, measureResut.pResultData, sizeof(measureResut.pResultData)); pGlassResult->SetWsiResultData(nModuleIndex, nCurResultIdx, WisMultiShotResult, nPosX, nPosY, nMPosX, nMPosY, dTime); // set last result idx pWsiMultiShotResult->SetLastSReviewResultIndex(nCurResultIdx); if (nCurResultIdx == nEndResultIdx && nCurResultIdx <= pWsiMultiShotResult->GetSReviewResultCount()) { nStartResultIdx = nCurResultIdx + 1; nEndResultIdx = nStartResultIdx + MAX_MOTOR_ADDRESS_SIZE - 1; nEndResultIdx = min(nEndResultIdx, (pWsiMultiShotResult->GetSReviewResultCount() - 1)); g_pLog->DisplayMessage(_T("RemainWsi Started view[%d] start[%d] end[%d]"), nModuleIndex, nStartResultIdx, nEndResultIdx); pWsiMultiShotResult->SetStartSReviewResultIndex(nStartResultIdx); pWsiMultiShotResult->SetEndSReviewResultIndex(nEndResultIdx); ::Sleep(3000); // Process_RemainWsiPoint(nModuleIndex); } // update view m_pSP2P->ISP2P_UpdateReviewResult(nModuleIndex, pGlassResult); RESULT_FAIL: return; } int CSequenceProcessor_CPJT::ChangeWsiReflowPointIndex( int nIdx ) { switch(nIdx) { case CELL_TOP: return TOP; break; case CELL_LEFT: return LEFT; break; case CELL_RIGHT: return RIGHT; break; case CELL_LEFTTOP: return LEFTTOP; break; case CELL_RIGHTTOP: return RIGHTTOP; break; case CELL_LEFTBOTTOM: return LEFTBOTTOM; break; case CELL_RIGHTBOTTOM: return RIGHTBOTTOM; break; case CELL_BOTTOM: return BOTTOM; break; case CELL_LEFTNOTCH: return LEFTNOTCH; break; case CELL_RIGHTNOTCH: return RIGHTNOTCH; break; } return 0; } BOOL CSequenceProcessor_CPJT::WsiReflowStartProcessing( CGlassResult *pGlassResult, int nPlanIndex/*=0*/ ) { AFM_SetAFMTracking(FALSE); // send wsi start SetWsiType(5); WSIAllReadySignal(0); if(!WSIReflowAllStartSignal()) { g_pLog->DisplayMessage(_T("[WSI] WSI Start Fail!!")); } CReviewProcessor* pReviewProcessor = m_pSP2P->ISP2P_GetReviewProcessor(); if(pGlassResult && pReviewProcessor) { // WsiStart pReviewProcessor->SetJobID(pGlassResult->m_strJobID); // pGlassResult->m_strGlassID -> pGlassResult->m_strJobID pReviewProcessor->SetOperID(pGlassResult->m_strOperID); m_pSP2P->ISP2P_UpdateReviewProcessStatus(ReviewProcessStatus_WSIReflowStart, nPlanIndex); // Send WsiPos to Motor m_pSP2P->ISP2P_DisplayMessage(_T("[Motor] Send WsiReflow Point to Motor Started!")); SendWsiReflowPositionToMotorControl(pGlassResult); m_pSP2P->ISP2P_DisplayMessage(_T("[Motor] Send WsiReflow Point to Motor Ended!")); MakeWSIUpLoadDirectory(pReviewProcessor->GetUploadImagePath()); return TRUE; } return FALSE; } BOOL CSequenceProcessor_CPJT::WsiUserStartProcessing( CGlassResult *pGlassResult, int nPlanIndex/*=0*/ ) { // AFM Tracking ON AFM_SetAFMTracking(FALSE); SetWsiType(0); WSIAllReadySignal(0); // send wsi start if(!WSIUserAllStartSignal()) { g_pLog->DisplayMessage(_T("[WSI] WSI Start Fail!!")); } CReviewProcessor* pReviewProcessor = m_pSP2P->ISP2P_GetReviewProcessor(); if(pGlassResult && pReviewProcessor) { // WsiStart pReviewProcessor->SetJobID(pGlassResult->m_strJobID); // pGlassResult->m_strGlassID -> pGlassResult->m_strJobID pReviewProcessor->SetOperID(pGlassResult->m_strOperID); m_pSP2P->ISP2P_UpdateReviewProcessStatus(ReviewProcessStatus_WSIStart, nPlanIndex); // Send WsiPos to Motor m_pSP2P->ISP2P_DisplayMessage(_T("[Motor] Send UserWsi Point to Motor Started!")); SendWsiUserPositionToMotorControl(pGlassResult); m_pSP2P->ISP2P_DisplayMessage(_T("[Motor] Send UserWsi Point to Motor Ended!")); MakeWSIUpLoadDirectory(pReviewProcessor->GetUploadImagePath()); return TRUE; } return FALSE; } BOOL CSequenceProcessor_CPJT::WsiMultiShotStartProcessing(CGlassResult *pGlassResult, int nPlanIndex /*= 0*/) { // AFM Tracking ON AFM_SetAFMTracking(FALSE); WsiMultiShotReScheduling(pGlassResult); SetWsiType(7); WSIAllReadySignal(1); // send wsi start if (!WSIMultiShotAllStartSignal()) { g_pLog->DisplayMessage(_T("[WSI] WSI MultiShot Start Fail!!")); } CReviewProcessor* pReviewProcessor = m_pSP2P->ISP2P_GetReviewProcessor(); if (pGlassResult && pReviewProcessor) { // WsiStart pReviewProcessor->SetJobID(pGlassResult->m_strJobID); // pGlassResult->m_strGlassID -> pGlassResult->m_strJobID pReviewProcessor->SetOperID(pGlassResult->m_strOperID); m_pSP2P->ISP2P_UpdateReviewProcessStatus(ReviewProcessStatus_WSIMultiShotStart, nPlanIndex); // Send WsiPos to Motor m_pSP2P->ISP2P_DisplayMessage(_T("[Motor] Send UserWsi Point to Motor Started!")); SendWsiMultiShotPositionToMotorControl(pGlassResult); m_pSP2P->ISP2P_DisplayMessage(_T("[Motor] Send UserWsi Point to Motor Ended!")); MakeWSIUpLoadDirectory(pReviewProcessor->GetUploadImagePath()); return TRUE; } return FALSE; } int CSequenceProcessor_CPJT::SendWsiReflowPositionToMotorControl( CGlassResult* pGlassResult ) { CMotorControl *pMotorControl = m_pSP2P->ISP2P_GetMotorControl(); if(pMotorControl == NULL) return 0; const CSystemInfo *pSystemInfo = m_pSP2P->ISP2P_System_GetSystemInfo(); if(pSystemInfo == NULL) return -1; const CMotorControlInfo* pMotorInfo = m_pSP2P->ISP2P_System_GetMotorInfo(); if (pMotorInfo == NULL) return -2; const CCoordCalibrator* pCoordCalibrator = m_pSP2P->ISP2P_GetCoordCalibrator(); if (pMotorInfo == NULL) return -3; // set move count zero for(int i=0; iGetGantryInfoCount(); i++) { pMotorControl->GantrySetMoveCount(i, 0); } // set move delay time pMotorControl->CommonSetAfDelayTime(pMotorInfo->GetAfDelayTime()); pMotorControl->CommonSetImageDelayTime(pMotorInfo->GetImageDelayTime()); pMotorControl->CommonSetWsiDelayTime(pMotorInfo->GetWsiDelayTime()); // get direction int nDirectionX, nDirectionY; pCoordCalibrator->GetTransDirection(nDirectionX, nDirectionY); int nTotalCount = 0; double dDefectPosX, dDefectPosY; // WSI result count for (int nModuleIdx=0; nModuleIdxGetWsiReflowResult(nModuleIdx); if (pWsiResult==NULL) continue; const SCoordInfo* pCoordInfo = Module_GetCoordInfo(nModuleIdx); if (pCoordInfo==NULL) continue; CModuleStatus* pModuleStatus = Module_GetModuleStatus(nModuleIdx); if (pModuleStatus == NULL) continue; // get result index int nStartIdx = pWsiResult->GetStartSReviewResultIndex(); int nEndIdx = pWsiResult->GetEndSReviewResultIndex(); nEndIdx = min(nEndIdx, (pWsiResult->GetSReviewResultCount()-1)) + 1; // set End Index // [2017:3:8]-[WEZASW] : CameraOffset (-1~1 => -5~5) double m_dMinOffset = -5.0; double m_dMaxOffset = 5.0; // get wsi pos VectorDouble vectorPosX, vectorPosY; for (int nResultIdx=nStartIdx; nResultIdxGetSReviewResult(nResultIdx); if (pWsi==NULL) continue; // set defect pos dDefectPosX = double(pWsi->nUMOriginX) / 1000.0; dDefectPosY = double(pWsi->nUMOriginY) / 1000.0; // trans glass to motor pos pCoordCalibrator->TransGlass2Motor(pCoordInfo, dDefectPosX, dDefectPosY); // set offset ApplyMotorOffset(pWsi->nModuleIdx, -1, MotorOffsetCamera + MotorOffsetWSI, dDefectPosX, dDefectPosY); // motor calibrate CalibrateMotorPos(pWsi->nModuleIdx, dDefectPosX, dDefectPosY); // add move pos if((int)vectorPosX.size() < MAX_MOTOR_ADDRESS_SIZE) { pWsi->dTargetMotorX = dDefectPosX; pWsi->dTargetMotorY = dDefectPosY; vectorPosX.push_back(dDefectPosX); vectorPosY.push_back(dDefectPosY); g_pLog->DisplayMessage(_T("[WsiStart] %d Module, %d Point, Motor: %.3lf mm, %.3lf mm"), nModuleIdx, nResultIdx, dDefectPosX, dDefectPosY); } } // move path to motor if (pMotorControl->GantryWsiAutoGo(pModuleStatus->GetGantryIndex(), vectorPosX, vectorPosY, TRUE)) { nTotalCount += (int)vectorPosX.size(); g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Success!"), pModuleStatus->GetGantryIndex()); } else { g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Fail"), pModuleStatus->GetGantryIndex()); } } if (pMotorControl->CommonSetAutoWsiGoAll()==FALSE) { g_pLog->DisplayMessage(_T("[GantryAutoGo] All Gantry AutoWsi Fail!")); return 0; } g_pLog->DisplayMessage(_T("[GantryAutoGo] All Gantry WsiReflow Success!")); return nTotalCount; } BOOL CSequenceProcessor_CPJT::SendWsiUserPositionToMotorControl( CGlassResult* pGlassResult ) { CMotorControl *pMotorControl = m_pSP2P->ISP2P_GetMotorControl(); if(pMotorControl == NULL) return 0; const CSystemInfo *pSystemInfo = m_pSP2P->ISP2P_System_GetSystemInfo(); if(pSystemInfo == NULL) return -1; const CMotorControlInfo* pMotorInfo = m_pSP2P->ISP2P_System_GetMotorInfo(); if (pMotorInfo == NULL) return -2; const CCoordCalibrator* pCoordCalibrator = m_pSP2P->ISP2P_GetCoordCalibrator(); if (pMotorInfo == NULL) return -3; // set move count zero for(int i=0; iGetGantryInfoCount(); i++) { pMotorControl->GantrySetMoveCount(i, 0); } // set move delay time pMotorControl->CommonSetAfDelayTime(pMotorInfo->GetAfDelayTime()); pMotorControl->CommonSetImageDelayTime(pMotorInfo->GetImageDelayTime()); pMotorControl->CommonSetWsiDelayTime(pMotorInfo->GetWsiDelayTime()); // get direction int nDirectionX, nDirectionY; pCoordCalibrator->GetTransDirection(nDirectionX, nDirectionY); int nTotalCount = 0; double dDefectPosX, dDefectPosY; //sjb /* VectorDouble vectorPosX2, vectorPosY2; vectorPosX2.push_back(2635); vectorPosX2.push_back(2635); vectorPosX2.push_back(2635); vectorPosX2.push_back(2635); vectorPosX2.push_back(2635); vectorPosX2.push_back(2635); vectorPosX2.push_back(2635); vectorPosX2.push_back(2635); vectorPosX2.push_back(2635); vectorPosX2.push_back(2635); // vectorPosY2.push_back(500); vectorPosY2.push_back(400); vectorPosY2.push_back(500); vectorPosY2.push_back(400); vectorPosY2.push_back(500); vectorPosY2.push_back(400); vectorPosY2.push_back(500); vectorPosY2.push_back(400); vectorPosY2.push_back(500); vectorPosY2.push_back(400); */ VectorDouble vectorCollisionPosX; vectorCollisionPosX.clear(); // WSI result count for (int nModuleIdx=0; nModuleIdxGetWsiUserResult(nModuleIdx); if (pWsiUserResult==NULL) continue; const SCoordInfo* pCoordInfo = Module_GetCoordInfo(nModuleIdx); if (pCoordInfo==NULL) continue; CModuleStatus* pModuleStatus = Module_GetModuleStatus(nModuleIdx); if (pModuleStatus == NULL) continue; { double dCollisionPosX = pWsiUserResult->GetCollisionPositionX() / 1000.0; double dCollisionPosY = 0.0; vectorCollisionPosX.push_back(dCollisionPosX); pCoordCalibrator->TransGlass2Motor(pCoordInfo, dCollisionPosX, dCollisionPosY); int type; if (m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->GetSingleGantryPath() == 2) { type = 1; } else if (m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->GetSingleGantryPath() == 1) { type = 0; } else { type = 1; } if (pMotorControl->GantrySetCollisionPosition(pModuleStatus->GetGantryIndex(), dCollisionPosX, dCollisionPosY, type)) { int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex()); g_pLog->DisplayMessage(_T("[Review_CollisionPos] %d Module, Addr: %d, PosX: %.3lf mm"), nModuleIdx, XAddr, dCollisionPosX); ///pGlassResult->SetCollisionXPos(nModuleIdx, dCollisionPosX); } else { int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex()); g_pLog->DisplayMessage(_T("[Collision Position Set Fail] %d Module, Addr: %d, PosX: %.3lfmm"), nModuleIdx, XAddr, dCollisionPosX); return 0; } } // get result index int nStartIdx = pWsiUserResult->GetStartSReviewResultIndex(); int nEndIdx = pWsiUserResult->GetEndSReviewResultIndex(); nEndIdx = min(nEndIdx, (pWsiUserResult->GetSReviewResultCount()-1)) + 1; // set End Index // [2017:3:8]-[WEZASW] : CameraOffset (-1~1 => -5~5) double m_dMinOffset = -5.0; double m_dMaxOffset = 5.0; // get wsi pos VectorDouble vectorPosX, vectorPosY; for (int nResultIdx=nStartIdx; nResultIdxGetSReviewResult(nResultIdx); if (pWsi==NULL) continue; // set defect pos dDefectPosX = double(pWsi->nUMOriginX) / 1000.0; dDefectPosY = double(pWsi->nUMOriginY) / 1000.0; // trans glass to motor pos pCoordCalibrator->TransGlass2Motor(pCoordInfo, dDefectPosX, dDefectPosY); // set offset ApplyMotorOffset(pWsi->nModuleIdx, -1, MotorOffsetCamera + MotorOffsetWSI, dDefectPosX, dDefectPosY); // motor calibrate CalibrateMotorPos(pWsi->nModuleIdx, dDefectPosX, dDefectPosY); // add move pos if((int)vectorPosX.size() < MAX_MOTOR_ADDRESS_SIZE) { pWsi->dTargetMotorX = dDefectPosX; pWsi->dTargetMotorY = dDefectPosY; vectorPosX.push_back(dDefectPosX); vectorPosY.push_back(dDefectPosY); } } if (m_pSP2P->ISP2P_GetReviewProcessor()->CheckMotionComplete() == FALSE) { g_pLog->DisplayMessage(_T("[GantryAutoGo] Motor IS Not Ready ")); } // move path to motor if (pMotorControl->GantryWsiAutoGo(pModuleStatus->GetGantryIndex(), vectorPosX, vectorPosY, TRUE)) //if (pMotorControl->GantryWsiAutoGo(pModuleStatus->GetGantryIndex(), vectorPosX2, vectorPosY2, TRUE)) { nTotalCount += (int)vectorPosX.size(); //nTotalCount += (int)vectorPosX2.size(); g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Success!, Point Count : %d"), pModuleStatus->GetGantryIndex(), (int)vectorPosX.size()); } else { g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Fail"), pModuleStatus->GetGantryIndex()); } } // all auto go if (pMotorControl->CommonSetAutoWsiGoAll()==FALSE) { g_pLog->DisplayMessage(_T("[GantryAutoGo] All Gantry AutoWsi Fail!")); return 0; } g_pLog->DisplayMessage(_T("[GantryAutoGo] All Gantry WsiUser Success!")); return nTotalCount; } void CSequenceProcessor_CPJT::WsiMultiShotReScheduling(CGlassResult* pGlassResult) { const CSystemInfo *pSystemInfo = m_pSP2P->ISP2P_System_GetSystemInfo(); if (pSystemInfo == NULL) return; for (int nModuleIdx = 0; nModuleIdx < Module_GetModuleStatusCount(); nModuleIdx++) { int nWSIFOVX = m_pSP2P->ISP2P_System_GetSystemInfo()->GetGantryInfo(nModuleIdx)->GetHeaderInfo(0)->GetWsiInfo(0)->GetWSIFOVX()/2; int nWSIFOVY = m_pSP2P->ISP2P_System_GetSystemInfo()->GetGantryInfo(nModuleIdx)->GetHeaderInfo(0)->GetWsiInfo(0)->GetWSIFOVY()/2; int nScandir = m_pSP2P->ISP2P_System_GetSystemInfo()->GetGantryInfo(nModuleIdx)->GetHeaderInfo(0)->GetWsiInfo(0)->GetWSIScanDir(); CReviewResult* pWsiMultiShotResult = pGlassResult->GetWsiMultiShotResult(nModuleIdx); if (pWsiMultiShotResult == NULL) continue; // get result index int nStartIdx = pWsiMultiShotResult->GetStartSReviewResultIndex(); int nEndIdx = pWsiMultiShotResult->GetEndSReviewResultIndex(); nEndIdx = min(nEndIdx, (pWsiMultiShotResult->GetSReviewResultCount() - 1)) + 1; // set End Index VectorSReviewResult m_vecSReviewResult; m_vecSReviewResult.clear(); for (int nResultIdx = nStartIdx; nResultIdx < nEndIdx; nResultIdx++) { SReviewResult* pWsi = pWsiMultiShotResult->GetSReviewResult(nResultIdx); CReviewResult* pWsiResult = pGlassResult->GetWsiResult(nModuleIdx); SReviewResult* pWsi2 = pWsiResult->GetSReviewResult(nResultIdx); if (pWsi2 == NULL) continue; if (pWsi == NULL) continue; if (pWsi2->bBigSizeDefect) { m_vecSReviewResult.push_back(*pWsi); } } pWsiMultiShotResult->GetVectorSReviewResult()->clear(); int nResultCount = 0; if (m_vecSReviewResult.size()>0) { for(int i=0; i< m_vecSReviewResult.size(); i++) { double dOringinX = m_vecSReviewResult[i].nUMOriginX; double dOringinY = m_vecSReviewResult[i].nUMOriginY; for (int nScan = 0; nScan < 4; nScan++) { double motorX=0; double motorY=0; if (nScandir == 0) { if (nScan == 3) { motorX = dOringinX + nWSIFOVX; motorY = dOringinY + nWSIFOVY; m_vecSReviewResult[i].nUMOriginX = motorX; m_vecSReviewResult[i].nUMOriginY = motorY; m_vecSReviewResult[i].nMultiShotNum = 0; m_vecSReviewResult[i].nResultIdx = nResultCount; } else if (nScan == 2) { motorX = dOringinX + nWSIFOVX; motorY = dOringinY - nWSIFOVY; m_vecSReviewResult[i].nUMOriginX = motorX; m_vecSReviewResult[i].nUMOriginY = motorY; m_vecSReviewResult[i].nMultiShotNum = 1; m_vecSReviewResult[i].nResultIdx = nResultCount; } else if (nScan == 1) { motorX = dOringinX - nWSIFOVX; motorY = dOringinY + nWSIFOVY; m_vecSReviewResult[i].nUMOriginX = motorX; m_vecSReviewResult[i].nUMOriginY = motorY; m_vecSReviewResult[i].nMultiShotNum = 2; m_vecSReviewResult[i].nResultIdx = nResultCount; } else if (nScan == 0) { motorX = dOringinX - nWSIFOVX; motorY = dOringinY - nWSIFOVY; m_vecSReviewResult[i].nUMOriginX = motorX; m_vecSReviewResult[i].nUMOriginY = motorY; m_vecSReviewResult[i].nMultiShotNum = 3; m_vecSReviewResult[i].nResultIdx = nResultCount; } } else if (nScandir == 1) { if (nScan == 0) { motorX = dOringinX + nWSIFOVX; motorY = dOringinY + nWSIFOVY; m_vecSReviewResult[i].nUMOriginX = motorX; m_vecSReviewResult[i].nUMOriginY = motorY; m_vecSReviewResult[i].nMultiShotNum = 0; m_vecSReviewResult[i].nResultIdx = nResultCount; } else if (nScan == 1) { motorX = dOringinX + nWSIFOVX; motorY = dOringinY - nWSIFOVY; m_vecSReviewResult[i].nUMOriginX = motorX; m_vecSReviewResult[i].nUMOriginY = motorY; m_vecSReviewResult[i].nMultiShotNum = 1; m_vecSReviewResult[i].nResultIdx = nResultCount; } else if (nScan == 2) { motorX = dOringinX - nWSIFOVX; motorY = dOringinY + nWSIFOVY; m_vecSReviewResult[i].nUMOriginX = motorX; m_vecSReviewResult[i].nUMOriginY = motorY; m_vecSReviewResult[i].nMultiShotNum = 2; m_vecSReviewResult[i].nResultIdx = nResultCount; } else if (nScan == 3) { motorX = dOringinX - nWSIFOVX; motorY = dOringinY - nWSIFOVY; m_vecSReviewResult[i].nUMOriginX = motorX; m_vecSReviewResult[i].nUMOriginY = motorY; m_vecSReviewResult[i].nMultiShotNum = 3; m_vecSReviewResult[i].nResultIdx = nResultCount; } } else if (nScandir == 2) { if (nScan == 1) { motorX = dOringinX + nWSIFOVX; motorY = dOringinY + nWSIFOVY; m_vecSReviewResult[i].nUMOriginX = motorX; m_vecSReviewResult[i].nUMOriginY = motorY; m_vecSReviewResult[i].nMultiShotNum = 0; m_vecSReviewResult[i].nResultIdx = nResultCount; } else if (nScan == 2) { motorX = dOringinX + nWSIFOVX; motorY = dOringinY - nWSIFOVY; m_vecSReviewResult[i].nUMOriginX = motorX; m_vecSReviewResult[i].nUMOriginY = motorY; m_vecSReviewResult[i].nMultiShotNum = 1; m_vecSReviewResult[i].nResultIdx = nResultCount; } else if (nScan == 3) { motorX = dOringinX - nWSIFOVX; motorY = dOringinY + nWSIFOVY; m_vecSReviewResult[i].nUMOriginX = motorX; m_vecSReviewResult[i].nUMOriginY = motorY; m_vecSReviewResult[i].nMultiShotNum = 2; m_vecSReviewResult[i].nResultIdx = nResultCount; } else if (nScan == 0) { motorX = dOringinX - nWSIFOVX; motorY = dOringinY - nWSIFOVY; m_vecSReviewResult[i].nUMOriginX = motorX; m_vecSReviewResult[i].nUMOriginY = motorY; m_vecSReviewResult[i].nMultiShotNum = 3; m_vecSReviewResult[i].nResultIdx = nResultCount; } } else if (nScandir == 3) { if (nScan == 2) { motorX = dOringinX + nWSIFOVX; motorY = dOringinY + nWSIFOVY; m_vecSReviewResult[i].nUMOriginX = motorX; m_vecSReviewResult[i].nUMOriginY = motorY; m_vecSReviewResult[i].nMultiShotNum = 0; m_vecSReviewResult[i].nResultIdx = nResultCount; } else if (nScan == 3) { motorX = dOringinX + nWSIFOVX; motorY = dOringinY - nWSIFOVY; m_vecSReviewResult[i].nUMOriginX = motorX; m_vecSReviewResult[i].nUMOriginY = motorY; m_vecSReviewResult[i].nMultiShotNum = 1; m_vecSReviewResult[i].nResultIdx = nResultCount; } else if (nScan == 0) { motorX = dOringinX - nWSIFOVX; motorY = dOringinY + nWSIFOVY; m_vecSReviewResult[i].nUMOriginX = motorX; m_vecSReviewResult[i].nUMOriginY = motorY; m_vecSReviewResult[i].nMultiShotNum = 2; m_vecSReviewResult[i].nResultIdx = nResultCount; } else if (nScan == 1) { motorX = dOringinX - nWSIFOVX; motorY = dOringinY - nWSIFOVY; m_vecSReviewResult[i].nUMOriginX = motorX; m_vecSReviewResult[i].nUMOriginY = motorY; m_vecSReviewResult[i].nMultiShotNum = 3; m_vecSReviewResult[i].nResultIdx = nResultCount; } } nResultCount +=1; pWsiMultiShotResult->GetVectorSReviewResult()->push_back(m_vecSReviewResult[i]); } } } } } int CSequenceProcessor_CPJT::SendWsiMultiShotPositionToMotorControl(CGlassResult* pGlassResult) { CMotorControl *pMotorControl = m_pSP2P->ISP2P_GetMotorControl(); if (pMotorControl == NULL) return 0; const CSystemInfo *pSystemInfo = m_pSP2P->ISP2P_System_GetSystemInfo(); if (pSystemInfo == NULL) return -1; const CMotorControlInfo* pMotorInfo = m_pSP2P->ISP2P_System_GetMotorInfo(); if (pMotorInfo == NULL) return -2; const CCoordCalibrator* pCoordCalibrator = m_pSP2P->ISP2P_GetCoordCalibrator(); if (pMotorInfo == NULL) return -3; // set move count zero for (int i = 0; i < pSystemInfo->GetGantryInfoCount(); i++) { pMotorControl->GantrySetMoveCount(i, 0); } // set move delay time pMotorControl->CommonSetAfDelayTime(pMotorInfo->GetAfDelayTime()); pMotorControl->CommonSetImageDelayTime(pMotorInfo->GetImageDelayTime()); pMotorControl->CommonSetWsiDelayTime(pMotorInfo->GetWsiDelayTime()); // get direction int nDirectionX, nDirectionY; pCoordCalibrator->GetTransDirection(nDirectionX, nDirectionY); int nTotalCount = 0; double dDefectPosX, dDefectPosY; VectorDouble vectorCollisionPosX; vectorCollisionPosX.clear(); // WSI result count for (int nModuleIdx = 0; nModuleIdx < Module_GetModuleStatusCount(); nModuleIdx++) { CReviewResult* pWsiMultiShotResult = pGlassResult->GetWsiMultiShotResult(nModuleIdx); if (pWsiMultiShotResult == NULL) continue; const SCoordInfo* pCoordInfo = Module_GetCoordInfo(nModuleIdx); if (pCoordInfo == NULL) continue; CModuleStatus* pModuleStatus = Module_GetModuleStatus(nModuleIdx); if (pModuleStatus == NULL) continue; { double dCollisionPosX = pWsiMultiShotResult->GetCollisionPositionX() / 1000.0; double dCollisionPosY = 0.0; vectorCollisionPosX.push_back(dCollisionPosX); pCoordCalibrator->TransGlass2Motor(pCoordInfo, dCollisionPosX, dCollisionPosY); if (pMotorControl->GantrySetCollisionPosition(pModuleStatus->GetGantryIndex(), dCollisionPosX, dCollisionPosY)) { int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex()); g_pLog->DisplayMessage(_T("[Review_CollisionPos] %d Module, Addr: %d, PosX: %.3lf mm"), nModuleIdx, XAddr, dCollisionPosX); ///pGlassResult->SetCollisionXPos(nModuleIdx, dCollisionPosX); } else { int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex()); g_pLog->DisplayMessage(_T("[Collision Position Set Fail] %d Module, Addr: %d, PosX: %.3lfmm"), nModuleIdx, XAddr, dCollisionPosX); return 0; } // get result index int nStartIdx = pWsiMultiShotResult->GetStartSReviewResultIndex(); int nEndIdx = pWsiMultiShotResult->GetEndSReviewResultIndex(); nEndIdx = min(nEndIdx, (pWsiMultiShotResult->GetSReviewResultCount() - 1)) + 1; // set End Index // [2017:3:8]-[WEZASW] : CameraOffset (-1~1 => -5~5) double m_dMinOffset = -5.0; double m_dMaxOffset = 5.0; // get wsi pos VectorDouble vectorPosX, vectorPosY; for (int nResultIdx = nStartIdx; nResultIdx < nEndIdx; nResultIdx++) { SReviewResult* pWsi = pWsiMultiShotResult->GetSReviewResult(nResultIdx); if (pWsi == NULL) continue; // set defect pos dDefectPosX = double(pWsi->nUMOriginX) / 1000.0; dDefectPosY = double(pWsi->nUMOriginY) / 1000.0; // trans glass to motor pos pCoordCalibrator->TransGlass2Motor(pCoordInfo, dDefectPosX, dDefectPosY); // set offset ApplyMotorOffset(pWsi->nModuleIdx, -1, MotorOffsetCamera + MotorOffsetWSI + MotorOffset_Glass, dDefectPosX, dDefectPosY); // motor calibrate CalibrateMotorPos(pWsi->nModuleIdx, dDefectPosX, dDefectPosY); // add move pos if ((int)vectorPosX.size() < MAX_MOTOR_ADDRESS_SIZE) { pWsi->dTargetMotorX = dDefectPosX; pWsi->dTargetMotorY = dDefectPosY; vectorPosX.push_back(dDefectPosX); vectorPosY.push_back(dDefectPosY); } } if (m_pSP2P->ISP2P_GetReviewProcessor()->CheckMotionComplete() == FALSE) { g_pLog->DisplayMessage(_T("[GantryAutoGo] Motor IS Not Ready ")); } if (pMotorControl->GantryWsiAutoGo(pModuleStatus->GetGantryIndex(), vectorPosX, vectorPosY, TRUE)) { nTotalCount += (int)vectorPosX.size(); g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Success! PointCount : %d"), pModuleStatus->GetGantryIndex(), (int)vectorPosX.size()); } else { g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Fail"), pModuleStatus->GetGantryIndex()); } } } // all auto go if (pMotorControl->CommonSetAutoWsiGoAll() == FALSE) { g_pLog->DisplayMessage(_T("[GantryAutoGo] All Gantry AutoWsi Fail!")); return 0; } g_pLog->DisplayMessage(_T("[GantryAutoGo] All Gantry AutoWsi Success!")); return nTotalCount; } BOOL CSequenceProcessor_CPJT::CalculateWsiReflowPathPlan( CPrioritySorter* pPrioritySorter, CGlassResult *pGlassResult ) { CPathScheduler *pReviewScheduler = m_pSP2P->ISP2P_GetReviewScheduler(); if (pGlassResult==NULL || pReviewScheduler==NULL || pPrioritySorter==NULL) return FALSE; int nTotalModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(); int nReviewModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(ModuleType_Wsi); int nPointCount = pPrioritySorter->GetSortingResultWsiReflowCount(); // point is zero? if (nPointCount==0) return TRUE; // get current glass pos review cameras VectorPathData vecStartPathData; for(int nIdx=0 ; nIdxGetModuleType() & ModuleType_Wsi) != ModuleType_Wsi) { continue; } const SMotorPosition* pMotorPosition = pModuleStatus->GetMotorPosition(); if (pMotorPosition==NULL) continue; SPathData ptStartPath; ptStartPath.nIndex = nIdx; // module index ptStartPath.nPosX = (LONG)(pMotorPosition->dGlassPosX * 1000); ptStartPath.nPosY = (LONG)(pMotorPosition->dGlassPosY * 1000); vecStartPathData.push_back(ptStartPath); } // get user point result VectorPathData vecPathData; for (int nPosIdx=0; nPosIdxGetSortingResultWsiReflow(nPosIdx); if (pSReviewResult==NULL) continue; SPathData pathData(pSReviewResult->nUMOriginX, pSReviewResult->nUMOriginY, pSReviewResult->nResultIdx); vecPathData.push_back(pathData); } // calculate shortest path if (pReviewScheduler->PathScheduling(vecPathData, vecStartPathData)>0) { m_pSP2P->ISP2P_DisplayMessage(_T("[ReviewScheduler] CalculatePath")); for(int nModuleIdx=0; nModuleIdxGetPathSchedulerResult(nModuleIdx); if (pScheduleResult==NULL) continue; // add reflow result pGlassResult->AddWsiReflowResult(CReviewResult(nModuleIdx)); // get user result CReviewResult *pReviewResult = pGlassResult->GetWsiReflowResult(nModuleIdx); if(pReviewResult == NULL) return FALSE; // get sreview result ReviewScheduler_ResizeWsiReflowResult(pScheduleResult, pReviewResult, pPrioritySorter, pScheduleResult->GetPathSchedulerResultCount()); // add user schedule result pGlassResult->AddWsiReflowScheduleRedult(*pScheduleResult); // CString strFilename = _T(""); // strFilename.Format(_T("c:\\%d_module_wsireflow_path.csv"), nModuleIdx); // CPathSchedulerResult::SaveResult(strFilename, *pScheduleResult); } } else { return FALSE; } return TRUE; } BOOL CSequenceProcessor_CPJT::CalculateWsiUserPathPlan( CPrioritySorter* pPrioritySorter, CGlassResult *pGlassResult ) { CPathScheduler *pReviewScheduler = m_pSP2P->ISP2P_GetReviewScheduler(); if (pGlassResult==NULL || pReviewScheduler==NULL || pPrioritySorter==NULL) return FALSE; int nTotalModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(); int nReviewModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(ModuleType_Wsi); int nPointCount = pPrioritySorter->GetSortingResultWsiUserCount(); // point is zero? if (nPointCount==0) return TRUE; // get current glass pos review cameras VectorPathData vecStartPathData; for(int nIdx=0 ; nIdxGetModuleType() & ModuleType_Wsi) != ModuleType_Wsi) { continue; } const SMotorPosition* pMotorPosition = pModuleStatus->GetMotorPosition(); if (pMotorPosition==NULL) continue; SPathData ptStartPath; ptStartPath.nIndex = nIdx; // module index ptStartPath.nPosX = (LONG)(pMotorPosition->dGlassPosX * 1000); ptStartPath.nPosY = (LONG)(pMotorPosition->dGlassPosY * 1000); vecStartPathData.push_back(ptStartPath); } // get user point result VectorPathData vecPathData; for (int nPosIdx=0; nPosIdxGetSortingResultWsiUser(nPosIdx); if (pSReviewResult==NULL) continue; SPathData pathData(pSReviewResult->nUMOriginX, pSReviewResult->nUMOriginY, pSReviewResult->nResultIdx); vecPathData.push_back(pathData); } bool use = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->GetShortestPath(); // calculate path int nSchedulingCount = 0; int type = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->GetSingleGantryPath(); pReviewScheduler->GetPathSchedulerParam()->SetSelectModuleType(type); pReviewScheduler->GetPathSchedulerParam()->SetUseShortPath(use); // calculate shortest path if (pReviewScheduler->PathScheduling(vecPathData, vecStartPathData)>0) { m_pSP2P->ISP2P_DisplayMessage(_T("[ReviewScheduler] CalculatePath")); for(int nModuleIdx=0; nModuleIdxGetPathSchedulerResult(nModuleIdx); if (pScheduleResult==NULL) continue; // add reflow result pGlassResult->AddWsiUserResult(CReviewResult(nModuleIdx)); // get user result CReviewResult *pReviewResult = pGlassResult->GetWsiUserResult(nModuleIdx); if(pReviewResult == NULL) return FALSE; // 181218 SJB, Collision XPosition Set pReviewResult->SetCollisionPostionX(pScheduleResult->GetCollisionPositionX()); // get sreview result ReviewScheduler_ResizeWsiUserResult(pScheduleResult, pReviewResult, pPrioritySorter, pScheduleResult->GetPathSchedulerResultCount()); // add user schedule result pGlassResult->AddWsiUserScheduleRedult(*pScheduleResult); double dCollisionPosX = pReviewResult->GetCollisionPositionX(); double dCollisionPosY = 0.0; pGlassResult->SetCollisionXPos(nModuleIdx, dCollisionPosX); // CString strFilename = _T(""); // strFilename.Format(_T("c:\\%d_module_wsireflow_path.csv"), nModuleIdx); // CPathSchedulerResult::SaveResult(strFilename, *pScheduleResult); } } else { return FALSE; } return TRUE; } void CSequenceProcessor_CPJT::ReviewScheduler_ResizeWsiReflowResult( CPathSchedulerResult* pScheduleResult, CReviewResult* pReviewResult, CPrioritySorter* pPrioritySorter, int nSize) { pReviewResult->Reset(); int nResultIdx = 0; int nModuleIdx = pScheduleResult->GetModuleIndex(); pReviewResult->SetModuleIndex(nModuleIdx); CModuleStatus *pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIdx); if (pModuleStatus==NULL) return; CRsRcpReviewInfo *pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if (pRsRcpReviewInfo==NULL) return; CRcpUserDefectInfo* pRcpUserDefectInfo; CRcpAFMRecipeInfo *pRcpAFMRecipeInfo = pRsRcpReviewInfo->GetRcpAFMRecipeInfo(nModuleIdx); if (pRcpAFMRecipeInfo==NULL) return; int nZoomIdx = GetRealMagnification(nModuleIdx, pRcpAFMRecipeInfo->m_nZoomIndex); SMagnificInfo *pMagnificInfo = pModuleStatus->GetMagnificInfo(nZoomIdx); SCameraInfo *pCameraInfo = pModuleStatus->GetCameraInfo(0); if (pMagnificInfo==NULL) return; if (pCameraInfo==NULL) return; CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult(); if(pGlassResult ==NULL) return; CString strGlassLastName = pGlassResult->m_strGlassLastName; for (int i=0; iGetPathSchedulerResult(i); if (pNode==NULL) continue; SReviewResult* sResult = pPrioritySorter->GetSortingResultWsiReflow(pNode->nTotalIndex); if(sResult == NULL) continue; sResult->nReviewType = ReviewType_WsiReflow; sResult->nModuleIdx = nModuleIdx; sResult->nResultIdx = nResultIdx; sResult->nZoomIdx = nZoomIdx; sResult->dMagnification = pMagnificInfo->dMagnification; sResult->dMeasureResolution = pCameraInfo->dResolution / sResult->dMagnification; sResult->bDigitalZoom = FALSE; pRcpUserDefectInfo = pRsRcpReviewInfo->GetRcpUserDefectInfo(pNode->nTotalIndex); if (pRcpUserDefectInfo == NULL) continue; if(strGlassLastName.Compare(_T("B")) == 0 || strGlassLastName.Compare(_T("b")) == 0) sResult->strCellID = pRcpUserDefectInfo->GetCellId2(); else sResult->strCellID = pRcpUserDefectInfo->GetCellId(); sResult->nReflow_CellIndex = pRcpUserDefectInfo->m_nReflowCellIndex; // Point Index Change int nWsiReflowPointIndex = ChangeWsiReflowPointIndex(pRcpUserDefectInfo->GetCellSide()); sResult->nWsiReflowPositionIndex = nWsiReflowPointIndex; pReviewResult->AddSReviewResult(*sResult); nResultIdx++; } pScheduleResult->ResizeScheduleResult(nSize); } void CSequenceProcessor_CPJT::ReviewScheduler_ResizeWsiUserResult( CPathSchedulerResult* pScheduleResult, CReviewResult* pReviewResult, CPrioritySorter* pPrioritySorter, int nSize) { pReviewResult->Reset(); int nResultIdx = 0; int nModuleIdx = pScheduleResult->GetModuleIndex(); pReviewResult->SetModuleIndex(nModuleIdx); CModuleStatus *pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIdx); if (pModuleStatus==NULL) return; CRsRcpReviewInfo *pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if (pRsRcpReviewInfo==NULL) return; CRcpUserDefectInfo* pRcpUserDefectInfo; CRcpAFMRecipeInfo *pRcpAFMRecipeInfo = pRsRcpReviewInfo->GetRcpAFMRecipeInfo(nModuleIdx); if (pRcpAFMRecipeInfo==NULL) return; int nZoomIdx = GetRealMagnification(nModuleIdx, pRcpAFMRecipeInfo->m_nZoomIndex); SMagnificInfo *pMagnificInfo = pModuleStatus->GetMagnificInfo(nZoomIdx); SCameraInfo *pCameraInfo = pModuleStatus->GetCameraInfo(0); if (pMagnificInfo==NULL) return; if (pCameraInfo==NULL) return; CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult(); if(pGlassResult ==NULL) return; CString strGlassLastName = pGlassResult->m_strGlassLastName; for (int i=0; iGetPathSchedulerResult(i); if (pNode==NULL) continue; SReviewResult* sResult = pPrioritySorter->GetSortingResultWsiUser(pNode->nTotalIndex); if(sResult == NULL) continue; sResult->nReviewType = ReviewType_WsiUser; sResult->nModuleIdx = nModuleIdx; sResult->nResultIdx = nResultIdx; sResult->nZoomIdx = nZoomIdx; sResult->dMagnification = pMagnificInfo->dMagnification; sResult->dMeasureResolution = pCameraInfo->dResolution / sResult->dMagnification; sResult->bDigitalZoom = FALSE; pRcpUserDefectInfo = pRsRcpReviewInfo->GetRcpUserDefectInfo(pNode->nTotalIndex); if (pRcpUserDefectInfo == NULL) continue; if(strGlassLastName.Compare(_T("B")) == 0 || strGlassLastName.Compare(_T("b")) == 0) sResult->strCellID = pRcpUserDefectInfo->GetCellId2(); else sResult->strCellID = pRcpUserDefectInfo->GetCellId(); sResult->nReflow_CellIndex = pRcpUserDefectInfo->m_nReflowCellIndex; // Point Index Change //int nWsiReflowPointIndex = ChangeWsiReflowPointIndex(pRcpUserDefectInfo->GetCellSide()); //sResult->nWsiReflowPositionIndex = nWsiReflowPointIndex; pReviewResult->AddSReviewResult(*sResult); nResultIdx++; } pScheduleResult->ResizeScheduleResult(nSize); } void CSequenceProcessor_CPJT::ReviewScheduler_ResizeWsiMultiShotResult(CPathSchedulerResult* pScheduleResult, CReviewResult* pReviewResult, CDefectPicker* pDefectPicker, int nSize) { pReviewResult->Reset(); int nResultIdx = 0; int nModuleIdx = pScheduleResult->GetModuleIndex(); pReviewResult->SetModuleIndex(nModuleIdx); CModuleStatus *pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIdx); if (pModuleStatus == NULL) return; CRsRcpReviewInfo *pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if (pRsRcpReviewInfo == NULL) return; CRcpAFMRecipeInfo *pRcpAFMRecipeInfo = pRsRcpReviewInfo->GetRcpAFMRecipeInfo(nModuleIdx); if (pRcpAFMRecipeInfo == NULL) return; int nZoomIdx = GetRealMagnification(nModuleIdx, pRcpAFMRecipeInfo->m_nZoomIndex); SMagnificInfo *pMagnificInfo = pModuleStatus->GetMagnificInfo(nZoomIdx); SCameraInfo *pCameraInfo = pModuleStatus->GetCameraInfo(0); if (pMagnificInfo == NULL) return; if (pCameraInfo == NULL) return; for (int i = 0; i < nSize; i++) { SSchedulerResult *pNode = pScheduleResult->GetPathSchedulerResult(i); if (pNode == NULL) continue; SReviewResult* sResult = pDefectPicker->GetPickingResultWsiMultiShot(pNode->nTotalIndex); if (sResult == NULL) continue; sResult->nReviewType = ReviewType_Wsi; sResult->nModuleIdx = nModuleIdx; sResult->nResultIdx = nResultIdx; // sResult->nZoomIdx = nZoomIdx; // sResult->dMagnification = pMagnificInfo->dMagnification; // sResult->dMeasureResolution = pCameraInfo->dResolution / sResult->dMagnification; // sResult->bDigitalZoom = FALSE; pReviewResult->AddSReviewResult(*sResult); nResultIdx++; } pScheduleResult->ResizeScheduleResult(nSize); } BOOL CSequenceProcessor_CPJT::ChangeUserReviewAxisCenterPosition(const CGlassResult *pGlassResult) { if(m_pSP2P == NULL || pGlassResult == NULL) return FALSE; const CSystemInfo *pSystemInfo = m_pSP2P->ISP2P_System_GetSystemInfo(); if(pSystemInfo == NULL) return FALSE; CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if(pRsRcpReviewInfo == NULL) return FALSE; if(pRsRcpReviewInfo->GetRcpUserDefectInfoCount() < 1) return TRUE; double dCenterPosX, dCenterPosY; CReviewProcessor* pReviewProcessor = m_pSP2P->ISP2P_GetReviewProcessor(); for(int nUseCnt=0; nUseCntGetRcpUserDefectInfoCount(); nUseCnt++) { CRcpUserDefectInfo *pUseInfo = pRsRcpReviewInfo->GetRcpUserDefectInfo(nUseCnt); if(pUseInfo == NULL) continue; double dGlassPosX = pUseInfo->m_dPosX; double dGlassPosY = pUseInfo->m_dPosY; if (pSystemInfo->m_nMachineType == 0 || pSystemInfo->m_nMachineType == 1 ||pSystemInfo->m_nMachineType == 2) { dCenterPosX = pReviewProcessor->GetCentertoOrginCoordinate(dGlassPosX*1000,-1,pGlassResult->GetCornerCutDir(),pGlassResult->GetOriginDir()); dCenterPosY = pReviewProcessor->GetCentertoOrginCoordinate(-1,dGlassPosY*1000,pGlassResult->GetCornerCutDir(),pGlassResult->GetOriginDir()); } else if(pSystemInfo->m_nMachineType == 3 || pSystemInfo->m_nMachineType == 4 || pSystemInfo->m_nMachineType == 5) { dCenterPosY = pReviewProcessor->GetCentertoOrginCoordinate(dGlassPosX*1000,-1,pGlassResult->GetCornerCutDir(),pGlassResult->GetOriginDir()); dCenterPosX = pReviewProcessor->GetCentertoOrginCoordinate(-1,dGlassPosY*1000,pGlassResult->GetCornerCutDir(),pGlassResult->GetOriginDir()); } pUseInfo->m_dPosX = dCenterPosX/= 1000.0; pUseInfo->m_dPosY = dCenterPosY/= 1000.0; } return TRUE; } void CSequenceProcessor_CPJT::RemoveMotorCount() { CMotorControl* pMotorControl = m_pSP2P->ISP2P_GetMotorControl(); if(pMotorControl == NULL) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor] MotorControl Init Fail")); return ; } const CSystemInfo *pSystemInfo = m_pSP2P->ISP2P_System_GetSystemInfo(); if(pSystemInfo == NULL) return; for(int nGantryIdx = 0; nGantryIdx < pSystemInfo->GetGantryInfoCount(); nGantryIdx++) { pMotorControl->RemoveAllAutoGoCount(nGantryIdx); } } BOOL CSequenceProcessor_CPJT::UpdateMemoryUserReflowPlanInfo(CDitGlassRawClient* pDitSharedGlassRaw) { CRsRcpReviewInfo* pRecipeinfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo(); if(pRecipeinfo == NULL) return FALSE; _grmGlassData* pSharedGlassData = pDitSharedGlassRaw->GetGlassData(); if(pSharedGlassData == NULL) return FALSE; //pSharedGlassData->m_nUserReviewNum = 0; // User plan _grmDefectData* pSharedDefect; int nPointCount = pRecipeinfo->GetRcpUserDefectInfoCount(); int nSharedDefectNum = pSharedGlassData->m_nDefectNum; int nStartIdx=nSharedDefectNum; CRcpPlanInfo* pRcpPlanInfo; CRcpUserDefectInfo *pDefectInfo; int nInsepectionType;// User Reviewreflow = 0 wsiReflow =1; REV&WSI =2; WSIUSEr =3; USER =4; int nCount = 0; for(int nPlanIndex = 0; nPlanIndex < pRecipeinfo->GetRcpPlanInfoCount(); nPlanIndex++) { nInsepectionType= -1; pRcpPlanInfo = pRecipeinfo->GetRcpPlanInfo(nPlanIndex); if(pRcpPlanInfo == NULL) continue; //=======================USERRVIEW & REFLOW & WSI Reflow & WSI User=========================================== if(pRcpPlanInfo->m_nReviewType == CPJT_PlanUser || pRcpPlanInfo->m_nReviewType == CPJT_PlanReflow || pRcpPlanInfo->m_nReviewType == CPJT_PlanWsiUser ||pRcpPlanInfo->m_nReviewType == CPJT_PlanWsiReflow) { for (int nPointIdx=0; nPointIdxGetRcpUserDefectInfo(nPointIdx); if (pDefectInfo==NULL) continue; pSharedDefect = pDitSharedGlassRaw->GetDefectData(nStartIdx); nInsepectionType =pDefectInfo->GetInspectionMode(); if(CompareRevType(nInsepectionType,pRcpPlanInfo->m_nReviewType) ) { nCount++; if (pDefectInfo==NULL) continue; pSharedDefect->clear(); pSharedDefect->m_nDefectIdx = nStartIdx; pSharedDefect->m_nUMOriginX = int(pDefectInfo->m_dPosX*1000.0); pSharedDefect->m_nUMOriginY = int(pDefectInfo->m_dPosY*1000.0); pSharedDefect->m_nUMCenterAlignX = pSharedDefect->m_nUMOriginX - pSharedGlassData->m_nGlassSizeWidth/2; pSharedDefect->m_nUMCenterAlignY = pSharedDefect->m_nUMOriginY - pSharedGlassData->m_nGlassSizeHeight/2; pSharedDefect->m_ReviewDefect.m_nReflow_Index = nPointIdx; pDefectInfo->m_nSharedDefectIndex = nStartIdx; if(pRcpPlanInfo->m_nReviewType==CPJT_PlanUser)pSharedDefect->m_ReviewDefect.m_nPlanType = ditRaw::RPT_User; else if(pRcpPlanInfo->m_nReviewType== CPJT_PlanReflow)pSharedDefect->m_ReviewDefect.m_nPlanType = ditRaw::RTP_Reflow; else if(pRcpPlanInfo->m_nReviewType== CPJT_PlanWsiUser)pSharedDefect->m_ReviewDefect.m_nPlanType = ditRaw::RTP_UserWsi; else pSharedDefect->m_ReviewDefect.m_nPlanType = ditRaw::RTP_WsiReflow; nStartIdx++; } else { continue; } } } } //pSharedGlassData->m_nUserReviewNum = nCount; //m_pSP2P->ISP2P_DisplayMessage(_T("Fix Position Add Count : %d!!"), pSharedGlassData->m_nUserReviewNum); return TRUE; } BOOL CSequenceProcessor_CPJT::CompareRevType(int nInsType,int nRevType) { //Plan InspectionMode if(nRevType == CPJT_PlanUser) { if(nInsType == USER) return TRUE; } else if (nRevType == CPJT_PlanReflow) { if(nInsType == REVIEW_REFLOW) return TRUE; } else if (nRevType == CPJT_PlanWsiReflow) { if(nInsType == WSI_REFLOW) return TRUE; } else if(nRevType== CPJT_PlanWsiUser) { if(nInsType == WSIUSER) return TRUE; } else if (nRevType == CPJT_PlanWsiMultiShot) { if (nInsType == WSIMULTISHOT) return TRUE; } else { return FALSE; } return FALSE; } void CSequenceProcessor_CPJT::AllAckSignalOff() { if(m_pSP2P == NULL) return; m_pSP2P->ISP2P_DisplayMessage(_T("==========================Ack Signal All Off Start!!")); for (int i = 0; i < PCControlRecv_ReviewAckSignalCount;i++) { RecvSignalToSignalControl(PCControlRecvSignalIndex_Ack,i,TRUE); } for (int i = 0; i < PCControlSendSignalAckCount;i++) { SendSignalOffToSignalControl(PCControlSendSignalIndex_Ack, i); } m_pSP2P->ISP2P_DisplayMessage(_T("==========================Ack Signal All Off End!!")); SendSignalOffToSignalControl(PCControlSendSignalIndex_State,PCControlSend_RecipeASCEND); //190723 recipe ASCEND bit off } void CSequenceProcessor_CPJT::WriteRawData(CGlassResult* pGlassResult) { g_pLog->DisplayMessage(_T("[Process_ReviewEnd] Result FILE WRITE IN")); const CNetworkInfo *pNetworkInfo = m_pSP2P->ISP2P_System_GetNetworkInfo(); if (pNetworkInfo==NULL) return; CString strMessage, strResultFilePath, strUploadResultFilePath, strLocalRawPath; CString strUploadRawPath, strUploadImagePath, strAOIRawFileName, strAOIRawFilePath; //3-1. m_pSP2P->ISP2P_SetReviewResultData(pGlassResult); strLocalRawPath = pNetworkInfo->m_strLocalRawPath; strUploadRawPath = pNetworkInfo->m_strUploadRawPath; strUploadImagePath = pNetworkInfo->m_strUploadImagePath; strAOIRawFileName = pGlassResult->m_strAOIRawFileName; strAOIRawFilePath = pGlassResult->m_strAOIRawFilePath; if(strLocalRawPath.IsEmpty() == FALSE && strAOIRawFileName.IsEmpty() == FALSE) { // TD if (pGlassResult->m_strResultDate.GetLength()>0) { strResultFilePath.Format(_T("%s\\%s\\%s"), strLocalRawPath, pGlassResult->m_strResultDate, strAOIRawFileName); // here mch } else { strResultFilePath.Format(_T("%s\\%s"), strLocalRawPath, strAOIRawFileName); // here mch } if(m_pSP2P->ISP2P_WriteGlassResultToAOIRawFile(pGlassResult, strResultFilePath, RESULT_FILE_TD)) { m_pSP2P->ISP2P_DisplayMessage(_T("[TD] %s Result File Write Success!"), strResultFilePath);// if(strUploadRawPath.IsEmpty() == FALSE && strAOIRawFilePath.IsEmpty() == FALSE) { // [2017:5:16]-[WEZASW] : strUploadResultFilePath.Format(_T("%s\\%s"), strUploadRawPath, strAOIRawFileName); if(CopyFile(strResultFilePath, strUploadResultFilePath, FALSE)) { m_pSP2P->ISP2P_DisplayMessage(_T("[TD]Result File Upload Success![%s]"), strUploadResultFilePath);// } else { m_pSP2P->ISP2P_DisplayMessage(_T("[TD]Result File Upload Fail! Src[%s]"), strResultFilePath);// m_pSP2P->ISP2P_DisplayMessage(_T("[TD]Result File Upload Fail! Dst[%s]"), strUploadResultFilePath); } } } else { m_pSP2P->ISP2P_DisplayMessage(_T("[TD]%s Result File Write Fail!"), strResultFilePath); } } // delete file of Glass direction DeleteFile(pNetworkInfo->m_strAOIRawPath + _T("\\") + pGlassResult->m_strJobID + _T("TD"));//pGlassResult->m_strGlassID -> m_StrJobID // [2017:4:11]-[WEZASW] :CIM(DV Data) if (SendDVDataToSignalControl()==FALSE) { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] DV Data Send FAIL!")); } else { m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] DV Data Send Success!")); } } BOOL CSequenceProcessor_CPJT::SendReviewStartMotorPosition( int nModuleIndex,double dPosX,double dPosY,int nMoveAxis ) { return m_pSP2P->ISP2P_Motor_CameraGo(nModuleIndex,dPosX,dPosY,nMoveAxis); } BOOL CSequenceProcessor_CPJT::MoveReviewStartMotorPosition(CGlassResult* pGlassResult,int nReviewType) { double dDefectPosX,dDefectPosY = 0; if(nReviewType == CPJT_PlanReview){ CReviewResult* pReviewResult = pGlassResult->GetReviewResult(0); if(pReviewResult==NULL) return FALSE; int nStartIdx = pReviewResult->GetStartSReviewResultIndex(); SReviewResult* pRev = pReviewResult->GetSReviewResult(nStartIdx); if (pRev==NULL) return FALSE; dDefectPosX = double(pRev->nUMOriginX) / 1000.0; dDefectPosY = double(pRev->nUMOriginY) / 1000.0; } else if(nReviewType == CPJT_PlanUser){ CReviewResult* pReviewResult = pGlassResult->GetUserResult(0); if(pReviewResult==NULL) return FALSE; int nStartIdx = pReviewResult->GetStartSReviewResultIndex(); SReviewResult* pRev = pReviewResult->GetSReviewResult(nStartIdx); if (pRev==NULL) return FALSE; dDefectPosX = double(pRev->nUMOriginX) / 1000.0; dDefectPosY = double(pRev->nUMOriginY) / 1000.0; } else if(nReviewType == CPJT_PlanMeasure) { CReviewResult* pReviewResult = pGlassResult->GetMeasureResult(0); if(pReviewResult==NULL) return FALSE; int nStartIdx = pReviewResult->GetStartSReviewResultIndex(); SReviewResult* pRev = pReviewResult->GetSReviewResult(nStartIdx); if (pRev==NULL) return FALSE; dDefectPosX = double(pRev->nUMOriginX) / 1000.0; dDefectPosY = double(pRev->nUMOriginY) / 1000.0; } else if(nReviewType == CPJT_PlanReflow) { CReviewResult* pReviewResult = pGlassResult->GetReflowResult(0); if(pReviewResult==NULL) return FALSE; int nStartIdx = pReviewResult->GetStartSReviewResultIndex(); SReviewResult* pRev = pReviewResult->GetSReviewResult(nStartIdx); if (pRev==NULL) return FALSE; dDefectPosX = double(pRev->nUMOriginX) / 1000.0; dDefectPosY = double(pRev->nUMOriginY) / 1000.0; } return SendReviewStartMotorPosition(0,dDefectPosX+1,dDefectPosY+1,0); } void CSequenceProcessor_CPJT::SendWsiErrorAlarm_CPJT(int Index) //190801 chm { //wsi if(Index==1) { g_pLog->DisplayMessage(_T("[SequenceProcessor_CPJT] WSI Alive Error!!!")); } else { g_pLog->DisplayMessage(_T("[SequenceProcessor_CPJT] WSI Error!!!")); } SendSignalToSignalControl(PCControlSendSignalIndex_State,PCControlSend_WSIError,1000); } void CSequenceProcessor_CPJT::SendWsiAlive_CPJT()//190801 chm { //WSI Alive SetWSIAliveCheck(TRUE); } void CSequenceProcessor_CPJT::WSIAliveCheckRunThread_CPJT() //190801 chm { CWinThread *pThread =NULL; pThread = AfxBeginThread(WsiAliveCheckThread,this); } UINT CSequenceProcessor_CPJT::WsiAliveCheckThread( LPVOID pParam )//190801 chm { DWORD dwTick = GetTickCount(); CSequenceProcessor_CPJT * m_pCSPC =(CSequenceProcessor_CPJT*) pParam; while(1) { if(GetTickCount()-dwTick >=30000) { dwTick = GetTickCount(); if(bWsiAliveCheck ==FALSE){ m_pCSPC->SendWsiErrorAlarm_CPJT(1); } bWsiAliveCheck=FALSE; } } return 1; } BOOL CSequenceProcessor_CPJT:: bWsiAliveCheck;