SDC C-Project CF Review 프로그램
LYW
2022-03-30 e147f44d605bdce9c395c1fd66a88f6cc8106350
ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.cpp
@@ -48,9 +48,10 @@
#define AOIRAWBIN_PATH      "\\\\126.100.100.1\\d\\DIT_ResultData\\RawBin"
#define AOIRAWBIN_TEST_PATH      "d:\\DIT_ResultData\\RawBin"
#define AOIRAWBIN_NETWORK_DRIVE_PATH   "Y:\\RawBin"
enum CPJT_MeasureMode { CPJT_ModeAuto = 0, CPJT_ModeManual };
// [2017:4:18]-[WEZASW] : WSI Module 장착 설비의 경우 PlanType 번호 변경.
// [2017:4:18]-[WEZASW] : WSI Module
enum CPJT_PlanType { CPJT_PlanReview = 0, CPJT_PlanUser, CPJT_PlanWSI, CPJT_PlanMeasure, CPJT_PlanReflow, CPJT_PlanWsiReflow, CPJT_PlanWsiUser,CPJT_PlanWsiMultiShot
};
enum CPJT_InsepectionType{REVIEW_REFLOW = 0, WSI_REFLOW, REV_WSI,WSIUSER, USER,WSIMULTISHOT};
@@ -168,7 +169,7 @@
   CDitGlassRawClient* pDitGlassRaw = CDitGlassRawClient::GetInstance();
   if(pDitGlassRaw->ConnectServer() == FALSE)
   {
      g_pLog->DisplayMessage(_T("공유메모리 접근 실패!(Shared memory Access Fail)"));
      g_pLog->DisplayMessage(_T("(Shared memory Access Fail)"));
   }
}
    
@@ -182,17 +183,15 @@
   EnterCriticalSection(&m_csProcessStatus);
   
   BOOL bReturn = FALSE;
   // 현재 상태가 이전 상태와 다른가?
   
   //if (nProcessStatus!=m_nProcessStatus || nProcessStatus==0)
   if (1)//nProcessStatus!=m_nProcessStatus || nProcessStatus==0)
   {
      //if (nProcessStatus==0) // 초기(0) 상태이면..
      //if (nProcessStatus==0)
      //{
      //   bReturn = TRUE;
      //}
      //   else if (nProcessStatus==(m_nProcessStatus+1)) // 이전 상태 다음(+1)이면..
      //   else if (nProcessStatus==(m_nProcessStatus+1))
      //   {
      //      bReturn = TRUE;
      //   }
@@ -203,9 +202,8 @@
      //   bReturn = FALSE;
      //}
      
      if (bReturn) // 수행이면...
      if (bReturn)
      {
         // Thread 생성 후 Thread 수행
         CSequenceProcessData* pThreadData = new CSequenceProcessData(this);
         if (pThreadData)
         {
@@ -226,7 +224,6 @@
         }
      }
      else if(nProcessStatus==2){
         // Thread 생성 후 Thread 수행
         CSequenceProcessData* pThreadData = new CSequenceProcessData(this);
         if (pThreadData)
         {
@@ -276,7 +273,6 @@
   CReviewResult* pWsiResult = pGlassResult->GetWsiResult(nModuleIndex);
   if (pWsiResult==NULL) goto RESULT_FAIL;
   // 마지막 인덱스를 가져온다.
   int nCurResultIdx   = pWsiResult->GetLastSReviewResultIndex() + 1; // last index + 1
   int nStartResultIdx   = pWsiResult->GetStartSReviewResultIndex();
   int nEndResultIdx   = pWsiResult->GetEndSReviewResultIndex();
@@ -290,13 +286,11 @@
   int      nMPosY   = int(pPosition->dMotorPosY * 1000.0);
   double   dTime   = (double) m_ProcessTimer.GetDurationMilliSecond();
   // 인덱스가 다르면 비정상임.
   if (measureResut.nResultIndex != nCurResultIdx) 
   {
      goto RESULT_FAIL;
   }
   // 현재 데이터 저장.
   // measureResut
   if(pWsiResult->GetSReviewResultCount() == 0) return ;
@@ -323,7 +317,6 @@
   // set last result idx
   pWsiResult->SetLastSReviewResultIndex(nCurResultIdx);
   // 마지막 포인트까지 왔고, WSI 결과가 남아 있으면...
   if(nCurResultIdx==nEndResultIdx && nCurResultIdx<=pWsiResult->GetSReviewResultCount())
   {
      nStartResultIdx = nCurResultIdx + 1;
@@ -334,8 +327,7 @@
      pWsiResult->SetStartSReviewResultIndex(nStartResultIdx);
      pWsiResult->SetEndSReviewResultIndex(nEndResultIdx);
      // 나머지 포인트 리뷰 수행하자.
      ::Sleep(3000); // 딜레이는 필수임. 없으면 동작 안함.
      ::Sleep(3000);
//      Process_RemainWsiPoint(nModuleIndex);
   }
@@ -361,7 +353,6 @@
   CReviewResult* pWsiResult = pGlassResult->GetWsiUserResult(nModuleIndex);
   if (pWsiResult==NULL) goto RESULT_FAIL;
   // 마지막 인덱스를 가져온다.
   int nCurResultIdx   = pWsiResult->GetLastSReviewResultIndex() + 1; // last index + 1
   int nStartResultIdx   = pWsiResult->GetStartSReviewResultIndex();
   int nEndResultIdx   = pWsiResult->GetEndSReviewResultIndex();
@@ -375,13 +366,11 @@
   int      nMPosY   = int(pPosition->dMotorPosY * 1000.0);
   double   dTime   = (double) m_ProcessTimer.GetDurationMilliSecond();
   // 인덱스가 다르면 비정상임.
   if (measureResut.nResultIndex != nCurResultIdx) 
   {
      goto RESULT_FAIL;
   }
   // 현재 데이터 저장.
   // measureResut
   if(pWsiResult->GetSReviewResultCount() == 0) return ;
@@ -406,7 +395,6 @@
   // set last result idx
   pWsiResult->SetLastSReviewResultIndex(nCurResultIdx);
   // 마지막 포인트까지 왔고, WSI 결과가 남아 있으면...
   if(nCurResultIdx==nEndResultIdx && nCurResultIdx<=pWsiResult->GetSReviewResultCount())
   {
      nStartResultIdx = nCurResultIdx + 1;
@@ -417,8 +405,7 @@
      pWsiResult->SetStartSReviewResultIndex(nStartResultIdx);
      pWsiResult->SetEndSReviewResultIndex(nEndResultIdx);
      // 나머지 포인트 리뷰 수행하자.
      ::Sleep(3000); // 딜레이는 필수임. 없으면 동작 안함.
      ::Sleep(3000);
      //      Process_RemainWsiPoint(nModuleIndex);
   }
@@ -441,6 +428,8 @@
       g_pLog->DisplayMessage(_T("[AlignResult] Glass Result is NULL!"));
       SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_FAIL);
       m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Fail Signal!"));
      AlignCamera_CameraControl(CameraControlStop);  // 210805 Align Camera Sequence ����
       return;
   }
@@ -448,7 +437,6 @@
    CAlignResult *pAlignResult = &pGlassResult->m_AlignResult;
    CAlignRecipe *pAlignRecipe = &pGlassResult->m_AlignRecipe; 
 
    // 얼라인 자동조명 결과 레시피에 저장하자.
    CRsRcpAlignInfo *pRsRcpAlignInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpAlignInfo();
    if (pRsRcpAlignInfo!=NULL && pRsRcpAlignInfo->m_bAutoProcess)
    {
@@ -462,25 +450,21 @@
          pRsRcpAlignInfo->m_dSecondCamExposure = pCurAlignResult->dExposureTime[1];
       }
 
       // 레시피 데이타 저장
       //m_pDoc->Recipe_WriteRecipeFile();
    }
 
 
    BOOL bLastAlignResult = FALSE;
    CCoordCalibrator *pCoordCalibrator = m_pSP2P->ISP2P_GetCoordCalibrator();
    // 최종 얼라인 결과..
    if (pCoordCalibrator && pCurAlignResult->nResultCode==Align_Success)
    {
       g_pLog->DisplayMessage(_T("[AlignResult] Align Find Success!"));
 
       // 얼라인 결과 글라스 정보에 갱신
       *pAlignResult = *pCurAlignResult;
 
       pCoordCalibrator->SetFirstMarkPos(pAlignResult->dFindPositionX[0], pAlignResult->dFindPositionY[0], pAlignRecipe->dGlassPositionX[0], pAlignRecipe->dGlassPositionY[0]);
       pCoordCalibrator->SetSecondMarkPos(pAlignResult->dFindPositionX[1], pAlignResult->dFindPositionY[1], pAlignRecipe->dGlassPositionX[1], pAlignRecipe->dGlassPositionY[1]);
 
       // 각도 계산
       if(pCoordCalibrator->CalculateAlignResult() == TRUE)
       {
          sAlignResult = pCoordCalibrator->GetAlignResult();
@@ -489,38 +473,35 @@
          bLastAlignResult = !pAlignRecipe->bRotateProcess;
       }
 
       // 글라스 각도 보정 유무
       CCameraControlAlign *pAlignCameraControl   = m_pSP2P->ISP2P_GetAlignCameraControl();
       SThetaMotorInfo* pThetaMotorInfo         = m_pSP2P->ISP2P_GetThetaMotorInfo();
       CMotorControl* pMotorControl            = m_pSP2P->ISP2P_GetMotorControl();
 
       if (pAlignRecipe->bRotateProcess && pAlignCameraControl && pMotorControl && pThetaMotorInfo)
       {
          if (fabs(sAlignResult.dDegree) <= pAlignRecipe->dGlassAngleMin) // 현재 글라스 각도가 최소각보다 작으면 성공
          if (fabs(sAlignResult.dDegree) <= pAlignRecipe->dGlassAngleMin)
          {
             bLastAlignResult = TRUE;
             g_pLog->DisplayMessage(_T("[AlignResult] Success! Last Glass Angle : %.8lf degree, Retry Count : %d ea"), 
                sAlignResult.dDegree,  pCurAlignResult->nFindCount);
          }
          else if (fabs(sAlignResult.dDegree) > pAlignRecipe->dGlassAngleMax) // 현재 글라스 각도가 최대각보다 크면 실패
          else if (fabs(sAlignResult.dDegree) > pAlignRecipe->dGlassAngleMax)
          {
             bLastAlignResult = FALSE;
             g_pLog->DisplayMessage(_T("[AlignResult] FAIL! Last Glass Angle : %.8lf degree, Retry Count : %d ea"), 
                sAlignResult.dDegree,  pCurAlignResult->nFindCount);
          }
          else if (pCurAlignResult->nFindCount < pAlignRecipe->nRetryCount) // 재보정 횟수가 레시피 횟수 이하이면 재보정 수행
          else if (pCurAlignResult->nFindCount < pAlignRecipe->nRetryCount)
          {
             g_pLog->DisplayMessage(_T("[AlignResult] Current Glass Angle : %.8lf degree, Retry Count : %d ea"), 
                sAlignResult.dDegree,  pCurAlignResult->nFindCount);
 
             // 모터로 각도 보정..
             double dCalAngle = sAlignResult.dDegree;
             dCalAngle = pThetaMotorInfo->dPosition - dCalAngle ;
             g_pLog->DisplayMessage(_T("[AlignResult] Move Rotate Glass Angle : %.8lf degree"), dCalAngle);
             pMotorControl->AxisThetaManualGoEnd(dCalAngle);
             ::Sleep(100);
 
             // 얼라인 ReProcess
             if (pAlignCameraControl->AlignProcess())
             {
                g_pLog->DisplayMessage(_T("[AlignResult] Align Find Process ReStarted!"));
@@ -555,8 +536,7 @@
       //m_pView->SetAlignResult(pAlignResult->nResultCode, sAlignResult.dOriginX, sAlignResult.dOriginY, sAlignResult.dDegree);
    }
 
   // PCControl 얼라인 신호 전송.
   if (bLastAlignResult) // 최종 얼라인결과...
   if (bLastAlignResult)
   {   
      SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Success Data!"));
@@ -566,6 +546,8 @@
      SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_FAIL);
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Fail Data!"));
   }
   AlignCamera_CameraControl(CameraControlStop);  // 210805 Align Camera Sequence 변경
   SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_AlignComplete_CPJT);
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Complete Signal!"));
@@ -686,15 +668,14 @@
      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!"));
      //LONGREUN
      //RecvSignalToSignalControl(PCControlRecvSignalIndex_Seq, 4);
      m_pSP2P->ISP2P_UpdateReviewProcessStatus(ReviewProcessStatus_None, nPlanIndex);
       
      //데모용
      AFM_SetAFMTracking(FALSE);
      return;
   }
   //190727 chm WSI 진행시 End 체크 후 진행
   if(nBeforePlanIndex== CPJT_PlanWSI||nBeforePlanIndex== CPJT_PlanWsiReflow||nBeforePlanIndex== CPJT_PlanWsiUser)
   {
      if(pPlanInfo->m_nReviewType == CPJT_PlanWSI ||pPlanInfo->m_nReviewType == CPJT_PlanWsiReflow||pPlanInfo->m_nReviewType== CPJT_PlanWsiUser || pPlanInfo->m_nReviewType == CPJT_PlanWsiMultiShot)
@@ -723,13 +704,12 @@
      }
   }
   //190727 chm WSI type 진행후 Review 플랜시 진행시 카메라가 글라스 밖에 있을경우를 위한...
   if(nBeforePlanIndex== CPJT_PlanWSI ||nBeforePlanIndex== CPJT_PlanWsiReflow||nBeforePlanIndex== CPJT_PlanWsiUser)
   {
      if(  pPlanInfo->m_nReviewType == CPJT_PlanReview|| pPlanInfo->m_nReviewType == CPJT_PlanUser|| pPlanInfo->m_nReviewType == CPJT_PlanMeasure|| pPlanInfo->m_nReviewType == CPJT_PlanReflow)
      {
         CTotalPitchMeasure* pTotapPithMeasure = m_pSP2P->ISP2P_GetTotalPitchMeasure(); // 빌려쓰기! 20190730 chm 나중에 함수로 따로....
         CTotalPitchMeasure* pTotapPithMeasure = m_pSP2P->ISP2P_GetTotalPitchMeasure();
   
         const CMotorControlInfo* pSystemMotorInfo = m_pSP2P->ISP2P_System_GetMotorInfo();
         if(pSystemMotorInfo !=NULL) 
@@ -773,8 +753,6 @@
      if(pPlanInfo == NULL) continue;
      //210325
      //END 나 언로딩이 되어버렸지만 해당 함수가 쓰레드로 돌아가고 있어 start 함수를 타버림
      //그것에 대한 예외처리
      if (GetProcessStatus() == ProcessReviewEnd_CPJT || GetProcessStatus() == ProcessReviewUnloding_CPJT)
      {
         g_pLog->DisplayMessage(_T("[ProcessStop] StartProcessing Sequence Stop Status : %d"), GetProcessStatus());
@@ -787,6 +765,20 @@
         if (( nTotalCount += pGlassResult->GetTotalSReviewResultCount()) > 0)
         {
            m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] Review Plan Start!"));
            //LYW DCOLL �ӽ���ġ
            CDitGlassRawClient *pDitRawClient = CDitGlassRawClient::GetInstance();
            if (pDitRawClient->isConnect() == TRUE)
            {
               _grmDefectData* pSharedDefect = pDitRawClient->GetDefectData(0);//pReviewResult->nDefectidx2
               _grmDefectReviewData * pSharedDefectReview = &pSharedDefect->m_ReviewDefect;
               //size_t CharactersConverted;
               //wcstombs_s(&CharactersConverted, pSharedDefectReview->m_strRevImageName, pReviewResult->strImgFileName, _TRUNCATE);
               strcpy(pSharedDefectReview->m_strRevImageName, "");
            }
            //LYW DCOLL �ӽ���ġ
            ::Sleep(nWaitTime);
            m_pSP2P->ISP2P_GetReviewProcessor()->ResetGantryDone();
            bExcute = ReviewStartProcessing(pGlassResult, nPlanIdx);
@@ -815,7 +807,7 @@
            m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] WSI Plan End!"));
         }
         break;
      //미사용
      case CPJT_PlanMeasure:
         if (( nTotalCount += pGlassResult->GetTotalSMeasureResultCount()) > 0)
         {
@@ -887,19 +879,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;
@@ -909,12 +909,20 @@
   case ProcessReviewEnd_CPJT:
      Process_ReviewEnd();
      //LONGREUN
      //RecvSignalToSignalControl(PCControlRecvSignalIndex_Seq, 5);
      break;
   case ProcessReviewUnloding_CPJT:
      Process_ReviewUnloading();
      //LONGREUN
      //RecvSignalToSignalControl(PCControlRecvSignalIndex_Seq, 0);
      break;
   }
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 ADD START
   SetSimulationMode(FALSE);
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 ADD END
   return;
}
@@ -924,17 +932,30 @@
   AllAckSignalOff();
   m_pSP2P->ISP2P_GetReviewProcessor()->ResetGantryDone();
   SetCheckWSIEnd(-1); //190726 wsiend체크 초기화
   SetWsiType(-1);    //wsi reflow 타입 구별 초기화
   SetCheckWSIEnd(-1); //190726
   SetWsiType(-1);    //wsi reflow
   SetLastPointCheck(FALSE);
   bFileFind = FALSE;
   m_pSP2P->ISP2P_GetDiagnosisHistory();
   if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_LoadingAck_CPJT))
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading Ack Signal!"));
   /*< LYW 20211109 - #3662 Delete Start >*/
   //m_pSP2P->ISP2P_GetDiagnosisHistory();
   /*< LYW 20211109 - #3662 Delete End >*/
   m_pSP2P->ISP2P_SetFirstReviewLeft(TRUE);
   m_pSP2P->ISP2P_SetFirstReviewRight(TRUE);
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
   if (GetSimulationMode() == FALSE)
   {
      if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_LoadingAck_CPJT))
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading Ack Signal!"));
   }
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
   //Original
//    if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_LoadingAck_CPJT))
//       m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading Ack Signal!"));
    // read config file
    if(!m_pSP2P->ISP2P_System_ReadConfigFile())
       m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor] System Value Loading FAIL!"));   
@@ -952,18 +973,18 @@
    }
    m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Glass Result Count : %d ea"), nGlassResultCount);
   
   pGlassResult->ResetDefocusCount();//로딩 부분에서 defocus count 초기화 190821 chm
   pGlassResult->ResetDefocusCount();
    CTime time = CTime::GetCurrentTime();
    pGlassResult->m_strResultDate.Format(_T("%04d.%02d.%02d"), time.GetYear(), time.GetMonth(), time.GetDay());
   //if(Revolver_SetGoHome(0)) // 리볼버 HOME 시퀀스
   //if(Revolver_SetGoHome(0))
   //{
   //   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Revolver Set GoHome Success!"));
   //}
   //210330 kyh Align Image 초기화
   //#3357 KYH Align Image ADD START
   CCameraControlAlign* pAlignCameraControl = m_pSP2P->ISP2P_GetAlignCameraControl();
   if (pAlignCameraControl != NULL)
   {
@@ -971,6 +992,7 @@
      g_pLog->DisplayMessage(_T("[Align] Align Image Clear"));
   }
   //#3357 KYH Align Image ADD END
    // get transfer data
    int nResultCode = 0;
@@ -997,13 +1019,20 @@
         if (pDitRawClient->isConnect()==FALSE)
         {
            m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading]공유메모리 연결 끊김 재연결 시도 "));
            m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] DitRawClient Connect Fail "));
            int nReconnect=0;
            while (1)
            {
               if (nReconnect == 3)
               {
                  SendResultToSignalControl(PCControlSendData_LoadingResult_CPJT, SIGNAL_SEND_RESULT_FAIL);
                  //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
                  if (GetSimulationMode() == FALSE)
                  {
                     SendResultToSignalControl(PCControlSendData_LoadingResult_CPJT, SIGNAL_SEND_RESULT_FAIL);
                  }
                  //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
                  //original
                  /*SendResultToSignalControl(PCControlSendData_LoadingResult_CPJT, SIGNAL_SEND_RESULT_FAIL);*/
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading FAIL Signal!"));
                  break;
@@ -1012,11 +1041,11 @@
               Sleep(1000);
               if (pDitRawClient->isConnect() == FALSE)
               {
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading]공유메모리 연결 실패 Count[%d]"), nReconnect);
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading]DitRawClient Connect Fail Count[%d]"), nReconnect);
               }
               else
               {
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading]공유메모리 연결 성공"));
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading]DitRawClient Connect Success"));
                  break;
               }
               nReconnect += 1;
@@ -1025,6 +1054,10 @@
            
         }
         // #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;
@@ -1041,8 +1074,21 @@
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading Success Signal!"));
         strFileName.Format(_T("%s_%s"), strGlassIDTemp, strGlassStepIdTemp);
         bFileFind = FindRawBinFile(strFileName);
         //bFileFind = TRUE;
         //������Ʈ��
         //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
         if (GetSimulationMode() == FALSE)
         {
            bFileFind = FindRawBinFile(strFileName);
         }
         else
         {
            bFileFind = TRUE;
         }
         //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
         //original
         /*bFileFind = FindRawBinFile(strFileName);*/
         pDitRawClient->SetReviewStart();
         Sleep(1000);
@@ -1087,7 +1133,7 @@
       }
    }
   //// 190725 고객사 요청사항 chm ASCEND 시 alarm
   //// 190725 chm ASCEND alarm
   const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo();
   const CRcpSortingInfo *pSortingInfo = pRsRcpReviewInfo->GetRcpReviewSortInfo();
@@ -1104,7 +1150,7 @@
   
   
   ////레시피 세팅으로 옴김 190618
   ////190618
   if(GetUseAfmHomePosition())
   {
   g_pLog->DisplayMessage(_T("[AFM] AFM Home Position Start!!!"));
@@ -1113,7 +1159,6 @@
   }
   //공유메모리 커멘드 리뷰 스타트(글라스 로딩)
   CDitGlassRawClient* pDitSharedGlassRaw = CDitGlassRawClient::GetInstance();
   if (pDitSharedGlassRaw->isConnect() == FALSE) {
      m_pSP2P->ISP2P_DisplayMessage(_T("[DitGlassRawClient] Shared Memory Connect Fail"));
@@ -1148,25 +1193,42 @@
    // review camera stop
   ReviewCamera_CameraControl(CameraControlStop);   
   //AlignCamera_CameraControl(CameraControlLive);
   AlignCamera_CameraControl(CameraControlStop);  // 210805 Align Camera Sequence ����
    // send signal to plc
    if (nResultCode==0)
    {
       SendResultToSignalControl(PCControlSendData_LoadingResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
       m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading Success Signal!"));
    }
    else
    {
       SendResultToSignalControl(PCControlSendData_LoadingResult_CPJT, SIGNAL_SEND_RESULT_FAIL);
       m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading FAIL Signal!"));
    }
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
      // send signal to plc
   if (GetSimulationMode() == FALSE)
   {
      if (nResultCode == 0)
      {
         SendResultToSignalControl(PCControlSendData_LoadingResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading Success Signal!"));
      }
      else
      {
         SendResultToSignalControl(PCControlSendData_LoadingResult_CPJT, SIGNAL_SEND_RESULT_FAIL);
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading FAIL Signal!"));
      }
   }
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
   //original
//     send signal to plc
//         if (nResultCode==0)
//         {
//            SendResultToSignalControl(PCControlSendData_LoadingResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
//            m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading Success Signal!"));
//         }
//         else
//         {
//            SendResultToSignalControl(PCControlSendData_LoadingResult_CPJT, SIGNAL_SEND_RESULT_FAIL);
//            m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading FAIL Signal!"));
//         }
 
    // send cell data to review processorm_pDitGlass
    CReviewProcessor* pReviewProcessor = m_pSP2P->ISP2P_GetReviewProcessor();
    if(pReviewProcessor == NULL) return ;   
    pReviewProcessor->SetCellData(pGlassResult);
    pReviewProcessor->SetReviewCount(0);         // 리뷰 Sequence No 초기화.
    pReviewProcessor->SetReviewCount(0);
   pReviewProcessor->SetPlanReviewCount(0);
   pReviewProcessor->SetPlanWSICount(0);
    // Process Status Update
@@ -1188,8 +1250,16 @@
       m_pSP2P->ISP2P_UpdateDefectFilter(pDefectFilter);
    }   
   
   SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_LoadingComplete_CPJT);
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading Complete Signal!"));
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
   if (GetSimulationMode() == FALSE)
   {
      SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_LoadingComplete_CPJT);
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading Complete Signal!"));
   }
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
   //original
//    SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_LoadingComplete_CPJT);
//    m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading Complete Signal!"));
    m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::OUT] Loading!"));
@@ -1205,17 +1275,57 @@
{
    m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::IN] AlignStart!"));
   if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_AlignStartAck_CPJT))
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Start Ack!"));
   //Sleep(400);//프레임 문제 딜레이 주기 chm190602
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
   if (GetSimulationMode() == FALSE)
   {
      if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_AlignStartAck_CPJT))
         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
   Sleep(300);
   //original
//    if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_AlignStartAck_CPJT))
//       m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Start Ack!"));
    // 1. get current glass result
    CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult();
    if (pGlassResult==NULL) {   return;   }
    if (pGlassResult==NULL)
   {
      Sleep(350);
      AlignCamera_CameraControl(CameraControlStop);  // 210805 Align Camera Sequence ����
      return;
   }
 
   const CRsRcpAlignInfo* pRsRcpAlignInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpAlignInfo();
   if(pRsRcpAlignInfo == NULL)   return;
   if (pRsRcpAlignInfo == NULL)
   {
      Sleep(350);
      AlignCamera_CameraControl(CameraControlStop);  // 210805 Align Camera Sequence ����
      return;
   }
    // 2. get align camera control   
    CCameraControlAlign* pAlignCameraControl = m_pSP2P->ISP2P_GetAlignCameraControl();
 
@@ -1223,23 +1333,48 @@
   if(pRsRcpAlignInfo->m_bAlignSkipMode)
   {
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Align Skip Mode !!!!!!!"));
      //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
      if (GetSimulationMode() == FALSE)
      {
         SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align SUCCESS Data!"));
         SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_AlignComplete_CPJT);
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Complete Signal!"));
         //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
      }
      //original
//       SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
//       m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align SUCCESS Data!"));
//       SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_AlignComplete_CPJT);
//       m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Complete Signal!"));
      SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align SUCCESS Data!"));
      SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_AlignComplete_CPJT);
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Complete Signal!"));
      Sleep(350);
      AlignCamera_CameraControl(CameraControlStop);  // 210805 Align Camera Sequence ����
   }
   else
   {
      // 190710 SJB Align Camera Disconnect Check, Align Step 진행 전에 확인한다.
      // 190710 SJB Align Camera Disconnect Check, Align Step
      if(pAlignCameraControl)
      {
         if(pAlignCameraControl->AlignCameraDisconnectCheck() == FALSE)
         {
            SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_FAIL);
            m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Algin Camera Disconnect!!!!"));
            //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
            if (GetSimulationMode() == FALSE)
            {
               SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_FAIL);
               m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Algin Camera Disconnect!!!!"));
            }
            //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
            //original
//             SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_FAIL);
//             m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Algin Camera Disconnect!!!!"));
         }
      }      
      else
      {
         Sleep(350);
         AlignCamera_CameraControl(CameraControlStop);  // 210805 Align Camera Sequence ����
      }
      if (pGlassResult && pAlignCameraControl && pAlignCameraControl->AlignProcess())
      {
@@ -1247,24 +1382,34 @@
      }
      else
      {
         //지워야됨
         Sleep(1000);
         //TEST 모드
         {
            SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
            m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align SUCCESS Data!"));
         SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_AlignComplete_CPJT);
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Complete Signal!"));
      }
            //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
            if (GetSimulationMode() == FALSE)
            {
               SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
               m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align SUCCESS Data!"));
               SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_AlignComplete_CPJT);
               m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Complete Signal!"));
            }
            //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
            //original
//             SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
//             m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align SUCCESS Data!"));
//             SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_AlignComplete_CPJT);
//             m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Complete Signal!"));
         }
         Sleep(350);
         AlignCamera_CameraControl(CameraControlStop);  // 210805 Align Camera Sequence ����
         //주석 풀기
         //�ּ� Ǯ��
         // 4. send align fail signal to plc
         //SendResultToSignalControl(PCControlSendData_AlignResult_CPJT, SIGNAL_SEND_RESULT_FAIL);
         //m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Fail Data!"));
         //SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_AlignComplete_CPJT);
         //m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Complete Signal!"));
   }
      }
   }
@@ -1286,21 +1431,36 @@
   m_pSP2P->ISP2P_GetSignalControl()->WriteData(_T("17110"), sizeof(pDitRawClient->GetGlassData()->m_strGlassJudge), pDitRawClient->GetGlassData()->m_strGlassJudge);
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::IN] ReadRawFile!"));
   if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReadRawFileAck_CPJT))
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Send Read Raw File Ack!"));
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
   if (GetSimulationMode() == FALSE)
   {
      if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReadRawFileAck_CPJT))
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Send Read Raw File Ack!"));
   }
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
   //original
//    if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReadRawFileAck_CPJT))
//       m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Send Read Raw File Ack!"));
    if (bFileFind == FALSE)
   {
      SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_FAIL);
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] 결과파일 찾기 실패"));
      //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
      if (GetSimulationMode() == FALSE)
      {
         SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_FAIL);
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Find Raw File Fail"));
      }
      //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
      //original
//       SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_FAIL);
//       m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Find Raw File Fail"));
      return;
   }   
   // get current glass result
   CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult();
   if (pGlassResult==NULL) return;
   //공유메모리 커멘드 리뷰 스타트(글라스 로딩)
   CDitGlassRawClient* pDitSharedGlassRaw = CDitGlassRawClient::GetInstance();
   if(pDitSharedGlassRaw->isConnect() == FALSE)            m_pSP2P->ISP2P_DisplayMessage(_T("[DitGlassRawClient] Shared Memory Connect Fail"));
@@ -1327,20 +1487,26 @@
      int nTotalPlanCount = CalculatePlanData(pGlassResult);
      m_pSP2P->ISP2P_DisplayMessage(_T("[Read Raw File] Review All Plan Total Count : %d"), nTotalPlanCount);
      //지워야됨
      Sleep(1000);
      // send review ready
      SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
      SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewReady_CPJT);
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Send Review Ready Signal!"));
      //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
      if (GetSimulationMode() == FALSE)
      {
         SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
         SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewReady_CPJT);
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Send Review Ready Signal!"));
      }
      //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
      //original
//       SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
//       SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewReady_CPJT);
//       m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Send Review Ready Signal!"));
   }
   else
   {
      processTimer.End();
      m_pSP2P->ISP2P_DisplayMessage(_T("[ReadRawFile] AOI Result File Read Fail![%.3f ms]"), processTimer.GetDurationMilliSecond());
      //테스트 모드
      //{
      //         // send review ready
      //   SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
@@ -1348,7 +1514,6 @@
      //         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Send Review Ready Signal!"));
      //}
      //주석 해제
      int nCurPlanIndex = 0;
      CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo();
      if(pRsRcpReviewInfo)
@@ -1363,15 +1528,21 @@
               m_pSP2P->ISP2P_DisplayMessage(_T("[Read Raw File] Review All Plan Total Count : %d"), nTotalPlanCount);
               // send review ready
               SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewReady_CPJT);
               m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Send Review Ready Signal!"));
               //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
               if (GetSimulationMode() == FALSE)
               {
                  SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewReady_CPJT);
                  m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Send Review Ready Signal!"));
               }
               //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
               //original
//                SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewReady_CPJT);
//                m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Send Review Ready Signal!"));
            }
         }
      }
   }
   //// [2017:5:24]-[WEZASW] : Review Image Upload Dir 생성.(FTPUploader에서 자동 삭제 되더라도 실제 리뷰시 생성)
   //// '반복검사'시 FTPUploader에서 업로드 후 삭제 시점과 PCControl Glass Unloading 후 즉시 Loading시 Review에서의 업로드 경로(GlassID) 생성 시점 오류
   const CNetworkInfo *pNetworkInfo = m_pSP2P->ISP2P_System_GetNetworkInfo();
   CString strPath = _T("");
   //if(pNetworkInfo && pNetworkInfo->m_strUploadImagePath.IsEmpty() == FALSE)
@@ -1385,8 +1556,6 @@
   CFileFind Uploadfile, RTMSUploadPath;
   if (CDitGlassRawClient::GetInstance()->GetGlassData() == NULL) return;
   //업로드 폴더가 없으면 폴더 생성후 다시 업로드 경로 Set 20190917chm
   if(Uploadfile.FindFile(strPath)==FALSE)
   {
      CTime tmServerLoadingTime = CDitGlassRawClient::GetInstance()->GetGlassData()->m_tmGlassLoading;
@@ -1394,10 +1563,6 @@
      CreateDirectory(strPath, NULL);
      pReviewProcessor->SetUploadImagePath(strPath);
      //taek 210126 rtms 보고용 이미지 폴더 생성
      CreateDirectory(pReviewProcessor->GetRTMSUploadImagePath(),NULL);
   }
@@ -1414,9 +1579,16 @@
   SetLastPointCheck(FALSE);
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::IN] %d Tick Count"), dwTime);
   if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewStartAck_CPJT))
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Start Ack!"));
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
   if (GetSimulationMode() == FALSE)
   {
      if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewStartAck_CPJT))
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Start Ack!"));
   }
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
   //original
//    if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewStartAck_CPJT))
//       m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Start Ack!"));
   const CRsRcpAlignInfo* pRsRcpAlignInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpAlignInfo();
   if(pRsRcpAlignInfo == NULL)   return;
@@ -1443,10 +1615,10 @@
   //         _grmCellData* pCellData = pDitRawClient->GetCellData(0);
   //         if(pCellData) 
   //         {
   //         //   pCellData->m_nTotalPitchData[0] = int(pTotapPithMeasure->GetTotalPitchBD() * 1000); // 장축, 작업자 기준 위쪽
   //         //   pCellData->m_nTotalPitchData[1] = int(pTotapPithMeasure->GetTotalPitchAC() * 1000); // 장축, 작업자 기준 아래쪽
   //         //   pCellData->m_nTotalPitchData[2] = int(pTotapPithMeasure->GetTotalPitchAB() * 1000); // 단축, 작업자 기준 왼쪽
   //         //   pCellData->m_nTotalPitchData[3] = int(pTotapPithMeasure->GetTotalPitchCD() * 1000); // 단축, 작업자 기준 오른쪽
   //         //   pCellData->m_nTotalPitchData[0] = int(pTotapPithMeasure->GetTotalPitchBD() * 1000);
   //         //   pCellData->m_nTotalPitchData[1] = int(pTotapPithMeasure->GetTotalPitchAC() * 1000);
   //         //   pCellData->m_nTotalPitchData[2] = int(pTotapPithMeasure->GetTotalPitchAB() * 1000);
   //         //   pCellData->m_nTotalPitchData[3] = int(pTotapPithMeasure->GetTotalPitchCD() * 1000);
   //         }
   //      }
   //   }
@@ -1454,7 +1626,6 @@
   //   {
   //      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor] TotalPitchMeasure Result Fail!"));
   //      // 190711 SJB, TotalPitchMeasure Fail시에 바로 Motor로 명령을 날리기 보다는 Motion Enable 신호를 확인하자
   //      
   //      if(!pTotapPithMeasure->GetMotorEnable())
   //      {
@@ -1480,15 +1651,23 @@
   if(FirstReviewPlanStart() <= 0)
   {
      //Sleep(1000);
      SendResultToSignalControl(PCControlSendData_ReviewComplete_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
      SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewComplete_CPJT);
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Success Signal!"));
      //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
      if (GetSimulationMode() == FALSE)
      {
         SendResultToSignalControl(PCControlSendData_ReviewComplete_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
         SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewComplete_CPJT);
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Success Signal!"));
      }
      //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
      //original
//       SendResultToSignalControl(PCControlSendData_ReviewComplete_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
//       SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewComplete_CPJT);
//       m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Success Signal!"));
   }
   else
   {
      //지워야됨
      //Sleep(1000);
      //Test모드
      //SendResultToSignalControl(PCControlSendData_ReviewComplete_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
      //SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewComplete_CPJT);
      //m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Success Signal!"));
@@ -1506,34 +1685,56 @@
{
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::IN] ReviewEnd!"));
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
   if (GetSimulationMode() == FALSE)
   {
      if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewEndAck_CPJT))
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] Send Review End Ack!"));
   }
   //#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(2500);
      Sleep(1000);
   }
   ReJudgeProcessing(m_pDitGlassRaw);
   m_pDitGlassRaw->GetGlassData()->m_tmReviewEnd = CTime::GetCurrentTime();
   if (m_pDitGlassRaw->isConnect() != FALSE)   m_pDitGlassRaw->SetReviewEnd();
   if (m_pDitGlassRaw->isConnect() != FALSE)
   {
      m_pDitGlassRaw->SetReviewEnd();
      m_pDitGlassRaw->WriteReviewRawBinFile();
   }
   
   m_pDitGlassRaw->GetGlassData()->m_nReviewNum = m_pSP2P->ISP2P_GetReviewProcessor()->GetPlanReviewCount();
    //SendDVDataToSignalControl();// 안쓰쥬
   if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewEndAck_CPJT))
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] Send Review End Ack!"));
   //OverTime 발생시 제어에서 END ACK를 기다리는게 아니라 걍 Conplete를 기다린다.
   //음 ... 로직  오류인데일단 추가
    //SendDVDataToSignalControl();
   if (GetLastPointCheck() == FALSE)
   {
      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!"));
      //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
      if (GetSimulationMode() == FALSE)
      {
         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!"));
      }
      //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
      //original
//       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!"));
   }
   CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult();
@@ -1554,10 +1755,8 @@
      m_pSP2P->ISP2P_GetWSIControl(0)->SendWsiAfmSafePosMove();
      m_pSP2P->ISP2P_GetWSIControl(1)->SendWsiAfmSafePosMove();
   }
   // 결과파일 생성은 Review에서 관여 안함
   if(m_pDitGlassRaw->isConnect()==FALSE)      WriteRawData(pGlassResult);
   
   //디포커스 알람 send 20190819chm
   if(pGlassResult->m_nDeFocusCount >0) 
   {
      SendSignalToSignalControl(PCControlSendSignalIndex_State,PCControlSend_Defoucs,1000);
@@ -1567,41 +1766,51 @@
      CString strTime = _T("");
      strTime.Format(_T("%04d-%02d-%02d %02d:%02d:%02d"), time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond());
      CDlgDefocusList::GetInstance()->SetDefocusTotalCount(pGlassResult->m_nDeFocusCount);//토탈 카운트 Add
      CDlgDefocusList::GetInstance()->SetDefocusData(strTime,pGlassResult->m_strGlassID,pGlassResult->m_nDeFocusCount);//ui 추가후 갱신
      CDlgDefocusList::GetInstance()->SetDefocusTotalCount(pGlassResult->m_nDeFocusCount);
      CDlgDefocusList::GetInstance()->SetDefocusData(strTime,pGlassResult->m_strGlassID,pGlassResult->m_nDeFocusCount);
   }
   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 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(); //0503 리뷰 End시 조명값 0으로 초기화
   /*int nModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount();
   for (int nModuleIdx = 0; nModuleIdx < nModuleCount; nModuleIdx++)
   {
      {
         ReviewLight_SetLightLevel(nModuleIdx, 0);
         g_pLog->DisplayMessage(_T("Module[%d] LightLevel 초기화"), nModuleIdx);
         g_pLog->DisplayMessage(_T("Module[%d] LightLevel"), nModuleIdx);
      }
   }*/
   //5. PCControl 신호 업데이트
   //5. PCControl
   if (pGlassResult)
   {
      m_pSP2P->ISP2P_UpdateProcessStatus(GetProcessStatus(), pGlassResult);
      g_pLog->DisplayMessage(_T("PCControl Update Signal"));
   }
   SendResultToSignalControl(PCControlSendData_ReviewResultFileCreateComplete_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
   SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ResultDataComplete_CPJT);
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] Send ResultData Complete Signal!"));
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
   if (GetSimulationMode() == FALSE)
   {
      SendResultToSignalControl(PCControlSendData_ReviewResultFileCreateComplete_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
      SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ResultDataComplete_CPJT);
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] Send ResultData Complete Signal!"));
   }
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
//    SendResultToSignalControl(PCControlSendData_ReviewResultFileCreateComplete_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
//    SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ResultDataComplete_CPJT);
//    m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] Send ResultData Complete Signal!"));
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::OUT] ReviewEnd!"));
}
@@ -1609,9 +1818,16 @@
void CSequenceProcessor_CPJT::Process_ReviewUnloading()
{
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::IN] Review Unloading!"));
   if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewUnloadingAck_CPJT))
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Unloading Ack!"));
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD START
   if (GetSimulationMode() == FALSE)
   {
      if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewUnloadingAck_CPJT))
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Unloading Ack!"));
   }
   //original
   //#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!"));
   
}
@@ -1634,8 +1850,8 @@
   CString strCode = _T("");
   int nDefectCount = pRawData->GetGlassData()->m_nDefectNum; // 디펙갯수
   int nJudgeCount = pRcpReviewInfo->GetRcpZoneFilterInfoCount();// 필터 갯수
   int nDefectCount = pRawData->GetGlassData()->m_nDefectNum;
   int nJudgeCount = pRcpReviewInfo->GetRcpZoneFilterInfoCount();
   int nFilterType = 0;
   int nJudgeType = 0;
   int nZoneNumber = 0;
@@ -1649,7 +1865,7 @@
   int nJudgeCellOKCount = 0;
   int nPixelSize = 0;
   int nPixelFilterSize = 0;
   //높이 데이터
   //1 wsi, 3 CS, 4 R, 5 G, 6 B
   //pRawData->GetDefectData(nDefectIdx)->m_ReviewDefect.m_fWsi_ResultData[1];//Defect
   //pRawData->GetDefectData(nDefectIdx)->m_ReviewDefect.m_fWsi_ResultData[3];//cs
@@ -1663,10 +1879,10 @@
      {
#pragma region 얼라인 fail
#pragma region Align fail
         if (m_pSP2P->ISP2P_GetCurrentGlassResult()->GetAlignResult()->nResultCode != Align_Success)
         {
            m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] 얼라인 실패 WSI 높이 재판정 진행 안함"));
            m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] Align Fail WSI Rejudge Cancel"));
            break;
         }
#pragma endregion
@@ -1704,7 +1920,7 @@
         
         if (nPixelFilterSize <= nPixelSize && nPixelFilterSize != 0)
         {
            m_pSP2P->ISP2P_DisplayMessage(_T("[ReviewEnd] 사이즈 필터링 Pixel Size[%d] nPixelFilterSize [%d]"), nPixelSize,nPixelFilterSize);
            m_pSP2P->ISP2P_DisplayMessage(_T("[ReviewEnd] Size filtering Pixel Size[%d] nPixelFilterSize [%d]"), nPixelSize,nPixelFilterSize);
            continue;   
         }
#pragma endregion
@@ -1714,13 +1930,13 @@
         for (int nJudgeindex = 0; nJudgeindex < nJudgeCount; nJudgeindex++)
         {
            //nZoneType = GetZoneType();
            dJudgeHight = pRcpReviewInfo->GetRcpZoneFilteringInfo(nJudgeindex)->GetJudgeHeight(); //높이
            dJudgeHight = pRcpReviewInfo->GetRcpZoneFilteringInfo(nJudgeindex)->GetJudgeHeight();
            nFilterType = pRcpReviewInfo->GetRcpZoneFilteringInfo(nJudgeindex)->m_nFilterType; //ZONE
            nJudge = pRcpReviewInfo->GetRcpZoneFilteringInfo(nJudgeindex)->m_nFilterJudge; //OK TR
            //nZoneNumber = pRcpReviewInfo->GetRcpZoneInfo(nFilterType)->m_vecZoneNumber[0];
            
            if (pRawData->GetDefectData(nDefectIdx)->m_ReviewDefect.m_nWsi_Type == 2) // 210330 kyh변경
            if (pRawData->GetDefectData(nDefectIdx)->m_ReviewDefect.m_nWsi_Type == 2) // 210330 kyh
            {
               BOOL isZoneValue = FALSE;
@@ -1733,7 +1949,7 @@
                  }
                  else
                  {
                     m_pSP2P->ISP2P_DisplayMessage(_T("[WSIZoneCheck] Zone[%d], DefectIndex[%d]"), nZoneNumber, pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx); //210330 kyh 로그 추가
                     m_pSP2P->ISP2P_DisplayMessage(_T("[WSIZoneCheck] Zone[%d], DefectIndex[%d]"), nZoneNumber, pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx); //210330 kyh
                     isZoneValue = TRUE;
                     //break;
@@ -1742,7 +1958,7 @@
               if (isZoneValue == FALSE)
               {
                  m_pSP2P->ISP2P_DisplayMessage(_T("[WSIZoneCheck] NoFail DefectIndex[%d]"), pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx); //210330 kyh 로그 추가
                  m_pSP2P->ISP2P_DisplayMessage(_T("[WSIZoneCheck] NoFail DefectIndex[%d]"), pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx); //210330 kyh
                  continue;
               }
@@ -1792,13 +2008,13 @@
                  }
               }
               else if (fWsiData<=0) // 0이하 값은 재판정 진행을 안한다.
               else if (fWsiData<=0)
               {
                  m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] WSI TYPE[%d] WSI 높이[%0.3lf] <= 0 판정 진행 안함"), nJudgeType, fWsiData);
                  m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] WSI TYPE[%d] WSI Height[%0.3lf] <= 0 Cancel Rejudge"), nJudgeType, fWsiData);
               }
               else
               {
                  //20210419 TR 고정으로 Judge 보다 낮을경우 OK ㄱㄱ
                  //20210419 TR
                  //if (nJudge == 1)//TR -> OK
                  //{
                     if (pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement == DEFECT_JUDGE_CPJT_OK || pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement == DEFECT_JUDGE_CPJT_Unknown)
@@ -1849,7 +2065,7 @@
            }
            else //WSI TYPE 이 아니면
            else //WSI TYPE
            {
               continue;
            }
@@ -1863,13 +2079,13 @@
         for (int nJudgeindex = 0; nJudgeindex < nJudgeCount; nJudgeindex++)
         {
            //nZoneType = GetZoneType();
            dJudgeHight = pRcpReviewInfo->GetRcpZoneFilteringInfo_PR(nJudgeindex)->GetJudgeHeight(); //높이
            dJudgeHight = pRcpReviewInfo->GetRcpZoneFilteringInfo_PR(nJudgeindex)->GetJudgeHeight();
            nFilterType = pRcpReviewInfo->GetRcpZoneFilteringInfo_PR(nJudgeindex)->m_nFilterType; //ZONE
            nJudge = pRcpReviewInfo->GetRcpZoneFilteringInfo_PR(nJudgeindex)->m_nFilterJudge; //OK TR
            //nZoneNumber = pRcpReviewInfo->GetRcpZoneInfo(nFilterType)->m_vecZoneNumber[0];
            if (pRawData->GetDefectData(nDefectIdx)->m_ReviewDefect.m_nWsi_Type == 2) // 210330 kyh변경
            if (pRawData->GetDefectData(nDefectIdx)->m_ReviewDefect.m_nWsi_Type == 2) // 210330
            {
               BOOL isZoneValue = FALSE;
@@ -1882,7 +2098,7 @@
                  }
                  else
                  {
                     m_pSP2P->ISP2P_DisplayMessage(_T("[WSIZoneCheck] Zone[%d], DefectIndex[%d]"), nZoneNumber, pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx); //210330 kyh 로그 추가
                     m_pSP2P->ISP2P_DisplayMessage(_T("[WSIZoneCheck] Zone[%d], DefectIndex[%d]"), nZoneNumber, pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx); //210330 kyh
                     isZoneValue = TRUE;
                     //break;
@@ -1891,7 +2107,7 @@
               if (isZoneValue == FALSE)
               {
                  m_pSP2P->ISP2P_DisplayMessage(_T("[WSIZoneCheck] NoFail DefectIndex[%d]"), pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx); //210330 kyh 로그 추가
                  m_pSP2P->ISP2P_DisplayMessage(_T("[WSIZoneCheck] NoFail DefectIndex[%d]"), pRawData->GetDefectData(nDefectIdx)->m_nDefectIdx); //210330 kyh
                  continue;
               }
@@ -1945,7 +2161,6 @@
               }
               else
               {
                  //20210419 TR 고정으로 Judge 보다 낮을경우 OK ㄱㄱ
                  //if (nJudge == 1)//TR -> OK
                  //{
                  if (pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement == DEFECT_JUDGE_CPJT_OK || pRawData->GetDefectData(nDefectIdx)->m_DefectJudgement == DEFECT_JUDGE_CPJT_Unknown)
@@ -1997,7 +2212,7 @@
            }
            else //WSI TYPE 이 아니면
            else //WSI TYPE
            {
               continue;
            }
@@ -2012,7 +2227,7 @@
            
            strCode =pRcpReviewInfo->GetRcpZoneFilteringInfo_CODE(nJudgeindex)->m_FilterCode;
            if (pRawData->GetDefectData(nDefectIdx)->m_ReviewDefect.m_nWsi_Type == 2) // 210330 kyh변경
            if (pRawData->GetDefectData(nDefectIdx)->m_ReviewDefect.m_nWsi_Type == 2) // 210330
            {
               nJudgeType = ReJugdeWSIType(nFilterType);
@@ -2065,7 +2280,7 @@
                  m_pSP2P->ISP2P_DisplayMessage(_T("[TEST Process::ReviewEnd] CODE JUDGE WSI TYPE[%d] Defect CODE [%s] != [%s]"), nJudgeType, strCode, pRawData->GetDefectData(nDefectIdx)->m_strDefectCode);
               }
            }
            else //WSI TYPE 이 아니면
            else //WSI TYPE
            {
               continue;
            }
@@ -2076,7 +2291,6 @@
      }
      
#pragma region CELLJUDGE
   //CELL 재판정////////////////////////////////////////////////////////////////
   int nCellCount = pRawData->GetGlassData()->m_nCellNum;
@@ -2095,7 +2309,7 @@
      else if (pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_OK_CPJT)
      {
         nCelllOKJuge = nCelllOKJuge + 1;
      } //taek 21.01.25 Juge 구하는 곳을 새롭게 바꾸자...
      } //taek 21.01.25
      else if (pRawData->GetCellData(nCellIndex)->m_nJudgement == Judge_PR_CPJT)
      {
         nCelllPRJuge = nCelllPRJuge + 1;
@@ -2139,7 +2353,7 @@
            }
            else
            {
               m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] 카운트 개수가 음수임 [%02d]Cell DefectTRCount[%d] >= [%d]"), nCellIndex, pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgeTR, pRcpJudgeInfo->GetJudgeCount());
               m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] Count Number is minus! [%02d]Cell DefectTRCount[%d] >= [%d]"), nCellIndex, pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgeTR, pRcpJudgeInfo->GetJudgeCount());
            }
            break;
         case JudgeType_T8_PR:
@@ -2189,7 +2403,7 @@
            }
            else
            {
               m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] 카운트 개수가 음수임 [%02d]Cell DefectTRCount[%d] <= [%d]"), nCellIndex, pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgeTR, pRcpJudgeInfo->GetSubJudgeCount());
               m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] Count Number is minus! [%02d]Cell DefectTRCount[%d] <= [%d]"), nCellIndex, pRawData->GetCellData(nCellIndex)->m_nDefectNumJudgeTR, pRcpJudgeInfo->GetSubJudgeCount());
            }
            break;
         case JudgeType_T8_PR:
@@ -2353,7 +2567,7 @@
   }
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] CELL COUNT OK:[%d] TR[%d] PR[%d]"), nCelllOKJuge, nCellTRJudge, nCelllPRJuge);
#pragma endregion
   //GLASS 재판정////////////////////////////////////////////////////////////////
#pragma region GLASSJUDGE
   CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo();
   if (pRsRcpReviewInfo == NULL) return FALSE;
@@ -2401,7 +2615,7 @@
         }
         else
         {
            m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] TR 카운트가 음수임 [%02d]GLASS Defect TR Count[%d] >= [%d]"), nIdx, pRawData->GetGlassData()->m_nDefectNumJudgeTR, pRcpJudgeInfo->GetJudgeCount());
            m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] TR Count is minus [%02d]GLASS Defect TR Count[%d] >= [%d]"), nIdx, pRawData->GetGlassData()->m_nDefectNumJudgeTR, pRcpJudgeInfo->GetJudgeCount());
         }
         break;
      case JudgeType_T8_PR:
@@ -2451,7 +2665,7 @@
         }
         else
         {
            m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd]TR카운트가 음수임 [%02d]GLASS Defect TR Count[%d] <= [%d]"), nIdx, pRawData->GetGlassData()->m_nDefectNumJudgeTR, pRcpJudgeInfo->GetSubJudgeCount());
            m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd]TR Count is minus [%02d]GLASS Defect TR Count[%d] <= [%d]"), nIdx, pRawData->GetGlassData()->m_nDefectNumJudgeTR, pRcpJudgeInfo->GetSubJudgeCount());
         }
         break;
      case JudgeType_T8_PR:
@@ -2635,11 +2849,22 @@
   {
      CTime tmReviewLoading = CTime::GetCurrentTime();
      CString strWild;
      strWild.Format("%s\\%s_*.bin", strFilePath, strFileName);
      //strWild.Format("%s\\%s_*.bin", strFilePath, strFileName);
      CakFileUtil akFileFinder;
      while (nReTryTime--)
      {
         akFileFinder.FindFile(strWild.GetBuffer(0), FALSE);
         //#3359_LYW CF AOI Review REVIEW_LOADING_COMPLETE_TIMEOVER START
         if (nReTryTime%2 == 0)
         {
            strFilePath = AOIRAWBIN_PATH;
         }
         else strFilePath = AOIRAWBIN_NETWORK_DRIVE_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;
@@ -2651,7 +2876,7 @@
               parser.process(pFileName, "_.");
               if (parser.getTokNum() < 4) continue;
               
               if (parser.getTokNum() >= 6) continue; // 0401 추가
               if (parser.getTokNum() >= 6) continue; // 0401
               int nDataTime[8] = {};
               {
@@ -2679,11 +2904,11 @@
         {
            if (mapSpanFileName.begin()->first < nCloseTime)
            {
               //가장 최근 결과파일 찾기 성공 [김태현 2019/7/17]
               strFindFile = mapSpanFileName.begin()->second;
               break;
            }
         }
         akFileFinder.clear();
         Sleep(100);
      }
@@ -2738,7 +2963,7 @@
   int nPCControlReadDataCount = pSignalInfo->GetReadDataAddressCount();
   // [2017:1:9]-[WEZASW] : PCControl GlassData 항목 재정의.
   // [2017:1:9]-[WEZASW] : PCControl GlassData
   if(pSignalInfo->GetUseContinuousReadAddress())
   {
      CString strReadAddress = _T("");
@@ -3108,7 +3333,7 @@
               strReadData = pTransferData->strRerferData;
               break;
            }
            m_pSP2P->ISP2P_DisplayMessage(_T("[ReadTransferData] Name: %s, Addr: %s, Size: %d, Data: %s"), pInfo->strName, strReadAddress, nReadSize, strReadData);
         //   m_pSP2P->ISP2P_DisplayMessage(_T("[ReadTransferData] Name: %s, Addr: %s, Size: %d, Data: %s"), pInfo->strName, strReadAddress, nReadSize, strReadData); //0517
      }
   }
@@ -3117,11 +3342,11 @@
void CSequenceProcessor_CPJT::UpdateGlassResultFromTransferData(CGlassResult *pGlassResult, STransferData* pTransferData)
{
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Transfer Data 읽기!"));
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Transfer Data Read!"));
   if (pGlassResult==NULL || pTransferData==NULL) return;
   // [2017:1:9]-[WEZASW] : PCControl GlassData 항목 재정의
   // [2017:1:9]-[WEZASW] : PCControl GlassData
   // transfer data is not exist
   if (pTransferData->strLotID.GetLength()<1)
   {
@@ -3190,80 +3415,89 @@
   pGlassResult->m_strPairFlag = pTransferData->strPairFlag;
   pGlassResult->m_strOptionValue = pTransferData->strOptionValue;
   pGlassResult->m_strReserved = pTransferData->strReserved;
   pGlassResult->strGlassScanSchedule = pTransferData->strGlassScanSchedule;//분판 정보 cmark
   pGlassResult->strGlassScanSchedule = pTransferData->strGlassScanSchedule;//cmark
   pGlassResult->m_strRTMSStepID = pTransferData->strStepID; //taek 210126
   
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Transfer Data 끝!"));
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Transfer Data END!"));
}
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)
{
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] 디렉토리 만들기 시작"));
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Make Directory Start"));
   if (m_pSP2P==NULL) return;
   const CNetworkInfo *pNetworkInfo = m_pSP2P->ISP2P_System_GetNetworkInfo();
@@ -3309,7 +3543,7 @@
      strPath.Format(_T("%s\\%s"),pNetworkInfo->m_strAlignImagePath, strGlassID);
      CreateDirectory(strPath, NULL);
   }
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] 디렉토리 만들기 끝"));
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Make directory End"));
}
@@ -3317,7 +3551,7 @@
void CSequenceProcessor_CPJT::SetSaveImageBasePathToReviewProcessor(const CString& strGlassID, const CString& strResultDate)
{
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] 이미지 패스 만들기 시작"));
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Make image path start"));
   const CNetworkInfo *pNetworkInfo = m_pSP2P->ISP2P_System_GetNetworkInfo();
   if(pNetworkInfo == NULL) return;
@@ -3325,6 +3559,7 @@
   if(pReviewProcessor == NULL) return;
   
   CString strPath = _T("");
   CString strImagePath = _T("");
   if(pNetworkInfo->m_strLocalImagePath.IsEmpty() == FALSE && strGlassID.IsEmpty() == FALSE)
   {
      CTime snapTime = CTime::GetCurrentTime();
@@ -3361,11 +3596,11 @@
            Sleep(1000);
            if (CDitGlassRawClient::GetInstance()->isConnect() == FALSE)
            {
               m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading]공유메모리 연결 실패 Count[%d]"), nReconnect);
               m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading]access Shared Memory Fail!! Count[%d]"), nReconnect);
            }
            else
            {
               m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading]공유메모리 연결 성공"));
               m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading]access Shared Memory Success"));
               break;
            }
            nReconnect += 1;
@@ -3380,25 +3615,29 @@
      {
         
         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_%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);
      }
      else
      {
         tmServerLoadingTime = CTime::GetCurrentTime();
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] 공유메모리 접근이상"));
         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());
         CreateDirectory(strPath, NULL);
         pReviewProcessor->SetUploadImagePath(strPath);
         pReviewProcessor->SetReviewImagePath(strImagePath);
      }
   }
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] 이미지 패스 만들기 끝"));
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Make image path End"));
}
void CSequenceProcessor_CPJT::SetSaveImageBasePathToAlignCameraControl(const CString& strGlassID)
{
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] 얼라인 이미지 패스 시작 "));
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading]  Make Align image path Start"));
   const CNetworkInfo *pNetworkInfo = m_pSP2P->ISP2P_System_GetNetworkInfo();
   if(pNetworkInfo == NULL) return;
@@ -3410,8 +3649,12 @@
   {
      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] 얼라인 이미지 패스 끝 "));
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Make Align image path End "));
}
BOOL CSequenceProcessor_CPJT::ReadRecipeDataFromRecipeFile(const CString& strPPID_RC, CString& strRecipeName)// const CString& strPPID, CString& strRecipeName
@@ -3478,14 +3721,12 @@
{
   if(pGlassResult == NULL) return FALSE;
   // 레시피 설정
   const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo();
   if (pRsRcpReviewInfo==NULL) return FALSE;
   // system info
   const CSystemInfo* pSystemInfo = m_pSP2P->ISP2P_System_GetSystemInfo();
   // 글라스 정보
   STransferData* pTransferData = m_pSP2P->ISP2P_GetCurrentTransferData();
   if (pTransferData==NULL) return FALSE;
   int nGlassTypeInfoIndex = 0;
@@ -3501,20 +3742,16 @@
   if (pGlassTypeInfo == NULL) return FALSE;
   m_pSP2P->ISP2P_DisplayMessage(_T("GlassTypeName : %s,GlassTypeIdx : %s"),pGlassTypeInfo->m_strGlassTypeName,pTransferData->strGlassScanSchedule);
   
   // 모터 정보
   const CMotorControlInfo *pMotorInfo = m_pSP2P->ISP2P_System_GetMotorInfo();
   // 좌표 변환기
   CCoordCalibrator* pCoordCalibrator = m_pSP2P->ISP2P_GetCoordCalibrator();
   // 좌표계 설정
   if (pSystemInfo && pGlassTypeInfo && pMotorInfo && pCoordCalibrator)
   {
      // Get Direction      
      int nDirectionX = GetDirectionX(pGlassTypeInfo->m_nOriginDirection, pMotorInfo->GetOriginDirection());
      int nDirectionY = GetDirectionY(pGlassTypeInfo->m_nOriginDirection, pMotorInfo->GetOriginDirection());
      // 좌표계 설정
      pCoordCalibrator->SetTransDirection(nDirectionX, nDirectionY);
      pCoordCalibrator->SetOriginMotorPosition(pGlassTypeInfo->m_dOriginMotorX, pGlassTypeInfo->m_dOriginMotorY);
      if (fabs(pGlassTypeInfo->m_dAlignAngle) > 0.0000001)
@@ -3523,7 +3760,6 @@
            pGlassTypeInfo->m_dFirstAlignGlassX, pGlassTypeInfo->m_dFirstAlignGlassY, pGlassTypeInfo->m_dAlignAngle);
      }
      // 글라스 정보 설정
      pGlassResult->SetGlassSize(pGlassTypeInfo->m_nGlassSizeX * 1000, pGlassTypeInfo->m_nGlassSizeY * 1000);
      pGlassResult->SetGlassOriginDirection(pGlassTypeInfo->m_nOriginDirection);
      pGlassResult->SetCornerCutDirection(pGlassTypeInfo->m_nCornerCutDirection);
@@ -3532,34 +3768,28 @@
      pGlassResult->SetCollisionDistanceX(int(pSystemInfo->m_dCollisionDistance*1000.));
   }
   // Align 정보
   const CRsRcpAlignInfo* pRsRcpAlignInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpAlignInfo();
   // Align 정보 설정
   if (pGlassTypeInfo && pRsRcpAlignInfo)
   {
      // Align 마크 정보 설정 (픽셀, 모터, 글라스 위치)
      pGlassResult->m_AlignRecipe.m_nUseAlignPosMove      = pGlassTypeInfo->m_nUseAlignPosMove;
      // 픽셀 위치
      pGlassResult->m_AlignRecipe.dOriginPixelX[0]      = pGlassTypeInfo->m_nFirstAlignFindPixelX;
      pGlassResult->m_AlignRecipe.dOriginPixelY[0]      = pGlassTypeInfo->m_nFirstAlignFindPixelY;
      pGlassResult->m_AlignRecipe.dOriginPixelX[1]      = pGlassTypeInfo->m_nSecondAlignFindPixelX;
      pGlassResult->m_AlignRecipe.dOriginPixelY[1]      = pGlassTypeInfo->m_nSecondAlignFindPixelY;
      // 모터 위치
      pGlassResult->m_AlignRecipe.dOriginPositionX[0]      = pGlassTypeInfo->m_dFirstAlignMotorX;
      pGlassResult->m_AlignRecipe.dOriginPositionY[0]      = pGlassTypeInfo->m_dFirstAlignMotorY;
      pGlassResult->m_AlignRecipe.dOriginPositionX[1]      = pGlassTypeInfo->m_dSecondAlignMotorX;
      pGlassResult->m_AlignRecipe.dOriginPositionY[1]      = pGlassTypeInfo->m_dSecondAlignMotorY;
      // 글라스 위치
      pGlassResult->m_AlignRecipe.dGlassPositionX[0]      = pGlassTypeInfo->m_dFirstAlignGlassX;
      pGlassResult->m_AlignRecipe.dGlassPositionY[0]      = pGlassTypeInfo->m_dFirstAlignGlassY;
      pGlassResult->m_AlignRecipe.dGlassPositionX[1]      = pGlassTypeInfo->m_dSecondAlignGlassX;
      pGlassResult->m_AlignRecipe.dGlassPositionY[1]      = pGlassTypeInfo->m_dSecondAlignGlassY;
      // Align Recipe 정보 설정 자동광량 찾기 파라미터
      // Align Recipe
      // Align Skip Mode
      pGlassResult->m_AlignRecipe.bAlignSkipMode      = pRsRcpAlignInfo->m_bAlignSkipMode;
      pGlassResult->m_AlignRecipe.bUseTotalPitchMeasure = pRsRcpAlignInfo->m_bTotalPitchMeasure;
@@ -3569,6 +3799,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
@@ -3579,29 +3815,24 @@
      pGlassResult->m_AlignRecipe.nMergeRange         = pRsRcpAlignInfo->m_nMergeRange;
      pGlassResult->m_AlignRecipe.dEdgeRate         = pRsRcpAlignInfo->m_dEdgeRate;
      
      // 노출시간
      pGlassResult->m_AlignRecipe.bManualProcess         = pRsRcpAlignInfo->m_bManualProcess;
      pGlassResult->m_AlignRecipe.dFirstCamExposure      = pRsRcpAlignInfo->m_dFirstCamExposure;
      pGlassResult->m_AlignRecipe.dSecondCamExposure      = pRsRcpAlignInfo->m_dSecondCamExposure;
      // 자동광량 조건
      pGlassResult->m_AlignRecipe.bAutoProcess         = pRsRcpAlignInfo->m_bAutoProcess;
      pGlassResult->m_AlignRecipe.dTargetMin            = pRsRcpAlignInfo->m_dTargetMin;
      pGlassResult->m_AlignRecipe.dTargetMax            = pRsRcpAlignInfo->m_dTargetMax;
      pGlassResult->m_AlignRecipe.dExposureMin         = pRsRcpAlignInfo->m_dExposureMin;
      pGlassResult->m_AlignRecipe.dExposureMax         = pRsRcpAlignInfo->m_dExposureMax;
      // Align Recipe 정보 설정 rotate info
      pGlassResult->m_AlignRecipe.bRotateProcess         = pRsRcpAlignInfo->m_bRotateProcess;
      pGlassResult->m_AlignRecipe.nRetryCount            = pRsRcpAlignInfo->m_nRetryCount;
      pGlassResult->m_AlignRecipe.dGlassAngleMin         = pRsRcpAlignInfo->m_dGlassAngleMin;
      pGlassResult->m_AlignRecipe.dGlassAngleMax         = pRsRcpAlignInfo->m_dGlassAngleMax;
      // Align 카메라 방향 및 해상도 설정
      int nAlignCameraInfoCount = 2;
      for(int nAlignCameraIdx = 0; nAlignCameraIdx < nAlignCameraInfoCount; nAlignCameraIdx++)
      {
         // Align 조명 값 가져오기.
         int nLightValue = 0;
         
         
@@ -3609,10 +3840,8 @@
         {
            nLightValue = (nAlignCameraIdx==0) ? (int)pRsRcpAlignInfo->m_dFirstCamExposure: (int)pRsRcpAlignInfo->m_dSecondCamExposure;
            // 얼라인 카메라 정보 가져오기
            const CAlignCameraInfo *pCameraInfo = m_pSP2P->ISP2P_System_GetAlignCameraInfo(nAlignCameraIdx);
             //조명값 변경.
            CLightControl *pLightControl = NULL;
            const CLightControlInfo *AlignLightinfo = pCameraInfo->GetLightContorlInfo();
@@ -3621,8 +3850,6 @@
            {
               if (AlignLightinfo->GetMaster()==1&& nAlignCameraIdx==1)
               {
                  //얼라인 컨틀롤러가 하나만 연결되어 있을때 마스터 여부로 확인
                  //솔직히 이거 맞는지 모르겟다 아무도 안알랴쥼
                  pLightControl = m_pSP2P->ISP2P_GetAlignLightControl(0);
               }
@@ -3656,8 +3883,6 @@
            }
         }
         
         // 얼라인 카메라 정보 가져오기
         const CAlignCameraInfo *pCameraInfo   = m_pSP2P->ISP2P_System_GetAlignCameraInfo(nAlignCameraIdx);
         if (pCameraInfo)
         {
@@ -3685,7 +3910,6 @@
            }
         }
         // 얼라인 템플릿 정보 가져오기
         if((int)pGlassTypeInfo->m_vecTemplateImagePath.size() == nAlignCameraInfoCount)
         {
            pGlassResult->m_AlignRecipe.strTemplateName[nAlignCameraIdx] = pGlassTypeInfo->m_vecTemplateImagePath[nAlignCameraIdx];
@@ -3714,14 +3938,13 @@
         if (pRcpReviewAFMInfo)
         {
            int nRealAFMIndex = pRcpReviewAFMInfo->m_nRecipeIndex;
            if(nRealAFMIndex == -1)// 레시피에 선택된 배율의 실제 MagnificInfo Index를 알아옴
            if(nRealAFMIndex == -1)
            {
               //-1의 경우 배율 인덱스 가져다 씀.
               nRealAFMIndex = GetRealMagnification(nModuleIdx, pRcpReviewAFMInfo->m_nZoomIndex);
            }
            AFM_SetAFMRecipeName(nModuleIdx, strRecipeName, nRealAFMIndex);
            if(pRcpReviewAFMInfo->m_bAFMHomeOffMode==TRUE) //190618AFM홈 시퀀스 진행 X
            if(pRcpReviewAFMInfo->m_bAFMHomeOffMode==TRUE) //190618AFM
            {
               SetUseAfmHomePosition(FALSE);
            }
@@ -3733,7 +3956,6 @@
      }
   }
   // 결함 찾기 레시피 설정
   CReviewProcessor* pReviewProcessor = m_pSP2P->ISP2P_GetReviewProcessor();
   const CRsRcpDefectFindInfo* pRsRcpDefectFindInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpDefectFindInfo();
   if(pReviewProcessor && pRsRcpDefectFindInfo)
@@ -3784,7 +4006,6 @@
   CString strRawTDPath=_T(""), strRawCDPath=_T(""), strRawSDPath=_T("");
   // 결과파일 이름 찾기
   FindAOIRawFilePath(pGlassResult, &strRawTDPath, &strRawCDPath, &strRawSDPath);
   bRet = m_pSP2P->ISP2P_ReadAOIRawFileToGlassResult(strRawTDPath);
@@ -3838,7 +4059,7 @@
      if(finder.IsDots()) continue;
      if(finder.IsDirectory()) continue;
      // [2017:5:16]-[WEZASW] : AOI Server의 결함 파일 위치에 결함맵 이미지 파일 존재로 결합 파일만 추출
      // [2017:5:16]-[WEZASW] : AOI Server
      sRawFile.strFileName = finder.GetFileName();
      strExtTemp = sRawFile.strFileName;
      int nIdx = strExtTemp.Remove('.');      
@@ -4016,7 +4237,6 @@
      CModuleStatus*               pModuleStatus   = Module_GetModuleStatus(nModuleIdx);      
      if (pModuleStatus == NULL) continue;
      //충돌거리 넣기
      {
      double dCollisionPosX = pReviewResult->GetCollisionPositionX() / 1000.0;
@@ -4057,13 +4277,12 @@
      }
      //좌우 겐트리 동시이동
      pMotorControl->GantrySetTwoGantrySyncModeSend(0);
      // set result index
      int nStartIdx = pReviewResult->GetStartSReviewResultIndex();
      int nEndIdx = pReviewResult->GetEndSReviewResultIndex();
      nEndIdx = min(nEndIdx, (pReviewResult->GetSReviewResultCount()-1)) + 1;      // End Index 다시설정
      nEndIdx = min(nEndIdx, (pReviewResult->GetSReviewResultCount()-1)) + 1;      // End Index
      double xpostemp, ypostemp;
      // get review pos
@@ -4073,7 +4292,7 @@
         SReviewResult* pReview = pReviewResult->GetSReviewResult(nResultIdx);
         if (pReview==NULL) continue;
         //200개 어드레스를 보낸후 완료시점에서 중복체크
         //200
         if (pReview->bCheckSendToMotor == FALSE)
         {
            pReview->bCheckSendToMotor = TRUE;
@@ -4120,7 +4339,6 @@
         }
      }
      //보낼 포인트가 있는지 없는지 체크
      if (vectorPosX.empty() ==TRUE)
      {
         g_pLog->DisplayMessage(_T("[GantryAutoGo] No Exist Send Point "), vectorPosX.size());
@@ -4152,13 +4370,11 @@
         int nTickCount = GetTickCount();
         while (1)
         {
            //5초 오버타임
            if ((GetTickCount() - nTickCount) > 5000)
            {
               bOverTime = TRUE;
               break;
            }
            //모터 모션 End 체크
            if (pMotorControl->IsGantryMotionEnd(pModuleStatus->GetGantryIndex()) == TRUE)
            {
               if (pMotorControl->GantryAutoGo(pModuleStatus->GetGantryIndex(), vectorPosX, vectorPosY, TRUE))
@@ -4177,15 +4393,12 @@
         }
         //5초후에도 안움직인다? 그럼 3번 재시도 ㄱㄱ
         //모션End 가 잘못 나올수도 있으니
         if (bOverTime == TRUE)
         {
            for (int i = 0; i < 3; i++)
            {
               Sleep(1000);
               //모터가 움직일수 없는상태일때 Send 신호시 Fail 발생 가능 Retry 3번 ㄱㄱ
               if (pMotorControl->GantryAutoGo(pModuleStatus->GetGantryIndex(), vectorPosX, vectorPosY, TRUE))
               {
                  nTotalCount += (int)vectorPosX.size();
@@ -4259,7 +4472,7 @@
   if(pGlassResult && pReviewProcessor)
   {
      // UserStart
      pReviewProcessor->SetJobID(pGlassResult->m_strJobID);   //pGlassResult->m_strGlassID -> pGlassResult->m_strJobID 변경
      pReviewProcessor->SetJobID(pGlassResult->m_strJobID);   //pGlassResult->m_strGlassID -> pGlassResult->m_strJobID
      pReviewProcessor->SetOperID(pGlassResult->m_strOperID);
      m_pSP2P->ISP2P_UpdateReviewProcessStatus(ReviewProcessStatus_UserStart, nPlanIndex);
@@ -4322,7 +4535,6 @@
      CModuleStatus*               pModuleStatus = Module_GetModuleStatus(nModuleIdx);
      if (pModuleStatus == NULL) continue;
      //충돌거리 넣기
      {
         double dCollisionPosX = pReviewResult->GetCollisionPositionX() / 1000.0;
@@ -4365,9 +4577,9 @@
      // set result index
      int nStartIdx = pReviewResult->GetStartSReviewResultIndex();
      int nEndIdx = pReviewResult->GetEndSReviewResultIndex();
      nEndIdx = min(nEndIdx, (pReviewResult->GetSReviewResultCount() - 1)) + 1;      // End Index 다시설정
      nEndIdx = min(nEndIdx, (pReviewResult->GetSReviewResultCount() - 1)) + 1;      // End Index
      // [2017:3:8]-[WEZASW] : CameraOffset 범위 변경 (-1~1 => -5~5)
      // [2017:3:8]-[WEZASW] : CameraOffset (-1~1 => -5~5)
      double m_dMinOffset = -5.0;
      double m_dMaxOffset = 5.0;
      double xpostemp, ypostemp;
@@ -4378,7 +4590,7 @@
         SReviewResult* pReview = pReviewResult->GetSReviewResult(nResultIdx);
         if (pReview == NULL) continue;
         //200개 어드레스를 보낸후 완료시점에서 중복체크
         //200
         if (pReview->bCheckSendToMotor == FALSE)
         {
            pReview->bCheckSendToMotor = TRUE;
@@ -4426,7 +4638,6 @@
         }
      }
      //보낼 포인트가 있는지 없는지 체크
      if (vectorPosX.empty() == TRUE)
      {
         g_pLog->DisplayMessage(_T("[GantryAutoGo] No Exist Send Point "), vectorPosX.size());
@@ -4481,7 +4692,17 @@
   SetWsiType(0);
   WSIAllReadySignal(1);
   Sleep(500);
   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!!"));
@@ -4491,7 +4712,7 @@
   if(pGlassResult && pReviewProcessor)
   {
      // WsiStart
      pReviewProcessor->SetJobID(pGlassResult->m_strJobID);   // pGlassResult->m_strGlassID -> pGlassResult->m_strJobID 변경
      pReviewProcessor->SetJobID(pGlassResult->m_strJobID);   // pGlassResult->m_strGlassID -> pGlassResult->m_strJobID
      pReviewProcessor->SetOperID(pGlassResult->m_strOperID);
      m_pSP2P->ISP2P_UpdateReviewProcessStatus(ReviewProcessStatus_WSIStart, nPlanIndex);
@@ -4504,7 +4725,7 @@
      MakeWSIUpLoadDirectory(pReviewProcessor->GetUploadImagePath());
      //20190219 chm 
      pReviewProcessor->SetReviewCount(0);         // 리뷰 Sequence No 초기화.
      pReviewProcessor->SetReviewCount(0);
      return TRUE;
   }   
@@ -4517,7 +4738,8 @@
   strPath  = strPath + _T("\\WSI");
   if(CreateDirectory(strPath,NULL)==FALSE)
   {
      g_pLog->DisplayMessage(_T("[MakeWSIUpLoadDirectory]Directory Create Fail %s "),strPath);
      //LYW LOG
      g_pLog->DisplayMessage(_T("[MakeWSIUpLoadDirectory]Directory Create Fail %s, ERROR CODE = %d "),strPath, GetLastError());
   }
   
}
@@ -4556,8 +4778,10 @@
   VectorDouble vectorCollisionPosX;
   vectorCollisionPosX.clear();
   //WSI
   pMotorControl->GantrySetTwoGantrySyncModeSend(1);
   // WSI result count
   for (int nModuleIdx = 0; nModuleIdx < Module_GetModuleStatusCount(); nModuleIdx++)
   {
@@ -4568,7 +4792,6 @@
      CModuleStatus*               pModuleStatus = Module_GetModuleStatus(nModuleIdx);
      if (pModuleStatus == NULL) continue;
      //충돌거리 넣기
      {
         double dCollisionPosX = pWsiResult->GetCollisionPositionX() / 1000.0;
         double dCollisionPosY = 0.0;
@@ -4603,15 +4826,13 @@
            return 0;
         }
      }
      //WSI 좌우 겐트리 동시이동
      pMotorControl->GantrySetTwoGantrySyncModeSend(1);
      // get result index
      int nStartIdx = pWsiResult->GetStartSReviewResultIndex();
      int nEndIdx = pWsiResult->GetEndSReviewResultIndex();
      nEndIdx = min(nEndIdx, (pWsiResult->GetSReviewResultCount() - 1)) + 1;      // set End Index 
      // [2017:3:8]-[WEZASW] : CameraOffset 범위 변경 (-1~1 => -5~5)
      // [2017:3:8]-[WEZASW] : CameraOffset (-1~1 => -5~5)
      double m_dMinOffset = -5.0;
      double m_dMaxOffset = 5.0;
@@ -4623,7 +4844,7 @@
         SReviewResult* pWsi = pWsiResult->GetSReviewResult(nResultIdx);
         if (pWsi == NULL) continue;
         //200개 어드레스를 보낸후 완료시점에서 중복체크
         //200
         if (pWsi->bCheckWSISendToMotor == FALSE)
         {
            pWsi->bCheckWSISendToMotor = TRUE;
@@ -4670,12 +4891,13 @@
         }
      }
      //보낼 포인트가 있는지 없는지 체크
      if (vectorPosX.empty() == TRUE)
      {
         g_pLog->DisplayMessage(_T("[GantryAutoGo] No Exist Send Point "), vectorPosX.size());
         //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
      }
      else
      {
@@ -4699,13 +4921,12 @@
            int nTickCount = GetTickCount();
            while (1)
            {
               //5초 오버타임
               if ((GetTickCount() - nTickCount) > 5000)
               {
                  bOverTime = TRUE;
                  break;
               }
               //모터 모션 End 체크
               //End üũ
               if (pMotorControl->IsGantryMotionEnd(pModuleStatus->GetGantryIndex()) == TRUE)
               {
                  if (pMotorControl->GantryAutoGo(pModuleStatus->GetGantryIndex(), vectorPosX, vectorPosY, TRUE))
@@ -4724,15 +4945,12 @@
            }
            //5초후에도 안움직인다? 그럼 3번 재시도 ㄱㄱ
            //모션End 가 잘못 나올수도 있으니
            if (bOverTime == TRUE)
            {
               for (int i = 0; i < 3; i++)
               {
                  Sleep(1000);
                  //모터가 움직일수 없는상태일때 Send 신호시 Fail 발생 가능 Retry 3번 ㄱㄱ
                  if (pMotorControl->GantryAutoGo(pModuleStatus->GetGantryIndex(), vectorPosX, vectorPosY, TRUE))
                  {
                     nTotalCount += (int)vectorPosX.size();
@@ -4867,9 +5085,9 @@
      // get result index
      int nStartIdx = pReviewResult->GetStartSReviewResultIndex();
      int nEndIdx = pReviewResult->GetEndSReviewResultIndex();
      nEndIdx = min(nEndIdx, (pReviewResult->GetSReviewResultCount()-1)) + 1;      // End Index 다시설정
      nEndIdx = min(nEndIdx, (pReviewResult->GetSReviewResultCount()-1)) + 1;      // End Index
      // [2017:3:8]-[WEZASW] : CameraOffset 범위 변경 (-1~1 => -5~5)
      // [2017:3:8]-[WEZASW] : CameraOffset (-1~1 => -5~5)
      double m_dMinOffset = -5.0; 
      double m_dMaxOffset = 5.0;
@@ -4971,7 +5189,7 @@
   if(pGlassResult && pReviewProcessor)
   {
      // MeasureStart
      pReviewProcessor->SetJobID(pGlassResult->m_strJobID);   // pGlassResult->m_strGlassID -> pGlassResult->m_strJobID 변경
      pReviewProcessor->SetJobID(pGlassResult->m_strJobID);   // pGlassResult->m_strGlassID -> pGlassResult->m_strJobID
      pReviewProcessor->SetOperID(pGlassResult->m_strOperID);
      m_pSP2P->ISP2P_UpdateReviewProcessStatus(ReviewProcessStatus_MeasureStart, nPlanIndex);
@@ -5046,7 +5264,7 @@
            const SCoordInfo* pCoordInfo = Module_GetCoordInfo(nModuleIdx);
            if(pCoordInfo == NULL) continue;   
            // [2017:3:8]-[WEZASW] : CameraOffset 범위 변경 (-1~1 => -5~5)
            // [2017:3:8]-[WEZASW] : CameraOffset (-1~1 => -5~5)
            double m_dMinOffset = -5.0; 
            double m_dMaxOffset = 5.0;
@@ -5152,7 +5370,6 @@
   int nTotalCount = 0;
   double dDefectPosX, dDefectPosY;
   // Module의 위치에 따른 ModuleStatus sorting
   std::vector<CModuleStatus*> SortedModuleStatus;
   for(int nModuleIdx = 0; nModuleIdx < m_pSP2P->ISP2P_GetModuleStatusCount(); nModuleIdx++)
   {
@@ -5206,7 +5423,7 @@
            const SCoordInfo* pCoordInfo = Module_GetCoordInfo(pReviewResult->GetModuleIndex());
            if(pCoordInfo == NULL) continue;            
            // [2017:3:8]-[WEZASW] : CameraOffset 범위 변경 (-1~1 => -5~5)
            // [2017:3:8]-[WEZASW] : CameraOffset (-1~1 => -5~5)
            double m_dMinOffset = -5.0; 
            double m_dMaxOffset = 5.0;
@@ -5227,7 +5444,6 @@
            if(nHeaderIdx == 0)
            {
               // 이동할 모터좌표 추가
               if((int)vectorPos.size() < MAX_MOTOR_ADDRESS_SIZE)
               {
                  pSReviewResult->dTargetMotorX = dDefectPosX;
@@ -6494,8 +6710,6 @@
         // add user schedule result
         
         //공유메모리에 채워줄 리뷰할 갯수와 디펙 좌표를 구조체에 채워주는 장소
         {
@@ -7210,7 +7424,6 @@
            break;
         }
         break;
      // 미사용
      case CPJT_PlanMeasure:
         {
            const CRcpMeasureInfo *pRcpMeasureInfo = pRsRcpMeasureInfo->GetRcpMeasureInfo(0);
@@ -7343,7 +7556,7 @@
}
//CIM DV Data
BOOL CSequenceProcessor_CPJT::SendDVDataToSignalControl() // 수정
BOOL CSequenceProcessor_CPJT::SendDVDataToSignalControl()
{
   CGlassResult *pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult();
   if (pGlassResult==NULL) return FALSE;
@@ -7368,7 +7581,7 @@
}
int CSequenceProcessor_CPJT::MakeDVData(CGlassResult *pGlassResult, char* pDVData, int nIndex) // 수정
int CSequenceProcessor_CPJT::MakeDVData(CGlassResult *pGlassResult, char* pDVData, int nIndex)
{
   g_pLog->DisplayMessage(_T("[SequenceProcessor] SendDVDataToSignalControl->MakeDVData IN."));
@@ -7377,16 +7590,16 @@
   const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo();
   if (pRsRcpReviewInfo == NULL) return FALSE;
   // Review 조명 정보
   // Review
   const CRcpLightInfo *pReviewLightInfo = pRsRcpReviewInfo->GetRcpLightInfo(nIndex);
   // Review AFM 정보
   // Review AFM
   const CRcpAFMRecipeInfo *pReviewAFMInfo = pRsRcpReviewInfo->GetRcpAFMRecipeInfo(nIndex);
   // Review Align Info
   const CAlignResult*   pAlignResult = pGlassResult->GetAlignResult();
   // Review Defect Info
   const CReviewResult* pReviewResult = pGlassResult->GetReviewResult(nIndex);
   // Review 배율 정보
   // Review
   const CModuleStatus* pModuleStatus = Module_GetModuleStatus(nIndex);
   const SMagnificInfo* pSMagnificInfo = pModuleStatus->GetMagnificInfo(pReviewAFMInfo->GetZoomIndex());
   CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl();
@@ -7408,12 +7621,12 @@
   // Write DVData Packet
   //_DVDataPack_B7_8ver DVDataPack;
   //**Review
   //INLINE  : 10개
   //TFE-OFF : 20개
   //Hcut : 50개
   //LAMI : 5개
   //INLINE  : 10
   //TFE-OFF : 20
   //Hcut : 50
   //LAMI : 5
   //**WSI
   //10개 고정
   //10
   ///////////////////////////////////////////////////////////////////////////
@@ -7451,8 +7664,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;
@@ -7460,8 +7678,8 @@
   //nAlignResult = 1;
   
   //nAlignResult00 = pAlignResult->nFindAlign[0] * 1000;//기준
   //nAlignResult01 = pAlignResult->nFindAlign[1] * 1000;//보조
   //nAlignResult00 = pAlignResult->nFindAlign[0] * 1000;
   //nAlignResult01 = pAlignResult->nFindAlign[1] * 1000;
   //nAlignResult00 = pAlignResult->dFindScore[0];
   //nAlignResult01 = pAlignResult->dFindScore[1];
@@ -7479,7 +7697,6 @@
      nAlignResult01 = 0;
   }
   //파워?
   nReviewAliveCamera00 = ReviewCamera_GetReviewCameraControl(0)->GetConnected() * 1000;
   nReviewAliveCamera01 = ReviewCamera_GetReviewCameraControl(1)->GetConnected() * 1000;
@@ -7496,8 +7713,7 @@
   {
      wsprintf(DriveText, TEXT("%C:"), Drive);
      UINT type = GetDriveType(DriveText);
      if ((dwDrive & dwDriveCh) && (type == DRIVE_REMOVABLE || type == DRIVE_FIXED || type == DRIVE_RAMDISK)) {
         // 하드용량
      if ((dwDrive & dwDriveCh) && (type == DRIVE_REMOVABLE || type == DRIVE_FIXED || type == DRIVE_RAMDISK)) {
         ULARGE_INTEGER i64FreeBytesToCaller = { 0 }, i64TotalBytes = { 0 }, i64FreeBytes = { 0 };
         BOOL bRsult = GetDiskFreeSpaceEx(DriveText, (PULARGE_INTEGER)&i64FreeBytesToCaller, (PULARGE_INTEGER)&i64TotalBytes, (PULARGE_INTEGER)&i64FreeBytes);
         if (bRsult) {
@@ -7711,7 +7927,8 @@
   pSignalControl->WritePacketData(_T("15100"), sizeof(DVDataPack_CPJT), (short*)&DVData);*/
}
void CSequenceProcessor_CPJT::MakeDVData2() //210325 kyh FDC
//#3358 KYH FDC ADD START
void CSequenceProcessor_CPJT::MakeDVData2()
{
   const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo();
@@ -7723,9 +7940,9 @@
   }
   else
   {
   // Review 조명 정보
   // Review
      pReviewLightInfo = pRsRcpReviewInfo->GetRcpLightInfo(0);
   // Review AFM 정보
   // Review AFM
      pReviewAFMInfo = pRsRcpReviewInfo->GetRcpAFMRecipeInfo(0);
   }
@@ -7749,7 +7966,7 @@
   // Review 배율 정보
   // Review
   const CModuleStatus* pModuleStatus = Module_GetModuleStatus(0);
   const SMagnificInfo* pSMagnificInfo = NULL;
   if (pModuleStatus == NULL)
@@ -7819,29 +8036,37 @@
   int nReviewAliveCamera01 = 1000;
   //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;
         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;
      }
      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 >*/
//    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;
//       }
//    }
@@ -7851,8 +8076,8 @@
   //nAlignResult = 1;
   //nAlignResult00 = pAlignResult->nFindAlign[0] * 1000;//기준
   //nAlignResult01 = pAlignResult->nFindAlign[1] * 1000;//보조
   //nAlignResult00 = pAlignResult->nFindAlign[0] * 1000;
   //nAlignResult01 = pAlignResult->nFindAlign[1] * 1000;
   //nAlignResult00 = pAlignResult->dFindScore[0];
   //nAlignResult01 = pAlignResult->dFindScore[1];
@@ -7892,7 +8117,6 @@
      nAlignResult01 = 1000;
   }
   //파워?
   if (ReviewCamera_GetReviewCameraControl(0) != NULL)
   {
      nReviewAliveCamera00 = ReviewCamera_GetReviewCameraControl(0)->GetConnected() * 1000;
@@ -7924,8 +8148,7 @@
   {
      wsprintf(DriveText, TEXT("%C:"), Drive);
      UINT type = GetDriveType(DriveText);
      if ((dwDrive & dwDriveCh) && (type == DRIVE_REMOVABLE || type == DRIVE_FIXED || type == DRIVE_RAMDISK)) {
         // 하드용량
      if ((dwDrive & dwDriveCh) && (type == DRIVE_REMOVABLE || type == DRIVE_FIXED || type == DRIVE_RAMDISK)) {
         ULARGE_INTEGER i64FreeBytesToCaller = { 0 }, i64TotalBytes = { 0 }, i64FreeBytes = { 0 };
         BOOL bRsult = GetDiskFreeSpaceEx(DriveText, (PULARGE_INTEGER)&i64FreeBytesToCaller, (PULARGE_INTEGER)&i64TotalBytes, (PULARGE_INTEGER)&i64FreeBytes);
         if (bRsult) {
@@ -7965,8 +8188,6 @@
   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);
@@ -7974,6 +8195,7 @@
   return;
}
//#3358 KYH FDC  ADD END
DWORD CSequenceProcessor_CPJT::GetDiskUsage()
{
@@ -8011,7 +8233,7 @@
   BOOL bResult = FALSE;
   // PCControl D2300 (검사 영역)
   // PCControl D2300
   switch(nSignalIndex)
   {
   case PCControlRecv_TimeChange:
@@ -8077,7 +8299,7 @@
       g_pLog->DisplayMessage(_T("[SequenceProcessor] Success! SetLocalTime(), Current: %04d-%02d-%02d %02d-%02d-%02d, Changed: %04d-%02d-%02d %02d-%02d-%02d"), 
         CurrentTime.wYear, CurrentTime.wMonth, CurrentTime.wDay, CurrentTime.wHour, CurrentTime.wMinute, CurrentTime.wSecond,
         ChangedTime.wYear, ChangedTime.wMonth, ChangedTime.wDay, ChangedTime.wHour, ChangedTime.wMinute, ChangedTime.wSecond);
      // AFM & WSI TIME 동기화
      // AFM & WSI TIME
      SendSystemTime(ChangedTime);
   } else {
       g_pLog->DisplayMessage(_T("[SequenceProcessor] Fail! SetLocalTime()"));
@@ -8104,7 +8326,7 @@
   return TRUE;
}
// Local System 변경 시간과 변경 요청 컨트롤러의 시간차 처리 생각
// Local System
BOOL CSequenceProcessor_CPJT::SendSystemTime(SYSTEMTIME sysTime)
{
   SYSTEMTIME CurrentTime;
@@ -8251,7 +8473,7 @@
         case PCControlSend_Defoucs:
            m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Defoucs! => %d"),0);
            break;
         case PCControlSend_Diagnosis: // 0412 자가진단 신호 추가
         case PCControlSend_Diagnosis: // 0412
            m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Diagnosis! => %d"), 0);
            break;
         }
@@ -8303,8 +8525,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;
         }
      }
@@ -8362,7 +8584,7 @@
         case PCControlSend_Defoucs:
            m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Defoucs! => %d"),0);
            break;
         case PCControlSend_Diagnosis: // 0412 자가진단 신호 추가
         case PCControlSend_Diagnosis: // 0412
            m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Diagnosis! => %d"), 0);
            break;
         }
@@ -8462,6 +8684,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!"));
      }
@@ -8469,14 +8692,16 @@
   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!"));
         // lmk simul manual camera,motor stop
         //ReviewCamera_CameraControl(CameraControlStop);   // 모터 멈추면 카메라 자동 스탑
         //ReviewCamera_CameraControl(CameraControlStop);
         CMotorControl*  pMotorControl = m_pSP2P->ISP2P_GetMotorControl();
         if(pMotorControl)
            pMotorControl->CommonSetAutoStop();
@@ -8647,10 +8872,10 @@
         if (SetLocalTime(&sTime))
         {
            m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] 시간동기화성공 %s"), strtime);
            m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] TymeSync Success %s"), strtime);
         }
         else
            m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] 시간동기화실패 %s"), strtime);
            m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] TymeSync Fail %s"), strtime);
         //memcpy(&time, strTime, 2);
@@ -8665,14 +8890,21 @@
   break;
   case PCControlRecv_Autodiagnosis:
   {
      m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Diagno start => %d"), bSignalOn);
      /*< LYW 20210719 : #3517 ADD Start >*/
      CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl();
      CString strDiagnosisMode;
      pSignalControl->ReadData(_T("11160"), 2, strDiagnosisMode);
      int nDiagnosisMode = atoi(strDiagnosisMode);
      m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Signal] Diagno start => %d, DiagnosisMode => %d"), bSignalOn, nDiagnosisMode);
      if (bSignalOn) {
         bResult = SendSignalToSignalControl(PCControlSendSignalIndex_DiagnoAck, 0);
         
         m_pSP2P->ISP2P_GetDlgDiagnosis()->ShowWindow(SW_SHOW);
         
         m_pSP2P->ISP2P_GetDiagnosisManager()->RecvSignalToSignalControl(0, 0);
         m_pSP2P->ISP2P_GetDiagnosisManager()->RecvSignalToSignalControl(0, nDiagnosisMode);
      }
      /*< LYW 20210719 : #3517 ADD End >*/
      else
         bResult = SendSignalOffToSignalControl(PCControlSendSignalIndex_DiagnoAck, 0);
@@ -8871,7 +9103,6 @@
   CReviewResult* pWsiMultiShotResult = pGlassResult->GetWsiMultiShotResult(nModuleIndex);
   if (pWsiMultiShotResult == NULL) goto RESULT_FAIL;
   // 마지막 인덱스를 가져온다.
   int nCurResultIdx = pWsiMultiShotResult->GetLastSReviewResultIndex() + 1; // last index + 1
   int nStartResultIdx = pWsiMultiShotResult->GetStartSReviewResultIndex();
   int nEndResultIdx = pWsiMultiShotResult->GetEndSReviewResultIndex();
@@ -8885,13 +9116,11 @@
   int      nMPosY = int(pPosition->dMotorPosY * 1000.0);
   double   dTime = (double)m_ProcessTimer.GetDurationMilliSecond();
   // 인덱스가 다르면 비정상임.
   if (measureResut.nResultIndex != nCurResultIdx)
   {
      goto RESULT_FAIL;
   }
   // 현재 데이터 저장.
   // measureResut
   if (pWsiMultiShotResult->GetSReviewResultCount() == 0) return;
@@ -8916,7 +9145,6 @@
   // set last result idx
   pWsiMultiShotResult->SetLastSReviewResultIndex(nCurResultIdx);
   // 마지막 포인트까지 왔고, WSI 결과가 남아 있으면...
   if (nCurResultIdx == nEndResultIdx && nCurResultIdx <= pWsiMultiShotResult->GetSReviewResultCount())
   {
      nStartResultIdx = nCurResultIdx + 1;
@@ -8927,8 +9155,7 @@
      pWsiMultiShotResult->SetStartSReviewResultIndex(nStartResultIdx);
      pWsiMultiShotResult->SetEndSReviewResultIndex(nEndResultIdx);
      // 나머지 포인트 리뷰 수행하자.
      ::Sleep(3000); // 딜레이는 필수임. 없으면 동작 안함.
      ::Sleep(3000);
   //   Process_RemainWsiPoint(nModuleIndex);
   }
@@ -8994,7 +9221,7 @@
   if(pGlassResult && pReviewProcessor)
   {
      // WsiStart
      pReviewProcessor->SetJobID(pGlassResult->m_strJobID);   // pGlassResult->m_strGlassID -> pGlassResult->m_strJobID 변경
      pReviewProcessor->SetJobID(pGlassResult->m_strJobID);   // pGlassResult->m_strGlassID -> pGlassResult->m_strJobID
      pReviewProcessor->SetOperID(pGlassResult->m_strOperID);
      m_pSP2P->ISP2P_UpdateReviewProcessStatus(ReviewProcessStatus_WSIReflowStart, nPlanIndex);
@@ -9030,7 +9257,7 @@
   if(pGlassResult && pReviewProcessor)
   {
      // WsiStart
      pReviewProcessor->SetJobID(pGlassResult->m_strJobID);   // pGlassResult->m_strGlassID -> pGlassResult->m_strJobID 변경
      pReviewProcessor->SetJobID(pGlassResult->m_strJobID);   // pGlassResult->m_strGlassID -> pGlassResult->m_strJobID
      pReviewProcessor->SetOperID(pGlassResult->m_strOperID);
      m_pSP2P->ISP2P_UpdateReviewProcessStatus(ReviewProcessStatus_WSIStart, nPlanIndex);
@@ -9057,7 +9284,6 @@
   WSIAllReadySignal(1);
   // send wsi start
   // 수정 사항
   if (!WSIMultiShotAllStartSignal())
   {
      g_pLog->DisplayMessage(_T("[WSI] WSI MultiShot Start Fail!!"));
@@ -9068,7 +9294,7 @@
   if (pGlassResult && pReviewProcessor)
   {
      // WsiStart
      pReviewProcessor->SetJobID(pGlassResult->m_strJobID);   // pGlassResult->m_strGlassID -> pGlassResult->m_strJobID 변경
      pReviewProcessor->SetJobID(pGlassResult->m_strJobID);   // pGlassResult->m_strGlassID -> pGlassResult->m_strJobID
      pReviewProcessor->SetOperID(pGlassResult->m_strOperID);
      m_pSP2P->ISP2P_UpdateReviewProcessStatus(ReviewProcessStatus_WSIMultiShotStart, nPlanIndex);
@@ -9131,7 +9357,7 @@
      int nEndIdx = pWsiResult->GetEndSReviewResultIndex();
      nEndIdx = min(nEndIdx, (pWsiResult->GetSReviewResultCount()-1)) + 1;      // set End Index 
      // [2017:3:8]-[WEZASW] : CameraOffset 범위 변경 (-1~1 => -5~5)
      // [2017:3:8]-[WEZASW] : CameraOffset (-1~1 => -5~5)
      double m_dMinOffset = -5.0; 
      double m_dMaxOffset = 5.0;
@@ -9261,7 +9487,6 @@
      CModuleStatus*               pModuleStatus   = Module_GetModuleStatus(nModuleIdx);      
      if (pModuleStatus == NULL) continue;
      //충돌거리 넣기
      {
         double dCollisionPosX = pWsiUserResult->GetCollisionPositionX() / 1000.0;
         double dCollisionPosY = 0.0;
@@ -9304,7 +9529,7 @@
      int nEndIdx = pWsiUserResult->GetEndSReviewResultIndex();
      nEndIdx = min(nEndIdx, (pWsiUserResult->GetSReviewResultCount()-1)) + 1;      // set End Index 
      // [2017:3:8]-[WEZASW] : CameraOffset 범위 변경 (-1~1 => -5~5)
      // [2017:3:8]-[WEZASW] : CameraOffset (-1~1 => -5~5)
      double m_dMinOffset = -5.0; 
      double m_dMaxOffset = 5.0;
@@ -9407,17 +9632,13 @@
         }
      
      }
      //기존꺼 삭제
      pWsiMultiShotResult->GetVectorSReviewResult()->clear();
      int nResultCount = 0;
      if (m_vecSReviewResult.size()>0)
      {   
         //스케줄링 순서 대로 집어넣은거라 걍 집어넣기 ㄱㄱ
         for(int i=0; i< m_vecSReviewResult.size(); i++)
         {
            //원래는 세팅에 분할 갯수 입력해야됨 그것만큼 돌리기!
            //지금은 WSI FOV 4분할 기준에서 ㄱㄱ
         {
            double dOringinX = m_vecSReviewResult[i].nUMOriginX;
            double dOringinY = m_vecSReviewResult[i].nUMOriginY;
@@ -9686,8 +9907,6 @@
      CModuleStatus*               pModuleStatus = Module_GetModuleStatus(nModuleIdx);
      if (pModuleStatus == NULL) continue;
      //충돌거리 넣기
      {
         double dCollisionPosX = pWsiMultiShotResult->GetCollisionPositionX() / 1000.0;
@@ -9715,7 +9934,7 @@
         int nEndIdx = pWsiMultiShotResult->GetEndSReviewResultIndex();
         nEndIdx = min(nEndIdx, (pWsiMultiShotResult->GetSReviewResultCount() - 1)) + 1;      // set End Index 
         // [2017:3:8]-[WEZASW] : CameraOffset 범위 변경 (-1~1 => -5~5)
         // [2017:3:8]-[WEZASW] : CameraOffset (-1~1 => -5~5)
         double m_dMinOffset = -5.0;
         double m_dMaxOffset = 5.0;
@@ -10156,7 +10375,7 @@
   CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo();
   if(pRsRcpReviewInfo == NULL)   return FALSE;
   if(pRsRcpReviewInfo->GetRcpUserDefectInfoCount() < 1)   return TRUE;      // 고정리뷰 카운트가 없다면 넘어가자
   if(pRsRcpReviewInfo->GetRcpUserDefectInfoCount() < 1)   return TRUE;
   double dCenterPosX, dCenterPosY;
   
@@ -10215,18 +10434,18 @@
   _grmGlassData* pSharedGlassData = pDitSharedGlassRaw->GetGlassData();
   if(pSharedGlassData == NULL) return FALSE;
   //pSharedGlassData->m_nUserReviewNum = 0; //공유 메모리 User plan
   //pSharedGlassData->m_nUserReviewNum = 0; // User plan
   _grmDefectData* pSharedDefect;
   int nPointCount = pRecipeinfo->GetRcpUserDefectInfoCount(); // User 좌표 총 카운트
   int nPointCount = pRecipeinfo->GetRcpUserDefectInfoCount();
   int nSharedDefectNum = pSharedGlassData->m_nDefectNum; // 디펙 총개수 User Idx 의 첫번째 Index 가 된다
   int nStartIdx=nSharedDefectNum;// USER 디펙 종류 IDX 부여하기 위한 시작점
   int nSharedDefectNum = pSharedGlassData->m_nDefectNum;
   int nStartIdx=nSharedDefectNum;
   CRcpPlanInfo* pRcpPlanInfo; // 레시피 정보
   CRcpUserDefectInfo *pDefectInfo;// 레시피 defect 정보
   CRcpPlanInfo* pRcpPlanInfo;
   CRcpUserDefectInfo *pDefectInfo;
   
   int nInsepectionType;// User 타입 Reviewreflow = 0 wsiReflow =1; REV&WSI =2; WSIUSEr =3; USER =4;
   int nInsepectionType;// User Reviewreflow = 0 wsiReflow =1; REV&WSI =2; WSIUSEr =3; USER =4;
   int nCount = 0;
@@ -10290,7 +10509,7 @@
BOOL CSequenceProcessor_CPJT::CompareRevType(int nInsType,int nRevType)
{
   //Plan 타입과 InspectionMode 비교
   //Plan InspectionMode
   if(nRevType == CPJT_PlanUser)
   {
     if(nInsType == USER) return TRUE;
@@ -10348,7 +10567,7 @@
   CString strMessage, strResultFilePath, strUploadResultFilePath, strLocalRawPath;
   CString   strUploadRawPath, strUploadImagePath, strAOIRawFileName, strAOIRawFilePath;
   //3-1. 리뷰 결과 파일 쓰기
   //3-1.
   m_pSP2P->ISP2P_SetReviewResultData(pGlassResult);
   strLocalRawPath      = pNetworkInfo->m_strLocalRawPath;
@@ -10375,7 +10594,7 @@
         if(strUploadRawPath.IsEmpty() == FALSE && strAOIRawFilePath.IsEmpty() == FALSE)
         {
            // [2017:5:16]-[WEZASW] : 리뷰 PASS시의 설비 운영의 상황에 따라 AOI Server가 RAW 파일 직접 업로드 진행.
            // [2017:5:16]-[WEZASW] :
            strUploadResultFilePath.Format(_T("%s\\%s"), strUploadRawPath, strAOIRawFileName);
            if(CopyFile(strResultFilePath, strUploadResultFilePath, FALSE))
@@ -10396,9 +10615,9 @@
   }
   // delete file of Glass direction
   DeleteFile(pNetworkInfo->m_strAOIRawPath + _T("\\") + pGlassResult->m_strJobID + _T("TD"));//pGlassResult->m_strGlassID -> m_StrJobID 변경
   DeleteFile(pNetworkInfo->m_strAOIRawPath + _T("\\") + pGlassResult->m_strJobID + _T("TD"));//pGlassResult->m_strGlassID -> m_StrJobID
   // [2017:4:11]-[WEZASW] :CIM(DV Data) 보고 항목 추가.
   // [2017:4:11]-[WEZASW] :CIM(DV Data)
   if (SendDVDataToSignalControl()==FALSE) 
   {
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] DV Data Send FAIL!"));         
@@ -10418,8 +10637,6 @@
BOOL CSequenceProcessor_CPJT::MoveReviewStartMotorPosition(CGlassResult* pGlassResult,int nReviewType)
{
   //혹시나 쓰일까봐 남겨듐
   //다음 플랜의 첫번째 위치로 이동
   
   double dDefectPosX,dDefectPosY = 0;
   
@@ -10483,7 +10700,7 @@
void CSequenceProcessor_CPJT::SendWsiErrorAlarm_CPJT(int Index) //190801 chm
{   
   //wsi 에러 알람
   //wsi
   if(Index==1)
   {
      g_pLog->DisplayMessage(_T("[SequenceProcessor_CPJT] WSI Alive Error!!!"));
@@ -10497,7 +10714,7 @@
void CSequenceProcessor_CPJT::SendWsiAlive_CPJT()//190801 chm
{
   //WSI Alive 신호 받음
   //WSI Alive
   SetWSIAliveCheck(TRUE);
}
@@ -10523,7 +10740,7 @@
         if(bWsiAliveCheck ==FALSE){
            m_pCSPC->SendWsiErrorAlarm_CPJT(1);
         }
         bWsiAliveCheck=FALSE; //30초에 한번씩 0으로 초기화
         bWsiAliveCheck=FALSE;
      }
   }