SDC C-Project CF Review 프로그램
ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.cpp
@@ -40,6 +40,11 @@
#include <fstream>
#include <afxwin.h>
#include <sstream> /* < KJG 20230605 - #4517 ADD >*/
#include <filesystem> /* < KJG 20230605 - #4517 ADD >*/
namespace fs = std::experimental::filesystem::v1; /* < KJG 20230605 - #4517 ADD >*/
#define GLASS_GD_FILE_PATH         _T("GD")
#define SIGNAL_SEND_RESULT_SUCCESS   _T("OK")
@@ -62,7 +67,8 @@
enum CPJT_GANTRY_TYPE { GantryType_Left, GantryType_Right };
enum Judgement_CPJT {
   Judge_OK_CPJT = 0, Judge_RP_CPJT, Judge_NG_CPJT, Judge_TR_CPJT, Judge_PR_CPJT, Judge_PT_CPJT, Judge_Review_CPJT, Judge_RC_CPJT, Judge_Size_CPJT, Judge_VI_CPJT, Judge_Rework_CPJT, Judge_Unknown_CPJT
//   Judge_OK_CPJT = 0, Judge_RP_CPJT, Judge_NG_CPJT, Judge_TR_CPJT, Judge_PR_CPJT, Judge_PT_CPJT, Judge_Review_CPJT, Judge_RC_CPJT, Judge_Size_CPJT, Judge_VI_CPJT, Judge_Rework_CPJT, Judge_Unknown_CPJT
   Judge_OK_CPJT = 0, Judge_RP_CPJT, Judge_NG_CPJT, Judge_TR_CPJT, Judge_PR_CPJT, Judge_ND_CPJT, Judge_PT_CPJT, Judge_Review_CPJT, Judge_RC_CPJT, Judge_Size_CPJT, Judge_VI_CPJT, Judge_Rework_CPJT, Judge_LN_CPJT, Judge_Unknown_CPJT, Judge_SR_CPJT      ////< KEJ 20231123 - #4669 MOD >
};
enum JudgeCode_CPJT {
   TRDF_CPJT = 0, BATR_CPJT, DOBB_CPJT, DOBS_CPJT, DOWW_CPJT, DOWB_CPJT, DOWS_CPJT
@@ -166,6 +172,9 @@
{
   m_bUseAFMHomePosition = TRUE;
   m_nGlassCount = 0;
   m_nStackZeroReviewCondition = 0;
   m_nUploadResultFailCount = 0;
   m_nStackUploadFailGlassCount = 0;
   CDitGlassRawClient* pDitGlassRaw = CDitGlassRawClient::GetInstance();
   if(pDitGlassRaw->ConnectServer() == FALSE)
   {
@@ -547,8 +556,16 @@
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Fail Data!"));
   }
   /*< SWK 20221226 - #4403 MOD Start >*/
//    AlignCamera_CameraControl(CameraControlStop);  // 210805 Align Camera Sequence 변경
//
//    SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_AlignComplete_CPJT);
//    m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Complete Signal!"));
   SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_AlignComplete_CPJT);
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Complete Signal!"));
   AlignCamera_CameraControl(CameraControlStop);
   /*< SWK 20221226 - #4403 MOD End >*/
   // LJY-20180905
   m_pSP2P->ISP2P_UpdateAlignResultStatus(0, pGlassResult);
@@ -663,9 +680,17 @@
      //   m_pSP2P->ISP2P_GetWSIControl(1)->SendWsiAfmSafePosMove();
      //}
      //Sleep(5000);
      SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
      SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewComplete_CPJT);
      //if (GetProcessStatus() != ProcessReviewEnd_CPJT && GetProcessStatus() != ProcessReviewUnloding_CPJT)
      if (GetReviewComplete() == FALSE)
      {
         SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
         SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewComplete_CPJT);
         SetReviewComplete(TRUE);
      }
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Success Signal!"));
      //LONGREUN
      //RecvSignalToSignalControl(PCControlRecvSignalIndex_Seq, 4);
      m_pSP2P->ISP2P_UpdateReviewProcessStatus(ReviewProcessStatus_None, nPlanIndex);
       
      AFM_SetAFMTracking(FALSE);
@@ -875,19 +900,27 @@
   CSequenceProcessData* pProcessData = static_cast<CSequenceProcessData*>(pParameter);
   m_nProcessStatus = pProcessData->nProcessStatus;
   //LONGREUN
   //SetSimulationMode(TRUE);
   switch(pProcessData->nProcessStatus)
   {
   case ProcessLoading_CPJT:
      Process_Loading();
      //LONGREUN
      //RecvSignalToSignalControl(PCControlRecvSignalIndex_Seq, 2);
      break;
   case ProcessAlignStart_CPJT:
      Process_AlignStart();
      //LONGREUN
      //RecvSignalToSignalControl(PCControlRecvSignalIndex_Seq, 3);
      break;
   case ProcessReadRawFile_CPJT:
      Process_ReadRawFile();
      //LONGREUN
      //RecvSignalToSignalControl(PCControlRecvSignalIndex_Seq, 1);
      break;
@@ -897,9 +930,14 @@
   case ProcessReviewEnd_CPJT:
      Process_ReviewEnd();
      //LONGREUN
      //RecvSignalToSignalControl(PCControlRecvSignalIndex_Seq, 5);
      break;
   case ProcessReviewUnloding_CPJT:
      Process_ReviewUnloading();
      //LONGREUN
      //RecvSignalToSignalControl(PCControlRecvSignalIndex_Seq, 0);
      break;
   }
@@ -919,9 +957,18 @@
   SetWsiType(-1);    //wsi reflow
   SetLastPointCheck(FALSE);
   bFileFind = FALSE;
   SetReviewComplete(FALSE);
   //SetUploadResultFailCount(0);
   m_pSP2P->ISP2P_GetDiagnosisHistory();
   bFileFind = FALSE;
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] FileMonitor Thread Stop Ready"));
   m_pSP2P->ISP2P_GetReviewProcessor()->FileMonitorThreadStop(); /* < KJG 20230630 - #4517 ADD Start >*/
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] FileMonitor Thread Stop Complete"));
   /*< LYW 20211109 - #3662 Delete Start >*/
   //m_pSP2P->ISP2P_GetDiagnosisHistory();
   /*< LYW 20211109 - #3662 Delete End >*/
   m_pSP2P->ISP2P_SetFirstReviewLeft(TRUE);
   m_pSP2P->ISP2P_SetFirstReviewRight(TRUE);
@@ -1039,7 +1086,6 @@
         // #3381 LYW CF AOI Review FDC TackTime ADD START
         pDitRawClient->GetGlassData()->m_tmReviewLoading = CTime::GetCurrentTime();
         // #3381 LYW CF AOI Review FDC TackTime ADD END
         CString strGlassIDTemp = NULL;
         CString strGlassStepIdTemp = NULL;
@@ -1047,7 +1093,6 @@
         strGlassIDTemp = pTransferData->strGlassID;
         strGlassStepIdTemp = pTransferData->strStepID;
         strGlassIDTemp = pTransferData->strGlassID;
         strcpy(pDitRawClient->GetGlassData()->m_strGlassID, strGlassIDTemp);
@@ -1072,7 +1117,8 @@
         /*bFileFind = FindRawBinFile(strFileName);*/
         pDitRawClient->SetReviewStart();
         Sleep(1000);
         //< SWK 20221226 - #4403 DEL >
//         Sleep(1000);
          m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Transfer Data Read Success!"));
 
@@ -1097,6 +1143,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)
@@ -1256,10 +1306,6 @@
{
    m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::IN] AlignStart!"));
   AlignCamera_CameraControl(CameraControlLive);  // 210805 Align Camera Sequence ����
   Sleep(300);
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
   if (GetSimulationMode() == FALSE)
   {
@@ -1267,6 +1313,31 @@
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Start Ack!"));
   }
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
   //#3561 210908 LYW ADD Start
    int nAlignReconnectRetryMaxCount = 3;
    for (int i = 0; i < nAlignReconnectRetryMaxCount; i++)
   {
      if (AlignCamera_CameraControl(CameraControlLive) == FALSE)
      {
         m_pSP2P->ISP2P_DisplayMessage(_T("[AlignStart] AlignConnect Fail! Reconect Start! ReconnectRetry count = %d"), nAlignReconnectRetryMaxCount + 1);
         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(10000);
         m_pSP2P->ISP2P_InitAlignCamera();
      }
      else
      {
         m_pSP2P->ISP2P_DisplayMessage(_T("[AlignStart] AlignConnect Success! "));
         break;
      }
   }
   //#3561 210908 LYW ADD End
   //< SWK 20221226 - #4403 MOD >
   Sleep(100);
   //original
//    if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_AlignStartAck_CPJT))
//       m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Start Ack!"));
@@ -1387,7 +1458,9 @@
   
   //pDitRawClient->SetReviewStart();
   Sleep(500);
   //< SWK 20221226 - #4403 DEL >
//   Sleep(500);
   //CString strJudgeData;
   m_pSP2P->ISP2P_GetSignalControl()->WriteData(_T("17110"), sizeof(pDitRawClient->GetGlassData()->m_strGlassJudge), pDitRawClient->GetGlassData()->m_strGlassJudge);
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::IN] ReadRawFile!"));
@@ -1448,7 +1521,8 @@
      int nTotalPlanCount = CalculatePlanData(pGlassResult);
      m_pSP2P->ISP2P_DisplayMessage(_T("[Read Raw File] Review All Plan Total Count : %d"), nTotalPlanCount);
      Sleep(1000);
      //< SWK 20221226 - #4403 DEL >
//      Sleep(1000);
      // send review ready
      //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
      if (GetSimulationMode() == FALSE)
@@ -1652,22 +1726,44 @@
      if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewEndAck_CPJT))
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] Send Review End Ack!"));
   }
   SetUploadResultFailCount(0);
   CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult();
   if (pGlassResult == NULL) return;
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
   //original
//    if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewEndAck_CPJT))
//       m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] Send Review End Ack!"));
   CDitGlassRawClient* m_pDitGlassRaw = CDitGlassRawClient::GetInstance();
   if (m_pSP2P->ISP2P_GetWSIControl(0)!=NULL)
   if (GetSimulationMode() == FALSE && m_pSP2P->ISP2P_GetWSIControl(0)!=NULL)
   {
      m_pSP2P->ISP2P_GetWSIControl(0)->SetWsiTimeOver();
      m_pSP2P->ISP2P_GetWSIControl(1)->SetWsiTimeOver();
      /*< LYW 20211015 - #3662 ADD Start >*/
//       m_pSP2P->ISP2P_GetWSIControl(0)->SetWsiEnd();
//       m_pSP2P->ISP2P_GetWSIControl(1)->SetWsiEnd();
      /*< LYW 20211015 - #3662 ADD End >*/
   }
   if (GetLastPointCheck() == FALSE)
   {
      Sleep(1000);
   }
   ReJudgeProcessing(m_pDitGlassRaw);
   /*< LYW 20220401 - ##4006 MOD Start >*/
   if (pGlassResult->m_AlignResult.GetResultCode() == Align_Success)
   {
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] Review ReJudgeProcessing Startl!"));
      ReJudgeProcessing(m_pDitGlassRaw);
   }
   else
   {
      m_pSP2P->ISP2P_DisplayMessage(_T("Align Code = %d, ReJudgeProcessing SKIPl!"), pGlassResult->m_AlignResult.GetResultCode());
   }
   /*< LYW 20220401 - ##4006 MOD End >*/
   //Origin
   //ReJudgeProcessing(m_pDitGlassRaw);
   m_pDitGlassRaw->GetGlassData()->m_tmReviewEnd = CTime::GetCurrentTime();
   if (m_pDitGlassRaw->isConnect() != FALSE) 
   {
@@ -1678,7 +1774,8 @@
   m_pDitGlassRaw->GetGlassData()->m_nReviewNum = m_pSP2P->ISP2P_GetReviewProcessor()->GetPlanReviewCount();
    //SendDVDataToSignalControl(); 
   if (GetLastPointCheck() == FALSE)
   //if (GetLastPointCheck() == FALSE)
   if (GetReviewComplete() == FALSE)
   {
      //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
      if (GetSimulationMode() == FALSE)
@@ -1686,6 +1783,7 @@
         SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
         SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewComplete_CPJT);
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Success Signal!"));
         SetReviewComplete(TRUE);
      }
      //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
      //original
@@ -1693,9 +1791,6 @@
//       SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewComplete_CPJT);
//       m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Success Signal!"));
   }
   CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult();
   if (pGlassResult==NULL) return;
   
   // review camera stop
   ReviewCamera_CameraControl(CameraControlStop);
@@ -1728,15 +1823,35 @@
   }
   g_pLog->DisplayMessage(_T("History map Start"));
   int nGlassResultCount = 0;
   CGlassResult*  pHistoryResult = m_pSP2P->ISP2P_GetNewHistoryResult(nGlassResultCount); //taek 210201
   g_pLog->DisplayMessage(_T("History map Copy"));
   ReadAOIMemory2(pHistoryResult);
   g_pLog->DisplayMessage(_T("History map TransferData"));
   UpdateHistoryResultFromTransferData(pHistoryResult, pGlassResult);
   g_pLog->DisplayMessage(_T("History Button Enable"));
   m_pSP2P->ISP2P_GetDiagnosisHistory2();
   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++;
         m_pSP2P->ISP2P_DisplayMessage(_T("Zero Review Condition ProdType = %s, ConditionStack = %d, AlarmExcept = %s, AlarmCondition = %d"), pTransferData->strProdType, m_nStackZeroReviewCondition, m_pSP2P->ISP2P_System_GetNetworkInfo()->m_strZeroReviewAlarmExcept, m_pSP2P->ISP2P_System_GetNetworkInfo()->m_nZeroReviewAlarm);
         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"));
   //    int nGlassResultCount = 0;
   //    CGlassResult*  pHistoryResult = m_pSP2P->ISP2P_GetNewHistoryResult(nGlassResultCount); //taek 210201
   //    g_pLog->DisplayMessage(_T("History map Copy"));
   //    ReadAOIMemory2(pHistoryResult);
   //    g_pLog->DisplayMessage(_T("History map TransferData"));
   //    UpdateHistoryResultFromTransferData(pHistoryResult, pGlassResult);
   //    g_pLog->DisplayMessage(_T("History Button Enable"));
   //    m_pSP2P->ISP2P_GetDiagnosisHistory2();
   /*< LYW 20211109 - #3662 Delete End >*/
   /*int nModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(); 
   for (int nModuleIdx = 0; nModuleIdx < nModuleCount; nModuleIdx++)
@@ -1783,7 +1898,10 @@
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
//    if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewUnloadingAck_CPJT))
//       m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Unloading Ack!"));
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::IN] FileMonitor Thread Start Ready"));
   m_pSP2P->ISP2P_GetReviewProcessor()->FileMonitorThreadStart(); /* < KJG 20230630 - #4517 ADD Start >*/
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::IN] FileMonitor Thread Start Complete"));
}
@@ -2252,7 +2370,7 @@
   int nCount = pRcpReviewInfo->GetRcpJudgeCellDefectCount();
   int nOK;
   int nCellTRJudge = 0, nCelllOKJuge = 0, nCelllPRJuge = 0;
   int nCellTRJudge = 0, nCelllOKJuge = 0, nCelllPRJuge = 0, nCelllPTJuge = 0;
   m_pSP2P->ISP2P_DisplayMessage(_T("[ReviewEnd] Start Cell Defect Rejudge"));
   for (int nCellIndex = 0; nCellIndex < nCellCount; nCellIndex++)
   {
@@ -2269,6 +2387,12 @@
      {
         nCelllPRJuge = nCelllPRJuge + 1;
      }
      /* < KEJ 20231123 - #4669 ADD Start > */
      else if (pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_PT_CPJT)
      {
         nCelllPTJuge = nCelllPTJuge + 1;
      }
      /* < KEJ 20231123 - #4669 ADD End > */
      BOOL bReJudge = FALSE, bSubReJudge = FALSE;
@@ -2322,6 +2446,19 @@
               m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE Cell DefectPRCount[%d] [%d]"), nCellIndex, pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgePR, pRcpJudgeInfo->GetJudgeCount());
            }
            break;
            /* < KEJ 20231123 - #4669 ADD Start > */
         case JudgeType_T8_PT:
            if (pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgePT >= pRcpJudgeInfo->GetJudgeCount())
            {
               m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell DefectPTCount[%d] >= [%d]"), nCellIndex, pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgePT, pRcpJudgeInfo->GetJudgeCount());
               bReJudge = TRUE;
            }
            else
            {
               m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE Cell DefectPTCount[%d] [%d]"), nCellIndex, pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgePT, pRcpJudgeInfo->GetJudgeCount());
            }
            break;
            /* < KEJ 20231123 - #4669 ADD End > */
         }
         // 2nd condition
@@ -2372,6 +2509,19 @@
               m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE Cell DefectPRCount[%d] [%d]"), nCellIndex, pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgePR, pRcpJudgeInfo->GetSubJudgeCount());
            }
            break;
            /* < KEJ 20231123 - #4669 ADD Start > */
         case JudgeType_T8_PT:
            if (pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgePT <= pRcpJudgeInfo->GetSubJudgeCount())
            {
               m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell DefectPTCount[%d] <= [%d]"), nCellIndex, pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgePT, pRcpJudgeInfo->GetSubJudgeCount());
               bSubReJudge = TRUE;
            }
            else
            {
               m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE Cell DefectPTCount[%d] [%d]"), nCellIndex, pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgePT, pRcpJudgeInfo->GetSubJudgeCount());
            }
            break;
            /* < KEJ 20231123 - #4669 ADD End > */
         }
         if (bReJudge & bSubReJudge)
@@ -2394,7 +2544,7 @@
                  {
                     nCelllOKJuge = 0;
                  }
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d]")
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d] PT[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge,nCelllPRJuge);
               }
               else if (pRawData->GetCellData(nCellIndex)->m_nJudgement==Judge_PR_CPJT)
@@ -2412,15 +2562,35 @@
                  {
                     nCelllPRJuge = 0;
                  }
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge);
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d] PT[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge, nCelllPTJuge);
               }
               /* < KEJ 20231123 - #4669 ADD Start > */
               else if (pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_PT_CPJT)
               {
                  int nbfJudge = pRawData->GetCellData(nCellIndex)->m_nJudgement;
                  pRawData->GetCellData(nCellIndex)->m_nJudgement = Judge_TR_CPJT;
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition : ReJudge Cell Defect Grade! [%d]->[%s]")
                     , nCellIndex, nIdx, nbfJudge, pRcpJudgeInfo->GetReJudgeCode());
                  nCelllPTJuge -= 1;
                  nCellTRJudge += 1;
                  if (nCelllPTJuge < 0)
                  {
                     nCelllPTJuge = 0;
                  }
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d] PT[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge, nCelllPTJuge);
               }
               /* < KEJ 20231123 - #4669 ADD End > */
               else
               {
                  m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd][%02d]Cell [%02d] ReJudge  Cell Defect Grade! [%s]->[%s]"), nCellIndex, nIdx,_T("TR"), _T("TR"));
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge);
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d] PT[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge, nCelllPTJuge);
               }
            }
            else if (pRcpJudgeInfo->GetReJudgeType() == JudgeType_T8_PR)
@@ -2440,8 +2610,8 @@
                  {
                     nCelllOKJuge = 0;
                  }
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge);
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d] PT[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge, nCelllPTJuge);
               }
               if (pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_TR_CPJT)
               {
@@ -2458,24 +2628,110 @@
                  {
                     nCellTRJudge = 0;
                  }
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge);
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d] PT[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge, nCelllPTJuge);
               }
               /* < KEJ 20231123 - #4669 ADD Start > */
               if (pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_PT_CPJT)
               {
                  int nbfJudge = pRawData->GetCellData(nCellIndex)->m_nJudgement;
                  pRawData->GetCellData(nCellIndex)->m_nJudgement = Judge_PR_CPJT;
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition : ReJudge Cell Defect Grade! [%d]->[%s]")
                     , nCellIndex, nIdx, nbfJudge, pRcpJudgeInfo->GetReJudgeCode());
                  nCelllPTJuge -= 1;
                  nCelllPRJuge += 1;
                  if (nCelllPTJuge < 0)
                  {
                     nCelllPTJuge = 0;
                  }
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d] PT[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge, nCelllPTJuge);
               }
               /* < KEJ 20231123 - #4669 ADD End > */
               else
               {
                  m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd][%02d]Cell [%02d] ReJudge  Cell Defect Grade! [%s]->[%s]"), nCellIndex, nIdx, _T("PR"), _T("PR"));
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge);
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d] PT[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge, nCelllPTJuge);
               }
            }
            /* < KEJ 20231123 - #4669 ADD Start > */
            else if (pRcpJudgeInfo->GetReJudgeType() == JudgeType_T8_PT)
            {
               if (pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_OK_CPJT)
               {
                  int nbfJudge = pRawData->GetCellData(nCellIndex)->m_nJudgement;
                  pRawData->GetCellData(nCellIndex)->m_nJudgement = Judge_PT_CPJT;
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition : ReJudge Cell Defect Grade! [%d]->[%s]")
                     , nCellIndex, nIdx, nbfJudge, pRcpJudgeInfo->GetReJudgeCode());
                  nCelllOKJuge -= 1;
                  nCelllPTJuge += 1;
                  if (nCelllOKJuge < 0)
                  {
                     nCelllOKJuge = 0;
                  }
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d] PT[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge, nCelllPTJuge);
               }
               if (pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_TR_CPJT)
               {
                  int nbfJudge = pRawData->GetCellData(nCellIndex)->m_nJudgement;
                  pRawData->GetCellData(nCellIndex)->m_nJudgement = Judge_PT_CPJT;
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition : ReJudge Cell Defect Grade! [%d]->[%s]")
                     , nCellIndex, nIdx, nbfJudge, pRcpJudgeInfo->GetReJudgeCode());
                  nCellTRJudge -= 1;
                  nCelllPTJuge += 1;
                  if (nCellTRJudge < 0)
                  {
                     nCellTRJudge = 0;
                  }
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d] PT[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge, nCelllPTJuge);
               }
               if (pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_PR_CPJT)
               {
                  int nbfJudge = pRawData->GetCellData(nCellIndex)->m_nJudgement;
                  pRawData->GetCellData(nCellIndex)->m_nJudgement = Judge_PT_CPJT;
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition : ReJudge Cell Defect Grade! [%d]->[%s]")
                     , nCellIndex, nIdx, nbfJudge, pRcpJudgeInfo->GetReJudgeCode());
                  nCelllPRJuge -= 1;
                  nCelllPTJuge += 1;
                  if (nCelllPRJuge < 0)
                  {
                     nCelllPRJuge = 0;
                  }
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d] PT[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge, nCelllPTJuge);
               }
               else
               {
                  m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd][%02d]Cell [%02d] ReJudge  Cell Defect Grade! [%s]->[%s]"), nCellIndex, nIdx, _T("PT"), _T("PT"));
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d] PT[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge, nCelllPTJuge);
               }
            }
            /* < KEJ 20231123 - #4669 ADD End > */
            else//OK
            {
               if (pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_OK_CPJT || pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_Unknown_CPJT)
               {
                  m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd][%02d]Cell [%02d] ReJudge  Cell Defect Grade! [%s]->[%s]"), nCellIndex, nIdx,_T("OK"), _T("OK"));
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge);
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d] PT[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge, nCelllPTJuge);
               }
               else
               {
@@ -2504,8 +2760,20 @@
                        nCelllPRJuge = 0;
                     }
                  }
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge);
                  /* < KEJ 20231123 - #4669 ADD Start > */
                  else if (pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_PT_CPJT)
                  {
                     nCelllOKJuge += 1;
                     nCelllPTJuge -= 1;
                     if (nCelllPTJuge < 0)
                     {
                        nCelllPTJuge = 0;
                     }
                  }
                  /* < KEJ 20231123 - #4669 ADD End > */
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]Cell [%02d]Condition CELL COUNT OK:[%d] TR[%d] PR[%d] PT[%d]")
                     , nCellIndex, nIdx, nCelllOKJuge, nCellTRJudge, nCelllPRJuge, nCelllPTJuge);
   
               }
            }
@@ -2584,6 +2852,19 @@
               m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE GLASS Defect PR Count[%d] [%d]"), nIdx, pRawData->GetGlassData()->m_nDefectNumJudgePR, pRcpJudgeInfo->GetJudgeCount());
            }
         break;
         /* < KEJ 20231123 - #4669 ADD Start > */
      case JudgeType_T8_PT:
         if (pRawData->GetGlassData()->m_nDefectNumJudgePT >= pRcpJudgeInfo->GetJudgeCount())
         {
            m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]GLASS Defect PT Count[%d] >= [%d]"), nIdx, pRawData->GetGlassData()->m_nDefectNumJudgePT, pRcpJudgeInfo->GetJudgeCount());
            bReJudge = TRUE;
         }
         else
         {
            m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE GLASS Defect PT Count[%d] [%d]"), nIdx, pRawData->GetGlassData()->m_nDefectNumJudgePT, pRcpJudgeInfo->GetJudgeCount());
         }
         break;
         /* < KEJ 20231123 - #4669 ADD End > */
         
      }
@@ -2633,6 +2914,18 @@
            m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE GLASS Defect PR Count[%d] [%d]"), nIdx, pRawData->GetGlassData()->m_nDefectNumJudgePR, pRcpJudgeInfo->GetSubJudgeCount());
         }
         break;
         /* < KEJ 20231123 - #4669 ADD Start > */
      case JudgeType_T8_PT:
         if (pRawData->GetGlassData()->m_nDefectNumJudgePT <= pRcpJudgeInfo->GetSubJudgeCount())
         {
            bSubReJudge = TRUE;
            m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]GLASS Defect PT Count[%d] <= [%d]"), nIdx, pRawData->GetGlassData()->m_nDefectNumJudgePT, pRcpJudgeInfo->GetSubJudgeCount());
         }
         else {
            m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] [%02d]ELSE GLASS Defect PT Count[%d] [%d]"), nIdx, pRawData->GetGlassData()->m_nDefectNumJudgePT, pRcpJudgeInfo->GetSubJudgeCount());
         }
         break;
         /* < KEJ 20231123 - #4669 ADD End > */
      
      }
@@ -2790,6 +3083,18 @@
BOOL CSequenceProcessor_CPJT::FindRawBinFile(CString strFileName)
{
   /* < KJG 20230605 - #4517 ADD Start >*/
   auto FuncStringSplit = [](string Sentence, char Separator, vector<string>& vec)
   {
      stringstream ss(Sentence);
      string tmp;
      while (getline(ss, tmp, Separator)) {
         vec.push_back(tmp);
      }
   };
   /* < KJG 20230605 - #4517 ADD End >*/
   //210128
   CString strFilePath = _T("");
   //pData->GetGlassData()->m_strFileName;
@@ -2811,60 +3116,121 @@
         //#3359_LYW CF AOI Review REVIEW_LOADING_COMPLETE_TIMEOVER START
         if (nReTryTime%2 == 0)
         {
            strFilePath = AOIRAWBIN_PATH;
            strFilePath = AOIRAWBIN_NETWORK_DRIVE_PATH;
         }
         else strFilePath = AOIRAWBIN_NETWORK_DRIVE_PATH;
         else strFilePath = AOIRAWBIN_PATH;
         strWild.Format("%s\\%s_*.bin", strFilePath, strFileName);
          akFileFinder.FindFile(strWild.GetBuffer(0), FALSE);
         //LYW LOG
         g_pLog->DisplayMessage(_T("[GlassLoading][FindRawBinFile] Find Path = %s, RetryCount = %d, ResultCode = [%d]"), strFilePath, 30-nReTryTime, GetLastError());
         //#3359_LYW CF AOI Review REVIEW_LOADING_COMPLETE_TIMEOVER END
         VECFINDDATA* pFindData = akFileFinder.getFindData();
         int nFileNamePos = strlen(akFileFinder.getProcessPath());
         std::map<LONGLONG, CString> mapSpanFileName;
         for (int i = 0; i < pFindData->size(); i++)
         //strWild.Format("%s\\%s_*.bin", strFilePath, strFileName); /* < KJG 20230605 - #4517 DEL >*/
         //akFileFinder.FindFile(strWild.GetBuffer(0), FALSE); /* < KJG 20230605 - #4517 DEL >*/
         /* < KJG 20230605 - #4517 ADD Start >*/
         auto timeStart = chrono::steady_clock::now();
         g_pLog->DisplayMessage(_T("[GlassLoading][FindRawBinFile] Start Find Path = %s, File Name = %s, TryCount = %d"), strFilePath, strFileName, 30 - nReTryTime);
         std::error_code err;
         vector<std::string> vtFileList;
         fs::path pathBinFile(strFilePath.GetBuffer(0));
         int constexpr SaperatorCount = 4, DateSize = 8, TimeSize = 6; // GLASSID_STEPID_'YYYYMMDD'_'HHMMSS' 포맷 확인
         for (auto iter = fs::directory_iterator(pathBinFile, err); iter != fs::directory_iterator(); iter++)
         {
            char* pFileName = &((*pFindData)[i]).name[nFileNamePos];
            fs::path p = iter->path();
            if (p.filename().stem().string().find(strFileName) != string::npos)
            {
               CakParser parser;
               parser.process(pFileName, "_.");
               if (parser.getTokNum() < 4) continue;
               if (parser.getTokNum() >= 6) continue; // 0401
               int nDataTime[8] = {};
               std::string strSearchFile = p.filename().stem().string();
               if (p.extension().string() == _T(".bin"))
               {
                  int nTokIndex = 0;
                  const char* pGlassId = parser.getTokStr(nTokIndex++);
                  const char* pStepId = parser.getTokStr(nTokIndex++);
                  char* pDate = &pFileName[parser.getTokPos(nTokIndex++)];
                  char* pTime = &pFileName[parser.getTokPos(nTokIndex++)];
                  nDataTime[0] = (pDate[0] - '0') * 1000 + (pDate[1] - '0') * 100 + (pDate[2] - '0') * 10 + (pDate[3] - '0') * 1;
                  nDataTime[1] = (pDate[4] - '0') * 10 + (pDate[5] - '0') * 1;
                  nDataTime[2] = (pDate[6] - '0') * 10 + (pDate[7] - '0') * 1;
                  nDataTime[3] = (pTime[0] - '0') * 10 + (pTime[1] - '0') * 1;
                  nDataTime[4] = (pTime[2] - '0') * 10 + (pTime[3] - '0') * 1;
                  nDataTime[5] = (pTime[4] - '0') * 10 + (pTime[5] - '0') * 1;
                  vtFileList.push_back(p.filename().stem().string());
               }
               CTime tmTemp(nDataTime[0], nDataTime[1], nDataTime[2], nDataTime[3], nDataTime[4], nDataTime[5]);
               CTimeSpan tmSpan = tmReviewLoading - tmTemp;
               mapSpanFileName.insert(std::make_pair(tmSpan.GetTotalSeconds(), pFileName));
            }
         }
         if (mapSpanFileName.empty() == FALSE)
         for (auto iter = vtFileList.begin(); iter != vtFileList.end(); )
         {
            if (mapSpanFileName.begin()->first < nCloseTime)
            vector<string> vtSplit;
            FuncStringSplit(*iter, _T('_'), vtSplit);
            if (vtSplit.size() == SaperatorCount && vtSplit[2].size() == DateSize && vtSplit[3].size() == TimeSize)
            {
               strFindFile = mapSpanFileName.begin()->second;
               iter++;
            }
            else
            {
               vtFileList.erase(iter);
            }
         }
         sort(vtFileList.begin(), vtFileList.end(), greater<>()); // 최신순으로 정렬
         string strPickFileName = vtFileList.empty() ? _T("NULL") : vtFileList.front();
         g_pLog->DisplayMessage(_T("[GlassLoading][FindRawBinFile] End File Count = %d, Pick File Name = %s, Tact = %d, ErrorCode = %d, ErrorMsg = %s"), vtFileList.size(), strPickFileName.c_str(), chrono::duration_cast<chrono::milliseconds>(chrono::steady_clock::now() - timeStart).count(),err.value(), err.message().c_str());
         if (vtFileList.empty() == FALSE)
         {
            vector<string> vtSplit;
            FuncStringSplit(strPickFileName, _T('_'), vtSplit);
            CTime tmTemp(stoi(vtSplit[2].substr(0, 4)), stoi(vtSplit[2].substr(4, 2)), stoi(vtSplit[2].substr(6, 2)), stoi(vtSplit[3].substr(0, 2)), stoi(vtSplit[3].substr(2, 2)), stoi(vtSplit[3].substr(4, 2)));
            CTimeSpan tmSpan = tmReviewLoading - tmTemp;
            if (tmSpan < nCloseTime)
            {
               strFindFile = strPickFileName.c_str();
               g_pLog->DisplayMessage(_T("[GlassLoading][FindRawBinFile] Find File Success"));
               break;
            }
         }
         /* < KJG 20230605 - #4517 ADD End >*/
         akFileFinder.clear();
         /* < KJG 20230605 - #4517 DEL Start >*/
         //#3359_LYW CF AOI Review REVIEW_LOADING_COMPLETE_TIMEOVER END
         //VECFINDDATA* pFindData = akFileFinder.getFindData();
         //int nFileNamePos = strlen(akFileFinder.getProcessPath());
         //std::map<LONGLONG, CString> mapSpanFileName;
         //for (int i = 0; i < pFindData->size(); i++)
         //{
         //   char* pFileName = &((*pFindData)[i]).name[nFileNamePos];
         //   {
         //      CakParser parser;
         //      parser.process(pFileName, "_.");
         //      if (parser.getTokNum() < 4) continue;
         //
         //      if (parser.getTokNum() >= 6) continue; // 0401
         //
         //      int nDataTime[8] = {};
         //      {
         //         int nTokIndex = 0;
         //         const char* pGlassId = parser.getTokStr(nTokIndex++);
         //         const char* pStepId = parser.getTokStr(nTokIndex++);
         //         char* pDate = &pFileName[parser.getTokPos(nTokIndex++)];
         //         char* pTime = &pFileName[parser.getTokPos(nTokIndex++)];
         //
         //         nDataTime[0] = (pDate[0] - '0') * 1000 + (pDate[1] - '0') * 100 + (pDate[2] - '0') * 10 + (pDate[3] - '0') * 1;
         //         nDataTime[1] = (pDate[4] - '0') * 10 + (pDate[5] - '0') * 1;
         //         nDataTime[2] = (pDate[6] - '0') * 10 + (pDate[7] - '0') * 1;
         //         nDataTime[3] = (pTime[0] - '0') * 10 + (pTime[1] - '0') * 1;
         //         nDataTime[4] = (pTime[2] - '0') * 10 + (pTime[3] - '0') * 1;
         //         nDataTime[5] = (pTime[4] - '0') * 10 + (pTime[5] - '0') * 1;
         //      }
         //
         //      CTime tmTemp(nDataTime[0], nDataTime[1], nDataTime[2], nDataTime[3], nDataTime[4], nDataTime[5]);
         //      CTimeSpan tmSpan = tmReviewLoading - tmTemp;
         //      mapSpanFileName.insert(std::make_pair(tmSpan.GetTotalSeconds(), pFileName));
         //   }
         //}
         //
         //if (mapSpanFileName.empty() == FALSE)
         //{
         //   if (mapSpanFileName.begin()->first < nCloseTime)
         //   {
         //      strFindFile = mapSpanFileName.begin()->second;
         //      break;
         //   }
         //}
         //
         //akFileFinder.clear();
         /* < KJG 20230605 - #4517 DEL End >*/
         Sleep(100);
      }
   }
@@ -3378,67 +3744,76 @@
void CSequenceProcessor_CPJT::UpdateHistoryResultFromTransferData(CGlassResult *pHistoryResult, CGlassResult* pGlassResult)
{
   if (pHistoryResult == NULL || pGlassResult == NULL) return;
   try
   {
      if (pHistoryResult == NULL || pGlassResult == NULL) return;
   CTime time = CTime::GetCurrentTime();
      CTime time = CTime::GetCurrentTime();
   CString strTime = _T("");
   strTime.Format(_T("%04d-%02d-%02d %02d:%02d:%02d"), time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond());
      CString strTime = _T("");
      strTime.Format(_T("%04d-%02d-%02d %02d:%02d:%02d"), time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond());
   // update transfer data to glass result
   pHistoryResult->m_nGlassSizeX = pGlassResult->m_nGlassSizeX;
   pHistoryResult->m_nGlassSizeY = pGlassResult->m_nGlassSizeY;
   pHistoryResult->m_nCollisionDistanceX = pGlassResult->m_nCollisionDistanceX;
   pHistoryResult->m_nCollisionDistanceY = pGlassResult->m_nCollisionDistanceY;
   pHistoryResult->m_nCollisionXPos1 = pGlassResult->m_nCollisionXPos1;
   pHistoryResult->m_nCollisionXPos2 = pGlassResult->m_nCollisionXPos2;
   pHistoryResult->m_nOriginDir = pGlassResult->m_nOriginDir;
   pHistoryResult->m_strResultDate = pGlassResult->m_strResultDate;
   pHistoryResult->m_vecReviewScheduleResult = pGlassResult->m_vecReviewScheduleResult;
   pHistoryResult->m_nCornerCutDir = pGlassResult->m_nCornerCutDir;
   pHistoryResult->m_bReadRawFile = pGlassResult->m_bReadRawFile;
   pHistoryResult->m_vecReviewResult = pGlassResult->m_vecReviewResult;
   pHistoryResult->m_strGlassLastName = pGlassResult->m_strGlassLastName;
   pHistoryResult->m_strGlassID = pGlassResult->m_strGlassID;
   pHistoryResult->m_strGlassCode = pGlassResult->m_strGlassCode;
   pHistoryResult->m_strMode = pGlassResult->m_strMode;
   pHistoryResult->m_strGlassType = pGlassResult->m_strGlassType;
   pHistoryResult->m_strDummyType = pGlassResult->m_strDummyType;
   pHistoryResult->m_strProdID = pGlassResult->m_strProdID;
   pHistoryResult->m_strOperID = pGlassResult->m_strOperID;
   pHistoryResult->m_strLotID = pGlassResult->m_strLotID;
   pHistoryResult->m_strPPID = pGlassResult->m_strPPID;
   pHistoryResult->m_strPPID_RC = pGlassResult->m_strPPID_RC;
   pHistoryResult->m_strJobType = pGlassResult->m_strJobType;
   pHistoryResult->m_strJobID = pGlassResult->m_strJobID;
   pHistoryResult->m_strLotSeqNum = pGlassResult->m_strLotSeqNum;
   pHistoryResult->m_strSlotSeqNum = pGlassResult->m_strSlotSeqNum;
   pHistoryResult->m_strPropertyCode = pGlassResult->m_strPropertyCode;
   pHistoryResult->m_strJobJudgeCode = pGlassResult->m_strJobJudgeCode;
   pHistoryResult->m_strJobGradeCode = pGlassResult->m_strJobGradeCode;
   pHistoryResult->m_strSubstrateType = pGlassResult->m_strSubstrateType;
   pHistoryResult->m_strProcessingFlag = pGlassResult->m_strProcessingFlag;
   pHistoryResult->m_strInspectionFlag = pGlassResult->m_strInspectionFlag;
   pHistoryResult->m_strSkipFlag = pGlassResult->m_strSkipFlag;
   pHistoryResult->m_strJobSize = pGlassResult->m_strJobSize;
   pHistoryResult->m_strGlassThickness = pGlassResult->m_strGlassThickness;
   pHistoryResult->m_strJobAngle = pGlassResult->m_strJobAngle;
   pHistoryResult->m_strJobFlip = pGlassResult->m_strJobFlip;
   pHistoryResult->m_strCuttingGlassType = pGlassResult->m_strCuttingGlassType;
   pHistoryResult->m_strProcessingCount = pGlassResult->m_strProcessingCount;
   pHistoryResult->m_strInspectionJudgeData = pGlassResult->m_strInspectionJudgeData;
   pHistoryResult->m_strPairJobID = pGlassResult->m_strPairJobID;
   pHistoryResult->m_strPairFlag = pGlassResult->m_strPairFlag;
   pHistoryResult->m_strOptionValue = pGlassResult->m_strOptionValue;
   pHistoryResult->m_strReserved = pGlassResult->m_strReserved;
   pHistoryResult->strGlassScanSchedule = pGlassResult->strGlassScanSchedule;// cmark
   pHistoryResult->m_strStepID = pGlassResult->m_strRTMSStepID; //taek 210126
   pHistoryResult->m_strEquipID = pGlassResult->m_strEquipID;
   pHistoryResult->m_strProcessID = pGlassResult->m_strProcessID;
   pHistoryResult->m_strUploadImgFileName = pGlassResult->m_strUploadImgFileName;
   pHistoryResult->m_strUnLoadingTime = strTime;
   pHistoryResult->m_mapDefectResult = pGlassResult->m_mapDefectResult;
   pHistoryResult->m_AlignResult = pGlassResult->m_AlignResult;
      // update transfer data to glass result
      pHistoryResult->m_nGlassSizeX = pGlassResult->m_nGlassSizeX;
      pHistoryResult->m_nGlassSizeY = pGlassResult->m_nGlassSizeY;
      pHistoryResult->m_nCollisionDistanceX = pGlassResult->m_nCollisionDistanceX;
      pHistoryResult->m_nCollisionDistanceY = pGlassResult->m_nCollisionDistanceY;
      pHistoryResult->m_nCollisionXPos1 = pGlassResult->m_nCollisionXPos1;
      pHistoryResult->m_nCollisionXPos2 = pGlassResult->m_nCollisionXPos2;
      pHistoryResult->m_nOriginDir = pGlassResult->m_nOriginDir;
      pHistoryResult->m_strResultDate = pGlassResult->m_strResultDate;
      pHistoryResult->m_vecReviewScheduleResult = pGlassResult->m_vecReviewScheduleResult;
      pHistoryResult->m_nCornerCutDir = pGlassResult->m_nCornerCutDir;
      pHistoryResult->m_bReadRawFile = pGlassResult->m_bReadRawFile;
      pHistoryResult->m_vecReviewResult = pGlassResult->m_vecReviewResult;
      pHistoryResult->m_strGlassLastName = pGlassResult->m_strGlassLastName;
      pHistoryResult->m_strGlassID = pGlassResult->m_strGlassID;
      pHistoryResult->m_strGlassCode = pGlassResult->m_strGlassCode;
      pHistoryResult->m_strMode = pGlassResult->m_strMode;
      pHistoryResult->m_strGlassType = pGlassResult->m_strGlassType;
      pHistoryResult->m_strDummyType = pGlassResult->m_strDummyType;
      pHistoryResult->m_strProdID = pGlassResult->m_strProdID;
      pHistoryResult->m_strOperID = pGlassResult->m_strOperID;
      pHistoryResult->m_strLotID = pGlassResult->m_strLotID;
      pHistoryResult->m_strPPID = pGlassResult->m_strPPID;
      pHistoryResult->m_strPPID_RC = pGlassResult->m_strPPID_RC;
      pHistoryResult->m_strJobType = pGlassResult->m_strJobType;
      pHistoryResult->m_strJobID = pGlassResult->m_strJobID;
      pHistoryResult->m_strLotSeqNum = pGlassResult->m_strLotSeqNum;
      pHistoryResult->m_strSlotSeqNum = pGlassResult->m_strSlotSeqNum;
      pHistoryResult->m_strPropertyCode = pGlassResult->m_strPropertyCode;
      pHistoryResult->m_strJobJudgeCode = pGlassResult->m_strJobJudgeCode;
      pHistoryResult->m_strJobGradeCode = pGlassResult->m_strJobGradeCode;
      pHistoryResult->m_strSubstrateType = pGlassResult->m_strSubstrateType;
      pHistoryResult->m_strProcessingFlag = pGlassResult->m_strProcessingFlag;
      pHistoryResult->m_strInspectionFlag = pGlassResult->m_strInspectionFlag;
      pHistoryResult->m_strSkipFlag = pGlassResult->m_strSkipFlag;
      pHistoryResult->m_strJobSize = pGlassResult->m_strJobSize;
      pHistoryResult->m_strGlassThickness = pGlassResult->m_strGlassThickness;
      pHistoryResult->m_strJobAngle = pGlassResult->m_strJobAngle;
      pHistoryResult->m_strJobFlip = pGlassResult->m_strJobFlip;
      pHistoryResult->m_strCuttingGlassType = pGlassResult->m_strCuttingGlassType;
      pHistoryResult->m_strProcessingCount = pGlassResult->m_strProcessingCount;
      pHistoryResult->m_strInspectionJudgeData = pGlassResult->m_strInspectionJudgeData;
      pHistoryResult->m_strPairJobID = pGlassResult->m_strPairJobID;
      pHistoryResult->m_strPairFlag = pGlassResult->m_strPairFlag;
      pHistoryResult->m_strOptionValue = pGlassResult->m_strOptionValue;
      pHistoryResult->m_strReserved = pGlassResult->m_strReserved;
      pHistoryResult->strGlassScanSchedule = pGlassResult->strGlassScanSchedule;// cmark
      pHistoryResult->m_strStepID = pGlassResult->m_strRTMSStepID; //taek 210126
      pHistoryResult->m_strEquipID = pGlassResult->m_strEquipID;
      pHistoryResult->m_strProcessID = pGlassResult->m_strProcessID;
      pHistoryResult->m_strUploadImgFileName = pGlassResult->m_strUploadImgFileName;
      pHistoryResult->m_strUnLoadingTime = strTime;
      pHistoryResult->m_mapDefectResult = pGlassResult->m_mapDefectResult;
      pHistoryResult->m_AlignResult = pGlassResult->m_AlignResult;
   }
   catch (...)
   {
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Review End] UpdateHistoryResultFromTransferData Error"));
      return;
   }
}
void CSequenceProcessor_CPJT::CreateResultDirectory(const CString& strGlassID, const CString& strDate)
@@ -3571,7 +3946,9 @@
         tmServerLoadingTime = CTime::GetCurrentTime();
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] access Shared Memory Fail"));
         strPath.Format(_T("%s\\%s_%04d%02d%02d%02d%02d%02d"), pNetworkInfo->m_strUploadImagePath, strGlassID, tmServerLoadingTime.GetYear(), tmServerLoadingTime.GetMonth(), tmServerLoadingTime.GetDay(), tmServerLoadingTime.GetHour(), tmServerLoadingTime.GetMinute(), tmServerLoadingTime.GetSecond());
         strImagePath.Format(_T("%s\\%s_%04d%02d%02d%02d%02d%02d"), strGlassID, tmServerLoadingTime.GetYear(), tmServerLoadingTime.GetMonth(), tmServerLoadingTime.GetDay(), tmServerLoadingTime.GetHour(), tmServerLoadingTime.GetMinute(), tmServerLoadingTime.GetSecond());
         //< SWK 20221226 - #4403 MOD >
//         strImagePath.Format(_T("%s\\%s_%04d%02d%02d%02d%02d%02d"), strGlassID, tmServerLoadingTime.GetYear(), tmServerLoadingTime.GetMonth(), tmServerLoadingTime.GetDay(), tmServerLoadingTime.GetHour(), tmServerLoadingTime.GetMinute(), tmServerLoadingTime.GetSecond());
         strImagePath.Format(_T("%s_%04d%02d%02d%02d%02d%02d"), strGlassID, tmServerLoadingTime.GetYear(), tmServerLoadingTime.GetMonth(), tmServerLoadingTime.GetDay(), tmServerLoadingTime.GetHour(), tmServerLoadingTime.GetMinute(), tmServerLoadingTime.GetSecond());
         CreateDirectory(strPath, NULL);
         pReviewProcessor->SetUploadImagePath(strPath);
         pReviewProcessor->SetReviewImagePath(strImagePath);
@@ -3595,6 +3972,10 @@
   {
      strPath.Format(_T("%s\\%s"), pNetworkInfo->m_strAlignImagePath, strGlassID);
      pAlignCameraControl->SetSaveImageBasePath(strPath);
      strPath.Format(_T("D:\\ResultData\\AlignOK\\%s"), strGlassID);
      pAlignCameraControl->SetSaveImageOKPath(strPath);
      strPath.Format(_T("D:\\ResultData\\AlignNG\\%s"), strGlassID);
      pAlignCameraControl->SetSaveImageNGPath(strPath);
   }
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Make Align image path End "));
}
@@ -3741,6 +4122,12 @@
      pGlassResult->m_AlignRecipe.dMatchingRate      = pRsRcpAlignInfo->m_dMatchingRate;
      pGlassResult->m_AlignRecipe.strFirstImageFile   = pRsRcpAlignInfo->m_strFirstImageFile;
      pGlassResult->m_AlignRecipe.strSecondImageFile   = pRsRcpAlignInfo->m_strSecondImageFile;
      /*< LYW 20211012 - #3671 ADD Start >*/
      pGlassResult->m_AlignRecipe.strFirstAssistantImageFile = pRsRcpAlignInfo->m_strFirstAssistantImageFile;
      pGlassResult->m_AlignRecipe.strSecondAssistantImageFile = pRsRcpAlignInfo->m_strSecondAssistantImageFile;
      pGlassResult->m_AlignRecipe.strMatchingPixelStandard = pRsRcpAlignInfo->m_strMatchingPixelStandard;
      pGlassResult->m_AlignRecipe.strMatchingAlarmCondition = pRsRcpAlignInfo->m_strMatchingAlarmCondition;
      /*< LYW 20211012 - #3671 ADD End >*/
      pGlassResult->m_AlignRecipe.strTotalPitchImageFile = pRsRcpAlignInfo->m_strTotalPitchImageFile;
      // edge find param
@@ -4208,7 +4595,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 >*/
      }
      }
@@ -4248,6 +4637,7 @@
         // set offset
         ApplyMotorOffset(pReview->nModuleIdx, pReview->nZoomIdx, MotorOffsetCamera + MotorOffsetMag+MotorOffset_Glass, dDefectPosX, dDefectPosY);
      
         m_pSP2P->CalcMotorOffSetValue(pReview->nModuleIdx, dDefectPosX, dDefectPosY);      //< KEJ 20230622 - #4526 ADD >
         //xpostemp = dDefectPosX;
         //ypostemp = dDefectPosY;
@@ -4506,7 +4896,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 >*/
         }
      }
@@ -4546,6 +4938,7 @@
         // set offset
         ApplyMotorOffset(pReview->nModuleIdx, pReview->nZoomIdx, MotorOffsetCamera + MotorOffsetMag + MotorOffset_Glass, dDefectPosX, dDefectPosY);
         m_pSP2P->CalcMotorOffSetValue(pReview->nModuleIdx, dDefectPosX, dDefectPosY);      //< KEJ 20230622 - #4526 ADD >
         //xpostemp = dDefectPosX;
         //ypostemp = dDefectPosY;
@@ -4629,6 +5022,16 @@
   SetWsiType(0);
   WSIAllReadySignal(1);
   Sleep(1000);
   /*< LYW 20211028 - #3718 ADD Start >*/
   // WSI Redeay 송신후 Review TimeOver 1회 추가 체크
   if (GetProcessStatus() == ProcessReviewEnd_CPJT || GetProcessStatus() == ProcessReviewUnloding_CPJT)
   {
      g_pLog->DisplayMessage(_T("[ProcessStop] WSI StartProcessing Sequence Stop Status : %d"), GetProcessStatus());
      return TRUE;
   }
   /*< LYW 20211028 - #3718 ADD End >*/
   if(!WSIAllStartSignal())
   {
      g_pLog->DisplayMessage(_T("[WSI] WSI Start Fail!!"));
@@ -4749,7 +5152,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 >*/
         }
      }
@@ -4790,6 +5195,8 @@
         // set offset
         ApplyMotorOffset(pWsi->nModuleIdx, -1, MotorOffsetCamera + MotorOffsetWSI + MotorOffset_Glass, dDefectPosX, dDefectPosY);
         m_pSP2P->CalcMotorOffSetValue(pWsi->nModuleIdx, dDefectPosX, dDefectPosY);      //< KEJ 20230622 - #4526 ADD >
         m_pSP2P->GetOffSetValue(nModuleIdx, pWsi->nAOICameraIdx, pWsi->nAOIScanIdx, pWsi->nUMOriginX / 1000.0, xpostemp, ypostemp);
@@ -7590,8 +7997,13 @@
   int nReviewAliveCamera01 = 0;
   //foucs 
   nRev_Cam1_Image_Contrast = m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast * 1000;
   nRev_Cam2_Image_Contrast = m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview01ImageContrast * 1000;
   /*< LYW 20211109 - #3662 MOD Start >*/
   nRev_Cam1_Image_Contrast = m_pSP2P->ISP2P_GetReview00ImageContrast() * 1000;
   nRev_Cam2_Image_Contrast = m_pSP2P->ISP2P_GetReview01ImageContrast() * 1000;
   /*< LYW 20211109 - #3662 MOD End >*/
   /*< Origin Code >*/
//    nRev_Cam1_Image_Contrast = m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast * 1000;
//    nRev_Cam2_Image_Contrast = m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview01ImageContrast * 1000;
   //nRev_PC_HDD_CHECK = GetDiskUsage() * 1000;
   //nWSI1_PC_HDD_CHECK = nRev_PC_HDD_CHECK;//GetDiskUsage() * 1000;
@@ -7679,6 +8091,9 @@
   pSignalControl->WritePacketData(_T("16136"), sizeof(nReviewVersion), (short*)&nReviewVersion);
   pSignalControl->WritePacketData(_T("16140"), sizeof(nWSI00Version), (short*)&nWSI00Version);
   pSignalControl->WritePacketData(_T("16144"), sizeof(nWSI01Version), (short*)&nWSI01Version);
   /*< LYW 20220415 - #4086 ADD Start >*/ //추가 필요
   /*< LYW 20220415 - #4086 ADD End >*/
   //CCHImageData pImageData;
@@ -7955,31 +8370,56 @@
   int nWSI01Version = 20210422;
   int nReviewAliveCamera00 = 1000;
   int nReviewAliveCamera01 = 1000;
   /*< LYW 20220415 - #4086 ADD Start >*/
   int   nFDCGRMSWVersion = 20200101;
   int   nFDCFTPUploaderSWVersion = 20200101;
   int   nFDCSyncSWVersion = 20200101;
   int   nFDCReviewSWVersion = 20200101;
   int   nFDCWSISWVersion00 = 20200101;
   int   nFDCWSISWVersion01 = 20200101;
   /*< LYW 20220415 - #4086 ADD End >*/
   //foucs 
   /*< LYW 20211109 - #3662 MOD Start >*/
   if (m_pSP2P != NULL)
   {
      if (m_pSP2P->ISP2P_GetCurrentGlassResult() != NULL)
      {
         nRev_Cam1_Image_Contrast = m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast * 1000;
         nRev_Cam2_Image_Contrast = m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview01ImageContrast * 1000;
      nRev_Cam1_Image_Contrast = m_pSP2P->ISP2P_GetReview00ImageContrast() * 1000;
      nRev_Cam2_Image_Contrast = m_pSP2P->ISP2P_GetReview01ImageContrast() * 1000;
         if (m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast <=-2 || m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast >=999)
         {
            nRev_Cam1_Image_Contrast = 0 * 1000;
         }
         if (m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast <=-2|| m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast >=999)
         {
            nRev_Cam2_Image_Contrast = 0 * 1000;
         }
      }
      else
      {
         nRev_Cam1_Image_Contrast = 0;
         nRev_Cam2_Image_Contrast = 0;
      }
      /*< LYW 20220415 - #4086 ADD Start >*/
      nFDCGRMSWVersion = m_pSP2P->ISP2P_GetGRMSWVersion();
      nFDCFTPUploaderSWVersion = m_pSP2P->ISP2P_GetFTPUploaderSWVersion();
      nFDCSyncSWVersion = m_pSP2P->ISP2P_GetSyncSWVersion();
      nFDCReviewSWVersion = m_pSP2P->ISP2P_GetReviewSWVersion();
      nFDCWSISWVersion00 = m_pSP2P->ISP2P_GetWSISWVersion(0);
      nFDCWSISWVersion01 = m_pSP2P->ISP2P_GetWSISWVersion(1);
      /*< LYW 20220415 - #4086 ADD End >*/
   }
   /*< LYW 20211109 - #3662 MOD End >*/
   /*< Origin Code >*/
//    if (m_pSP2P != NULL)
//    {
//       if (m_pSP2P->ISP2P_GetCurrentGlassResult() != NULL)
//       {
//
//          nRev_Cam1_Image_Contrast = m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast * 1000;
//          nRev_Cam2_Image_Contrast = m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview01ImageContrast * 1000;
//
//          if (m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast <=-2 || m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast >=999)
//          {
//             nRev_Cam1_Image_Contrast = 0 * 1000;
//          }
//          if (m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast <=-2|| m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast >=999)
//          {
//             nRev_Cam2_Image_Contrast = 0 * 1000;
//          }
//       }
//       else
//       {
//          nRev_Cam1_Image_Contrast = 0;
//          nRev_Cam2_Image_Contrast = 0;
//       }
//    }
@@ -8097,17 +8537,167 @@
   pSignalControl->WritePacketData(_T("16116"), sizeof(nRev_Cam1_Image_Contrast), (short*)&nRev_Cam1_Image_Contrast);
   pSignalControl->WritePacketData(_T("16120"), sizeof(nRev_Cam2_Image_Contrast), (short*)&nRev_Cam2_Image_Contrast);
   pSignalControl->WritePacketData(_T("16124"), sizeof(nRev_PC_HDD_CHECK), (short*)&nRev_PC_HDD_CHECK);
   pSignalControl->WritePacketData(_T("16128"), sizeof(nWSI1_PC_HDD_CHECK), (short*)&nWSI1_PC_HDD_CHECK);
   pSignalControl->WritePacketData(_T("16132"), sizeof(nWSI2_PC_HDD_CHECK), (short*)&nWSI2_PC_HDD_CHECK);
   /*< LYW 20220415 - #4086 ADD Start >*/
   pSignalControl->WritePacketData(_T("16124"), sizeof(nFDCSyncSWVersion), (short*)&nFDCSyncSWVersion);
   pSignalControl->WritePacketData(_T("16128"), sizeof(nFDCReviewSWVersion), (short*)&nFDCReviewSWVersion);
   pSignalControl->WritePacketData(_T("16132"), sizeof(nFDCFTPUploaderSWVersion), (short*)&nFDCFTPUploaderSWVersion);
   pSignalControl->WritePacketData(_T("16136"), sizeof(nFDCGRMSWVersion), (short*)&nFDCGRMSWVersion);
   pSignalControl->WritePacketData(_T("16140"), sizeof(nFDCWSISWVersion00), (short*)&nFDCWSISWVersion00);
   pSignalControl->WritePacketData(_T("16144"), sizeof(nFDCWSISWVersion01), (short*)&nFDCWSISWVersion01);
   /*< LYW 20220415 - #4086 ADD End >*/
   pSignalControl->WritePacketData(_T("16136"), sizeof(nReviewVersion), (short*)&nReviewVersion);
   pSignalControl->WritePacketData(_T("16140"), sizeof(nWSI00Version), (short*)&nWSI00Version);
   pSignalControl->WritePacketData(_T("16144"), sizeof(nWSI01Version), (short*)&nWSI01Version);
//    pSignalControl->WritePacketData(_T("16124"), sizeof(nRev_PC_HDD_CHECK), (short*)&nRev_PC_HDD_CHECK);
//    pSignalControl->WritePacketData(_T("16128"), sizeof(nWSI1_PC_HDD_CHECK), (short*)&nWSI1_PC_HDD_CHECK);
//    pSignalControl->WritePacketData(_T("16132"), sizeof(nWSI2_PC_HDD_CHECK), (short*)&nWSI2_PC_HDD_CHECK);
//
//    pSignalControl->WritePacketData(_T("16136"), sizeof(nReviewVersion), (short*)&nReviewVersion);
//    pSignalControl->WritePacketData(_T("16140"), sizeof(nWSI00Version), (short*)&nWSI00Version);
//    pSignalControl->WritePacketData(_T("16144"), sizeof(nWSI01Version), (short*)&nWSI01Version);
   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++;
      m_pSP2P->ISP2P_DisplayMessage(_T("Upload Ack is False"));
      if (UploadResultFailCount >= 3)
      {
         //SendSignalToSignalControl(PCControlSendSignalIndex_State, PCControlSend_ResultData_Upload_Fail, 1000);
         m_nStackUploadFailGlassCount++;
         m_pSP2P->ISP2P_DisplayMessage(_T("ResultFile Upload Fail Glass Count = %d"),m_nStackUploadFailGlassCount);
         if (m_nStackUploadFailGlassCount >= m_pSP2P->ISP2P_System_GetNetworkInfo()->m_nResultFileUploadFailAlarmCondition)
         {
            SendSignalToSignalControl(PCControlSendSignalIndex_State, PCControlSend_ResultData_Upload_Fail, 1000);
            m_nStackUploadFailGlassCount = 0;
            m_pSP2P->ISP2P_DisplayMessage(_T("ResultFile Upload Fail Alarm!"));
         }
         SetUploadResultFailCount(-1);
      }
      else
      {
         SetUploadResultFailCount(UploadResultFailCount);
      }
   }
   else
   {
      m_pSP2P->ISP2P_DisplayMessage(_T("Upload Ack is True"));
      m_nStackUploadFailGlassCount = 0;
   }
}
//#3358 KYH FDC  ADD END
DWORD CSequenceProcessor_CPJT::GetDiskUsage()
@@ -8438,8 +9028,8 @@
            m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Review Start Ack! => %d"), 1);
            break;
         case PCControlSend_ResultDataComplete_CPJT:
            m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Result Data Complete! => %d"), 1);
         case PCControlSend_ReviewEndAck_CPJT:
            m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Review End Ack! => %d"), 1);
            break;
         }
      }
@@ -8597,6 +9187,7 @@
   case PCControlRecv_AutoMode_CPJT:      // auto mode on
      {
         m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Mode] Auto Mode"));
         SetSimulationMode(FALSE);
         bResult = SetProcessMode(ProcessAutoMode_CPJT);
         if (bResult==FALSE) m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Mode] Auto Mode Error!"));
      }
@@ -8604,8 +9195,10 @@
   case PCControlRecv_ManualMode_CPJT:   // manual mode on
      {
         m_pSP2P->ISP2P_GetDiagnosisHistory2();
      /*< LYW 20211109 - #3662 Delete Start >*/
      //m_pSP2P->ISP2P_GetDiagnosisHistory2();
      /*< LYW 20211109 - #3662 Delete End >*/
         m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Mode] Manual Mode"));
         bResult = SetProcessMode(ProcessManualMode_CPJT);
         if (bResult==FALSE) m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Mode] Manual Mode Error!"));
@@ -8800,12 +9393,11 @@
   break;
   case PCControlRecv_Autodiagnosis:
   {
      //#3514_LYW_CF AOI Review �ڰ����� ��� ����_START
      /*< LYW 20210719 : #3517 ADD Start >*/
      CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl();
      CString strDiagnosisMode;
      pSignalControl->ReadData(_T("11160"), 2, strDiagnosisMode);
      int nDiagnosisMode = atoi(strDiagnosisMode);
      //#3514_LYW_CF AOI Review �ڰ����� ��� ����_END
      m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Diagno start => %d, DiagnosisMode => %d"), bSignalOn, nDiagnosisMode);
      if (bSignalOn) {
@@ -8815,7 +9407,7 @@
         
         m_pSP2P->ISP2P_GetDiagnosisManager()->RecvSignalToSignalControl(0, nDiagnosisMode);
      }
      //#3514_LYW_CF AOI Review �ڰ����� ��� ����_END
      /*< LYW 20210719 : #3517 ADD End >*/
      else
         bResult = SendSignalOffToSignalControl(PCControlSendSignalIndex_DiagnoAck, 0);
@@ -9155,7 +9747,7 @@
   AFM_SetAFMTracking(FALSE);
   SetWsiType(0);
   WSIAllReadySignal(0);
   WSIAllReadySignal(1);
   
   // send wsi start
   if(!WSIUserAllStartSignal())
@@ -9386,7 +9978,8 @@
   VectorDouble vectorCollisionPosX;
   vectorCollisionPosX.clear();
   //WSI
   pMotorControl->GantrySetTwoGantrySyncModeSend(1);
   // WSI result count
   for (int nModuleIdx=0; nModuleIdx<Module_GetModuleStatusCount(); nModuleIdx++)
@@ -9430,7 +10023,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 >*/
         }
      }
@@ -9473,6 +10068,15 @@
            vectorPosX.push_back(dDefectPosX);
            vectorPosY.push_back(dDefectPosY);            
         }
      }
      if (vectorPosX.empty() == TRUE)
      {
         //3360 LYW_ CF AOI QD Review WSI XY MotorMoving Error START
         g_pLog->DisplayMessage(_T("[GantryAutoGo] No Exist Send Point,TwoGantrySyncMode OFF!"), vectorPosX.size());
         g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Fail"), pModuleStatus->GetGantryIndex()); //taek 210128
         pMotorControl->GantrySetTwoGantrySyncModeSend(0);
         //3360 LYW_ CF AOI QD Review WSI XY MotorMoving Error END
      }
      if (m_pSP2P->ISP2P_GetReviewProcessor()->CheckMotionComplete() == FALSE)
@@ -9832,13 +10436,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();
@@ -10337,6 +10943,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();