#include "StdAfx.h"
|
#include "CHReviewPrioritySorter/PrioritySorter_CPJT.h"
|
#include <algorithm>
|
#include <vector>
|
|
using namespace std;
|
|
enum ProcessType { PROCESS_TYPE_REVIEW=0, PROCESS_TYPE_WSI };
|
|
CPrioritySorter_CPJT::CPrioritySorter_CPJT(int nMaxPointCount) : CPrioritySorter(nMaxPointCount)
|
{
|
m_vecDefectCount.clear();
|
m_vecDefectReviewCount.clear();
|
m_vecDefectReviewString.clear();
|
m_vecAreaDefectCount.clear();
|
m_vecAreaDefectReviewCount.clear();
|
m_vecAreaDefectReviewString.clear();
|
|
m_fPercent = 0;
|
}
|
|
CPrioritySorter_CPJT::~CPrioritySorter_CPJT(void)
|
{
|
|
}
|
|
int CPrioritySorter_CPJT::AddDefectPointPriority(int nPriorityData, const CRcpPriorityInfo *pRcpPriorityInfo)
|
{
|
return 1;
|
}
|
|
int CPrioritySorter_CPJT::PrioritySorting()
|
{
|
return 0;
|
}
|
|
int CPrioritySorter_CPJT::FilteringAndSorting()
|
{
|
if (m_pPS2P==NULL) return 0;
|
|
if (m_pGlassResult==NULL) return 0;
|
|
if (m_pRsRcpReviewInfo==NULL) return -1;
|
|
int nTotalPointCount = 0;
|
|
m_vecDefectCount.clear();
|
m_vecDefectReviewCount.clear();
|
m_vecDefectReviewString.clear();
|
|
m_vecAreaDefectCount.clear();
|
m_vecAreaDefectReviewCount.clear();
|
m_vecAreaDefectReviewString.clear();
|
|
// Total Plan
|
int nRcpPlanCount = m_pRsRcpReviewInfo->GetRcpPlanInfoCount();
|
for (int nPlanIdx=0; nPlanIdx<nRcpPlanCount; nPlanIdx++)
|
{
|
const CRcpPlanInfo *pPlanInfo = m_pRsRcpReviewInfo->GetRcpPlanInfo(nPlanIdx);
|
if (pPlanInfo==NULL) continue;
|
|
int nPointCount = 0;
|
|
switch(pPlanInfo->GetReviewType())
|
{
|
case REVIEW_PLAN_DEFECT:
|
nPointCount = AddReviewPoint();
|
break;
|
|
case REVIEW_PLAN_WSI:
|
nPointCount = AddWsiPoint();
|
break;
|
|
case REVIEW_PLAN_USER:
|
nPointCount = AddUserPoint();
|
break;
|
|
case REVIEW_PLAN_MEASURE:
|
nPointCount = AddMeasurePoint();
|
break;
|
|
case REVIEW_PLAN_REFLOW:
|
nPointCount = AddReflowPoint();
|
break;
|
|
case REVIEW_PLAN_WSI_REFLOW:
|
nPointCount = AddWsiReflowPoint();
|
break;
|
|
case REVIEW_PLAN_WSI_USER:
|
nPointCount = AddWsiUserPoint();
|
break;
|
case REVIEW_PLAN_WSI_MultiShot:
|
nPointCount = AddWsiMultiShotPoint();
|
break;
|
}
|
|
nTotalPointCount += nPointCount;
|
}
|
|
return nTotalPointCount;
|
}
|
|
int CPrioritySorter_CPJT::AddReviewPoint()
|
{
|
int nTotalPointCount = 0;
|
|
// review result clear
|
m_vecDefectResultPtr.clear();
|
|
//MapDefectRsult & pDefectResult Define
|
const MapDefectResult* pMapDefectResult = m_pGlassResult->GetMapDefectResult();
|
if (pMapDefectResult==NULL)
|
{
|
return nTotalPointCount;
|
}
|
CDefectResult* pDefectResult = NULL;
|
|
int nCount = m_pRsRcpReviewInfo->GetRcpPriorityInfoCount();
|
|
for (int nIdx=0; nIdx<nCount; nIdx++)
|
{
|
const CRcpPriorityInfo *pPriorityInfo = m_pRsRcpReviewInfo->GetRcpPriorityInfo(nIdx);
|
if (pPriorityInfo==NULL) continue;
|
|
for(constMapDefectResultIt it=pMapDefectResult->begin();it!=pMapDefectResult->end();it++)
|
{
|
//pDefectResult´Â MapDefectResult<int,CDefectResult>¿¡¼ 2¹øÂ° °ª
|
pDefectResult = static_cast<CDefectResult*>(it->second);
|
if(pDefectResult == NULL || pDefectResult->bReviewAdded==TRUE) continue;
|
|
if(pDefectResult->nDefectCode ==2) continue; //°í°´»ç ¿äû»çÇ× 190609 chm Crack ¾ÈÂï±â
|
|
if(pPriorityInfo->GetPriorityDefectSizeOption())
|
{
|
// Size Check
|
if(pPriorityInfo->GetPriorityDefectMinSize() > pDefectResult->nAOISize || pPriorityInfo->GetPriorityDefectMaxSize() < pDefectResult->nAOISize)
|
continue;
|
}
|
|
// check priority
|
if (CheckReviewPriority(pPriorityInfo, pDefectResult) == FALSE) continue;
|
|
pDefectResult->nSortSection = nIdx;
|
m_vecDefectResultPtrTemp.push_back(pDefectResult);
|
|
pDefectResult->bReviewAdded = TRUE;
|
|
nTotalPointCount++;
|
}
|
|
const CRcpSortingInfo *pSortingInfo = m_pRsRcpReviewInfo->GetRcpReviewSortInfo();
|
|
if (pSortingInfo)
|
{
|
//SIZE
|
if (pSortingInfo->m_nSortType == RCP_SORT_TYPE_SIZE)
|
{
|
//DEC
|
if (pSortingInfo->m_nSortData == RCP_SORT_DATA_ORDER_DECEND)
|
{
|
std::sort(m_vecDefectResultPtrTemp.begin(), m_vecDefectResultPtrTemp.end(), CompareDefectSizeDescending);
|
}
|
else if (pSortingInfo->m_nSortData == RCP_SORT_DATA_ORDER_ASCEND)
|
{
|
std::sort(m_vecDefectResultPtrTemp.begin(), m_vecDefectResultPtrTemp.end(), CompareDefectSizeAscending);
|
}
|
}
|
else if (pSortingInfo->m_nSortType == RCP_SORT_TYPE_PEAK)
|
{
|
if (pSortingInfo->m_nSortData == RCP_SORT_DATA_ORDER_DECEND)
|
{
|
std::sort(m_vecDefectResultPtrTemp.begin(), m_vecDefectResultPtrTemp.end(), CompareDefectPeakDescending);
|
}
|
else if (pSortingInfo->m_nSortData == RCP_SORT_DATA_ORDER_ASCEND)
|
{
|
std::sort(m_vecDefectResultPtrTemp.begin(), m_vecDefectResultPtrTemp.end(), CompareDefectPeakAscending);
|
}
|
}
|
}
|
|
for(int i=0;i<m_vecDefectResultPtrTemp.size();i++)
|
{
|
m_vecDefectResultPtr.push_back(m_vecDefectResultPtrTemp[i]);
|
}
|
m_vecDefectResultPtrTemp.clear();
|
}
|
|
// °áÇÔ ¿ì¼±¼øÀ§ Á¤·Ä°á°ú Ãâ·Â
|
CString strFilename = _T("");
|
//strFilename.Format(_T("C:\\Users\\dit-344\\Desktop\\testfile\\Sorting_Review.csv"));
|
strFilename.Format(_T("D:\\Sorting_Review.csv"));
|
SaveDefectPoint(m_vecDefectResultPtr, strFilename);
|
|
// °á°ú ¸¸µé±â
|
return AddReviewDefectResult();
|
}
|
|
int CPrioritySorter_CPJT::AddWsiPoint()
|
{
|
int nTotalPointCount = 0;
|
|
// wsi result clear
|
m_vecDefectResultPtr.clear();
|
|
//MapDefectRsult & pDefectResult Define
|
const MapDefectResult* pMapDefectResult = m_pGlassResult->GetMapDefectResult();
|
if (pMapDefectResult==NULL)
|
{
|
return nTotalPointCount;
|
}
|
CDefectResult* pDefectResult = NULL;
|
const CRcpSortingInfo* pSortingInfo = m_pRsRcpReviewInfo->GetRcpWSISortInfo();
|
if (pSortingInfo == NULL) return FALSE;
|
|
int nCount = m_pRsRcpReviewInfo->GetRcpWsiPriorityInfoCount();
|
|
VectorDefectResultPtr vecDefectResultPtrTemp1;
|
VectorDefectResultPtr vecDefectResultPtrTemp2;
|
|
for (int nIdx=0; nIdx<nCount; nIdx++)
|
{
|
const CRcpPriorityInfo *pPriorityInfo = m_pRsRcpReviewInfo->GetRcpWsiPriorityInfo(nIdx);
|
if (pPriorityInfo==NULL) continue;
|
|
for(constMapDefectResultIt it=pMapDefectResult->begin();it!=pMapDefectResult->end();it++)
|
{
|
//pDefectResult´Â MapDefectResult<int,CDefectResult>¿¡¼ 2¹øÂ° °ª
|
pDefectResult = static_cast<CDefectResult*>(it->second);
|
if(pDefectResult == NULL) continue;
|
|
if(pDefectResult->nDefectCode == 2)continue; //°í°´»ç ¿äû»çÇ× 190609 chm Crack ¾ÈÂï±â
|
|
//if(pDefectResult->nLocation == DefectLoc_ASG || pDefectResult->nLocation == DefectLoc_PAD || pDefectResult->nLocation == DefectLoc_C2C) continue;
|
|
// Size Check
|
if(pPriorityInfo->GetPriorityDefectSizeOption())
|
{
|
if(pPriorityInfo->GetPriorityDefectMinSize() > pDefectResult->nAOISize || pPriorityInfo->GetPriorityDefectMaxSize() < pDefectResult->nAOISize)
|
continue;
|
}
|
|
// check priority
|
if (CheckWsiPriority(pPriorityInfo, pDefectResult) == FALSE) continue;
|
|
pDefectResult->nSortSection = nIdx;
|
m_vecDefectResultPtrTemp.push_back(pDefectResult);
|
nTotalPointCount++;
|
}
|
|
const CRcpSortingInfo *pSortingInfo = m_pRsRcpReviewInfo->GetRcpWSISortInfo();
|
|
if (pSortingInfo)
|
{
|
//SIZE
|
if (pSortingInfo->m_nSortType == RCP_SORT_TYPE_SIZE)
|
{
|
//DEC
|
if (pSortingInfo->m_nSortData == RCP_SORT_DATA_ORDER_DECEND)
|
{
|
std::sort(m_vecDefectResultPtrTemp.begin(), m_vecDefectResultPtrTemp.end(), CompareDefectSizeDescending);
|
}
|
else if (pSortingInfo->m_nSortData == RCP_SORT_DATA_ORDER_ASCEND)
|
{
|
std::sort(m_vecDefectResultPtrTemp.begin(), m_vecDefectResultPtrTemp.end(), CompareDefectSizeAscending);
|
}
|
}
|
else if (pSortingInfo->m_nSortType == RCP_SORT_TYPE_PEAK)
|
{
|
if (pSortingInfo->m_nSortData == RCP_SORT_DATA_ORDER_DECEND)
|
{
|
std::sort(m_vecDefectResultPtrTemp.begin(), m_vecDefectResultPtrTemp.end(), CompareDefectPeakDescending);
|
}
|
else if (pSortingInfo->m_nSortData == RCP_SORT_DATA_ORDER_ASCEND)
|
{
|
std::sort(m_vecDefectResultPtrTemp.begin(), m_vecDefectResultPtrTemp.end(), CompareDefectPeakAscending);
|
}
|
}
|
}
|
|
for(int i=0;i<m_vecDefectResultPtrTemp.size();i++)
|
{
|
m_vecDefectResultPtr.push_back(m_vecDefectResultPtrTemp[i]);
|
}
|
|
m_vecDefectResultPtrTemp.clear();
|
}
|
|
// °áÇÔ ¿ì¼±¼øÀ§ Á¤·Ä°á°ú Ãâ·Â
|
CString strFilename = _T("");
|
// strFilename.Format(_T("D:\\Sorting_Wsi_temp1.csv"));
|
// SaveDefectPoint(vecDefectResultPtrTemp1, strFilename);
|
|
// strFilename.Format(_T("D:\\Sorting_Wsi_temp2.csv"));
|
// SaveDefectPoint(vecDefectResultPtrTemp2, strFilename);
|
|
// strFilename.Format(_T("D:\\Sorting_Wsi.csv"));
|
// SaveDefectPoint(m_vecDefectResultPtr, strFilename);
|
|
// °á°ú ¸¸µé±â..
|
return AddWsiDefectResult();
|
}
|
|
int CPrioritySorter_CPJT::AddUserPoint()
|
{
|
if(m_pGlassResult == NULL) return 0;
|
|
CString strGlassLasteName = m_pGlassResult->m_strGlassLastName;
|
|
int nTotalCount = 0;
|
SReviewResult sResult;
|
int nPointCount = m_pRsRcpReviewInfo->GetRcpUserDefectInfoCount();
|
for (int nPointIdx=0; nPointIdx<nPointCount; nPointIdx++)
|
{
|
const CRcpUserDefectInfo *pDefectInfo = m_pRsRcpReviewInfo->GetRcpUserDefectInfo(nPointIdx);
|
if (pDefectInfo==NULL) continue;
|
|
if(pDefectInfo->GetInspectionMode()!=4) continue;
|
|
sResult.Reset();
|
|
sResult.nDefectIdx = pDefectInfo->m_nSharedDefectIndex;
|
|
sResult.nUMOriginX = int(pDefectInfo->GetPosX() * 1000.0);
|
sResult.nUMOriginY = int(pDefectInfo->GetPosY() * 1000.0);
|
|
sResult.nReviewType = ReviewType_User;
|
sResult.nModuleIdx = -1;
|
sResult.nResultIdx = nTotalCount;
|
|
sResult.nZoomIdx = -1;
|
sResult.dMagnification = 1.0;
|
sResult.dMeasureResolution = 1.0;
|
sResult.bDigitalZoom = FALSE;
|
|
if(strGlassLasteName.Compare(_T("B")) == 0 || strGlassLasteName.Compare(_T("b")) == 0) sResult.strCellID = pDefectInfo->m_strCellId2;
|
else sResult.strCellID = pDefectInfo->m_strCellId;
|
|
sResult.nReflow_Side = pDefectInfo->m_nCellSide;
|
sResult.nInspectionMode = pDefectInfo->m_nInspectionMode;
|
|
|
m_vecSortingResultUser.push_back(sResult);
|
|
nTotalCount++;
|
}
|
|
return nTotalCount;
|
}
|
|
int CPrioritySorter_CPJT::AddReflowPoint()
|
{
|
if(m_pGlassResult == NULL) return 0;
|
|
CString strGlassLasteName = m_pGlassResult->m_strGlassLastName;
|
|
int nTotalCount = 0;
|
SReviewResult sResult;
|
int nPointCount = m_pRsRcpReviewInfo->GetRcpUserDefectInfoCount();
|
for (int nPointIdx=0; nPointIdx<nPointCount; nPointIdx++)
|
{
|
const CRcpUserDefectInfo *pDefectInfo = m_pRsRcpReviewInfo->GetRcpUserDefectInfo(nPointIdx);
|
if (pDefectInfo==NULL) continue;
|
if (pDefectInfo->m_nInspectionMode != 0) continue; // _T("WSI") ÀÏ °æ¿ì continue 20181218 smok
|
|
sResult.Reset();
|
|
sResult.nDefectIdx = pDefectInfo->m_nSharedDefectIndex;
|
|
sResult.nUMOriginX = int(pDefectInfo->GetPosX() * 1000.0);
|
sResult.nUMOriginY = int(pDefectInfo->GetPosY() * 1000.0);
|
|
sResult.nReviewType = ReviewType_Reflow;
|
sResult.nModuleIdx = -1;
|
sResult.nResultIdx = nTotalCount;
|
|
sResult.nZoomIdx = -1;
|
sResult.dMagnification = 1.0;
|
sResult.dMeasureResolution = 1.0;
|
sResult.bDigitalZoom = FALSE;
|
|
if(strGlassLasteName.Compare(_T("B")) == 0 || strGlassLasteName.Compare(_T("b")) == 0) sResult.strCellID = pDefectInfo->m_strCellId2;
|
else sResult.strCellID = pDefectInfo->m_strCellId;
|
|
sResult.nReflow_Side = pDefectInfo->m_nCellSide;
|
sResult.nInspectionMode = pDefectInfo->m_nInspectionMode;
|
|
|
m_vecSortingResultReflow.push_back(sResult);
|
|
nTotalCount++;
|
}
|
|
return nTotalCount;
|
}
|
|
int CPrioritySorter_CPJT::AddMeasurePoint()
|
{
|
int nTotalCount = 0;
|
SReviewResult sResult;
|
int nPointCount = m_pRsRcpMeasureInfo->GetRcpMeasureInfoCount();
|
|
for (int nPointIdx=0; nPointIdx<nPointCount; nPointIdx++)
|
{
|
const CRcpMeasureInfo *pInfo = m_pRsRcpMeasureInfo->GetRcpMeasureInfo(nPointIdx);
|
if (pInfo==NULL) continue;
|
|
sResult.Reset();
|
|
|
sResult.nReviewType = ReviewType_Measure;
|
sResult.nUMOriginX = int(pInfo->GetPosX() * 1000.0);
|
sResult.nUMOriginY = int(pInfo->GetPosY() * 1000.0);
|
|
|
sResult.nModuleIdx = pInfo->GetModuleIdx();
|
sResult.nResultIdx = pInfo->GetResultIdx();
|
|
sResult.nMeasure_RecipeIndex = pInfo->GetMeasureModelIdx();
|
sResult.nZoomIdx = pInfo->GetMagnificationIdx();
|
|
sResult.dMagnification = 1.0;
|
sResult.dMeasureResolution = 1.0;
|
sResult.bDigitalZoom = FALSE;
|
|
sResult.strCellID = _T(""); // cell id add
|
|
m_vecSortingResultMeasure.push_back(sResult);
|
|
nTotalCount++;
|
}
|
|
return nTotalCount;
|
}
|
|
int CPrioritySorter_CPJT::AddWsiReflowPoint()
|
{
|
if(m_pGlassResult == NULL) return 0;
|
|
CString strGlassLasteName = m_pGlassResult->m_strGlassLastName;
|
|
int nTotalCount = 0;
|
SReviewResult sResult;
|
int nPointCount = m_pRsRcpReviewInfo->GetRcpUserDefectInfoCount();
|
for (int nPointIdx=0; nPointIdx<nPointCount; nPointIdx++)
|
{
|
const CRcpUserDefectInfo *pInfo = m_pRsRcpReviewInfo->GetRcpUserDefectInfo(nPointIdx);
|
if (pInfo==NULL) continue;
|
if (pInfo->m_nInspectionMode != 1) continue; // _T("REVIEW") ÀÏ °æ¿ì continue 20181218 smok
|
|
sResult.Reset();
|
|
sResult.nReviewType = ReviewType_WsiReflow;
|
|
sResult.nDefectIdx = pInfo->m_nSharedDefectIndex;
|
|
sResult.nUMOriginX = int(pInfo->GetPosX() * 1000.0);
|
sResult.nUMOriginY = int(pInfo->GetPosY() * 1000.0);
|
|
sResult.nModuleIdx = -1;
|
sResult.nResultIdx = nTotalCount;
|
|
sResult.nMeasure_RecipeIndex = 0; //pInfo->GetMeasureModelIdx();
|
sResult.nZoomIdx = 0; //pInfo->GetMagnificationIdx();
|
|
sResult.dMagnification = 20.0;
|
sResult.dMeasureResolution = 1.0;
|
sResult.bDigitalZoom = FALSE;
|
|
if(strGlassLasteName.Compare(_T("B")) == 0 || strGlassLasteName.Compare(_T("b")) == 0) sResult.strCellID = pInfo->m_strCellId2;
|
else sResult.strCellID = pInfo->m_strCellId;
|
|
sResult.nReflow_Side = pInfo->m_nCellSide;
|
sResult.nInspectionMode = pInfo->m_nInspectionMode;
|
|
|
m_vecSortingResultWsiReflow.push_back(sResult);
|
|
nTotalCount++;
|
}
|
|
return nTotalCount;
|
}
|
|
|
int CPrioritySorter_CPJT::AddWsiUserPoint()
|
{
|
if(m_pGlassResult == NULL) return 0;
|
|
CString strGlassLasteName = m_pGlassResult->m_strGlassLastName;
|
|
int nTotalCount = 0;
|
SReviewResult sResult;
|
int nPointCount = m_pRsRcpReviewInfo->GetRcpUserDefectInfoCount();
|
for (int nPointIdx=0; nPointIdx<nPointCount; nPointIdx++)
|
{
|
const CRcpUserDefectInfo *pInfo = m_pRsRcpReviewInfo->GetRcpUserDefectInfo(nPointIdx);
|
if (pInfo==NULL) continue;
|
if (pInfo->m_nInspectionMode != 3) continue;
|
|
sResult.Reset();
|
|
sResult.nDefectIdx = pInfo->m_nSharedDefectIndex;
|
|
sResult.nReviewType = ReviewType_WsiUser;
|
sResult.nUMOriginX = int(pInfo->GetPosX() * 1000.0);
|
sResult.nUMOriginY = int(pInfo->GetPosY() * 1000.0);
|
|
sResult.nModuleIdx = -1;
|
sResult.nResultIdx = nTotalCount;
|
|
sResult.nMeasure_RecipeIndex = 0; //pInfo->GetMeasureModelIdx();
|
sResult.nZoomIdx = 0; //pInfo->GetMagnificationIdx();
|
|
sResult.dMagnification = 20.0;
|
sResult.dMeasureResolution = 1.0;
|
sResult.bDigitalZoom = FALSE;
|
|
if(strGlassLasteName.Compare(_T("B")) == 0 || strGlassLasteName.Compare(_T("b")) == 0) sResult.strCellID = pInfo->m_strCellId2;
|
else sResult.strCellID = pInfo->m_strCellId;
|
|
sResult.nReflow_Side = pInfo->m_nCellSide;
|
sResult.nInspectionMode = pInfo->m_nInspectionMode;
|
|
|
m_vecSortingResultWsiUser.push_back(sResult);
|
|
nTotalCount++;
|
}
|
|
return nTotalCount;
|
}
|
|
|
int CPrioritySorter_CPJT::AddReviewDefectResult(int nModuleIdx)
|
{
|
int nResultIdx = 0;
|
SReviewResult sResult;
|
CDefectResult *pDefectResult = NULL;
|
for (VectorDetectResultPrtIt it=m_vecDefectResultPtr.begin(); it!=m_vecDefectResultPtr.end(); it++)
|
{
|
pDefectResult = static_cast<CDefectResult*>(*it);
|
if(pDefectResult == NULL) continue;
|
|
// clear review result
|
sResult.Reset();
|
|
// set defect result
|
*(dynamic_cast<CDefectResult*>(&sResult)) = *pDefectResult;
|
|
sResult.nReviewType = ReviewType_Review;
|
sResult.nModuleIdx = nModuleIdx;
|
sResult.nResultIdx = nResultIdx++;
|
|
sResult.nZoomIdx = -1;
|
sResult.dMagnification = 1.0;
|
sResult.dMeasureResolution = 1.0;
|
sResult.bDigitalZoom = FALSE;
|
|
m_vecSortingResult.push_back(sResult);
|
}
|
|
return int(m_vecSortingResult.size());
|
}
|
|
int CPrioritySorter_CPJT::AddWsiDefectResult(int nModuleIdx)
|
{
|
int nResultIdx = 0;
|
SReviewResult sResult;
|
CDefectResult *pDefectResult = NULL;
|
for (VectorDetectResultPrtIt it=m_vecDefectResultPtr.begin(); it!=m_vecDefectResultPtr.end(); it++)
|
{
|
pDefectResult = static_cast<CDefectResult*>(*it);
|
if(pDefectResult == NULL) continue;
|
|
// clear review result
|
sResult.Reset();
|
|
// set defect result
|
*(dynamic_cast<CDefectResult*>(&sResult)) = *pDefectResult;
|
|
sResult.nReviewType = ReviewType_Wsi;
|
sResult.nModuleIdx = nModuleIdx;
|
sResult.nResultIdx = nResultIdx++;
|
|
m_vecSortingResultWsi.push_back(sResult);
|
}
|
|
return 1;
|
}
|
|
int CPrioritySorter_CPJT::AddWsiMultishotDefectResult(int nModuleIdx /*= -1*/)
|
{
|
int nResultIdx = 0;
|
SReviewResult sResult;
|
CDefectResult *pDefectResult = NULL;
|
for (VectorDetectResultPrtIt it = m_vecDefectResultPtr.begin(); it != m_vecDefectResultPtr.end(); it++)
|
{
|
pDefectResult = static_cast<CDefectResult*>(*it);
|
if (pDefectResult == NULL) continue;
|
|
// clear review result
|
sResult.Reset();
|
|
// set defect result
|
*(dynamic_cast<CDefectResult*>(&sResult)) = *pDefectResult;
|
|
sResult.nReviewType = ReviewType_Wsi_MultiShot;
|
sResult.nModuleIdx = nModuleIdx;
|
sResult.nResultIdx = nResultIdx++;
|
|
m_vecSortingResultWsiMultiShot.push_back(sResult);
|
}
|
|
return 1;
|
}
|
|
BOOL CPrioritySorter_CPJT::CheckReviewPriority(const CRcpPriorityInfo* pPriorityInfo, CDefectResult* pDefectResult)
|
{
|
if (pPriorityInfo==NULL || pDefectResult==NULL) return FALSE;
|
|
// check Type
|
if (pPriorityInfo->GetPriorityOpticData() != RCP_PRIORITY_ORDER_OPTIC_ALL)
|
{
|
if (pDefectResult->nDefectCode != pPriorityInfo->GetPriorityOpticData()) return FALSE;
|
}
|
|
if (pPriorityInfo->GetPriorityGradeData() != RCP_PRIORITY_Judge_ALL)
|
{
|
if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_OK)
|
{
|
if (pDefectResult->nJudgeType != 0) { return FALSE; }
|
}
|
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_RP)
|
{
|
if (pDefectResult->nJudgeType != 1) { return FALSE; }
|
}
|
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_NG)
|
{
|
if (pDefectResult->nJudgeType != 2) { return FALSE; }
|
}
|
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_TR)
|
{
|
if (pDefectResult->nJudgeType != 3) { return FALSE; }
|
}
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_PR)
|
{
|
if (pDefectResult->nJudgeType != 4) { return FALSE; }
|
}
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_PT)
|
{
|
if (pDefectResult->nJudgeType != 5) { return FALSE; }
|
}
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_Review)
|
{
|
if (pDefectResult->nJudgeType != 6) { return FALSE; }
|
}
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_RC)
|
{
|
if (pDefectResult->nJudgeType != 7) { return FALSE; }
|
}
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_Size)
|
{
|
if (pDefectResult->nJudgeType != 8) { return FALSE; }
|
}
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_VI)
|
{
|
if (pDefectResult->nJudgeType != 9) { return FALSE; }
|
}
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_Rework)
|
{
|
if (pDefectResult->nJudgeType != 10) { return FALSE; }
|
}
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_Unknown)
|
{
|
if (pDefectResult->nJudgeType != 11) { return FALSE; }
|
}
|
|
}
|
//RCP_PRIORITY_ORDER_ALL,RCP_PRIORITY_ORDER_NONE_STACK,RCP_PRIORITY_ORDER_STACK
|
|
// check Stack
|
if (pPriorityInfo->GetPriorityStackData() != CSOT_RCP_PRIORITY_ORDER_ALL)
|
{
|
if(pPriorityInfo->GetPriorityStackData()==RCP_PRIORITY_STACK_TD)
|
{
|
if(pDefectResult->nStackType != 1 ){return FALSE;}
|
}
|
else if(pPriorityInfo->GetPriorityStackData() == RCP_PRIORITY_STACK_SD)
|
{
|
if(pDefectResult->nStackType != 2 ){return FALSE;}
|
}
|
else if(pPriorityInfo->GetPriorityStackData()== RCP_PRIORITY_STACK_PD)
|
{
|
if(pDefectResult->nStackType != 3 ){return FALSE;}
|
}
|
else if (pPriorityInfo->GetPriorityStackData() == RCP_PRIORITY_STACK_SP)
|
{
|
if (pDefectResult->nStackType != 4) { return FALSE; }
|
}
|
}
|
|
// check Gray
|
if (pPriorityInfo->GetPriorityGrayData() != RCP_PRIORITY_ORDER_GRAY_ALL)
|
{
|
if (pDefectResult->nDefectWBType != pPriorityInfo->GetPriorityGrayData()) return FALSE;
|
}
|
|
|
if (pPriorityInfo->GetPriorityModelData() != RCP_PRIORITY_MODEL_TYPE_ALL)
|
{
|
|
if (pPriorityInfo->GetPriorityModelData() < 0)return FALSE;
|
|
//·¹½ÃÇÇ À妽º Model0 -> 1 ±×·¡¼ -1
|
if (pDefectResult->nMultiModel != pPriorityInfo->GetPriorityModelData() - 1)return FALSE;
|
|
}
|
|
|
return TRUE;
|
}
|
|
// 190131 SJB, WSI Priority
|
BOOL CPrioritySorter_CPJT::CheckWsiPriority(const CRcpPriorityInfo* pPriorityInfo, CDefectResult* pDefectResult)
|
{
|
if (pPriorityInfo==NULL || pDefectResult==NULL) return FALSE;
|
|
// check Type
|
if (pPriorityInfo->GetPriorityOpticData() != RCP_PRIORITY_ORDER_OPTIC_ALL)
|
{
|
if (pDefectResult->nDefectCode != pPriorityInfo->GetPriorityOpticData()) return FALSE;
|
}
|
|
if (pPriorityInfo->GetPriorityGradeData() != RCP_PRIORITY_Judge_ALL)
|
{
|
if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_OK)
|
{
|
if (pDefectResult->nJudgeType != 0) { return FALSE; }
|
}
|
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_RP)
|
{
|
if (pDefectResult->nJudgeType != 1) { return FALSE; }
|
}
|
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_NG)
|
{
|
if (pDefectResult->nJudgeType != 2) { return FALSE; }
|
}
|
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_TR)
|
{
|
if (pDefectResult->nJudgeType != 3) { return FALSE; }
|
}
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_PR)
|
{
|
if (pDefectResult->nJudgeType != 4) { return FALSE; }
|
}
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_PT)
|
{
|
if (pDefectResult->nJudgeType != 5) { return FALSE; }
|
}
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_Review)
|
{
|
if (pDefectResult->nJudgeType != 6) { return FALSE; }
|
}
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_RC)
|
{
|
if (pDefectResult->nJudgeType != 7) { return FALSE; }
|
}
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_Size)
|
{
|
if (pDefectResult->nJudgeType != 8) { return FALSE; }
|
}
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_VI)
|
{
|
if (pDefectResult->nJudgeType != 9) { return FALSE; }
|
}
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_Rework)
|
{
|
if (pDefectResult->nJudgeType != 10) { return FALSE; }
|
}
|
else if (pPriorityInfo->GetPriorityGradeData() == RCP_PRIORITY_Judge_Unknown)
|
{
|
if (pDefectResult->nJudgeType != 11) { return FALSE; }
|
}
|
|
}
|
|
//RCP_PRIORITY_ORDER_ALL,RCP_PRIORITY_ORDER_NONE_STACK,RCP_PRIORITY_ORDER_STACK
|
// check Stack
|
if (pPriorityInfo->GetPriorityStackData() != CSOT_RCP_PRIORITY_ORDER_ALL)
|
{
|
if (pPriorityInfo->GetPriorityStackData() == RCP_PRIORITY_STACK_TD)
|
{
|
if (pDefectResult->nStackType != 1) { return FALSE; }
|
}
|
else if (pPriorityInfo->GetPriorityStackData() == RCP_PRIORITY_STACK_SD)
|
{
|
if (pDefectResult->nStackType != 2) { return FALSE; }
|
}
|
else if (pPriorityInfo->GetPriorityStackData() == RCP_PRIORITY_STACK_PD)
|
{
|
if (pDefectResult->nStackType != 3) { return FALSE; }
|
}
|
else if (pPriorityInfo->GetPriorityStackData() == RCP_PRIORITY_STACK_SP)
|
{
|
if (pDefectResult->nStackType != 4) { return FALSE; }
|
}
|
}
|
|
// check Gray
|
if (pPriorityInfo->GetPriorityGrayData() != RCP_PRIORITY_ORDER_GRAY_ALL)
|
{
|
if (pDefectResult->nDefectWBType != pPriorityInfo->GetPriorityGrayData()) return FALSE;
|
}
|
|
if (pPriorityInfo->GetPriorityModelData() != RCP_PRIORITY_MODEL_TYPE_ALL)
|
{
|
|
if (pPriorityInfo->GetPriorityModelData() < 0)return FALSE;
|
|
//·¹½ÃÇÇ À妽º Model0 -> 1 ±×·¡¼ -1
|
if (pDefectResult->nMultiModel != pPriorityInfo->GetPriorityModelData()-1)return FALSE;
|
|
}
|
|
|
|
return TRUE;
|
}
|
|
int CPrioritySorter_CPJT::AddWsiMultiShotPoint()
|
{
|
int nTotalPointCount = 0;
|
|
// wsi result clear
|
m_vecDefectResultPtr.clear();
|
|
//MapDefectRsult & pDefectResult Define
|
const MapDefectResult* pMapDefectResult = m_pGlassResult->GetMapDefectResult();
|
if (pMapDefectResult == NULL)
|
{
|
return nTotalPointCount;
|
}
|
CDefectResult* pDefectResult = NULL;
|
const CRcpSortingInfo* pSortingInfo = m_pRsRcpReviewInfo->GetRcpWSISortInfo(); //WSI °¡Á®´Ù ¾²±â
|
if (pSortingInfo == NULL) return FALSE;
|
|
int nCount = m_pRsRcpReviewInfo->GetRcpWsiPriorityInfoCount();
|
|
VectorDefectResultPtr vecDefectResultPtrTemp1;
|
VectorDefectResultPtr vecDefectResultPtrTemp2;
|
|
for (int nIdx = 0; nIdx < nCount; nIdx++)
|
{
|
const CRcpPriorityInfo *pPriorityInfo = m_pRsRcpReviewInfo->GetRcpWsiPriorityInfo(nIdx);
|
if (pPriorityInfo == NULL) continue;
|
|
for (constMapDefectResultIt it = pMapDefectResult->begin(); it != pMapDefectResult->end(); it++)
|
{
|
//pDefectResult´Â MapDefectResult<int,CDefectResult>¿¡¼ 2¹øÂ° °ª
|
pDefectResult = static_cast<CDefectResult*>(it->second);
|
if (pDefectResult == NULL) continue;
|
|
if (pDefectResult->nDefectCode == 2)continue; //°í°´»ç ¿äû»çÇ× 190609 chm Crack ¾ÈÂï±â
|
|
//if (pDefectResult->nLocation == DefectLoc_ASG || pDefectResult->nLocation == DefectLoc_PAD || pDefectResult->nLocation == DefectLoc_C2C) continue;
|
|
// Size Check
|
if (pPriorityInfo->GetPriorityDefectSizeOption())
|
{
|
if (pPriorityInfo->GetPriorityDefectMinSize() > pDefectResult->nAOISize || pPriorityInfo->GetPriorityDefectMaxSize() < pDefectResult->nAOISize)
|
continue;
|
}
|
|
// check priority
|
if (CheckWsiPriority(pPriorityInfo, pDefectResult) == FALSE) continue;
|
|
pDefectResult->nSortSection = nIdx;
|
m_vecDefectResultPtrTemp.push_back(pDefectResult);
|
nTotalPointCount++;
|
}
|
|
const CRcpSortingInfo *pSortingInfo = m_pRsRcpReviewInfo->GetRcpWSISortInfo();
|
|
if (pSortingInfo)
|
{
|
//SIZE
|
if (pSortingInfo->m_nSortType == RCP_SORT_TYPE_SIZE)
|
{
|
//DEC
|
if (pSortingInfo->m_nSortData == RCP_SORT_DATA_ORDER_DECEND)
|
{
|
std::sort(m_vecDefectResultPtrTemp.begin(), m_vecDefectResultPtrTemp.end(), CompareDefectSizeDescending);
|
}
|
else if (pSortingInfo->m_nSortData == RCP_SORT_DATA_ORDER_ASCEND)
|
{
|
std::sort(m_vecDefectResultPtrTemp.begin(), m_vecDefectResultPtrTemp.end(), CompareDefectSizeAscending);
|
}
|
}
|
else if (pSortingInfo->m_nSortType == RCP_SORT_TYPE_PEAK)
|
{
|
if (pSortingInfo->m_nSortData == RCP_SORT_DATA_ORDER_DECEND)
|
{
|
std::sort(m_vecDefectResultPtrTemp.begin(), m_vecDefectResultPtrTemp.end(), CompareDefectPeakDescending);
|
}
|
else if (pSortingInfo->m_nSortData == RCP_SORT_DATA_ORDER_ASCEND)
|
{
|
std::sort(m_vecDefectResultPtrTemp.begin(), m_vecDefectResultPtrTemp.end(), CompareDefectPeakAscending);
|
}
|
}
|
}
|
|
for (int i = 0; i < m_vecDefectResultPtrTemp.size(); i++)
|
{
|
m_vecDefectResultPtr.push_back(m_vecDefectResultPtrTemp[i]);
|
}
|
|
m_vecDefectResultPtrTemp.clear();
|
}
|
|
// °áÇÔ ¿ì¼±¼øÀ§ Á¤·Ä°á°ú Ãâ·Â
|
CString strFilename = _T("");
|
// strFilename.Format(_T("D:\\Sorting_Wsi_temp1.csv"));
|
// SaveDefectPoint(vecDefectResultPtrTemp1, strFilename);
|
|
// strFilename.Format(_T("D:\\Sorting_Wsi_temp2.csv"));
|
// SaveDefectPoint(vecDefectResultPtrTemp2, strFilename);
|
|
// strFilename.Format(_T("D:\\Sorting_Wsi.csv"));
|
// SaveDefectPoint(m_vecDefectResultPtr, strFilename);
|
|
// °á°ú ¸¸µé±â..
|
return AddWsiMultishotDefectResult();
|
}
|