From 50ac8b007a5adcac5e6b84e0ed903c2cc0fff8c6 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期六, 16 八月 2025 17:11:56 +0800
Subject: [PATCH] 1. 还原离线全部执行

---
 EdgeInspector_App/MainFrm.cpp |  126 +++++++++++++++++++++--------------------
 1 files changed, 65 insertions(+), 61 deletions(-)

diff --git a/EdgeInspector_App/MainFrm.cpp b/EdgeInspector_App/MainFrm.cpp
index 3581f3b..cdb31fa 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, 3000);
+			pMain->Simulate2PhaseScanByDirs(vecDirs, 1000);
 		}
 		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, 3000);
+			pMain->Simulate2PhaseScanByDirs(vecDirs, 1000);
 		}
 		break;
 	case PROC_MODE_SIMULATION_SIDELONG:
@@ -449,25 +449,44 @@
 			std::vector<DimensionDir> vecDirs = {
 				DIMENSION_A, DIMENSION_C, DIMENSION_A_DN, DIMENSION_C_DN
 			};
-			pMain->Simulate2PhaseScanByDirs(vecDirs, 3000);
+			pMain->Simulate2PhaseScanByDirs(vecDirs, 1000);
 		}
 		break;
 	case PROC_MODE_SIMULATION_ALL:
 		{
-			if (pMain->m_HardwareRecipe.m_bUseRipInspection) {
-				std::vector<DimensionDir> vecDirs = {
-					DIMENSION_A, DIMENSION_C, DIMENSION_A_DN, DIMENSION_C_DN,
-					DIMENSION_B, DIMENSION_D, DIMENSION_B_DN, DIMENSION_D_DN,
-					DIMENSION_A_RIP, DIMENSION_B_RIP, DIMENSION_C_RIP, DIMENSION_D_RIP
-				};
-				pMain->Simulate2PhaseScanByDirs(vecDirs, 3000);
+			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);
 			}
-			else {
-				std::vector<DimensionDir> vecDirs = {
-					DIMENSION_A, DIMENSION_C, DIMENSION_A_DN, DIMENSION_C_DN,
-					DIMENSION_B, DIMENSION_D, DIMENSION_B_DN, DIMENSION_D_DN
-				};
-				pMain->Simulate2PhaseScanByDirs(vecDirs, 3000);
+
+			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);
 			}
 		}
 		break;
@@ -478,17 +497,13 @@
 
 BOOL CMainFrame::IV2M_InspectionProcess(DimensionDir eDim)
 {
-	if(IsScanNow())
-	{
+	if(IsScanNow()) {
 		g_pLog->DisplayMessage(_T("Doing Inspection"));
 		return FALSE;
 	}
 
 	g_pBase->m_eProcessMode = PROC_MODE_SIMULATION_ONESIDE;
 	m_eManualInspectSide = eDim;
-
-	// 鐑欑煫鑲� 闃滄緶
-	//return TRUE;
 
 	AfxBeginThread(ManualInspectProcess,this);
 
@@ -497,30 +512,20 @@
 
 void CMainFrame::MLight_OnOff(int iCon,int iCh,BOOL bValue)
 {
-	// 	if(IsScanNow())
-	// 	{
-	// 		g_pLog->DisplayMessage(_T("Doing Inspection"));
-	// 		return;
-	// 	}
-
-	if(m_pLightManager == NULL)
+	if (m_pLightManager == NULL) {
 		return;
+	}
 
 	m_pLightManager->LampTurnOnOff(iCon, iCh, bValue);
 }
 
 BOOL CMainFrame::MLight_SetLightControlValue(int iCon,int iCh, int nValue, BOOL bRef, int nScanIdx, BOOL bAdjLight)
 {
-	// 	if(IsScanNow())
-	// 	{
-	// 		g_pLog->DisplayMessage(_T("Doing Inspection"));
-	// 		return TRUE;
-	// 	}
-
-	if(m_pLightManager == NULL)
+	if (m_pLightManager == NULL) {
 		return FALSE;
+	}
 
-	BOOL	bRet = m_pLightManager->SetLightControlValue(iCon, iCh, nValue);
+	BOOL bRet = m_pLightManager->SetLightControlValue(iCon, iCh, nValue);
 
 	return bRet;
 }
@@ -745,6 +750,16 @@
 	SendGlassRecipe();
 
 	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);
@@ -752,36 +767,25 @@
 		}
 
 		// 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);
-			}
+		for (const auto& cs : phase0) {
+			ScanStartManual(cs.cam, 0);
 		}
 
-		if (!phase0.empty() && !phase1.empty()) {
-			DWORD sTime = GetTickCount();
-			while (TRUE) {
-				if (m_GlassData.GetScanEnd(0) == TRUE) {
-					break;
-				}
-
-				if (GetTickCount() - sTime > 5000) {
-					break;
-				}
-
-				Sleep(10);
+		DWORD sTime = GetTickCount();
+		while (TRUE) {
+			if (m_GlassData.GetScanEnd(0) == TRUE) {
+				break;
 			}
 
-			// 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);
-				}
+			if (GetTickCount() - sTime > 5000) {
+				break;
 			}
+
+			Sleep(10);
+		}
+
+		for (const auto& cs : phase1) {
+			ScanStartManual(cs.cam, 1);
 		}
 	}
 	else {

--
Gitblit v1.9.3