From 6bb39b058bce38f80645e1e54d03a172f74dba3b Mon Sep 17 00:00:00 2001
From: LYW <leeyeanwoo@diteam.co.kr>
Date: 금, 09 7월 2021 09:04:43 +0900
Subject: [PATCH] Ongoing100 #3495 CF AOI Review[QD, Blue] GlassLoading 시 다운 현상 조치

---
 ReviewSystem/ReviewSystem/DitGlassRawStruct.h                       |   32 ++++++++++++++++
 ReviewSystem/ReviewSystem/ReviewSystem.cpp                          |    1 
 ReviewSystem/ReviewSystem/ReviewInterface.cpp                       |   21 +++++++---
 ReviewSystem/ReviewSystem/ReviewProcessor_CPJT.cpp                  |   11 ++---
 ReviewSystem/ReviewSystem/MainFrm.cpp                               |    4 +-
 Internal_Library/CHCameraControl_Pylon/CHCameraControlPylon.vcxproj |    4 +-
 ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.cpp                |   24 ++++++++---
 Internal_Library/CHCameraControl_Pylon/CameraControl_Pylon.cpp      |    8 ++-
 ReviewSystem/CHAlignFinder/AlignFinder.cpp                          |    1 
 9 files changed, 79 insertions(+), 27 deletions(-)

diff --git a/Internal_Library/CHCameraControl_Pylon/CHCameraControlPylon.vcxproj b/Internal_Library/CHCameraControl_Pylon/CHCameraControlPylon.vcxproj
index 48fd050..b4d6568 100644
--- a/Internal_Library/CHCameraControl_Pylon/CHCameraControlPylon.vcxproj
+++ b/Internal_Library/CHCameraControl_Pylon/CHCameraControlPylon.vcxproj
@@ -136,7 +136,7 @@
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <AdditionalIncludeDirectories>$(MSBuildStartupDirectory)\Include;C:\Program Files\Basler\pylon 5\Development\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(MSBuildStartupDirectory)\Include;C:\Program Files\Basler\pylon 5\Development\include;C:\Program Files\Basler\pylon 4\pylon\include;C:\Program Files\Basler\pylon 4\genicam\library\cpp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <FunctionLevelLinking>true</FunctionLevelLinking>
@@ -150,7 +150,7 @@
       <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ResourceCompile>
     <Link>
-      <AdditionalLibraryDirectories>C:\Program Files\Basler\pylon 5\Development\lib\x64;$(MSBuildStartupDirectory)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>C:\Program Files\Basler\pylon 5\Development\lib\x64;$(MSBuildStartupDirectory)\lib;C:\Program Files\Basler\pylon 4\genicam\library\cpp\lib\win64_x64;C:\Program Files\Basler\pylon 4\pylon\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <ModuleDefinitionFile>
       </ModuleDefinitionFile>
       <GenerateDebugInformation>true</GenerateDebugInformation>
diff --git a/Internal_Library/CHCameraControl_Pylon/CameraControl_Pylon.cpp b/Internal_Library/CHCameraControl_Pylon/CameraControl_Pylon.cpp
index 18fa0fb..24691d4 100644
--- a/Internal_Library/CHCameraControl_Pylon/CameraControl_Pylon.cpp
+++ b/Internal_Library/CHCameraControl_Pylon/CameraControl_Pylon.cpp
@@ -64,13 +64,15 @@
 			//SetHeartbeatTimeout(10000); // set heartbeat
 			//if (controlInfo.GetCameraReverseX() == TRUE)//210614占쏙옙占싹론몌옙 占쏙옙占쏙옙占쏙옙 占쏙옙占� 占쏙옙占쏙옙
 			//{
-			//	m_pCamera->ReverseX = TRUE;
+			//	//m_pCamera->ReverseX = TRUE;
+			//	m_pCamera->ReverseX.SetValue(TRUE);
 			//}
 			//else
 			//{
-			//	m_pCamera->ReverseX = FALSE;
+			//	//m_pCamera->ReverseX = FALSE;
+			//	m_pCamera->ReverseX.SetValue(FALSE);
 			//}
-			
+
 			m_pCamera->SetCameraContext(m_nTotalIndex);///m_nCameraIndex); // set context
 
 			m_pCamera->MaxNumBuffer = m_nGrabCount;
diff --git a/ReviewSystem/CHAlignFinder/AlignFinder.cpp b/ReviewSystem/CHAlignFinder/AlignFinder.cpp
index 42eedaf..67d3d83 100644
--- a/ReviewSystem/CHAlignFinder/AlignFinder.cpp
+++ b/ReviewSystem/CHAlignFinder/AlignFinder.cpp
@@ -205,7 +205,6 @@
 	CCHImageData tempImage;
 	CCHImageProcess::ImageNormalize(&resultImage, &m_BlobImage, 0, 255);
 
-	//테스트 필요
 	if (findResult.dMatchValue<m_findParam.dMatchRate)
 	{
 		findResult.nResultCode = AlignMatch_LowScore;
diff --git a/ReviewSystem/ReviewSystem/DitGlassRawStruct.h b/ReviewSystem/ReviewSystem/DitGlassRawStruct.h
index 600196e..a02d42a 100644
--- a/ReviewSystem/ReviewSystem/DitGlassRawStruct.h
+++ b/ReviewSystem/ReviewSystem/DitGlassRawStruct.h
@@ -256,12 +256,43 @@
 	char		m_strProImage[32];
 	char		m_strAvgGray_0[12];
 	char		m_strPortion_0[12];
+	//kyh Mura Data 추가 0622
+	char		m_strCorner_Gray_0[12];
+	char		m_strAvgAmp_0[12];
+	char		m_strFFTVar_0[12];
+	char		m_strFFTVah_0[12];
+	char		m_strFFTVaq_0[12];
+	char		m_strFFTPK_0[12];
+
 	char		m_strAvgGray_1[12];
 	char		m_strPortion_1[12];
+	//kyh Mura Data 추가 0622
+	char		m_strCorner_Gray_1[12];
+	char		m_strAvgAmp_1[12];
+	char		m_strFFTVar_1[12];
+	char		m_strFFTVah_1[12];
+	char		m_strFFTVaq_1[12];
+	char		m_strFFTPK_1[12];
+
 	char		m_strAvgGray_2[12];
 	char		m_strPortion_2[12];
+	//kyh Mura Data 추가 0622
+	char		m_strCorner_Gray_2[12];
+	char		m_strAvgAmp_2[12];
+	char		m_strFFTVar_2[12];
+	char		m_strFFTVah_2[12];
+	char		m_strFFTVaq_2[12];
+	char		m_strFFTPK_2[12];
+
 	char		m_strAvgGray_3[12];
 	char		m_strPortion_3[12];
+	//kyh Mura Data 추가 0622
+	char		m_strCorner_Gray_3[12];
+	char		m_strAvgAmp_3[12];
+	char		m_strFFTVar_3[12];
+	char		m_strFFTVah_3[12];
+	char		m_strFFTVaq_3[12];
+	char		m_strFFTPK_3[12];
 
 	int			m_nDefectNumJudgeOKWhite;
 	int			m_nDefectNumJudgeOKBlack;
@@ -379,6 +410,7 @@
 	int				m_nPixelGlassStart;			// Glass 시작 픽셀
 	short			m_sDefectLoc;
 
+	short			m_sZoneClassPixelCount[16];
 	short			m_sZonePixelCount[16];	// Zone별 결함 Pixel 수
 	short			m_sZoneValueMin[16];	// Zone별 결함 Min
 	short			m_sZoneValueMax[16];	// Zone별 결함 Max
diff --git a/ReviewSystem/ReviewSystem/MainFrm.cpp b/ReviewSystem/ReviewSystem/MainFrm.cpp
index ee342ad..62cab8a 100644
--- a/ReviewSystem/ReviewSystem/MainFrm.cpp
+++ b/ReviewSystem/ReviewSystem/MainFrm.cpp
@@ -88,8 +88,8 @@
 
 	//LYW Align Reconnect
 	//�뾽�뜲�씠�듃�떆
-	//system("netsh interface set interface name = \"Align #1\" admin = disable&& netsh interface set interface name = \"Align #1\" admin = enable&& netsh interface set interface name = \"Align #2\" admin = disable&& netsh interface set interface name = \"Align #2\" admin = enable");
-	//Sleep(2000);
+	system("netsh interface set interface name = \"Align #1\" admin = disable&& netsh interface set interface name = \"Align #1\" admin = enable&& netsh interface set interface name = \"Align #2\" admin = disable&& netsh interface set interface name = \"Align #2\" admin = enable");
+	Sleep(2000);
 
 //	SetTimer(ID_TIMER_WSI_LONGRUN_TEST_TIME, 10000, NULL);
 
diff --git a/ReviewSystem/ReviewSystem/ReviewInterface.cpp b/ReviewSystem/ReviewSystem/ReviewInterface.cpp
index da0c3dd..9c6774d 100644
--- a/ReviewSystem/ReviewSystem/ReviewInterface.cpp
+++ b/ReviewSystem/ReviewSystem/ReviewInterface.cpp
@@ -3313,14 +3313,23 @@
 
 void CReviewInterface::IRP2P_DisplayMessage(const TCHAR* lpstrFormat, ...)
 {
-	va_list list;
-	TCHAR strText[2000] = {0};
+	try
+	{
+		va_list list;
+		TCHAR strText[2000] = { 0 };
 
-	va_start(list, lpstrFormat);
-	_vstprintf_s(strText, lpstrFormat, list);
-	va_end(list);
+		va_start(list, lpstrFormat);
+		_vstprintf_s(strText, lpstrFormat, list);
+		va_end(list);
 
-	g_pLog->DisplayMessage(strText);
+		g_pLog->DisplayMessage(strText);
+	}
+
+	catch (...)
+	{
+		return ;
+	}
+
 }
 
 CResultServerControl* CReviewInterface::IRP2P_GetResultServerControl()
diff --git a/ReviewSystem/ReviewSystem/ReviewProcessor_CPJT.cpp b/ReviewSystem/ReviewSystem/ReviewProcessor_CPJT.cpp
index 52ad15b..b3ae34a 100644
--- a/ReviewSystem/ReviewSystem/ReviewProcessor_CPJT.cpp
+++ b/ReviewSystem/ReviewSystem/ReviewProcessor_CPJT.cpp
@@ -1181,25 +1181,24 @@
 			// 업로드 이미지 경로 수정 20190917 chm
 			strPath.Format(_T("%s\\%s"), m_strSaveImageUploadPath, pReviewResult->strUploadImgFileName);
 			nSize = SaveReviewImage(&uploadImage, strPath, m_nReviewImageSize, m_nReviewImageQuality, m_nReviewImageStep);
-			m_pRP2P->IRP2P_DisplayMessage(_T("Backup Review Image Save Success! Size: %d byte [%s]"), nSize, strPath);
 
 			if (pGlassResult != NULL)
-			{
+			{				
 				pGlassResult->m_strUploadImgFileName = m_strSaveImageUploadPath;
 				//taek 210203
 				strRTMSPath.Format(_T("\\\\126.100.100.5\\Reviewimage\\%s\\%s\\%s"), pGlassResult->m_strRTMSStepID, pGlassResult->m_strGlassID, pReviewResult->strUploadImgFileName);
 				int bRet = SaveReviewImage(&uploadImage, strRTMSPath, m_nReviewImageSize, m_nReviewImageQuality, m_nReviewImageStep); //Taek Rtms 210126
 				if (bRet == 0)
 				{
-					m_pRP2P->IRP2P_DisplayMessage(_T("RTMS Review Image Save Fail [%s] index[%d]"), strRTMSPath, pReviewResult->nDefectIdx);
+					m_pRP2P->IRP2P_DisplayMessage(_T("RTMS Review Image Save Fail!!"));
 				}
-				else m_pRP2P->IRP2P_DisplayMessage(_T("RTMS Review Image Save Success! Size: %d byte [%s] index[%d]"), nSize, strRTMSPath, pReviewResult->nDefectIdx); //taek 210128 속도 문제로 임시로 로그 남기지 않음
+				else m_pRP2P->IRP2P_DisplayMessage(_T("RTMS Review Image Save Success! Size: %d byte [%s]"), nSize, strRTMSPath);
 			}
-
 			if (nSize > 0)
 			{
+				
 				 int aoiindex = CDitGlassRawClient::GetInstance()->GetDefectData(pReviewResult->nDefectidx2)->m_nDefectIdx;
-				m_pRP2P->IRP2P_DisplayMessage(_T("Upload Review Image Save Success! Size: %d byte [%s] index[%d] AOI NO[%d]"), nSize, strRTMSPath, pReviewResult->nDefectIdx, aoiindex); //taek 210128 속도 문제로 임시로 로그 남기지 않음
+				m_pRP2P->IRP2P_DisplayMessage(_T("Upload Review Image Save Success! Size: %d byte [%s] index[%d] AOI NO[%d]"), nSize, pReviewResult->strUploadImgFileName, pReviewResult->nDefectIdx, aoiindex); //taek 210128 속도 문제로 임시로 로그 남기지 않음
 				//m_pRP2P->IRP2P_DisplayMessage(_T("Upload Review Image Save Success! Size: %d byte [%s]"), nSize, pReviewResult->strUploadImgFileName);
 			}
 			else
diff --git a/ReviewSystem/ReviewSystem/ReviewSystem.cpp b/ReviewSystem/ReviewSystem/ReviewSystem.cpp
index 9b4ef68..163c882 100644
--- a/ReviewSystem/ReviewSystem/ReviewSystem.cpp
+++ b/ReviewSystem/ReviewSystem/ReviewSystem.cpp
@@ -254,6 +254,7 @@
 	{
 		if (g_pLog) 
 		{
+			//210617 TEST
 			//delete g_pLog;
 		}
 	}
diff --git a/ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.cpp b/ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.cpp
index 613e945..ebac4f6 100644
--- a/ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.cpp
+++ b/ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.cpp
@@ -788,6 +788,20 @@
 			if (( nTotalCount += pGlassResult->GetTotalSReviewResultCount()) > 0)
 			{
 				m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] Review Plan Start!"));
+				//LYW DCOLL 임시조치
+				CDitGlassRawClient *pDitRawClient = CDitGlassRawClient::GetInstance();
+				if (pDitRawClient->isConnect() == TRUE)
+				{
+
+					_grmDefectData* pSharedDefect = pDitRawClient->GetDefectData(0);//pReviewResult->nDefectidx2
+					_grmDefectReviewData * pSharedDefectReview = &pSharedDefect->m_ReviewDefect;
+
+					//size_t CharactersConverted;
+					//wcstombs_s(&CharactersConverted, pSharedDefectReview->m_strRevImageName, pReviewResult->strImgFileName, _TRUNCATE);
+
+					strcpy(pSharedDefectReview->m_strRevImageName, "");
+				}
+				//LYW DCOLL 임시조치
 				::Sleep(nWaitTime);
 				m_pSP2P->ISP2P_GetReviewProcessor()->ResetGantryDone();
 				bExcute = ReviewStartProcessing(pGlassResult, nPlanIdx);
@@ -1048,8 +1062,8 @@
 
 			strFileName.Format(_T("%s_%s"), strGlassIDTemp, strGlassStepIdTemp);
 			//업데이트시
-			//bFileFind = FindRawBinFile(strFileName);
-			bFileFind = TRUE;
+			bFileFind = FindRawBinFile(strFileName);
+			//bFileFind = TRUE;
 
 			pDitRawClient->SetReviewStart();
 			Sleep(1000);
@@ -1244,7 +1258,6 @@
 			if(pAlignCameraControl->AlignCameraDisconnectCheck() == FALSE)
 			{
 				SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_FAIL);
-				m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Fail! Align Cam Disconnect"));
 				m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Algin Camera Disconnect!!!!"));
 			}
 		}		
@@ -3128,7 +3141,7 @@
 					strReadData = pTransferData->strRerferData;
 					break;
 				}
-				m_pSP2P->ISP2P_DisplayMessage(_T("[ReadTransferData] Name: %s, Addr: %s, Size: %d, Data: %s"), pInfo->strName, strReadAddress, nReadSize, strReadData); //0517
+			//	m_pSP2P->ISP2P_DisplayMessage(_T("[ReadTransferData] Name: %s, Addr: %s, Size: %d, Data: %s"), pInfo->strName, strReadAddress, nReadSize, strReadData); //0517
 		}
 	}
 
@@ -4581,7 +4594,6 @@
 	//WSI 좌우 겐트리 동시이동 
 	pMotorControl->GantrySetTwoGantrySyncModeSend(1);
 	
-
 	// WSI result count
 	for (int nModuleIdx = 0; nModuleIdx < Module_GetModuleStatusCount(); nModuleIdx++)
 	{
@@ -4627,7 +4639,6 @@
 				return 0;
 			}
 		}
-		
 
 		// get result index
 		int nStartIdx = pWsiResult->GetStartSReviewResultIndex();
@@ -6085,7 +6096,6 @@
 	pReviewScheduler->GetPathSchedulerParam()->SetSelectModuleType(type);
 	
 	nSchedulingCount = pReviewScheduler->PathScheduling(vecPathData, vecStartPathData);
-
 
 	if (nSchedulingCount>0)
 	{

--
Gitblit v1.9.3