From 06548959f857ca6a9eabaa695ab84dfa0ff73849 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期日, 10 八月 2025 14:03:11 +0800
Subject: [PATCH] 1. 添加侧面检的执行和报警参数 2. 修复配方界面分组按钮的显示异常问题

---
 EdgeInspector_App/EdgeInspector_App.rc        |    0 
 EdgeInspector_App/Process/InspectCamera.cpp   |    6 
 EdgeInspector_App/Define/Global_Define.h      |    6 
 EdgeInspector_App/ViewMain_Recipe.cpp         |  312 +++++++++++++++++++++++++++++++++-
 EdgeInspector_App/ViewMain_Recipe.h           |    2 
 EdgeInspector_App/Recipe/GlassRecipe.h        |   30 +++
 EdgeInspector_App/resource.h                  |   40 ++--
 EdgeInspector_App/Recipe/GlassRecipe.cpp      |  105 +++++++++++
 EdgeInspector_App/View/ViewMain_ScanImage.cpp |    2 
 9 files changed, 467 insertions(+), 36 deletions(-)

diff --git a/EdgeInspector_App/Define/Global_Define.h b/EdgeInspector_App/Define/Global_Define.h
index 67f2028..4ce3921 100644
--- a/EdgeInspector_App/Define/Global_Define.h
+++ b/EdgeInspector_App/Define/Global_Define.h
@@ -325,10 +325,11 @@
 	eRcp_InsType_In_Burr, 
 	eRcp_InsType_In_Chamfer, 
 	eRcp_InsType_TopCorner, 
-	eRcp_InsType_BotCorner
+	eRcp_InsType_BotCorner,
+	eRcp_InsType_RipThickness
 };
 
-static CString g_strInsType[10] = 
+static CString g_strInsType[] = 
 {
 	_T("Chip"),
 	_T("Crack"),
@@ -340,6 +341,7 @@
 	_T("In_Chamfer"),
 	_T("Top_Corner"),
 	_T("Bot_Corner"),
+	_T("Thickness")
 };
 
 enum eSideInsType		
diff --git a/EdgeInspector_App/EdgeInspector_App.rc b/EdgeInspector_App/EdgeInspector_App.rc
index 5f85e87..90c0f1d 100644
--- a/EdgeInspector_App/EdgeInspector_App.rc
+++ b/EdgeInspector_App/EdgeInspector_App.rc
Binary files differ
diff --git a/EdgeInspector_App/Process/InspectCamera.cpp b/EdgeInspector_App/Process/InspectCamera.cpp
index bd15068..b7b32b7 100644
--- a/EdgeInspector_App/Process/InspectCamera.cpp
+++ b/EdgeInspector_App/Process/InspectCamera.cpp
@@ -6259,6 +6259,12 @@
 		// 1. Find End Line.. (Corner毳� 鞝滌櫢頃� Side霛检澑鞚� 彀娟赴 鞙勴暣 End Line攵�韯� 彀倦姅雼�)
 		FindEndLine(iThread, emDim, stFrame);
 
+		bool bIsRipSide = (emDim == DIMENSION_A_RIP || emDim == DIMENSION_B_RIP || emDim == DIMENSION_C_RIP || emDim == DIMENSION_D_RIP);
+		if (bIsRipSide) {
+			CRIP_THICKNESS_PARM& rip = m_pRecipe->m_SideParam[emDim].m_RipThk;
+			return TRUE;
+		}
+
 		// 2. Find Side Line.. (頃措嫻 頂勲爤鞛勳棎靹� Corner/Notch 毳� 鞝滌櫢頃� Side 霛检澑 彀娟赴)
 #if USE_AI_DETECT
 		FindSideLine(iThread, emDim, stFrame);
diff --git a/EdgeInspector_App/Recipe/GlassRecipe.cpp b/EdgeInspector_App/Recipe/GlassRecipe.cpp
index 95dbbc7..0d97f36 100644
--- a/EdgeInspector_App/Recipe/GlassRecipe.cpp
+++ b/EdgeInspector_App/Recipe/GlassRecipe.cpp
@@ -553,6 +553,8 @@
 	m_nUserDefectAreaCount = 0;
 	for(int i=0; i<MAX_SIDE_USER_DEFECT_AREA_COUNT; i++)
 		m_UserDefectPrm[i].Reset();
+
+	m_RipThk.Reset();
 }
 
 BOOL CSIDE_PARM::ReadRecipe(CConfig *pFile, int nSideIdx)
@@ -1705,3 +1707,106 @@
 
 	return TRUE;
 }
+
+void CRIP_THICKNESS_PARM::Reset()
+{
+	m_bUseInspect = FALSE;
+	m_nLeftThres = m_nRightThres = m_nGlassThres = 0;
+	m_nRipDir = 0;
+	m_nRectLeft = m_nRectRight = 0;
+	m_nTopOffset = m_nBottomOffset = 0;
+
+	m_nGlassSizeMin_um = 0;  m_nGlassSizeMax_um = 0;
+	m_nLeftRipSizeMin_um = 0; m_nLeftRipSizeMax_um = 0;
+	m_nRightRipSizeMin_um = 0; m_nRightRipSizeMax_um = 0;
+}
+
+BOOL CRIP_THICKNESS_PARM::ReadRecipe(CConfig* pFile, int nSideIdx)
+{
+	if (!pFile) {
+		return FALSE;
+	}
+
+	if (nSideIdx < 0 || nSideIdx >= MAX_SIDE_COUNT) {
+		return FALSE;
+	}
+
+	CString k;
+	k = _T("RipThk_m_bUseInspect");
+	pFile->GetItemValue(nSideIdx, k, m_bUseInspect, 0);
+	k = _T("RipThk_m_nLeftThres");
+	pFile->GetItemValue(nSideIdx, k, m_nLeftThres, 0);
+	k = _T("RipThk_m_nRightThres");
+	pFile->GetItemValue(nSideIdx, k, m_nRightThres, 0);
+	k = _T("RipThk_m_nGlassThres");
+	pFile->GetItemValue(nSideIdx, k, m_nGlassThres, 0);
+	k = _T("RipThk_m_nRipDir");
+	pFile->GetItemValue(nSideIdx, k, m_nRipDir, 2);
+	k = _T("RipThk_m_nRectLeft");
+	pFile->GetItemValue(nSideIdx, k, m_nRectLeft, 0);
+	k = _T("RipThk_m_nTopOffset");
+	pFile->GetItemValue(nSideIdx, k, m_nTopOffset, 0);
+	k = _T("RipThk_m_nRectRight");
+	pFile->GetItemValue(nSideIdx, k, m_nRectRight, 0);
+	k = _T("RipThk_m_nBottomOffset");
+	pFile->GetItemValue(nSideIdx, k, m_nBottomOffset, 0);
+	k = _T("RipThk_m_nGlassSizeMin_um");
+	pFile->GetItemValue(nSideIdx, k, m_nGlassSizeMin_um, 0);
+	k = _T("RipThk_m_nGlassSizeMax_um");
+	pFile->GetItemValue(nSideIdx, k, m_nGlassSizeMax_um, 0);
+	k = _T("RipThk_m_nLeftRipSizeMin_um");
+	pFile->GetItemValue(nSideIdx, k, m_nLeftRipSizeMin_um, 0);
+	k = _T("RipThk_m_nLeftRipSizeMax_um");
+	pFile->GetItemValue(nSideIdx, k, m_nLeftRipSizeMax_um, 0);
+	k = _T("RipThk_m_nRightRipSizeMin_um");
+	pFile->GetItemValue(nSideIdx, k, m_nRightRipSizeMin_um, 0);
+	k = _T("RipThk_m_nRightRipSizeMax_um");
+	pFile->GetItemValue(nSideIdx, k, m_nRightRipSizeMax_um, 0);
+
+	return TRUE;
+}
+
+BOOL CRIP_THICKNESS_PARM::WriteRecipe(CConfig* pFile, int nSideIdx)
+{
+	if (!pFile) { 
+		return FALSE;
+	}
+
+	if (nSideIdx < 0 || nSideIdx >= MAX_SIDE_COUNT) { 
+		return FALSE;
+	}
+
+	CString k;
+	k = _T("RipThk_m_bUseInspect");
+	pFile->SetItemValue(nSideIdx, k, m_bUseInspect);
+	k = _T("RipThk_m_nLeftThres");
+	pFile->SetItemValue(nSideIdx, k, m_nLeftThres);
+	k = _T("RipThk_m_nRightThres");
+	pFile->SetItemValue(nSideIdx, k, m_nRightThres);
+	k = _T("RipThk_m_nGlassThres");
+	pFile->SetItemValue(nSideIdx, k, m_nGlassThres);
+	k = _T("RipThk_m_nRipDir");
+	pFile->SetItemValue(nSideIdx, k, m_nRipDir);
+	k = _T("RipThk_m_nRectLeft");
+	pFile->SetItemValue(nSideIdx, k, m_nRectLeft);
+	k = _T("RipThk_m_nTopOffset");
+	pFile->SetItemValue(nSideIdx, k, m_nTopOffset);
+	k = _T("RipThk_m_nRectRight");
+	pFile->SetItemValue(nSideIdx, k, m_nRectRight);
+	k = _T("RipThk_m_nBottomOffset");
+	pFile->SetItemValue(nSideIdx, k, m_nBottomOffset);
+	k = _T("RipThk_m_nGlassSizeMin_um");
+	pFile->SetItemValue(nSideIdx, k, m_nGlassSizeMin_um);
+	k = _T("RipThk_m_nGlassSizeMax_um");
+	pFile->SetItemValue(nSideIdx, k, m_nGlassSizeMax_um);
+	k = _T("RipThk_m_nLeftRipSizeMin_um");
+	pFile->SetItemValue(nSideIdx, k, m_nLeftRipSizeMin_um);
+	k = _T("RipThk_m_nLeftRipSizeMax_um");
+	pFile->SetItemValue(nSideIdx, k, m_nLeftRipSizeMax_um);
+	k = _T("RipThk_m_nRightRipSizeMin_um");
+	pFile->SetItemValue(nSideIdx, k, m_nRightRipSizeMin_um);
+	k = _T("RipThk_m_nRightRipSizeMax_um");
+	pFile->SetItemValue(nSideIdx, k, m_nRightRipSizeMax_um);
+
+	return TRUE;
+}
\ No newline at end of file
diff --git a/EdgeInspector_App/Recipe/GlassRecipe.h b/EdgeInspector_App/Recipe/GlassRecipe.h
index 4a432a8..925e993 100644
--- a/EdgeInspector_App/Recipe/GlassRecipe.h
+++ b/EdgeInspector_App/Recipe/GlassRecipe.h
@@ -318,6 +318,33 @@
 	int		m_nJudge_Size_Min_OR_AND;	// 0 : No Use, 1 : OR, 2 : AND
 };
 
+// RIP Thickness
+struct CRIP_THICKNESS_PARM
+{
+	// Inspect
+	BOOL m_bUseInspect = FALSE;
+	int  m_nLeftThres = 0;
+	int  m_nRightThres = 0;
+	int  m_nGlassThres = 0;
+	int  m_nRipDir = 0;				// 0:L 1:R 2:L+R
+	int  m_nRectLeft = 0;			// Inspect Rect L
+	int  m_nTopOffset = 0;			// Inspect Top Offset
+	int  m_nRectRight = 0;			// Inspect Rect R
+	int  m_nBottomOffset = 0;       // Inspect Bottom Offset
+
+	// Judgement
+	int  m_nGlassSizeMin_um = 0;
+	int  m_nGlassSizeMax_um = 0;
+	int  m_nLeftRipSizeMin_um = 0;
+	int  m_nLeftRipSizeMax_um = 0;
+	int  m_nRightRipSizeMin_um = 0;
+	int  m_nRightRipSizeMax_um = 0;
+
+	void Reset();
+	BOOL ReadRecipe(CConfig* pFile, int nSideIdx);
+	BOOL WriteRecipe(CConfig* pFile, int nSideIdx);
+};
+
 class CSIDE_PARM
 {	
 public:
@@ -453,6 +480,9 @@
 	// User Defect
 	int						m_nUserDefectAreaCount;
 	CUSER_DEFECT_AREA_PARM	m_UserDefectPrm[MAX_SIDE_USER_DEFECT_AREA_COUNT];
+
+	// Rip Thickness
+	CRIP_THICKNESS_PARM		m_RipThk;
 };
 
 class CGlassRecipe
diff --git a/EdgeInspector_App/View/ViewMain_ScanImage.cpp b/EdgeInspector_App/View/ViewMain_ScanImage.cpp
index b20660d..cebf8b4 100644
--- a/EdgeInspector_App/View/ViewMain_ScanImage.cpp
+++ b/EdgeInspector_App/View/ViewMain_ScanImage.cpp
@@ -945,7 +945,7 @@
 BOOL CViewMain_ScanImage::ManualThreadStart(int nCmd,int nIndex /*= -1*/)
 {
 	if(m_pManualProcess) {
-		DWORD dwWait = ::WaitForSingleObject(m_pManualProcess->m_hThread, 1000);
+		DWORD dwWait = ::WaitForSingleObject(m_pManualProcess->m_hThread, 3000);
 		if (dwWait == WAIT_TIMEOUT) {
 			DWORD dwExitCode;
 			if ((::GetExitCodeThread(m_pManualProcess->m_hThread, &dwExitCode)) && (dwExitCode == STILL_ACTIVE)) {
diff --git a/EdgeInspector_App/ViewMain_Recipe.cpp b/EdgeInspector_App/ViewMain_Recipe.cpp
index 6cd32ce..454f6e0 100644
--- a/EdgeInspector_App/ViewMain_Recipe.cpp
+++ b/EdgeInspector_App/ViewMain_Recipe.cpp
@@ -182,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)
@@ -1199,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);
 
@@ -1649,6 +1656,9 @@
 	case eRcp_InsType_BotCorner :
 		nRows = 14;
 		break;
+	case eRcp_InsType_RipThickness:
+		nRows = 10;
+		break;
 	default:
 		break;
 	}
@@ -1825,6 +1835,47 @@
 			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);
+
+		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);
@@ -1858,6 +1909,9 @@
 	case eRcp_InsType_TopCorner :
 	case eRcp_InsType_BotCorner :
 		nRows = 11;
+		break;
+	case eRcp_InsType_RipThickness:
+		nRows = 7;
 		break;
 	default:
 		break;
@@ -2008,6 +2062,40 @@
 
 		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 Size Min um"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("Glass Size Max um"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("Left Rip Size Min um"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("Left Rip Size Max um"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("Right Rip Size Min um"), g_strInsType[m_eSelectInsType]);
+		vecParams.push_back(strTemp);
+		strTemp.Format(_T("Right Rip Size Max um"), 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]);
@@ -2471,6 +2559,55 @@
 				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);
+			}
 		}
 
 		m_SideInspectInfo.Invalidate();
@@ -2639,10 +2776,49 @@
 				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);
+			}
 		}
 	}
 }
-
 
 void CViewMain_Recipe::Fill_JudgementInfo(BOOL bGetData)
 {
@@ -2791,6 +2967,40 @@
 				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);
+			}
 		}
 
 		m_JudgementInfo.Invalidate();
@@ -2907,6 +3117,34 @@
 				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);
+			}
 		}
 	}
 }
@@ -2939,11 +3177,9 @@
 {
 	UINT nID = GetFocus()->GetDlgCtrlID();
 
-	SetSideRadioExclusive(nID);
-
 	UpdateRecipe(TRUE);
-
 	ChangViewCdmSide(nID);
+	RefreshRadioStates();
 }
 
 
@@ -2951,10 +3187,10 @@
 {
 	UINT nID = GetFocus()->GetDlgCtrlID();
 
-	Fill_SideInsInfo(TRUE);	// Get Data..
+	Fill_SideInsInfo(TRUE);
 	Fill_JudgementInfo(TRUE);
-
 	ChangInsTypeSide(nID);
+	RefreshRadioStates();
 }
 
 void CViewMain_Recipe::ClickButtonLang()
@@ -3260,17 +3496,69 @@
 #endif // HALCON_VISION_KEY
 }
 
-void CViewMain_Recipe::SetSideRadioExclusive(UINT nSelId)
+void CViewMain_Recipe::RefreshRadioStates()
 {
-	static const UINT kIds[] = {
+	// 鍐呴儴鏄犲皠 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
 	};
 
-	for (UINT id : kIds) {
-		if (CButton* p = (CButton*)GetDlgItem(id)) {
-			p->SetCheck(id == nSelId ? 1 : 0);
+	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
diff --git a/EdgeInspector_App/ViewMain_Recipe.h b/EdgeInspector_App/ViewMain_Recipe.h
index a48ae7a..18b965b 100644
--- a/EdgeInspector_App/ViewMain_Recipe.h
+++ b/EdgeInspector_App/ViewMain_Recipe.h
@@ -81,7 +81,7 @@
 	BOOL			WriteLinkFile(CString strFilePath);
 	void			ChangeRecipe();
 	BOOL			ReadRecipe(CString strRecipe);
-	void			SetSideRadioExclusive(UINT nSelId);
+	void			RefreshRadioStates();
 
 public:
 	void			UpdateRecipe(BOOL bGetData, int type = 0);
diff --git a/EdgeInspector_App/resource.h b/EdgeInspector_App/resource.h
index 9d5857a..4d52072 100644
--- a/EdgeInspector_App/resource.h
+++ b/EdgeInspector_App/resource.h
@@ -581,26 +581,26 @@
 #define IDC_RDO_SIDE_B_BOT              1814
 #define IDC_RDO_SIDE_C_BOT              1815
 #define IDC_RDO_SIDE_D_BOT              1816
-#define IDC_RDO_INSTYPE_CHIPCRACK       1817
-#define IDC_RDO_INSTYPE_CHIP            1817
-#define IDC_RDO_INSTYPE_BURR            1818
-#define IDC_RDO_INSTYPE_BURR2           1819
-#define IDC_RDO_INSTYPE_CHAMFER         1819
-#define IDC_RDO_INSTYPE_TOP_CORNER      1820
-#define IDC_RDO_INSTYPE_BOT_CORNER      1821
-#define IDC_RDO_INSTYPE_CRACK           1822
-#define IDC_RDO_SIDE_A_RIP              1823
-#define IDC_RDO_SIDE_B_RIP              1824
-#define IDC_RDO_INSTYPE_CF_CHIPCRACK    1825
-#define IDC_RDO_INSTYPE_IN_CHIP         1825
-#define IDC_RDO_INSTYPE_CF_BURR         1826
-#define IDC_RDO_INSTYPE_IN_BURR         1826
-#define IDC_RDO_INSTYPE_IN_CRACK        1827
-#define IDC_RDO_INSTYPE_IN_BURR2        1828
-#define IDC_RDO_INSTYPE_IN_CHAMFER      1828
-#define IDC_RDO_SIDE_C_RIP              1829
-#define IDC_RDO_SIDE_D_BOT2             1830
-#define IDC_RDO_SIDE_D_RIP              1830
+#define IDC_RDO_SIDE_A_RIP              1817
+#define IDC_RDO_SIDE_B_RIP              1818
+#define IDC_RDO_SIDE_C_RIP              1819
+#define IDC_RDO_SIDE_D_RIP              1820
+#define IDC_RDO_INSTYPE_CHIPCRACK       1821
+#define IDC_RDO_INSTYPE_CHIP            1822
+#define IDC_RDO_INSTYPE_BURR            1823
+#define IDC_RDO_INSTYPE_BURR2           1824
+#define IDC_RDO_INSTYPE_CHAMFER         1825
+#define IDC_RDO_INSTYPE_TOP_CORNER      1826
+#define IDC_RDO_INSTYPE_BOT_CORNER      1827
+#define IDC_RDO_INSTYPE_CRACK           1828
+#define IDC_RDO_INSTYPE_CF_CHIPCRACK    1829
+#define IDC_RDO_INSTYPE_IN_CHIP         1830
+#define IDC_RDO_INSTYPE_CF_BURR         1831
+#define IDC_RDO_INSTYPE_IN_BURR         1832
+#define IDC_RDO_INSTYPE_IN_CRACK        1833
+#define IDC_RDO_INSTYPE_IN_CHAMFER      1834
+#define IDC_RDO_INSTYPE_RIP_THICKNESS   1835
+#define IDC_RDO_INSTYPE_RIP_THICKNESS2  1860
 #define ID_PROFILE_CHECKALL             32782
 #define ID_PROFILE_CLEARALL             32783
 #define ID_PROFILE_CURRENTX             32784

--
Gitblit v1.9.3