From 662be16e087b11027318938dc840445b5dbacc27 Mon Sep 17 00:00:00 2001
From: LYW <leeyeanwoo@diteam.co.kr>
Date: 금, 10 6월 2022 13:44:44 +0900
Subject: [PATCH] Ongoing90 #4185 CF AOI Review OneGantryMode 개선

---
 ReviewSystem/ReviewRecipeEditor/ReviewRecipeEditor.rc                     |    8 ++--
 ReviewSystem/include/CHSignalControls/SignalControl.h                     |    3 +
 ReviewSystem/CHSignalControls/SignalControl.cpp                           |    5 ++
 ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.h                        |    1 
 ReviewSystem/CHSignalControls/SignalControl_DitSharedMemorySync.cpp       |   18 +++++++++
 ReviewSystem/include/CHSignalControls/SignalControl_DitSharedMemorySync.h |    3 +
 ReviewSystem/CHReviewRecipe/Rcp_RsReviewManager.cpp                       |    8 ++-
 ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.cpp                      |   50 ++++++++++++++++++++++---
 8 files changed, 83 insertions(+), 13 deletions(-)

diff --git a/ReviewSystem/CHReviewRecipe/Rcp_RsReviewManager.cpp b/ReviewSystem/CHReviewRecipe/Rcp_RsReviewManager.cpp
index 993c5b0..8159f88 100644
--- a/ReviewSystem/CHReviewRecipe/Rcp_RsReviewManager.cpp
+++ b/ReviewSystem/CHReviewRecipe/Rcp_RsReviewManager.cpp
@@ -1120,9 +1120,11 @@
 		macroFile.GetItem(strItem, nData);
 		pScheduleInfo->SetMaxPointCount(nData);
 
-		strItem.Format(_T("RCP_REVIEW_SINGLE_GANRTY_PATH"));
-		macroFile.GetItem(strItem, nData);
-		pScheduleInfo->SetSingleGantryPath(nData);
+		/*< LYW 20220610 - #4185 Delete Start >*/
+// 		strItem.Format(_T("RCP_REVIEW_SINGLE_GANRTY_PATH"));
+// 		macroFile.GetItem(strItem, nData);
+// 		pScheduleInfo->SetSingleGantryPath(nData);
+		/*< LYW 20220610 - #4185 Delete End >*/
 
 
 		strItem.Format(_T("RCP_REVIEW_MAX_WSI_POINT_COUNT"));
diff --git a/ReviewSystem/CHSignalControls/SignalControl.cpp b/ReviewSystem/CHSignalControls/SignalControl.cpp
index 938a10d..1303c3e 100644
--- a/ReviewSystem/CHSignalControls/SignalControl.cpp
+++ b/ReviewSystem/CHSignalControls/SignalControl.cpp
@@ -148,6 +148,11 @@
 
 }
 
+BOOL CSignalControl::ReadData(const CString strAddr, int BitPosition, int nSize, int& nData)
+{
+	return TRUE;
+}
+
 void CSignalControl::IST2P_RunThreadProcess(const CSignalData& signalData)
 {
 	switch(signalData.nSignalType)
diff --git a/ReviewSystem/CHSignalControls/SignalControl_DitSharedMemorySync.cpp b/ReviewSystem/CHSignalControls/SignalControl_DitSharedMemorySync.cpp
index 0a7f470..d6ef04c 100644
--- a/ReviewSystem/CHSignalControls/SignalControl_DitSharedMemorySync.cpp
+++ b/ReviewSystem/CHSignalControls/SignalControl_DitSharedMemorySync.cpp
@@ -265,6 +265,24 @@
 	return TRUE;
 }
 
+/*< LYW 20220610 - #4185 ADD Start >*/
+BOOL CSignalControl_DitSharedMemorySync::ReadData(const CString strAddr, int BitPosition, int nSize, int& nData)
+{
+	if (m_pMemStartAddr == NULL)	return FALSE;
+
+	int nAddress = _ttoi(strAddr);
+
+	// read value
+	int TempData = 0;
+	memcpy(&TempData, m_pMemStartAddr + nAddress, sizeof(int)*nSize);
+
+	TempData = TempData >> BitPosition;
+
+	nData = TempData & 1;
+	return TRUE;
+}
+/*< LYW 20220610 - #4185 ADD End >*/
+
 BOOL CSignalControl_DitSharedMemorySync::WriteData(const CString strAddr, int nSize, CString strData)
 {
 	if(m_pMemStartAddr == NULL)	return FALSE;
diff --git a/ReviewSystem/ReviewRecipeEditor/ReviewRecipeEditor.rc b/ReviewSystem/ReviewRecipeEditor/ReviewRecipeEditor.rc
index 9ed677b..168962c 100644
--- a/ReviewSystem/ReviewRecipeEditor/ReviewRecipeEditor.rc
+++ b/ReviewSystem/ReviewRecipeEditor/ReviewRecipeEditor.rc
@@ -160,10 +160,10 @@
     PUSHBUTTON      "ChangeRCP",IDC_BUTTON4,322,41,50,14
     EDITTEXT        IDC_EDIT_RCP_REFLOW_PIXEL_SCALE,221,145,32,12,ES_CENTER | ES_AUTOHSCROLL
     LTEXT           "Pixel Scale",IDC_STATIC,184,147,34,8
-    GROUPBOX        "GantryMode",IDC_STATIC,264,291,54,46
-    CONTROL         "All Gantry",IDC_RADIO_GANTRY_MODE_1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,266,301,52,9
-    CONTROL         "Left Gantry",IDC_RADIO_GANTRY_MODE_2,"Button",BS_AUTORADIOBUTTON,266,312,52,9
-    CONTROL         "Right Gantry",IDC_RADIO_GANTRY_MODE_3,"Button",BS_AUTORADIOBUTTON,266,323,52,9
+    GROUPBOX        "GantryMode",IDC_STATIC,264,291,54,46,NOT WS_VISIBLE
+    CONTROL         "All Gantry",IDC_RADIO_GANTRY_MODE_1,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_GROUP | WS_TABSTOP,266,301,52,9
+    CONTROL         "Left Gantry",IDC_RADIO_GANTRY_MODE_2,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,266,312,52,9
+    CONTROL         "Right Gantry",IDC_RADIO_GANTRY_MODE_3,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,266,323,52,9
 END
 
 IDD_DIALOG_REVIEW_RCP_EDITOR_MEASURE DIALOGEX 0, 0, 379, 526
diff --git a/ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.cpp b/ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.cpp
index 8d8d1e5..736acff 100644
--- a/ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.cpp
+++ b/ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.cpp
@@ -1120,6 +1120,10 @@
  			}
  			
 			m_pSP2P->ISP2P_DisplayMessage(_T("[Glass Loading] Current Apply Recipe Name : %s"), strRecipefile);
+
+			/*< LYW 20220610 - #4185 ADD Start >*/
+			CheckGantryMode();
+			/*< LYW 20220610 - #4185 ADD End >*/
  
 			// recipe data apply
 			if(ApplyRecipeDataToGlassResult(pGlassResult)==FALSE)
@@ -4289,7 +4293,9 @@
 		{
 			int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex());
 			g_pLog->DisplayMessage(_T("[Collision Position Set Fail] %d Module, Addr: %d, PosX: %.3lfmm"), nModuleIdx, XAddr, dCollisionPosX);
-			return 0;
+			/*< LYW 20220610 - #4185 Delete Start >*/
+			//return 0;
+			/*< LYW 20220610 - #4185 Delete End >*/
 		}
 
 		}
@@ -4587,7 +4593,9 @@
 			{
 				int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex());
 				g_pLog->DisplayMessage(_T("[Collision Position Set Fail] %d Module, Addr: %d, PosX: %.3lfmm"), nModuleIdx, XAddr, dCollisionPosX);
-				return 0;
+				/*< LYW 20220610 - #4185 Delete Start >*/
+				//return 0;
+				/*< LYW 20220610 - #4185 Delete End >*/
 			}
 
 		}
@@ -4840,7 +4848,9 @@
 			{
 				int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex());
 				g_pLog->DisplayMessage(_T("[Collision Position Set Fail] %d Module, Addr: %d, PosX: %.3lfmm"), nModuleIdx, XAddr, dCollisionPosX);
-				return 0;
+				/*< LYW 20220610 - #4185 Delete Start >*/
+				//return 0;
+				/*< LYW 20220610 - #4185 Delete End >*/
 			}
 		}
 
@@ -9566,7 +9576,9 @@
 			{
 				int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex());
 				g_pLog->DisplayMessage(_T("[Collision Position Set Fail] %d Module, Addr: %d, PosX: %.3lfmm"), nModuleIdx, XAddr, dCollisionPosX);
-				return 0;
+				/*< LYW 20220610 - #4185 Delete Start >*/
+				//return 0;
+				/*< LYW 20220610 - #4185 Delete End >*/
 			}
 
 		}
@@ -9977,13 +9989,15 @@
 				int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex());
 				g_pLog->DisplayMessage(_T("[Review_CollisionPos] %d Module, Addr: %d, PosX: %.3lf mm"), nModuleIdx, XAddr, dCollisionPosX);
 
-				///pGlassResult->SetCollisionXPos(nModuleIdx, dCollisionPosX);
+				//pGlassResult->SetCollisionXPos(nModuleIdx, dCollisionPosX);
 			}
 			else
 			{
 				int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex());
 				g_pLog->DisplayMessage(_T("[Collision Position Set Fail] %d Module, Addr: %d, PosX: %.3lfmm"), nModuleIdx, XAddr, dCollisionPosX);
-				return 0;
+				/*< LYW 20220610 - #4185 Delete Start >*/
+				//return 0;
+				/*< LYW 20220610 - #4185 Delete End >*/
 			}
 			// get result index
 			int nStartIdx = pWsiMultiShotResult->GetStartSReviewResultIndex();
@@ -10482,6 +10496,30 @@
 	}	
 }
 
+/*< LYW 20220610 - #4185 ADD Start >*/
+void CSequenceProcessor_CPJT::CheckGantryMode()
+{
+	CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl();
+	if (pSignalControl == NULL) m_pSP2P->ISP2P_DisplayMessage(_T("[CheckGantryMode] SignalControl is NULL"));
+	if (pSignalControl->IsConnected() == FALSE) m_pSP2P->ISP2P_DisplayMessage(_T("[CheckGantryMode] SignalControl is Not Connect"));
+
+	int LeftGantryUse = 0;
+	int RightGantryUse = 0;
+
+	pSignalControl->ReadData(_T("10003"), 1, 1, LeftGantryUse);
+	pSignalControl->ReadData(_T("10003"), 2, 1, RightGantryUse);
+
+	if (LeftGantryUse == 1 && RightGantryUse == 0) 
+		m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->SetSingleGantryPath(1);
+	else if (LeftGantryUse == 0 && RightGantryUse == 1)
+		m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->SetSingleGantryPath(2);
+	else
+		m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->SetSingleGantryPath(0);
+
+	m_pSP2P->ISP2P_DisplayMessage(_T("[CheckGantryMode] GantryMode LeftBit = %d, RightBit = %d"), LeftGantryUse, RightGantryUse);
+}
+/*< LYW 20220610 - #4185 ADD End >*/
+
 BOOL CSequenceProcessor_CPJT::UpdateMemoryUserReflowPlanInfo(CDitGlassRawClient* pDitSharedGlassRaw)
 {
 	CRsRcpReviewInfo* pRecipeinfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo();
diff --git a/ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.h b/ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.h
index c73e01f..9b31a20 100644
--- a/ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.h
+++ b/ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.h
@@ -327,6 +327,7 @@
 
 	// 190130 SJB, Motor AutoGo Count Remove
 	void	RemoveMotorCount();
+	void	CheckGantryMode();
 
 	// 190130 SJB, User,Reflow Plan Memory Update
 	BOOL	UpdateMemoryUserReflowPlanInfo(CDitGlassRawClient* pDitSharedGlassRaw);
diff --git a/ReviewSystem/include/CHSignalControls/SignalControl.h b/ReviewSystem/include/CHSignalControls/SignalControl.h
index 8443860..c5991e6 100644
--- a/ReviewSystem/include/CHSignalControls/SignalControl.h
+++ b/ReviewSystem/include/CHSignalControls/SignalControl.h
@@ -19,6 +19,9 @@
 	virtual BOOL	Read_SendSignal(int nAddrIndex, WORD& dwValue) = 0;
 	virtual BOOL	ReadData(const CString strAddr, int nSize, CString& strData) = 0;
 	virtual BOOL	ReadData(const CString strAddr, int nSize, char* pData) = 0;
+	/*< LYW 20220610 - #4185 ADD Start >*/
+	virtual BOOL	ReadData(const CString strAddr, int BitPosition, int nSize, int& nData);
+	/*< LYW 20220610 - #4185 ADD End >*/
 	virtual BOOL	WriteWordData(const CString strAddr, int nSize, int nData) = 0;
 	virtual BOOL	WriteData(const CString strAddr, int nSize, CString strData) = 0;
 
diff --git a/ReviewSystem/include/CHSignalControls/SignalControl_DitSharedMemorySync.h b/ReviewSystem/include/CHSignalControls/SignalControl_DitSharedMemorySync.h
index 9db01f7..4a62bfb 100644
--- a/ReviewSystem/include/CHSignalControls/SignalControl_DitSharedMemorySync.h
+++ b/ReviewSystem/include/CHSignalControls/SignalControl_DitSharedMemorySync.h
@@ -17,6 +17,9 @@
 	virtual BOOL	Read_SendSignal(int nAddrIndex, WORD& dwValue);
 	virtual BOOL	ReadData(const CString strAddr, int nSize, CString& strData);
 	virtual BOOL	ReadData(const CString strAddr, int nSize, char* pData);
+	/*< LYW 20220610 - #4185 ADD Start >*/
+	virtual BOOL	ReadData(const CString strAddr, int BitPosition, int nSize, int& nData);
+	/*< LYW 20220610 - #4185 ADD End >*/
 	virtual BOOL	WriteWordData(const CString strAddr, int nSize, int nData);
 	virtual BOOL	WriteData(const CString strAddr, int nSize, CString strData);
 

--
Gitblit v1.9.3