From 1c0ac1c7924efb8a2cb6962d3eda4126533a5ac8 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期一, 14 七月 2025 16:55:55 +0800
Subject: [PATCH] 合并代码(代提交)

---
 ENRIT/View/ViewHWSetting.cpp            |    2 
 ENRIT/BICommon.h                        |    2 
 ENRIT/resource.h                        |    0 
 ENRIT/Process/InspectCamera.cpp         |   76 +++++++---
 ENRIT/Recipe/HardwareSettings.cpp       |   25 ++
 ENRIT/View/FrameImg.cpp                 |   19 ++
 ENRIT/Data/Glass_Data.h                 |    2 
 ENRIT/Data/PostProcess.cpp              |    6 
 ENRIT/ENRIT.rc                          |    0 
 ENRIT/Recipe/GlassRecipe.h              |    3 
 ENRIT/InterfaceManager.h                |    2 
 ENRIT/Data/Glass_Data.cpp               |    2 
 ENRIT/Data/History.h                    |    7 
 ENRIT/View/ViewHWSetting.h              |    2 
 ENRIT/View/ViewRecipeSetting.cpp        |    3 
 ENRIT/InterfaceManager.cpp              |  172 +++++++++++++++++++++++
 ENRIT/Grabber/SapLineGrab.cpp           |   35 ++--
 ENRIT/Recipe/HardwareSettings.h         |    4 
 ENRIT/UITool/DisplayMessage.h           |    2 
 ENRIT/View/ViewInsInformation.cpp       |    4 
 ENRIT/ENRIT.cpp                         |    2 
 ENRIT/View/FrameImg.h                   |    4 
 ENRIT/View/ViewRecipeInspectionView.cpp |    1 
 23 files changed, 298 insertions(+), 77 deletions(-)

diff --git a/ENRIT/BICommon.h b/ENRIT/BICommon.h
index c7fb138..8cd05b2 100644
--- a/ENRIT/BICommon.h
+++ b/ENRIT/BICommon.h
@@ -12,5 +12,5 @@
 
 #define OFFLINE_KEY           1   //OFFLINE_KEY:1鏄绾挎ā寮�;0鏄湪绾挎ā寮�
 #define PROHIBITED_LICENSE    0   //Prohibited license
-
+#define MARKIMG_NOTSAVE       0   // 涓嶄繚瀛業MG_MARK鏂囦欢澶圭殑鍥剧墖
 #endif
\ No newline at end of file
diff --git a/ENRIT/Data/Glass_Data.cpp b/ENRIT/Data/Glass_Data.cpp
index 196a7f8..28aa52f 100644
--- a/ENRIT/Data/Glass_Data.cpp
+++ b/ENRIT/Data/Glass_Data.cpp
@@ -60,7 +60,7 @@
 
 	ZeroMemory(m_EdgeResultInfo,sizeof(INS_EDGE_RESULT_INFO)*MAX_DIMENSION_COUNT);
 	m_stProfileResult.Reset();
-	ZeroMemory(m_nGlassResult,sizeof(short)*5);	
+	ZeroMemory(m_nGlassResult,sizeof(short) * 11);
 	m_ProfileInspectData.Reset();
 
 	ZeroMemory(m_nStageLongTheta,sizeof(short)*2);
diff --git a/ENRIT/Data/Glass_Data.h b/ENRIT/Data/Glass_Data.h
index 132da52..91579d9 100644
--- a/ENRIT/Data/Glass_Data.h
+++ b/ENRIT/Data/Glass_Data.h
@@ -371,7 +371,7 @@
 		
 	INS_EDGE_RESULT_INFO	m_EdgeResultInfo[MAX_DIMENSION_COUNT];
 	INS_PROFILE_RESULT_INFO	m_stProfileResult;
-	short					m_nGlassResult[5];
+	short					m_nGlassResult[11];
 	PROFILECHAMFER_RESULT_DATA	m_ProfileInspectData;
 	
 	BOOL					m_bScanEndCamera[MAX_CAMERA_COUNT][MAX_SCAN_COUNT];
diff --git a/ENRIT/Data/History.h b/ENRIT/Data/History.h
index 1b116ae..7e32255 100644
--- a/ENRIT/Data/History.h
+++ b/ENRIT/Data/History.h
@@ -12,8 +12,11 @@
 	int				nChipCount;
 	int				nChamferCount;
 	int				nBurrCount;
-	int				nUnknownCount;	
-	
+	int				nUnknownCount;
+	int				nProAlarmResultCountA;
+	int				nProAlarmResultCountB;
+	int				nProAlarmResultCountC;
+	int				nProAlarmResultCountD;
 	BOOL			bProfileJudge[MAX_PROFILE_SETTING_COUNT];
 	int				nProfileDiff[MAX_PROFILE_SETTING_COUNT];
 	BOOL			bChamferJudgeUp[MAX_PROFILE_SETTING_COUNT];
diff --git a/ENRIT/Data/PostProcess.cpp b/ENRIT/Data/PostProcess.cpp
index b3cbc6e..268826f 100644
--- a/ENRIT/Data/PostProcess.cpp
+++ b/ENRIT/Data/PostProcess.cpp
@@ -723,11 +723,9 @@
 				case DefectLoc_RCUTChip: str = _T("RCUTChip"); break;
 				}				
 
-				int			nDefectSize = pInsDefect->m_nDefectRScale;
 				strFile.Format(_T("%s\\%03d_%s_%s_%s.jpg"),m_strDefectFolder,pInsDefect->m_nGlassDefectIdx,g_pBase->m_strHPanelID,PANEL_SIDE[(DimensionDir)pDefect->m_nSideLoc],str);
 
-				CRect		rectDefect;
-
+				CRect rectDefect;
 				rectDefect.left = DEFECTIMAGE_WIDTH/2-pInsDefect->m_sPixelWidth/2;
 				rectDefect.right = DEFECTIMAGE_WIDTH/2+pInsDefect->m_sPixelWidth/2;
 				rectDefect.top = DEFECTIMAGE_HEIGHT/2-pInsDefect->m_sPixelHeight/2;
@@ -869,7 +867,7 @@
 			if(pDefect->m_DefectLoc == DefectLoc_Chamfer || pDefect->m_DefectLoc == DefectLoc_Profile)
 				continue;
 
-			if (pDefect->m_DefectLoc == DefectLoc_KDist || pDefect->m_DefectLoc == DefectLoc_RCUTChip)
+			if (pDefect->m_DefectLoc == DefectLoc_Hole || pDefect->m_DefectLoc == DefectLoc_KDist || pDefect->m_DefectLoc == DefectLoc_RCUTChip)
 				continue;
 			
 			rectOrg = pDefect->m_Defect.s_DefectRect;
diff --git a/ENRIT/ENRIT.cpp b/ENRIT/ENRIT.cpp
index 1c1e4b8..dea685f 100644
--- a/ENRIT/ENRIT.cpp
+++ b/ENRIT/ENRIT.cpp
@@ -105,7 +105,7 @@
 		dumpInfo.ClientPointers = TRUE;
 
 		// ?蹇慸ump鍐奸亗
-		BOOL success = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpWithFullMemory, &dumpInfo, NULL, NULL);
+		BOOL success = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpFilterMemory, &dumpInfo, NULL, NULL);
 		CloseHandle(hFile);
 
 		if (!success) {
diff --git a/ENRIT/ENRIT.rc b/ENRIT/ENRIT.rc
index 0d42b1b..492d6f5 100644
--- a/ENRIT/ENRIT.rc
+++ b/ENRIT/ENRIT.rc
Binary files differ
diff --git a/ENRIT/Grabber/SapLineGrab.cpp b/ENRIT/Grabber/SapLineGrab.cpp
index 12c03b4..a918dcb 100644
--- a/ENRIT/Grabber/SapLineGrab.cpp
+++ b/ENRIT/Grabber/SapLineGrab.cpp
@@ -39,16 +39,15 @@
 
 BOOL CSapLineGrab::CreateAcq(char *camFile)
 {
-	if (SapManager::Open() == FALSE)
-	{
-		g_pLog->DisplayMessage(_T("Error: SapManager::Open."));
+	if (SapManager::Open() == FALSE) {
+		//g_pLog->DisplayMessage(_T("Error: SapManager::Open."));
 		return FALSE;
 	}
 
 	// Get actual server count and ensure m_nBoardID is within range
 	int nCount = SapManager::GetServerCount(SapManager::ResourceAcq);
 	if (m_nBoardID < 0 || m_nBoardID >= nCount) {
-		g_pLog->DisplayMessage(_T("Error: Invalid Board ID. ServerCount=%d, nBoardID=%d"), nCount, m_nBoardID);
+		//g_pLog->DisplayMessage(_T("Error: Invalid Board ID. ServerCount=%d, nBoardID=%d"), nCount, m_nBoardID);
 		return FALSE;
 	}
 
@@ -59,7 +58,7 @@
 	SapLocation loc(serverName, 0);
 	nCount = SapManager::GetResourceCount(loc, SapManager::ResourceAcq);
 	if (nCount < 0) {
-		g_pLog->DisplayMessage(_T("Error: Invalid Resource Count. ResourceCount=%d, nBoardID=%d"), nCount, m_nBoardID);
+		//g_pLog->DisplayMessage(_T("Error: Invalid Resource Count. ResourceCount=%d, nBoardID=%d"), nCount, m_nBoardID);
 		return FALSE;
 	}
 
@@ -80,24 +79,24 @@
 
 		if (CreateAcq(m_Param.cDCFPath) == FALSE) {
 			if (pErrorCode) *pErrorCode = INITX64_FAIL_CREATEACQ;
-			g_pLog->DisplayMessage(_T("Error: CreateAcq fail."));
+			//g_pLog->DisplayMessage(_T("Error: CreateAcq fail."));
 			return FALSE;
 		}
 
 		if (CreateBuffer(0) == FALSE) {
 			if (pErrorCode) *pErrorCode = INITX64_FAIL_CREATEBUFFER;
-			g_pLog->DisplayMessage(_T("Error: CreateBuffer fail."));
+			//g_pLog->DisplayMessage(_T("Error: CreateBuffer fail."));
 			return FALSE;
 		}
 
 		if (ActivateObjects() == FALSE) {
 			if (pErrorCode) *pErrorCode = INITX64_FAIL_CREATEXFER;
-			g_pLog->DisplayMessage(_T("Error: ActivateObjects fail."));
+			//g_pLog->DisplayMessage(_T("Error: ActivateObjects fail."));
 			return FALSE;
 		}
 
 		if (m_pXfer->Connect() == FALSE) {
-			g_pLog->DisplayMessage(_T("Error: m_pXfer->Connect fail."));
+			//g_pLog->DisplayMessage(_T("Error: m_pXfer->Connect fail."));
 			return FALSE;
 		}
 
@@ -140,13 +139,11 @@
 
 	m_pFrameBuffer = new CFrameBufferController;
 
-	if(TRUE == m_pFrameBuffer->CreateBuffer(m_Param.nCameraIdx,nBufSizeX ,nBufSizeY,nBufSize, nScanCount))
-	{		
-		g_pLog->DisplayMessage(_T("Create Buffer success!:Id[%d],Frame[%d,%d],Cnt[%d]"),m_Param.nCameraIdx,nBufSizeX,nBufSizeY,nBufSize);		
+	if(TRUE == m_pFrameBuffer->CreateBuffer(m_Param.nCameraIdx,nBufSizeX ,nBufSizeY,nBufSize, nScanCount)) {		
+		//g_pLog->DisplayMessage(_T("Create Buffer success!:Id[%d],Frame[%d,%d],Cnt[%d]"),m_Param.nCameraIdx,nBufSizeX,nBufSizeY,nBufSize);		
 	}
-	else
-	{
-		g_pLog->DisplayMessage(_T("Create Buffer Fail!:Id[%d],Frame[%d,%d],Cnt[%d]"),m_Param.nCameraIdx,nBufSizeX,nBufSizeY,nBufSize);
+	else {
+		//g_pLog->DisplayMessage(_T("Create Buffer Fail!:Id[%d],Frame[%d,%d],Cnt[%d]"),m_Param.nCameraIdx,nBufSizeX,nBufSizeY,nBufSize);
 		return FALSE;
 	}
 
@@ -182,7 +179,7 @@
 	if (m_pSapAcq && !*m_pSapAcq) {
 		if (!m_pSapAcq->Create()) {
 			DestroyObjects();
-			g_pLog->DisplayMessage(_T("Error: m_pSapAcq->Create fail."));
+			//g_pLog->DisplayMessage(_T("Error: m_pSapAcq->Create fail."));
 			return FALSE;
 		}
 	}
@@ -190,7 +187,7 @@
 	if (m_pSapBuffers && !*m_pSapBuffers) {
 		if (!m_pSapBuffers->Create()) {
 			DestroyObjects();
-			g_pLog->DisplayMessage(_T("Error: m_pSapBuffers->Create fail."));
+			//g_pLog->DisplayMessage(_T("Error: m_pSapBuffers->Create fail."));
 			return FALSE;
 		}
 		m_pSapBuffers->Clear();
@@ -200,7 +197,7 @@
 		m_pXfer->SetAutoEmpty(TRUE);
 		if (!m_pXfer->Create()) {
 			DestroyObjects();
-			g_pLog->DisplayMessage(_T("Error: m_pXfer->Create fail."));
+			//g_pLog->DisplayMessage(_T("Error: m_pXfer->Create fail."));
 			return FALSE;
 		}
 	}
@@ -354,7 +351,7 @@
 	if(m_pFrameBuffer == NULL)
 		return;
 
-	int			nFrameCnt = m_pFrameBuffer->GetFrameCount();
+	int	nFrameCnt = m_pFrameBuffer->GetFrameCount();
 
 	m_nEndFrameIdx = nFrameCnt;
 	m_nSetBufferIdx = nFrameCnt -1;
diff --git a/ENRIT/InterfaceManager.cpp b/ENRIT/InterfaceManager.cpp
index 18bd626..7498f1f 100644
--- a/ENRIT/InterfaceManager.cpp
+++ b/ENRIT/InterfaceManager.cpp
@@ -638,7 +638,7 @@
 			if(pCamera == NULL)
 				continue;			
 
-			pBuffer = m_pInspect[iCam]->GetFullImgBuffer(iScan);			
+			pBuffer = m_pInspect[iCam]->GetFullImgBuffer(iScan);
 			if(pBuffer == NULL)
 				continue;			
 
@@ -654,11 +654,160 @@
 	g_pLog->DisplayMessage(_T("Full Image Save Completed : Time[%d]"),GetTickCount()-dwTick);
 }
 
+void CInterfaceManager::CoordProfileJudge(HISTORY_RESULT& pHistory)
+{
+	PROFILECHAMFER_RESULT_DATA* pProfileResult1 = m_GlassData.GetProfileInspectData();
+	pHistory.bResult = TRUE;
+	CINSPECT_JUDGEMENT_PARM* pJudges = m_GlassRecipe.GetJudgePrm();
+	NgInfo ngArray[3][NG_INF_TOTAL];
+	BlVision_GetSoftVisionApp()->Execute(4, ngArray[0]);
+	BlVision_GetSoftVisionApp()->Execute(5, ngArray[1]);
+	BlVision_GetSoftVisionApp()->Execute(7, ngArray[2]);
+	pHistory.nProAlarmResultCountB = 0;
+	pHistory.nProAlarmResultCountA = 0;
+	pHistory.nProAlarmResultCountD = 0;
+	pHistory.nProAlarmResultCountC = 0;
+	for (int i = 0; i < 3; i++)
+	{
+		/*A-BOT*/
+		if (i == 0)
+		{
+			for (int c = 33; c < 47; c++)
+			{
+				if (pProfileResult1->ProfileData[c].bUseJudge == 1)
+				{
+					if (pHistory.nProfileDiff[c] > pJudges->nMinProfileNgCount_MinDiff[4])
+					{
+						pHistory.bResult = FALSE;
+					}
+					if (pHistory.nProfileDiff[c] < -1 * pProfileResult1->ProfileData[c].nJudgeMinus || pHistory.nProfileDiff[c] > pProfileResult1->ProfileData[c].nJudgePlus)
+					{
+						pHistory.nProAlarmResultCountA += 1;
+					}
+
+				}
+			}
+			for (int z = 0; z < 50; z++)
+			{
+				if (ngArray[i][z].ngType == 5 && ngArray[i][z].id < 6)
+				{
+					if (ngArray[i][z].maxValue<ngArray[i][z].result || ngArray[i][z].minValue>ngArray[i][z].result)
+					{
+						pHistory.nProAlarmResultCountA += 1;
+						if (pHistory.nProAlarmResultCountA > pJudges->nMinProfileNgCount[4] || ngArray[i][z].result > pJudges->nMinProfileNgCount_MinDiff[4])
+							pHistory.bResult = FALSE;
+					}
+
+				}
+				if (ngArray[i][z].ngType == 5 && (5 < ngArray[i][z].id && ngArray[i][z].id < 11))
+				{
+					if (ngArray[i][z].maxValue<ngArray[i][z].result || ngArray[i][z].minValue>ngArray[i][z].result)
+					{
+						pHistory.nProAlarmResultCountA += 1;
+						if (pHistory.nProAlarmResultCountA > pJudges->nMinProfileNgCount[4] || ngArray[i][z].result > pJudges->nMinProfileNgCount_MinDiff[4])
+							pHistory.bResult = FALSE;
+					}
+
+				}
+			}
+
+		}
+		/*B-BOT*/
+		if (i == 1)
+		{
+			for (int c = 0; c < 10; c++)
+			{
+				if (pProfileResult1->ProfileData[c].bUseJudge == 1)
+				{
+					if (pHistory.nProfileDiff[c] > pJudges->nMinProfileNgCount_MinDiff[5])
+					{
+						pHistory.bResult = FALSE;
+					}
+					if (pHistory.nProfileDiff[c] < -1 * pProfileResult1->ProfileData[c].nJudgeMinus || pHistory.nProfileDiff[c] > pProfileResult1->ProfileData[c].nJudgePlus)
+					{
+						pHistory.nProAlarmResultCountB += 1;
+					}
+
+				}
+			}
+			for (int z = 0; z < 50; z++)
+			{
+				if (ngArray[i][z].ngType == 5 && ngArray[i][z].id < 6)
+				{
+					if (ngArray[i][z].maxValue<ngArray[i][z].result || ngArray[i][z].minValue>ngArray[i][z].result)
+					{
+						pHistory.nProAlarmResultCountB += 1;
+						if (pHistory.nProAlarmResultCountB > pJudges->nMinProfileNgCount[5] || ngArray[i][z].result > pJudges->nMinProfileNgCount_MinDiff[5])
+							pHistory.bResult = FALSE;
+					}
+
+				}
+
+			}
+
+		}
+		/*D-BOT*/
+		if (i == 2)
+		{
+			for (int c = 23; c < 33; c++)
+			{
+				if (pProfileResult1->ProfileData[c].bUseJudge == 1)
+				{
+					if (pHistory.nProfileDiff[c] > pJudges->nMinProfileNgCount_MinDiff[7])
+					{
+						pHistory.bResult = FALSE;
+					}
+					if (pHistory.nProfileDiff[c] < -1 * pProfileResult1->ProfileData[c].nJudgeMinus || pHistory.nProfileDiff[c] > pProfileResult1->ProfileData[c].nJudgePlus)
+					{
+						pHistory.nProAlarmResultCountD += 1;
+					}
+
+				}
+			}
+			for (int z = 0; z < 50; z++)
+			{
+				if (ngArray[i][z].ngType == 5 && ngArray[i][z].id < 6)
+				{
+					if (ngArray[i][z].maxValue<ngArray[i][z].result || ngArray[i][z].minValue>ngArray[i][z].result)
+					{
+						pHistory.nProAlarmResultCountD += 1;
+						if (pHistory.nProAlarmResultCountD > pJudges->nMinProfileNgCount[7] || ngArray[i][z].result > pJudges->nMinProfileNgCount_MinDiff[7])
+							pHistory.bResult = FALSE;
+					}
+				}
+
+			}
+
+
+
+		}
+	}
+	for (int i = 10; i < 23; i++)
+	{
+		if (pProfileResult1->ProfileData[i].bUseJudge == 1)
+		{
+
+			if (pHistory.nProfileDiff[i] < -1 * pProfileResult1->ProfileData[i].nJudgeMinus || pHistory.nProfileDiff[i] > pProfileResult1->ProfileData[i].nJudgePlus)
+			{
+				pHistory.nProAlarmResultCountC += 1;
+				if (pHistory.nProAlarmResultCountD > pJudges->nMinProfileNgCount[6] || pHistory.nProfileDiff[i] > pJudges->nMinProfileNgCount_MinDiff[6])
+					pHistory.bResult = FALSE;
+			}
+		}
+	}
+}
+
 void CInterfaceManager::WritePLCResult(HISTORY_RESULT &pHistory)
 {
 	short *pResult = m_GlassData.GetGlassResultInfo();
 	ZeroMemory(pResult,sizeof(short)*5);
-
+	
+	if (m_HardwareRecipe.GetCoordProfileUse() == 1)
+	{
+		CoordProfileJudge(pHistory);
+		if (pHistory.nDefectCnt- (pHistory.nProAlarmResultCountD+ pHistory.nProAlarmResultCountB+ pHistory.nProAlarmResultCountA+ pHistory.nProAlarmResultCountC) >0 )
+			pHistory.bResult = FALSE;
+	}
 	// 0 : OK, 1 : NG
 	if(pHistory.bResult == TRUE)
 	{
@@ -667,15 +816,26 @@
 	}
 	else
 	{
-		pResult[0] = 1;	
-		g_pLog->DisplayMessage(_T("Inspection Result Glass %s - NG"),g_pBase->m_strHPanelID);
+		if (g_pLog->m_nHoleAlarmState ==TRUE)
+		{
+			pResult[10] = g_pLog->m_nHoleAlarmState;
+			pResult[0] = 1;
+			g_pLog->m_nHoleAlarmState = 0;
+			g_pLog->DisplayMessage(_T("Inspection Result Glass %s - NG, Hole Alarm%d-NG"), g_pBase->m_strHPanelID, pResult[10]);
+		}
+		else
+		{
+			pResult[0] = 1;
+			pResult[10] = 0;
+			g_pLog->DisplayMessage(_T("Inspection Result Glass %s - NG"), g_pBase->m_strHPanelID);
+		}
 	}
 
 	m_GlassData.GetStageTheta(0,pResult[1],pResult[2]);
 	m_GlassData.GetStageTheta(1,pResult[3],pResult[4]);
 
-	m_pControlInterface->SendCIMData(pResult,PLC_ADDR_GLASS_JUDEMENT,5);
-	g_pLog->DisplayMessage(_T("write PLC Result Data : Resut %d,1_L_Theat %d,1_S_Theat %d,2_L_Theat %d,2_S_Theat %d"),pResult[0],pResult[1],pResult[2],pResult[3],pResult[4]);
+	m_pControlInterface->SendCIMData(pResult,PLC_ADDR_GLASS_JUDEMENT,11);
+	g_pLog->DisplayMessage(_T("write PLC Result Data : Resut %d,1_L_Theat %d,1_S_Theat %d,2_L_Theat %d,2_S_Theat %d,pResult[10]:%d"),pResult[0],pResult[1],pResult[2],pResult[3],pResult[4], pResult[10]);
 
 	INS_PROFILE_RESULT_INFO *pProfileResult = m_GlassData.GetProfileResultInfo();
 
diff --git a/ENRIT/InterfaceManager.h b/ENRIT/InterfaceManager.h
index 7c9afc3..9b6c064 100644
--- a/ENRIT/InterfaceManager.h
+++ b/ENRIT/InterfaceManager.h
@@ -30,6 +30,7 @@
 public:
 	CInterfaceManager(void);
 	virtual ~CInterfaceManager(void);
+	NgInfo ngArray[3][NG_INF_TOTAL];
 
 protected:
 	virtual void	IMI2P_PLC_ReceiveSignalValue(int nSignalIndex, int nValue);
@@ -104,6 +105,7 @@
 	BOOL			SetLiveGrabCommand(DimensionDir eDir,BOOL bStop);	
 	void			WriteLogManager(TCHAR *str);	
 	void			WritePLCResult(HISTORY_RESULT &pHistory);
+	void			CoordProfileJudge(HISTORY_RESULT &pHistory);
 	void			Save_FullImg();
 	void			ReadSplineModeldata(CString strRecipe);
 	void			CopyImageBuffer();		
diff --git a/ENRIT/Process/InspectCamera.cpp b/ENRIT/Process/InspectCamera.cpp
index 2ad36ac..f6df629 100644
--- a/ENRIT/Process/InspectCamera.cpp
+++ b/ENRIT/Process/InspectCamera.cpp
@@ -615,12 +615,13 @@
 		g_pLog->DisplayMessage(_T("%s Re Align Mark Find[%d] Fail x %.2f, y %.2f"),PANEL_SIDE[emDim],iPos,m_iSideLine[stFrame.nScanIdx] + m_dMark2MarkX[stFrame.nScanIdx][iPos], pResInfo->nGlassStartLine + m_dMark2MarkY[stFrame.nScanIdx][iPos]);	
 	}
 
+#if MARKIMG_NOTSAVE
+	CString			strFile;
+	CvRect			saveRect = cvRect((int)matchResut.pt.x - rectAlign.Width() / 2, (int)(matchResut.pt.y + rectAlign.top) - rectAlign.Height() / 2, rectAlign.Width(), rectAlign.Height());
+	strFile.Format(_T("%sIMG_MARK\\%s\\%s\\%s\\Align_%s_%s_%s.jpg"), PATH_INSPECTION_DATA, g_pBase->m_strLoadingDay, g_pBase->m_strHPanelID, g_pBase->m_strLoadingTime, strPos, PANEL_SIDE[emDim], strRes);
 
-	CString			strFile;		
-	CvRect			saveRect = cvRect((int)matchResut.pt.x-rectAlign.Width()/2,(int)(matchResut.pt.y + rectAlign.top)-rectAlign.Height()/2,rectAlign.Width(),rectAlign.Height());
-	strFile.Format(_T("%sIMG_MARK\\%s\\%s\\%s\\Align_%s_%s_%s.jpg"),PATH_INSPECTION_DATA,g_pBase->m_strLoadingDay,g_pBase->m_strHPanelID,g_pBase->m_strLoadingTime,strPos,PANEL_SIDE[emDim],strRes);
-
-	SaveCvAlignImage(saveRect,strFile,stFrame.nScanIdx,nFrameWidth,nFrameHeight);		
+	SaveCvAlignImage(saveRect, strFile, stFrame.nScanIdx, nFrameWidth, nFrameHeight);
+#endif // 0
 
 	return TRUE;
 }
@@ -1362,12 +1363,13 @@
 				continue;
 			CopyBuffer.SetPixel((int)ptChamferEdgePos.u,v,128);
 		}
-
+#if MARKIMG_NOTSAVE
 		CString		str;
-		str.Format(_T("%sIMG_MARK\\%s\\%s\\%s\\ChamferRes_%s_%d.bmp"),PATH_INSPECTION_DATA,g_pBase->m_strLoadingDay,g_pBase->m_strHPanelID,g_pBase->m_strLoadingTime,PANEL_SIDE[eDimension],index);
+		str.Format(_T("%sIMG_MARK\\%s\\%s\\%s\\ChamferRes_%s_%d.bmp"), PATH_INSPECTION_DATA, g_pBase->m_strLoadingDay, g_pBase->m_strHPanelID, g_pBase->m_strLoadingTime, PANEL_SIDE[eDimension], index);
 		CBufferAttach		attach(str);
 		attach.AttachToFile(CopyBuffer);
-	}	
+#endif // 0	
+	}
 
 	return TRUE;
 }
@@ -2197,6 +2199,10 @@
 	int	nStartLine = pEdgeInfo->nGlassStartLine - nOffset / 2;
 	int	nEndLine = nSetEnd + nOffset / 2;
 	int nDefectIdx = 0;
+	int nChamferAlarmResultCount = 0;
+	int nProAlarmResultCount_MinDiff = 0;
+	
+	CINSPECT_JUDGEMENT_PARM* pJudge = m_pRecipe->GetJudgePrm();
 	for (int i = 0; i < ngNum; i++) {
 		NgInfo ng = ngArray[i];    //渚鹅焷璀啀雽勮綆頇у眻
 		if (ng.eDir > 8 || ng.eDir < 0) continue;
@@ -2231,8 +2237,10 @@
 			int offy = ng.y2 - ps.y;
 
 			if (m_pDefectControl != NULL/* && nDefectIdx < 1*/)
-				m_pDefectControl->ExtractDefect_Hole(eDim, m_iCamera, stFrame.nScanIdx, vecList, ngNum, DefectLoc_Hole, CRect(offx, offy, 2 * offx,2 * offy));
-			
+			{
+				m_pDefectControl->ExtractDefect_Hole(eDim, m_iCamera, stFrame.nScanIdx, vecList, ngNum, DefectLoc_Hole, CRect(offx, offy, 2 * offx, 2 * offy));
+				g_pLog->m_nHoleAlarmState = 1;
+			}	
 		}
 		if (5 == ng.ngType)
 		{
@@ -2245,8 +2253,11 @@
 					{
 						pProfileResult->ProfileData[59+i].bUseJudge = TRUE;
 						pProfileResult->ProfileData[59 + i].bProfileJudge = FALSE;
+						if (pJudge->nMinProfileNgCount_MinDiff[ng.eDir] < abs(ng.result))
+						{
+							nProAlarmResultCount_MinDiff = 1;
+						}
 					}
-					
 				}
 				else if (5<ng.id&& ng.id < 11)
 				{
@@ -2255,16 +2266,22 @@
 					{
 						pProfileResult->ProfileData[69 + i].bUseJudge = TRUE;
 						pProfileResult->ProfileData[69+i].bProfileJudge = FALSE;
+						
+						if (pJudge->nMinProfileNgCount_MinDiff[ng.eDir] < abs(ng.result))
+						{
+							nProAlarmResultCount_MinDiff = 1;
+						}
 					}
 				}
 				else if (10<ng.id && ng.id < 16)
 				{
-				  pProfileResult->ResultChamfer[49 +i][1].nChamferCalThick = ng.result;
-				  if (ng.maxValue<ng.result || ng.minValue>ng.result)
-				  {
-					  pProfileResult->ResultChamfer[49 + i][1].bUseJudge = TRUE;
-					  pProfileResult->ResultChamfer[49+i][1].bChamferJudge= FALSE;
-				  }
+					pProfileResult->ResultChamfer[49 + i][1].nChamferCalThick = ng.result;
+					if (ng.maxValue<ng.result || ng.minValue>ng.result)
+					{
+						pProfileResult->ResultChamfer[49 + i][1].bUseJudge = TRUE;
+						pProfileResult->ResultChamfer[49 + i][1].bChamferJudge = FALSE;
+						nChamferAlarmResultCount = 1;
+					}
 				}
 				else if (15<ng.id && ng.id < 21)
 				{
@@ -2273,9 +2290,9 @@
 					{
 						pProfileResult->ResultChamfer[59 + i][1].bUseJudge = TRUE;
 						pProfileResult->ResultChamfer[59+i][1].bChamferJudge = FALSE;
+						nChamferAlarmResultCount = 1;
 					}
-				}
-				
+				}		
 			}
 
 			if (ng.eDir == 5)
@@ -2287,8 +2304,12 @@
 					{
 						pProfileResult->ProfileData[64 + i].bUseJudge = TRUE;
 						pProfileResult->ProfileData[64 + i].bProfileJudge = FALSE;
+						
+						if (pJudge->nMinProfileNgCount_MinDiff[ng.eDir] < abs(ng.result))
+						{
+							nProAlarmResultCount_MinDiff = 1;
+						}
 					}
-
 				}
 				else if (5 < ng.id && ng.id < 11)
 				{
@@ -2297,10 +2318,9 @@
 					{
 						pProfileResult->ResultChamfer[59 + i][1].bUseJudge = TRUE;
 						pProfileResult->ResultChamfer[59 + i][1].bChamferJudge = FALSE;
-					
+						nChamferAlarmResultCount = 1;
 					}
 				}
-
 			}
 			if (ng.eDir == 7)
 			{
@@ -2311,8 +2331,12 @@
 					{
 						pProfileResult->ProfileData[69 + i].bUseJudge = TRUE;
 						pProfileResult->ProfileData[69 + i].bProfileJudge = FALSE;
+						
+						if (pJudge->nMinProfileNgCount_MinDiff[ng.eDir] < abs(ng.result))
+						{
+							nProAlarmResultCount_MinDiff = 1;
+						}
 					}
-
 				}
 				else if (5 < ng.id && ng.id < 11)
 				{
@@ -2321,6 +2345,7 @@
 					{
 						pProfileResult->ResultChamfer[64 + i][1].bUseJudge = TRUE;
 						pProfileResult->ResultChamfer[64+i][1].bChamferJudge = FALSE;
+						nChamferAlarmResultCount = 1;		
 					}
 				}
 			}
@@ -4228,8 +4253,11 @@
 	USES_CONVERSION;
 	char str_filename[1024];
 	sprintf_s(str_filename, "%s", W2A(strFile));
-	cvSaveImage(str_filename,IpImg);	
 	
+#if MARKIMG_NOTSAVE
+	cvSaveImage(str_filename, IpImg);
+#endif // 0
+
 	cvReleaseImage(&IpImg);
 }
 
diff --git a/ENRIT/Recipe/GlassRecipe.h b/ENRIT/Recipe/GlassRecipe.h
index d307850..b7b4bf4 100644
--- a/ENRIT/Recipe/GlassRecipe.h
+++ b/ENRIT/Recipe/GlassRecipe.h
@@ -805,7 +805,7 @@
 typedef struct tagJUDGE_AVG
 {
 	BOOL bUse;			
-	int  nDiff;					
+	int  nDiff;
 }JUDGE_AVG, *PJUDGE_AVG;
 
 #define		MAX_MARKER_COUNT		3
@@ -838,6 +838,7 @@
 	BOOL		bUseLengthDepthComp;
 	int			nCornerJugeLength;
 	int			nCornerJugeDepth;
+	BOOL		bCoordProUse;
 	JUDGE_AVG	AvgProfile[MAX_DIMENSION_COUNT];
 	JUDGE_AVG	AvgChamfer[MAX_DIMENSION_COUNT];
 
diff --git a/ENRIT/Recipe/HardwareSettings.cpp b/ENRIT/Recipe/HardwareSettings.cpp
index 5c2d269..5e01225 100644
--- a/ENRIT/Recipe/HardwareSettings.cpp
+++ b/ENRIT/Recipe/HardwareSettings.cpp
@@ -1017,7 +1017,7 @@
 
 		m_bInsDirReverse = rhs.m_bInsDirReverse;
 		m_bUseColorVisual = rhs.m_bUseColorVisual;
-
+		m_bUseCoordProfile = rhs.m_bUseCoordProfile;
 		m_bUseFreerun = rhs.m_bUseFreerun;
 		m_nFreerunPeriod = rhs.m_nFreerunPeriod;
 		m_nFreerunExposureTime = rhs.m_nFreerunExposureTime;
@@ -1049,7 +1049,7 @@
 	m_SoftWareSettings.Reset();	
 	m_bInsDirReverse = FALSE;
 	m_bUseColorVisual = TRUE;
-
+	m_bUseCoordProfile = FALSE;
 	m_bTriggerBoardUse = FALSE;
 	m_nTriggerBoardComport = 0;
 	m_nFullImageCompressRatio = 70;
@@ -1233,6 +1233,8 @@
 		str = _T("FOLERREMOVEDAY");
 	else if((void *)&m_bUseColorVisual == pValue)
 		str = _T("USECOLORVISUAL");
+	else if ((void*)&m_bUseCoordProfile == pValue)
+		str = _T("USECOORDPROFILE");
 	else if((void *)&m_bUseFreerun == pValue)
 		str = _T("USE_FREERUN");
 	else if((void *)&m_nFreerunPeriod == pValue)
@@ -1300,7 +1302,10 @@
 	if(str.IsEmpty() == TRUE)
 		return FALSE;
 	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str,m_bUseColorVisual);
-
+	str = GetFileString((void*)&m_bUseCoordProfile);
+	if (str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str, m_bUseCoordProfile);
 
 	SetCameraCount(m_nCameraCount,m_nScanCount);
 	iLoop = 0;
@@ -1423,7 +1428,10 @@
 	if(str.IsEmpty() == TRUE)
 		return FALSE;
 	Register.GetItemValue((TCHAR*)(LPCTSTR)str,m_bUseColorVisual);
-
+	str = GetFileString((void*)&m_bUseCoordProfile);
+	if (str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.GetItemValue((TCHAR*)(LPCTSTR)str, m_bUseCoordProfile);
 	SetCameraCount(m_nCameraCount,m_nScanCount);
 	iLoop = 0;
 	for(iCam=0;iCam<m_nCameraCount;iCam++)
@@ -1542,7 +1550,10 @@
 	if(str.IsEmpty() == TRUE)
 		return FALSE;
 	Register.SetItemValue((TCHAR*)(LPCTSTR)str,m_bUseColorVisual);
-
+	str = GetFileString((void*)&m_bUseCoordProfile);
+	if (str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.SetItemValue((TCHAR*)(LPCTSTR)str, m_bUseCoordProfile);
 	if(m_pCameraSettings != NULL)
 	{
 		iLoop = 0;
@@ -1672,6 +1683,10 @@
 		return FALSE;
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_bUseColorVisual);
 
+	str = GetFileString((void*)&m_bUseCoordProfile);
+	if (str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str, m_bUseCoordProfile);
 	if(m_pCameraSettings != NULL)
 	{
 		iLoop = 0;
diff --git a/ENRIT/Recipe/HardwareSettings.h b/ENRIT/Recipe/HardwareSettings.h
index 5a27f32..ae49927 100644
--- a/ENRIT/Recipe/HardwareSettings.h
+++ b/ENRIT/Recipe/HardwareSettings.h
@@ -181,7 +181,8 @@
 	BOOL						m_bInsDirReverse;
 	int							m_nFolderRemoveDay;
 	BOOL						m_bUseColorVisual;
-
+	BOOL						m_bUseCoordProfile;
+	
 	// Software
 public:
 	CSoftSettings				*GetSoftSettings(){return &m_SoftWareSettings;}		
@@ -194,6 +195,7 @@
 
 public:
 	BOOL						GetTriggerBoardUse()		{return m_bTriggerBoardUse;}
+	BOOL						GetCoordProfileUse() 		{ return m_bUseCoordProfile; }
 	int							GetTriggerBoardComport()	{return m_nTriggerBoardComport;}
 
 	BOOL						m_bTriggerBoardUse;
diff --git a/ENRIT/UITool/DisplayMessage.h b/ENRIT/UITool/DisplayMessage.h
index bf369eb..f175dd2 100644
--- a/ENRIT/UITool/DisplayMessage.h
+++ b/ENRIT/UITool/DisplayMessage.h
@@ -37,6 +37,8 @@
 
 	CStdioFile*					m_pFileLog;
 	CFileException				m_fileException;
+	
+	int 						m_nHoleAlarmState;
 };
 
 #define g_pLog		CDisplayMessage::GetSingletonPtr()
\ No newline at end of file
diff --git a/ENRIT/View/FrameImg.cpp b/ENRIT/View/FrameImg.cpp
index 4d20c3a..e8e73af 100644
--- a/ENRIT/View/FrameImg.cpp
+++ b/ENRIT/View/FrameImg.cpp
@@ -87,6 +87,8 @@
 	m_st_GdiItem.colorOrange		= RGB(250, 150,	  0);
 
 	m_bMouseLDown = FALSE;
+	
+	m_nBrushGray = 5;
 }
 
 CFrameImg::~CFrameImg()
@@ -1156,11 +1158,14 @@
 			x = int(m_ptMouseCurrent.x / m_dZoom)+ m_ptOrg.x;
 			y = int(m_ptMouseCurrent.y / m_dZoom);
 
+			if (0 > m_nBrushGray || 255 < m_nBrushGray)
+				m_nBrushGray = 5;
+
 			for(k = y -20 ; k < y+20 ; k++)
 			{
 				for(l = x -8; l < x + 8 ; l++)
 				{
-					m_pBuffer[k * m_szImg.cx  + l ] = 5;
+					m_pBuffer[k * m_szImg.cx  + l ] = m_nBrushGray;
 				}
 			}
 		}
@@ -3333,6 +3338,7 @@
 	CPen pen(PS_SOLID, 1, RGB(255, 0, 0));
 	CPen pen_SearchArea(PS_DASH, 1, RGB(255, 0, 255));
 	CPen pen_Line(PS_DASH, 1, RGB(0, 255, 255));
+	CPen roiPen(PS_SOLID, 1, RGB(0, 255, 255));
 
 	CBrush brush_Null;
 	brush_Null.CreateStockObject(NULL_BRUSH);
@@ -3363,11 +3369,16 @@
 			}
 		}
 		else if (1 == nType) {     //矩形
-			if (4 == inf.eVision) {
-				dc.SelectObject(&pen);
+			if (1 == inf.showROI) {
+				dc.SelectObject(&roiPen);
 			}
 			else {
-				dc.SelectObject(&pen_SearchArea);
+				if (4 == inf.eVision) {
+					dc.SelectObject(&pen);
+				}
+				else {
+					dc.SelectObject(&pen_SearchArea);
+				}
 			}
 			CPoint pt0, pt1, pt;
 			pt0.x = (int)((inf.rectX1 - m_ptOrg.x) * m_dZoom);
diff --git a/ENRIT/View/FrameImg.h b/ENRIT/View/FrameImg.h
index 5070575..0937d48 100644
--- a/ENRIT/View/FrameImg.h
+++ b/ENRIT/View/FrameImg.h
@@ -157,7 +157,6 @@
 	SIZE					m_szMark;
 	MANUAL_MEASURE			m_ManualMeausre;
 	CPoint					m_ptMouseSaved;		// Profile Save 扁瓷矫 荤侩
-
 	IViewInterface2Parent	*m_pI2M;
 	bitset<MAX_DISPLAY_MODE>		m_bitModeDisplay;	// 拳搁 葛靛 bit
 	CRect					m_rcROI;			// 泅力 焊咯瘤绊 乐绰 康开
@@ -169,7 +168,7 @@
 	
 	CGlass_Data				*m_pGlassData;
 	CHardwareSettings		*m_pHardware;
-	CGlassRecipe		*m_pRecipe;
+	CGlassRecipe			*m_pRecipe;
 //	CRecipe					m_RecipeManager;	
 
 public:	
@@ -182,6 +181,7 @@
 
 	int				m_nModeTrackerVCR;
 	CPoint			m_ptOldMouseVCR;	
+	int				m_nBrushGray;
 };
 
 
diff --git a/ENRIT/View/ViewHWSetting.cpp b/ENRIT/View/ViewHWSetting.cpp
index 3152e45..9545e8d 100644
--- a/ENRIT/View/ViewHWSetting.cpp
+++ b/ENRIT/View/ViewHWSetting.cpp
@@ -66,7 +66,7 @@
 	DDX_Text(pDX,IDC_EDIT_FOLDER_REMOVE_DAY,m_pDlgHDSettingParm->m_nFolderRemoveDay);
 	
 	DDX_Check(pDX,IDC_CHK_USECOLORVISUAL,m_pDlgHDSettingParm->m_bUseColorVisual);
-
+	DDX_Check(pDX, IDC_CHK_USE_COORD_PROFILE,m_pDlgHDSettingParm->m_bUseCoordProfile);
 	DDX_Check(pDX,IDC_CHECK_USE_FREERUN_INSPECT,m_pDlgHDSettingParm->m_bUseFreerun);
 	DDX_Text(pDX,IDC_EDIT_FREERUN_PERIOD,m_pDlgHDSettingParm->m_nFreerunPeriod);
 	DDX_Text(pDX,IDC_EDIT_PREERUN_EXPOSURETIME,m_pDlgHDSettingParm->m_nFreerunExposureTime);
diff --git a/ENRIT/View/ViewHWSetting.h b/ENRIT/View/ViewHWSetting.h
index 17fc30b..acd7191 100644
--- a/ENRIT/View/ViewHWSetting.h
+++ b/ENRIT/View/ViewHWSetting.h
@@ -49,7 +49,7 @@
 
 public:
 	void				View_LicenseInfo();
-
+	
 protected:
 	CGridCtrl			m_LightGrid;
 	CGridCtrl			m_CameraGrid;
diff --git a/ENRIT/View/ViewInsInformation.cpp b/ENRIT/View/ViewInsInformation.cpp
index f10495d..2fa6a74 100644
--- a/ENRIT/View/ViewInsInformation.cpp
+++ b/ENRIT/View/ViewInsInformation.cpp
@@ -203,7 +203,7 @@
 				pCell->SetTextClr(color);		
 				pCell->SetFont(&lf);
 			}
-			str.Format(_T("%.3f"),(double)m_HistoryData.nProfileDiff[nProfileIndex]/1000.);
+			str.Format(_T("%.3f"),(double)m_HistoryData.nProfileDiff[nProfileIndex] / 1000.);
 			m_GrdMeasureLine[i].SetItemText(nRowIdx,iCol,str);	
 
 			nRowIdx = 2;
@@ -232,7 +232,7 @@
 				pCell->SetTextClr(color);		
 				pCell->SetFont(&lf);
 			}
-			str.Format(_T("%.3f"),(double)m_HistoryData.nChamferThickDn[nProfileIndex]/1000.);
+			str.Format(_T("%.3f"),(double)m_HistoryData.nChamferThickDn[nProfileIndex] / 1000.);
 			m_GrdMeasureLine[i].SetItemText(nRowIdx,iCol,str);
 
 			if (i > MAX_VIEWINFO_GRD_CNT - 3 && (68 == nProfileIndex || 78 == nProfileIndex))
diff --git a/ENRIT/View/ViewRecipeInspectionView.cpp b/ENRIT/View/ViewRecipeInspectionView.cpp
index 68cc5f0..60094c9 100644
--- a/ENRIT/View/ViewRecipeInspectionView.cpp
+++ b/ENRIT/View/ViewRecipeInspectionView.cpp
@@ -182,6 +182,7 @@
 
 	DDX_Check(pDX,IDC_CHK_USE_AVG_PROFILE_JUDGEMENT,pJudge->AvgProfile[m_nCndRDSide].bUse);
 	DDX_Text(pDX,IDC_EDIT_AVG_PROFILE_DIFF,pJudge->AvgProfile[m_nCndRDSide].nDiff);
+	
 	DDX_Check(pDX,IDC_CHK_USE_AVG_CHAMFER_JUDGEMENT,pJudge->AvgChamfer[m_nCndRDSide].bUse);
 	DDX_Text(pDX,IDC_EDIT_AVG_CHAMFER_DIFF,pJudge->AvgChamfer[m_nCndRDSide].nDiff);
 
diff --git a/ENRIT/View/ViewRecipeSetting.cpp b/ENRIT/View/ViewRecipeSetting.cpp
index b4cb48f..e271935 100644
--- a/ENRIT/View/ViewRecipeSetting.cpp
+++ b/ENRIT/View/ViewRecipeSetting.cpp
@@ -95,7 +95,8 @@
 	DDX_Control(pDX, IDC_SLIDER_ZOOM2				, m_sliderZoom);
 	DDX_Control(pDX, IDC_SCROLLBAR_V				, m_ctrlScrollV);
 	DDX_Control(pDX, IDC_SCROLLBAR_H				, m_ctrlScrollH);	
-
+	DDX_Text(pDX, IDC_BRUSH_GRAY					, m_frameImg.m_nBrushGray);
+	
 	UINT nIDCmdSelect[] = { IDC_RDO_RCP_INSPECT_SETTING,IDC_RDO_RCP_PROFILE_SETTING,IDC_RDO_RCP_CHAMFER_SETTING};
 	for (int i = 0; i < eRcp_End; i++) {
 		DDX_Control(pDX, nIDCmdSelect[i], m_ctrlCmdSelect[i]);
diff --git a/ENRIT/resource.h b/ENRIT/resource.h
index 96da743..442b133 100644
--- a/ENRIT/resource.h
+++ b/ENRIT/resource.h
Binary files differ

--
Gitblit v1.9.3