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/MainFrm.h                   |    2 
 EdgeInspector_App/MainFrm.cpp                 |   61 +++++++++---------------------
 EdgeInspector_App/View/ViewMain_ScanImage.cpp |    2 
 3 files changed, 21 insertions(+), 44 deletions(-)

diff --git a/EdgeInspector_App/MainFrm.cpp b/EdgeInspector_App/MainFrm.cpp
index cdb31fa..ec0566d 100644
--- a/EdgeInspector_App/MainFrm.cpp
+++ b/EdgeInspector_App/MainFrm.cpp
@@ -433,7 +433,7 @@
 			std::vector<DimensionDir> vecDirs = {
 				DIMENSION_A_RIP, DIMENSION_B_RIP, DIMENSION_C_RIP, DIMENSION_D_RIP
 			};
-			pMain->Simulate2PhaseScanByDirs(vecDirs, 1000);
+			pMain->Simulate2PhaseScanByDirs(vecDirs);
 		}
 		break;
 	case PROC_MODE_SIMULATION_SIDESHORT:
@@ -441,7 +441,7 @@
 			std::vector<DimensionDir> vecDirs = {
 				DIMENSION_B, DIMENSION_D, DIMENSION_B_DN, DIMENSION_D_DN
 			};
-			pMain->Simulate2PhaseScanByDirs(vecDirs, 1000);
+			pMain->Simulate2PhaseScanByDirs(vecDirs);
 		}
 		break;
 	case PROC_MODE_SIMULATION_SIDELONG:
@@ -449,44 +449,25 @@
 			std::vector<DimensionDir> vecDirs = {
 				DIMENSION_A, DIMENSION_C, DIMENSION_A_DN, DIMENSION_C_DN
 			};
-			pMain->Simulate2PhaseScanByDirs(vecDirs, 1000);
+			pMain->Simulate2PhaseScanByDirs(vecDirs);
 		}
 		break;
 	case PROC_MODE_SIMULATION_ALL:
 		{
-			g_pLog->DisplayMessage(_T("Simulation Full "));
-			pMain->m_GlassData.SetScanStartCount(MAX_DIMENSION_COUNT);
-			pMain->SendGlassRecipe();
-			for (iCam = 0; iCam < MAX_CAMERA_COUNT; iCam++) {
-				pMain->ScanStartGrabManual(iCam, 0);
-				pMain->ScanStartGrabManual(iCam, 1);
+			if (pMain->m_HardwareRecipe.m_bUseRipInspection) {
+				std::vector<DimensionDir> vecDirs = {
+					DIMENSION_A, DIMENSION_B, DIMENSION_C, DIMENSION_D,
+					DIMENSION_A_DN, DIMENSION_B_DN, DIMENSION_C_DN, DIMENSION_D_DN,
+					DIMENSION_A_RIP, DIMENSION_B_RIP, DIMENSION_C_RIP, DIMENSION_D_RIP
+				};
+				pMain->Simulate2PhaseScanByDirs(vecDirs);
 			}
-
-			if (pMain->m_pThread_CheckSequence != NULL) {
-				double dOneScanTime = pMain->m_GlassRecipe.m_RecieParm.m_dOneScanTime_sec;
-				pMain->m_pThread_CheckSequence->AddCheckSeqMSG(CHECKSEQ_GLASS_INSPECTION_OVERTIME, (int)(dOneScanTime * 1000.), pMain->m_HardwareRecipe.GetScanCount() - 1);
-				g_pLog->DisplayMessage(_T("Simulation Time Out Set : %.1f"), dOneScanTime);
-			}
-
-			for (iCam = 0; iCam < MAX_CAMERA_COUNT; iCam++) {
-				pMain->ScanStartManual(iCam, 0);
-			}
-
-			DWORD sTime = GetTickCount();
-			while (TRUE) {
-				if (pMain->m_GlassData.GetScanEnd(0) == TRUE) {
-					break;
-				}
-
-				if (GetTickCount() - sTime > 5000) {
-					break;
-				}
-
-				Sleep(10);
-			}
-
-			for (iCam = 0; iCam < MAX_CAMERA_COUNT; iCam++) {
-				pMain->ScanStartManual(iCam, 1);
+			else {
+				std::vector<DimensionDir> vecDirs = {
+					DIMENSION_A, DIMENSION_B, DIMENSION_C, DIMENSION_D,
+					DIMENSION_A_DN, DIMENSION_B_DN, DIMENSION_C_DN, DIMENSION_D_DN
+				};
+				pMain->Simulate2PhaseScanByDirs(vecDirs);
 			}
 		}
 		break;
@@ -706,7 +687,7 @@
 	WriteLogManager(str);
 }
 
-void CMainFrame::Simulate2PhaseScanByDirs(const std::vector<DimensionDir>& vDirs, int nTimeoutMs /*=0 琛ㄧず鍙栭厤鏂规椂闂�*/)
+void CMainFrame::Simulate2PhaseScanByDirs(const std::vector<DimensionDir>& vDirs)
 {
 	struct SCamScan { int cam; int scan; };
 
@@ -748,21 +729,19 @@
 	}
 
 	SendGlassRecipe();
-
+	m_GlassData.SetScanStartCount((int)vDirs.size());
 	if (!phase0.empty() && !phase1.empty()) {
-		m_GlassData.SetScanStartCount((int)phase0.size());
 		for (const auto& cs : phase0) {
 			ScanStartGrabManual(cs.cam, 0);
 		}
 
-		m_GlassData.SetScanStartCount((int)phase1.size());
 		for (const auto& cs : phase1) {
 			ScanStartGrabManual(cs.cam, 1);
 		}
 
 		if (m_pThread_CheckSequence != NULL) {
 			double dOneScanTime = m_GlassRecipe.m_RecieParm.m_dOneScanTime_sec;
-			m_pThread_CheckSequence->AddCheckSeqMSG(CHECKSEQ_GLASS_INSPECTION_OVERTIME, (int)(dOneScanTime * nTimeoutMs), m_HardwareRecipe.GetScanCount() - 1);
+			m_pThread_CheckSequence->AddCheckSeqMSG(CHECKSEQ_GLASS_INSPECTION_OVERTIME, (int)(dOneScanTime * 1000), m_HardwareRecipe.GetScanCount() - 1);
 			g_pLog->DisplayMessage(_T("Simulation Time Out Set : %.1f"), dOneScanTime);
 		}
 
@@ -791,7 +770,6 @@
 	else {
 		// nScan == 0
 		if (!phase0.empty()) {
-			m_GlassData.SetScanStartCount((int)phase0.size());
 			for (const auto& cs : phase0) {
 				ScanStartGrabManual(cs.cam, cs.scan);
 				ScanStartManual(cs.cam, cs.scan);
@@ -800,7 +778,6 @@
 
 		// nScan == 1
 		if (!phase1.empty()) {
-			m_GlassData.SetScanStartCount((int)phase1.size());
 			for (const auto& cs : phase1) {
 				ScanStartGrabManual(cs.cam, cs.scan);
 				ScanStartManual(cs.cam, cs.scan);
diff --git a/EdgeInspector_App/MainFrm.h b/EdgeInspector_App/MainFrm.h
index 19b48b8..8ffab1b 100644
--- a/EdgeInspector_App/MainFrm.h
+++ b/EdgeInspector_App/MainFrm.h
@@ -57,7 +57,7 @@
 
 public:
 	void				SetView(CEdgeInspector_AppView	*pView);
-	void				Simulate2PhaseScanByDirs(const std::vector<DimensionDir>& vDirs, int nTimeoutMs = 0);
+	void				Simulate2PhaseScanByDirs(const std::vector<DimensionDir>& vDirs);
 
 protected:
 	void				KillProcessByName(LPCTSTR lpProcessName);
diff --git a/EdgeInspector_App/View/ViewMain_ScanImage.cpp b/EdgeInspector_App/View/ViewMain_ScanImage.cpp
index 2e50ca6..874a1ef 100644
--- a/EdgeInspector_App/View/ViewMain_ScanImage.cpp
+++ b/EdgeInspector_App/View/ViewMain_ScanImage.cpp
@@ -949,7 +949,7 @@
 BOOL CViewMain_ScanImage::ManualThreadStart(int nCmd,int nIndex /*= -1*/)
 {
 	if(m_pManualProcess) {
-		DWORD dwWait = ::WaitForSingleObject(m_pManualProcess->m_hThread, 3000);
+		DWORD dwWait = ::WaitForSingleObject(m_pManualProcess->m_hThread, 1000);
 		if (dwWait == WAIT_TIMEOUT) {
 			DWORD dwExitCode;
 			if ((::GetExitCodeThread(m_pManualProcess->m_hThread, &dwExitCode)) && (dwExitCode == STILL_ACTIVE)) {

--
Gitblit v1.9.3