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/Recipe/HardwareSettings.cpp |  198 +++++++++++++++++++++++++++++++++++--------------
 1 files changed, 142 insertions(+), 56 deletions(-)

diff --git a/EdgeInspector_App/Recipe/HardwareSettings.cpp b/EdgeInspector_App/Recipe/HardwareSettings.cpp
index 4cfde21..a4f1357 100644
--- a/EdgeInspector_App/Recipe/HardwareSettings.cpp
+++ b/EdgeInspector_App/Recipe/HardwareSettings.cpp
@@ -991,7 +991,7 @@
 {
 	if(this != &rhs)
 	{
-		int				iLoop;
+		int	iLoop;
 
 		Reset();
 		m_nLightCount_Trans = rhs.m_nLightCount_Trans;
@@ -1009,10 +1009,12 @@
 
 		m_strMachineName = rhs.m_strMachineName;
 		m_strLineID = rhs.m_strLineID;
-		m_nPLCSignalRetry = rhs.m_nPLCSignalRetry;		
-		m_nSaveImageQuality = rhs.m_nSaveImageQuality;
+		m_nPLCSignalRetry = rhs.m_nPLCSignalRetry;
 
-		//		m_dOneScanTime = rhs.m_dOneScanTime;
+		m_nSaveImageQuality = rhs.m_nSaveImageQuality;
+		m_bAsyncFullSave = rhs.m_bAsyncFullSave;
+
+		// m_dOneScanTime = rhs.m_dOneScanTime;
 		m_nFolderRemoveDay = rhs.m_nFolderRemoveDay;
 
 		m_PLCSettings = rhs.m_PLCSettings;
@@ -1034,6 +1036,9 @@
 		// ly,2025.07.10
 		m_bSaveResultByHour = rhs.m_bSaveResultByHour;
 
+		// ly,2025.08.14
+		m_bUseRipInspection = rhs.m_bUseRipInspection;
+
 		// ly,2025.07.07
 		m_bEnableAutoCopy = rhs.m_bEnableAutoCopy;
 		m_strCopyToolExePath = rhs.m_strCopyToolExePath;
@@ -1047,7 +1052,7 @@
 
 void CHardwareSettings::Reset()
 {		
-	//	m_dOneScanTime = 0.;
+	// m_dOneScanTime = 0.;
 	m_nLightCount_Trans = 0;	
 	m_nLightCount_Reflect = 0;	
 	m_nCameraCount = 0;
@@ -1055,6 +1060,7 @@
 	m_nFolderRemoveDay = 0;
 	m_nPLCSignalRetry = 0;
 	m_nSaveImageQuality = 30;
+	m_bAsyncFullSave = FALSE;
 	m_strMachineName = _T("");
 	m_strLineID = _T("");
 	m_nBoardType = GRAB_LINK_BOARD;
@@ -1277,10 +1283,16 @@
 		str = _T("SAVE_DEBUG_IMAGE");
 	else if((void *)&m_nSaveImageQuality == pValue)
 		str = _T("SAVEIMAGE_QUALITY");
+	else if ((void*)&m_bAsyncFullSave == pValue)
+		str = _T("ASYNC_FULL_SAVE");
 
 	// ly,2025.07.10
 	else if ((void*)&m_bSaveResultByHour == pValue)
 		str = _T("SAVE_RESULT_BY_HOUR");
+
+	// ly,2025.08.14
+	else if ((void*)&m_bUseRipInspection == pValue)
+		str = _T("USE_RIP_INSPECTION");
 
 	// ly,2025.07.07
 	else if ((void*)&m_bEnableAutoCopy == pValue)
@@ -1374,6 +1386,10 @@
 		return FALSE;
 	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str,m_nSaveImageQuality,30);	
 	
+	str = GetFileString((void*)&m_bAsyncFullSave);
+	if (str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str, m_bAsyncFullSave, FALSE);
 
 	SetCameraCount(m_nCameraCount,m_nScanCount);
 	iLoop = 0;
@@ -1451,6 +1467,12 @@
 	if (str.IsEmpty() == TRUE)
 		return FALSE;
 	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str, m_bSaveResultByHour, FALSE);
+
+	// ly,2025.08.14
+	str = GetFileString((void*)&m_bUseRipInspection);
+	if (str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str, m_bUseRipInspection, FALSE);
 
 	// ly,2025.07.07
 	str = GetFileString((void*)&m_bEnableAutoCopy);
@@ -1554,7 +1576,12 @@
 	str = GetFileString((void *)&m_nSaveImageQuality);
 	if(str.IsEmpty() == TRUE)
 		return FALSE;
-	Register.GetItemValue((TCHAR*)(LPCTSTR)str,m_nSaveImageQuality,30);	
+	Register.GetItemValue((TCHAR*)(LPCTSTR)str,m_nSaveImageQuality,30);
+
+	str = GetFileString((void*)&m_bAsyncFullSave);
+	if (str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.GetItemValue((TCHAR*)(LPCTSTR)str, m_bAsyncFullSave, FALSE);
 
 	SetCameraCount(m_nCameraCount,m_nScanCount);
 	iLoop = 0;
@@ -1631,6 +1658,12 @@
 	if (str.IsEmpty() == TRUE)
 		return FALSE;
 	Register.GetItemValue((TCHAR*)(LPCTSTR)str, m_bSaveResultByHour, FALSE);
+
+	// ly,2025.08.14
+	str = GetFileString((void*)&m_bUseRipInspection);
+	if (str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.GetItemValue((TCHAR*)(LPCTSTR)str, m_bUseRipInspection, FALSE);
 
 	// ly,2025.07.07
 	str = GetFileString((void*)&m_bEnableAutoCopy);
@@ -1719,6 +1752,11 @@
 		return FALSE;
 	Register.SetItemValue((TCHAR*)(LPCTSTR)str,m_nSaveImageQuality);
 
+	str = GetFileString((void*)&m_bAsyncFullSave);
+	if (str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.SetItemValue((TCHAR*)(LPCTSTR)str, m_bAsyncFullSave);
+
 	if(m_pCameraSettings != NULL)
 	{
 		iLoop = 0;
@@ -1795,6 +1833,12 @@
 		return FALSE;
 	Register.SetItemValue((TCHAR*)(LPCTSTR)str, (int)m_bSaveResultByHour);
 
+	// ly,2025.08.14
+	str = GetFileString((void*)&m_bUseRipInspection);
+	if (str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.SetItemValue((TCHAR*)(LPCTSTR)str, (int)m_bUseRipInspection);
+
 	// ly,2025.07.07
 	str = GetFileString((void*)&m_bEnableAutoCopy);
 	if (str.IsEmpty() == TRUE)
@@ -1826,33 +1870,39 @@
 
 BOOL CHardwareSettings::WriteHardwareSettingsFile(CString strFilePath)
 {
-	CConfig		BasicInfoFile;
-	CString				str;
-	int					iCam,iScan,iLight,iLoop;	
+	g_pLog->DisplayMessage(_T("HWSettings Start writing hardware settings to file: %s"), strFilePath);
 
-	if(BasicInfoFile.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strFilePath, FileMap_Mode) == FALSE)
-	{
+	int	iCam, iScan, iLight, iLoop;
+
+	CConfig	BasicInfoFile;
+	if(BasicInfoFile.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strFilePath, FileMap_Mode) == FALSE) {
 		CFile File;
-		if (!File.Open((TCHAR*)(LPCTSTR)strFilePath, CFile::modeCreate))
-		{			
+		if (!File.Open((TCHAR*)(LPCTSTR)strFilePath, CFile::modeCreate)) {
+			DWORD dwErr = GetLastError();
+			g_pLog->DisplayMessage(_T("HWSettings failed | Path=%s | Error=%lu"), strFilePath, dwErr);
 			return FALSE;
 		}
 		File.Close();
 	}
 
+	CString	str;
 	str = GetFileString((void *)&m_nCameraCount);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
+
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nCameraCount);
 
 	str = GetFileString((void *)&m_nScanCount);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nScanCount);	
 
 	str = GetFileString((void *)&m_nBoardType);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nBoardType);	
 	
 	// 	str = GetFileString((void *)&m_dOneScanTime);
@@ -1861,140 +1911,176 @@
 	// 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_dOneScanTime);	
 
 	str = GetFileString((void *)&m_strMachineName);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
-	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,(TCHAR*)(LPCTSTR)m_strMachineName);	
+	}
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,(TCHAR*)(LPCTSTR)m_strMachineName);
 
 	str = GetFileString((void *)&m_strLineID);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
+
 		return FALSE;
-	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,(TCHAR*)(LPCTSTR)m_strLineID);	
+	}
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,(TCHAR*)(LPCTSTR)m_strLineID);
 
 	str = GetFileString((void *)&m_nPLCSignalRetry);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nPLCSignalRetry);	
 
 	str = GetFileString((void *)&m_bInsDirReverse);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_bInsDirReverse);
 
 	str = GetFileString((void *)&m_bUseColorVisual);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_bUseColorVisual);
 
 	str = GetFileString((void *)&m_nSaveImageQuality);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
-	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nSaveImageQuality);	
+	}
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nSaveImageQuality);
 
-	if(m_pCameraSettings != NULL)
-	{
+	str = GetFileString((void*)&m_bAsyncFullSave);
+	if (str.IsEmpty() == TRUE) {
+		return FALSE;
+	}
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str, m_bAsyncFullSave);
+
+	if (m_pCameraSettings != NULL) {
 		iLoop = 0;
-		for(iCam=0;iCam<m_nCameraCount;iCam++)
-		{
-			for(iScan=0;iScan<m_nScanCount;iScan++)
-			{
-				m_pCameraSettings[iLoop].WriteHardwareSettingsFile(&BasicInfoFile);	
+		for (iCam = 0; iCam < m_nCameraCount; iCam++) {
+			for (iScan = 0; iScan < m_nScanCount; iScan++) {
+				m_pCameraSettings[iLoop].WriteHardwareSettingsFile(&BasicInfoFile);
 				iLoop++;
 			}
 		}
 	}
 
 	str = GetFileString((void *)&m_nLightCount_Trans);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nLightCount_Trans);	
 
 	str = GetFileString((void *)&m_nLightCount_Reflect);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nLightCount_Reflect);
 
 	str = GetFileString((void *)&m_nFolderRemoveDay);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nFolderRemoveDay);
 
-	if(m_pLightSettings != NULL)
-	{		
-		for(iLight=0;iLight<m_nLightCount_Trans+m_nLightCount_Reflect;iLight++)
-		{
+	if (m_pLightSettings != NULL) {
+		for (iLight = 0; iLight < m_nLightCount_Trans + m_nLightCount_Reflect; iLight++) {
 			m_pLightSettings[iLight].WriteHardwareSettingsFile(&BasicInfoFile);
-		}		
+		}
 	}
 
 	m_PLCSettings.WriteHardwareSettingsFile(&BasicInfoFile);
-
 	m_SoftWareSettings.WriteHardwareSettingsFile(&BasicInfoFile);
 
-
 	str = GetFileString((void *)&m_bUseFreerun);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,(int) m_bUseFreerun);
 
 	str = GetFileString((void *)&m_nFreerunPeriod);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nFreerunPeriod);
 
 	str = GetFileString((void *)&m_nFreerunExposureTime);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nFreerunExposureTime);
 
 	str = GetFileString((void *)&m_bUse_MvsolTriggerControl);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_bUse_MvsolTriggerControl);
 
 	str = GetFileString((void *)&m_nPort_MvsolTriggerControl);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nPort_MvsolTriggerControl);
 
 	str = GetFileString((void *)&m_bUse_SaveDebugImage);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_bUse_SaveDebugImage);
 
 	// ly,2025.07.10
 	str = GetFileString((void*)&m_bSaveResultByHour);
-	if (str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str, (int)m_bSaveResultByHour);
+
+	// ly,2025.08.14
+	str = GetFileString((void*)&m_bUseRipInspection);
+	if (str.IsEmpty() == TRUE) {
+		return FALSE;
+	}
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str, (int)m_bUseRipInspection);
 
 	// ly,2025.07.07
 	str = GetFileString((void*)&m_bEnableAutoCopy);
-	if (str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str, (int)m_bEnableAutoCopy);
+
 	str = GetFileString((void*)&m_strCopyToolExePath);
-	if (str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str, m_strCopyToolExePath);
+
 	str = GetFileString((void*)&m_strCopyToolConfigPath);
-	if (str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str, m_strCopyToolConfigPath);
+
 	str = GetFileString((void*)&m_bEnableAutoDelete);
-	if (str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str, (int)m_bEnableAutoDelete);
+
 	str = GetFileString((void*)&m_strDeleteToolExePath);
-	if (str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
+
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str, m_strDeleteToolExePath);
 	str = GetFileString((void*)&m_strDeleteToolConfigPath);
-	if (str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
-	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str, m_strDeleteToolConfigPath);
+	}
 
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str, m_strDeleteToolConfigPath);
 	BasicInfoFile.WriteToFile();
 
+	g_pLog->DisplayMessage(_T("HWSettings Finished writing hardware settings file: %s"), strFilePath);
+
 	return TRUE;
 }
 

--
Gitblit v1.9.3