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/Process/InspectCamera.cpp |   76 ++++++++++++++++++++++++++------------
 1 files changed, 52 insertions(+), 24 deletions(-)

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);
 }
 

--
Gitblit v1.9.3