From 1e751a5eb3c23d932b5de94456b5a8741f28c7cc Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期六, 16 八月 2025 17:37:49 +0800
Subject: [PATCH] 1. 修复离线测试设置错误的扫描个数,应该设置的是需要扫描的个数(非相机个数)

---
 EdgeInspector_App/ViewMain_Recipe.cpp |  550 ++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 486 insertions(+), 64 deletions(-)

diff --git a/EdgeInspector_App/ViewMain_Recipe.cpp b/EdgeInspector_App/ViewMain_Recipe.cpp
index a576591..3b7f916 100644
--- a/EdgeInspector_App/ViewMain_Recipe.cpp
+++ b/EdgeInspector_App/ViewMain_Recipe.cpp
@@ -1,4 +1,4 @@
-// ViewLedRecipeSetting.cpp : 备泅 颇老涝聪促.
+锘�// ViewLedRecipeSetting.cpp : 澶囨硡 棰囪�佹稘鑱績.
 //
 
 #include "stdafx.h"
@@ -9,7 +9,7 @@
 #include "ViewLampControl.h"
 #include "DlgLogin.h"
 #include "Global_Define.h"
-// CViewLedRecipeSetting 措拳 惑磊涝聪促.
+// CViewLedRecipeSetting 鎺嫵 鎯戠娑濊仾淇�.
 
 IMPLEMENT_DYNAMIC(CViewMain_Recipe, CDialogEx)
 
@@ -150,7 +150,7 @@
 END_MESSAGE_MAP()
 
 
-// CViewLedRecipeSetting 皋矫瘤 贸府扁涝聪促.
+// CViewLedRecipeSetting 鐨嬬煫鐦� 璐稿簻鎵佹稘鑱績.
 BEGIN_EVENTSINK_MAP(CViewMain_Recipe, CDialogEx)
 	ON_EVENT(CViewMain_Recipe, IDC_BTN_IMG_LOAD, DISPID_CLICK, CViewMain_Recipe::ClickImgLoadButton, VTS_NONE)
 	ON_EVENT(CViewMain_Recipe, IDC_BTN_IMG_SAVE, DISPID_CLICK, CViewMain_Recipe::ClickImgSaveButton, VTS_NONE)
@@ -167,6 +167,10 @@
 	ON_EVENT(CViewMain_Recipe, IDC_RDO_SIDE_B_BOT, DISPID_CLICK, CViewMain_Recipe::ClickSideSelButton, VTS_NONE)
 	ON_EVENT(CViewMain_Recipe, IDC_RDO_SIDE_C_BOT, DISPID_CLICK, CViewMain_Recipe::ClickSideSelButton, VTS_NONE)
 	ON_EVENT(CViewMain_Recipe, IDC_RDO_SIDE_D_BOT, DISPID_CLICK, CViewMain_Recipe::ClickSideSelButton, VTS_NONE)
+	ON_EVENT(CViewMain_Recipe, IDC_RDO_SIDE_A_RIP, DISPID_CLICK, CViewMain_Recipe::ClickSideSelButton, VTS_NONE)
+	ON_EVENT(CViewMain_Recipe, IDC_RDO_SIDE_B_RIP, DISPID_CLICK, CViewMain_Recipe::ClickSideSelButton, VTS_NONE)
+	ON_EVENT(CViewMain_Recipe, IDC_RDO_SIDE_C_RIP, DISPID_CLICK, CViewMain_Recipe::ClickSideSelButton, VTS_NONE)
+	ON_EVENT(CViewMain_Recipe, IDC_RDO_SIDE_D_RIP, DISPID_CLICK, CViewMain_Recipe::ClickSideSelButton, VTS_NONE)
 
 	ON_EVENT(CViewMain_Recipe, IDC_RDO_INSTYPE_CHIP, DISPID_CLICK, CViewMain_Recipe::ClickRdoInsType, VTS_NONE)
 	ON_EVENT(CViewMain_Recipe, IDC_RDO_INSTYPE_CRACK, DISPID_CLICK, CViewMain_Recipe::ClickRdoInsType, VTS_NONE)
@@ -178,6 +182,7 @@
 	ON_EVENT(CViewMain_Recipe, IDC_RDO_INSTYPE_IN_CHAMFER, DISPID_CLICK, CViewMain_Recipe::ClickRdoInsType, VTS_NONE)
 	ON_EVENT(CViewMain_Recipe, IDC_RDO_INSTYPE_TOP_CORNER, DISPID_CLICK, CViewMain_Recipe::ClickRdoInsType, VTS_NONE)
 	ON_EVENT(CViewMain_Recipe, IDC_RDO_INSTYPE_BOT_CORNER, DISPID_CLICK, CViewMain_Recipe::ClickRdoInsType, VTS_NONE)
+	ON_EVENT(CViewMain_Recipe, IDC_RDO_INSTYPE_RIP_THICKNESS, DISPID_CLICK, CViewMain_Recipe::ClickRdoInsType, VTS_NONE)
 
 	ON_EVENT(CViewMain_Recipe, IDC_BTN_TOP_MARK_UPDATE_0, DISPID_CLICK, CViewMain_Recipe::ClickBtnMarkUpdate, VTS_NONE)
 	ON_EVENT(CViewMain_Recipe, IDC_BTN_TOP_MARK_UPDATE_1, DISPID_CLICK, CViewMain_Recipe::ClickBtnMarkUpdate, VTS_NONE)
@@ -309,10 +314,10 @@
 #if HALCON_VISION_KEY
 void CViewMain_Recipe::onMsgVisionEvent(int code, int eDir) {
 	/* code */
-	if (1 == code) {     //获取区域数据
+	if (1 == code) {     //鑾峰彇鍖哄煙鏁版嵁
 		m_pThis->SetFrameRegion();
 	}
-	else if (2 == code) {    //获取效果
+	else if (2 == code) {    //鑾峰彇鏁堟灉
 		m_pThis->DispAllResult();
 	}
 }
@@ -906,7 +911,7 @@
 
 		tickCount = GetTickCount();
 
-		// 急琶等 Recipe 荐沥.				
+		// 鎬ョ惗绛� Recipe 鑽愭播.				
 		if (m_pDlgRecipe->WriteRecipeFile() == FALSE)		
 		{
 			AfxMessageBox(_T("Save Fail"), MB_OK | MB_ICONERROR);
@@ -989,7 +994,7 @@
 
 void CViewMain_Recipe::DeleteVectorList()
 {
-	// Vector 昏力
+	// Vector 鏄忓姏
 	LinkList* pList = NULL;
 	for (VectorLinkListIt it = m_VectorLinkList.begin(); it != m_VectorLinkList.end(); it++)
 	{
@@ -1076,7 +1081,7 @@
 {
 	if(strRecipe.IsEmpty() == TRUE)
 	{
-		//AfxMessageBox("Recipe Name捞 绝嚼聪促.");
+		//AfxMessageBox("Recipe Name鎹� 缁濆毤鑱績.");
 		return FALSE;	
 	}
 
@@ -1118,12 +1123,25 @@
 	case IDC_RDO_SIDE_D_BOT:
 		eSelView = eRcp_SideRD_D_DN;		
 		break;
+	case IDC_RDO_SIDE_A_RIP:
+		eSelView = eRcp_SideRD_A_RIP;
+		break;
+	case IDC_RDO_SIDE_B_RIP:
+		eSelView = eRcp_SideRD_B_RIP;
+		break;
+	case IDC_RDO_SIDE_C_RIP:
+		eSelView = eRcp_SideRD_C_RIP;
+		break;
+	case IDC_RDO_SIDE_D_RIP:
+		eSelView = eRcp_SideRD_D_RIP;
+		break;
 	default:
 		return;
 	}
 
-	if(m_eSelectSide == eSelView)
+	if (m_eSelectSide == eSelView) {
 		return;
+	}
 
 	m_eSelectSide = eSelView;
 
@@ -1133,11 +1151,17 @@
 
 	double dPixelSizeX = 1.0;
 	double dPixelSizeY = 1.0;
-	int nFrameWidth = IMAGE_WIDTH;
+
+	int nFrameWidth = IMAGE_WIDTH / 2;
+	if (eSelView < eRcp_SideRD_A_RIP){
+		nFrameWidth = IMAGE_WIDTH;
+	}
+
 	int nFrameHeight = IMAGE_HEIGHT;
 	int nFrameCount = MAX_FRAM_COUNT;
 	GetResolution(dPixelSizeX, dPixelSizeY, nFrameWidth, nFrameHeight, nFrameCount);
 	m_frameImg.SetPixelSize(dPixelSizeX, dPixelSizeY);
+	m_frameImg.SetImageSize(nFrameWidth, nFrameHeight, nFrameCount);
 
 #if HALCON_VISION_KEY
 	if (NULL != m_pVisionSetDlg) {
@@ -1176,15 +1200,21 @@
 		break;
 	case IDC_RDO_INSTYPE_BOT_CORNER:	eSelInsType = eRcp_InsType_BotCorner;
 		break;
+	case IDC_RDO_INSTYPE_RIP_THICKNESS:	eSelInsType = eRcp_InsType_RipThickness;
+		break;
 	default:
 		return;
 	}
 
-	if(m_eSelectInsType == eSelInsType)
+	// Check Ins Type
+	if (m_eSelectInsType == eSelInsType) {
 		return;
+	}
 
+	// Change Ins Type
 	m_eSelectInsType = eSelInsType;
 	
+	// Update UI
 	Init_SideInsInfo();
 	Fill_SideInsInfo(FALSE);
 
@@ -1194,58 +1224,44 @@
 
 void CViewMain_Recipe::UpdateRecipe(BOOL bGetData, int type)
 {
-	if(bGetData == FALSE)
-	{
-		// UpdateData(FALSE);	// Parameter
-
-		Fill_PanelInfo(bGetData);
-		Fill_SideInsInfo(bGetData);
-		Fill_JudgementInfo(bGetData);
-
-		UpdateSideImage();		// Image
-
-		UpdateMarkImage();		// Mark Image
-
-		m_dScanTimeOut = m_pDlgRecipe->m_RecieParm.m_dOneScanTime_sec;
-
-		if(m_pViewSideDimensionSetting != NULL)
-			m_pViewSideDimensionSetting->UpdateRecipe(bGetData);
-
-		if(m_pViewSideNotchSetting != NULL)
-			m_pViewSideNotchSetting->UpdateRecipe(bGetData);
-
-		if(m_pViewSideExceptionSetting != NULL)
-			m_pViewSideExceptionSetting->UpdateRecipe(bGetData);
-
-		if(m_pViewSideUserDefectSetting != NULL)
-			m_pViewSideUserDefectSetting->UpdateRecipe(bGetData);		
-
-		UpdateData(FALSE);
-	}
-	else
-	{
-		UpdateData(TRUE);	// Parameter
-
-		Fill_PanelInfo(bGetData);
-		Fill_SideInsInfo(bGetData);
-		Fill_JudgementInfo(bGetData);
-
+	if (bGetData) {
+		UpdateData(TRUE);
 		m_pDlgRecipe->m_RecieParm.m_dOneScanTime_sec = m_dScanTimeOut;
+	}
+	else {
+		m_dScanTimeOut = m_pDlgRecipe->m_RecieParm.m_dOneScanTime_sec;
+	}
 
-		if (type == 1)
-		{
-			if (m_pViewSideDimensionSetting != NULL)
-				m_pViewSideDimensionSetting->UpdateRecipe(bGetData);
+	Fill_PanelInfo(bGetData);
+	Fill_SideInsInfo(bGetData);
+	Fill_JudgementInfo(bGetData);
+
+	if (!bGetData) {
+		UpdateSideImage();
+		UpdateMarkImage();
+	}
+
+	auto UpdateChild = [&](auto* pView) {
+		if (pView) {
+			pView->UpdateRecipe(bGetData);
 		}
+	};
 
-		if(m_pViewSideNotchSetting != NULL)
-			m_pViewSideNotchSetting->UpdateRecipe(bGetData);
+	const bool bNeedUpdateSideDim = (!bGetData) || (type == 1);
+	const bool bNeedRefreshSideUI = (!bGetData);
+	if (m_pViewSideDimensionSetting && bNeedUpdateSideDim) {
+		if (bNeedRefreshSideUI) {
+			m_pViewSideDimensionSetting->RefreshSideUI(TRUE);
+		}
+		m_pViewSideDimensionSetting->UpdateRecipe(bGetData);
+	}
 
-		if(m_pViewSideExceptionSetting != NULL)
-			m_pViewSideExceptionSetting->UpdateRecipe(bGetData);
+	UpdateChild(m_pViewSideNotchSetting);
+	UpdateChild(m_pViewSideExceptionSetting);
+	UpdateChild(m_pViewSideUserDefectSetting);
 
-		if(m_pViewSideUserDefectSetting != NULL)
-			m_pViewSideUserDefectSetting->UpdateRecipe(bGetData);
+	if (!bGetData) {
+		UpdateData(FALSE);
 	}
 }
 
@@ -1541,6 +1557,14 @@
 	m_PanelInfo.SetItemText(nRowIdx, nColIdx++, _T("C Bot"));
 	m_PanelInfo.SetColumnWidth(nColIdx, 80);
 	m_PanelInfo.SetItemText(nRowIdx, nColIdx++, _T("D Bot"));
+	m_PanelInfo.SetColumnWidth(nColIdx, 80);
+	m_PanelInfo.SetItemText(nRowIdx, nColIdx++, _T("A RIP"));
+	m_PanelInfo.SetColumnWidth(nColIdx, 80);
+	m_PanelInfo.SetItemText(nRowIdx, nColIdx++, _T("B RIP"));
+	m_PanelInfo.SetColumnWidth(nColIdx, 80);
+	m_PanelInfo.SetItemText(nRowIdx, nColIdx++, _T("C RIP"));
+	m_PanelInfo.SetColumnWidth(nColIdx, 80);
+	m_PanelInfo.SetItemText(nRowIdx, nColIdx++, _T("D RIP"));
 
 	nColIdx = 0;
 	nRowIdx = 1;
@@ -1618,6 +1642,9 @@
 	case eRcp_InsType_BotCorner :
 		nRows = 14;
 		break;
+	case eRcp_InsType_RipThickness:
+		nRows = 15;
+		break;
 	default:
 		break;
 	}
@@ -1674,6 +1701,14 @@
 	m_SideInspectInfo.SetItemText(nRowIdx, nColIdx++, _T("C Bot"));
 	m_SideInspectInfo.SetColumnWidth(nColIdx, 80);
 	m_SideInspectInfo.SetItemText(nRowIdx, nColIdx++, _T("D Bot"));
+	m_SideInspectInfo.SetColumnWidth(nColIdx, 80);
+	m_SideInspectInfo.SetItemText(nRowIdx, nColIdx++, _T("A RIP"));
+	m_SideInspectInfo.SetColumnWidth(nColIdx, 80);
+	m_SideInspectInfo.SetItemText(nRowIdx, nColIdx++, _T("B RIP"));
+	m_SideInspectInfo.SetColumnWidth(nColIdx, 80);
+	m_SideInspectInfo.SetItemText(nRowIdx, nColIdx++, _T("C RIP"));
+	m_SideInspectInfo.SetColumnWidth(nColIdx, 80);
+	m_SideInspectInfo.SetItemText(nRowIdx, nColIdx++, _T("D RIP"));
 
 	nColIdx = 0;
 	nRowIdx = 1;
@@ -1786,6 +1821,57 @@
 			m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, vecParams[i]);
 		}
 	}
+	else if (m_eSelectInsType == eRcp_InsType_RipThickness) {
+		std::vector<CString> vecParams;
+		strTemp.Format(_T("%s Use (0:OFF/1:ON)"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("%s Ins. Left Thres"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("%s Ins. Right Thres"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("%s Glsss Thres"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("%s Rip Dir. (0:Left/1:Right/2:Both)"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("%s Ins. Rect L"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("%s Ins. T Offset"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("%s Ins. Rect R"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("%s Ins. B Offset"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("%s Ins. Use (0:OFF/1:ON)"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("%s Ins. Range (um)"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("%s Ins. SideLine Offset (um)"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("%s Ins. Min Thres"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("%s Ins. Max Thres"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+
+		CLanguageControl* pLanguageControl = g_pStatus->m_pLanguageControl;
+
+		if (pLanguageControl != NULL) {
+			for (int i = 0; i < vecParams.size(); i++) {
+				CString strParam = pLanguageControl->GetString(m_eSelectLangType, vecParams[i]);
+
+				if (strParam.IsEmpty() || strParam.GetLength() == 0) {
+					continue;
+				}
+
+				vecParams[i] = strParam;
+			}
+		}
+
+		for (int i = 0; i < vecParams.size(); i++) {
+			m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetState(GVIS_READONLY);
+			m_SideInspectInfo.SetRowHeight(nRowIdx, 19);
+			m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, vecParams[i]);
+		}
+	}
 
 	m_SideInspectInfo.SetFixedRowSelection(FALSE);
 	m_SideInspectInfo.SetFixedColumnSelection(FALSE);
@@ -1819,6 +1905,9 @@
 	case eRcp_InsType_TopCorner :
 	case eRcp_InsType_BotCorner :
 		nRows = 11;
+		break;
+	case eRcp_InsType_RipThickness:
+		nRows = 10;
 		break;
 	default:
 		break;
@@ -1876,6 +1965,14 @@
 	m_JudgementInfo.SetItemText(nRowIdx, nColIdx++, _T("C Bot"));
 	m_JudgementInfo.SetColumnWidth(nColIdx, 80);
 	m_JudgementInfo.SetItemText(nRowIdx, nColIdx++, _T("D Bot"));
+	m_JudgementInfo.SetColumnWidth(nColIdx, 80);
+	m_JudgementInfo.SetItemText(nRowIdx, nColIdx++, _T("A RIP"));
+	m_JudgementInfo.SetColumnWidth(nColIdx, 80);
+	m_JudgementInfo.SetItemText(nRowIdx, nColIdx++, _T("B RIP"));
+	m_JudgementInfo.SetColumnWidth(nColIdx, 80);
+	m_JudgementInfo.SetItemText(nRowIdx, nColIdx++, _T("C RIP"));
+	m_JudgementInfo.SetColumnWidth(nColIdx, 80);
+	m_JudgementInfo.SetItemText(nRowIdx, nColIdx++, _T("D RIP"));
 
 	nColIdx = 0;
 	nRowIdx = 1;
@@ -1961,6 +2058,46 @@
 
 		for(int i=0; i<vecParams.size(); i++)
 		{
+			m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetState(GVIS_READONLY);
+			m_JudgementInfo.SetRowHeight(nRowIdx, 19);
+			m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, vecParams[i]);
+		}
+	}
+	else if (eRcp_InsType_RipThickness == m_eSelectInsType) {
+		std::vector<CString> vecParams;
+		strTemp.Format(_T("Glass %s Size Min um"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("Glass %s Size Max um"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("Left %s Rip Size Min um"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("Left %s Rip Size Max um"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("Right %s Rip Size Min um"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("Right %s Rip Size Max um"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("%s Rip Judge Size Min X um"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("%s Rip Judge Size Min Y um"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("%s Rip Judge Mode (0:NoUse/1:OR/2:AND)"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+
+		CLanguageControl* pLanguageControl = g_pStatus->m_pLanguageControl;
+
+		if (pLanguageControl != NULL) {
+			for (int i = 0; i < vecParams.size(); i++) {
+				CString strParam = pLanguageControl->GetString(m_eSelectLangType, vecParams[i]);
+
+				if (strParam.IsEmpty() || strParam.GetLength() == 0)
+					continue;
+
+				vecParams[i] = strParam;
+			}
+		}
+
+		for (int i = 0; i < vecParams.size(); i++) {
 			m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetState(GVIS_READONLY);
 			m_JudgementInfo.SetRowHeight(nRowIdx, 19);
 			m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, vecParams[i]);
@@ -2424,6 +2561,81 @@
 				strTemp.Format(_T("%d"), pSideParam->m_nBottomCornerEdgeThreshold );
 				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
 			}
+			else if (m_eSelectInsType == eRcp_InsType_RipThickness)
+			{
+				CRIP_THICKNESS_PARM& rip = pSideParam->m_RipThk;
+				// 1. Use (0/1)
+				if (rip.m_bUseInspect)  m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(RGB(50, 255, 50));
+				else                    m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(RGB(255, 50, 50));
+				strTemp.Format(_T("%d"), rip.m_bUseInspect);
+				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 2. Left Thres
+				m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nLeftThres);
+				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 3. Right Thres
+				m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nRightThres);
+				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 4. Glass Thres
+				m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nGlassThres);
+				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 5. Rip Direction (0/1/2)
+				m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nRipDir);
+				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 6. Rect L
+				m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nRectLeft);
+				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 7. T Offset
+				m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nTopOffset);
+				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 8. Rect R
+				m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nRectRight);
+				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 9. B Offset
+				m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nBottomOffset);
+				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 10. RIP Inspect Use
+				if (rip.m_bRipUseInspect)  m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(RGB(50, 255, 50));
+				else                       m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(RGB(255, 50, 50));
+				strTemp.Format(_T("%d"), rip.m_bRipUseInspect);
+				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 11. RIP Inspect Range
+				m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nRipInspect_Range_um);
+				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 12. RIP Inspect SideLine Offset
+				m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nRipInspect_SideLine_Offset_um);
+				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 13. RIP Min Threshold
+				m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nRipMin_Threshold);
+				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 14. RIP Min Threshold
+				m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nRipMax_Threshold);
+				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+			}
 		}
 
 		m_SideInspectInfo.Invalidate();
@@ -2592,10 +2804,69 @@
 				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
 				pSideParam->m_nBottomCornerEdgeThreshold  = _wtoi(strTemp);
 			}
+			else if (m_eSelectInsType == eRcp_InsType_RipThickness)
+			{
+				CRIP_THICKNESS_PARM& rip = pSideParam->m_RipThk;
+
+				// 1. Use
+				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_bUseInspect = _wtoi(strTemp);
+
+				// 2. Left Thres
+				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nLeftThres = _wtoi(strTemp);
+
+				// 3. Right Thres
+				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nRightThres = _wtoi(strTemp);
+
+				// 4. Glass Thres
+				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nGlassThres = _wtoi(strTemp);
+
+				// 5. Rip Direction
+				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nRipDir = _wtoi(strTemp);
+
+				// 6. Rect L
+				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nRectLeft = _wtoi(strTemp);
+
+				// 7. T Offset
+				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nTopOffset = _wtoi(strTemp);
+
+				// 8. Rect R
+				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nRectRight = _wtoi(strTemp);
+
+				// 9. B Offset
+				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nBottomOffset = _wtoi(strTemp);
+
+				// 10. RIP Inspect Use
+				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_bRipUseInspect = _wtoi(strTemp);
+
+				// 11. RIP Inspect Range
+				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nRipInspect_Range_um = _wtoi(strTemp);
+
+				// 12. RIP Inspect SideLine Offset
+				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nRipInspect_SideLine_Offset_um = _wtoi(strTemp);
+
+				// 13. RIP Min Threshold
+				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nRipMin_Threshold = _wtoi(strTemp);
+
+				// 14. RIP Min Threshold
+				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nRipMax_Threshold = _wtoi(strTemp);
+			}
 		}
 	}
 }
-
 
 void CViewMain_Recipe::Fill_JudgementInfo(BOOL bGetData)
 {
@@ -2744,6 +3015,52 @@
 				strTemp.Format(_T("%d"), pSideParam->m_nBottomCorner_Measure_Judge_OR_AND );
 				m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
 			}
+			else if (m_eSelectInsType == eRcp_InsType_RipThickness)
+			{
+				const CRIP_THICKNESS_PARM& rip = pSideParam->m_RipThk;
+
+				// 1. Glass Size Min um
+				m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nGlassSizeMin_um);
+				m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 2. Glass Size Max um
+				m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nGlassSizeMax_um);
+				m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 3. Left Rip Size Min um
+				m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nLeftRipSizeMin_um);
+				m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 4. Left Rip Size Max um
+				m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nLeftRipSizeMax_um);
+				m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 5. Right Rip Size Min um
+				m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nRightRipSizeMin_um);
+				m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 6. Right Rip Size Max um
+				m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nRightRipSizeMax_um);
+				m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+				// 7. Rip chip Size Min um
+				m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nRipJudge_Size_Min_X_um);
+				m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+				// 8. Rip chip Size Max um
+				m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nRipJudge_Size_Min_Y_um);
+				m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+				// 9. Rip chip OR/AND
+				m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nRipJudge_Size_Min_OR_AND);
+				m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+			}
 		}
 
 		m_JudgementInfo.Invalidate();
@@ -2860,6 +3177,43 @@
 				strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
 				pSideParam->m_nBottomCorner_Measure_Judge_OR_AND  = _wtoi(strTemp);
 			}
+			else if (m_eSelectInsType == eRcp_InsType_RipThickness)
+			{
+				CRIP_THICKNESS_PARM& rip = pSideParam->m_RipThk;
+
+				// 1. Glass Size Min um
+				strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nGlassSizeMin_um = _wtoi(strTemp);
+
+				// 2. Glass Size Max um
+				strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nGlassSizeMax_um = _wtoi(strTemp);
+
+				// 3. Left Rip Size Min um
+				strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nLeftRipSizeMin_um = _wtoi(strTemp);
+
+				// 4. Left Rip Size Max um
+				strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nLeftRipSizeMax_um = _wtoi(strTemp);
+
+				// 5. Right Rip Size Min um
+				strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nRightRipSizeMin_um = _wtoi(strTemp);
+
+				// 6. Right Rip Size Max um
+				strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nRightRipSizeMax_um = _wtoi(strTemp);
+				// 7. Rip chip Size Min um
+				strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nRipJudge_Size_Min_X_um = _wtoi(strTemp);
+				// 8. Rip chip Size Max um
+				strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nRipJudge_Size_Min_Y_um = _wtoi(strTemp);
+				// 9. Rip chip OR/AND
+				strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nRipJudge_Size_Min_OR_AND = _wtoi(strTemp);
+			}
 		}
 	}
 }
@@ -2893,8 +3247,8 @@
 	UINT nID = GetFocus()->GetDlgCtrlID();
 
 	UpdateRecipe(TRUE);
-
 	ChangViewCdmSide(nID);
+	RefreshRadioStates();
 }
 
 
@@ -2902,10 +3256,10 @@
 {
 	UINT nID = GetFocus()->GetDlgCtrlID();
 
-	Fill_SideInsInfo(TRUE);	// Get Data..
+	Fill_SideInsInfo(TRUE);
 	Fill_JudgementInfo(TRUE);
-
 	ChangInsTypeSide(nID);
+	RefreshRadioStates();
 }
 
 void CViewMain_Recipe::ClickButtonLang()
@@ -3145,8 +3499,9 @@
 
 void CViewMain_Recipe::ClickButtonOpenDimensionSettingView()
 {
-	if(m_pViewSideDimensionSetting == NULL)
+	if (m_pViewSideDimensionSetting == NULL) {
 		return;
+	}
 
 	m_pViewSideDimensionSetting->SetGlassData(m_pGlassData);
 	m_pViewSideDimensionSetting->ShowWindow(SW_SHOW);
@@ -3166,7 +3521,7 @@
 {
 	CPaintDC dc(this);
 
-	DrawMarkImage();	// 恐 捞芭 秦拎具父 贸澜俊 付农 捞固瘤啊 弊妨龙鳖..
+	DrawMarkImage();	// 鎭� 鎹炶姯 绉︽嫀鍏风埗 璐告緶淇� 浠樺啘 鎹炲浐鐦ゅ晩 寮婂Θ榫欓硸..
 }
 
 void CViewMain_Recipe::ClickButtonOpenExceptionSettingView()
@@ -3191,7 +3546,7 @@
 
 void CViewMain_Recipe::ClickButtonVisionSetting()
 {
-	// TODO: 在此处添加消息处理程序代码
+	// TODO: 鍦ㄦ澶勬坊鍔犳秷鎭鐞嗙▼搴忎唬鐮�
 #if HALCON_VISION_KEY
 	IVisionRecipe* pInstance = BlVision_GetVisionRecipe();
 	if (!pInstance->getVisionUse()) {
@@ -3210,3 +3565,70 @@
 	pApp->ChangeDimension(m_pVisionSetDlg, nDir);
 #endif // HALCON_VISION_KEY
 }
+
+void CViewMain_Recipe::RefreshRadioStates()
+{
+	// 鍐呴儴鏄犲皠 lambda锛氭灇涓� -> 鎺т欢 ID
+	auto InsTypeToCtrlId = [](eViewCmdInsType t) -> UINT {
+		switch (t) {
+		case eRcp_InsType_Chip:          return IDC_RDO_INSTYPE_CHIP;
+		case eRcp_InsType_Crack:         return IDC_RDO_INSTYPE_CRACK;
+		case eRcp_InsType_Burr:          return IDC_RDO_INSTYPE_BURR;
+		case eRcp_InsType_Chamfer:       return IDC_RDO_INSTYPE_CHAMFER;
+		case eRcp_InsType_In_Chip:       return IDC_RDO_INSTYPE_IN_CHIP;
+		case eRcp_InsType_In_Crack:      return IDC_RDO_INSTYPE_IN_CRACK;
+		case eRcp_InsType_In_Burr:       return IDC_RDO_INSTYPE_IN_BURR;
+		case eRcp_InsType_In_Chamfer:    return IDC_RDO_INSTYPE_IN_CHAMFER;
+		case eRcp_InsType_TopCorner:     return IDC_RDO_INSTYPE_TOP_CORNER;
+		case eRcp_InsType_BotCorner:     return IDC_RDO_INSTYPE_BOT_CORNER;
+		case eRcp_InsType_RipThickness:  return IDC_RDO_INSTYPE_RIP_THICKNESS;
+		default: return 0;
+		}
+	};
+
+	auto SideToCtrlId = [](eViewCmdSide s) -> UINT {
+		switch (s) {
+		case eRcp_SideRD_A:      return IDC_RDO_SIDE_A_TOP;
+		case eRcp_SideRD_B:      return IDC_RDO_SIDE_B_TOP;
+		case eRcp_SideRD_C:      return IDC_RDO_SIDE_C_TOP;
+		case eRcp_SideRD_D:      return IDC_RDO_SIDE_D_TOP;
+		case eRcp_SideRD_A_DN:   return IDC_RDO_SIDE_A_BOT;
+		case eRcp_SideRD_B_DN:   return IDC_RDO_SIDE_B_BOT;
+		case eRcp_SideRD_C_DN:   return IDC_RDO_SIDE_C_BOT;
+		case eRcp_SideRD_D_DN:   return IDC_RDO_SIDE_D_BOT;
+		case eRcp_SideRD_A_RIP:  return IDC_RDO_SIDE_A_RIP;
+		case eRcp_SideRD_B_RIP:  return IDC_RDO_SIDE_B_RIP;
+		case eRcp_SideRD_C_RIP:  return IDC_RDO_SIDE_C_RIP;
+		case eRcp_SideRD_D_RIP:  return IDC_RDO_SIDE_D_RIP;
+		default: return 0;
+		}
+	};
+
+	const UINT nInsIds[] = {
+		IDC_RDO_INSTYPE_CHIP, IDC_RDO_INSTYPE_CRACK, IDC_RDO_INSTYPE_BURR,
+		IDC_RDO_INSTYPE_CHAMFER, IDC_RDO_INSTYPE_IN_CHIP, IDC_RDO_INSTYPE_IN_CRACK,
+		IDC_RDO_INSTYPE_IN_BURR, IDC_RDO_INSTYPE_IN_CHAMFER,
+		IDC_RDO_INSTYPE_TOP_CORNER, IDC_RDO_INSTYPE_BOT_CORNER,
+		IDC_RDO_INSTYPE_RIP_THICKNESS
+	};
+
+	const UINT nSideIds[] = {
+		IDC_RDO_SIDE_A_TOP, IDC_RDO_SIDE_B_TOP, IDC_RDO_SIDE_C_TOP, IDC_RDO_SIDE_D_TOP,
+		IDC_RDO_SIDE_A_BOT, IDC_RDO_SIDE_B_BOT, IDC_RDO_SIDE_C_BOT, IDC_RDO_SIDE_D_BOT,
+		IDC_RDO_SIDE_A_RIP, IDC_RDO_SIDE_B_RIP, IDC_RDO_SIDE_C_RIP, IDC_RDO_SIDE_D_RIP
+	};
+
+	const UINT nSelIns = InsTypeToCtrlId(m_eSelectInsType);
+	for (UINT id : nInsIds) {
+		if (auto* p = (CButton*)GetDlgItem(id)) { 
+			p->SetCheck(id == nSelIns ? 1 : 0);
+		}
+	}
+
+	const UINT nSelSide = SideToCtrlId(m_eSelectSide);
+	for (UINT id : nSideIds) {
+		if (auto* p = (CButton*)GetDlgItem(id)) {
+			p->SetCheck(id == nSelSide ? 1 : 0);
+		}
+	}
+}
\ No newline at end of file

--
Gitblit v1.9.3