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/InterfaceManager.cpp |  172 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 166 insertions(+), 6 deletions(-)

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

--
Gitblit v1.9.3