#include "StdAfx.h"
|
#include "ReviewProcessor_CSOT_OFF.h"
|
|
#include "ModuleStatus.h"
|
#include "ResultServerControl.h"
|
#include "CameraControlReview.h"
|
#include "CHImageProcess.h"
|
#include "MotorControl.h"
|
|
#include "EdgeTriangle.h"
|
#include "RecipeManager.h"
|
#include "RsRcpReviewInfo.h"
|
#include "DitGlassRawClient.h"
|
#include "../LineCheckerMethod/LineChecker/LineChecker.h"
|
|
using namespace CHImageControls;
|
|
CReviewProcessor_CSOT_OFF::CReviewProcessor_CSOT_OFF(int nThreadCount) : CReviewProcessor(nThreadCount)
|
{
|
bProcessSuccess[CSOT_OFF_REVIEW_SUCCESS] = FALSE;
|
bProcessSuccess[CSOT_OFF_MEASURE_SUCCESS] = FALSE;
|
bProcessSuccess[CSOT_OFF_WSI_SUCCESS] = FALSE;
|
bProcessSuccess[CSOT_OFF_REFLOW_SUCCESS] = FALSE;
|
|
InitializeCriticalSection(&m_csUserCriticalSection);
|
InitializeCriticalSection(&m_csMeasureRcpfileCriticalSection);
|
InitializeCriticalSection(&m_csMeasureRcpimageCriticalSection);
|
InitializeCriticalSection(&m_csMeasureMeasureResult);
|
|
// 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 };
|
|
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_CSOT_OFF::~CReviewProcessor_CSOT_OFF(void)
|
{
|
DeleteCriticalSection(&m_csUserCriticalSection);
|
DeleteCriticalSection(&m_csMeasureRcpfileCriticalSection);
|
DeleteCriticalSection(&m_csMeasureRcpimageCriticalSection);
|
DeleteCriticalSection(&m_csMeasureMeasureResult);
|
}
|
|
void CReviewProcessor_CSOT_OFF::AddWsiResultData(int nModuleIndex, const SWSIMeasureResult& 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_ResultCode = measureResut.nResultCode;
|
wsiResult.nWsi_Type = measureResut.nResultType;
|
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(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_CSOT_OFF::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)
|
{
|
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;
|
}
|
|
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;
|
}
|
|
// ÀúÀå ¼º°ø½Ã, ¸®ºä ÇÁ·Î¼¼¼¿¡ Æ÷ÀÎÅÍ Àü´Þ
|
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==nEndResultIdx && nCurResultIdx+1 < pReviewResult->GetSReviewResultCount())
|
{
|
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(500); // µô·¹ÀÌ´Â ÇʼöÀÓ. ¾øÀ¸¸é µ¿ÀÛ ¾ÈÇÔ.
|
|
CSequenceProcessor* pSequenceProcessor = m_pRP2P->IRP2P_GetSequenceProcessor();
|
switch(GetReviewProcessStatus())
|
{
|
case ReviewProcessStatus_ReviewStart:
|
pSequenceProcessor->SendReviewPositionToMotorControl(pGlassResult);
|
break;
|
case ReviewProcessStatus_UserStart:
|
pSequenceProcessor->SendUserPositionToMotorControl(pGlassResult);
|
break;
|
|
case ReviewProcessStatus_ReflowStart:
|
pSequenceProcessor->SendReflowPositionToMotorControl(pGlassResult);
|
break;
|
//Process_RemainReviewPoint(nModuleIndex);
|
}
|
}
|
|
// °á°ú °»½Å.
|
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_CSOT_OFF::CheckMotionComplete()
|
{
|
long lCheckCommand = 0;
|
// check motor signal
|
CMotorControl* pMotorControl = m_pRP2P->IRP2P_GetMotorControl();
|
|
DWORD dWStart = GetTickCount();
|
|
while(pMotorControl != NULL)
|
{
|
// [2016:11:14]-[WEZASW] : FIC 900¹øÀÚ Motor ÁÖ¼Ò È®ÀÎÇÊ¿ä.
|
if(pMotorControl->ReadAddressValue(m_MotorControlInfo->GetMotorCommonAddr()->m_nAllAutoEnableAddr,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;
|
}
|
|
int CReviewProcessor_CSOT_OFF::PostProcessReviewResult(int nThreadIdx, SReviewResult* pReviewResult)
|
{
|
if (m_pRP2P==NULL) return 0;
|
|
// ¸¶Áö¸· Æ÷ÀÎÆ®ÀÎÁö È®ÀÎ ÈÄ PCControl ReviewEnd Àü¼Û
|
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);
|
|
// check motor signal
|
//int lCheckCommand = CheckMotionComplete();
|
int lCheckCommand = 1;
|
//ReviewCamera_CameraControl(CameraControlStop);
|
Sleep(500);
|
|
if(lCheckCommand)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("LCHECKCOMMAND"));
|
m_pRP2P->IRP2P_CompletePlanIndex(ReviewProcessStatus_ReviewEnd, m_nReviewPlanIndex);
|
}
|
bProcessSuccess[CSOT_OFF_REVIEW_SUCCESS] = TRUE;
|
}
|
|
return 1;
|
}
|
|
int CReviewProcessor_CSOT_OFF::PostProcessUserResult(int nThreadIdx, SReviewResult* pReviewResult)
|
{
|
if (m_pRP2P==NULL) return 0;
|
|
// ¸¶Áö¸· Æ÷ÀÎÆ®ÀÎÁö È®ÀÎ ÈÄ PCControl ReviewEnd Àü¼Û
|
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);
|
Sleep(500);
|
|
if(lCheckCommand)
|
{
|
m_pRP2P->IRP2P_CompletePlanIndex(ReviewProcessStatus_UserEnd, m_nReviewPlanIndex);
|
}
|
bProcessSuccess[CSOT_OFF_USER_SUCCESS] = TRUE;
|
}
|
|
return 1;
|
}
|
|
int CReviewProcessor_CSOT_OFF::PostProcessReflowResult( int nThreadIdx, SReviewResult* pReviewResult )
|
{
|
if (m_pRP2P==NULL) return 0;
|
|
// ¸¶Áö¸· Æ÷ÀÎÆ®ÀÎÁö È®ÀÎ ÈÄ PLC ReviewEnd Àü¼Û
|
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);
|
Sleep(500);
|
|
if(lCheckCommand)
|
{
|
m_pRP2P->IRP2P_CompletePlanIndex(ReviewProcessStatus_ReflowEnd, m_nReviewPlanIndex);
|
}
|
bProcessSuccess[CSOT_OFF_REFLOW_SUCCESS] = TRUE;
|
}
|
|
return 1;
|
}
|
|
int CReviewProcessor_CSOT_OFF::PostProcessWsiResult(int nThreadIdx, SReviewResult* pReviewResult)
|
{
|
if (m_pRP2P==NULL) return 0;
|
|
// ¸¶Áö¸· Æ÷ÀÎÆ®ÀÎÁö È®ÀÎ ÈÄ PCControl ReviewEnd Àü¼Û
|
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);
|
Sleep(500);
|
|
if(lCheckCommand)
|
{
|
m_pRP2P->IRP2P_CompletePlanIndex(ReviewProcessStatus_WSIEnd, m_nReviewPlanIndex);
|
}
|
bProcessSuccess[CSOT_OFF_WSI_SUCCESS] = TRUE;
|
}
|
|
return 1;
|
}
|
|
int CReviewProcessor_CSOT_OFF::PostProcessMeasureResult(int nThreadIdx, SReviewResult* pReviewResult)
|
{
|
g_pLog->DisplayMessage(_T("PostProcessMeasureResult[%d]"),nThreadIdx);
|
if (m_pRP2P==NULL) return 0;
|
|
// ¸¶Áö¸· Æ÷ÀÎÆ®ÀÎÁö È®ÀÎ ÈÄ PCControl ReviewEnd Àü¼Û
|
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);
|
Sleep(500);
|
|
if(lCheckCommand)
|
{
|
m_pRP2P->IRP2P_CompletePlanIndex(ReviewProcessStatus_MeasureEnd, m_nReviewPlanIndex);
|
}
|
|
bProcessSuccess[CSOT_OFF_MEASURE_SUCCESS] = TRUE;
|
}
|
else
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[CheckComplete] NotComplete-------------------------"));
|
}
|
|
return 1;
|
}
|
int CReviewProcessor_CSOT_OFF::PostProcessWsiReflowResult(int nThreadIdx, SReviewResult* pReviewResult)
|
{
|
if (m_pRP2P==NULL) return 0;
|
|
// ¸¶Áö¸· Æ÷ÀÎÆ®ÀÎÁö È®ÀÎ ÈÄ PCControl ReviewEnd Àü¼Û
|
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);
|
Sleep(500);
|
|
if(lCheckCommand)
|
{
|
m_pRP2P->IRP2P_CompletePlanIndex(ReviewProcessStatus_WSIReflowEnd, m_nReviewPlanIndex);
|
}
|
bProcessSuccess[CSOT_OFF_WSI_SUCCESS] = TRUE;
|
}
|
|
return 1;
|
}
|
|
|
int CReviewProcessor_CSOT_OFF::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;
|
|
TRACE(_T("in pThreadData => %d\n"), pThreadData);
|
|
// set data
|
pThreadData->nThreadIdx = nThreadIdx;
|
pThreadData->pReviewResult = pReviewResult;
|
|
// start thread
|
CreateWorkThread(pThreadData);
|
|
return 1;
|
}
|
|
void CReviewProcessor_CSOT_OFF::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;
|
}
|
|
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;
|
}
|
|
UnlockThreadIndex(pProcessData->nThreadIdx);
|
|
return;
|
}
|
|
/// Ãß°¡
|
|
int CReviewProcessor_CSOT_OFF::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;
|
}
|
|
// Snap ½Ã°£ ÀúÀå.
|
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)
|
{
|
strImageFileName.Format(_T("REVIEW_%05d_%07d_%07d.JPG"), pReviewResult->nDefectIdx+1, pReviewResult->nUMOriginX, pReviewResult->nUMOriginY);
|
pReviewResult->strUploadImgFileName = strImageFileName;
|
}
|
//ºÐÆÇ
|
int posX = int(462500) -pReviewResult->nUMOriginX;
|
int posY = int(750000) -pReviewResult->nUMOriginY;
|
CDitGlassRawClient *dit = CDitGlassRawClient::GetInstance();
|
if(dit->isConnect() == TRUE)
|
{
|
_grmDefectData* pSharedDefect = dit->GetDefectData(pReviewResult->nDefectIdx);
|
_grmDefectReviewData * pSharedDefectReview = &pSharedDefect->m_ReviewDefect;
|
|
size_t CharactersConverted;
|
wcstombs_s(&CharactersConverted, pSharedDefectReview->m_strRevImageName, pReviewResult->strImgFileName, _TRUNCATE);
|
|
pSharedDefectReview->m_nPlanType = ReviewType_Review; //0:None, 1:Location(User, Fiexed) Review, 4:reflower, ??:Wsi, 1000:AOI(¿ÜºÎ ·ÎÄà ¸®ºä ¸í·É)
|
pSharedDefectReview->m_nResultCode = 1; //0:None, 1:Success
|
pSharedDefectReview->m_nShotIndex = m_nReviewCount;
|
pSharedDefectReview->m_nModuleIndex;
|
pSharedDefectReview->m_nMagnificIndex;
|
pSharedDefectReview->m_fManification;
|
pSharedDefectReview->m_fManificResoultion;
|
|
}
|
|
|
// ·ÎÄà À̹ÌÁö ÀúÀå ÆÄÀÏ À̸§
|
//strImageFileName.Format(_T("ModuleIdx[%d]_PointIdx[%d]_Zoom[%d]"), pReviewResult->nModuleIdx, pReviewResult->nResultIdx, pReviewResult->nZoomIdx);
|
pReviewResult->strImgFileName = m_strSaveImageBasePath + _T("\\") +pReviewResult->strImgFileName;
|
//pReviewResult->strImgFileName = strImageFileName;
|
|
// [2017:6:6]-[WEZASW] : Review DefectImage¿¡ AOI DefectImage ¿À¹ö·¦(¸®ºä À̹ÌÁö ¿ìÃø ÇÏ´Ü)
|
// load aoi image
|
CCHImageData aoiDark, aoiBright;
|
pReviewResult->nOpticType = 1;
|
//LoadAoiImage(m_strJobID, pReviewResult->nOpticType, pReviewResult->nUMCenterOriginX, pReviewResult->nUMCenterOriginY, &aoiDark, &aoiBright);
|
|
// find defect pos
|
SReviewDefectFindResult findResult;
|
|
// make upload image
|
CCHImageData uploadImage;
|
//if(MakeUploadImage(&uploadImage, pImageData, &aoiDark, &aoiBright, findResult, pReviewResult))
|
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);
|
if (nSize > 0)
|
m_pRP2P->IRP2P_DisplayMessage(_T("Backup Review Image Save Success! Size: %d byte [%s]"), nSize, pReviewResult->strUploadImgFileName);
|
|
// [2017:4:10]-[WEZASW] : °í°´»ç ¿äû¿¡ ÀÇÇÑ bmp ÆÄÀÏ Ãß°¡ ÀúÀå. (Àӽûç¿ë)
|
// if (m_bReviewOriginalImage == TRUE)
|
// {
|
// if(0)
|
// CreateDirectory(m_strSaveImageBasePath + _T("\\Orignal"), NULL);
|
// strPath.Format(_T("%s\\Orignal\\%s"), m_strSaveImageBasePath, pReviewResult->strOrignalImgFileName);
|
// SaveReviewImage(&uploadImage, strPath);
|
// }
|
//
|
//if(GetReviewProcessStatus() == ReviewProcessStatus_ReviewStart)
|
//{
|
// if(0)
|
strPath.Format(_T("%s\\%s"), m_strSaveImageUploadPath, pReviewResult->strUploadImgFileName);
|
nSize = SaveReviewImage(&uploadImage, strPath, m_nReviewImageSize, m_nReviewImageQuality, m_nReviewImageStep);
|
if (nSize > 0)
|
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);
|
// }
|
}
|
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);
|
}
|
|
return ReviewResult_Process_Complete;
|
}
|
|
|
int CReviewProcessor_CSOT_OFF::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;
|
}
|
|
// Snap ½Ã°£ ÀúÀå.
|
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->nDefectIdx+1, pReviewResult->nUMOriginX, pReviewResult->nUMOriginY);
|
pReviewResult->strUploadImgFileName = strImageFileName;
|
}
|
|
// ·ÎÄà À̹ÌÁö ÀúÀå ÆÄÀÏ À̸§
|
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); // ÈÁú 60% 150k
|
if(GetReviewProcessStatus() == ReviewProcessStatus_UserStart)
|
{
|
// [2017:6:21][bhs] : ¾÷·Îµå À̹ÌÁö °æ·Î ¼öÁ¤
|
//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);
|
}
|
|
return ReviewResult_Process_Complete;
|
}
|
int CReviewProcessor_CSOT_OFF::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];
|
if (pImageData==NULL)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("RPT2P_ThreadProcess ImageData NULL"));
|
return ReviewResult_Process_Fail;
|
}
|
|
// Snap ½Ã°£ ÀúÀå.
|
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->nDefectIdx+1, pReviewResult->nUMOriginX, pReviewResult->nUMOriginY);
|
pReviewResult->strUploadImgFileName = strImageFileName;
|
}
|
|
// int nImageWidth=2432, nImageHeight=2048, nSide=0, nBaseTh = 10, nDamTh1=45, nDamTh2=60, nDam2Dist=123, nDam12Dist=195, nDam1Dist=102;
|
// int nBaseline=0, nBaseDam2=0;
|
// CRect rtRoi = CRect(0,0,nImageWidth,nImageHeight);
|
|
int l = 0;
|
int t = 0;
|
int r = 0;
|
int b = 0;
|
|
CGlassResult* pGlassResult = m_pRP2P->IRP2P_GetCurrentGlassResult();
|
if (pGlassResult == NULL)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("GlassResult NULL!!!!"));
|
return ReviewResult_Process_Fail;
|
}
|
// const CReviewResult* pUserReviewResult = pGlassResult->GetUserResult()
|
reflowParam reParam;
|
|
reParam.nImageWidth = 2432;
|
reParam.nImageHeight = 2048;
|
const CRsRcpReviewInfo* pRsRecipeManage = m_pRP2P->IRP2P_Recipe_GetRsRcpReviewInfo();
|
if (pRsRecipeManage !=NULL)
|
{
|
const CRcpUserDefectInfo* pRcpUserDefect = pRsRecipeManage->GetRcpUserDefectInfo(pReviewResult->nResultIdx);
|
if (pRcpUserDefect != NULL)
|
{
|
// nSide = pRcpUserDefect->GetCellSide();
|
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->GetDam2Th();
|
reParam.nDamTh1 = pRcpReflowParameter->GetDam1Th();
|
|
// 20180521 smok. Reflow °ËÃâ·Â Çâ»óÀ» À§ÇÑ ROI ¼³Á¤
|
// if (reParam.nSide == 0 ) // TOP
|
// {
|
// l = 0;
|
// r = reParam.nImageWidth;
|
// t = reParam.nImageHeight / 2 - 50;
|
// b = t + (reParam.nBaseline + reParam.nBaseDam2 + reParam.nDam2Dist + reParam.nDam12Dist + reParam.nDam1Dist) + 100;
|
// if (b > reParam.nImageHeight) b = reParam.nImageHeight;
|
// }
|
// else if (reParam.nSide == 1) // Left
|
// {
|
// b = reParam.nImageHeight;
|
// t = 0;
|
// l = reParam.nImageWidth / 2 - 50;
|
// r = l + (reParam.nBaseline + reParam.nBaseDam2 + reParam.nDam2Dist + reParam.nDam12Dist + reParam.nDam1Dist) + 100;
|
// if (r > reParam.nImageWidth) r = reParam.nImageWidth;
|
// }
|
// else if (reParam.nSide == 2) // Right
|
// {
|
// b = reParam.nImageHeight;
|
// t = 0;
|
// r = reParam.nImageWidth / 2 + 50;
|
// l = r - (reParam.nBaseline + reParam.nBaseDam2 + reParam.nDam2Dist + reParam.nDam12Dist + reParam.nDam1Dist) - 100;
|
// if (l < 0) l = 0;
|
// }
|
// CRect rtRoi = CRect(l,t,r,b);
|
// reParam.ROI_Rect = &rtRoi;
|
CCHImageData MasterImage;
|
CString strMasterImageFileName;
|
strMasterImageFileName.Format(_T("%s\\%s"), _REVIEW_REFLOW_RECIPE_PATH_, pRcpReflowParameter->GetMasterFileName());
|
MasterImage.LoadImageW(strMasterImageFileName);
|
reParam.nMasterChannel = MasterImage.GetChannels();
|
reParam.nMasterHeight = MasterImage.GetHeight();
|
reParam.nMasterWidth = MasterImage.GetWidth();
|
reParam.pMasterBuffer = (BYTE*)MasterImage.GetImageBuffer();
|
reParam.nMasterWidthStep = MasterImage.GetWidthStep();
|
|
if (m_pRP2P->IRP2P_GetIsSuperUser() == _T("1"))
|
{
|
static int topnum = 0;
|
static int leftnum = 0;
|
static int rightnum = 0;
|
|
CCHImageData reflowImage;
|
CString strLoadImageFileName;
|
if (reParam.nSide == 0 )
|
{
|
strLoadImageFileName.Format(_T("D:\\B11Reflow\\top_%d.jpg"), topnum++);
|
if (topnum > 10) topnum = 0;
|
}
|
else if (reParam.nSide == 1)
|
{
|
strLoadImageFileName.Format(_T("D:\\B11Reflow\\left_%d.jpg"), leftnum++);
|
if (leftnum > 10) leftnum = 0;
|
}
|
else if (reParam.nSide == 2)
|
{
|
strLoadImageFileName.Format(_T("D:\\B11Reflow\\right_%d.jpg"), rightnum++);
|
if (rightnum > 10) rightnum = 0;
|
}
|
reflowImage.LoadImageW(strLoadImageFileName);
|
reParam.nChannel = reflowImage.GetChannels();
|
reParam.pImageBuffer = (BYTE*)reflowImage.GetImageBuffer();
|
reParam.nImageWidthStep = reflowImage.GetWidthStep();
|
|
CRect rtRoi = CRect(0,0,reflowImage.GetWidth()-1, reflowImage.GetHeight()-1);
|
reParam.ROI_Rect = &rtRoi;
|
int result=Linecheck_Method(pReviewResult->pReflow_LinePosData, &reParam, TRUE);
|
pReviewResult->nReflow_Result = result;
|
pImageData->SetSubImage(0,0,reflowImage.GetWidth(),reflowImage.GetHeight(), reflowImage.GetChannels(), reParam.pImageBuffer);
|
// reflowImage.SaveImage(_T("d:\\lineResultimage.jpg"));
|
pImageData->CopyImageFrom(&reflowImage);
|
}
|
else
|
{ ////////////////////// Reflow 󸮴 ¿©±â¼
|
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;
|
pReviewResult->nReflow_Result = Linecheck_Method(pReviewResult->pReflow_LinePosData, &reParam, TRUE);
|
}
|
delete reParam.nDistance;
|
}
|
}
|
}
|
// // 20181016 reflow ÆÇÁ¤ ¸®Åϰª º¯°æÀ¸·Î ÀÎÇÑ ÀÓ½ÃÄÚµå
|
// if (pReviewResult->nReflow_Result == 0)
|
// { // no reflow
|
// pReviewResult->nReflow_Result = 4;
|
// }
|
// else if (pReviewResult->nReflow_Result == 1)
|
// { // Dam1 Reflow
|
// if (pReviewResult->pReflow_LinePosData[2] > 0)
|
// {
|
// pReviewResult->nReflow_Result = 3;
|
// }
|
// else
|
// {
|
// pReviewResult->nReflow_Result = 2;
|
// }
|
// }
|
// else if (pReviewResult->nReflow_Result == 2)
|
// {
|
// if (pReviewResult->pReflow_LinePosData[0] > 0)
|
// {
|
// pReviewResult->nReflow_Result = 1;
|
// }
|
// else
|
// pReviewResult->nReflow_Result = 0;
|
// }
|
// /////////////////////////////////////////////////////
|
if (pReviewResult->nReflow_Result > -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 : %d"), pReviewResult->nReflow_Result);
|
}
|
// test code
|
// static int vv = 0;
|
// vv ++;
|
// if (vv == 5) vv = 0;
|
// pReviewResult->nReflow_Result = vv;
|
///////////////////////////////////////
|
|
pReviewResult->nReflow_Result = 4 - pReviewResult->nReflow_Result;
|
// 20180824 smok. BMP ¿øº» À̹ÌÁö ÀúÀå
|
CCHImageData tempImage1;
|
tempImage1.CopyImageFrom(pImageData);
|
if (m_bReviewOriginalImage == TRUE)
|
{
|
CString strPath = _T("");
|
CreateDirectory(m_strSaveImageBasePath + _T("\\Orignal"), NULL);
|
strPath.Format(_T("%s\\Orignal\\%s"), m_strSaveImageBasePath, pReviewResult->strOrignalImgFileName);
|
SaveReviewImage(&tempImage1, 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); // ÈÁú 60% 150k
|
if(GetReviewProcessStatus() == ReviewProcessStatus_ReflowStart)
|
{
|
// [2017:6:21][bhs] : ¾÷·Îµå À̹ÌÁö °æ·Î ¼öÁ¤
|
//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);
|
}
|
}
|
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);
|
}
|
|
return ReviewResult_Process_Complete;
|
}
|
int CReviewProcessor_CSOT_OFF::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;
|
EnterCriticalSection(&m_csMeasureRcpimageCriticalSection);
|
if (modelImage.LoadImage(strTemp)==FALSE)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ProcessMeasure] Model-Image Load Error"));
|
LeaveCriticalSection(&m_csMeasureRcpimageCriticalSection);
|
return ReviewResult_Process_Fail;
|
}
|
LeaveCriticalSection(&m_csMeasureRcpimageCriticalSection);
|
|
// recipe load
|
strTemp = TRIANGLE_RECIPE_PATH + pRecipeInfo->strRecipeFile;
|
CRecipeTriangle recipeTriangle;
|
EnterCriticalSection(&m_csMeasureRcpfileCriticalSection);
|
if (recipeTriangle.ReadRecipe(strTemp)==FALSE)
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[ProcessMeasure] RecipeTraingle Load Error"));
|
LeaveCriticalSection(&m_csMeasureRcpfileCriticalSection);
|
return ReviewResult_Process_Fail;
|
}
|
LeaveCriticalSection(&m_csMeasureRcpfileCriticalSection);
|
|
// 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;
|
// }
|
EnterCriticalSection(&m_csMeasureMeasureResult); //Fix CD Measure 2016-03-22 ¡é
|
|
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;
|
}
|
LeaveCriticalSection(&m_csMeasureMeasureResult); //Fix CD Measure 2016-03-22 ¡è
|
|
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_CSOT_OFF::ProcessWSI(int nThreadIdx, SReviewResult* pReviewResult)
|
{
|
// [2016:11:15]-[WEZASW] : Á¡°Ë ÇÊ¿ä
|
|
// wsi¿ë return °ªÀ¸·Î ¼öÁ¤ [6/20/2017 bhs]
|
return WsiResultSuccess;
|
}
|
|
//ÆÄÀϸí 181227 cmark
|
BOOL CReviewProcessor_CSOT_OFF::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;
|
|
// [2017:5:18]-[WEZASW] : Defect ÁÂÇ¥ ±âÁØ º¯°æ(Glass Conner to Center)
|
// [2017:6:4]-[WEZASW] : Review Image Namming RuleÀÇ StepID(EQPID -> OperID) ¼öÁ¤
|
// [2017:6:20]-[WEZASW] : Review Image Namming RuleÀÇ EQPID Ãß°¡¿äû(°í°´»ç)
|
// [2017:6:24]-[bhs] : Review Image Namming RuleÀÇ EQPID -> MachineID·Î º¯°æ¿äû(°í°´»ç)
|
|
//ReviewImage Process_ID_Glass_ID_EQPTYPE__Index_Xpos_Ypos_Judge_ScaleJudge_DefectType_Date(YYYYMMDD_HHMMSS).jpg
|
CDitGlassRawClient *dit = CDitGlassRawClient::GetInstance();
|
if(dit->isConnect() == TRUE)
|
{
|
int nPosX,nPosY;
|
{
|
if(dit->GetGlassData()->m_nScanCoordinateY == 0)
|
{
|
nPosX = int(dit->GetGlassData()->m_nGlassSizeWidth/2) - pReviewResult->nUMOriginX;
|
nPosY = int(dit->GetGlassData()->m_nGlassSizeHeight/2) - pReviewResult->nUMOriginY;
|
}
|
else
|
{
|
nPosY = int(dit->GetGlassData()->m_nGlassSizeWidth/2) - pReviewResult->nUMOriginX;
|
nPosX = int(dit->GetGlassData()->m_nGlassSizeHeight/2) - pReviewResult->nUMOriginY;
|
}
|
}
|
_grmDefectData* pSharedDefect = dit->GetDefectData(pReviewResult->nDefectIdx);
|
|
CStringW strOperID (dit->GetGlassData()->m_strOperID );
|
CStringW strGlassID(dit->GetGlassData()->m_strGlassID);
|
CStringW strStepID(dit->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,
|
m_nReviewCount,
|
nPosX/1000.0,
|
nPosY/1000.0,
|
pReviewResult->strJudgeType,
|
pReviewResult->strSizeType,
|
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.
|
pReviewResult->strEquipID;
|
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] : °í°´»ç ¿äû¿¡ ÀÇÇÑ bmp ÆÄÀÏ Ãß°¡ ÀúÀå. (Àӽûç¿ë)
|
pReviewResult->strOrignalImgFileName = strFileName + _T(".bmp");
|
|
strFileName += _T(".jpg");
|
pReviewResult->strUploadImgFileName = strFileName;
|
pReviewResult->strImgFileName = strFileName;
|
return TRUE;
|
}
|
|
|
BOOL CReviewProcessor_CSOT_OFF::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_CSOT_OFF::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_ReviewStart)
|
{
|
// [2017:6:5]-[WEZASW] : Review Image ÆÄÀÏ¸í¿¡ '*' »ç¿ë ±ÝÁö.(¿¹¿Üó¸®)
|
if (pReviewResult->strDefectCode.Compare(_T("***")) == 0)
|
strDefectCodeTemp = _T("DC");
|
else
|
strDefectCodeTemp = pReviewResult->strDefectCode;
|
|
// [2017:5:18]-[WEZASW] : Defect ÁÂÇ¥ ±âÁØ º¯°æ(Glass Conner to Center)
|
// [2017:6:4]-[WEZASW] : Review Image Namming RuleÀÇ StepID(EQPID -> OperID) ¼öÁ¤
|
// [2017:6:20]-[WEZASW] : Review Image Namming RuleÀÇ EQPID Ãß°¡¿äû(°í°´»ç)
|
// [2017:6:24]-[bhs] : Review Image Namming RuleÀÇ EQPID -> MachineID·Î º¯°æ¿äû(°í°´»ç)
|
|
//ReviewImage Process_ID_Glass_ID_EQPTYPE__Index_Xpos_Ypos_Judge_ScaleJudge_DefectType_Date(YYYYMMDD_HHMMSS).jpg
|
CDitGlassRawClient *dit = CDitGlassRawClient::GetInstance();
|
if(dit->isConnect() == TRUE)
|
{
|
int nPosX,nPosY;
|
{
|
if(dit->GetGlassData()->m_nScanCoordinateY == 0)
|
{
|
nPosX = int(dit->GetGlassData()->m_nGlassSizeWidth/2) - pReviewResult->nUMOriginX;
|
nPosY = int(dit->GetGlassData()->m_nGlassSizeHeight/2) - pReviewResult->nUMOriginY;
|
}
|
else
|
{
|
nPosY = int(dit->GetGlassData()->m_nGlassSizeWidth/2) - pReviewResult->nUMOriginX;
|
nPosX = int(dit->GetGlassData()->m_nGlassSizeHeight/2) - pReviewResult->nUMOriginY;
|
}
|
}
|
_grmDefectData* pSharedDefect = dit->GetDefectData(pReviewResult->nDefectIdx);
|
|
CStringW strOperID (dit->GetGlassData()->m_strOperID );
|
CStringW strGlassID(dit->GetGlassData()->m_strGlassID);
|
CStringW strStepID(dit->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,
|
m_nReviewCount,
|
nPosX/1000.0,
|
nPosY/1000.0,
|
pReviewResult->strJudgeType,
|
pReviewResult->strSizeType,
|
snapTime.GetYear(), snapTime.GetMonth(), snapTime.GetDay(),
|
snapTime.GetHour(), snapTime.GetMinute(), snapTime.GetSecond());
|
}
|
|
|
|
// strFileName.Format(_T("%s_%s_%s_%d_%d_%d_%s_%04d%02d%02d_%02d%02d%02d%03d"), m_strGlassID, m_strOperID, m_strEqpID, m_nReviewCount++,
|
// pReviewResult->nUMCenterOriginX, pReviewResult->nUMCenterOriginY, strDefectCodeTemp,
|
// snapTime.wYear, snapTime.wMonth, snapTime.wDay, snapTime.wHour, snapTime.wMinute, snapTime.wSecond, snapTime.wMilliseconds);
|
}
|
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.
|
pReviewResult->strEquipID;
|
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] : °í°´»ç ¿äû¿¡ ÀÇÇÑ bmp ÆÄÀÏ Ãß°¡ ÀúÀå. (Àӽûç¿ë)
|
pReviewResult->strOrignalImgFileName = strFileName + _T(".bmp");
|
|
strFileName += _T(".jpg");
|
pReviewResult->strUploadImgFileName = strFileName;
|
pReviewResult->strImgFileName = strFileName;
|
return TRUE;
|
}
|
|
void CReviewProcessor_CSOT_OFF::LoadAoiImage(const CString& strGlassID, int nOpticType, int nPosX, int nPosY, CCHImageData* pAoiDark, CCHImageData *pAoiBright)
|
{
|
// 3. °Ë»ç °áÇÔ À̹ÌÁö ã±â
|
CString strAoiDarkPath = _T("");
|
CString strAoiBrightPath = _T("");
|
|
FindAoiDefectImagePath(strGlassID, nOpticType, nPosX, nPosY, strAoiDarkPath, strAoiBrightPath);
|
|
// Dark, Bright ¸ðµÎ ã±â À§ÇØ ÁÖ¼®Ã³¸® [2017.7.1 bhs]
|
// 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_CSOT_OFF::FindAoiDefectImagePath( const CString& strGlassID, int nOpticType, int nPosX, int nPosY, CString& strDarkPath, CString& strBrightPath)
|
{
|
BOOL bRet;
|
CFileFind finder;
|
CString strSearchPath = _T("");
|
|
// Dark, Bright ¸ðµÎ ã±â À§ÇØ ÁÖ¼®Ã³¸® [2017.7.1 bhs]
|
//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_CSOT_OFF::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();
|
}
|
|
// 4-3. ¸®ºäÆò±Õ ¹à±â
|
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_CSOT_OFF::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);
|
// 20170817 smok Dark, Bright À̹ÌÁö°¡ ¸®ºä À̹ÌÁö ¾Æ·¡¿¡ ºÙµµ·Ï ¼öÁ¤
|
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
|
|
// draw text string
|
DrawDefectInfo(&memDC, findResult, pReviewResult);
|
|
//DrawAoiImage(&memDC, &pAoiDark2, &pAoiBright2, &pAoiDark2, &pAoiBright2, nAoiWidth, nAoiHeight);
|
|
// draw line È÷ÆÃ °ËÁõ¿ë
|
//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_CSOT_OFF::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_CSOT_OFF::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);
|
|
// Dark, Bright À̹ÌÁö°¡ ³ª¶õÈ÷ ºÙµµ·Ï ¼öÁ¤, Dark À§, Bright ¾Æ·¡ - °í°´»ç ¿äû[2017.6.30 bhs]
|
//int nX = nTotalWidth - nWidth;
|
//int nY = nTotalHeight - (nHeight * 2);
|
|
// 20170817 smok Dark, Bright À̹ÌÁö°¡ ¸®ºä À̹ÌÁö ¾Æ·¡¿¡ ºÙµµ·Ï ¼öÁ¤
|
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);
|
|
// °Ë»ç À̹ÌÁö Áß¾Ó¿¡ È»ìÇ¥ Ç¥½Ã - °í°´»ç ¿äû [2017.6.30 bhs]
|
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();
|
}
|
|
// [2017:1:3]-[WEZASW] : CIM º¸°í¿ë '°Ë»ç°á°ú' Á¤º¸ ¹Ý¿µ
|
// [2017:5:12]-[WEZASW] : DFS Result File Format º¯°æ
|
void CReviewProcessor_CSOT_OFF::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;
|
FontFamily fontFamily(_T("Arial"));
|
StringFormat strformat;
|
|
int nStartX = 10;
|
int nStartY = 1900;
|
//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();
|
|
// 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,m_nReviewCount++);
|
path.AddString(strValue, (int)wcslen(strValue), &fontFamily, FontStyleRegular, nFontSize, Gdiplus::Point(nStartX,nStartY), &strformat );
|
nStartY += nRowGab;
|
int i = snapTime.GetHour();
|
|
int posX;
|
int posY;
|
CDitGlassRawClient *dit = CDitGlassRawClient::GetInstance();
|
if(dit->isConnect() == TRUE)
|
{
|
posX = int(dit->GetGlassData()->m_nGlassSizeWidth/2) - pReviewResult->nUMOriginX;
|
posY = int(dit->GetGlassData()->m_nGlassSizeHeight/2) - pReviewResult->nUMOriginY;
|
|
}
|
|
strValue.Format(_T("GlassID[%s].Panel[%s].D/G[%d/%d].X/Y[%.3lf/%.3lf]"), m_strJobID,pReviewResult->strCellID,pReviewResult->nUMCellX,pReviewResult->nUMCellY, posY/1000.0, posX/1000.0);
|
path.AddString(strValue, (int)wcslen(strValue), &fontFamily, FontStyleRegular, nFontSize, Gdiplus::Point(nStartX,nStartY), &strformat );
|
nStartY += nRowGab;
|
|
|
|
strValue.Format(_T("DefectType[%s].Cam[%d] Size[%dum] ReviewMag[%dX]"),pReviewResult->strDefectType,pReviewResult->nAOICameraIdx,
|
pReviewResult->nAOISize,(int)pReviewResult->dMagnification);
|
path.AddString(strValue, (int)wcslen(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);
|
}
|
// 20170720 smok. bright, dark image is exist
|
void CReviewProcessor_CSOT_OFF::DrawDefectInfo(CDC *pDC, const SReviewDefectFindResult& findResult, const SReviewResult* pReviewResult, CCHImageData* pAoiBright, CCHImageData* pAoiDark)
|
{
|
if (pDC==NULL || m_pRP2P==NULL) return;
|
|
Gdiplus::Graphics graphics(pDC->GetSafeHdc());
|
|
graphics.SetSmoothingMode(SmoothingModeAntiAlias);
|
graphics.SetInterpolationMode(InterpolationModeHighQuality);
|
|
GraphicsPath path;
|
FontFamily fontFamily(_T("Arial"));
|
StringFormat strformat;
|
|
int nStartX = 10;
|
int nStartY = 1900;
|
//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();
|
|
// 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,m_nReviewCount++);
|
path.AddString(strValue, (int)wcslen(strValue), &fontFamily, FontStyleRegular, nFontSize, Gdiplus::Point(nStartX,nStartY), &strformat );
|
nStartY += nRowGab;
|
int i = snapTime.GetHour();
|
|
int posX;
|
int posY;
|
CDitGlassRawClient *dit = CDitGlassRawClient::GetInstance();
|
if(dit->isConnect() == TRUE)
|
{
|
posX = int(dit->GetGlassData()->m_nGlassSizeWidth/2) - pReviewResult->nUMOriginX;
|
posY = int(dit->GetGlassData()->m_nGlassSizeHeight/2) - pReviewResult->nUMOriginY;
|
|
}
|
|
strValue.Format(_T("GlassID[%s].Panel[%s].D/G[%d/%d].X/Y[%.3lf/%.3lf]"), m_strJobID,pReviewResult->strCellID,pReviewResult->nUMCellX,pReviewResult->nUMCellY, posY/1000.0, posX/1000.0);
|
path.AddString(strValue, (int)wcslen(strValue), &fontFamily, FontStyleRegular, nFontSize, Gdiplus::Point(nStartX,nStartY), &strformat );
|
nStartY += nRowGab;
|
|
strValue.Format(_T("DefectType[%s].Cam[%d] Size[%dum] ReviewMag[%dX]"),pReviewResult->strDefectType,pReviewResult->nAOICameraIdx,
|
pReviewResult->nAOISize,(int)pReviewResult->dMagnification);
|
path.AddString(strValue, (int)wcslen(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);
|
}
|
|
void CReviewProcessor_CSOT_OFF::DrawUserDefectInfo(CDC *pDC, const SReviewDefectFindResult& findResult, const SReviewResult* pReviewResult, CCHImageData* pAoiBright, CCHImageData* pAoiDark)
|
{
|
if (pDC==NULL || m_pRP2P==NULL) return;
|
|
Gdiplus::Graphics graphics(pDC->GetSafeHdc());
|
|
graphics.SetSmoothingMode(SmoothingModeAntiAlias);
|
graphics.SetInterpolationMode(InterpolationModeHighQuality);
|
|
GraphicsPath path;
|
FontFamily fontFamily(_T("Arial"));
|
StringFormat strformat;
|
|
int nStartX = 10;
|
int nStartY = 1900;
|
//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();
|
|
// 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,m_nReviewCount++);
|
path.AddString(strValue, (int)wcslen(strValue), &fontFamily, FontStyleRegular, nFontSize, Gdiplus::Point(nStartX,nStartY), &strformat );
|
nStartY += nRowGab;
|
int i = snapTime.GetHour();
|
|
int posX;
|
int posY;
|
CDitGlassRawClient *dit = CDitGlassRawClient::GetInstance();
|
if(dit->isConnect() == TRUE)
|
{
|
posX = int(dit->GetGlassData()->m_nGlassSizeWidth/2) - pReviewResult->nUMOriginX;
|
posY = int(dit->GetGlassData()->m_nGlassSizeHeight/2) - pReviewResult->nUMOriginY;
|
|
}
|
|
strValue.Format(_T("GlassID[%s].Panel[%s].D/G[%d/%d].X/Y[%.3lf/%.3lf]"), m_strJobID,pReviewResult->strCellID,pReviewResult->nUMCellX,pReviewResult->nUMCellY, posY/1000.0, posX/1000.0);
|
path.AddString(strValue, (int)wcslen(strValue), &fontFamily, FontStyleRegular, nFontSize, Gdiplus::Point(nStartX,nStartY), &strformat );
|
nStartY += nRowGab;
|
|
|
|
strValue.Format(_T("DefectType[%s].Cam[%d] Size[%dum] ReviewMag[%dX]"),pReviewResult->strDefectType,pReviewResult->nAOICameraIdx,
|
pReviewResult->nAOISize,(int)pReviewResult->dMagnification);
|
path.AddString(strValue, (int)wcslen(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);
|
}
|
void CReviewProcessor_CSOT_OFF::FindCDDefectIdx(SReviewResult* pReviewResult)
|
{
|
return;
|
|
/*
|
if (m_pManageResultFileCD==NULL) return;
|
|
if(m_pManageResultFileCD->GetReadComplete())
|
{
|
int nUMOriginX, nUMOriginY;
|
int nCount = m_pManageResultFileCD->GetDefectCount();
|
|
for(int i = 0; i < nCount; i++)
|
{
|
nUMOriginX = atoi(m_pManageResultFileCD->GetDefectData(i, 5));
|
nUMOriginY = atoi(m_pManageResultFileCD->GetDefectData(i, 6));
|
|
if(pReviewResult->nUMOriginX == nUMOriginX && pReviewResult->nUMOriginY == nUMOriginY)
|
{
|
pReviewResult->nCDDefectIdx = i;
|
break;
|
}
|
}
|
}
|
*/
|
}
|
|
void CReviewProcessor_CSOT_OFF::FindSDDefectIdx(SReviewResult* pReviewResult)
|
{
|
return;
|
|
/*
|
if (m_pManageResultFileSD==NULL) return;
|
|
if(m_pManageResultFileSD->GetReadComplete())
|
{
|
int nUMOriginX, nUMOriginY;
|
int nCount = m_pManageResultFileSD->GetDefectCount();
|
|
for(int i = 0; i < nCount; i++)
|
{
|
nUMOriginX = atoi(m_pManageResultFileSD->GetDefectData(i, 5));
|
nUMOriginY = atoi(m_pManageResultFileSD->GetDefectData(i, 6));
|
|
if(pReviewResult->nUMOriginX == nUMOriginX && pReviewResult->nUMOriginY == nUMOriginY)
|
{
|
pReviewResult->nSDDefectIdx = i;
|
break;
|
}
|
}
|
}
|
*/
|
}
|
|
void CReviewProcessor_CSOT_OFF::FindInspectionDefectImage(int nUMOriginX, int nUMOriginY, const CString& strGlassID, CString& strInspectionDefectImagePath)
|
{
|
BOOL bRet;
|
CFileFind finder;
|
CString strSearchPath;
|
|
strSearchPath.Format(_T("\\\\126.100.100.1\\d\\Image\\Defect\\%s\\%d_%d.bmp"), strGlassID, nUMOriginX, nUMOriginY);
|
|
bRet = finder.FindFile(strSearchPath);
|
|
while(bRet)
|
{
|
bRet = finder.FindNextFile();
|
|
if(finder.IsDots()) continue;
|
if(finder.IsDirectory()) continue;
|
|
strInspectionDefectImagePath = finder.GetFilePath();
|
}
|
|
finder.Close();
|
}
|
|
void CReviewProcessor_CSOT_OFF::FindInspectionDefectImage(int nUMOriginX, int nUMOriginY, const CString& strGlassID, int nOpticType, 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, nUMOriginX, nUMOriginY);
|
bRet = finder.FindFile(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, nUMOriginX, nUMOriginY);
|
bRet = finder.FindFile(strSearchPath);
|
while(bRet)
|
{
|
bRet = finder.FindNextFile();
|
|
if(finder.IsDots()) continue;
|
if(finder.IsDirectory()) continue;
|
strBrightPath = finder.GetFilePath();
|
}
|
|
finder.Close();
|
}
|
}
|
|
BOOL CReviewProcessor_CSOT_OFF::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_CSOT_OFF::ProcessSuccessReset()
|
{
|
bProcessSuccess[CSOT_OFF_REVIEW_SUCCESS] = FALSE;
|
bProcessSuccess[CSOT_OFF_MEASURE_SUCCESS] = FALSE;
|
bProcessSuccess[CSOT_OFF_WSI_SUCCESS] = FALSE;
|
bProcessSuccess[CSOT_OFF_REFLOW_SUCCESS] = FALSE;
|
}
|
|
|
BOOL CReviewProcessor_CSOT_OFF::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[CSOT_OFF_REVIEW_SUCCESS];
|
break;
|
case CDMeasure :
|
bSuccess = bProcessSuccess[CSOT_OFF_MEASURE_SUCCESS];
|
break;
|
case WSI :
|
bSuccess = bProcessSuccess[CSOT_OFF_WSI_SUCCESS];
|
break;
|
}
|
}
|
return bSuccess;
|
}
|
BOOL CReviewProcessor_CSOT_OFF::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_ReviewStart)
|
{
|
// [2017:6:5]-[WEZASW] : Review Image ÆÄÀÏ¸í¿¡ '*' »ç¿ë ±ÝÁö.(¿¹¿Üó¸®)
|
if (pReviewResult->strDefectCode.Compare(_T("***")) == 0)
|
strDefectCodeTemp = _T("DC");
|
else
|
strDefectCodeTemp = pReviewResult->strDefectCode;
|
|
// [2017:5:18]-[WEZASW] : Defect ÁÂÇ¥ ±âÁØ º¯°æ(Glass Conner to Center)
|
// [2017:6:4]-[WEZASW] : Review Image Namming RuleÀÇ StepID(EQPID -> OperID) ¼öÁ¤
|
// [2017:6:20]-[WEZASW] : Review Image Namming RuleÀÇ EQPID Ãß°¡¿äû(°í°´»ç)
|
// [2017:6:24]-[bhs] : Review Image Namming RuleÀÇ EQPID -> MachineID·Î º¯°æ¿äû(°í°´»ç)
|
|
//ReviewImage Process_ID_Glass_ID_EQPTYPE__Index_Xpos_Ypos_Judge_ScaleJudge_DefectType_Date(YYYYMMDD_HHMMSS).jpg
|
CDitGlassRawClient *dit = CDitGlassRawClient::GetInstance();
|
if(dit->isConnect() == TRUE)
|
{
|
int nPosX,nPosY;
|
{
|
if(dit->GetGlassData()->m_nScanCoordinateY == 0)
|
{
|
nPosX = int(dit->GetGlassData()->m_nGlassSizeWidth/2) - pReviewResult->nUMOriginX;
|
nPosY = int(dit->GetGlassData()->m_nGlassSizeHeight/2) - pReviewResult->nUMOriginY;
|
}
|
else
|
{
|
nPosY = int(dit->GetGlassData()->m_nGlassSizeWidth/2) - pReviewResult->nUMOriginX;
|
nPosX = int(dit->GetGlassData()->m_nGlassSizeHeight/2) - pReviewResult->nUMOriginY;
|
}
|
}
|
|
_grmDefectData* pSharedDefect = dit->GetDefectData(pReviewResult->nDefectIdx);
|
|
CStringW strOperID (dit->GetGlassData()->m_strOperID );
|
CStringW strGlassID(dit->GetGlassData()->m_strGlassID);
|
CStringW strStepID(dit->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,
|
m_nReviewCount,
|
nPosX/1000.0,
|
nPosY/1000.0,
|
pReviewResult->strJudgeType,
|
pReviewResult->strSizeType,
|
snapTime.GetYear(), snapTime.GetMonth(), snapTime.GetDay(),
|
snapTime.GetHour(), snapTime.GetMinute(), snapTime.GetSecond());
|
}
|
|
|
|
// strFileName.Format(_T("%s_%s_%s_%d_%d_%d_%s_%04d%02d%02d_%02d%02d%02d%03d"), m_strGlassID, m_strOperID, m_strEqpID, m_nReviewCount++,
|
// pReviewResult->nUMCenterOriginX, pReviewResult->nUMCenterOriginY, strDefectCodeTemp,
|
// snapTime.wYear, snapTime.wMonth, snapTime.wDay, snapTime.wHour, snapTime.wMinute, snapTime.wSecond, snapTime.wMilliseconds);
|
}
|
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.
|
pReviewResult->strEquipID;
|
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] : °í°´»ç ¿äû¿¡ ÀÇÇÑ bmp ÆÄÀÏ Ãß°¡ ÀúÀå. (Àӽûç¿ë)
|
pReviewResult->strOrignalImgFileName = strFileName + _T(".bmp");
|
|
strFileName += _T(".jpg");
|
pReviewResult->strUploadImgFileName = strFileName;
|
pReviewResult->strImgFileName = strFileName;
|
return TRUE;
|
}
|
|
// 181130 SJB, Add Wsi Reflow
|
void CReviewProcessor_CSOT_OFF::AddWsiReflowResultData( int nModuleIndex, const SWSIMeasureResult& 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 < WsiReflow_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); // 181203 SJB, Reflow Plan Info Àü¼Û
|
return;
|
|
RESULT_FAIL:
|
g_pLog->DisplayMessage(_T("[ReviewProcessor]WsiResult FAIL! module[%d] result[%d]"), nModuleIndex, measureResut.nResultIndex);
|
return;
|
}
|