From 63439977901d54a01924ed76290931aeddbce66c Mon Sep 17 00:00:00 2001
From: LYW <leeyeanwoo@diteam.co.kr>
Date: 화, 05 7월 2022 18:16:55 +0900
Subject: [PATCH] Ongoing80 #4220 CF AOI Review 알람 추가

---
 ReviewSystem/CHMotorControls/MotorControl.cpp              |   29 ++++
 ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.h         |   14 ++
 ReviewSystem/ReviewSystemSetting/DlgNetwork.cpp            |   23 +++
 ReviewSystem/CHReviewSetting/NetworkInfo.cpp               |    9 +
 ReviewSystem/ReviewSystem/SequenceProcessor.h              |    1 
 ReviewSystem/ReviewSystem/ReviewInterface.cpp              |    7 +
 ReviewSystem/ReviewSystem/MainFrm.cpp                      |   18 +++
 ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.cpp       |  145 ++++++++++++++++++++++++
 FTPUploader/FTPUploader/FTPThreadPool.cpp                  |   11 +
 ReviewSystem/CHReviewSetting/Sys_NetworkManager.cpp        |   12 ++
 ReviewSystem/include/CHReviewSetting/NetworkInfo.h         |    3 
 ReviewSystem/ReviewSystem/ReviewInterface.h                |    3 
 ReviewSystem/ReviewSystemSetting/DlgNetwork.h              |    2 
 ReviewSystem/include/CHMotorControls/MotorControlInfo.h    |    1 
 ReviewSystem/include/CHMotorControls/MotorControl.h        |    6 +
 ReviewSystem/ReviewSystem/ReviewSystem.vcxproj             |    2 
 ReviewSystem/ReviewSystemSetting/ReviewSystemSetting.rc    |   11 +
 ReviewSystem/ReviewSystemSetting/resource.h                |    4 
 DitGlassRawMessenger/DitGlassRawMessenger/GlassRawCPJT.cpp |   18 +-
 19 files changed, 298 insertions(+), 21 deletions(-)

diff --git a/DitGlassRawMessenger/DitGlassRawMessenger/GlassRawCPJT.cpp b/DitGlassRawMessenger/DitGlassRawMessenger/GlassRawCPJT.cpp
index 2055277..10f02ce 100644
--- a/DitGlassRawMessenger/DitGlassRawMessenger/GlassRawCPJT.cpp
+++ b/DitGlassRawMessenger/DitGlassRawMessenger/GlassRawCPJT.cpp
@@ -373,14 +373,7 @@
 
 	//if(1) ReadMuraFile(pData); 211012 KJG - QD Macro 媛쒕퀎 �뾽濡쒕뱶 �븯誘�濡� Macro �뜲�씠�꽣 �쟻�젣 �젣嫄� �슂泥�
 
-  	if(WriteAOIFile(pData) == FALSE)
-  		return FALSE;
-
-	//210126 CJH - Review End�뿉�꽌留� RTMS 寃곌낵�뙆�씪 �깮�꽦�븯�룄濡� 蹂�寃�
-	if (m_GlassRawRTMS.WriteAOIFile(pData) == FALSE)
-		return FALSE;
-
-	if(1)
+	if (1)
 	{
 		_grmGlassData* pGlassData = pData->GetGlassData();
 
@@ -390,6 +383,15 @@
 		SendMessageFTPUploadImage(pGlassData, FTPCMD_MURA_IMAGE);//0405nwh
 
 	}
+
+  	if(WriteAOIFile(pData) == FALSE)
+  		return FALSE;
+
+	//210126 CJH - Review End�뿉�꽌留� RTMS 寃곌낵�뙆�씪 �깮�꽦�븯�룄濡� 蹂�寃�
+	if (m_GlassRawRTMS.WriteAOIFile(pData) == FALSE)
+		return FALSE;
+
+
 	
 	
 
diff --git a/FTPUploader/FTPUploader/FTPThreadPool.cpp b/FTPUploader/FTPUploader/FTPThreadPool.cpp
index c892dd5..3da991c 100644
--- a/FTPUploader/FTPUploader/FTPThreadPool.cpp
+++ b/FTPUploader/FTPUploader/FTPThreadPool.cpp
@@ -118,12 +118,13 @@
 
 BOOL CFTPThreadPool::Process_UploadAck(int nResultCode, const CFTPUploadParam& uploadParam)
 {
-	if (uploadParam.m_nSendResultCode==0)
-	{
-		return TRUE;
-	}
+// 	if (uploadParam.m_nSendResultCode==0)
+// 	{
+// 		return TRUE;
+// 	}
 
-	HWND hWnd = uploadParam.GetSenderWnd();
+	//HWND hWnd = uploadParam.GetSenderWnd();
+	HWND hWnd = ::FindWindow(NULL, "ReviewSystem");
 	if (hWnd==NULL) 
 	{
 		return FALSE;
diff --git a/ReviewSystem/CHMotorControls/MotorControl.cpp b/ReviewSystem/CHMotorControls/MotorControl.cpp
index ca168d3..3be3b86 100644
--- a/ReviewSystem/CHMotorControls/MotorControl.cpp
+++ b/ReviewSystem/CHMotorControls/MotorControl.cpp
@@ -24,6 +24,12 @@
 	m_nAutoEnable				= 0;
 	m_nAutoEnablePrev			= 0;
 
+	/*< LYW 20220704 - #4220 ADD Start >*/
+	m_nMotorAlive = 0;
+	m_nMotorAlivePrev = 0;
+	dwLastAliveTick = GetTickCount();
+	/*< LYW 20220704 - #4220 ADD End >*/
+
 	// wsi signal
 	m_nWsiMotionEndPrev			= 0;
 
@@ -96,6 +102,29 @@
 
 	if (m_nAxisCount<1) return;
 
+	//Alive
+	if (ReadAddressValue(50, m_nMotorAlive))
+	{
+		if (m_nMotorAlivePrev != m_nMotorAlive)
+		{
+			dwLastAliveTick = GetTickCount();
+		}
+		m_nAutoEnablePrev = m_nAutoEnable;
+
+		if (GetTickCount() - dwLastAliveTick >15000 && dwLastAliveTick != 0)
+		{
+			m_pMC2P->IMC2P_SendMotorAliveErrorAlram();
+			m_pMC2P->IMC2P_DisplayMessage(m_nIndex, _T("Motor Alive Error!"));
+			dwLastAliveTick = GetTickCount();
+		}
+	}
+	else
+	{
+		m_pMC2P->IMC2P_SendMotorAliveErrorAlram();
+		m_pMC2P->IMC2P_DisplayMessage(m_nIndex, _T("Motor Alive Read Fail!"));
+		dwLastAliveTick = GetTickCount();
+	}
+
 	// auto enable
 	const CMotorCommonAddr *pAddr = m_ControlInfo.GetMotorCommonAddr();
 	if (pAddr && pAddr->m_nAllAutoEnableAddr!=MOTOR_ADDRESS_NONE)
diff --git a/ReviewSystem/CHReviewSetting/NetworkInfo.cpp b/ReviewSystem/CHReviewSetting/NetworkInfo.cpp
index 509226d..448a5bd 100644
--- a/ReviewSystem/CHReviewSetting/NetworkInfo.cpp
+++ b/ReviewSystem/CHReviewSetting/NetworkInfo.cpp
@@ -34,6 +34,9 @@
 	m_bUpdateImageOriginal	= FALSE;
 	m_nImageRotate			= 0;
 	m_nImageFlip			= 0;
+
+	m_nZeroReviewAlarm		 = 0;
+	m_strZeroReviewAlarmExcept = _T("");
 }
 
 void CNetworkInfo::SetInfo(const CNetworkInfo& rhs)
@@ -59,6 +62,9 @@
 	m_bUpdateImageOriginal	= rhs.m_bUpdateImageOriginal;
 	m_nImageRotate			= rhs.m_nImageRotate;
 	m_nImageFlip			= rhs.m_nImageFlip;
+
+	m_nZeroReviewAlarm = rhs.m_nZeroReviewAlarm;
+	m_strZeroReviewAlarmExcept = rhs.m_strZeroReviewAlarmExcept;
 }
 
 void CNetworkInfo::GetInfo(CNetworkInfo& rhs)
@@ -84,4 +90,7 @@
 	rhs.m_bUpdateImageOriginal	= m_bUpdateImageOriginal;
 	rhs.m_nImageRotate			= m_nImageRotate;
 	rhs.m_nImageFlip			= m_nImageFlip;
+
+	rhs.m_nZeroReviewAlarm = m_nZeroReviewAlarm;
+	rhs.m_strZeroReviewAlarmExcept = m_strZeroReviewAlarmExcept;
 }
diff --git a/ReviewSystem/CHReviewSetting/Sys_NetworkManager.cpp b/ReviewSystem/CHReviewSetting/Sys_NetworkManager.cpp
index 32a9409..e032a02 100644
--- a/ReviewSystem/CHReviewSetting/Sys_NetworkManager.cpp
+++ b/ReviewSystem/CHReviewSetting/Sys_NetworkManager.cpp
@@ -82,6 +82,12 @@
 
 	strItem.Format(_T("SYS_NETWORK_SAVE_ORIGINAL_IMAGE"));
 	macroFile.SetItem(strItem, networkInfo.m_bUpdateImageOriginal);
+
+	strItem.Format(_T("SYS_NETWORK_REVIEW_ZERO_ALARM_CONDITION"));
+	macroFile.SetItem(strItem, networkInfo.m_nZeroReviewAlarm);
+
+	strItem.Format(_T("SYS_NETWORK_REVIEW_ZERO_ALARM_EXCEPTION"));
+	macroFile.SetItem(strItem, networkInfo.m_strZeroReviewAlarmExcept);
 }
 
 void CSys_NetworkManager::GetProfile(CMacroFile& macroFile)
@@ -146,5 +152,11 @@
 	strItem.Format(_T("SYS_NETWORK_SAVE_ORIGINAL_IMAGE"));
 	macroFile.GetItem(strItem, networkInfo.m_bUpdateImageOriginal);
 
+	strItem.Format(_T("SYS_NETWORK_REVIEW_ZERO_ALARM_CONDITION"));
+	macroFile.GetItem(strItem, networkInfo.m_nZeroReviewAlarm, 0);
+
+	strItem.Format(_T("SYS_NETWORK_REVIEW_ZERO_ALARM_EXCEPTION"));
+	macroFile.GetItem(strItem, networkInfo.m_strZeroReviewAlarmExcept, _T(""));
+
 	m_networkInfo.SetInfo(networkInfo);
 }
\ No newline at end of file
diff --git a/ReviewSystem/ReviewSystem/MainFrm.cpp b/ReviewSystem/ReviewSystem/MainFrm.cpp
index ef54a5d..b6ea163 100644
--- a/ReviewSystem/ReviewSystem/MainFrm.cpp
+++ b/ReviewSystem/ReviewSystem/MainFrm.cpp
@@ -859,6 +859,24 @@
 
 	switch(pCopyDataStruct->dwData)
 	{
+	case COPYDATA_RAW_DOWNLOAD_ACK:
+	case COPYDATA_RAW_UPLOAD_ACK:
+	case COPYDATA_LOT_UPLOAD_ACK:
+	case COPYDATA_IMAGE_UPLOAD_ACK:
+	{
+		CFTPCopyDataParam ftpCopyDataParam;
+
+		ftpCopyDataParam = *(static_cast<CFTPCopyDataParam*>(pCopyDataStruct->lpData));
+		if (ftpCopyDataParam.m_nSendResultCode == FALSE)
+		{
+			CMainFrame* pMain = static_cast<CMainFrame*>(AfxGetMainWnd());
+			CSequenceProcessor* pSequenceProcessor = pMain->IRP2P_GetSequenceProcessor();
+			if (pSequenceProcessor == NULL)	return FALSE;
+			pSequenceProcessor->sendUploadResult2SequenceProcessor(ftpCopyDataParam.m_nSendResultCode);
+		}
+		
+	}
+	break;
 	case COPYDATA_SYSTEMSETTING2REVIEWSYSTEM:
 		{
 			COPYDATA_SYSTEM2REV* pCopyData = (COPYDATA_SYSTEM2REV*)pCopyDataStruct->lpData;
diff --git a/ReviewSystem/ReviewSystem/ReviewInterface.cpp b/ReviewSystem/ReviewSystem/ReviewInterface.cpp
index 4bb293d..1b652cd 100644
--- a/ReviewSystem/ReviewSystem/ReviewInterface.cpp
+++ b/ReviewSystem/ReviewSystem/ReviewInterface.cpp
@@ -9369,6 +9369,13 @@
 		g_pLog->DisplayMessage(_T("[WSI_%d] Send Motion End to WSI SUCCESS! [%02d][%02d]"), nWsiIndex, nModuleIndex, nWsiIndex);
 }
 
+void CReviewInterface::IMC2P_SendMotorAliveErrorAlram()
+{
+	IRP2P_GetSequenceProcessor()->SendSignalToSignalControl(PCControlSendSignalIndex_State, PCControlSend_Review_Motor_Communication_Fail, 1000);
+
+	return;
+}
+
 void CReviewInterface::IWC2P_SetScanEnd( int nIndex, int nPointIndex, int nPositionX, int nPositionY )
 {
 	int nModuleIndex=-1, nWsiIndex=-1;
diff --git a/ReviewSystem/ReviewSystem/ReviewInterface.h b/ReviewSystem/ReviewSystem/ReviewInterface.h
index e0423fc..94ed860 100644
--- a/ReviewSystem/ReviewSystem/ReviewInterface.h
+++ b/ReviewSystem/ReviewSystem/ReviewInterface.h
@@ -58,6 +58,8 @@
 #include "M_AutoDiagnosisManager/DiagnosisManager.h"
 #include "DlgSelfDiagnosis.h"
 
+#include "FTPUploadParam.h"
+
 typedef std::vector<CMotorCalibrator>						VectorMotorCalibrator;
 typedef std::vector<CMotorCalibrator>::iterator				VectorMotorCalibratorIt;
 typedef std::vector<CMotorCalibrator>::const_iterator		constVectorMotorCalibratorIt;
@@ -138,6 +140,7 @@
 	virtual void	IMC2P_GantrySoftWareTrigger(int nIndex, int nGantryIdx, int nTrigger);
 	virtual void    IMC2P_WsiGantrySoftWareTrigger(int nIndex, int nGantryIdx, int nTrigger);
 	virtual void	IMC2P_UpdateWsiMotionEnd(int nIndex, int nGantryIdx);
+	virtual void	IMC2P_SendMotorAliveErrorAlram();
 	virtual BOOL	IMC2P_GetUseWsi();
 
 	// WSI Controller 2 parent	
diff --git a/ReviewSystem/ReviewSystem/ReviewSystem.vcxproj b/ReviewSystem/ReviewSystem/ReviewSystem.vcxproj
index f2ee3c4..e2bf5ed 100644
--- a/ReviewSystem/ReviewSystem/ReviewSystem.vcxproj
+++ b/ReviewSystem/ReviewSystem/ReviewSystem.vcxproj
@@ -145,7 +145,7 @@
     <ClCompile>
       <Optimization>Disabled</Optimization>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <AdditionalIncludeDirectories>../include;../../Internal_Library/include;../../External_Library/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../include;../../Internal_Library/include;../../External_Library/include;../../FTPUploader/FTPUploader;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>false</MinimalRebuild>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
diff --git a/ReviewSystem/ReviewSystem/SequenceProcessor.h b/ReviewSystem/ReviewSystem/SequenceProcessor.h
index 7bcd1d5..d3dfc9c 100644
--- a/ReviewSystem/ReviewSystem/SequenceProcessor.h
+++ b/ReviewSystem/ReviewSystem/SequenceProcessor.h
@@ -764,6 +764,7 @@
 	virtual void SetEndTickCount(DWORD dwTick) = 0;
 	virtual DWORD GetStartTickCount() = 0;
 	virtual DWORD GetEndTickCount() = 0;
+	virtual void sendUploadResult2SequenceProcessor(int UploadResult) = 0;
 
 protected:
 	int m_nCheckWSIEnd;
diff --git a/ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.cpp b/ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.cpp
index 9cbdfb2..267abef 100644
--- a/ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.cpp
+++ b/ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.cpp
@@ -166,6 +166,8 @@
 {
 	m_bUseAFMHomePosition = TRUE;
 	m_nGlassCount = 0;
+	m_nStackZeroReviewCondition = 0;
+	m_nUploadResultFailCount = 0;
 	CDitGlassRawClient* pDitGlassRaw = CDitGlassRawClient::GetInstance();
 	if(pDitGlassRaw->ConnectServer() == FALSE)
 	{
@@ -943,6 +945,7 @@
 	SetLastPointCheck(FALSE);
 
 	SetReviewComplete(FALSE);
+	SetUploadResultFailCount(0);
 
 	bFileFind = FALSE;
 
@@ -1797,6 +1800,23 @@
 		CDlgDefocusList::GetInstance()->SetDefocusData(strTime,pGlassResult->m_strGlassID,pGlassResult->m_nDeFocusCount);
 
 	}
+
+	if (CheckZeroReviewAlarm() == FALSE && m_pSP2P->ISP2P_System_GetNetworkInfo()->m_nZeroReviewAlarm != 0)
+	{
+		STransferData* pTransferData = m_pSP2P->ISP2P_GetCurrentTransferData();
+		if (pTransferData->strProdType != m_pSP2P->ISP2P_System_GetNetworkInfo()->m_strZeroReviewAlarmExcept)
+		{
+			m_nStackZeroReviewCondition++;
+			if (m_nStackZeroReviewCondition >= m_pSP2P->ISP2P_System_GetNetworkInfo()->m_nZeroReviewAlarm)
+			{
+				m_pSP2P->ISP2P_DisplayMessage(_T("Zero Review Alarm! %d ea Glass Is Zero Review!"), m_nStackZeroReviewCondition);
+				SendSignalToSignalControl(PCControlSendSignalIndex_State, PCControlSend_Review_0Count_Alarm, 1000);
+				m_nStackZeroReviewCondition = 0;
+			}
+		}
+		else m_nStackZeroReviewCondition = 0;
+	}
+	else m_nStackZeroReviewCondition = 0;
 
 	/*< LYW 20211109 - #3662 Delete Start >*/
 	// 	g_pLog->DisplayMessage(_T("History map Start"));
@@ -8257,6 +8277,131 @@
 
 	return;
 }
+
+BOOL CSequenceProcessor_CPJT::CheckZeroReviewAlarm()
+{
+	CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult();
+	if (pGlassResult == NULL) return FALSE;
+
+	int TotalCount = 0;
+
+	//Defect
+	const VectorReviewResult *pVecReviewResult = pGlassResult->GetVectorReviewResult();
+	if (pVecReviewResult != NULL) 
+	{
+		for (constVectorReviewResultIt it = pVecReviewResult->begin(); it != pVecReviewResult->end(); it++)
+		{
+			const CReviewResult *pReviewResult = static_cast<const CReviewResult*>(&(*it));
+
+			TotalCount += pReviewResult->m_vecSReviewResult.size();
+
+			for (constVectorSReviewResultIt its = pReviewResult->m_vecSReviewResult.begin(); its != pReviewResult->m_vecSReviewResult.end(); its++)
+			{
+				if (its->nResultCode > ReviewResult_None)
+				{
+					return TRUE;
+				}
+				else
+				{
+					continue;
+				}
+			}
+		}
+	}
+
+	//DefectWSI
+	const VectorReviewResult *pVecWsiResult = pGlassResult->GetVectorWsiResult();
+	if (pVecWsiResult != NULL)
+	{
+		for (constVectorReviewResultIt it = pVecWsiResult->begin(); it != pVecWsiResult->end(); it++)
+		{
+			const CReviewResult *pWsiResult = static_cast<const CReviewResult*>(&(*it));
+
+			TotalCount += pWsiResult->m_vecSReviewResult.size();
+
+			for (constVectorSReviewResultIt its = pWsiResult->m_vecSReviewResult.begin(); its != pWsiResult->m_vecSReviewResult.end(); its++)
+			{
+				if (its->nResultCode > WsiResult_None)
+				{
+					return TRUE;
+				}
+				else
+				{
+					continue;
+				}
+			}
+		}
+	}
+
+	//User Review
+	const VectorReviewResult *pVecUserReviewResult = pGlassResult->GetVectorUserResult();
+	if (pVecUserReviewResult != NULL)
+	{
+		for (constVectorReviewResultIt it = pVecUserReviewResult->begin(); it != pVecUserReviewResult->end(); it++)
+		{
+			const CReviewResult *pUserReviewResult = static_cast<const CReviewResult*>(&(*it));
+
+			TotalCount += pUserReviewResult->m_vecSReviewResult.size();
+
+			for (constVectorSReviewResultIt its = pUserReviewResult->m_vecSReviewResult.begin(); its != pUserReviewResult->m_vecSReviewResult.end(); its++)
+			{
+				if (its->nResultCode > ReviewResult_None)
+				{
+					return TRUE;
+				}
+				else
+				{
+					continue;
+				}
+			}
+		}
+	}
+
+	//User WSI
+	const VectorReviewResult *pVecUserWsiResult = pGlassResult->GetVectorUserWsiResult();
+	if (pVecUserWsiResult != NULL)
+	{
+		for (constVectorReviewResultIt it = pVecUserWsiResult->begin(); it != pVecUserWsiResult->end(); it++)
+		{
+			const CReviewResult *pUserWsiResult = static_cast<const CReviewResult*>(&(*it));
+
+			TotalCount += pUserWsiResult->m_vecSReviewResult.size();
+
+			for (constVectorSReviewResultIt its = pUserWsiResult->m_vecSReviewResult.begin(); its != pUserWsiResult->m_vecSReviewResult.end(); its++)
+			{
+				if (its->nResultCode > WsiResult_None)
+				{
+					return TRUE;
+				}
+				else
+				{
+					continue;
+				}
+			}
+		}
+	}
+
+	if (TotalCount == 0) return TRUE;
+
+	return FALSE;
+}
+
+void CSequenceProcessor_CPJT::sendUploadResult2SequenceProcessor(int UploadResult)
+{
+	int UploadResultFailCount = GetUploadResultFailCount();
+	if (UploadResult == FALSE)
+	{
+		UploadResultFailCount++;
+		if (UploadResultFailCount >= 2)
+		{
+			m_pSP2P->ISP2P_DisplayMessage(_T("ResultFile Upload Fail!"));
+			SendSignalToSignalControl(PCControlSendSignalIndex_State, PCControlSend_ResultData_Upload_Fail, 1000);
+			SetUploadResultFailCount(-1);
+		}
+		SetUploadResultFailCount(UploadResultFailCount);
+	}
+}
+
 //#3358 KYH FDC  ADD END
 
 DWORD CSequenceProcessor_CPJT::GetDiskUsage()
diff --git a/ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.h b/ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.h
index 9b31a20..b01194a 100644
--- a/ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.h
+++ b/ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.h
@@ -116,7 +116,12 @@
 	PCControlSend_RecipeASCEND,
 	PCControlSend_WSIError,
 	PCControlSend_Defoucs,
-	PCControlSend_Diagnosis //0412 자가진단 코드추가
+	PCControlSend_Diagnosis, //0412 자가진단 코드추가
+	/*< LYW 20220704 - #4220 ADD Start >*/
+	PCControlSend_Review_Motor_Communication_Fail,
+	PCControlSend_ResultData_Upload_Fail,
+	PCControlSend_Review_0Count_Alarm
+	/*< LYW 20220704 - #4220 ADD End >*/
 };
 
 enum PCControlRecvSignalState_WSI
@@ -207,9 +212,14 @@
 	int nReviewCount;
 	void SetReviewCount(int nCount) { nReviewCount = nCount; };
 	int GetReviewCount() { return nReviewCount; };
+
+	void SetUploadResultFailCount(int nCount) { m_nUploadResultFailCount = nCount; };
+	int GetUploadResultFailCount() { return m_nUploadResultFailCount; };
 	//#3358 KYH FDC 데이터 전송 시점 개선 ADD START
     virtual void    MakeDVData2(); 
 	//#3358 KYH FDC 데이터 전송 시점 개선 ADD END
+	BOOL CheckZeroReviewAlarm();
+	virtual void sendUploadResult2SequenceProcessor(int UploadResult);
 
 	int nHistoryCount = 0;
 	void SetHistoryCount(int nCount) { nHistoryCount = nCount; }
@@ -420,5 +430,7 @@
 	BOOL bLastPointEndCheck;
 
 	BOOL bFileFind;
+	int m_nStackZeroReviewCondition;
+	int m_nUploadResultFailCount;
 };
 
diff --git a/ReviewSystem/ReviewSystemSetting/DlgNetwork.cpp b/ReviewSystem/ReviewSystemSetting/DlgNetwork.cpp
index 9b844a5..94d0928 100644
--- a/ReviewSystem/ReviewSystemSetting/DlgNetwork.cpp
+++ b/ReviewSystem/ReviewSystemSetting/DlgNetwork.cpp
@@ -29,6 +29,8 @@
 	, m_strUploadDefectMapImagePath(_T(""))
 	, m_dUpdateImageScale(1.0)
 	, m_strWsiImagePath(_T(""))
+	, m_nZeroReviewAlarm(0)
+	, m_strZeroReviewAlarmExcept(_T(""))
 {
 	m_nUpdateImageWidth			= 1224;
 	m_nUpdateImageHeight		= 1024;
@@ -61,11 +63,11 @@
 	DDX_Text(pDX, IDC_EDIT_SYS_NETWORK_UPLOAD_IMAGE_PATH, m_strUploadImagePath);
 	DDX_Text(pDX, IDC_EDIT_SYS_NETWORK_UPLOAD_DEFECTMAP_IMAGE_PATH, m_strUploadDefectMapImagePath);
 
-	DDX_Text(pDX, IDC_EDIT_SYS_NETWORK_UPLOAD_IMAGE_WIDTH,			m_nUpdateImageWidth);
-	DDX_Text(pDX, IDC_EDIT_SYS_NETWORK_UPLOAD_IMAGE_HEIGHT,			m_nUpdateImageHeight);
-	DDX_Text(pDX, IDC_EDIT_SYS_NETWORK_UPLOAD_IMAGE_SIZE,			m_nUpdateImageSize);
-	DDX_Text(pDX, IDC_EDIT_SYS_NETWORK_UPLOAD_IMAGE_START_QUALTY,	m_nUpdateImageQuality);
-	DDX_Text(pDX, IDC_EDIT_SYS_NETWORK_UPLOAD_IMAGE_STEP_QUALTY,	m_nUpdateImageStep);
+	DDX_Text(pDX, IDC_EDIT_SYS_NETWORK_UPLOAD_IMAGE_WIDTH, m_nUpdateImageWidth);
+	DDX_Text(pDX, IDC_EDIT_SYS_NETWORK_UPLOAD_IMAGE_HEIGHT, m_nUpdateImageHeight);
+	DDX_Text(pDX, IDC_EDIT_SYS_NETWORK_UPLOAD_IMAGE_SIZE, m_nUpdateImageSize);
+	DDX_Text(pDX, IDC_EDIT_SYS_NETWORK_UPLOAD_IMAGE_START_QUALTY, m_nUpdateImageQuality);
+	DDX_Text(pDX, IDC_EDIT_SYS_NETWORK_UPLOAD_IMAGE_STEP_QUALTY, m_nUpdateImageStep);
 
 	DDX_Text(pDX, IDC_EDIT_SYS_NETWORK_UPLOAD_IMAGE_SCALE, m_dUpdateImageScale);
 
@@ -77,6 +79,8 @@
 	DDX_Control(pDX, IDC_COMBO2, m_ctrlComboImageFlip);
 	DDX_Text(pDX, IDC_EDIT_SYS_NETWORK_WSI_IMAGE_PATH, m_strWsiImagePath);
 	DDV_MaxChars(pDX, m_strWsiImagePath, 255);
+	DDX_Text(pDX, IDC_EDIT_SYS_NETWORK_UPLOAD_ZERO_COUNT_ALARM_CONDITION, m_nZeroReviewAlarm);
+	DDX_Text(pDX, IDC_EDIT_SYS_NETWORK_UPLOAD_ZERO_COUNT_ALARM_CONDITION_2, m_strZeroReviewAlarmExcept);
 }
 
 BEGIN_MESSAGE_MAP(CDlgNetwork, CDialog)
@@ -133,6 +137,9 @@
 			m_nImageRotate			= pNetworkInfo->m_nImageRotate;
 			m_nImageFlip			= pNetworkInfo->m_nImageFlip;
 
+			m_nZeroReviewAlarm		= pNetworkInfo->m_nZeroReviewAlarm;
+			m_strZeroReviewAlarmExcept = pNetworkInfo->m_strZeroReviewAlarmExcept;
+
 			m_ctrlButtonUseSaveOrignalImage.SetCheck(m_bUpdateImageOriginal);
 			m_ctrlComboImageRotate.SetCurSel(m_nImageRotate);
 			m_ctrlComboImageFlip.SetCurSel(m_nImageFlip);
@@ -184,6 +191,9 @@
 	m_nImageRotate				= 0;
 	m_nImageFlip				= -1;
 
+	m_nZeroReviewAlarm			= 0;
+	m_strZeroReviewAlarmExcept	 = _T("");
+
 	UpdateData(FALSE);
 }
 
@@ -218,6 +228,9 @@
 			pNetworkInfo->m_bUpdateImageOriginal	= m_bUpdateImageOriginal;
 			pNetworkInfo->m_nImageRotate			= m_nImageRotate;
 			pNetworkInfo->m_nImageFlip				= m_nImageFlip;
+
+			pNetworkInfo->m_nZeroReviewAlarm		= m_nZeroReviewAlarm;
+			pNetworkInfo->m_strZeroReviewAlarmExcept = m_strZeroReviewAlarmExcept;
 		}
 	}
 	m_ctrlEditImageHeight.EnableWindow(TRUE);
diff --git a/ReviewSystem/ReviewSystemSetting/DlgNetwork.h b/ReviewSystem/ReviewSystemSetting/DlgNetwork.h
index 025aecf..35cf4d0 100644
--- a/ReviewSystem/ReviewSystemSetting/DlgNetwork.h
+++ b/ReviewSystem/ReviewSystemSetting/DlgNetwork.h
@@ -59,4 +59,6 @@
 	CComboBox m_ctrlComboImageRotate;
 	CComboBox m_ctrlComboImageFlip;
 
+	int m_nZeroReviewAlarm;
+	CString m_strZeroReviewAlarmExcept;
 };
diff --git a/ReviewSystem/ReviewSystemSetting/ReviewSystemSetting.rc b/ReviewSystem/ReviewSystemSetting/ReviewSystemSetting.rc
index 66cde8b..66d7c63 100644
--- a/ReviewSystem/ReviewSystemSetting/ReviewSystemSetting.rc
+++ b/ReviewSystem/ReviewSystemSetting/ReviewSystemSetting.rc
@@ -335,6 +335,12 @@
     RTEXT           "Upload DefectMap Image File Path :",IDC_STATIC,7,111,93,14,SS_CENTERIMAGE
     RTEXT           "WSI Image File Path :",IDC_STATIC,7,127,93,14,SS_CENTERIMAGE
     EDITTEXT        IDC_EDIT_SYS_NETWORK_WSI_IMAGE_PATH,105,129,267,14,ES_AUTOHSCROLL
+    RTEXT           "Review 0 Count Alarm : ",IDC_STATIC,15,289,85,14,SS_CENTERIMAGE
+    GROUPBOX        "Alarm Condition",IDC_STATIC,7,282,365,135
+    EDITTEXT        IDC_EDIT_SYS_NETWORK_UPLOAD_ZERO_COUNT_ALARM_CONDITION,105,290,55,14,ES_AUTOHSCROLL
+    LTEXT           "매 이상 연속 0리뷰시 발생",IDC_STATIC,162,289,85,14,SS_CENTERIMAGE
+    EDITTEXT        IDC_EDIT_SYS_NETWORK_UPLOAD_ZERO_COUNT_ALARM_CONDITION_2,249,289,55,14,ES_AUTOHSCROLL
+    LTEXT           "일 경우 제외",IDC_STATIC,305,290,59,14,SS_CENTERIMAGE
 END
 
 IDD_DIALOG_SYS_SETTING_SYSTEM_GANTRY DIALOGEX 0, 0, 363, 345
@@ -755,6 +761,11 @@
     0
 END
 
+IDD_DIALOG_SYS_SETTING_NETWORK AFX_DIALOG_LAYOUT
+BEGIN
+    0
+END
+
 
 /////////////////////////////////////////////////////////////////////////////
 //
diff --git a/ReviewSystem/ReviewSystemSetting/resource.h b/ReviewSystem/ReviewSystemSetting/resource.h
index f91454f..f94e837 100644
--- a/ReviewSystem/ReviewSystemSetting/resource.h
+++ b/ReviewSystem/ReviewSystemSetting/resource.h
@@ -142,7 +142,9 @@
 #define IDC_EDIT_SYS_NETWORK_UPLOAD_DEFECTMAP_IMAGE_PATH2 1039
 #define IDC_EDIT_SYS_NETWORK_WSI_IMAGE_PATH 1039
 #define IDC_BUTTON_SYS_SYSTEM_LIGHT_RESET 1040
+#define IDC_EDIT_SYS_NETWORK_UPLOAD_ZERO_COUNT_ALARM_CONDITION 1040
 #define IDC_BUTTON_SYS_SYSTEM_LIGHT_APPLY 1041
+#define IDC_EDIT_SYS_NETWORK_UPLOAD_ZERO_COUNT_ALARM_CONDITION_2 1041
 #define IDC_GRID_SYSTEM_LIGHT_INFO      1042
 #define IDC_EDIT_SYS_SG_GANTRY_IDX      1043
 #define IDC_EDIT_SYS_SG_HEADER_IDX      1044
@@ -230,7 +232,7 @@
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        145
+#define _APS_NEXT_RESOURCE_VALUE        146
 #define _APS_NEXT_COMMAND_VALUE         32771
 #define _APS_NEXT_CONTROL_VALUE         1094
 #define _APS_NEXT_SYMED_VALUE           107
diff --git a/ReviewSystem/include/CHMotorControls/MotorControl.h b/ReviewSystem/include/CHMotorControls/MotorControl.h
index 184515e..321f7ed 100644
--- a/ReviewSystem/include/CHMotorControls/MotorControl.h
+++ b/ReviewSystem/include/CHMotorControls/MotorControl.h
@@ -261,6 +261,12 @@
 	long					m_nAutoEnable;
 	long					m_nAutoEnablePrev;
 
+	/*< LYW 20220704 - #4220 ADD Start >*/
+	long					m_nMotorAlive;
+	long					m_nMotorAlivePrev;
+	DWORD					dwLastAliveTick;
+	/*< LYW 20220704 - #4220 ADD End >*/
+
 	// wsi signal
 	long					m_nWsiMotionEndPrev;
 	BOOL					m_bUseWsi;
diff --git a/ReviewSystem/include/CHMotorControls/MotorControlInfo.h b/ReviewSystem/include/CHMotorControls/MotorControlInfo.h
index 72ff3a2..d279447 100644
--- a/ReviewSystem/include/CHMotorControls/MotorControlInfo.h
+++ b/ReviewSystem/include/CHMotorControls/MotorControlInfo.h
@@ -25,6 +25,7 @@
 	virtual void IMC2P_GantrySoftWareTrigger(int nIndex, int nGantryIdx, int nTrigger) = 0;
 	virtual void IMC2P_WsiGantrySoftWareTrigger(int nIndex, int nGantryIdx, int nTrigger) = 0;
 	virtual void IMC2P_UpdateAutoEnable(int nIndex, int nAutoEnable){return;};
+	virtual void IMC2P_SendMotorAliveErrorAlram() = 0;
 	virtual void IMC2P_UpdateWsiMotionEnd(int nIndex, int nGantryIdx) = 0;
 	virtual BOOL IMC2P_GetUseWsi() = 0;
 };
diff --git a/ReviewSystem/include/CHReviewSetting/NetworkInfo.h b/ReviewSystem/include/CHReviewSetting/NetworkInfo.h
index 0c494e9..51898d7 100644
--- a/ReviewSystem/include/CHReviewSetting/NetworkInfo.h
+++ b/ReviewSystem/include/CHReviewSetting/NetworkInfo.h
@@ -34,5 +34,8 @@
 
 	int		m_nImageRotate;
 	int		m_nImageFlip;
+
+	int m_nZeroReviewAlarm;
+	CString m_strZeroReviewAlarmExcept;
 };
 

--
Gitblit v1.9.3