#include "StdAfx.h"
|
#include "ReviewProcessor_CPJT.h"
|
#include "ModuleStatus.h"
|
#include "ResultServerControl.h"
|
#include "CameraControlReview.h"
|
#include "CHImageControls/CHImageProcess.h"
|
#include "CHMotorControls/MotorControl.h"
|
#include "CHSignalControls/SignalControl.h"
|
|
#include "CHEdgeTriangle/EdgeTriangle.h"
|
#include "CHEdgeTriangle/RecipeManager.h"
|
#include "CHReviewRecipe/RsRcpReviewInfo.h"
|
#include "DitGlassRawClient.h"
|
#include "LineChecker/LineChecker.h"
|
enum StackInfo { Stack_Unknown = 0, Stack_TD, Stack_SD, Stack_PD, Stack_SP, Stack_CD };
|
using namespace CHImageControls;
|
|
CReviewProcessor_CPJT::CReviewProcessor_CPJT(int nThreadCount) : CReviewProcessor(nThreadCount)
|
{
|
bProcessSuccess[CPJT_REVIEW_SUCCESS] = FALSE;
|
bProcessSuccess[CPJT_MEASURE_SUCCESS] = FALSE;
|
bProcessSuccess[CPJT_WSI_SUCCESS] = FALSE;
|
bProcessSuccess[CPJT_REFLOW_SUCCESS] = FALSE;
|
|
InitializeCriticalSection(&m_csUserCriticalSection);
|
|
ErrorStringCode[0].Insert(0,_T("ImageFailModel"));
|
ErrorStringCode[1].Insert(1,_T("ImageFailSource"));
|
ErrorStringCode[2].Insert(2,_T("ImageFailSub"));
|
ErrorStringCode[3].Insert(3,_T("ImageFailBandModel"));
|
ErrorStringCode[4].Insert(4,_T("ImageFailBandSource"));
|
ErrorStringCode[5].Insert(5,_T("RecipeFailModel"));
|
ErrorStringCode[6].Insert(6,_T("RecipeFailMarker"));
|
ErrorStringCode[7].Insert(7,_T("RecipeFailFormula"));
|
ErrorStringCode[8].Insert(8,_T("ProcessFailModel"));
|
ErrorStringCode[9].Insert(9,_T("ProcessFailMarker"));
|
ErrorStringCode[10].Insert(10,_T("ProcessFailFormula"));
|
ErrorStringCode[11].Insert(11,_T("ResultFailModel"));
|
ErrorStringCode[12].Insert(12,_T("ResultFailMarker"));
|
ErrorStringCode[13].Insert(13,_T("ResultFailFormula"));
|
ErrorStringCode[14].Insert(14,_T("EdgeFailLeft"));
|
ErrorStringCode[15].Insert(15,_T("EdgeFailRight"));
|
ErrorStringCode[16].Insert(16,_T("PreProcessFail"));
|
ErrorStringCode[17].Insert(17,_T("CircleCoefficientFail"));
|
ErrorStringCode[18].Insert(18,_T("ProcessSuccess"));
|
ErrorStringCode[19].Insert(19,_T("ProcessNone"));
|
}
|
|
CReviewProcessor_CPJT::~CReviewProcessor_CPJT(void)
|
{
|
DeleteCriticalSection(&m_csUserCriticalSection);
|
}
|
|
void CReviewProcessor_CPJT::AddWsiResultData(int nModuleIndex, const SWsiResult& measureResut)
|
{
|
SReviewResult wsiResult;
|
|
if (GetReviewProcessStatus()!=ReviewProcessStatus_WSIStart)
|
{
|
goto RESULT_FAIL;
|
}
|
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]WsiResult : Module[%d] Result[%d]"), nModuleIndex, measureResut.nResultIndex);
|
|
CGlassResult *pGlassResult = m_pRP2P->IRP2P_GetCurrentGlassResult();
|
if (pGlassResult==NULL) goto RESULT_FAIL;
|
|
DWORD dwCurTick = GetTickCount(); // save tick count
|
m_ProcessTimer.End(); // end process timer
|
|
// get review result
|
CReviewResult* pReviewResult = pGlassResult->GetWsiResult(nModuleIndex);
|
if (pReviewResult==NULL) goto RESULT_FAIL;
|
|
// get grab position
|
const SMotorPosition *pPosition = Module_GetMotorPosition(nModuleIndex);
|
if (pPosition==NULL) goto RESULT_FAIL;
|
int nGlassPosX = int(pPosition->dGlassPosX * 1000.0);
|
int nGlassPosY = int(pPosition->dGlassPosY * 1000.0);
|
int nMotorPosX = int(pPosition->dMotorPosX * 1000.0);
|
int nMotorPosY = int(pPosition->dMotorPosY * 1000.0);
|
double dTime = (double) m_ProcessTimer.GetDurationMilliSecond();
|
|
EnterCriticalSection(&m_csUserCriticalSection);
|
|
// get last result idx + 1
|
int nCurResultIdx = pReviewResult->GetLastSReviewResultIndex() + 1;
|
int nStartResultIdx = pReviewResult->GetStartSReviewResultIndex();
|
int nEndResultIdx = pReviewResult->GetEndSReviewResultIndex();
|
|
|
if (nCurResultIdx > nEndResultIdx)
|
{
|
LeaveCriticalSection(&m_csUserCriticalSection);
|
goto RESULT_FAIL;
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]SetWsiResultData module[%d] point[%d] result[%d]"), nModuleIndex, measureResut.nResultIndex, nCurResultIdx);
|
}
|
|
|
wsiResult.nWsi_ResultIndex = measureResut.nResultIndex;
|
wsiResult.nResultCode = measureResut.nResultCode;
|
wsiResult.nGlassType = measureResut.nGlassType;
|
|
switch (wsiResult.nGlassType)
|
{
|
|
case 0://TFE
|
wsiResult.nWsi_Type = measureResut.bObjectType;
|
wsiResult.bBigSizeDefect = measureResut.bBigSizeDefect;
|
wsiResult.fHeight = measureResut.fHeight;
|
wsiResult.fWidthX = measureResut.fWidthX;
|
wsiResult.fWidthY = measureResut.fWidthY;
|
wsiResult.fAratio = measureResut.fAratio;
|
break;
|
case 1: //MN
|
wsiResult.nDecisionZoneA = measureResut.nDecisionZoneA;
|
wsiResult.nDecisionZoneB = measureResut.nDecisionZoneB;
|
wsiResult.nDecisionZoneC = measureResut.nDecisionZoneC;
|
wsiResult.nDecisionZoneD = measureResut.nDecisionZoneD;
|
wsiResult.nDecisionZoneE = measureResut.nDecisionZoneE;
|
wsiResult.nDecisionZoneF = measureResut.nDecisionZoneF;
|
wsiResult.nPointIndex = measureResut.nPointIndex;
|
wsiResult.nDecisionZoneSlotB = measureResut.nDecisionZoneSlotB;
|
wsiResult.dDistFromRef = measureResut.dDistFromRef;
|
break;
|
case 2: //QD
|
wsiResult.nJugementR = measureResut.nJugementR;
|
wsiResult.nJugementG = measureResut.nJugementG;
|
wsiResult.nJugementB = measureResut.nJugementB;
|
wsiResult.dRZoneHeight = measureResut.dRZoneHeight;
|
wsiResult.dGZoneHeight = measureResut.dGZoneHeight;
|
wsiResult.dBZoneHeight = measureResut.dBZoneHeight;
|
wsiResult.dDefectHeight = measureResut.dDefectHeight;
|
wsiResult.nWsi_DefectType = measureResut.nDefectType;
|
|
// g_pLog->DisplayMessage(_T("[ReviewProcessor]JugementR [%d] JugementG [%d] JugementB [%d]"), wsiResult.nJugementR, wsiResult.nJugementG, wsiResult.nJugementB);
|
// g_pLog->DisplayMessage(_T("[ReviewProcessor]RZoneHeight [%.03lf] GZoneHeight [%.03lf] BZoneHeight [%.03lf]"), wsiResult.dRZoneHeight, wsiResult.dGZoneHeight, wsiResult.dBZoneHeight);
|
|
break;
|
case 3: //BANK
|
wsiResult.dRZoneHeight = measureResut.dRZoneHeight;
|
wsiResult.dGZoneHeight = measureResut.dGZoneHeight;
|
wsiResult.dBZoneHeight = measureResut.dBZoneHeight;
|
wsiResult.dDefectHeight = measureResut.dDefectHeight;
|
wsiResult.nWsi_DefectType = measureResut.nDefectType;
|
|
break;
|
case 4: //CS
|
wsiResult.dCSHeight = measureResut.dCSHeight;
|
wsiResult.dDefectHeight = measureResut.dDefectHeight;
|
wsiResult.nWsi_DefectType = measureResut.nDefectType;
|
|
break;
|
}
|
|
wsiResult.nWsi_SlopeWarn = measureResut.nXSlopeWarn;
|
|
memcpy(wsiResult.pWsi_ResultData, measureResut.pResultData, sizeof(wsiResult.pWsi_ResultData));
|
|
SReviewResult *pProcessResult = NULL;
|
if (pGlassResult->SetWsiResultData(nModuleIndex, nCurResultIdx, wsiResult, nGlassPosX, nGlassPosY, nMotorPosX, nMotorPosY, dTime))
|
{
|
// [2017.6.20 bhs]
|
//pProcessResult = pGlassResult->GetSReviewResult(nModuleIhomendex, nCurResultIdx);
|
|
pProcessResult = pReviewResult->GetSReviewResult(nCurResultIdx);
|
}
|
|
if (pProcessResult)
|
{
|
if (AddReviewProcessData(pProcessResult)==1)
|
{
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]Add Process Data module[%d] result[%d]"), nModuleIndex, nCurResultIdx);
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]Add FAIL Process Data module[%d] result[%d]"), nModuleIndex, nCurResultIdx);
|
}
|
|
// set last result idx
|
pReviewResult->SetLastSReviewResultIndex(nCurResultIdx);
|
}
|
|
LeaveCriticalSection(&m_csUserCriticalSection);
|
|
m_pRP2P->IRP2P_UpdateReviewResult(nModuleIndex, pGlassResult);
|
return;
|
|
RESULT_FAIL:
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]WsiResult FAIL! module[%d] result[%d]"), nModuleIndex, measureResut.nResultIndex);
|
return;
|
}
|
void CReviewProcessor_CPJT::AddWsiUserResultData(int nModuleIndex, const SWsiResult& measureResut)
|
{
|
SReviewResult wsiUserResult;
|
|
if (GetReviewProcessStatus()!=ReviewProcessStatus_WSIStart)
|
{
|
goto RESULT_FAIL;
|
}
|
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]WsiResult : Module[%d] Result[%d]"), nModuleIndex, measureResut.nResultIndex);
|
|
CGlassResult *pGlassResult = m_pRP2P->IRP2P_GetCurrentGlassResult();
|
if (pGlassResult==NULL) goto RESULT_FAIL;
|
|
DWORD dwCurTick = GetTickCount(); // save tick count
|
m_ProcessTimer.End(); // end process timer
|
|
// get review result
|
CReviewResult* pReviewResult = pGlassResult->GetWsiUserResult(nModuleIndex);
|
if (pReviewResult==NULL) goto RESULT_FAIL;
|
|
// get grab position
|
const SMotorPosition *pPosition = Module_GetMotorPosition(nModuleIndex);
|
if (pPosition==NULL) goto RESULT_FAIL;
|
int nGlassPosX = int(pPosition->dGlassPosX * 1000.0);
|
int nGlassPosY = int(pPosition->dGlassPosY * 1000.0);
|
int nMotorPosX = int(pPosition->dMotorPosX * 1000.0);
|
int nMotorPosY = int(pPosition->dMotorPosY * 1000.0);
|
double dTime = (double) m_ProcessTimer.GetDurationMilliSecond();
|
|
EnterCriticalSection(&m_csUserCriticalSection);
|
|
// get last result idx + 1
|
int nCurResultIdx = pReviewResult->GetLastSReviewResultIndex() + 1;
|
int nStartResultIdx = pReviewResult->GetStartSReviewResultIndex();
|
int nEndResultIdx = pReviewResult->GetEndSReviewResultIndex();
|
|
|
if (nCurResultIdx > nEndResultIdx)
|
{
|
LeaveCriticalSection(&m_csUserCriticalSection);
|
goto RESULT_FAIL;
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]SetWsiResultData module[%d] point[%d] result[%d]"), nModuleIndex, measureResut.nResultIndex, nCurResultIdx);
|
}
|
|
wsiUserResult.nWsi_ResultCode = measureResut.nResultCode;
|
wsiUserResult.nWsi_Type = measureResut.nResultType;
|
wsiUserResult.nWsi_SlopeWarn = measureResut.nXSlopeWarn;
|
memcpy(wsiUserResult.pWsi_ResultData, measureResut.pResultData, sizeof(wsiUserResult.pWsi_ResultData));
|
|
|
SReviewResult *pProcessResult = NULL;
|
if (pGlassResult->SetUserWsiResultData(nModuleIndex, nCurResultIdx, wsiUserResult, nGlassPosX, nGlassPosY, nMotorPosX, nMotorPosY, dTime))
|
{
|
// [2017.6.20 bhs]
|
//pProcessResult = pGlassResult->GetSReviewResult(nModuleIndex, nCurResultIdx);
|
|
pProcessResult = pReviewResult->GetSReviewResult(nCurResultIdx);
|
}
|
|
if (pProcessResult)
|
{
|
if (AddReviewProcessData(pProcessResult)==1)
|
{
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]Add Process Data module[%d] result[%d]"), nModuleIndex, nCurResultIdx);
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]Add FAIL Process Data module[%d] result[%d]"), nModuleIndex, nCurResultIdx);
|
}
|
|
// set last result idx
|
pReviewResult->SetLastSReviewResultIndex(nCurResultIdx);
|
}
|
|
LeaveCriticalSection(&m_csUserCriticalSection);
|
|
m_pRP2P->IRP2P_UpdateReviewResult(nModuleIndex, pGlassResult);
|
return;
|
|
RESULT_FAIL:
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]WsiResult FAIL! module[%d] result[%d]"), nModuleIndex, measureResut.nResultIndex);
|
return;
|
}
|
|
|
|
void CReviewProcessor_CPJT::AddWsiVLSIResultData(int nModuleIndex, const SWsiResult& measureResut)
|
{
|
measureResut.dAccuracy;
|
measureResut.dRepeatability;
|
}
|
|
void CReviewProcessor_CPJT::AddWsiMultiShotResultData(int nModuleIndex, const SWsiResult& measureResut)
|
{
|
SReviewResult wsiResult;
|
|
if (GetReviewProcessStatus() != ReviewProcessStatus_WSIMultiShotStart)
|
{
|
goto RESULT_FAIL;
|
}
|
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]WsiMultiShotResult : Module[%d] Result[%d]"), nModuleIndex, measureResut.nResultIndex);
|
|
CGlassResult *pGlassResult = m_pRP2P->IRP2P_GetCurrentGlassResult();
|
if (pGlassResult == NULL) goto RESULT_FAIL;
|
|
DWORD dwCurTick = GetTickCount(); // save tick count
|
m_ProcessTimer.End(); // end process timer
|
|
// get review result
|
CReviewResult* pReviewResult = pGlassResult->GetWsiMultiShotResult(nModuleIndex);
|
if (pReviewResult == NULL) goto RESULT_FAIL;
|
|
// get grab position
|
const SMotorPosition *pPosition = Module_GetMotorPosition(nModuleIndex);
|
if (pPosition == NULL) goto RESULT_FAIL;
|
int nGlassPosX = int(pPosition->dGlassPosX * 1000.0);
|
int nGlassPosY = int(pPosition->dGlassPosY * 1000.0);
|
int nMotorPosX = int(pPosition->dMotorPosX * 1000.0);
|
int nMotorPosY = int(pPosition->dMotorPosY * 1000.0);
|
double dTime = (double)m_ProcessTimer.GetDurationMilliSecond();
|
|
EnterCriticalSection(&m_csUserCriticalSection);
|
|
// get last result idx + 1
|
int nCurResultIdx = pReviewResult->GetLastSReviewResultIndex() + 1;
|
int nStartResultIdx = pReviewResult->GetStartSReviewResultIndex();
|
int nEndResultIdx = pReviewResult->GetEndSReviewResultIndex();
|
|
|
if (nCurResultIdx > nEndResultIdx)
|
{
|
LeaveCriticalSection(&m_csUserCriticalSection);
|
goto RESULT_FAIL;
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]SetWsiMultiShotResultData module[%d] point[%d] result[%d]"), nModuleIndex, measureResut.nResultIndex, nCurResultIdx);
|
}
|
|
wsiResult.nWsi_ResultCode = measureResut.nResultCode;
|
wsiResult.nWsi_Type = measureResut.nResultType;
|
wsiResult.nWsi_SlopeWarn = measureResut.nXSlopeWarn;
|
wsiResult.bBigSizeDefect = measureResut.bBigSizeDefect;
|
memcpy(wsiResult.pWsi_ResultData, measureResut.pResultData, sizeof(wsiResult.pWsi_ResultData));
|
|
|
SReviewResult *pProcessResult = NULL;
|
if (pGlassResult->SetWsiResultData(nModuleIndex, nCurResultIdx, wsiResult, nGlassPosX, nGlassPosY, nMotorPosX, nMotorPosY, dTime))
|
{
|
// [2017.6.20 bhs]
|
//pProcessResult = pGlassResult->GetSReviewResult(nModuleIndex, nCurResultIdx);
|
|
pProcessResult = pReviewResult->GetSReviewResult(nCurResultIdx);
|
}
|
|
if (pProcessResult)
|
{
|
if (AddReviewProcessData(pProcessResult) == 1)
|
{
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]Add Process Data module[%d] result[%d]"), nModuleIndex, nCurResultIdx);
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]Add FAIL Process Data module[%d] result[%d]"), nModuleIndex, nCurResultIdx);
|
}
|
|
// set last result idx
|
pReviewResult->SetLastSReviewResultIndex(nCurResultIdx);
|
}
|
|
LeaveCriticalSection(&m_csUserCriticalSection);
|
m_pRP2P->IRP2P_UpdateReviewResult(nModuleIndex, pGlassResult);
|
return;
|
|
RESULT_FAIL:
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]WsiResult FAIL! module[%d] result[%d]"), nModuleIndex, measureResut.nResultIndex);
|
return;
|
}
|
|
void CReviewProcessor_CPJT::AddCameraImageData(int nModuleIndex, int nResultIndex, VectorImageData& vectorImageData)
|
{
|
if (GetReviewProcessStatus()!=ReviewProcessStatus_ReviewStart && GetReviewProcessStatus()!=ReviewProcessStatus_UserStart
|
&& GetReviewProcessStatus()!=ReviewProcessStatus_MeasureStart && GetReviewProcessStatus()!=ReviewProcessStatus_ReflowStart
|
&& GetReviewProcessStatus()!=ReviewProcessStatus_WSIStart && GetReviewProcessStatus()!=ReviewProcessStatus_WSIReflowStart
|
&& GetReviewProcessStatus()!=ReviewProcessStatus_WSIUserStart && GetReviewProcessStatus() != ReviewProcessStatus_WSIMultiShotStart)
|
{
|
goto RESULT_FAIL;
|
}
|
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]ReviewResult : Module[%d] Result[%d]"), nModuleIndex, nResultIndex);
|
|
CGlassResult *pGlassResult = m_pRP2P->IRP2P_GetCurrentGlassResult();
|
if (pGlassResult==NULL) goto RESULT_FAIL;
|
|
DWORD dwCurTick = GetTickCount(); // save tick count
|
m_ProcessTimer.End(); // end process timer
|
|
// get review result
|
CReviewResult* pReviewResult = NULL;
|
switch(GetReviewProcessStatus())
|
{
|
case ReviewProcessStatus_ReviewStart:
|
pReviewResult = pGlassResult->GetReviewResult(nModuleIndex);
|
break;
|
case ReviewProcessStatus_UserStart:
|
pReviewResult = pGlassResult->GetUserResult(nModuleIndex);
|
break;
|
case ReviewProcessStatus_MeasureStart:
|
pReviewResult = pGlassResult->GetMeasureResult(nModuleIndex);
|
break;
|
case ReviewProcessStatus_WSIStart:
|
pReviewResult = pGlassResult->GetWsiResult(nModuleIndex);
|
break;
|
case ReviewProcessStatus_ReflowStart:
|
pReviewResult = pGlassResult->GetReflowResult(nModuleIndex);
|
break;
|
case ReviewProcessStatus_WSIReflowStart:
|
pReviewResult = pGlassResult->GetWsiReflowResult(nModuleIndex);
|
break;
|
case ReviewProcessStatus_WSIUserStart:
|
pReviewResult = pGlassResult->GetWsiUserResult(nModuleIndex);
|
break;
|
case ReviewProcessStatus_WSIMultiShotStart :
|
pReviewResult = pGlassResult->GetWsiMultiShotResult(nModuleIndex);
|
break;
|
}
|
|
if (pReviewResult==NULL) goto RESULT_FAIL;
|
|
// get grab position
|
const SMotorPosition *pPosition = Module_GetMotorPosition(nModuleIndex);
|
if (pPosition==NULL) goto RESULT_FAIL;
|
int nGlassPosX = int(pPosition->dGlassPosX * 1000.0);
|
int nGlassPosY = int(pPosition->dGlassPosY * 1000.0);
|
int nMotorPosX = int(pPosition->dMotorPosX * 1000.0);
|
int nMotorPosY = int(pPosition->dMotorPosY * 1000.0);
|
double dTime = (double) m_ProcessTimer.GetDurationMilliSecond();
|
|
EnterCriticalSection(&m_csUserCriticalSection);
|
|
// get last result idx + 1
|
int nCurResultIdx = pReviewResult->GetLastSReviewResultIndex() + 1;
|
int nStartResultIdx = pReviewResult->GetStartSReviewResultIndex();
|
int nEndResultIdx = pReviewResult->GetEndSReviewResultIndex();
|
|
if (nCurResultIdx > nEndResultIdx)
|
{
|
LeaveCriticalSection(&m_csUserCriticalSection);
|
goto RESULT_FAIL;
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]SetReviewResultData module[%d] point[%d] result[%d]"), nModuleIndex, nResultIndex, nCurResultIdx);
|
}
|
|
SReviewResult *pProcessResult = NULL;
|
switch(GetReviewProcessStatus())
|
{
|
case ReviewProcessStatus_ReviewStart:
|
if (pGlassResult->SetReviewResultData(nModuleIndex, nCurResultIdx, vectorImageData, nGlassPosX, nGlassPosY, nMotorPosX, nMotorPosY, dTime))
|
{
|
pProcessResult = pGlassResult->GetSReviewResult(nModuleIndex, nCurResultIdx);
|
}
|
break;
|
|
case ReviewProcessStatus_UserStart:
|
if (pGlassResult->SetUserResultData(nModuleIndex, nCurResultIdx, vectorImageData, nGlassPosX, nGlassPosY, nMotorPosX, nMotorPosY, dTime))
|
{
|
pProcessResult = pGlassResult->GetSUserResult(nModuleIndex, nCurResultIdx);
|
}
|
break;
|
|
case ReviewProcessStatus_MeasureStart:
|
if (pGlassResult->SetMeasureResultData(nModuleIndex, nCurResultIdx, vectorImageData, nGlassPosX, nGlassPosY, nMotorPosX, nMotorPosY, dTime))
|
{
|
pProcessResult = pGlassResult->GetSMeasureResult(nModuleIndex, nCurResultIdx);
|
}
|
break;
|
|
case ReviewProcessStatus_WSIStart:
|
|
break;
|
case ReviewProcessStatus_ReflowStart:
|
if (pGlassResult->SetReflowResultData(nModuleIndex, nCurResultIdx, vectorImageData, nGlassPosX, nGlassPosY, nMotorPosX, nMotorPosY, dTime))
|
{
|
pProcessResult = pGlassResult->GetSReflowResult(nModuleIndex, nCurResultIdx);
|
}
|
break;
|
case ReviewProcessStatus_WSIReflowStart:
|
|
break;
|
case ReviewProcessStatus_WSIUserStart:
|
|
break;
|
case ReviewProcessStatus_WSIMultiShotStart:
|
break;
|
}
|
|
if (pProcessResult)
|
{
|
if (AddReviewProcessData(pProcessResult)==1)
|
{
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]Add Process Data module[%d] result[%d]"), nModuleIndex, nCurResultIdx);
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]Add FAIL Process Data module[%d] result[%d]"), nModuleIndex, nCurResultIdx);
|
}
|
|
// set last result idx
|
pReviewResult->SetLastSReviewResultIndex(nCurResultIdx);
|
}
|
LeaveCriticalSection(&m_csUserCriticalSection);
|
|
if (nCurResultIdx + 1== pReviewResult->GetSReviewResultCount())
|
{
|
if (nModuleIndex == 0)
|
{
|
bLeftGantryReviewDone = TRUE;
|
}
|
else
|
{
|
bRightGantryReviewDone = TRUE;
|
}
|
|
if (bLeftGantryReviewDone&&bRightGantryReviewDone)
|
{
|
::Sleep(3000);
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]RemainReview Started module[%d]"), nModuleIndex);
|
CSequenceProcessor* pSequenceProcessor = m_pRP2P->IRP2P_GetSequenceProcessor();
|
switch (GetReviewProcessStatus())
|
{
|
case ReviewProcessStatus_ReviewStart:
|
pSequenceProcessor->SendReviewPositionToMotorControl(pGlassResult);
|
bLeftGantryReviewDone = FALSE;
|
bRightGantryReviewDone = FALSE;
|
break;
|
case ReviewProcessStatus_UserStart:
|
pSequenceProcessor->SendUserPositionToMotorControl(pGlassResult);
|
bLeftGantryReviewDone = FALSE;
|
bRightGantryReviewDone = FALSE;
|
break;
|
|
case ReviewProcessStatus_ReflowStart:
|
pSequenceProcessor->SendReflowPositionToMotorControl(pGlassResult);
|
bLeftGantryReviewDone = FALSE;
|
bRightGantryReviewDone = FALSE;
|
break;
|
}
|
}
|
else if(m_pRP2P->IRP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->GetSingleGantryPath()>0)
|
{
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]Single GantryPath Use"), nModuleIndex);
|
if (bLeftGantryReviewDone || bRightGantryReviewDone)
|
{
|
::Sleep(3000);
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]RemainReview Started module[%d]"), nModuleIndex);
|
CSequenceProcessor* pSequenceProcessor = m_pRP2P->IRP2P_GetSequenceProcessor();
|
switch (GetReviewProcessStatus())
|
{
|
case ReviewProcessStatus_ReviewStart:
|
pSequenceProcessor->SendReviewPositionToMotorControl(pGlassResult);
|
bLeftGantryReviewDone = FALSE;
|
bRightGantryReviewDone = FALSE;
|
break;
|
case ReviewProcessStatus_UserStart:
|
pSequenceProcessor->SendUserPositionToMotorControl(pGlassResult);
|
bLeftGantryReviewDone = FALSE;
|
bRightGantryReviewDone = FALSE;
|
break;
|
|
case ReviewProcessStatus_ReflowStart:
|
pSequenceProcessor->SendReflowPositionToMotorControl(pGlassResult);
|
bLeftGantryReviewDone = FALSE;
|
bRightGantryReviewDone = FALSE;
|
break;
|
}
|
}
|
|
}
|
|
}
|
|
if(nCurResultIdx==nEndResultIdx && nCurResultIdx+1 < pReviewResult->GetSReviewResultCount())
|
{
|
|
|
if (nModuleIndex==0)
|
{
|
int a = pReviewResult->GetSReviewResultCount();
|
bLeftGantryReviewDone = TRUE;
|
}
|
else
|
{
|
bRightGantryReviewDone = TRUE;
|
}
|
|
nStartResultIdx = nCurResultIdx + 1;
|
nEndResultIdx = nStartResultIdx + MAX_MOTOR_ADDRESS_SIZE - 1;
|
nEndResultIdx = min(nEndResultIdx, (pReviewResult->GetSReviewResultCount()-1));
|
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]RemainReview Started module[%d] start[%d] end[%d]"), nModuleIndex, nStartResultIdx, nEndResultIdx);
|
pReviewResult->SetStartSReviewResultIndex(nStartResultIdx);
|
pReviewResult->SetEndSReviewResultIndex(nEndResultIdx);
|
|
::Sleep(3000);
|
if (bLeftGantryReviewDone&&bRightGantryReviewDone)
|
{
|
|
CSequenceProcessor* pSequenceProcessor = m_pRP2P->IRP2P_GetSequenceProcessor();
|
switch (GetReviewProcessStatus())
|
{
|
case ReviewProcessStatus_ReviewStart:
|
pSequenceProcessor->SendReviewPositionToMotorControl(pGlassResult);
|
bLeftGantryReviewDone = FALSE;
|
bRightGantryReviewDone = FALSE;
|
break;
|
case ReviewProcessStatus_UserStart:
|
pSequenceProcessor->SendUserPositionToMotorControl(pGlassResult);
|
bLeftGantryReviewDone = FALSE;
|
bRightGantryReviewDone = FALSE;
|
break;
|
|
case ReviewProcessStatus_ReflowStart:
|
pSequenceProcessor->SendReflowPositionToMotorControl(pGlassResult);
|
bLeftGantryReviewDone = FALSE;
|
bRightGantryReviewDone = FALSE;
|
break;
|
}
|
//Process_RemainReviewPoint(nModuleIndex);
|
}
|
else if (m_pRP2P->IRP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->GetSingleGantryPath() > 0)
|
{
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]Single GantryPath Use IN RemainPoint"), nModuleIndex);
|
if (bLeftGantryReviewDone || bRightGantryReviewDone)
|
{
|
CSequenceProcessor* pSequenceProcessor = m_pRP2P->IRP2P_GetSequenceProcessor();
|
switch (GetReviewProcessStatus())
|
{
|
case ReviewProcessStatus_ReviewStart:
|
pSequenceProcessor->SendReviewPositionToMotorControl(pGlassResult);
|
bLeftGantryReviewDone = FALSE;
|
bRightGantryReviewDone = FALSE;
|
break;
|
case ReviewProcessStatus_UserStart:
|
pSequenceProcessor->SendUserPositionToMotorControl(pGlassResult);
|
bLeftGantryReviewDone = FALSE;
|
bRightGantryReviewDone = FALSE;
|
break;
|
|
case ReviewProcessStatus_ReflowStart:
|
pSequenceProcessor->SendReflowPositionToMotorControl(pGlassResult);
|
bLeftGantryReviewDone = FALSE;
|
bRightGantryReviewDone = FALSE;
|
break;
|
}
|
}
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]RemainReview Started module[%d] L[%d] R[%d]"), nModuleIndex, bLeftGantryReviewDone, bRightGantryReviewDone);
|
|
}
|
}
|
|
m_pRP2P->IRP2P_UpdateReviewResult(nModuleIndex, pGlassResult, m_nReviewPlanIndex);
|
return;
|
|
RESULT_FAIL:
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]ReviewResult FAIL! module[%d] result[%d]"), nModuleIndex, nResultIndex);
|
return;
|
}
|
|
int CReviewProcessor_CPJT::CheckMotionComplete()
|
{
|
long lCheckCommand = 0;
|
// check motor signal
|
CMotorControl* pMotorControl = m_pRP2P->IRP2P_GetMotorControl();
|
|
DWORD dWStart = GetTickCount();
|
|
while (pMotorControl != NULL)
|
{
|
if (pMotorControl->ReadAddressValue(230, lCheckCommand) && lCheckCommand)
|
{
|
g_pLog->DisplayMessage(_T("[ReviewProcessor] Motor Ready to Move Success!"));
|
break;
|
}
|
::Sleep(50);
|
if (GetTickCount() - dWStart > 5000)
|
{
|
g_pLog->DisplayMessage(_T("[ReviewProcessor] Motor Ready to Move TimeOut!"));
|
break;
|
}
|
}
|
return (int)lCheckCommand;
|
}
|
|
void CReviewProcessor_CPJT::ResetGantryDone()
|
{
|
bLeftGantryReviewDone = FALSE;
|
bRightGantryReviewDone = FALSE;
|
}
|
|
int CReviewProcessor_CPJT::PostProcessReviewResult(int nThreadIdx, SReviewResult* pReviewResult)
|
{
|
if (m_pRP2P==NULL) return 0;
|
|
CGlassResult *pGlassResult = m_pRP2P->IRP2P_GetCurrentGlassResult();
|
CSequenceProcessor* pSequenceProcessor = m_pRP2P->IRP2P_GetSequenceProcessor();
|
if (pGlassResult==NULL || pSequenceProcessor==NULL)
|
{
|
return 1;
|
}
|
|
if (pGlassResult->CheckReviewComplete())
|
{
|
// check motor ready!
|
// address : 900
|
m_pRP2P->IRP2P_DisplayMessage(_T("Review Last Point Complete! "));
|
m_pRP2P->IRP2P_UpdateReviewProcessStatus(ReviewProcessStatus_ReviewEnd, m_nReviewPlanIndex);
|
|
DWORD dwTime = GetTickCount();
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ReviewMoveEnd] %d Tick Count"), dwTime);
|
m_pRP2P->IRP2P_GetSequenceProcessor()->SetEndTickCount(dwTime);
|
|
double dTime2 = ((int)m_pRP2P->IRP2P_GetSequenceProcessor()->GetEndTickCount() - (int)m_pRP2P->IRP2P_GetSequenceProcessor()->GetStartTickCount()) / 1000.0;
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ReviewMoveEnd] Total Tack [%lf]"), dTime2);
|
m_pRP2P->IRP2P_CompletePlanIndex(ReviewProcessStatus_ReviewEnd, m_nReviewPlanIndex);
|
|
bProcessSuccess[CPJT_REVIEW_SUCCESS] = TRUE;
|
}
|
|
return 1;
|
}
|
|
int CReviewProcessor_CPJT::PostProcessUserResult(int nThreadIdx, SReviewResult* pReviewResult)
|
{
|
if (m_pRP2P==NULL) return 0;
|
|
CGlassResult *pGlassResult = m_pRP2P->IRP2P_GetCurrentGlassResult();
|
CSequenceProcessor* pSequenceProcessor = m_pRP2P->IRP2P_GetSequenceProcessor();
|
if (pGlassResult==NULL || pSequenceProcessor==NULL)
|
{
|
return 1;
|
}
|
|
if (pGlassResult->CheckUserComplete())
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("User Last Point Complete! "));
|
m_pRP2P->IRP2P_UpdateReviewProcessStatus(ReviewProcessStatus_UserEnd, m_nReviewPlanIndex);
|
|
// check motor signal
|
//int lCheckCommand = CheckMotionComplete();
|
int lCheckCommand = 1;
|
//ReviewCamera_CameraControl(CameraControlStop);
|
|
if(lCheckCommand)
|
{
|
m_pRP2P->IRP2P_CompletePlanIndex(ReviewProcessStatus_UserEnd, m_nReviewPlanIndex);
|
}
|
bProcessSuccess[CPJT_REVIEW_SUCCESS] = TRUE;
|
}
|
|
return 1;
|
}
|
|
int CReviewProcessor_CPJT::PostProcessReflowResult( int nThreadIdx, SReviewResult* pReviewResult )
|
{
|
if (m_pRP2P==NULL) return 0;
|
|
CGlassResult *pGlassResult = m_pRP2P->IRP2P_GetCurrentGlassResult();
|
CSequenceProcessor* pSequenceProcessor = m_pRP2P->IRP2P_GetSequenceProcessor();
|
if (pGlassResult==NULL || pSequenceProcessor==NULL)
|
{
|
return 1;
|
}
|
|
if (pGlassResult->CheckReflowComplete())
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("Reflow Last Point Complete! "));
|
m_pRP2P->IRP2P_UpdateReviewProcessStatus(ReviewProcessStatus_ReflowEnd, m_nReviewPlanIndex);
|
|
// check motor signal
|
//int lCheckCommand = CheckMotionComplete();
|
int lCheckCommand = 1;
|
//ReviewCamera_CameraControl(CameraControlStop);
|
|
if(lCheckCommand)
|
{
|
m_pRP2P->IRP2P_CompletePlanIndex(ReviewProcessStatus_ReflowEnd, m_nReviewPlanIndex);
|
}
|
bProcessSuccess[CPJT_REFLOW_SUCCESS] = TRUE;
|
}
|
|
return 1;
|
}
|
|
int CReviewProcessor_CPJT::PostProcessWsiResult(int nThreadIdx, SReviewResult* pReviewResult)
|
{
|
if (m_pRP2P==NULL) return 0;
|
|
CGlassResult *pGlassResult = m_pRP2P->IRP2P_GetCurrentGlassResult();
|
CSequenceProcessor* pSequenceProcessor = m_pRP2P->IRP2P_GetSequenceProcessor();
|
if (pGlassResult==NULL || pSequenceProcessor==NULL)
|
{
|
return 1;
|
}
|
|
if (pGlassResult->CheckWsiComplete())
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("Wsi Last Point Complete! "));
|
m_pRP2P->IRP2P_UpdateReviewProcessStatus(ReviewProcessStatus_WSIEnd, m_nReviewPlanIndex);
|
|
// check motor signal
|
//int lCheckCommand = CheckMotionComplete();
|
int lCheckCommand = 1;
|
//ReviewCamera_CameraControl(CameraControlStop);
|
|
if(lCheckCommand)
|
{
|
m_pRP2P->IRP2P_CompletePlanIndex(ReviewProcessStatus_WSIEnd, m_nReviewPlanIndex);
|
}
|
bProcessSuccess[CPJT_WSI_SUCCESS] = TRUE;
|
}
|
|
return 1;
|
}
|
|
int CReviewProcessor_CPJT::PostProcessMeasureResult(int nThreadIdx, SReviewResult* pReviewResult)
|
{
|
g_pLog->DisplayMessage(_T("PostProcessMeasureResult[%d]"),nThreadIdx);
|
if (m_pRP2P==NULL) return 0;
|
|
CGlassResult *pGlassResult = m_pRP2P->IRP2P_GetCurrentGlassResult();
|
CSequenceProcessor* pSequenceProcessor = m_pRP2P->IRP2P_GetSequenceProcessor();
|
if (pGlassResult==NULL || pSequenceProcessor==NULL)
|
{
|
return 1;
|
}
|
|
if (pGlassResult->CheckMeasureComplete())
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("Measure Last Point Complete! "));
|
m_pRP2P->IRP2P_UpdateReviewProcessStatus(ReviewProcessStatus_MeasureEnd, m_nReviewPlanIndex);
|
|
// check motor signal
|
//int lCheckCommand = CheckMotionComplete();
|
int lCheckCommand = 1;
|
//ReviewCamera_CameraControl(CameraControlStop);
|
|
if(lCheckCommand)
|
{
|
m_pRP2P->IRP2P_CompletePlanIndex(ReviewProcessStatus_MeasureEnd, m_nReviewPlanIndex);
|
}
|
|
bProcessSuccess[CPJT_MEASURE_SUCCESS] = TRUE;
|
}
|
else
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[CheckComplete] NotComplete-------------------------"));
|
}
|
|
return 1;
|
}
|
int CReviewProcessor_CPJT::PostProcessWsiReflowResult(int nThreadIdx, SReviewResult* pReviewResult)
|
{
|
if (m_pRP2P==NULL) return 0;
|
|
CGlassResult *pGlassResult = m_pRP2P->IRP2P_GetCurrentGlassResult();
|
CSequenceProcessor* pSequenceProcessor = m_pRP2P->IRP2P_GetSequenceProcessor();
|
if (pGlassResult==NULL || pSequenceProcessor==NULL)
|
{
|
return 1;
|
}
|
|
if (pGlassResult->CheckWsiReflowComplete())
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("Wsi Reflow Last Point Complete! "));
|
m_pRP2P->IRP2P_UpdateReviewProcessStatus(ReviewProcessStatus_WSIReflowEnd, m_nReviewPlanIndex);
|
// check motor signal
|
//int lCheckCommand = CheckMotionComplete();
|
int lCheckCommand = 1;
|
//ReviewCamera_CameraControl(CameraControlStop);
|
|
if(lCheckCommand)
|
{
|
m_pRP2P->IRP2P_CompletePlanIndex(ReviewProcessStatus_WSIReflowEnd, m_nReviewPlanIndex);
|
}
|
bProcessSuccess[CPJT_WSI_SUCCESS] = TRUE;
|
}
|
|
return 1;
|
}
|
|
int CReviewProcessor_CPJT::PostProcessWsiUserResult( int nThreadIdx, SReviewResult* pReviewResult )
|
{
|
if (m_pRP2P==NULL) return 0;
|
|
CGlassResult *pGlassResult = m_pRP2P->IRP2P_GetCurrentGlassResult();
|
CSequenceProcessor* pSequenceProcessor = m_pRP2P->IRP2P_GetSequenceProcessor();
|
if (pGlassResult==NULL || pSequenceProcessor==NULL)
|
{
|
return 1;
|
}
|
|
if (pGlassResult->CheckWsiUserComplete())
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("Wsi Last Point Complete! "));
|
m_pRP2P->IRP2P_UpdateReviewProcessStatus(ReviewProcessStatus_WSIEnd, m_nReviewPlanIndex);
|
|
// check motor signal
|
//int lCheckCommand = CheckMotionComplete();
|
int lCheckCommand = 1;
|
//ReviewCamera_CameraControl(CameraControlStop);
|
|
if(lCheckCommand)
|
{
|
m_pRP2P->IRP2P_CompletePlanIndex(ReviewProcessStatus_WSIEnd, m_nReviewPlanIndex);
|
}
|
bProcessSuccess[CPJT_WSI_SUCCESS] = TRUE;
|
}
|
|
return 1;
|
}
|
|
int CReviewProcessor_CPJT::PostProcessWsiMultiShotResult(int nThreadIdx, SReviewResult* pReviewResult)
|
{
|
if (m_pRP2P == NULL) return 0;
|
|
CGlassResult *pGlassResult = m_pRP2P->IRP2P_GetCurrentGlassResult();
|
CSequenceProcessor* pSequenceProcessor = m_pRP2P->IRP2P_GetSequenceProcessor();
|
if (pGlassResult == NULL || pSequenceProcessor == NULL)
|
{
|
return 1;
|
}
|
|
if (pGlassResult->CheckWsiMultiShotComplete())
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("WsiMultiShot Last Point Complete! "));
|
m_pRP2P->IRP2P_UpdateReviewProcessStatus(ReviewProcessStatus_WSIMultiShotEnd, m_nReviewPlanIndex);
|
|
// check motor signal
|
//int lCheckCommand = CheckMotionComplete();
|
int lCheckCommand = 1;
|
//ReviewCamera_CameraControl(CameraControlStop);
|
|
if (lCheckCommand)
|
{
|
m_pRP2P->IRP2P_CompletePlanIndex(ReviewProcessStatus_WSIMultiShotEnd, m_nReviewPlanIndex);
|
}
|
bProcessSuccess[CPJT_WSI_SUCCESS] = TRUE;
|
}
|
|
return 1;
|
}
|
|
int CReviewProcessor_CPJT::PostProcessWsiVLSIResult(int nThreadIdx, SReviewResult* pReviewResult)
|
{
|
return 1;
|
}
|
|
int CReviewProcessor_CPJT::AddReviewProcessData(SReviewResult* pReviewResult)
|
{
|
if (pReviewResult==NULL || m_pRP2P==NULL) return 0;
|
|
/*
|
int nThreadIdx = LockThreadIndex();
|
|
if (nThreadIdx<0)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("Thread indexs is -1 ============================== %02d , %02d"),pReviewResult->nModuleIdx, pReviewResult->nResultIdx);
|
return -1;
|
}
|
*/
|
|
int nThreadIdx = 0;
|
|
// make thread data
|
CReviewProcessData *pThreadData = new CReviewProcessData(this);
|
if (pThreadData==NULL) return -2;
|
|
// set data
|
pThreadData->nThreadIdx = nThreadIdx;
|
pThreadData->pReviewResult = pReviewResult;
|
|
// start thread
|
CreateWorkThread(pThreadData);
|
|
return 1;
|
}
|
|
void CReviewProcessor_CPJT::WorkThreadProcess(PVOID pParameter)
|
{
|
if (pParameter==NULL)
|
{
|
TRACE(_T("in pThreadData is NULL\n"));
|
return;
|
}
|
|
CReviewProcessData* pProcessData = static_cast<CReviewProcessData*>(pParameter);
|
SReviewResult* pReviewResult = pProcessData->pReviewResult;
|
if (pReviewResult==NULL)
|
{
|
TRACE(_T("in pReviewResult is NULL\n"));
|
return;
|
}
|
|
//enum ReviewResultCode { ReviewResult_None = 0, ReviewResult_TriggerMissing=1, ReviewResult_Snap_Complete=3, ReviewResult_Processing=7, ReviewResult_Process_Fail=15, ReviewResult_Process_Complete=31 };
|
|
// processing
|
int nResultCode = ReviewResult_None;
|
switch(pReviewResult->nReviewType)
|
{
|
case ReviewType_Review:
|
nResultCode = ProcessReview(pProcessData->nThreadIdx, pReviewResult);
|
break;
|
|
case ReviewType_Measure:
|
nResultCode = ProcessMeasure(pProcessData->nThreadIdx, pReviewResult);
|
break;
|
|
case ReviewType_Wsi:
|
nResultCode = ProcessWSI(pProcessData->nThreadIdx, pReviewResult);
|
break;
|
|
case ReviewType_User:
|
nResultCode = ProcessUser(pProcessData->nThreadIdx, pReviewResult);
|
break;
|
|
case ReviewType_Reflow:
|
nResultCode = ProcessReflow(pProcessData->nThreadIdx, pReviewResult);
|
break;
|
|
case ReviewType_WsiReflow:
|
nResultCode = ProcessWSIReflow(pProcessData->nThreadIdx, pReviewResult);
|
break;
|
case ReviewType_WsiUser:
|
nResultCode = ProcessWSIUser(pProcessData->nThreadIdx, pReviewResult);
|
break;
|
case ReviewType_Wsi_MultiShot:
|
nResultCode = ProcessWSIMultiShot(pProcessData->nThreadIdx, pReviewResult);
|
break;
|
|
}
|
|
pReviewResult->nResultCode = nResultCode;
|
|
// post processing
|
switch(pReviewResult->nReviewType)
|
{
|
case ReviewType_Review:
|
PostProcessReviewResult(pProcessData->nThreadIdx, pReviewResult);
|
break;
|
|
case ReviewType_User:
|
PostProcessUserResult(pProcessData->nThreadIdx, pReviewResult);
|
break;
|
|
case ReviewType_Measure:
|
PostProcessMeasureResult(pProcessData->nThreadIdx, pReviewResult);
|
break;
|
|
case ReviewType_Wsi:
|
PostProcessWsiResult(pProcessData->nThreadIdx, pReviewResult);
|
break;
|
|
case ReviewType_Reflow:
|
PostProcessReflowResult(pProcessData->nThreadIdx, pReviewResult);
|
break;
|
|
case ReviewType_WsiReflow:
|
PostProcessWsiReflowResult(pProcessData->nThreadIdx, pReviewResult);
|
break;
|
case ReviewType_WsiUser:
|
PostProcessWsiUserResult(pProcessData->nThreadIdx, pReviewResult);
|
break;
|
case ReviewType_Wsi_MultiShot:
|
PostProcessWsiMultiShotResult(pProcessData->nThreadIdx, pReviewResult);
|
break;
|
|
|
}
|
|
UnlockThreadIndex(pProcessData->nThreadIdx);
|
|
return;
|
}
|
|
int CReviewProcessor_CPJT::ProcessReview(int nThreadIdx, SReviewResult* pReviewResult)
|
{
|
if (m_pRP2P==NULL || pReviewResult==NULL) return ReviewResult_Process_Fail;
|
m_pRP2P->IRP2P_DisplayMessage(_T("RPT2P_ThreadProcess ThreadIdx[%d] : Review"), nThreadIdx);
|
|
CCHImageData *pImageData = pReviewResult->vectorImageData[0];
|
if (pImageData==NULL)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("RPT2P_ThreadProcess ImageData NULL"));
|
return ReviewResult_Process_Fail;
|
}
|
|
CTime snapTime = CTime::GetCurrentTime();
|
pReviewResult->strSnapTime.Format(_T("%04d%02d%02d%02d%02d%02d"), snapTime.GetYear(), snapTime.GetMonth(), snapTime.GetDay(),
|
snapTime.GetHour(), snapTime.GetMinute(), snapTime.GetSecond()); // snap_time
|
|
CString strImageFileName = _T("");
|
if (MakeReviewImageFileName(pReviewResult)==FALSE)
|
{
|
|
}
|
|
if(!UpdateMemoryReviewPlan(pReviewResult))
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ReviewPlan] Memory Update Fail!! DefectIdx : %d"), pReviewResult->nDefectidx2);
|
|
pReviewResult->strImgFileName = m_strSaveImageBasePath + _T("\\") +pReviewResult->strImgFileName;
|
pReviewResult->nOpticType = 1;
|
|
|
// find defect pos
|
SReviewDefectFindResult findResult;
|
|
CGlassResult *pGlassResult = m_pRP2P->IRP2P_GetCurrentGlassResult(); //taek 210127
|
|
|
// make upload image
|
CCHImageData uploadImage;
|
if(MakeUploadImage(&uploadImage, pImageData, NULL, NULL, findResult, pReviewResult))
|
{
|
if(pReviewResult->strUploadImgFileName.IsEmpty() == FALSE)
|
{
|
CString strPath = _T(""), strRTMSPath = _T("");
|
strPath.Format(_T("%s\\%s"), m_strSaveImageBasePath, pReviewResult->strUploadImgFileName);
|
|
UINT64 nSize = 0;
|
// UINT64 nSize = SaveReviewImage(&uploadImage, strPath, m_nReviewImageSize, m_nReviewImageQuality, m_nReviewImageStep);
|
//if (nSize > 0)
|
// m_pRP2P->IRP2P_DisplayMessage(_T("Backup Review Image Save Success! Size: %d byte [%s]"), nSize, pReviewResult->strUploadImgFileName);
|
strPath.Format(_T("%s\\%s"), m_strSaveImageUploadPath, pReviewResult->strUploadImgFileName);
|
nSize = SaveReviewImage(&uploadImage, strPath, m_nReviewImageSize, m_nReviewImageQuality, m_nReviewImageStep);
|
|
if (pGlassResult != NULL)
|
{
|
pGlassResult->m_strUploadImgFileName = m_strSaveImageUploadPath;
|
//taek 210203
|
strRTMSPath.Format(_T("\\\\126.100.100.5\\Reviewimage\\%s\\%s\\%s"), pGlassResult->m_strRTMSStepID, pGlassResult->m_strGlassID, pReviewResult->strUploadImgFileName);
|
int bRet = SaveReviewImage(&uploadImage, strRTMSPath, m_nReviewImageSize, m_nReviewImageQuality, m_nReviewImageStep); //Taek Rtms 210126
|
if (bRet == 0)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("RTMS Review Image Save Fail!!"));
|
}
|
|
else m_pRP2P->IRP2P_DisplayMessage(_T("RTMS Review Image Save Success! Size: %d byte [%s] index[%d]"), nSize, strRTMSPath, pReviewResult->nDefectIdx);
|
|
}
|
if (nSize > 0)
|
{
|
|
int aoiindex = CDitGlassRawClient::GetInstance()->GetDefectData(pReviewResult->nDefectidx2)->m_nDefectIdx;
|
|
m_pRP2P->IRP2P_DisplayMessage(_T("Upload Review Image Save Success! Size: %d byte [%s] index[%d] AOI NO[%d]"), nSize, pReviewResult->strUploadImgFileName, pReviewResult->nDefectIdx, aoiindex); //taek 210128 ¼Óµµ ¹®Á¦·Î Àӽ÷Π·Î±× ³²±âÁö ¾ÊÀ½
|
//m_pRP2P->IRP2P_DisplayMessage(_T("Upload Review Image Save Success! Size: %d byte [%s]"), nSize, pReviewResult->strUploadImgFileName);
|
}
|
else
|
{
|
|
m_pRP2P->IRP2P_DisplayMessage(_T("Upload Review Image Save Fail! [%s]"), strPath);
|
|
}
|
|
/*CDitGlassRawClient *pDitGlassRawCleint = CDitGlassRawClient::GetInstance();
|
_grmGlassData* pSharedGlassData = pDitGlassRawCleint->GetGlassData();
|
|
strPath.Format(_T("D:\\DitRtms\\Data\\ReviewImage\\%s\\%s\\%s\\%s"),pReviewResult->strOperID,pReviewResult->strLotID,pReviewResult->strGlassID,pReviewResult->strUploadImgFileName);
|
nSize = SaveReviewImage(&uploadImage, strPath, m_nReviewImageSize, m_nReviewImageQuality, m_nReviewImageStep);
|
|
|
if (nSize > 0)
|
m_pRP2P->IRP2P_DisplayMessage(_T("RTMS Review Image Save Success! Size: %d byte [%s]"), nSize, pReviewResult->strUploadImgFileName);
|
else
|
m_pRP2P->IRP2P_DisplayMessage(_T("RTMS Review Image Save Fail! [%s]"), strPath);*/
|
}
|
else
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("Upload Review Image Save Fail!"));
|
}
|
}
|
else
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("Upload Review Image Save Fail![%s]"), pReviewResult->strUploadImgFileName);
|
}
|
|
|
const CRsRcpReviewInfo* psRcpReviewInfo = m_pRP2P->IRP2P_Recipe_GetRsRcpReviewInfo();
|
if(psRcpReviewInfo== NULL) m_pRP2P->IRP2P_DisplayMessage(_T("RcpReviewInfo is NULL"));
|
|
if(psRcpReviewInfo->m_bDefocusUse)
|
{
|
if(pReviewResult->nLocation == DefectLoc_ASG || pReviewResult->nLocation == DefectLoc_PAD || pReviewResult->nLocation == DefectLoc_C2C)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[DefocusValue] Pad Loacation! IDX [%d] LOC [%d]"),pReviewResult->nDefectidx2,pReviewResult->nLocation);
|
|
}
|
else
|
{
|
|
// calculation focus value // lmk 190813 image defocus
|
double dFocusValue = 0.;
|
CCHImageData imageConvert;
|
if (pImageData->GetChannels()!=1)
|
{
|
CCHImageProcess::ImageConvert(pImageData, &imageConvert, ConvertTypeRGB2Gray);
|
}
|
else
|
{
|
pImageData->CopyImageTo(&imageConvert);
|
}
|
if (imageConvert.GetImageExist())
|
{
|
dFocusValue = CalcFocusValue(imageConvert.GetImageBuffer(), imageConvert.GetWidth(), imageConvert.GetHeight());
|
}
|
|
// count defocus
|
CGlassResult* pGlassResult = m_pRP2P->IRP2P_GetCurrentGlassResult();
|
if (pGlassResult)
|
{
|
double dJudgeFocusValue = psRcpReviewInfo->m_dDefocusValue;
|
|
if (dFocusValue < dJudgeFocusValue)
|
{
|
// display log
|
m_pRP2P->IRP2P_DisplayMessage(_T("[%02d][%03d] Defocus Image! Value[%.2f]<Recipe[%.2f]"), pReviewResult->nModuleIdx, pReviewResult->nResultIdx, dFocusValue, dJudgeFocusValue);
|
// count
|
pGlassResult->AddDefocusCount();
|
}
|
}
|
|
if (pReviewResult->nModuleIdx == 0 && m_pRP2P->IRP2P_GetFirstReviewLeft())
|
{
|
const CSignalControlInfo* pSignalInfo = m_pRP2P->IRP2P_GetReviewSignalinfo();
|
int nDefocusValueMin = pSignalInfo->GetDefocusValueMin();
|
int nDefocusValueMax = pSignalInfo->GetDefocusValueMax();
|
|
m_pRP2P->IRP2P_GetCurrentGlassResult()->nReview00ImageContrast = dFocusValue;
|
m_pRP2P->IRP2P_SetFirstReviewLeft(FALSE);
|
m_pRP2P->IRP2P_DisplayMessage(_T("FirstReviewLeft FDC FocusValue = %.2f "), dFocusValue);
|
|
if (dFocusValue < nDefocusValueMin || dFocusValue > nDefocusValueMax)
|
{
|
m_pRP2P->IRP2P_GetSequenceProcessor()->SendSignalToSignalControl(0, 3, 1000);
|
}
|
}
|
else if(pReviewResult->nModuleIdx == 1 && m_pRP2P->IRP2P_GetFirstReviewRight())
|
{
|
const CSignalControlInfo* pSignalInfo = m_pRP2P->IRP2P_GetReviewSignalinfo();
|
int nDefocusValueMin = pSignalInfo->GetDefocusValueMin();
|
int nDefocusValueMax = pSignalInfo->GetDefocusValueMax();
|
|
m_pRP2P->IRP2P_GetCurrentGlassResult()->nReview01ImageContrast = dFocusValue;
|
m_pRP2P->IRP2P_SetFirstReviewRight(FALSE);
|
m_pRP2P->IRP2P_DisplayMessage(_T("FirstReviewRight FDC FocusValue = %.2f "), dFocusValue);
|
|
if (dFocusValue < nDefocusValueMin || dFocusValue > nDefocusValueMax)
|
{
|
m_pRP2P->IRP2P_GetSequenceProcessor()->SendSignalToSignalControl(0, 3, 1000);
|
}
|
}
|
}
|
}
|
//#3524_210723_LYW_CF AOI Review µðÆ÷Ä¿½º ¾Ë¶÷ Ãß°¡ ¹× FDC º¸°í ¹æ½Ä °³¼± MOD Start
|
else
|
{
|
double dFocusValue = 0.;
|
CCHImageData imageConvert;
|
if (pImageData->GetChannels() != 1)
|
{
|
CCHImageProcess::ImageConvert(pImageData, &imageConvert, ConvertTypeRGB2Gray);
|
}
|
else
|
{
|
pImageData->CopyImageTo(&imageConvert);
|
}
|
if (imageConvert.GetImageExist())
|
{
|
dFocusValue = CalcFocusValue(imageConvert.GetImageBuffer(), imageConvert.GetWidth(), imageConvert.GetHeight());
|
}
|
|
if (pReviewResult->nModuleIdx == 0 && m_pRP2P->IRP2P_GetFirstReviewLeft())
|
{
|
const CSignalControlInfo* pSignalInfo = m_pRP2P->IRP2P_GetReviewSignalinfo();
|
int nDefocusValueMin = pSignalInfo->GetDefocusValueMin();
|
int nDefocusValueMax = pSignalInfo->GetDefocusValueMax();
|
|
m_pRP2P->IRP2P_GetCurrentGlassResult()->nReview00ImageContrast = dFocusValue;
|
m_pRP2P->IRP2P_SetFirstReviewLeft(FALSE);
|
m_pRP2P->IRP2P_DisplayMessage(_T("FirstReviewLeft FDC FocusValue = %.2f "), dFocusValue);
|
|
if (dFocusValue < nDefocusValueMin || dFocusValue > nDefocusValueMax)
|
{
|
m_pRP2P->IRP2P_GetSequenceProcessor()->SendSignalToSignalControl(0, 3, 1000);
|
}
|
|
}
|
else if (pReviewResult->nModuleIdx == 1 && m_pRP2P->IRP2P_GetFirstReviewRight())
|
{
|
const CSignalControlInfo* pSignalInfo = m_pRP2P->IRP2P_GetReviewSignalinfo();
|
int nDefocusValueMin = pSignalInfo->GetDefocusValueMin();
|
int nDefocusValueMax = pSignalInfo->GetDefocusValueMax();
|
|
m_pRP2P->IRP2P_GetCurrentGlassResult()->nReview01ImageContrast = dFocusValue;
|
m_pRP2P->IRP2P_SetFirstReviewRight(FALSE);
|
m_pRP2P->IRP2P_DisplayMessage(_T("FirstReviewRight FDC FocusValue = %.2f "), dFocusValue);
|
|
if (dFocusValue < nDefocusValueMin || dFocusValue > nDefocusValueMax)
|
{
|
m_pRP2P->IRP2P_GetSequenceProcessor()->SendSignalToSignalControl(0, 3, 1000);
|
}
|
|
}
|
}
|
//#3524_210723_LYW_CF AOI Review µðÆ÷Ä¿½º ¾Ë¶÷ Ãß°¡ ¹× FDC º¸°í ¹æ½Ä °³¼± MOD End
|
|
|
|
|
return ReviewResult_Process_Complete;
|
}
|
|
int CReviewProcessor_CPJT::ProcessUser(int nThreadIdx, SReviewResult* pReviewResult)
|
{
|
if (pReviewResult==NULL) return ReviewResult_Process_Fail;
|
m_pRP2P->IRP2P_DisplayMessage(_T("RPT2P_ThreadProcess ThreadIdx[%d]"), nThreadIdx);
|
|
CCHImageData *pImageData = pReviewResult->vectorImageData[0];
|
if (pImageData==NULL)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("RPT2P_ThreadProcess ImageData NULL"));
|
return ReviewResult_Process_Fail;
|
}
|
|
CTime snapTime = CTime::GetCurrentTime();
|
pReviewResult->strSnapTime.Format(_T("%04d%02d%02d%02d%02d%02d"), snapTime.GetYear(), snapTime.GetMonth(), snapTime.GetDay(),
|
snapTime.GetHour(), snapTime.GetMinute(), snapTime.GetSecond()); // snap_time
|
|
CString strImageFileName = _T("");
|
if (MakeUserImageFileName(pReviewResult)==FALSE)
|
{
|
strImageFileName.Format(_T("REVIEW_%05d_%07d_%07d.JPG"), pReviewResult->nDefectidx2 +1, pReviewResult->nUMOriginX, pReviewResult->nUMOriginY);
|
pReviewResult->strUploadImgFileName = strImageFileName;
|
}
|
|
|
if(!UpdateMemoryUserPlan(pReviewResult))
|
m_pRP2P->IRP2P_DisplayMessage(_T("[UserPlan] Memory Update Fail!! DefectIdx : %d"), pReviewResult->nDefectidx2);
|
|
//strImageFileName.Format(_T("ModuleIdx[%d]_PointIdx[%d]_Zoom[%d]"), pReviewResult->nModuleIdx, pReviewResult->nResultIdx, pReviewResult->nZoomIdx);
|
//pReviewResult->strImgFileName = strImageFileName;
|
|
|
|
// make upload image
|
SReviewDefectFindResult findResult;
|
CCHImageData uploadImage;
|
if(MakeUploadImage(&uploadImage, pImageData, NULL, NULL, findResult, pReviewResult))
|
{
|
if(pReviewResult->strUploadImgFileName.IsEmpty() == FALSE)
|
{
|
CString strPath = _T("");
|
strPath.Format(_T("%s\\%s"), m_strSaveImageBasePath, pReviewResult->strUploadImgFileName);
|
|
UINT64 nSize = SaveReviewImage(&uploadImage, strPath, m_nReviewImageSize, m_nReviewImageQuality, m_nReviewImageStep);
|
m_pRP2P->IRP2P_DisplayMessage(_T("Upload Review Image Save Success! Size: %d byte"), nSize);
|
|
//uploadImage.SaveImage(strPath, 40);
|
if(GetReviewProcessStatus() == ReviewProcessStatus_UserStart)
|
{
|
//strPath.Format(_T("%s\\%s\\%s"), m_strSaveImageUploadPath, m_strGlassID, pReviewResult->strUploadImgFileName);
|
strPath.Format(_T("%s\\%s"), m_strSaveImageUploadPath, pReviewResult->strUploadImgFileName);
|
nSize = SaveReviewImage(&uploadImage, strPath, m_nReviewImageSize, m_nReviewImageQuality, m_nReviewImageStep);
|
|
m_pRP2P->IRP2P_DisplayMessage(_T("Upload User Image Save Success! Size: %d byte"), nSize);
|
}
|
}
|
else
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("Upload User Image Save Fail!"));
|
}
|
}
|
else
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("Upload User Image Save Fail![%s]"), pReviewResult->strUploadImgFileName);
|
}
|
|
|
const CRsRcpReviewInfo* psRcpReviewInfo = m_pRP2P->IRP2P_Recipe_GetRsRcpReviewInfo();
|
if(psRcpReviewInfo== NULL) m_pRP2P->IRP2P_DisplayMessage(_T("RcpReviewInfo is NULL"));
|
|
if(psRcpReviewInfo->m_bDefocusUse)
|
{
|
if(pReviewResult->nLocation == DefectLoc_ASG || pReviewResult->nLocation == DefectLoc_PAD || pReviewResult->nLocation == DefectLoc_C2C)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[DefocusValue] Pad Loacation! IDX [%d] LOC [%d]"),pReviewResult->nDefectidx2,pReviewResult->nLocation);
|
|
}
|
else
|
{
|
// calculation focus value // lmk 190813 image defocus
|
double dFocusValue = 0.;
|
CCHImageData imageConvert;
|
if (pImageData->GetChannels()!=1)
|
{
|
CCHImageProcess::ImageConvert(pImageData, &imageConvert, ConvertTypeRGB2Gray);
|
}
|
else
|
{
|
pImageData->CopyImageTo(&imageConvert);
|
}
|
if (imageConvert.GetImageExist())
|
{
|
dFocusValue = CalcFocusValue(imageConvert.GetImageBuffer(), imageConvert.GetWidth(), imageConvert.GetHeight());
|
|
if (pReviewResult->nModuleIdx == 0 && m_pRP2P->IRP2P_GetFirstReviewLeft())
|
{
|
const CSignalControlInfo* pSignalInfo = m_pRP2P->IRP2P_GetReviewSignalinfo();
|
int nDefocusValueMin = pSignalInfo->GetDefocusValueMin();
|
int nDefocusValueMax = pSignalInfo->GetDefocusValueMax();
|
|
m_pRP2P->IRP2P_GetCurrentGlassResult()->nReview00ImageContrast = dFocusValue;
|
m_pRP2P->IRP2P_SetFirstReviewLeft(FALSE);
|
m_pRP2P->IRP2P_DisplayMessage(_T("FirstReviewLeft FDC FocusValue = %.2f "), dFocusValue);
|
|
if (dFocusValue < nDefocusValueMin || dFocusValue > nDefocusValueMax)
|
{
|
m_pRP2P->IRP2P_GetSequenceProcessor()->SendSignalToSignalControl(0, 3, 1000);
|
}
|
}
|
else if (pReviewResult->nModuleIdx == 1 && m_pRP2P->IRP2P_GetFirstReviewRight())
|
{
|
const CSignalControlInfo* pSignalInfo = m_pRP2P->IRP2P_GetReviewSignalinfo();
|
int nDefocusValueMin = pSignalInfo->GetDefocusValueMin();
|
int nDefocusValueMax = pSignalInfo->GetDefocusValueMax();
|
|
m_pRP2P->IRP2P_GetCurrentGlassResult()->nReview01ImageContrast = dFocusValue;
|
m_pRP2P->IRP2P_SetFirstReviewRight(FALSE);
|
m_pRP2P->IRP2P_DisplayMessage(_T("FirstReviewRight FDC FocusValue = %.2f "), dFocusValue);
|
|
if (dFocusValue < nDefocusValueMin || dFocusValue > nDefocusValueMax)
|
{
|
m_pRP2P->IRP2P_GetSequenceProcessor()->SendSignalToSignalControl(0, 3, 1000);
|
}
|
|
}
|
|
}
|
|
// count defocus
|
CGlassResult* pGlassResult = m_pRP2P->IRP2P_GetCurrentGlassResult();
|
if (pGlassResult)
|
{
|
double dJudgeFocusValue = psRcpReviewInfo->m_dDefocusValue;
|
|
m_pRP2P->IRP2P_DisplayMessage(_T("[%02d][%03d] Defocus Image! Value[%.2f]<Recipe[%.2f]"), pReviewResult->nModuleIdx, pReviewResult->nResultIdx, dFocusValue, dJudgeFocusValue);
|
|
if (dFocusValue < dJudgeFocusValue)
|
{
|
// display log
|
m_pRP2P->IRP2P_DisplayMessage(_T("[%02d][%03d] Defocus Image! Value[%.2f]<Recipe[%.2f]"), pReviewResult->nModuleIdx, pReviewResult->nResultIdx, dFocusValue, dJudgeFocusValue);
|
// count
|
pGlassResult->AddDefocusCount();
|
}
|
}
|
}
|
}
|
|
//#3524_210723_LYW_CF AOI Review µðÆ÷Ä¿½º ¾Ë¶÷ Ãß°¡ ¹× FDC º¸°í ¹æ½Ä °³¼± ADD Start
|
else
|
{
|
double dFocusValue = 0.;
|
CCHImageData imageConvert;
|
if (pImageData->GetChannels() != 1)
|
{
|
CCHImageProcess::ImageConvert(pImageData, &imageConvert, ConvertTypeRGB2Gray);
|
}
|
else
|
{
|
pImageData->CopyImageTo(&imageConvert);
|
}
|
if (imageConvert.GetImageExist())
|
{
|
dFocusValue = CalcFocusValue(imageConvert.GetImageBuffer(), imageConvert.GetWidth(), imageConvert.GetHeight());
|
}
|
|
if (pReviewResult->nModuleIdx == 0 && m_pRP2P->IRP2P_GetFirstReviewLeft())
|
{
|
const CSignalControlInfo* pSignalInfo = m_pRP2P->IRP2P_GetReviewSignalinfo();
|
int nDefocusValueMin = pSignalInfo->GetDefocusValueMin();
|
int nDefocusValueMax = pSignalInfo->GetDefocusValueMax();
|
|
m_pRP2P->IRP2P_GetCurrentGlassResult()->nReview00ImageContrast = dFocusValue;
|
m_pRP2P->IRP2P_SetFirstReviewLeft(FALSE);
|
m_pRP2P->IRP2P_DisplayMessage(_T("FirstReviewLeft FDC FocusValue = %.2f "), dFocusValue);
|
|
if (dFocusValue < nDefocusValueMin || dFocusValue > nDefocusValueMax)
|
{
|
m_pRP2P->IRP2P_GetSequenceProcessor()->SendSignalToSignalControl(0, 3, 1000);
|
}
|
}
|
else if (pReviewResult->nModuleIdx == 1 && m_pRP2P->IRP2P_GetFirstReviewRight())
|
{
|
const CSignalControlInfo* pSignalInfo = m_pRP2P->IRP2P_GetReviewSignalinfo();
|
int nDefocusValueMin = pSignalInfo->GetDefocusValueMin();
|
int nDefocusValueMax = pSignalInfo->GetDefocusValueMax();
|
|
m_pRP2P->IRP2P_GetCurrentGlassResult()->nReview01ImageContrast = dFocusValue;
|
m_pRP2P->IRP2P_SetFirstReviewRight(FALSE);
|
m_pRP2P->IRP2P_DisplayMessage(_T("FirstReviewRight FDC FocusValue = %.2f "), dFocusValue);
|
|
if (dFocusValue < nDefocusValueMin || dFocusValue > nDefocusValueMax)
|
{
|
m_pRP2P->IRP2P_GetSequenceProcessor()->SendSignalToSignalControl(0, 3, 1000);
|
}
|
|
}
|
}
|
//#3524_210723_LYW_CF AOI Review µðÆ÷Ä¿½º ¾Ë¶÷ Ãß°¡ ¹× FDC º¸°í ¹æ½Ä °³¼± ADD End
|
|
return ReviewResult_Process_Complete;
|
}
|
int CReviewProcessor_CPJT::ProcessReflow( int nThreadIdx, SReviewResult* pReviewResult )
|
{
|
|
if (pReviewResult==NULL) return ReviewResult_Process_Fail;
|
m_pRP2P->IRP2P_DisplayMessage(_T("RPT2P_ThreadProcess ThreadIdx[%d]"), nThreadIdx);
|
|
CCHImageData *pImageData= pReviewResult->vectorImageData[0];
|
|
int nTestMode = FALSE;
|
|
if(nTestMode){
|
Sleep(500);
|
CString strPathName;
|
TCHAR szFilter[] = _T("Image(*.png, *.gif, *.jpg)|*.png;*.gif;*.bmp;*.jpg|All Files(*.*)|*.*||");
|
CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY, szFilter);
|
if (IDOK == dlg.DoModal())
|
{
|
strPathName = dlg.GetPathName();
|
//CString strFileName = dlg.GetFileName();
|
//CString strFolderPath = dlg.GetFolderPath();
|
}
|
|
BOOL ret =pImageData->LoadImage(strPathName);
|
}
|
|
if (pImageData==NULL)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("RPT2P_ThreadProcess ImageData NULL"));
|
return ReviewResult_Process_Fail;
|
}
|
|
CTime snapTime = CTime::GetCurrentTime();
|
pReviewResult->strSnapTime.Format(_T("%04d%02d%02d%02d%02d%02d"), snapTime.GetYear(), snapTime.GetMonth(), snapTime.GetDay(),
|
snapTime.GetHour(), snapTime.GetMinute(), snapTime.GetSecond()); // snap_time
|
|
CString strImageFileName = _T("");
|
if (MakeReflowImageFileName(pReviewResult)==FALSE)
|
{
|
strImageFileName.Format(_T("REVIEW_%05d_%07d_%07d.JPG"), pReviewResult->nDefectidx2+1, pReviewResult->nUMOriginX, pReviewResult->nUMOriginY);
|
pReviewResult->strUploadImgFileName = strImageFileName;
|
}
|
|
CGlassResult* pGlassResult = m_pRP2P->IRP2P_GetCurrentGlassResult();
|
if (pGlassResult == NULL)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("GlassResult NULL!!!!"));
|
return ReviewResult_Process_Fail;
|
}
|
|
|
reflowParam reParam;
|
reflowResult reResult;
|
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
BOOL btFlag =0;
|
//reParam.nImageWidth = 2432;
|
//reParam.nImageHeight = 2048;
|
reParam.nImageWidth =pImageData->GetWidth();
|
reParam.nImageHeight =pImageData->GetHeight();
|
CCHImageData tempImageOrigin;
|
CCHImageData tempImage;
|
tempImageOrigin.CopyImageFrom(pImageData);
|
|
if(pReviewResult->nReflow_Side==7)
|
{
|
btFlag=1;
|
CCHImageProcess::ImageRotate(pImageData,&tempImage,135);
|
pImageData = &tempImage;
|
//reParam.nImageWidth = 2048;
|
//reParam.nImageHeight = 2432;
|
pReviewResult->nReflow_Side = 2;
|
}
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
const CRsRcpReviewInfo* pRsRecipeManage = m_pRP2P->IRP2P_Recipe_GetRsRcpReviewInfo();
|
if (pRsRecipeManage !=NULL)
|
{
|
reParam.nSide = pReviewResult->nReflow_Side;
|
const CRcpReflowParameter* pRcpReflowParameter = pRsRecipeManage->GetRcpReflowParameter(reParam.nSide);
|
|
if (pRcpReflowParameter != NULL)
|
{
|
reParam.nDistance = new int [4];
|
|
reParam.nDistance[0] = pRcpReflowParameter->GetAPixel();
|
reParam.nDistance[1] = pRcpReflowParameter->GetBPixel();
|
reParam.nDistance[2] = pRcpReflowParameter->GetCPixel();
|
reParam.nDistance[3] = pRcpReflowParameter->GetDPixel();
|
|
reParam.nDamTh2 = pRcpReflowParameter->GetDam1Th();
|
reParam.nDamTh2_in = pRcpReflowParameter->GetDam2Th();
|
reParam.nDamTh1 = pRcpReflowParameter->GetDam3Th();
|
reParam.nDamTh1_in= pRcpReflowParameter->GetDam4Th();
|
|
CCHImageData MasterImage;
|
CString strMasterImageFileName;
|
strMasterImageFileName.Format(_T("%s\\%s"), _REVIEW_REFLOW_RECIPE_PATH_, pRcpReflowParameter->GetMasterFileName());
|
if(MasterImage.LoadImage(strMasterImageFileName)==true)
|
{
|
int nRet = 0;
|
}
|
reParam.nMasterChannel = MasterImage.GetChannels();
|
reParam.nMasterHeight = MasterImage.GetHeight();
|
reParam.nMasterWidth = MasterImage.GetWidth();
|
reParam.pMasterBuffer = (BYTE*)MasterImage.GetImageBuffer();
|
reParam.nMasterWidthStep = MasterImage.GetWidthStep();
|
|
reParam.nChannel = pImageData->GetChannels();
|
reParam.pImageBuffer = (BYTE*)pImageData->GetImageBuffer();
|
reParam.nImageWidthStep = pImageData->GetWidthStep();
|
CRect rtRoi = CRect(0, 0, pImageData->GetWidth()-1, pImageData->GetHeight()-1);
|
reParam.ROI_Rect = &rtRoi;
|
|
if(pRcpReflowParameter->m_nPixelScale >0 ){
|
|
reParam.nPeakPeriod = pRcpReflowParameter->m_nPixelScale;
|
}
|
else{
|
reParam.nPeakPeriod = 10;
|
}
|
|
//pReviewResult->nReflow_Result = Linecheck_Method(pReviewResult->pReflow_LinePosData, &reParam, TRUE);
|
|
reResult = Linecheck_New_Method(pReviewResult->pReflow_LinePosData, &reParam, TRUE);
|
|
pReviewResult->nReflow_Result = reResult.nDAM1 + reResult.nDam1_in + reResult.nDam2 + reResult.nDam2_in;
|
|
m_pRP2P->IRP2P_DisplayMessage(_T("[REFLOW]DAM2 [%d] DAM2-in [%d] DAM1 [%d] DAM1-IN [%d]"), reResult.nDam2,reResult.nDam2_in,reResult.nDAM1,reResult.nDam1_in);
|
|
|
if(reResult.nDam2 == FALSE){
|
m_pRP2P->IRP2P_DisplayMessage(_T("[REFLOW]DAM2 DIF[%d] TH[%d] MIN[%d] MAX[%d]"), reResult.nDam2_GrayDif,reResult.nDam2_GrayTH,reResult.nDam2_GrayMin,reResult.nDam2_GrayMax);
|
}
|
if(reResult.nDam2_in == FALSE)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[REFLOW]DAM2 IN DIF[%d] TH[%d] MIN[%d] MAX[%d]"), reResult.nDam2_in_GrayDif, reResult.nDam2_in_GrayTH,reResult.nDam2_in_GrayMin,reResult.nDam2_in_GrayMax);
|
}
|
if(reResult.nDAM1 == FALSE)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[REFLOW]DAM1 DIF[%d] TH[%d] MIN[%d] MAX[%d]"), reResult.nDam1_GrayDif,reResult.nDam1_GrayTH, reResult.nDAM1_GrayMin,reResult.nDAM1_GrayMax);
|
}
|
if(reResult.nDam1_in == FALSE)
|
{
|
|
m_pRP2P->IRP2P_DisplayMessage(_T("[REFLOW]DAM1 IN DIF[%d] TH[%d] MIN[%d] MAX[%d] "), reResult.nDam1_in_GrayDif,reResult.nDam1_in_GrayTH,reResult.nDam1_in_GrayMin,reResult.nDam1_in_GrayMax);
|
|
}
|
|
|
|
delete reParam.nDistance;
|
}
|
|
}
|
|
if (reResult.nErrorcode > -1)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[REFLOW] %d point Reflow Result Line Result %d Line(s) !!!"), pReviewResult->nResultIdx, pReviewResult->nReflow_Result);
|
}
|
else
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[REFLOW] Result Error Code : %s"),Reflow_Judge(reResult.nErrorcode));
|
|
|
|
}
|
|
|
m_pRP2P->IRP2P_DisplayMessage(_T("[REFLOW] DefectIdx : %d, Cell ID : %s, Cell Idx : %d"), pReviewResult->nDefectidx2, pReviewResult->strCellID, pReviewResult->nReflow_CellIndex);
|
|
|
CCHImageData tmepData2;
|
if(btFlag==1){
|
CCHImageProcess::ImageRotate(pImageData,&tmepData2,135);
|
pImageData= &tmepData2;
|
//pImageData->SaveImage(_T("D:\\Testafter.bmp"));
|
}
|
|
|
if (m_bReviewOriginalImage == TRUE)
|
{
|
CString strPath = _T("");
|
CreateDirectory(m_strSaveImageBasePath + _T("\\Orignal"), NULL);
|
strPath.Format(_T("%s\\Orignal\\%s"), m_strSaveImageBasePath, pReviewResult->strOrignalImgFileName);
|
SaveReviewImage(&tempImageOrigin, strPath);
|
}
|
|
// make upload image
|
SReviewDefectFindResult findResult;
|
CCHImageData uploadImage;
|
if(MakeUploadImage(&uploadImage, pImageData, NULL, NULL, findResult, pReviewResult))
|
{
|
if(pReviewResult->strUploadImgFileName.IsEmpty() == FALSE)
|
{
|
CString strPath = _T("");
|
strPath.Format(_T("%s\\%s"), m_strSaveImageBasePath, pReviewResult->strUploadImgFileName);
|
|
UINT64 nSize = SaveReviewImage(&uploadImage, strPath, m_nReviewImageSize, m_nReviewImageQuality, m_nReviewImageStep);
|
m_pRP2P->IRP2P_DisplayMessage(_T("Upload Review Image Save Success! Size: %d byte"), nSize);
|
|
//uploadImage.SaveImage(strPath, 40);
|
if(GetReviewProcessStatus() == ReviewProcessStatus_ReflowStart)
|
{
|
//strPath.Format(_T("%s\\%s\\%s"), m_strSaveImageUploadPath, m_strGlassID, pReviewResult->strUploadImgFileName);
|
strPath.Format(_T("%s\\%s"), m_strSaveImageUploadPath, pReviewResult->strUploadImgFileName);
|
nSize = SaveReviewImage(&uploadImage, strPath, m_nReviewImageSize, m_nReviewImageQuality, m_nReviewImageStep);
|
|
m_pRP2P->IRP2P_DisplayMessage(_T("Upload Reflow Image Save Success! Size: %d byte"), nSize);
|
|
if(nTestMode)
|
{
|
CString csParam;
|
csParam.Format(_T("shimgvw.dll, ImageView_Fullscreen %s"), strPath);
|
ShellExecute(NULL, _T("open"), _T("rundll32.exe"), csParam, NULL, SW_SHOW);
|
}
|
|
}
|
}
|
else
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("Upload Reflow Image Save Fail!"));
|
}
|
}
|
else
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("Upload Reflow Image Save Fail![%s]"), pReviewResult->strUploadImgFileName);
|
}
|
|
if(!UpdateMemoryReflowPlan(pReviewResult))
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ReflowPlan] Memory Update Fail!! DefectIdx : %d"), pReviewResult->nDefectidx2);
|
|
return ReviewResult_Process_Complete;
|
|
|
|
}
|
int CReviewProcessor_CPJT::ProcessMeasure(int nThreadIdx, SReviewResult* pReviewResult)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ProcessMeasure] Module : %02d, nResultIdx : %02d"), pReviewResult->nModuleIdx, pReviewResult->nResultIdx);
|
|
if (m_pRP2P==NULL || pReviewResult==NULL)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ProcessMeasure] ReveiwResult NULL Error"));
|
return ReviewResult_Process_Fail;
|
}
|
|
CModuleStatus* pModuleStatus = m_pRP2P->IRP2P_GetModuleStatus(pReviewResult->nModuleIdx);
|
if(pModuleStatus == NULL)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ProcessMeasure] ModuleStatus NULL Error"));
|
return ReviewResult_Process_Fail;
|
}
|
|
CCHImageData *pImageData = NULL;
|
// get zoom image
|
// if(pModuleStatus->GetLensType())
|
// {
|
// pImageData = pReviewResult->vectorImageData[pReviewResult->nZoomIdx];
|
// }
|
// else
|
// {
|
// pImageData = pReviewResult->vectorImageData[0];
|
// }
|
if(pModuleStatus->GetLensType()) // dual tube
|
{
|
pImageData = pReviewResult->vectorImageData[1];
|
}
|
else
|
{
|
pImageData = pReviewResult->vectorImageData[0];
|
}
|
|
// last image (20X)
|
//int nIdx = (int)pReviewResult->vectorImageData.size() - 1;
|
//pImageData = pReviewResult->vectorImageData[nIdx];
|
if (pImageData==NULL)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ProcessMeasure] ImageData NULL Error"));
|
return ReviewResult_Process_Fail;
|
}
|
|
CString strImageFileName = _T("");
|
// strImageFileName.Format(_T("ORIGIN_%02d_%02d_%07d_%07d.JPG"),
|
// pReviewResult->nModuleIdx,
|
// pReviewResult->nResultIdx,
|
// pReviewResult->nUMOriginX,
|
// pReviewResult->nUMOriginY);
|
|
// // save origin image
|
CString strPath = _T("");
|
// strPath.Format(_T("%s\\%s"), m_strSaveImageBasePath, strImageFileName);
|
// pImageData->SaveImage(strPath, 100);
|
// m_pRP2P->IRP2P_DisplayMessage(_T("[ReviewProcessor] ORIGIN IMAGE SUCCESS !!!! "));
|
|
// make measure image filename
|
if (MakeMeasureImageFileName(pReviewResult)==FALSE)
|
{
|
pReviewResult->strUploadImgFileName.Format(_T("M_%02d_%02d.JPG"), pReviewResult->nModuleIdx, pReviewResult->nResultIdx);
|
}
|
|
|
// get edge recipe manager
|
CRecipeManager* pEdgeRecipeManager = m_pRP2P->IRP2P_GetEdgeRecipeManager();
|
if (pEdgeRecipeManager==NULL)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ProcessMeasure] EdgeRecipeManager NULL"));
|
return ReviewResult_Process_Fail;
|
}
|
|
// measure recipe manager
|
int nRecipeIndex = pReviewResult->nMeasure_RecipeIndex;
|
CRecipeInfo* pRecipeInfo = pEdgeRecipeManager->GetRecipeInfo(nRecipeIndex);
|
|
CEdgeTriangle edgeTriangle;
|
//CEdgeTriangle* pEdgeTriangle = &m_pEdgeTriangle[nThreadIdx];
|
CEdgeTriangle* pEdgeTriangle = &edgeTriangle;
|
|
if (pRecipeInfo==NULL || pEdgeTriangle==NULL)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ProcessMeasure] RecipeInfo & EdgeTriangle NULL Error"));
|
return ReviewResult_Process_Fail;
|
}
|
|
// model image load
|
CCHImageData modelImage;
|
CString strTemp = TRIANGLE_RECIPE_PATH + pRecipeInfo->strModelFile;
|
if (modelImage.LoadImage(strTemp)==FALSE)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ProcessMeasure] Model-Image Load Error"));
|
return ReviewResult_Process_Fail;
|
}
|
|
// recipe load
|
strTemp = TRIANGLE_RECIPE_PATH + pRecipeInfo->strRecipeFile;
|
CRecipeTriangle recipeTriangle;
|
|
if (recipeTriangle.ReadRecipe(strTemp)==FALSE)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ProcessMeasure] RecipeTraingle Load Error"));
|
|
return ReviewResult_Process_Fail;
|
}
|
|
// measure process
|
int nMeasureResult = pEdgeTriangle->ProcessTriangle(&modelImage, pImageData, recipeTriangle);
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ProcessMeasure] processTriangle Result Code : %d"), nMeasureResult);
|
// enum TriangleResult { ImageFailModel=-1, ImageFailSource=-2, ImageFailSub=-3, ImageFailBandModel=-4, ImageFailBandSource=-5,
|
// RecipeFailModel=-6, RecipeFailMarker=-7, RecipeFailFormula=-8,
|
// ProcessFailModel=-9, ProcessFailMarker=-10, ProcessFailFormula=-11,
|
// ResultFailModel=-12, ResultFailMarker=-13, ResultFailFormula=-14,
|
// EdgeFailLeft=-15, EdgeFailRight=-16, PreProcessFail=-17, CircleCoefficientFail=-18,
|
// ProcessSuccess=1, ProcessNone=0 };
|
|
CResultTriangle *pResultTriangle = NULL;
|
switch (nMeasureResult)
|
{
|
case ProcessSuccess:
|
pResultTriangle = pEdgeTriangle->GetResultTriangle();
|
g_pLog->DisplayMessage(_T("[ReviewProcessor] [%02d]Thread [%02d]Module [%02d] ResultTriangle Measure Success!"),
|
nThreadIdx, pReviewResult->nModuleIdx, pReviewResult->nResultIdx);
|
break;
|
default:
|
g_pLog->DisplayMessage(_T("[ReviewProcessor] [%02d]Thread [%02d]Module [%02d] ResultTriangle Measure FAIL!"),
|
nThreadIdx, pReviewResult->nModuleIdx, pReviewResult->nResultIdx);
|
break;
|
}
|
|
if (pResultTriangle)
|
{
|
// pReviewResult->vecMeasure_ResultData = *(pResultTriangle->GetResultFormula());
|
// strPath = _T("[MeasureResult]");
|
// for (VectorResultFormulaIt it=pReviewResult->vecMeasure_ResultData.begin(); it!=pReviewResult->vecMeasure_ResultData.end(); it++)
|
// {
|
// it->m_dResultValue *= pReviewResult->dMeasureResolution; // pixel * resolution
|
// /* it->m_dResultValue = fabs(it->m_dResultValue);*/
|
// strTemp.Format(_T("%s, %.3lf, "), it->m_strResultName, it->m_dResultValue);
|
// strPath += strTemp;
|
// }
|
|
strPath = _T("[MeasureResult]");
|
for (int nResultIdx=0; nResultIdx<(int)pResultTriangle->GetResultFormulaCount();nResultIdx++)
|
{
|
if(nResultIdx >= MAX_MEASURERESULT)
|
{
|
g_pLog->DisplayMessage(_T("[MeasureProcessing] Module : %02d, nResultIdx : %02d | Over count Formula result index"), pReviewResult->nModuleIdx, pReviewResult->nResultIdx);
|
break;
|
}
|
|
const CResultFormula* pFResult = pResultTriangle->GetResultFormula(nResultIdx);
|
if (pFResult==NULL) continue;
|
|
pReviewResult->vecMeasure_ResultData[nResultIdx] = *pFResult;
|
pReviewResult->vecMeasure_ResultData[nResultIdx].m_dResultValue *= pReviewResult->dMeasureResolution;
|
strTemp.Format(_T("%s, %.3lf, "), pReviewResult->vecMeasure_ResultData[nResultIdx].m_strResultName, pReviewResult->vecMeasure_ResultData[nResultIdx].m_dResultValue);
|
strPath += strTemp;
|
}
|
|
g_pLog->DisplayMessage(strPath);
|
}
|
|
// make upload image
|
CCHImageData uploadImage;
|
if(MakeUploadMeasureImage(&uploadImage, pImageData, pReviewResult, pResultTriangle, nMeasureResult))
|
{
|
if(pReviewResult->strUploadImgFileName.IsEmpty() == FALSE)
|
{
|
strPath.Format(_T("%s\\%s"), m_strSaveImageBasePath, pReviewResult->strUploadImgFileName);
|
UINT64 nSize = SaveReviewImage(&uploadImage, strPath, m_nReviewImageSize, 99, m_nReviewImageStep);
|
CProcessTimer processTimer;
|
//Time Check (Upload Inspector Server)
|
processTimer.Start();
|
strPath.Format(_T("%s\\[MEASURE]_%s\\%s"), m_strSaveImageUploadPath, m_strJobID, pReviewResult->strUploadImgFileName);
|
nSize = SaveReviewImage(&uploadImage, strPath, m_nReviewImageSize, 99, m_nReviewImageStep);
|
processTimer.End();
|
g_pLog->DisplayMessage(_T("[ProcessMeasure] Save Upload Image Duration Time : %f ms"), processTimer.GetDurationMilliSecond());
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ProcessMeasure] Upload Measure Image Save Success! Size: %d byte"), nSize);
|
}
|
else
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ProcessMeasure] Upload Measure Image Save FAIL!"));
|
}
|
}
|
else
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ProcessMeasure] Upload Measure Image Save FAIL![%s]"), pReviewResult->strUploadImgFileName);
|
}
|
|
return ReviewResult_Process_Complete;
|
}
|
|
int CReviewProcessor_CPJT::ProcessWSI(int nThreadIdx, SReviewResult* pReviewResult)
|
{
|
if(!UpdateMemoryWsiPlan(pReviewResult))
|
m_pRP2P->IRP2P_DisplayMessage(_T("[WsiPlan] Memory Update Fail!! DefectIdx : %d"), pReviewResult->nDefectidx2);
|
|
return WsiResultSuccess;
|
}
|
|
|
BOOL CReviewProcessor_CPJT::MakeReviewImageFileName(SReviewResult* pReviewResult)
|
{
|
if (m_pRP2P==NULL || pReviewResult==NULL) return FALSE;
|
CTime snapTime = CTime::GetCurrentTime();
|
//SYSTEMTIME snapTime;
|
//GetLocalTime(&snapTime);
|
|
CString strFileName = _T("");
|
CString strDefectCodeTemp = _T("");
|
|
if(GetReviewProcessStatus() == ReviewProcessStatus_ReviewStart)
|
{
|
// [2017:6:5]-[WEZASW] : Review Image
|
if (pReviewResult->strDefectCode.Compare(_T("***")) == 0)
|
strDefectCodeTemp = _T("DC");
|
else
|
strDefectCodeTemp = pReviewResult->strDefectCode;
|
|
|
//ReviewImage Process_ID_Glass_ID_EQPTYPE__Index_Xpos_Ypos_Judge_ScaleJudge_DefectType_Date(YYYYMMDD_HHMMSS).jpg
|
CDitGlassRawClient *pDitGlassRawClient = CDitGlassRawClient::GetInstance();
|
_grmDefectData* pSharedDefect;
|
CGlassResult* pGlassResult =m_pRP2P->IRP2P_GetCurrentGlassResult();
|
|
|
|
pSharedDefect = pDitGlassRawClient->GetDefectData(pReviewResult->nDefectidx2);
|
|
|
if(pDitGlassRawClient->isConnect() == TRUE)
|
{
|
double dPosX = double(pSharedDefect->m_nUMOriginX)/1000.0;
|
double dPosY = double(pSharedDefect->m_nUMOriginY)/1000.0;
|
|
{
|
if(pDitGlassRawClient->GetGlassData()->m_nScanCoordinateY == 0)
|
{
|
m_pRP2P->IRP2P_GetCenterCoordinate(dPosX, dPosY);
|
}
|
else
|
{
|
double dPosXTemp=dPosX;
|
double dPosYTemp=dPosY;
|
m_pRP2P->IRP2P_GetCenterCoordinate(dPosXTemp, dPosYTemp);
|
|
dPosX=dPosYTemp;
|
dPosY=dPosXTemp;
|
}
|
}
|
_grmDefectData* pSharedDefect = pDitGlassRawClient->GetDefectData(pReviewResult->nDefectidx2);
|
|
|
//CStringW strOperID (pDitGlassRawClient->GetGlassData()->m_strOperID );
|
//CStringW strGlassID(pDitGlassRawClient->GetGlassData()->m_strGlassID);
|
//CStringW strStepID(pDitGlassRawClient->GetGlassData()->m_strStepID );
|
CString strProcessID(pDitGlassRawClient->GetGlassData()->m_strProcessID);
|
//CString strOperID (pDitGlassRawClient->GetGlassData()->m_strOperID );
|
CString strGlassID(pDitGlassRawClient->GetGlassData()->m_strGlassID);
|
CString strStepID(pDitGlassRawClient->GetGlassData()->m_strStepID );
|
//strFileName.Format(_T("%s_%s_%s_%d_%0.3lf_%0.3lf_%s_%s_%04d%02d%02d_%02d%02d%02d"),
|
// strOperID ,
|
// strGlassID,
|
// strStepID,
|
// pReviewResult->nResultIdx,
|
// //m_nReviewCount,
|
// dPosX,
|
// dPosY,
|
// pReviewResult->strJudgeType,
|
// pReviewResult->strSizeType,
|
// snapTime.GetYear(), snapTime.GetMonth(), snapTime.GetDay(),
|
// snapTime.GetHour(), snapTime.GetMinute(), snapTime.GetSecond());
|
|
int nCount = GetPlanReviewCount();
|
strFileName.Format(_T("%s_%03d"),
|
pDitGlassRawClient->GetCellData(pSharedDefect->m_nCellIdx)->m_strCellName,
|
nCount
|
);
|
nCount += 1;
|
SetPlanReviewCount(nCount);
|
}
|
}
|
|
else if(GetReviewProcessStatus() == ReviewProcessStatus_MeasureStart)
|
{
|
strFileName += m_strJobID + _T("."); // glass_id.
|
|
strFileName += pReviewResult->strCellID + _T("."); // cell_id.
|
|
CString tmp = _T("");
|
tmp.Format(_T("%03d"),pReviewResult->nModuleIdx);
|
strFileName += tmp + _T("."); // ModuleIndex.
|
|
tmp.Format(_T("%03d"),pReviewResult->nResultIdx);
|
strFileName += tmp + _T("."); // ModuleIndex.
|
|
strFileName += _T("Measure.");
|
strFileName += pReviewResult->strSnapTime;
|
}
|
|
pReviewResult->strSnapTime.Format(_T("%04d%02d%02d_%02d%02d%02d"), snapTime.GetYear(), snapTime.GetMonth(), snapTime.GetDay(),
|
snapTime.GetHour(), snapTime.GetMinute(), snapTime.GetSecond()); // snap_time
|
|
|
// [2017:4:10]-[WEZASW] :
|
pReviewResult->strOrignalImgFileName = strFileName + _T(".bmp");
|
|
strFileName += _T(".jpg");
|
pReviewResult->strUploadImgFileName = strFileName;
|
pReviewResult->strImgFileName = strFileName;
|
pReviewResult->strImgFilePath = GetReviewUploadImagePath();
|
return TRUE;
|
}
|
|
|
int CReviewProcessor_CPJT::ProcessWSIReflow(int nThreadIdx, SReviewResult* pReviewResult)
|
{
|
// [2016:11:15]-[WEZASW] :
|
if(!UpdateMemoryWsiReflowPlan(pReviewResult))
|
m_pRP2P->IRP2P_DisplayMessage(_T("[WsiReflowPlan] Memory Update Fail!! DefectIdx : %d"), pReviewResult->nDefectidx2);
|
|
return WsiResultSuccess;
|
}
|
|
int CReviewProcessor_CPJT::ProcessWSIUser(int nThreadIdx, SReviewResult* pReviewResult)
|
{
|
if(!UpdateMemoryWsiUserPlan(pReviewResult))
|
m_pRP2P->IRP2P_DisplayMessage(_T("[WsiUserPlan] Memory Update Fail!! DefectIdx : %d"), pReviewResult->nDefectidx2);
|
|
return WsiResultSuccess;
|
}
|
|
int CReviewProcessor_CPJT::ProcessWSIMultiShot(int nThreadIdx, SReviewResult* pReviewResult)
|
{
|
return WsiResultSuccess;
|
}
|
|
BOOL CReviewProcessor_CPJT::MakeMeasureImageFileName(SReviewResult* pReviewResult)
|
{
|
if (m_pRP2P==NULL || pReviewResult==NULL) return FALSE;
|
|
CTime snapTime = CTime::GetCurrentTime();
|
|
CString strFilename = _T("");
|
|
strFilename.Format(_T("MEASURE_%02d_%02d.JPG"), pReviewResult->nModuleIdx, pReviewResult->nResultIdx);
|
|
pReviewResult->strUploadImgFileName = strFilename;
|
|
return TRUE;
|
}
|
|
BOOL CReviewProcessor_CPJT::MakeUserImageFileName(SReviewResult* pReviewResult)
|
{
|
if (m_pRP2P==NULL || pReviewResult==NULL) return FALSE;
|
CTime snapTime = CTime::GetCurrentTime();
|
//SYSTEMTIME snapTime;
|
//GetLocalTime(&snapTime);
|
|
CString strFileName = _T("");
|
CString strDefectCodeTemp = _T("");
|
|
if(GetReviewProcessStatus() == ReviewProcessStatus_UserStart)
|
{
|
// [2017:6:5]-[WEZASW] : Review Image
|
if (pReviewResult->strDefectCode.Compare(_T("***")) == 0)
|
strDefectCodeTemp = _T("DC");
|
else
|
strDefectCodeTemp = pReviewResult->strDefectCode;
|
|
|
//ReviewImage Process_ID_Glass_ID_EQPTYPE__Index_Xpos_Ypos_Judge_ScaleJudge_DefectType_Date(YYYYMMDD_HHMMSS).jpg
|
CDitGlassRawClient *pDitGlassRawClient = CDitGlassRawClient::GetInstance();
|
_grmDefectData* pSharedDefect;
|
CGlassResult* pGlassResult =m_pRP2P->IRP2P_GetCurrentGlassResult();
|
pSharedDefect = pDitGlassRawClient->GetDefectData(pReviewResult->nDefectidx2);
|
|
if(pDitGlassRawClient->isConnect() == TRUE)
|
{
|
|
double dPosX = double(pReviewResult->nUMOriginX)/1000.0;
|
double dPosY = double(pReviewResult->nUMOriginY)/1000.0;
|
{
|
if(pDitGlassRawClient->GetGlassData()->m_nScanCoordinateY == 0)
|
{
|
m_pRP2P->IRP2P_GetCenterCoordinate(dPosX, dPosY);
|
}
|
else
|
{
|
double dPosXTemp=dPosX;
|
double dPosYTemp=dPosY;
|
m_pRP2P->IRP2P_GetCenterCoordinate(dPosXTemp , dPosYTemp);
|
|
dPosX=dPosYTemp;
|
dPosY=dPosXTemp;
|
}
|
}
|
_grmDefectData* pSharedDefect = pDitGlassRawClient->GetDefectData(pReviewResult->nDefectidx2);
|
|
CString strOperID (pDitGlassRawClient->GetGlassData()->m_strOperID );
|
CString strGlassID(pDitGlassRawClient->GetGlassData()->m_strGlassID);
|
CString strStepID(pDitGlassRawClient->GetGlassData()->m_strStepID );
|
|
|
if(strOperID !=GetEQPID(m_nMachineType))
|
{
|
strOperID = GetEQPID(m_nMachineType);
|
}
|
if(strGlassID != m_strJobID)
|
{
|
strGlassID = m_strJobID;
|
}
|
|
if(strStepID != GetStepID(m_nMachineType))
|
{
|
strStepID = GetStepID(m_nMachineType);
|
}
|
|
|
strFileName.Format(_T("%s_%s_%s_%d_%0.3lf_%0.3lf_%s_%s_%04d%02d%02d_%02d%02d%02d"),
|
strOperID ,
|
strGlassID,
|
strStepID,
|
//m_nReviewCount,
|
pReviewResult->nResultIdx,
|
dPosX,
|
dPosY,
|
_T("0"),
|
_T("0"),
|
snapTime.GetYear(), snapTime.GetMonth(), snapTime.GetDay(),
|
snapTime.GetHour(), snapTime.GetMinute(), snapTime.GetSecond());
|
}
|
}
|
else if(GetReviewProcessStatus() == ReviewProcessStatus_MeasureStart)
|
{
|
strFileName += m_strJobID + _T("."); // glass_id.
|
|
strFileName += pReviewResult->strCellID + _T("."); // cell_id.
|
|
CString tmp = _T("");
|
tmp.Format(_T("%03d"),pReviewResult->nModuleIdx);
|
strFileName += tmp + _T("."); // ModuleIndex.
|
|
tmp.Format(_T("%03d"),pReviewResult->nResultIdx);
|
strFileName += tmp + _T("."); // ModuleIndex.
|
|
strFileName += _T("Measure.");
|
strFileName += pReviewResult->strSnapTime;
|
}
|
|
pReviewResult->strSnapTime.Format(_T("%04d%02d%02d_%02d%02d%02d"), snapTime.GetYear(), snapTime.GetMonth(), snapTime.GetDay(),
|
snapTime.GetHour(), snapTime.GetMinute(), snapTime.GetSecond()); // snap_time
|
// pReviewResult->strSnapTime.Format(_T("%04d%02d%02d%02d%02d%02d%03d.jpg"), snapTime.wYear, snapTime.wMonth, snapTime.wDay, snapTime.wHour, snapTime.wMinute, snapTime.wSecond, snapTime.wMilliseconds);
|
// if(pReviewResult->strSizeType.MakeLower().Compare(_T("")) == 0)
|
// {
|
// strFileName += pReviewResult->strSnapTime;
|
// }
|
|
// [2017:4:10]-[WEZASW] :
|
pReviewResult->strOrignalImgFileName = strFileName + _T(".bmp");
|
|
strFileName += _T(".jpg");
|
pReviewResult->strUploadImgFileName = strFileName;
|
pReviewResult->strImgFileName = strFileName;
|
pReviewResult->strImgFilePath = GetReviewUploadImagePath();
|
return TRUE;
|
}
|
|
CString CReviewProcessor_CPJT::GetStepID(int nMachin){
|
|
if(nMachin == 0)
|
return _T("EDAOI110");
|
else if(nMachin == 1)
|
return _T("EDAOI120");
|
else if(nMachin == 2)
|
return _T("EDAOI130");
|
else if(nMachin == 3)
|
return _T("EDAOI510");
|
else if(nMachin == 4)
|
return _T("EDAOI410");
|
else if(nMachin == 5)
|
return _T("EDAOI420");
|
|
}
|
|
CString CReviewProcessor_CPJT::GetEQPID(int nMachin){
|
|
if(nMachin == 0)
|
return _T("22010");
|
else if(nMachin == 1)
|
return _T("23011");
|
else if(nMachin == 2)
|
return _T("23012");
|
else if(nMachin == 3)
|
return _T("24010");
|
else if(nMachin == 4)
|
return _T("21010");
|
else if(nMachin == 5)
|
return _T("23013");
|
|
}
|
|
|
CString CReviewProcessor_CPJT::GetStackType(int nStackType)
|
{
|
CString strStackType = _T("None");
|
switch (nStackType)
|
{
|
case Stack_Unknown:
|
strStackType = _T("None");
|
break;
|
case Stack_TD:
|
strStackType = _T("TD");
|
break;
|
|
case Stack_SD:
|
strStackType = _T("SD");
|
break;
|
|
case Stack_PD:
|
strStackType = _T("PD");
|
break;
|
case Stack_SP:
|
strStackType = _T("SP");
|
break;
|
case Stack_CD:
|
strStackType = _T("CD");
|
break;
|
}
|
|
return strStackType;
|
}
|
|
void CReviewProcessor_CPJT::LoadAoiImage(const CString& strGlassID, int nOpticType, int nPosX, int nPosY, CCHImageData* pAoiDark, CCHImageData *pAoiBright)
|
{
|
CString strAoiDarkPath = _T("");
|
CString strAoiBrightPath = _T("");
|
|
FindAoiDefectImagePath(strGlassID, nOpticType, nPosX, nPosY, strAoiDarkPath, strAoiBrightPath);
|
|
// Dark image
|
//if(nOpticType & DEFECT_OPTIC_DARK)
|
{
|
if (strAoiDarkPath.IsEmpty()==FALSE)
|
{
|
if(pAoiDark->LoadImage(strAoiDarkPath)==FALSE)
|
{
|
//m_pRP2P->IRP2P_DisplayMessage(_T("Dark AOI Image Load Fail![D_%07d_%07d.bmp]"), nPosX, nPosY);
|
m_pRP2P->IRP2P_DisplayMessage(_T("Dark AOI Image Load Fail![%s]"), strAoiDarkPath);
|
}
|
}
|
else
|
{
|
//m_pRP2P->IRP2P_DisplayMessage(_T("Dark AOI Image Search Fail![D_%07d_%07d.bmp]"), nPosX, nPosY);
|
m_pRP2P->IRP2P_DisplayMessage(_T("Dark AOI Image Search Fail![%s]"), strAoiDarkPath);
|
}
|
}
|
|
// Bright image
|
//if(nOpticType & DEFECT_OPTIC_BRIGHT)
|
{
|
if(strAoiBrightPath.IsEmpty()==FALSE)
|
{
|
if(pAoiBright->LoadImage(strAoiBrightPath)==FALSE)
|
{
|
//m_pRP2P->IRP2P_DisplayMessage(_T("Bright AOI Image Load Fail![B_%07d_%07d.bmp]"), nPosX, nPosY);
|
m_pRP2P->IRP2P_DisplayMessage(_T("Bright AOI Image Load Fail![%s]"), strAoiBrightPath);
|
}
|
}
|
else
|
{
|
//m_pRP2P->IRP2P_DisplayMessage(_T("Bright AOI Image Search Fail![B_%07d_%07d.bmp]"), nPosX, nPosY);
|
m_pRP2P->IRP2P_DisplayMessage(_T("Bright AOI Image Search Fail![%s]"), strAoiBrightPath);
|
}
|
}
|
}
|
|
void CReviewProcessor_CPJT::FindAoiDefectImagePath( const CString& strGlassID, int nOpticType, int nPosX, int nPosY, CString& strDarkPath, CString& strBrightPath)
|
{
|
|
BOOL bRet;
|
CFileFind finder;
|
CString strSearchPath = _T("");
|
|
//if (nOpticType & DEFECT_OPTIC_DARK)
|
{
|
// Dark field
|
//strSearchPath.Format(_T("%s\\%s\\D_%07d_%07d.bmp"), m_strInspectImagePath, strGlassID, nPosX, nPosY);
|
strSearchPath.Format(_T("%s\\%s\\%d_%d_Q*.bmp"), m_strInspectImagePath, strGlassID, nPosX, nPosY);
|
bRet = finder.FindFile(strSearchPath);
|
m_pRP2P->IRP2P_DisplayMessage(_T("[SearchDefect]D %s"), strSearchPath);
|
|
while(bRet)
|
{
|
bRet = finder.FindNextFile();
|
|
if(finder.IsDots()) continue;
|
if(finder.IsDirectory()) continue;
|
strDarkPath = finder.GetFilePath();
|
}
|
|
finder.Close();
|
}
|
|
//if (nOpticType & DEFECT_OPTIC_BRIGHT)
|
{
|
// Bright field
|
//strSearchPath.Format(_T("%s\\%s\\B_%07d_%07d.bmp"), m_strInspectImagePath, strGlassID, nPosX, nPosY);
|
strSearchPath.Format(_T("%s\\%s\\%d_%d_C*.bmp"), m_strInspectImagePath, strGlassID, nPosX, nPosY);
|
bRet = finder.FindFile(strSearchPath);
|
m_pRP2P->IRP2P_DisplayMessage(_T("[SearchDefect]B %s"), strSearchPath);
|
while(bRet)
|
{
|
bRet = finder.FindNextFile();
|
|
if(finder.IsDots()) continue;
|
if(finder.IsDirectory()) continue;
|
strBrightPath = finder.GetFilePath();
|
}
|
|
finder.Close();
|
}
|
}
|
|
void CReviewProcessor_CPJT::FindDefectPos(int nThreadIdx, CCHImageData* pImageData, const SReviewDefectFindParam& findParam, SReviewDefectFindResult& findResult, SReviewResult* pReviewResult)
|
{
|
BOOL bDefectFindResult = FALSE;
|
|
if (m_bDefectFindProcess && m_pReviewDefectFinder && pReviewResult->nLocation==DefectLoc_Pattern)
|
{
|
SReviewDefectFindParam findParam = m_ReviewDefectFindParam;
|
findParam.dPitchX = findParam.dPitchX / pReviewResult->dMeasureResolution;
|
findParam.dPitchY = findParam.dPitchY / pReviewResult->dMeasureResolution;
|
findParam.dResolutionX = pReviewResult->dMeasureResolution;
|
findParam.dResolutionY = pReviewResult->dMeasureResolution;
|
|
// 4-1. gray band image
|
CCHImageData bandImage;
|
bDefectFindResult = pImageData->GetBandImage(BandTypeGray, &bandImage);
|
|
CProcessTimer processTimer;
|
|
// 4-2. find defect info
|
if (bDefectFindResult)
|
{
|
processTimer.Start();
|
|
bDefectFindResult = m_pReviewDefectFinder[nThreadIdx].FindDefect(
|
(BYTE*)bandImage.GetImageBuffer(),
|
bandImage.GetWidth(),
|
bandImage.GetHeight(),
|
findParam,
|
findResult);
|
|
processTimer.End();
|
}
|
|
double dAverageGray = 0.0;
|
if (CCHImageProcess::ImageAverage(&bandImage, dAverageGray)==1)
|
{
|
pReviewResult->nLightLevel = int(dAverageGray+0.5);
|
}
|
|
// display result
|
if(bDefectFindResult)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[FindDefect]Success! Module[%d]_Point[%d] => pitch: %.04lf, x: %d, y: %d, size: %d [%.3f ms]"),
|
pReviewResult->nModuleIdx, pReviewResult->nResultIdx, findResult.dDefectPitch, findResult.nDefectPosX, findResult.nDefectPosY, findResult.nDefectArea,
|
processTimer.GetDurationMilliSecond());
|
|
pReviewResult->nReview_ResultCode = 1;
|
pReviewResult->nReview_Width = int(findResult.rtDefectRect.Width() * pReviewResult->dMeasureResolution + 0.5); // um
|
pReviewResult->nReview_Height = int(findResult.rtDefectRect.Height() * pReviewResult->dMeasureResolution + 0.5); // um
|
pReviewResult->nReview_Length = findResult.nDefectRScale; // um
|
pReviewResult->nReview_Square = int(findResult.nDefectArea * pReviewResult->dMeasureResolution + 0.5); // um
|
pReviewResult->nReview_Stat = 0;
|
}
|
else
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[FindDefect]FAIL! Module[%d]_Point[%d]"), pReviewResult->nModuleIdx, pReviewResult->nResultIdx);
|
}
|
}
|
}
|
|
BOOL CReviewProcessor_CPJT::MakeUploadImage(CCHImageData *pUploadImage, CCHImageData *pReviewCamSource, CCHImageData *pAoiDark, CCHImageData *pAoiBright, const SReviewDefectFindResult& findResult, const SReviewResult* pReviewResult)
|
{
|
if (m_pView==NULL || pUploadImage==NULL || pReviewCamSource==NULL || pReviewResult==NULL) return FALSE;
|
|
if (!pReviewCamSource->GetImageExist()) return FALSE;
|
|
CCHImageData pReviewCam;
|
CCHImageData tempImage1;
|
|
if (m_nImageRotate > 0)
|
{
|
tempImage1.CopyImageFrom(pReviewCamSource);
|
CCHImageProcess::ImageRotate(pReviewCamSource, &tempImage1, (90.0*m_nImageRotate));
|
}
|
|
if (m_nimageFlip > 0)
|
{
|
if(m_nImageRotate > 0)
|
{
|
CCHImageProcess::ImageFlip(&tempImage1, &pReviewCam, m_nimageFlip);
|
}
|
else
|
{
|
CCHImageProcess::ImageFlip(pReviewCamSource, &pReviewCam, m_nimageFlip);
|
}
|
}
|
else
|
{
|
if(m_nImageRotate > 0)
|
{
|
pReviewCam.CopyImageFrom(&tempImage1);
|
}
|
else
|
{
|
pReviewCam.CopyImageFrom(pReviewCamSource);
|
}
|
}
|
// make aoi image
|
int nAoiWidth, nAoiHeight;
|
CCHImageData pAoiDark1, pAoiBright1, pAoiDark2, pAoiBright2;
|
MakeAoiImage(pAoiDark, pAoiBright, &pAoiDark1, &pAoiBright1, &pAoiDark2, &pAoiBright2, nAoiWidth, nAoiHeight);
|
|
// set roi rect
|
CRect rtRoiRect = CRect(0,0,0,0);
|
rtRoiRect.left = (pReviewCam.GetWidth() - m_nReviewResizeWidth) / 2;
|
rtRoiRect.right = rtRoiRect.left + m_nReviewResizeWidth;
|
rtRoiRect.top = (pReviewCam.GetHeight() - m_nReviewResizeHeight) / 2;
|
rtRoiRect.bottom = rtRoiRect.top + m_nReviewResizeHeight;
|
|
// set total size * scale
|
int nTotalWidth = int(m_nReviewResizeWidth * m_dReviewImageScale + 0.5);
|
int nTotalHeight = int(m_nReviewResizeHeight * m_dReviewImageScale + 0.5 + max(pAoiDark2.GetHeight(), pAoiBright2.GetHeight()));
|
int nTotalHeight2 = int(m_nReviewResizeHeight * m_dReviewImageScale + 0.5);
|
|
// create memdc
|
CDC memDC;
|
CBitmap Bitmap;
|
CDC *pDC = m_pView->GetDC();
|
memDC.CreateCompatibleDC(pDC);
|
Bitmap.CreateCompatibleBitmap(pDC, nTotalWidth, nTotalHeight);
|
CBitmap* pOldBitmap = memDC.SelectObject(&Bitmap);
|
|
// draw background
|
memDC.SelectStockObject(BLACK_PEN);
|
memDC.SelectStockObject(BLACK_BRUSH);
|
memDC.Rectangle(0, 0, nTotalWidth, nTotalHeight);
|
|
// draw review image
|
//pReviewCam->ShowImage(memDC.m_hDC, 0, 0, m_nReviewResizeWidth, m_nReviewResizeHeight, rtRoiRect.left, rtRoiRect.top);
|
pReviewCam.ShowImage(memDC.m_hDC, rtRoiRect, CRect(0,0,nTotalWidth,nTotalHeight2));
|
|
// draw review ruler
|
//DrawRuler(&memDC, m_nReviewResizeWidth, m_nReviewResizeHeight, pReviewResult->dMeasureResolution, 20.0); // resolution, ruler gab
|
double dRulerGab = 20.0 / m_dReviewImageScale;
|
double dScaleResolution = pReviewResult->dMeasureResolution / m_dReviewImageScale;
|
|
//DrawRuler(&memDC, nTotalWidth, nTotalHeight2, dScaleResolution, dRulerGab); // resolution, ruler gab //taek 210127
|
|
// draw text string
|
DrawDefectInfo(&memDC, findResult, pReviewResult);
|
|
//DrawAoiImage(&memDC, &pAoiDark2, &pAoiBright2, &pAoiDark2, &pAoiBright2, nAoiWidth, nAoiHeight);
|
|
//DrawCenterLine(&memDC, nTotalWidth, nTotalHeight);
|
// DrawCenterRect(&memDC, nTotalWidth, nTotalHeight, 100, 100, pReviewResult->dMeasureResolution);
|
|
BOOL bResult = pUploadImage->DCtoIplImage(&memDC, CRect(0,0, nTotalWidth, nTotalHeight));
|
|
m_pView->ReleaseDC(pDC);
|
memDC.SelectObject(pOldBitmap);
|
memDC.DeleteDC();
|
|
|
|
return bResult;
|
}
|
|
void CReviewProcessor_CPJT::MakeAoiImage(CCHImageData *pAoiDark, CCHImageData* pAoiBright, CCHImageData* pAoiDark1, CCHImageData* pAoiBright1, CCHImageData* pAoiDark2, CCHImageData* pAoiBright2, int& nMaxWidth, int& nMaxHeight)
|
{
|
nMaxWidth = nMaxHeight = 0;
|
|
if (pAoiDark==NULL && pAoiBright==NULL) return;
|
|
int nWidthDark, nHeightDark;
|
int nWidthBright, nHeightBright;
|
|
float scale = 1;
|
|
nWidthDark = nHeightDark = nWidthBright = nHeightBright = 0;
|
|
// 20170817 smok Dark, Bright
|
// dark
|
CCHImageData subImage;
|
if(pAoiDark!=NULL && pAoiDark->GetImageExist())
|
{
|
// pAoiDark->SaveImage(_T("d:\\dark_source.bmp"));
|
nWidthDark = pAoiDark->GetWidth();
|
nHeightDark = pAoiDark->GetHeight();
|
|
scale = m_nReviewResizeWidth * (float)m_dReviewImageScale /2 / nWidthDark;
|
nWidthDark = (int)(m_nReviewResizeWidth * m_dReviewImageScale /2);
|
nHeightDark = (int)(nHeightDark * scale);
|
|
// resize
|
if (CCHImageProcess::ImageResize(pAoiDark, pAoiDark1, 1) ==1)// ImageRotate(pAoiDark, pAoiDark1, RotateTypeRight)==1)
|
{
|
// pAoiDark1->SaveImage(_T("d:\\dark_rotate.bmp"));
|
|
int nResizeX = pAoiDark1->GetWidth() / 4;
|
int nResizeY = pAoiDark1->GetHeight() / 4;
|
|
int nResizeWidth = pAoiDark1->GetWidth() / 2;
|
int nResizeHeight = pAoiDark1->GetHeight() / 2;
|
|
if (pAoiDark1->GetSubImage(nResizeX, nResizeY, nResizeWidth, nResizeHeight, &subImage)==1)
|
{
|
// subImage.SaveImage(_T("d:\\dark_sub.bmp"));
|
|
CCHImageProcess::ImageResize(&subImage, pAoiDark2, nWidthDark, nHeightDark);
|
|
// pAoiDark2->SaveImage(_T("d:\\dark_resize.bmp"));
|
}
|
}
|
}
|
scale = 1;
|
|
// bright
|
if(pAoiBright!=NULL && pAoiBright->GetImageExist())
|
{
|
// pAoiBright->SaveImage(_T("d:\\bright_source.bmp"));
|
nWidthBright = pAoiBright->GetWidth();
|
nHeightBright = pAoiBright->GetHeight();
|
|
scale = m_nReviewResizeWidth * (float)m_dReviewImageScale /2 / nWidthBright;
|
nWidthBright = (int)(m_nReviewResizeWidth * m_dReviewImageScale /2);
|
nHeightBright = (int)(nHeightBright * scale);
|
|
// resize
|
if (CCHImageProcess::ImageResize(pAoiBright, pAoiBright1, 1) ==1)// ImageRotate(pAoiBright, pAoiBright1, RotateTypeRight)==1)
|
{
|
// pAoiBright1->SaveImage(_T("d:\\bright_rotate.bmp"));
|
|
int nResizeX = pAoiBright1->GetWidth() / 4;
|
int nResizeY = pAoiBright1->GetHeight() / 4;
|
|
int nResizeWidth = pAoiBright1->GetWidth() / 2;
|
int nResizeHeight = pAoiBright1->GetHeight() / 2;
|
|
if (pAoiBright1->GetSubImage(nResizeX, nResizeY, nResizeWidth, nResizeHeight, &subImage)==1)
|
{
|
// subImage.SaveImage(_T("d:\\bright_sub.bmp"));
|
|
CCHImageProcess::ImageResize(&subImage, pAoiBright2, nWidthBright, nHeightBright);
|
|
// pAoiBright2->SaveImage(_T("d:\\bright_resize.bmp"));
|
}
|
}
|
}
|
|
nMaxWidth = max(nWidthDark, nWidthBright);
|
nMaxHeight = max(nHeightDark, nHeightBright);
|
}
|
|
void CReviewProcessor_CPJT::DrawAoiImage(CDC *pDC, CCHImageData *pAoiDark1, CCHImageData* pAoiBright1, CCHImageData *pAoiDark2, CCHImageData* pAoiBright2, int nWidth, int nHeight)
|
{
|
if (pDC==NULL) return;
|
|
// set total size * scale
|
int nTotalWidth = int(m_nReviewResizeWidth * m_dReviewImageScale + 0.5);
|
int nTotalHeight = int(m_nReviewResizeHeight * m_dReviewImageScale + 0.5);
|
|
//int nX = nTotalWidth - nWidth;
|
//int nY = nTotalHeight - (nHeight * 2);
|
|
int nX = 0;
|
int nY = nTotalHeight;
|
pAoiDark1->ShowImage(pDC->m_hDC, nX, nY, pAoiDark1->GetWidth(), pAoiDark1->GetHeight(), 0, 0);
|
pAoiBright1->ShowImage(pDC->m_hDC, nX + nWidth, nY , pAoiBright1->GetWidth(), pAoiBright1->GetHeight(), 0, 0);
|
//pAoiDark1->ShowImage(pDC->m_hDC, nTotalWidth - nWidth, nTotalHei4ght-nHeight, pAoiDark1->GetWidth(), pAoiDark1->GetHeight(), 0, 0);
|
//pAoiBright1->ShowImage(pDC->m_hDC, nTotalWidth - nWidth, nTotalHeight-nHeight, pAoiBright1->GetWidth(), pAoiBright1->GetHeight(), 0, 0);
|
|
CFont Font;
|
VERIFY(Font.CreateFont(
|
50, // nHeight
|
25, // nWidth
|
0, // nEscapement
|
0, // nOrientation
|
FW_NORMAL, // nWeight
|
FALSE, // bItalic
|
FALSE, // bUnderline
|
0, // cStrikeOut
|
ANSI_CHARSET, // nCharSet
|
OUT_DEFAULT_PRECIS, // nOutPrecision
|
CLIP_DEFAULT_PRECIS, // nClipPrecision
|
DEFAULT_QUALITY, // nQuality
|
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
|
_T("Arial"))); // lpszFacename
|
|
CFont *pOldFont = pDC->SelectObject(&Font);
|
pDC->SetTextColor(RGB(255,0,0));
|
|
CString strArrow = _T("¢Ö");
|
CSize size = pDC->GetTextExtent(strArrow);
|
int nCenterX = nX + (nWidth / 2) - size.cx;
|
int nCenterY = nY + (nHeight / 2)/* + (size.cy / 2)*/;
|
|
if (pAoiDark1->GetImageExist())
|
pDC->TextOut(nCenterX, nCenterY, strArrow);
|
if (pAoiBright1->GetImageExist())
|
pDC->TextOut(nCenterX + nWidth, nCenterY, strArrow);
|
|
pDC->SelectObject(pOldFont);
|
Font.DeleteObject();
|
|
}
|
|
void CReviewProcessor_CPJT::DrawDefectInfo(CDC *pDC, const SReviewDefectFindResult& findResult, const SReviewResult* pReviewResult)
|
{
|
if (pDC==NULL || m_pRP2P==NULL) return;
|
|
Gdiplus::Graphics graphics(pDC->GetSafeHdc());
|
|
graphics.SetSmoothingMode(SmoothingModeAntiAlias);
|
graphics.SetInterpolationMode(InterpolationModeHighQuality);
|
|
GraphicsPath path;
|
wchar_t pstrfontfamily[128] = {};
|
CString strfontfamily = _T(_T("Arial"));
|
|
#ifdef UNICODE
|
wcscpy(pstrfontfamily,(LPWSTR)strfontfamily.GetBuffer(0));
|
#endif
|
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, strfontfamily, strfontfamily.GetLength(), pstrfontfamily, strfontfamily.GetLength());
|
|
FontFamily fontFamily(pstrfontfamily);
|
StringFormat strformat;
|
StringFormat *strformat1;
|
|
int nStartX = ImageCaptionStartX;
|
int nStartY = ImageCaptionStartY;
|
//Gdiplus::REAL nFontSize = 20;
|
Gdiplus::REAL nFontSize = (REAL)min(int(m_nReviewResizeHeight * m_dReviewImageScale + 0.5) / 25, int(m_nReviewResizeWidth * m_dReviewImageScale + 0.5) / 60);
|
int nRowGab = (int)nFontSize + 4;
|
|
CString strValue = _T("");
|
CString strTemp = _T("");
|
CTime snapTime = CTime::GetCurrentTime();
|
//////////////////////////////////////////////////////////////////////////
|
// Machine id
|
CGlassResult* pGlassResult = m_pRP2P->IRP2P_GetCurrentGlassResult();
|
if(pGlassResult == NULL) return;
|
|
|
|
CDitGlassRawClient *pDitGlassRawClient = CDitGlassRawClient::GetInstance();
|
_grmDefectData* pSharedDefect;
|
|
pSharedDefect = pDitGlassRawClient->GetDefectData(pReviewResult->nDefectidx2);
|
|
double dPosX = 0.0;
|
double dPosY = 0.0;
|
|
if(pDitGlassRawClient->isConnect() == TRUE)
|
{
|
if(pReviewResult->nReviewType == 1 || pReviewResult->nReviewType == 4){
|
dPosX = double(pReviewResult->nUMOriginX)/1000.0;
|
dPosY = double(pReviewResult->nUMOriginY)/1000.0;
|
}
|
else
|
{
|
dPosX = double(pSharedDefect->m_nUMOriginX)/1000.0;
|
dPosY = double(pSharedDefect->m_nUMOriginY)/1000.0;
|
}
|
{
|
if(pDitGlassRawClient->GetGlassData()->m_nScanCoordinateY == 0)
|
{
|
m_pRP2P->IRP2P_GetCenterCoordinate(dPosX, dPosY);
|
}
|
else
|
{
|
double dPosXTemp=dPosX;
|
double dPosYTemp=dPosY;
|
m_pRP2P->IRP2P_GetCenterCoordinate(dPosXTemp, dPosYTemp);
|
|
dPosX=dPosYTemp;
|
dPosY=dPosXTemp;
|
}
|
}
|
}
|
int nPlanType = pReviewResult->nReviewType;
|
CString strPlanType = _T("");
|
if(nPlanType == 1){
|
strPlanType = _T("USER");
|
}
|
else if(nPlanType == 4)
|
{
|
strPlanType = _T("REFLOW");
|
}
|
|
|
|
int nReflowjuge = pReviewResult->nReflow_Result;
|
|
CString strReflowJuge = _T("");
|
|
if(nReflowjuge==4)
|
{
|
strReflowJuge =_T("OK");
|
}
|
else if(nReflowjuge == 3 || nReflowjuge == 2)
|
{
|
strReflowJuge =_T("OK");
|
}
|
else if(nReflowjuge == 1 || nReflowjuge == 0)
|
{
|
strReflowJuge =_T("NG");
|
}
|
else
|
{
|
strReflowJuge =_T("Error");
|
}
|
|
if(nPlanType == 1 ) //User
|
{
|
// PPID
|
wchar_t pstrPrefix[128] = {};
|
|
strValue.Format(_T("Tool[%s].Recipe[%s].ScanNo[%d/%d].Time[%4d/%2d/%2d_%d:%d:%d].MaxGray[%d].RefGray[%d].REVCnt[%d]"),pReviewResult->strEquipID,pGlassResult->m_strPPID,0,0,snapTime.GetYear(), snapTime.GetMonth(), snapTime.GetDay(),
|
snapTime.GetHour(), snapTime.GetMinute(), snapTime.GetSecond(),0,0,pReviewResult->nResultIdx);
|
#ifdef UNICODE
|
wcscpy(pstrPrefix,(LPWSTR)strValue.GetBuffer(0));
|
#endif
|
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, strValue, strValue.GetLength(), pstrPrefix, strValue.GetLength());
|
|
path.AddString(pstrPrefix, (int)strlen(strValue), &fontFamily, FontStyleRegular, nFontSize, Gdiplus::Point(nStartX,nStartY), &strformat );
|
nStartY += nRowGab;
|
int i = snapTime.GetHour();
|
|
|
|
strValue.Format(_T("GlassID[%s].Panel[%s].D/G[%d/%d].X/Y[%.3lf/%.3lf]"), m_strJobID,pReviewResult->strCellID,0,0, dPosX, dPosY);
|
#ifdef UNICODE
|
wcscpy(pstrPrefix,(LPWSTR)strValue.GetBuffer(0));
|
#endif
|
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, strValue, strValue.GetLength(), pstrPrefix, strValue.GetLength());
|
|
path.AddString(pstrPrefix, (int)strlen(strValue), &fontFamily, FontStyleRegular, nFontSize, Gdiplus::Point(nStartX,nStartY), &strformat );
|
nStartY += nRowGab;
|
|
|
strValue.Format(_T("DefectType[%s].Cam[%d] Size[%dum] ReviewMag[%dX] PLAN[%s]"),pReviewResult->strDefectType,pReviewResult->nAOICameraIdx,
|
pReviewResult->nAOISize,(int)pReviewResult->dMagnification,strPlanType);
|
#ifdef UNICODE
|
wcscpy(pstrPrefix,(LPWSTR)strValue.GetBuffer(0));
|
#endif
|
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, strValue, strValue.GetLength(), pstrPrefix, strValue.GetLength());
|
|
path.AddString(pstrPrefix, (int)strlen(strValue), &fontFamily, FontStyleRegular, nFontSize, Gdiplus::Point(nStartX,nStartY), &strformat );
|
nStartY += nRowGab;
|
|
}
|
else if(nPlanType== 4){ //reflow
|
|
wchar_t pstrPrefix[128] = {};
|
|
|
|
strValue.Format(_T("Tool[%s].Recipe[%s].ScanNo[%d/%d].Time[%4d/%2d/%2d_%d:%d:%d].MaxGray[%d].RefGray[%d].REVCnt[%d]"),pReviewResult->strEquipID,pGlassResult->m_strPPID,0,0,snapTime.GetYear(), snapTime.GetMonth(), snapTime.GetDay(),
|
snapTime.GetHour(), snapTime.GetMinute(), snapTime.GetSecond(),0,0,pReviewResult->nResultIdx);
|
#ifdef UNICODE
|
wcscpy(pstrPrefix, (LPWSTR)strValue.GetBuffer(0));
|
#endif
|
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, strValue, strValue.GetLength(), pstrPrefix, strValue.GetLength());
|
|
path.AddString(pstrPrefix, (int)strlen(strValue), &fontFamily, FontStyleRegular, nFontSize, Gdiplus::Point(nStartX,nStartY), &strformat );
|
nStartY += nRowGab;
|
int i = snapTime.GetHour();
|
|
|
|
strValue.Format(_T("GlassID[%s].Panel[%s].D/G[%d/%d].X/Y[%.3lf/%.3lf]"), m_strJobID,pReviewResult->strCellID,0,0, dPosX, dPosY);
|
#ifdef UNICODE
|
wcscpy(pstrPrefix, (LPWSTR)strValue.GetBuffer(0));
|
#endif
|
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, strValue, strValue.GetLength(), pstrPrefix, strValue.GetLength());
|
|
path.AddString(pstrPrefix, (int)strlen(strValue), &fontFamily, FontStyleRegular, nFontSize, Gdiplus::Point(nStartX,nStartY), &strformat );
|
nStartY += nRowGab;
|
|
|
|
strValue.Format(_T("DefectType[%s].Cam[%d] Size[%dum] ReviewMag[%dX] PLAN[%s],OverFlow[%s]"),pReviewResult->strDefectType,pReviewResult->nAOICameraIdx,
|
pReviewResult->nAOISize,(int)pReviewResult->dMagnification,strPlanType,strReflowJuge);
|
#ifdef UNICODE
|
wcscpy(pstrPrefix, (LPWSTR)strValue.GetBuffer(0));
|
#endif
|
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, strValue, strValue.GetLength(), pstrPrefix, strValue.GetLength());
|
|
path.AddString(pstrPrefix, (int)strlen(strValue), &fontFamily, FontStyleRegular, nFontSize, Gdiplus::Point(nStartX,nStartY), &strformat );
|
nStartY += nRowGab;
|
}
|
else {
|
wchar_t pstrPrefix[128] ={};
|
|
int nValue = 0;
|
for (int i = 15; i >= 0; i--)
|
{
|
if (pSharedDefect->m_sZonePixelCount[i] > 0)
|
nValue += 1;
|
if (i > 0)
|
nValue = nValue << 1;
|
}
|
|
//taek 210127
|
|
// PPID
|
// strValue.Format(_T("Tool[%s].Recipe[%s].ScanNo[%d/%d].Time[%4d/%2d/%2d_%d:%d:%d].MaxGray[%d].RefGray[%d].REVCnt[%d]"),pReviewResult->strEquipID,pGlassResult->m_strPPID,pReviewResult->nAOIScanIdx,0,snapTime.GetYear(), snapTime.GetMonth(), snapTime.GetDay(),
|
// snapTime.GetHour(), snapTime.GetMinute(), snapTime.GetSecond(),pReviewResult->nSrcMax,pReviewResult->nRefMax,pReviewResult->nResultIdx);
|
strValue.Format(_T("Module ID [%s].Inspector Cam [%d].Cell ID [%s].Revie Cam [%d]"), pDitGlassRawClient->GetGlassData()->m_strOperID,pReviewResult->nAOICameraIdx,pReviewResult->strCellID, pReviewResult->nModuleIdx);
|
|
#ifdef UNICODE
|
wcscpy(pstrPrefix, (LPWSTR)strValue.GetBuffer(0));
|
#endif
|
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, strValue, strValue.GetLength(), pstrPrefix, strValue.GetLength());
|
|
path.AddString(pstrPrefix, (int)strlen(strValue), &fontFamily, FontStyleRegular, nFontSize, Gdiplus::Point(nStartX,nStartY), &strformat );
|
nStartY += nRowGab;
|
int i = snapTime.GetHour();
|
|
|
//strValue.Format(_T("GlassID[%s].Panel[%s].D/G[%d/%d].X/Y[%.3lf/%.3lf]"), m_strJobID,pReviewResult->strCellID,pReviewResult->nUMCellX,pReviewResult->nUMCellY, dPosX, dPosY);
|
strValue.Format(_T("Size [Size:%d, dx:%dum, dy:%dum, SizeH:%d].Zone [%04X].Stack [%s].RTC [%s]"),pSharedDefect->m_nUMSize, pSharedDefect->m_nUMSizeX,pSharedDefect->m_nUMSizeY,pSharedDefect->m_sPixelHeight ,nValue, GetStackType(pReviewResult->nStackType), pSharedDefect->m_strDefectCode);
|
#ifdef UNICODE
|
wcscpy(pstrPrefix, (LPWSTR)strValue.GetBuffer(0));
|
#endif
|
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, strValue, strValue.GetLength(), pstrPrefix, strValue.GetLength());
|
|
path.AddString(pstrPrefix, (int)strlen(strValue), &fontFamily, FontStyleRegular, nFontSize, Gdiplus::Point(nStartX,nStartY), &strformat );
|
nStartY += nRowGab;
|
|
_grmDefectReviewData * pSharedDefectReview = &pSharedDefect->m_ReviewDefect;
|
if(pSharedDefectReview->m_fWsi_ResultData[1] != 0.0)
|
{
|
|
// strValue.Format(_T("DefectType[%s].Cam[%d] Size[%dum] ReviewMag[%dX] WsiHeight[%.3lfum]"),pReviewResult->strDefectType,pReviewResult->nAOICameraIdx,
|
// pReviewResult->nAOISize,(int)pReviewResult->dMagnification, pSharedDefectReview->m_fWsi_ResultData[1]);
|
strValue.Format(_T("POS X/Y[%d,%d]"), pSharedDefect->m_nUMCenterAlignX, pSharedDefect->m_nUMCenterAlignY *-1);
|
#ifdef UNICODE
|
wcscpy(pstrPrefix, (LPWSTR)strValue.GetBuffer(0));
|
#endif
|
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, strValue, strValue.GetLength(), pstrPrefix, strValue.GetLength());
|
|
path.AddString(pstrPrefix, (int)strlen(strValue), &fontFamily, FontStyleRegular, nFontSize, Gdiplus::Point(nStartX,nStartY), &strformat );
|
nStartY += nRowGab;
|
}
|
else
|
{
|
// strValue.Format(_T("DefectType[%s].Cam[%d] Size[%dum] ReviewMag[%dX] WsiHeight[None]"),pReviewResult->strDefectType,pReviewResult->nAOICameraIdx,
|
// pReviewResult->nAOISize,(int)pReviewResult->dMagnification);
|
|
strValue.Format(_T("POS X/Y[%d,%d]"), pSharedDefect->m_nUMCenterAlignX, pSharedDefect->m_nUMCenterAlignY *-1);
|
|
#ifdef UNICODE
|
wcscpy(pstrPrefix, (LPWSTR)strValue.GetBuffer(0));
|
#endif
|
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, strValue, strValue.GetLength(), pstrPrefix, strValue.GetLength());
|
|
path.AddString(pstrPrefix, (int)strlen(strValue), &fontFamily, FontStyleRegular, nFontSize, Gdiplus::Point(nStartX,nStartY), &strformat );
|
nStartY += nRowGab;
|
|
}
|
}
|
|
// draw string
|
for(int i=1; i<4; ++i)
|
{
|
Pen pen(Color(255, 50, 50, 50), REAL(i));
|
pen.SetLineJoin(LineJoinRound);
|
graphics.DrawPath(&pen, &path);
|
}
|
|
SolidBrush brush(Color(255,255,0));
|
graphics.FillPath(&brush, &path);
|
}
|
|
BOOL CReviewProcessor_CPJT::MakeUploadMeasureImage(CCHImageData *pUploadImage, CCHImageData *pReviewCam, const SReviewResult* pReviewResult, CResultTriangle * pResultTriangle, int nMeasureResult) //Modify by JuneKi 2016-02-29
|
{
|
|
if (m_pView==NULL || pUploadImage==NULL || pReviewCam==NULL || pReviewResult==NULL)
|
{
|
g_pLog->DisplayMessage(_T("m_pView==NULL || pUploadImage==NULL || pReviewCam==NULL || pReviewResult==NULL"));
|
return FALSE;
|
}
|
|
|
if (!pReviewCam->GetImageExist())
|
{
|
g_pLog->DisplayMessage(_T("!pReviewCam->GetImageExist()"));
|
return FALSE;
|
}
|
|
if(pResultTriangle==NULL)
|
{
|
g_pLog->DisplayMessage(_T("ResultTriangle == NULL"));
|
pReviewCam->CopyImageTo(pUploadImage);
|
pUploadImage->DrawText(CPoint(10,20), RGB(255,0,0), CString(_T("Not Exist ResultTriangle")));
|
return TRUE;
|
}
|
//ImageFailModel=-1, ImageFailSource=-2, ImageFailSub=-3, ImageFailBandModel=-4, ImageFailBandSource=-5,
|
// RecipeFailModel=-6, RecipeFailMarker=-7, RecipeFailFormula=-8,
|
// ProcessFailModel=-9, ProcessFailMarker=-10, ProcessFailFormula=-11,
|
// ResultFailModel=-12, ResultFailMarker=-13, ResultFailFormula=-14,
|
// EdgeFailLeft=-15, EdgeFailRight=-16, PreProcessFail=-17, CircleCoefficientFail=-18,
|
// ProcessSuccess=1, ProcessNone=0
|
|
//Insert ErrorCode to UploadImage
|
if(nMeasureResult < 0)
|
{
|
pReviewCam->CopyImageTo(pUploadImage);
|
for(int i = 1;i<ErrorCount;i++)
|
{
|
if((i + nMeasureResult) == 0)
|
{
|
pUploadImage->DrawText(CPoint(10,20), RGB(255,0,0), ErrorStringCode[i-1]);
|
}
|
}
|
}
|
|
CResultModel * pResultModel = pResultTriangle->GetResultModel(0);
|
if(pResultModel==NULL)
|
{
|
g_pLog->DisplayMessage(_T("ResultModel == NULL"));
|
return FALSE;
|
}
|
CRect rtUploadImage = CRect(pResultModel->m_nFindLeft, pResultModel->m_nFindTop, pResultModel->m_nFindRight, pResultModel->m_nFindBottom);
|
pReviewCam->GetSubImage(rtUploadImage, pUploadImage);
|
|
int i, nTextYPos;
|
int nTextHGap = 20;
|
//int nFormulaCnt = pReviewResult->vecMeasure_ResultData.size();
|
int nFormulaCnt = pResultTriangle->GetResultFormulaCount();
|
CString strFormula;
|
|
for(i = 0, nTextYPos = nTextHGap;i<nFormulaCnt;i++, nTextYPos+=nTextHGap)
|
{
|
strFormula.Format(_T("[%s] : %.3lf um,"), pReviewResult->vecMeasure_ResultData[i].m_strResultName, pReviewResult->vecMeasure_ResultData[i].m_dResultValue);
|
pUploadImage->DrawText(CPoint(10,nTextYPos), RGB(255,0,0), strFormula);
|
}
|
|
double dAvgValue = 0.0;
|
CCHImageData bandImage;
|
BOOL bBandImage = pUploadImage->GetBandImage(BandTypeGray, &bandImage);
|
if(CCHImageProcess::ImageAverage(&bandImage, dAvgValue) == 1)
|
{
|
strFormula.Format(_T("[IMAGE INTENSITY] : %d"), (int)dAvgValue);
|
pUploadImage->DrawText(CPoint(10,nTextYPos), RGB(255,0,0), strFormula);
|
}
|
|
|
int nMakerCnt = pResultTriangle->GetResultMarkerCount();
|
CResultMarker * pResultMaker;
|
int nPtRuler = 5;
|
for(i=0;i<nMakerCnt;i++)
|
{
|
pResultMaker = pResultTriangle->GetResultMarker(i);
|
pUploadImage->DrawLine(CPoint((int)pResultMaker->m_dFirstX,(int)pResultMaker->m_dFirstY), CPoint((int)pResultMaker->m_dSecondX,(int)pResultMaker->m_dSecondY), RGB(0,255,0));
|
if(pResultMaker->m_nEdgeDirection == EdgeDirection_Horiz)
|
{
|
pUploadImage->DrawLine(CPoint((int)pResultMaker->m_dFirstX-nPtRuler,(int)pResultMaker->m_dFirstY), CPoint((int)pResultMaker->m_dFirstX+nPtRuler,(int)pResultMaker->m_dFirstY), RGB(0,255,0));
|
pUploadImage->DrawLine(CPoint((int)pResultMaker->m_dSecondX-nPtRuler,(int)pResultMaker->m_dSecondY), CPoint((int)pResultMaker->m_dSecondX+nPtRuler,(int)pResultMaker->m_dSecondY), RGB(0,255,0));
|
}
|
else
|
{
|
pUploadImage->DrawLine(CPoint((int)pResultMaker->m_dFirstX,(int)pResultMaker->m_dFirstY-nPtRuler), CPoint((int)pResultMaker->m_dFirstX,(int)pResultMaker->m_dFirstY+nPtRuler), RGB(0,255,0));
|
pUploadImage->DrawLine(CPoint((int)pResultMaker->m_dSecondX,(int)pResultMaker->m_dSecondY-nPtRuler), CPoint((int)pResultMaker->m_dSecondX,(int)pResultMaker->m_dSecondY+nPtRuler), RGB(0,255,0));
|
}
|
}
|
|
return TRUE;
|
}
|
|
void CReviewProcessor_CPJT::ProcessSuccessReset()
|
{
|
bProcessSuccess[CPJT_REVIEW_SUCCESS] = FALSE;
|
bProcessSuccess[CPJT_MEASURE_SUCCESS] = FALSE;
|
bProcessSuccess[CPJT_WSI_SUCCESS] = FALSE;
|
bProcessSuccess[CPJT_REFLOW_SUCCESS] = FALSE;
|
}
|
|
|
BOOL CReviewProcessor_CPJT::CheckProcessSuccess(CRsRcpReviewInfo* pRsRcpReviewInfo)
|
{
|
enum {DefectReivew = 0, UserReview, CDMeasure, WSI};
|
int nPlanCount = pRsRcpReviewInfo->GetRcpPlanInfoCount();
|
BOOL bSuccess = TRUE;
|
for(int nPlanIdx = 0; nPlanIdx < nPlanCount; nPlanIdx++)
|
{
|
CRcpPlanInfo* pRcpPlanInfo = pRsRcpReviewInfo->GetRcpPlanInfo(nPlanIdx);
|
if(pRcpPlanInfo == NULL) continue ;
|
|
switch(pRcpPlanInfo->GetReviewType())
|
{
|
case DefectReivew:
|
bSuccess = bProcessSuccess[CPJT_REVIEW_SUCCESS];
|
break;
|
case CDMeasure :
|
bSuccess = bProcessSuccess[CPJT_MEASURE_SUCCESS];
|
break;
|
case WSI :
|
bSuccess = bProcessSuccess[CPJT_WSI_SUCCESS];
|
break;
|
}
|
}
|
return bSuccess;
|
}
|
|
BOOL CReviewProcessor_CPJT::MakeReflowImageFileName( SReviewResult* pReviewResult )
|
{
|
if (m_pRP2P==NULL || pReviewResult==NULL) return FALSE;
|
CTime snapTime = CTime::GetCurrentTime();
|
//SYSTEMTIME snapTime;
|
//GetLocalTime(&snapTime);
|
|
CString strFileName = _T("");
|
CString strDefectCodeTemp = _T("");
|
|
if(GetReviewProcessStatus() == ReviewProcessStatus_ReflowStart)
|
{
|
// [2017:6:5]-[WEZASW] : Review Image
|
if (pReviewResult->strDefectCode.Compare(_T("***")) == 0)
|
strDefectCodeTemp = _T("DC");
|
else
|
strDefectCodeTemp = pReviewResult->strDefectCode;
|
|
|
//ReviewImage Process_ID_Glass_ID_EQPTYPE__Index_Xpos_Ypos_Judge_ScaleJudge_DefectType_Date(YYYYMMDD_HHMMSS).jpg
|
CDitGlassRawClient *pDitGlassRawClient = CDitGlassRawClient::GetInstance();
|
_grmDefectData* pSharedDefect;
|
CGlassResult* pGlassResult =m_pRP2P->IRP2P_GetCurrentGlassResult();
|
pSharedDefect = pDitGlassRawClient->GetDefectData(pReviewResult->nDefectidx2);
|
|
if(pDitGlassRawClient->isConnect() == TRUE)
|
{
|
|
double dPosX = double(pReviewResult->nUMOriginX)/1000.0;
|
double dPosY = double(pReviewResult->nUMOriginY)/1000.0;
|
{
|
|
if(pDitGlassRawClient->GetGlassData()->m_nScanCoordinateY == 0)
|
{
|
m_pRP2P->IRP2P_GetCenterCoordinate(dPosX, dPosY);
|
}
|
else
|
{
|
double dPosXTemp=dPosX;
|
double dPosYTemp=dPosY;
|
m_pRP2P->IRP2P_GetCenterCoordinate(dPosXTemp , dPosYTemp);
|
|
dPosX=dPosYTemp;
|
dPosY=dPosXTemp;
|
}
|
}
|
_grmDefectData* pSharedDefect = pDitGlassRawClient->GetDefectData(pReviewResult->nDefectidx2);
|
|
CStringW strOperID (pDitGlassRawClient->GetGlassData()->m_strOperID );
|
CStringW strGlassID(pDitGlassRawClient->GetGlassData()->m_strGlassID);
|
CStringW strStepID(pDitGlassRawClient->GetGlassData()->m_strStepID );
|
strFileName.Format(_T("%s_%s_%s_%d_%0.3lf_%0.3lf_%s_%s_%04d%02d%02d_%02d%02d%02d"),
|
strOperID ,
|
strGlassID,
|
strStepID,
|
pReviewResult->nResultIdx,
|
dPosX,
|
dPosY,
|
_T("0"),
|
_T("0"),
|
snapTime.GetYear(), snapTime.GetMonth(), snapTime.GetDay(),
|
snapTime.GetHour(), snapTime.GetMinute(), snapTime.GetSecond());
|
}
|
}
|
else if(GetReviewProcessStatus() == ReviewProcessStatus_MeasureStart)
|
{
|
strFileName += m_strJobID + _T("."); // glass_id.
|
|
strFileName += pReviewResult->strCellID + _T("."); // cell_id.
|
|
CString tmp = _T("");
|
tmp.Format(_T("%03d"),pReviewResult->nModuleIdx);
|
strFileName += tmp + _T("."); // ModuleIndex.
|
|
tmp.Format(_T("%03d"),pReviewResult->nResultIdx);
|
strFileName += tmp + _T("."); // ModuleIndex.
|
|
strFileName += _T("Measure.");
|
strFileName += pReviewResult->strSnapTime;
|
}
|
|
pReviewResult->strSnapTime.Format(_T("%04d%02d%02d_%02d%02d%02d"), snapTime.GetYear(), snapTime.GetMonth(), snapTime.GetDay(),
|
snapTime.GetHour(), snapTime.GetMinute(), snapTime.GetSecond()); // snap_time
|
// pReviewResult->strSnapTime.Format(_T("%04d%02d%02d%02d%02d%02d%03d.jpg"), snapTime.wYear, snapTime.wMonth, snapTime.wDay, snapTime.wHour, snapTime.wMinute, snapTime.wSecond, snapTime.wMilliseconds);
|
// if(pReviewResult->strSizeType.MakeLower().Compare(_T("")) == 0)
|
// {
|
// strFileName += pReviewResult->strSnapTime;
|
// }
|
|
// [2017:4:10]-[WEZASW] :
|
pReviewResult->strOrignalImgFileName = strFileName + _T(".bmp");
|
|
strFileName += _T(".jpg");
|
pReviewResult->strUploadImgFileName = strFileName;
|
pReviewResult->strImgFileName = strFileName;
|
return TRUE;
|
}
|
|
void CReviewProcessor_CPJT::AddWsiReflowResultData( int nModuleIndex, const SWsiResult& measureResut )
|
{
|
SReviewResult wsiResult;
|
|
if (GetReviewProcessStatus()!=ReviewProcessStatus_WSIReflowStart)
|
{
|
goto RESULT_FAIL;
|
}
|
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]WsiResult : Module[%d] Result[%d]"), nModuleIndex, measureResut.nResultIndex);
|
|
CGlassResult *pGlassResult = m_pRP2P->IRP2P_GetCurrentGlassResult();
|
if (pGlassResult==NULL) goto RESULT_FAIL;
|
|
DWORD dwCurTick = GetTickCount(); // save tick count
|
m_ProcessTimer.End(); // end process timer
|
|
// get review result
|
CReviewResult* pReviewResult = pGlassResult->GetWsiReflowResult(nModuleIndex);
|
if (pReviewResult==NULL) goto RESULT_FAIL;
|
|
// get grab position
|
const SMotorPosition *pPosition = Module_GetMotorPosition(nModuleIndex);
|
if (pPosition==NULL) goto RESULT_FAIL;
|
int nGlassPosX = int(pPosition->dGlassPosX * 1000.0);
|
int nGlassPosY = int(pPosition->dGlassPosY * 1000.0);
|
int nMotorPosX = int(pPosition->dMotorPosX * 1000.0);
|
int nMotorPosY = int(pPosition->dMotorPosY * 1000.0);
|
double dTime = (double) m_ProcessTimer.GetDurationMilliSecond();
|
|
EnterCriticalSection(&m_csUserCriticalSection);
|
|
// get last result idx + 1
|
int nCurResultIdx = pReviewResult->GetLastSReviewResultIndex() + 1;
|
int nStartResultIdx = pReviewResult->GetStartSReviewResultIndex();
|
int nEndResultIdx = pReviewResult->GetEndSReviewResultIndex();
|
|
if (nCurResultIdx > nEndResultIdx)
|
{
|
LeaveCriticalSection(&m_csUserCriticalSection);
|
goto RESULT_FAIL;
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]SetWsiResultData module[%d] point[%d] result[%d]"), nModuleIndex, measureResut.nResultIndex, nCurResultIdx);
|
}
|
|
wsiResult.nWsi_ResultCode = measureResut.nResultCode;
|
wsiResult.dWsi_DamDistance = measureResut.dDamDistance;
|
|
for(int nCnt=0; nCnt < WsiReflowInfo_Result_Info_Count; nCnt++)
|
{
|
wsiResult.nWsi_pReflowResultData[nCnt] = measureResut.pReflowResultData[nCnt];
|
}
|
//memcpy(wsiResult.nWsi_pReflowResultData, measureResut.pReflowResultData, sizeof(wsiResult.nWsi_pReflowResultData));
|
|
SReviewResult *pProcessResult = NULL;
|
if (pGlassResult->SetWsiReflowResultData(nModuleIndex, nCurResultIdx, wsiResult, nGlassPosX, nGlassPosY, nMotorPosX, nMotorPosY, dTime))
|
{
|
// [2017.6.20 bhs]
|
//pProcessResult = pGlassResult->GetSReviewResult(nModuleIndex, nCurResultIdx);
|
pProcessResult = pReviewResult->GetSReviewResult(nCurResultIdx);
|
}
|
|
if (pProcessResult)
|
{
|
if (AddReviewProcessData(pProcessResult)==1)
|
{
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]Add Wsi Reflow Process Data module[%d] result[%d]"), nModuleIndex, nCurResultIdx);
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]Add FAIL Process Data module[%d] result[%d]"), nModuleIndex, nCurResultIdx);
|
}
|
|
// set last result idx
|
pReviewResult->SetLastSReviewResultIndex(nCurResultIdx);
|
}
|
|
LeaveCriticalSection(&m_csUserCriticalSection);
|
|
m_pRP2P->IRP2P_UpdateReviewResult(nModuleIndex, pGlassResult, 5);
|
return;
|
|
RESULT_FAIL:
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]WsiResult FAIL! module[%d] result[%d]"), nModuleIndex, measureResut.nResultIndex);
|
return;
|
}
|
|
double CReviewProcessor_CPJT::GetCentertoOrginCoordinate(double dPosX,double dPosY,int nCornercut,int nOriginDirection){
|
|
double nResultPosX=0.0;
|
double nResultPosY=0.0;
|
|
// CornerCutDirection { CLeftTop=0, CRightTop, CLeftBottom, CRightBottom };
|
// OriginDirection { OLeftTop=0, ORightTop, OLeftBottom, ORightBottom };
|
|
if(nOriginDirection==RPOLeftTop){
|
|
if(nCornercut == RPCLeftTop)
|
{
|
nResultPosX = double(GLASS_SIZE_WIDTH)/2. - dPosX;
|
nResultPosY = double(GLASS_SIZE_HEIGHT)/2. - dPosY;
|
|
}
|
else if(nCornercut == RPCRightTop)
|
{
|
nResultPosX = double(GLASS_SIZE_WIDTH)/2. - dPosX;
|
nResultPosY = double(GLASS_SIZE_HEIGHT)/2. + dPosY;
|
|
}
|
else if(nCornercut == RPCLeftBottom)
|
{
|
nResultPosX = double(GLASS_SIZE_WIDTH)/2. + dPosX;
|
nResultPosY = double(GLASS_SIZE_HEIGHT)/2. - dPosY;
|
}
|
else if(nCornercut == RPCRightBottom)
|
{
|
nResultPosX = double(GLASS_SIZE_WIDTH)/2 + dPosX;
|
nResultPosY = double(GLASS_SIZE_HEIGHT)/2 + dPosY;
|
}
|
}
|
|
else if(nOriginDirection==RPORightTop){
|
|
if(nCornercut == RPCLeftTop)
|
{
|
nResultPosX = double(GLASS_SIZE_WIDTH)/2. - dPosX;
|
nResultPosY = double(GLASS_SIZE_HEIGHT)/2. + dPosY;
|
|
}
|
else if(nCornercut == RPCRightTop)
|
{
|
nResultPosX = double(GLASS_SIZE_WIDTH)/2. - dPosX;
|
nResultPosY = double(GLASS_SIZE_HEIGHT)/2. - dPosY;
|
|
}
|
else if(nCornercut == RPCLeftBottom)
|
{
|
nResultPosX = double(GLASS_SIZE_WIDTH)/2. + dPosX;
|
nResultPosY = double(GLASS_SIZE_HEIGHT)/2. + dPosY;
|
}
|
else if(nCornercut == RPCRightBottom)
|
{
|
nResultPosX = double(GLASS_SIZE_WIDTH)/2. + dPosX;
|
nResultPosY = double(GLASS_SIZE_HEIGHT)/2. - dPosY;
|
}
|
}
|
else if(nOriginDirection==RPOLeftBottom){
|
|
if(nCornercut == RPCLeftTop)
|
{
|
//210402
|
/* nResultPosX = double(GLASS_SIZE_WIDTH)/2. + dPosX;
|
nResultPosY = double(GLASS_SIZE_HEIGHT)/2. - dPosY;
|
*/
|
nResultPosX = double(GLASS_SIZE_WIDTH) / 2. + dPosX;
|
nResultPosY = double(GLASS_SIZE_HEIGHT) / 2. + dPosY;
|
}
|
else if(nCornercut == RPCRightTop)
|
{
|
nResultPosX = double(GLASS_SIZE_WIDTH)/2. + dPosX;
|
nResultPosY = double(GLASS_SIZE_HEIGHT)/2. + dPosY;
|
|
}
|
else if(nCornercut == RPCLeftBottom)
|
{
|
//210402
|
/*nResultPosX = double(GLASS_SIZE_WIDTH)/2. - dPosX;
|
nResultPosY = double(GLASS_SIZE_HEIGHT)/2. - dPosY;*/
|
nResultPosX = double(GLASS_SIZE_WIDTH) / 2. + dPosX;
|
nResultPosY = double(GLASS_SIZE_HEIGHT) / 2. + dPosY;
|
}
|
else if(nCornercut == RPCRightBottom)
|
{
|
nResultPosX = double(GLASS_SIZE_WIDTH) / 2. - dPosX;
|
nResultPosY = double(GLASS_SIZE_HEIGHT) / 2. + dPosY;
|
}
|
}
|
else if (nOriginDirection==RPORightBottom)
|
{
|
|
if(nCornercut == RPCLeftTop)
|
{
|
nResultPosX = double(GLASS_SIZE_WIDTH)/2. + dPosX;
|
nResultPosY = double(GLASS_SIZE_HEIGHT)/2. + dPosY;
|
|
}
|
else if(nCornercut == RPCRightTop)
|
{
|
nResultPosX = double(GLASS_SIZE_WIDTH)/2. + dPosX;
|
nResultPosY = double(GLASS_SIZE_HEIGHT)/2. - dPosY;
|
|
}
|
else if(nCornercut == RPCLeftBottom)
|
{
|
nResultPosX = double(GLASS_SIZE_WIDTH)/2. - dPosX;
|
nResultPosY = double(GLASS_SIZE_HEIGHT)/2. + dPosY;
|
}
|
else if(nCornercut == RPCRightBottom)
|
{
|
nResultPosX = double(GLASS_SIZE_WIDTH)/2. - dPosX;
|
nResultPosY = double(GLASS_SIZE_HEIGHT)/2. - dPosY;
|
}
|
}
|
|
if(dPosX == -1){
|
return nResultPosY;
|
}
|
|
return nResultPosX;
|
}
|
|
|
CString CReviewProcessor_CPJT::MakeWSIImageFileName( SReviewResult* pReviewResult )
|
{
|
if (m_pRP2P==NULL || pReviewResult==NULL) return FALSE;
|
CTime snapTime = CTime::GetCurrentTime();
|
//SYSTEMTIME snapTime;
|
//GetLocalTime(&snapTime);
|
|
CString strFileName = _T("");
|
CString strDefectCodeTemp = _T("");
|
|
// [2017:6:5]-[WEZASW] : Review Image
|
if (pReviewResult->strDefectCode.Compare(_T("***")) == 0)
|
strDefectCodeTemp = _T("DC");
|
else
|
strDefectCodeTemp = pReviewResult->strDefectCode;
|
|
//ReviewImage Process_ID_Glass_ID_EQPTYPE__Index_Xpos_Ypos_Judge_ScaleJudge_DefectType_Date(YYYYMMDD_HHMMSS).jpg
|
CDitGlassRawClient *pDitGlassRawClient = CDitGlassRawClient::GetInstance();
|
_grmDefectData* pSharedDefect;
|
CGlassResult* pGlassResult =m_pRP2P->IRP2P_GetCurrentGlassResult();
|
|
pSharedDefect = pDitGlassRawClient->GetDefectData(pReviewResult->nDefectidx2);
|
|
if(pDitGlassRawClient->isConnect() == TRUE)
|
{
|
double dPosX = double(pSharedDefect->m_nUMOriginX)/1000.0;
|
double dPosY = double(pSharedDefect->m_nUMOriginY)/1000.0;
|
{
|
if(pDitGlassRawClient->GetGlassData()->m_nScanCoordinateY == 0)
|
{
|
m_pRP2P->IRP2P_GetCenterCoordinate(dPosX, dPosY);
|
}
|
else
|
{
|
double dPosXTemp=dPosX;
|
double dPosYTemp=dPosY;
|
m_pRP2P->IRP2P_GetCenterCoordinate(dPosXTemp, dPosYTemp);
|
|
dPosX=dPosYTemp;
|
dPosY=dPosXTemp;
|
}
|
}
|
_grmDefectData* pSharedDefect = pDitGlassRawClient->GetDefectData(pReviewResult->nDefectidx2);
|
|
/*CStringW strOperID (pDitGlassRawClient->GetGlassData()->m_strOperID );
|
CStringW strGlassID(pDitGlassRawClient->GetGlassData()->m_strGlassID);
|
CStringW strStepID(pDitGlassRawClient->GetGlassData()->m_strStepID );
|
strFileName.Format(_T("%d_%s_%s_%d_%04d%02d%02d_%02d%02d%02d"),
|
pReviewResult->nResultIdx,
|
pReviewResult->strJudgeType,
|
pReviewResult->strSizeType,
|
pSharedDefect->m_nDefectIdx,
|
snapTime.GetYear(), snapTime.GetMonth(), snapTime.GetDay(),
|
snapTime.GetHour(), snapTime.GetMinute(), snapTime.GetSecond());
|
*/
|
|
int nCount = GetPlanWSICount();
|
strFileName.Format(_T("%s_%03d"),
|
pDitGlassRawClient->GetCellData(pSharedDefect->m_nCellIdx)->m_strCellName,
|
nCount
|
);
|
nCount += 1;
|
SetPlanWSICount(nCount);
|
}
|
|
//m_nReviewCount++;
|
|
return strFileName;
|
}
|
|
BOOL CReviewProcessor_CPJT::UpdateMemoryReviewPlan(SReviewResult* pReviewResult)
|
{
|
if(pReviewResult == NULL) return FALSE;
|
|
CDitGlassRawClient *pDitGlassRawCleint = CDitGlassRawClient::GetInstance();
|
if(pDitGlassRawCleint->isConnect() == TRUE)
|
{
|
|
_grmDefectData* pSharedDefect = pDitGlassRawCleint->GetDefectData(pReviewResult->nDefectidx2);
|
_grmDefectReviewData * pSharedDefectReview = &pSharedDefect->m_ReviewDefect;
|
_grmGlassData* pSharedGlassData = pDitGlassRawCleint->GetGlassData();
|
|
//size_t CharactersConverted;
|
//wcstombs_s(&CharactersConverted, pSharedDefectReview->m_strRevImageName, pReviewResult->strImgFileName, _TRUNCATE);
|
|
strcpy(pSharedDefectReview->m_strRevImageName,pReviewResult->strImgFileName.MakeLower());
|
|
//taek 210624
|
|
strcpy(pSharedDefectReview->m_strRevImagePath,pReviewResult->strImgFilePath.MakeLower());
|
|
strcpy(pSharedGlassData->m_strAlignFirst, m_strReviewFirst.MakeLower());
|
strcpy(pSharedGlassData->m_strAlignSecond, m_strReviewSecned.MakeLower());
|
|
pSharedDefectReview->m_nPlanType = ditRaw::RPT_Review; //0:None, 1:Location(User, Fiexed) Review, 4:reflower, ??:Wsi, 1000:AOI(
|
pSharedDefectReview->m_nResultCode = 1; //0:None, 1:Success
|
pSharedDefectReview->m_nShotIndex = pReviewResult->nResultIdx;
|
//pSharedDefectReview->m_nShotIndex = GetPlanReviewCount(); //RTMS taek 210128
|
pSharedDefectReview->m_nModuleIndex = pReviewResult->nModuleIdx;
|
pSharedDefectReview->m_nMagnificIndex = 20;
|
pSharedDefectReview->m_fManification =pReviewResult->dMagnification;
|
pSharedDefectReview->m_fManificResoultion = 0.1725;
|
}
|
else
|
return FALSE;
|
|
return TRUE;
|
}
|
|
BOOL CReviewProcessor_CPJT::UpdateMemoryUserPlan( SReviewResult* pReviewResult )
|
{
|
CDitGlassRawClient *pDitRawClient = CDitGlassRawClient::GetInstance();
|
if(pDitRawClient->isConnect() == TRUE)
|
{
|
int nDefectCount = pDitRawClient->GetGlassData()->m_nDefectNum; // user,reflow
|
if(pReviewResult->nDefectIdx <nDefectCount)
|
{
|
return FALSE;
|
}
|
_grmDefectData* pSharedDefect = pDitRawClient->GetDefectData(pReviewResult->nDefectidx2);
|
_grmDefectReviewData * pSharedDefectReview = &pSharedDefect->m_ReviewDefect;
|
|
//size_t CharactersConverted;
|
//wcstombs_s(&CharactersConverted, pSharedDefectReview->m_strRevImageName, pReviewResult->strImgFileName, _TRUNCATE);
|
|
strcpy(pSharedDefectReview->m_strRevImageName,pReviewResult->strImgFileName);
|
|
pSharedDefectReview->m_nPlanType = ditRaw::RPT_User; //0:None, 1:Location(User, Fiexed) Review, 4:reflower, ??:Wsi, 1000:AOI(
|
pSharedDefectReview->m_nResultCode = 1; //0:None, 1:Success
|
pSharedDefectReview->m_nShotIndex = pReviewResult->nResultIdx;
|
pSharedDefect->m_nShotIdx = pReviewResult->nResultIdx;
|
pSharedDefectReview->m_nModuleIndex;
|
pSharedDefect->m_nModelIdx = pReviewResult->nModuleIdx;
|
pSharedDefectReview->m_nMagnificIndex = pReviewResult->dMagnification;
|
pSharedDefectReview->m_fManification = pReviewResult->dMagnification;
|
pSharedDefectReview->m_fManificResoultion = pReviewResult->dMagnification;
|
m_pRP2P->IRP2P_DisplayMessage(_T("[Access Shared Memory]IDX[%d]Filename[%s]"),pReviewResult->nDefectidx2, pReviewResult->strUploadImgFileName);
|
}
|
|
|
return TRUE;
|
}
|
|
BOOL CReviewProcessor_CPJT::UpdateMemoryReflowPlan( SReviewResult* pReviewResult )
|
{
|
if(pReviewResult == NULL) return FALSE;
|
CDitGlassRawClient *pDitRawClient = CDitGlassRawClient::GetInstance();
|
//int nEqpID = m_pSP2P->ISP2P_System_GetSystemInfo()->m_nMachineType;
|
CString strCellID = _T("");
|
int nCellIndex=0;
|
int nReflowjuge=pReviewResult->nReflow_Result;
|
|
for(int i =0 ; i<pDitRawClient->GetGlassData()->m_nCellNum;i++)
|
{
|
_grmCellData* pCellData = pDitRawClient->GetCellData(i);
|
if(pCellData == NULL) continue;
|
|
strCellID=(LPSTR)pCellData->m_strCellName;
|
|
if(strCellID.Compare(pReviewResult->strCellID) == 0)
|
{
|
if(nReflowjuge ==4)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ReflowResult] Reflow Judge Is No OverFlow %d"),nReflowjuge);
|
nReflowjuge=1;
|
}
|
|
else if(nReflowjuge == 3 || nReflowjuge == 2)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ReflowResult] Reflow Judge Is No OverFlow %d"),nReflowjuge);
|
nReflowjuge=1;
|
}
|
|
else if(nReflowjuge == 1 || nReflowjuge == 0)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ReflowResult] Reflow Judge Is Dam1 OverFlow %d"),nReflowjuge);
|
nReflowjuge=2;
|
}
|
|
else
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ReflowResult] Reflow Judge Is Error %d"),nReflowjuge);
|
nReflowjuge=0;
|
}
|
|
if(pReviewResult->nReflow_CellIndex > 7)
|
{
|
pReviewResult->nReflow_CellIndex = 0;
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ReflowResult] Reflow Cell Index Max Count is 7.. Result File Max Count"));
|
}
|
|
pCellData->m_nReflowResult[pReviewResult->nReflow_CellIndex] = nReflowjuge;
|
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ReflowResult] CellId : %s CellCount : %d, Reflow Judge : %d"),strCellID,pReviewResult->nReflow_CellIndex,nReflowjuge);
|
|
break;
|
}
|
}
|
|
if(pDitRawClient->isConnect() == TRUE)
|
{
|
int nDefectCount = pDitRawClient->GetGlassData()->m_nDefectNum;
|
if(pReviewResult->nDefectidx2 <nDefectCount)
|
{
|
return FALSE;
|
}
|
_grmDefectData* pSharedDefect = pDitRawClient->GetDefectData(pReviewResult->nDefectidx2);
|
_grmDefectReviewData * pSharedDefectReview = &pSharedDefect->m_ReviewDefect;
|
|
//size_t CharactersConverted;
|
//wcstombs_s(&CharactersConverted, pSharedDefectReview->m_strRevImageName, pReviewResult->strImgFileName, _TRUNCATE);
|
|
strcpy(pSharedDefectReview->m_strRevImageName,pReviewResult->strImgFileName);
|
|
pSharedDefectReview->m_nPlanType = ditRaw::RTP_Reflow;
|
pSharedDefectReview->m_nReflow_ResultCode = pReviewResult->nReflow_Result;// pReviewResult->nReflow_Result;
|
//pSharedDefectReview->m_fReflow_LinePosData;
|
pSharedDefectReview->m_nReflow_Side = pReviewResult->nReflow_Side;
|
pSharedDefectReview->m_nReflow_InspectionMode = 0;
|
m_pRP2P->IRP2P_DisplayMessage(_T("[Access Shared Memory]IDX[%d]Filename[%s]"),pReviewResult->nDefectidx2, pReviewResult->strUploadImgFileName);
|
}
|
|
return TRUE;
|
}
|
|
BOOL CReviewProcessor_CPJT::UpdateMemoryWsiPlan( SReviewResult* pReviewResult )
|
{
|
if(pReviewResult == NULL) return FALSE;
|
|
CDitGlassRawClient *pDitGlassRawClient = CDitGlassRawClient::GetInstance();
|
|
if(pDitGlassRawClient->isConnect() == TRUE)
|
{
|
pDitGlassRawClient->GetGlassData()->m_strGlassID;
|
m_pRP2P->IRP2P_GetCurrentGlassResult()->m_strGlassID;
|
_grmDefectData* pSharedDefect = pDitGlassRawClient->GetDefectData(pReviewResult->nDefectidx2);
|
_grmDefectReviewData * pSharedDefectReview = &pSharedDefect->m_ReviewDefect;
|
int nWSIType = pReviewResult->nWsi_Type;
|
int nWSIheight = pReviewResult->dDefectHeight*1000.0;
|
int nWSIWidth = pReviewResult->pWsi_ResultData[1]*1000.0;
|
|
pReviewResult->nWsi_ResultCode;
|
|
pSharedDefectReview->m_nPlanType = ditRaw::RTP_WSI;
|
pSharedDefectReview->m_nWsi_ResultCode=pReviewResult->nWsi_ResultCode; //0:None, 1:Success
|
pSharedDefectReview->m_nWsi_Type = 2;
|
pSharedDefectReview->m_fWsi_ResultData[0]= pReviewResult->nWsi_DefectType; // 0:normal 1:metal 2:huge 3:diffuse 4:trashy
|
pSharedDefectReview->m_fWsi_ResultData[1]=(float)(nWSIheight/1000.0);
|
pSharedDefectReview->m_fWsi_ResultData[2]=(float)(nWSIWidth/1000.0); // 0:Type, 1:Height, 2:Width
|
pSharedDefectReview->m_fWsi_ResultData[3] = pReviewResult->dCSHeight;
|
pSharedDefectReview->m_fWsi_ResultData[4] = pReviewResult->dRZoneHeight;
|
pSharedDefectReview->m_fWsi_ResultData[5] = pReviewResult->dGZoneHeight;
|
pSharedDefectReview->m_fWsi_ResultData[6] = pReviewResult->dBZoneHeight;
|
pSharedDefectReview->m_strWsi_2DImageFilename;
|
pSharedDefectReview->m_strWsi_3DImageFilename;
|
pSharedDefectReview->m_fWsiManification = 20;
|
pSharedDefectReview->m_dWsiMmMotorX=pReviewResult->dTargetMotorX;
|
pSharedDefectReview->m_dWsiMmMotorY=pReviewResult->dTargetMotorY;
|
|
// pSharedDefectReview->m_nWsiReflowPositionIndex; // WsiReflowPositionIndex
|
// pSharedDefectReview->m_nWsi_pReflowResultData;
|
// pSharedDefectReview->m_dWsi_DamDistance;
|
}
|
|
return TRUE;
|
}
|
|
BOOL CReviewProcessor_CPJT::UpdateMemoryWsiReflowPlan( SReviewResult* pReviewResult )
|
{
|
if(pReviewResult == NULL) return FALSE;
|
CDitGlassRawClient *pDitRawClient = CDitGlassRawClient::GetInstance();
|
|
|
CString strCellID = _T("");
|
CString strRcpCellID = _T("");
|
int nCellIndex=0;
|
|
|
int nWsiReflowResult = 0;
|
int nWsiReflowJudge = -1;
|
|
// int nReflowjuge=0;
|
// for(int nZone=2; nZone<6; nZone++)
|
// {
|
// nReflowjuge+=pReviewResult->nWsi_pReflowResultData[4];
|
// }
|
|
nWsiReflowJudge = pReviewResult->nWsi_ResultCode;
|
|
//nWsiReflowResult += pReviewResult->nWsi_pReflowResultData[0] //A
|
nWsiReflowResult += pReviewResult->nWsi_pReflowResultData[1];//B
|
nWsiReflowResult += pReviewResult->nWsi_pReflowResultData[2];//C
|
//nWsiReflowResult += pReviewResult->nWsi_pReflowResultData[3];//D
|
|
for(int i=0;i<m_pRP2P->IRP2P_Recipe_GetRsRcpReviewInfo()->GetRcpUserDefectInfoCount(); i++)
|
{
|
m_pRP2P->IRP2P_Recipe_GetRsRcpReviewInfo()->GetRcpUserDefectInfo(i)->m_nSharedDefectIndex;
|
if(m_pRP2P->IRP2P_Recipe_GetRsRcpReviewInfo()->GetRcpUserDefectInfo(i)->m_nSharedDefectIndex ==pReviewResult->nDefectidx2)
|
{
|
strRcpCellID = m_pRP2P->IRP2P_Recipe_GetRsRcpReviewInfo()->GetRcpUserDefectInfo(i)->GetCellId();
|
nCellIndex = m_pRP2P->IRP2P_Recipe_GetRsRcpReviewInfo()->GetRcpUserDefectInfo(i)->GetReflowCellIndex();
|
}
|
|
}
|
|
for(int i =0 ; i<pDitRawClient->GetGlassData()->m_nCellNum;i++)
|
{
|
_grmCellData* pCellData = pDitRawClient->GetCellData(i);
|
if(pCellData == NULL) continue;
|
|
strCellID=(LPSTR)pCellData->m_strCellName;
|
|
if(strCellID.Compare(strRcpCellID) == 0)
|
{
|
if(nWsiReflowJudge == 0)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ReflowResult] Wsi Reflow Judge Is Error %d"),nWsiReflowJudge);
|
nWsiReflowResult = 0;
|
}
|
else
|
{
|
if(nWsiReflowResult ==0)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ReflowResult] Wsi Reflow Judge Is No OverFlow %d"),nWsiReflowResult);
|
nWsiReflowResult=1;
|
}
|
else
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ReflowResult] Wsi Reflow Judge Is Dam OverFlow %d"),nWsiReflowResult);
|
nWsiReflowResult=2;
|
}
|
|
}
|
|
pCellData->m_nReflowResult[nCellIndex] = nWsiReflowResult;
|
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ReflowResult] CellId : %s CellCount : %d, Reflow Judge : %d"),strCellID ,nCellIndex ,nWsiReflowResult);
|
|
break;
|
}
|
}
|
|
return TRUE;
|
}
|
|
BOOL CReviewProcessor_CPJT::UpdateMemoryWsiUserPlan( SReviewResult* pReviewResult )
|
{
|
if(pReviewResult == NULL) return FALSE;
|
|
CDitGlassRawClient *pDitGlassRawClient = CDitGlassRawClient::GetInstance();
|
|
if(pDitGlassRawClient->isConnect() == TRUE)
|
{
|
pDitGlassRawClient->GetGlassData()->m_strGlassID;
|
m_pRP2P->IRP2P_GetCurrentGlassResult()->m_strGlassID;
|
_grmDefectData* pSharedDefect = pDitGlassRawClient->GetDefectData(pReviewResult->nDefectidx2);
|
_grmDefectReviewData * pSharedDefectReview = &pSharedDefect->m_ReviewDefect;
|
int nWSIType = pReviewResult->nWsi_Type;
|
int nWSIheight = pReviewResult->pWsi_ResultData[0]*100.0;
|
int nWSIWidth = pReviewResult->pWsi_ResultData[1]*100.0;
|
|
pReviewResult->nWsi_ResultCode;
|
|
pSharedDefectReview->m_nPlanType = ditRaw::RTP_UserWsi;
|
pSharedDefectReview->m_nWsi_ResultCode=pReviewResult->nWsi_ResultCode; //0:None, 1:Success
|
pSharedDefectReview->m_nWsi_Type=nWSIType;
|
pSharedDefectReview->m_fWsi_ResultData[0]= nWSIType;
|
pSharedDefectReview->m_fWsi_ResultData[1]=(float)(nWSIheight/100.0);
|
pSharedDefectReview->m_fWsi_ResultData[2]=(float)(nWSIWidth/100.0); // 0:Type, 1:Height, 2:Width
|
pSharedDefectReview->m_strWsi_2DImageFilename;
|
pSharedDefectReview->m_strWsi_3DImageFilename;
|
pSharedDefectReview->m_fWsiManification = 20;
|
pSharedDefectReview->m_dWsiMmMotorX=pReviewResult->dTargetMotorX;
|
pSharedDefectReview->m_dWsiMmMotorY=pReviewResult->dTargetMotorY;
|
}
|
|
return TRUE;
|
}
|
|
BOOL CReviewProcessor_CPJT::UpdateMemoryWsiMutiShotPlan(SReviewResult* pReviewResult)
|
{
|
if (pReviewResult == NULL) return FALSE;
|
|
CDitGlassRawClient *pDitGlassRawClient = CDitGlassRawClient::GetInstance();
|
|
if (pDitGlassRawClient->isConnect() == TRUE)
|
{
|
pDitGlassRawClient->GetGlassData()->m_strGlassID;
|
m_pRP2P->IRP2P_GetCurrentGlassResult()->m_strGlassID;
|
_grmDefectData* pSharedDefect = pDitGlassRawClient->GetDefectData(pReviewResult->nDefectidx2);
|
_grmDefectReviewData * pSharedDefectReview = &pSharedDefect->m_ReviewDefect;
|
int nWSIType = pReviewResult->nWsi_Type;
|
int nWSIheight = pReviewResult->pWsi_ResultData[0] * 100.0;
|
int nWSIWidth = pReviewResult->pWsi_ResultData[1] * 100.0;
|
|
pReviewResult->nWsi_ResultCode;
|
|
pSharedDefectReview->m_nPlanType = ditRaw::RTP_WSI;
|
pSharedDefectReview->m_nWsi_ResultCode = pReviewResult->nWsi_ResultCode; //0:None, 1:Success
|
pSharedDefectReview->m_nWsi_Type = nWSIType;
|
pSharedDefectReview->m_fWsi_ResultData[0] = nWSIType;
|
pSharedDefectReview->m_fWsi_ResultData[1] = (float)(nWSIheight / 100.0);
|
pSharedDefectReview->m_fWsi_ResultData[2] = (float)(nWSIWidth / 100.0); // 0:Type, 1:Height, 2:Width
|
pSharedDefectReview->m_strWsi_2DImageFilename;
|
pSharedDefectReview->m_strWsi_3DImageFilename;
|
pSharedDefectReview->m_fWsiManification = 20;
|
pSharedDefectReview->m_dWsiMmMotorX = pReviewResult->dTargetMotorX;
|
pSharedDefectReview->m_dWsiMmMotorY = pReviewResult->dTargetMotorY;
|
|
// pSharedDefectReview->m_nWsiReflowPositionIndex; // WsiReflowPositionIndex
|
// pSharedDefectReview->m_nWsi_pReflowResultData;
|
// pSharedDefectReview->m_dWsi_DamDistance;
|
}
|
|
return TRUE;
|
}
|
|
double CReviewProcessor_CPJT::CalcFocusValue( const char* pImageBuffer, int nImageWidth, int nImageHeight, int nMothod/*=FocusValueMethod_Diff*/ ) // lmk 190813 image defocus chm new
|
{
|
BYTE *pImageBufferByte = (BYTE*)(pImageBuffer);
|
if (pImageBuffer==NULL) return 0.;
|
|
//#3524_210902_LYW_MOD START
|
int nWidth = nImageWidth;
|
//int nWidthStep = nImageWidth;
|
int nHeight = nImageHeight;
|
// int nCalWidth = nWidth/2;
|
// int nCalHeight = nHeight/2;
|
//
|
// int nStartX = nWidth/2 - nCalWidth/2;
|
// int nStartY = nHeight/2 - nCalHeight/2;
|
|
int nCalWidth = nWidth;
|
int nCalHeight = nHeight;
|
|
int nStartX = 0;
|
int nStartY = 0;
|
|
int nStep = 3;
|
|
double dXValue = 0., dYValue = 0., dCurr = 0., dSum = 0., dFocus = 0.;
|
for (int nH = nStartY; nH < nStartY + nCalHeight - nStep; nH++)
|
{
|
for (int nW = nStartX; nW < nStartX + nCalWidth - nStep; nW++)
|
{
|
dXValue = float((pImageBufferByte[nH*nWidth + nW + nStep] - pImageBufferByte[nH*nWidth + nW])*(pImageBufferByte[nH*nWidth + nW + nStep] - pImageBufferByte[nH*nWidth + nW]));
|
dYValue = float((pImageBufferByte[(nH + nStep)*nWidth + nW] - pImageBufferByte[nH*nWidth + nW])*(pImageBufferByte[(nH + nStep)*nWidth + nW] - pImageBufferByte[nH*nWidth + nW]));
|
dCurr = sqrt(dXValue + dYValue);
|
break;
|
|
dSum += dCurr;
|
}
|
}
|
dFocus = dSum / double(nCalWidth*nCalHeight);
|
|
return dFocus;
|
//#3524_210902_LYW_MOD END
|
//Origin
|
// int nWidth = nImageWidth;
|
// int nHeight = nImageHeight;
|
// int nCalWidth = nWidth/2;
|
// int nCalHeight = nHeight/2;
|
//
|
// int nStartX = nWidth/2 - nCalWidth/2;
|
// int nStartY = nHeight/2 - nCalHeight/2;
|
//
|
// //
|
// double Focusvalue = 0;
|
// double SumValue = 0;
|
// double TempValue = 0;
|
// double m_nResultFocusValue = 0;
|
//
|
// for (int y = 0; y < nHeight - 1; y++)
|
// {
|
// for (int x = 0; x < nWidth - 1; x++)
|
// {
|
// TempValue = (double)(pImageBufferByte[y*nWidth + x] - pImageBufferByte[y*nWidth + x + 1]);
|
// SumValue = TempValue * TempValue;
|
// TempValue = (double)(pImageBufferByte[y*nWidth + x] - pImageBufferByte[(y + 1)*nWidth + x]);
|
// SumValue += TempValue * TempValue;
|
//
|
// Focusvalue += sqrt(SumValue);
|
// //Focusvalue += SumValue;
|
// }
|
// }
|
//
|
// m_nResultFocusValue = int(Focusvalue / (double)(nWidth*nHeight));
|
//
|
// double dXValue=0., dYValue=0., dCurr=0., dSum=0., dFocus=0.;
|
// for(int nH=nStartY ; nH<nStartY+nCalHeight-1 ; nH++)
|
// {
|
// for(int nW=nStartX ; nW<nStartX+nCalWidth-1 ; nW++)
|
// {
|
// dXValue = float((pImageBufferByte[nH*nW + nW+1] - pImageBufferByte[nH*nW + nW])*(pImageBufferByte[nH*nW + nW+1] - pImageBufferByte[nH*nW + nW]));
|
// dYValue = float((pImageBufferByte[(nH+1)*nW + nW] - pImageBufferByte[nH*nW + nW])*(pImageBufferByte[(nH+1)*nW + nW] - pImageBufferByte[nH*nW + nW]));
|
// dCurr = sqrt(dXValue + dYValue);
|
// dSum += dCurr;
|
// }
|
// }
|
// dFocus = dSum/double(nCalWidth*nCalHeight);
|
//
|
// return dFocus;
|
}
|