SDC C-Project CF Review 프로그램
ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.cpp
@@ -51,7 +51,7 @@
#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};
@@ -166,10 +166,13 @@
{
   m_bUseAFMHomePosition = TRUE;
   m_nGlassCount = 0;
   m_nStackZeroReviewCondition = 0;
   m_nUploadResultFailCount = 0;
   m_nStackUploadFailGlassCount = 0;
   CDitGlassRawClient* pDitGlassRaw = CDitGlassRawClient::GetInstance();
   if(pDitGlassRaw->ConnectServer() == FALSE)
   {
      g_pLog->DisplayMessage(_T("�����޸� ���� ����!(Shared memory Access Fail)"));
      g_pLog->DisplayMessage(_T("(Shared memory Access Fail)"));
   }
}
    
@@ -183,17 +186,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;
      //   }
@@ -204,9 +205,8 @@
      //   bReturn = FALSE;
      //}
      
      if (bReturn) // �����̸�...
      if (bReturn)
      {
         // Thread ���� �� Thread ����
         CSequenceProcessData* pThreadData = new CSequenceProcessData(this);
         if (pThreadData)
         {
@@ -227,7 +227,6 @@
         }
      }
      else if(nProcessStatus==2){
         // Thread ���� �� Thread ����
         CSequenceProcessData* pThreadData = new CSequenceProcessData(this);
         if (pThreadData)
         {
@@ -277,7 +276,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();
@@ -291,13 +289,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 ;
@@ -324,7 +320,6 @@
   // set last result idx
   pWsiResult->SetLastSReviewResultIndex(nCurResultIdx);
   // ������ ����Ʈ���� �԰�, WSI ����� ���� ������...
   if(nCurResultIdx==nEndResultIdx && nCurResultIdx<=pWsiResult->GetSReviewResultCount())
   {
      nStartResultIdx = nCurResultIdx + 1;
@@ -335,8 +330,7 @@
      pWsiResult->SetStartSReviewResultIndex(nStartResultIdx);
      pWsiResult->SetEndSReviewResultIndex(nEndResultIdx);
      // ������ ����Ʈ ���� ��������.
      ::Sleep(3000); // ����̴� �ʼ���. ������ ���� ����.
      ::Sleep(3000);
//      Process_RemainWsiPoint(nModuleIndex);
   }
@@ -362,7 +356,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();
@@ -376,13 +369,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 ;
@@ -407,7 +398,6 @@
   // set last result idx
   pWsiResult->SetLastSReviewResultIndex(nCurResultIdx);
   // ������ ����Ʈ���� �԰�, WSI ����� ���� ������...
   if(nCurResultIdx==nEndResultIdx && nCurResultIdx<=pWsiResult->GetSReviewResultCount())
   {
      nStartResultIdx = nCurResultIdx + 1;
@@ -418,8 +408,7 @@
      pWsiResult->SetStartSReviewResultIndex(nStartResultIdx);
      pWsiResult->SetEndSReviewResultIndex(nEndResultIdx);
      // ������ ����Ʈ ���� ��������.
      ::Sleep(3000); // ����̴� �ʼ���. ������ ���� ����.
      ::Sleep(3000);
      //      Process_RemainWsiPoint(nModuleIndex);
   }
@@ -442,6 +431,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;
   }
@@ -449,7 +440,6 @@
    CAlignResult *pAlignResult = &pGlassResult->m_AlignResult;
    CAlignRecipe *pAlignRecipe = &pGlassResult->m_AlignRecipe; 
 
    // ����� �ڵ����� ��� �����ǿ� ��������.
    CRsRcpAlignInfo *pRsRcpAlignInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpAlignInfo();
    if (pRsRcpAlignInfo!=NULL && pRsRcpAlignInfo->m_bAutoProcess)
    {
@@ -463,25 +453,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();
@@ -490,38 +476,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!"));
@@ -556,8 +539,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!"));
@@ -568,8 +550,16 @@
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Fail Data!"));
   }
   /*< SWK 20221226 - #4403 MOD Start >*/
//    AlignCamera_CameraControl(CameraControlStop);  // 210805 Align Camera Sequence 변경
//
//    SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_AlignComplete_CPJT);
//    m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Complete Signal!"));
   SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_AlignComplete_CPJT);
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Complete Signal!"));
   AlignCamera_CameraControl(CameraControlStop);
   /*< SWK 20221226 - #4403 MOD End >*/
   // LJY-20180905
   m_pSP2P->ISP2P_UpdateAlignResultStatus(0, pGlassResult);
@@ -684,18 +674,23 @@
      //   m_pSP2P->ISP2P_GetWSIControl(1)->SendWsiAfmSafePosMove();
      //}
      //Sleep(5000);
      SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
      SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewComplete_CPJT);
      //if (GetProcessStatus() != ProcessReviewEnd_CPJT && GetProcessStatus() != ProcessReviewUnloding_CPJT)
      if (GetReviewComplete() == FALSE)
      {
         SendResultToSignalControl(PCControlSendData_ReviewResult_CPJT, SIGNAL_SEND_RESULT_SUCCESS);
         SendSignalToSignalControl(PCControlSendSignalIndex_Seq, PCControlSend_ReviewComplete_CPJT);
         SetReviewComplete(TRUE);
      }
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewStart] Send Review Success Signal!"));
      //LONGREUN
      //RecvSignalToSignalControl(PCControlRecvSignalIndex_Seq, 4);
      m_pSP2P->ISP2P_UpdateReviewProcessStatus(ReviewProcessStatus_None, nPlanIndex);
       
      //�����
      AFM_SetAFMTracking(FALSE);
      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)
@@ -724,13 +719,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) 
@@ -774,8 +768,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());
@@ -788,7 +780,7 @@
         if (( nTotalCount += pGlassResult->GetTotalSReviewResultCount()) > 0)
         {
            m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] Review Plan Start!"));
            //LYW DCOLL 임시조치
            //LYW DCOLL �ӽ���ġ
            CDitGlassRawClient *pDitRawClient = CDitGlassRawClient::GetInstance();
            if (pDitRawClient->isConnect() == TRUE)
            {
@@ -801,7 +793,7 @@
               strcpy(pSharedDefectReview->m_strRevImageName, "");
            }
            //LYW DCOLL 임시조치
            //LYW DCOLL �ӽ���ġ
            ::Sleep(nWaitTime);
            m_pSP2P->ISP2P_GetReviewProcessor()->ResetGantryDone();
            bExcute = ReviewStartProcessing(pGlassResult, nPlanIdx);
@@ -830,7 +822,7 @@
            m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] WSI Plan End!"));
         }
         break;
      //�̻��
      case CPJT_PlanMeasure:
         if (( nTotalCount += pGlassResult->GetTotalSMeasureResultCount()) > 0)
         {
@@ -902,19 +894,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;
@@ -924,12 +924,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;
}
@@ -939,17 +947,33 @@
   AllAckSignalOff();
   m_pSP2P->ISP2P_GetReviewProcessor()->ResetGantryDone();
   SetCheckWSIEnd(-1); //190726 wsiendüũ �ʱ�ȭ
   SetWsiType(-1);    //wsi reflow Ÿ�� ���� �ʱ�ȭ
   SetCheckWSIEnd(-1); //190726
   SetWsiType(-1);    //wsi reflow
   SetLastPointCheck(FALSE);
   SetReviewComplete(FALSE);
   //SetUploadResultFailCount(0);
   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!"));   
@@ -967,18 +991,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!"));
   //}
   //#3357 KYH Align Image �ʱ�ȭ ADD START
   //#3357 KYH Align Image ADD START
   CCameraControlAlign* pAlignCameraControl = m_pSP2P->ISP2P_GetAlignCameraControl();
   if (pAlignCameraControl != NULL)
   {
@@ -986,7 +1010,7 @@
      g_pLog->DisplayMessage(_T("[Align] Align Image Clear"));
   }
   //#3357 KYH Align Image �ʱ�ȭ ADD END
   //#3357 KYH Align Image ADD END
    // get transfer data
    int nResultCode = 0;
@@ -1013,13 +1037,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;
@@ -1028,11 +1059,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;
@@ -1042,10 +1073,9 @@
         }
         // #3381 LYW CF AOI Review ������ FDC TackTime ������ ���� ���� ADD START
         // #3381 LYW CF AOI Review FDC TackTime ADD START
         pDitRawClient->GetGlassData()->m_tmReviewLoading = CTime::GetCurrentTime();
         // #3381 LYW CF AOI Review ������ FDC TackTime ������ ���� ���� ADD END
         // #3381 LYW CF AOI Review FDC TackTime ADD END
         CString strGlassIDTemp = NULL;
         CString strGlassStepIdTemp = NULL;
@@ -1053,7 +1083,6 @@
         strGlassIDTemp = pTransferData->strGlassID;
         strGlassStepIdTemp = pTransferData->strStepID;
         strGlassIDTemp = pTransferData->strGlassID;
         strcpy(pDitRawClient->GetGlassData()->m_strGlassID, strGlassIDTemp);
@@ -1061,18 +1090,25 @@
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::GlassLoading] Send Loading Success Signal!"));
         strFileName.Format(_T("%s_%s"), strGlassIDTemp, strGlassStepIdTemp);
<<<<<<< HEAD
         //업데이트시
         bFileFind = FindRawBinFile(strFileName);
         //bFileFind = TRUE;
=======
         //������Ʈ��
         //bFileFind = FindRawBinFile(strFileName);
         bFileFind = TRUE;
>>>>>>> feature/#3486_CF_AOI_Review_Review_History_프로그램_테스트_및_적용
         //#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);
         //< SWK 20221226 - #4403 DEL >
//         Sleep(1000);
          m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::Loading] Transfer Data Read Success!"));
 
@@ -1097,6 +1133,10 @@
          }
          
         m_pSP2P->ISP2P_DisplayMessage(_T("[Glass Loading] Current Apply Recipe Name : %s"), strRecipefile);
         /*< LYW 20220610 - #4185 ADD Start >*/
         CheckGantryMode();
         /*< LYW 20220610 - #4185 ADD End >*/
 
         // recipe data apply
         if(ApplyRecipeDataToGlassResult(pGlassResult)==FALSE)
@@ -1114,7 +1154,7 @@
       }
    }
   //// 190725 ����� ��û���� chm ASCEND �� alarm
   //// 190725 chm ASCEND alarm
   const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo();
   const CRcpSortingInfo *pSortingInfo = pRsRcpReviewInfo->GetRcpReviewSortInfo();
@@ -1131,7 +1171,7 @@
   
   
   ////������ �������� �ȱ� 190618
   ////190618
   if(GetUseAfmHomePosition())
   {
   g_pLog->DisplayMessage(_T("[AFM] AFM Home Position Start!!!"));
@@ -1140,7 +1180,6 @@
   }
   //�����޸� Ŀ��� ���� ��ŸƮ(�۶� �ε�)
   CDitGlassRawClient* pDitSharedGlassRaw = CDitGlassRawClient::GetInstance();
   if (pDitSharedGlassRaw->isConnect() == FALSE) {
      m_pSP2P->ISP2P_DisplayMessage(_T("[DitGlassRawClient] Shared Memory Connect Fail"));
@@ -1175,25 +1214,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
@@ -1215,8 +1271,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!"));
@@ -1232,17 +1296,58 @@
{
    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
   //< SWK 20221226 - #4403 MOD >
   Sleep(100);
   //original
//    if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_AlignStartAck_CPJT))
//       m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::AlignStart] Send Align Start Ack!"));
    // 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();
 
@@ -1250,23 +1355,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())
      {
@@ -1274,16 +1404,26 @@
      }
      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
@@ -1291,7 +1431,7 @@
         //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!"));
   }
      }
   }
@@ -1308,26 +1448,43 @@
   
   //pDitRawClient->SetReviewStart();
   Sleep(500);
   //< SWK 20221226 - #4403 DEL >
//   Sleep(500);
   //CString strJudgeData;
   m_pSP2P->ISP2P_GetSignalControl()->WriteData(_T("17110"), sizeof(pDitRawClient->GetGlassData()->m_strGlassJudge), pDitRawClient->GetGlassData()->m_strGlassJudge);
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::IN] ReadRawFile!"));
   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"));
@@ -1354,20 +1511,27 @@
      int nTotalPlanCount = CalculatePlanData(pGlassResult);
      m_pSP2P->ISP2P_DisplayMessage(_T("[Read Raw File] Review All Plan Total Count : %d"), nTotalPlanCount);
      //�����ߵ�
      Sleep(1000);
      //< SWK 20221226 - #4403 DEL >
//      Sleep(1000);
      // send review ready
      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);
@@ -1375,7 +1539,6 @@
      //         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReadRawFile] Send Review Ready Signal!"));
      //}
      //�ּ� ����
      int nCurPlanIndex = 0;
      CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo();
      if(pRsRcpReviewInfo)
@@ -1390,15 +1553,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)
@@ -1412,8 +1581,6 @@
   CFileFind Uploadfile, RTMSUploadPath;
   if (CDitGlassRawClient::GetInstance()->GetGlassData() == NULL) return;
   //���ε� ������ ������ ���� ������ �ٽ� ���ε� ��� Set 20190917chm
   if(Uploadfile.FindFile(strPath)==FALSE)
   {
      CTime tmServerLoadingTime = CDitGlassRawClient::GetInstance()->GetGlassData()->m_tmGlassLoading;
@@ -1421,10 +1588,6 @@
      CreateDirectory(strPath, NULL);
      pReviewProcessor->SetUploadImagePath(strPath);
      //taek 210126 rtms ����� �̹��� ���� ����
      CreateDirectory(pReviewProcessor->GetRTMSUploadImagePath(),NULL);
   }
@@ -1441,9 +1604,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;
@@ -1470,10 +1640,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);
   //         }
   //      }
   //   }
@@ -1481,7 +1651,6 @@
   //   {
   //      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor] TotalPitchMeasure Result Fail!"));
   //      // 190711 SJB, TotalPitchMeasure Fail�ÿ� �ٷ� Motor�� ����� ������ ���ٴ� Motion Enable ��ȣ�� Ȯ������
   //      
   //      if(!pTotapPithMeasure->GetMotorEnable())
   //      {
@@ -1507,15 +1676,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!"));
@@ -1533,20 +1710,50 @@
{
   m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::IN] ReviewEnd!"));
   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 START
   if (GetSimulationMode() == FALSE)
   {
      if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewEndAck_CPJT))
         m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] Send Review End Ack!"));
   }
   SetUploadResultFailCount(0);
   CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult();
   if (pGlassResult == NULL) return;
   //#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 MOD END
   //original
//    if (SendSignalToSignalControl(PCControlSendSignalIndex_Ack, PCControlSend_ReviewEndAck_CPJT))
//       m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] Send Review End Ack!"));
   CDitGlassRawClient* m_pDitGlassRaw = CDitGlassRawClient::GetInstance();
   if (m_pSP2P->ISP2P_GetWSIControl(0)!=NULL)
   if (GetSimulationMode() == FALSE && m_pSP2P->ISP2P_GetWSIControl(0)!=NULL)
   {
      m_pSP2P->ISP2P_GetWSIControl(0)->SetWsiTimeOver();
      m_pSP2P->ISP2P_GetWSIControl(1)->SetWsiTimeOver();
      /*< LYW 20211015 - #3662 ADD Start >*/
//       m_pSP2P->ISP2P_GetWSIControl(0)->SetWsiEnd();
//       m_pSP2P->ISP2P_GetWSIControl(1)->SetWsiEnd();
      /*< LYW 20211015 - #3662 ADD End >*/
   }
   if (GetLastPointCheck() == FALSE)
   {
      Sleep(1000);
   }
   ReJudgeProcessing(m_pDitGlassRaw);
   /*< LYW 20220401 - ##4006 MOD Start >*/
   if (pGlassResult->m_AlignResult.GetResultCode() == Align_Success)
   {
      m_pSP2P->ISP2P_DisplayMessage(_T("[SequenceProcessor::ReviewEnd] Review ReJudgeProcessing Startl!"));
      ReJudgeProcessing(m_pDitGlassRaw);
   }
   else
   {
      m_pSP2P->ISP2P_DisplayMessage(_T("Align Code = %d, ReJudgeProcessing SKIPl!"), pGlassResult->m_AlignResult.GetResultCode());
   }
   /*< LYW 20220401 - ##4006 MOD End >*/
   //Origin
   //ReJudgeProcessing(m_pDitGlassRaw);
   m_pDitGlassRaw->GetGlassData()->m_tmReviewEnd = CTime::GetCurrentTime();
   if (m_pDitGlassRaw->isConnect() != FALSE) 
   {
@@ -1555,20 +1762,25 @@
   }
   
   m_pDitGlassRaw->GetGlassData()->m_nReviewNum = m_pSP2P->ISP2P_GetReviewProcessor()->GetPlanReviewCount();
    //SendDVDataToSignalControl();// �Ⱦ���
    //SendDVDataToSignalControl();
   //OverTime �߻��� ����� END ACK�� ��ٸ��°� �ƴ϶� �� Conplete�� ��ٸ���.
   //�� ... ����  �����ε��ϴ� �߰�
   if (GetLastPointCheck() == FALSE)
   //if (GetLastPointCheck() == FALSE)
   if (GetReviewComplete() == 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!"));
         SetReviewComplete(TRUE);
      }
      //#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();
   if (pGlassResult==NULL) return;
   
   // review camera stop
   ReviewCamera_CameraControl(CameraControlStop);
@@ -1585,10 +1797,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);
@@ -1598,41 +1808,69 @@
      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();
   if (CheckZeroReviewAlarm() == FALSE && m_pSP2P->ISP2P_System_GetNetworkInfo()->m_nZeroReviewAlarm != 0)
   {
      STransferData* pTransferData = m_pSP2P->ISP2P_GetCurrentTransferData();
      if (pTransferData->strProdType != m_pSP2P->ISP2P_System_GetNetworkInfo()->m_strZeroReviewAlarmExcept)
      {
         m_nStackZeroReviewCondition++;
         m_pSP2P->ISP2P_DisplayMessage(_T("Zero Review Condition ProdType = %s, ConditionStack = %d, AlarmExcept = %s, AlarmCondition = %d"), pTransferData->strProdType, m_nStackZeroReviewCondition, m_pSP2P->ISP2P_System_GetNetworkInfo()->m_strZeroReviewAlarmExcept, m_pSP2P->ISP2P_System_GetNetworkInfo()->m_nZeroReviewAlarm);
         if (m_nStackZeroReviewCondition >= m_pSP2P->ISP2P_System_GetNetworkInfo()->m_nZeroReviewAlarm)
         {
            m_pSP2P->ISP2P_DisplayMessage(_T("Zero Review Alarm! %d ea Glass Is Zero Review!"), m_nStackZeroReviewCondition);
            SendSignalToSignalControl(PCControlSendSignalIndex_State, PCControlSend_Review_0Count_Alarm, 1000);
            m_nStackZeroReviewCondition = 0;
         }
      }
      else m_nStackZeroReviewCondition = 0;
   }
   else m_nStackZeroReviewCondition = 0;
   /*int nModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount(); //0503 ���� End�� ����� 0���� �ʱ�ȭ
   /*< LYW 20211109 - #3662 Delete Start >*/
   //    g_pLog->DisplayMessage(_T("History map Start"));
   //    int nGlassResultCount = 0;
   //    CGlassResult*  pHistoryResult = m_pSP2P->ISP2P_GetNewHistoryResult(nGlassResultCount); //taek 210201
   //    g_pLog->DisplayMessage(_T("History map Copy"));
   //    ReadAOIMemory2(pHistoryResult);
   //    g_pLog->DisplayMessage(_T("History map TransferData"));
   //    UpdateHistoryResultFromTransferData(pHistoryResult, pGlassResult);
   //    g_pLog->DisplayMessage(_T("History Button Enable"));
   //    m_pSP2P->ISP2P_GetDiagnosisHistory2();
   /*< LYW 20211109 - #3662 Delete End >*/
   /*int nModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount();
   for (int nModuleIdx = 0; nModuleIdx < nModuleCount; nModuleIdx++)
   {
      {
         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!"));
}
@@ -1640,9 +1878,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!"));
   
}
@@ -1665,8 +1910,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;
@@ -1680,7 +1925,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
@@ -1694,10 +1939,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
@@ -1735,7 +1980,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
@@ -1745,13 +1990,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;
@@ -1764,7 +2009,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;
@@ -1773,7 +2018,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;
               }
@@ -1823,13 +2068,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)
@@ -1880,7 +2125,7 @@
            }
            else //WSI TYPE �� �ƴϸ�
            else //WSI TYPE
            {
               continue;
            }
@@ -1894,13 +2139,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;
@@ -1913,7 +2158,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;
@@ -1922,7 +2167,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;
               }
@@ -1976,7 +2221,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)
@@ -2028,7 +2272,7 @@
            }
            else //WSI TYPE �� �ƴϸ�
            else //WSI TYPE
            {
               continue;
            }
@@ -2043,7 +2287,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);
@@ -2096,7 +2340,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;
            }
@@ -2107,7 +2351,6 @@
      }
      
#pragma region CELLJUDGE
   //CELL ������////////////////////////////////////////////////////////////////
   int nCellCount = pRawData->GetGlassData()->m_nCellNum;
@@ -2126,7 +2369,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;
@@ -2170,7 +2413,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:
@@ -2220,7 +2463,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:
@@ -2384,7 +2627,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;
@@ -2432,7 +2675,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:
@@ -2482,7 +2725,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:
@@ -2670,7 +2913,7 @@
      CakFileUtil akFileFinder;
      while (nReTryTime--)
      {
         //#3359_LYW CF AOI Review REVIEW_LOADING_COMPLETE_TIMEOVER �˶� �߻� ���� �м� START
         //#3359_LYW CF AOI Review REVIEW_LOADING_COMPLETE_TIMEOVER START
         if (nReTryTime%2 == 0)
         {
            strFilePath = AOIRAWBIN_PATH;
@@ -2679,9 +2922,9 @@
         strWild.Format("%s\\%s_*.bin", strFilePath, strFileName);
          akFileFinder.FindFile(strWild.GetBuffer(0), FALSE);
         //LYW LOG�߰�
         //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
         //#3359_LYW CF AOI Review REVIEW_LOADING_COMPLETE_TIMEOVER END
         VECFINDDATA* pFindData = akFileFinder.getFindData();
         int nFileNamePos = strlen(akFileFinder.getProcessPath());
         std::map<LONGLONG, CString> mapSpanFileName;
@@ -2693,7 +2936,7 @@
               parser.process(pFileName, "_.");
               if (parser.getTokNum() < 4) continue;
               
               if (parser.getTokNum() >= 6) continue; // 0401 �߰�
               if (parser.getTokNum() >= 6) continue; // 0401
               int nDataTime[8] = {};
               {
@@ -2721,7 +2964,6 @@
         {
            if (mapSpanFileName.begin()->first < nCloseTime)
            {
               //���� �ֱ� ������� ã�� ���� [������ 2019/7/17]
               strFindFile = mapSpanFileName.begin()->second;
               break;
            }
@@ -2781,7 +3023,7 @@
   int nPCControlReadDataCount = pSignalInfo->GetReadDataAddressCount();
   // [2017:1:9]-[WEZASW] : PCControl GlassData �׸� ������.
   // [2017:1:9]-[WEZASW] : PCControl GlassData
   if(pSignalInfo->GetUseContinuousReadAddress())
   {
      CString strReadAddress = _T("");
@@ -3160,11 +3402,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)
   {
@@ -3233,80 +3475,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();
@@ -3352,7 +3603,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"));
}
@@ -3360,7 +3611,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;
@@ -3405,11 +3656,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;
@@ -3432,21 +3683,23 @@
      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());
         //< SWK 20221226 - #4403 MOD >
//         strImagePath.Format(_T("%s\\%s_%04d%02d%02d%02d%02d%02d"), strGlassID, tmServerLoadingTime.GetYear(), tmServerLoadingTime.GetMonth(), tmServerLoadingTime.GetDay(), tmServerLoadingTime.GetHour(), tmServerLoadingTime.GetMinute(), tmServerLoadingTime.GetSecond());
         strImagePath.Format(_T("%s_%04d%02d%02d%02d%02d%02d"), strGlassID, tmServerLoadingTime.GetYear(), tmServerLoadingTime.GetMonth(), tmServerLoadingTime.GetDay(), tmServerLoadingTime.GetHour(), tmServerLoadingTime.GetMinute(), tmServerLoadingTime.GetSecond());
         CreateDirectory(strPath, NULL);
         pReviewProcessor->SetUploadImagePath(strPath);
         pReviewProcessor->SetReviewImagePath(strImagePath);
      }
   }
   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;
@@ -3458,8 +3711,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
@@ -3526,14 +3783,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;
@@ -3549,20 +3804,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)
@@ -3571,7 +3822,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);
@@ -3580,34 +3830,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;
@@ -3617,6 +3861,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
@@ -3627,29 +3877,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;
         
         
@@ -3657,10 +3902,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();
@@ -3669,8 +3912,6 @@
            {
               if (AlignLightinfo->GetMaster()==1&& nAlignCameraIdx==1)
               {
                  //����� ��Ʋ�ѷ��� �ϳ��� ����Ǿ� ������ ������ ���η� Ȯ��
                  //������ �̰� �´��� �𸣰ٴ� �ƹ��� �Ⱦ˷���
                  pLightControl = m_pSP2P->ISP2P_GetAlignLightControl(0);
               }
@@ -3704,8 +3945,6 @@
            }
         }
         
         // ����� ī�޶� ���� ��������
         const CAlignCameraInfo *pCameraInfo   = m_pSP2P->ISP2P_System_GetAlignCameraInfo(nAlignCameraIdx);
         if (pCameraInfo)
         {
@@ -3733,7 +3972,6 @@
            }
         }
         // ����� ���ø� ���� ��������
         if((int)pGlassTypeInfo->m_vecTemplateImagePath.size() == nAlignCameraInfoCount)
         {
            pGlassResult->m_AlignRecipe.strTemplateName[nAlignCameraIdx] = pGlassTypeInfo->m_vecTemplateImagePath[nAlignCameraIdx];
@@ -3762,14 +4000,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);
            }
@@ -3781,7 +4018,6 @@
      }
   }
   // ���� ã�� ������ ����
   CReviewProcessor* pReviewProcessor = m_pSP2P->ISP2P_GetReviewProcessor();
   const CRsRcpDefectFindInfo* pRsRcpDefectFindInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpDefectFindInfo();
   if(pReviewProcessor && pRsRcpDefectFindInfo)
@@ -3832,7 +4068,6 @@
   CString strRawTDPath=_T(""), strRawCDPath=_T(""), strRawSDPath=_T("");
   // ������� �̸� ã��
   FindAOIRawFilePath(pGlassResult, &strRawTDPath, &strRawCDPath, &strRawSDPath);
   bRet = m_pSP2P->ISP2P_ReadAOIRawFileToGlassResult(strRawTDPath);
@@ -3886,7 +4121,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('.');      
@@ -4064,7 +4299,6 @@
      CModuleStatus*               pModuleStatus   = Module_GetModuleStatus(nModuleIdx);      
      if (pModuleStatus == NULL) continue;
      //�浹�Ÿ� �ֱ�
      {
      double dCollisionPosX = pReviewResult->GetCollisionPositionX() / 1000.0;
@@ -4100,18 +4334,19 @@
      {
         int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex());
         g_pLog->DisplayMessage(_T("[Collision Position Set Fail] %d Module, Addr: %d, PosX: %.3lfmm"), nModuleIdx, XAddr, dCollisionPosX);
         return 0;
         /*< LYW 20220610 - #4185 Delete Start >*/
         //return 0;
         /*< LYW 20220610 - #4185 Delete End >*/
      }
      }
      //�¿� ��Ʈ�� �����̵�
      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
@@ -4121,7 +4356,7 @@
         SReviewResult* pReview = pReviewResult->GetSReviewResult(nResultIdx);
         if (pReview==NULL) continue;
         //200�� ��巹���� ������ �Ϸ�������� �ߺ�üũ
         //200
         if (pReview->bCheckSendToMotor == FALSE)
         {
            pReview->bCheckSendToMotor = TRUE;
@@ -4141,6 +4376,7 @@
         // set offset
         ApplyMotorOffset(pReview->nModuleIdx, pReview->nZoomIdx, MotorOffsetCamera + MotorOffsetMag+MotorOffset_Glass, dDefectPosX, dDefectPosY);
      
         m_pSP2P->CalcMotorOffSetValue(pReview->nModuleIdx, dDefectPosX, dDefectPosY);      //< KEJ 20230622 - #4526 ADD >
         //xpostemp = dDefectPosX;
         //ypostemp = dDefectPosY;
@@ -4168,7 +4404,6 @@
         }
      }
      //���� ����Ʈ�� �ִ��� ������ üũ
      if (vectorPosX.empty() ==TRUE)
      {
         g_pLog->DisplayMessage(_T("[GantryAutoGo] No Exist Send Point "), vectorPosX.size());
@@ -4200,13 +4435,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))
@@ -4225,15 +4458,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();
@@ -4307,7 +4537,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);
@@ -4370,7 +4600,6 @@
      CModuleStatus*               pModuleStatus = Module_GetModuleStatus(nModuleIdx);
      if (pModuleStatus == NULL) continue;
      //�浹�Ÿ� �ֱ�
      {
         double dCollisionPosX = pReviewResult->GetCollisionPositionX() / 1000.0;
@@ -4406,16 +4635,18 @@
         {
            int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex());
            g_pLog->DisplayMessage(_T("[Collision Position Set Fail] %d Module, Addr: %d, PosX: %.3lfmm"), nModuleIdx, XAddr, dCollisionPosX);
            return 0;
            /*< LYW 20220610 - #4185 Delete Start >*/
            //return 0;
            /*< LYW 20220610 - #4185 Delete End >*/
         }
      }
      // 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;
@@ -4426,7 +4657,7 @@
         SReviewResult* pReview = pReviewResult->GetSReviewResult(nResultIdx);
         if (pReview == NULL) continue;
         //200�� ��巹���� ������ �Ϸ�������� �ߺ�üũ
         //200
         if (pReview->bCheckSendToMotor == FALSE)
         {
            pReview->bCheckSendToMotor = TRUE;
@@ -4446,6 +4677,7 @@
         // set offset
         ApplyMotorOffset(pReview->nModuleIdx, pReview->nZoomIdx, MotorOffsetCamera + MotorOffsetMag + MotorOffset_Glass, dDefectPosX, dDefectPosY);
         m_pSP2P->CalcMotorOffSetValue(pReview->nModuleIdx, dDefectPosX, dDefectPosY);      //< KEJ 20230622 - #4526 ADD >
         //xpostemp = dDefectPosX;
         //ypostemp = dDefectPosY;
@@ -4474,7 +4706,6 @@
         }
      }
      //���� ����Ʈ�� �ִ��� ������ üũ
      if (vectorPosX.empty() == TRUE)
      {
         g_pLog->DisplayMessage(_T("[GantryAutoGo] No Exist Send Point "), vectorPosX.size());
@@ -4530,6 +4761,16 @@
   SetWsiType(0);
   WSIAllReadySignal(1);
   Sleep(1000);
   /*< LYW 20211028 - #3718 ADD Start >*/
   // WSI Redeay 송신후 Review TimeOver 1회 추가 체크
   if (GetProcessStatus() == ProcessReviewEnd_CPJT || GetProcessStatus() == ProcessReviewUnloding_CPJT)
   {
      g_pLog->DisplayMessage(_T("[ProcessStop] WSI StartProcessing Sequence Stop Status : %d"), GetProcessStatus());
      return TRUE;
   }
   /*< LYW 20211028 - #3718 ADD End >*/
   if(!WSIAllStartSignal())
   {
      g_pLog->DisplayMessage(_T("[WSI] WSI Start Fail!!"));
@@ -4539,7 +4780,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);
@@ -4552,7 +4793,7 @@
      MakeWSIUpLoadDirectory(pReviewProcessor->GetUploadImagePath());
      //20190219 chm 
      pReviewProcessor->SetReviewCount(0);         // ���� Sequence No �ʱ�ȭ.
      pReviewProcessor->SetReviewCount(0);
      return TRUE;
   }   
@@ -4565,7 +4806,7 @@
   strPath  = strPath + _T("\\WSI");
   if(CreateDirectory(strPath,NULL)==FALSE)
   {
      //LYW LOG�߰�
      //LYW LOG
      g_pLog->DisplayMessage(_T("[MakeWSIUpLoadDirectory]Directory Create Fail %s, ERROR CODE = %d "),strPath, GetLastError());
   }
   
@@ -4606,7 +4847,7 @@
   VectorDouble vectorCollisionPosX;
   vectorCollisionPosX.clear();
   //WSI �¿� ��Ʈ�� �����̵�
   //WSI
   pMotorControl->GantrySetTwoGantrySyncModeSend(1);
   
   // WSI result count
@@ -4619,7 +4860,6 @@
      CModuleStatus*               pModuleStatus = Module_GetModuleStatus(nModuleIdx);
      if (pModuleStatus == NULL) continue;
      //�浹�Ÿ� �ֱ�
      {
         double dCollisionPosX = pWsiResult->GetCollisionPositionX() / 1000.0;
         double dCollisionPosY = 0.0;
@@ -4651,7 +4891,9 @@
         {
            int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex());
            g_pLog->DisplayMessage(_T("[Collision Position Set Fail] %d Module, Addr: %d, PosX: %.3lfmm"), nModuleIdx, XAddr, dCollisionPosX);
            return 0;
            /*< LYW 20220610 - #4185 Delete Start >*/
            //return 0;
            /*< LYW 20220610 - #4185 Delete End >*/
         }
      }
@@ -4660,7 +4902,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;
@@ -4672,7 +4914,7 @@
         SReviewResult* pWsi = pWsiResult->GetSReviewResult(nResultIdx);
         if (pWsi == NULL) continue;
         //200�� ��巹���� ������ �Ϸ�������� �ߺ�üũ
         //200
         if (pWsi->bCheckWSISendToMotor == FALSE)
         {
            pWsi->bCheckWSISendToMotor = TRUE;
@@ -4692,6 +4934,8 @@
         // set offset
         ApplyMotorOffset(pWsi->nModuleIdx, -1, MotorOffsetCamera + MotorOffsetWSI + MotorOffset_Glass, dDefectPosX, dDefectPosY);
         m_pSP2P->CalcMotorOffSetValue(pWsi->nModuleIdx, dDefectPosX, dDefectPosY);      //< KEJ 20230622 - #4526 ADD >
         m_pSP2P->GetOffSetValue(nModuleIdx, pWsi->nAOICameraIdx, pWsi->nAOIScanIdx, pWsi->nUMOriginX / 1000.0, xpostemp, ypostemp);
@@ -4719,14 +4963,13 @@
         }
      }
      //���� ����Ʈ�� �ִ��� ������ üũ
      if (vectorPosX.empty() == TRUE)
      {
         //3360 LYW_ CF AOI QD Review WSI XY MotorMoving Error �˶� �߻� ���� �м� �� ��ġ START
         //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
         //3360 LYW_ CF AOI QD Review WSI XY MotorMoving Error END
      }
      else
      {
@@ -4750,13 +4993,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))
@@ -4775,15 +5017,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();
@@ -4918,9 +5157,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;
@@ -5022,7 +5261,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);
@@ -5097,7 +5336,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;
@@ -5203,7 +5442,6 @@
   int nTotalCount = 0;
   double dDefectPosX, dDefectPosY;
   // Module�� ��ġ�� ���� ModuleStatus sorting
   std::vector<CModuleStatus*> SortedModuleStatus;
   for(int nModuleIdx = 0; nModuleIdx < m_pSP2P->ISP2P_GetModuleStatusCount(); nModuleIdx++)
   {
@@ -5257,7 +5495,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;
@@ -5278,7 +5516,6 @@
            if(nHeaderIdx == 0)
            {
               // �̵��� ������ǥ �߰�
               if((int)vectorPos.size() < MAX_MOTOR_ADDRESS_SIZE)
               {
                  pSReviewResult->dTargetMotorX = dDefectPosX;
@@ -6545,8 +6782,6 @@
         // add user schedule result
         
         //�����޸𸮿� ä���� ������ ������ ���� ��ǥ�� ����ü�� ä���ִ� ���
         {
@@ -7261,7 +7496,6 @@
            break;
         }
         break;
      // �̻��
      case CPJT_PlanMeasure:
         {
            const CRcpMeasureInfo *pRcpMeasureInfo = pRsRcpMeasureInfo->GetRcpMeasureInfo(0);
@@ -7394,7 +7628,7 @@
}
//CIM DV Data
BOOL CSequenceProcessor_CPJT::SendDVDataToSignalControl() // ����
BOOL CSequenceProcessor_CPJT::SendDVDataToSignalControl()
{
   CGlassResult *pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult();
   if (pGlassResult==NULL) return FALSE;
@@ -7419,7 +7653,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."));
@@ -7428,16 +7662,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();
@@ -7459,12 +7693,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
   ///////////////////////////////////////////////////////////////////////////
@@ -7502,8 +7736,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;
@@ -7511,8 +7750,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];
@@ -7530,7 +7769,6 @@
      nAlignResult01 = 0;
   }
   //�Ŀ�?
   nReviewAliveCamera00 = ReviewCamera_GetReviewCameraControl(0)->GetConnected() * 1000;
   nReviewAliveCamera01 = ReviewCamera_GetReviewCameraControl(1)->GetConnected() * 1000;
@@ -7547,8 +7785,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) {
@@ -7593,6 +7830,9 @@
   pSignalControl->WritePacketData(_T("16136"), sizeof(nReviewVersion), (short*)&nReviewVersion);
   pSignalControl->WritePacketData(_T("16140"), sizeof(nWSI00Version), (short*)&nWSI00Version);
   pSignalControl->WritePacketData(_T("16144"), sizeof(nWSI01Version), (short*)&nWSI01Version);
   /*< LYW 20220415 - #4086 ADD Start >*/ //추가 필요
   /*< LYW 20220415 - #4086 ADD End >*/
   //CCHImageData pImageData;
@@ -7762,7 +8002,7 @@
   pSignalControl->WritePacketData(_T("15100"), sizeof(DVDataPack_CPJT), (short*)&DVData);*/
}
//#3358 KYH FDC ������ ���� ���� ���� ADD START
//#3358 KYH FDC ADD START
void CSequenceProcessor_CPJT::MakeDVData2()
{
@@ -7775,9 +8015,9 @@
   }
   else
   {
   // Review ���� ����
   // Review
      pReviewLightInfo = pRsRcpReviewInfo->GetRcpLightInfo(0);
   // Review AFM ����
   // Review AFM
      pReviewAFMInfo = pRsRcpReviewInfo->GetRcpAFMRecipeInfo(0);
   }
@@ -7801,7 +8041,7 @@
   // Review ���� ����
   // Review
   const CModuleStatus* pModuleStatus = Module_GetModuleStatus(0);
   const SMagnificInfo* pSMagnificInfo = NULL;
   if (pModuleStatus == NULL)
@@ -7869,31 +8109,56 @@
   int nWSI01Version = 20210422;
   int nReviewAliveCamera00 = 1000;
   int nReviewAliveCamera01 = 1000;
   /*< LYW 20220415 - #4086 ADD Start >*/
   int   nFDCGRMSWVersion = 20200101;
   int   nFDCFTPUploaderSWVersion = 20200101;
   int   nFDCSyncSWVersion = 20200101;
   int   nFDCReviewSWVersion = 20200101;
   int   nFDCWSISWVersion00 = 20200101;
   int   nFDCWSISWVersion01 = 20200101;
   /*< LYW 20220415 - #4086 ADD End >*/
   //foucs 
   /*< LYW 20211109 - #3662 MOD Start >*/
   if (m_pSP2P != NULL)
   {
      if (m_pSP2P->ISP2P_GetCurrentGlassResult() != NULL)
      {
         nRev_Cam1_Image_Contrast = m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast * 1000;
         nRev_Cam2_Image_Contrast = m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview01ImageContrast * 1000;
      nRev_Cam1_Image_Contrast = m_pSP2P->ISP2P_GetReview00ImageContrast() * 1000;
      nRev_Cam2_Image_Contrast = m_pSP2P->ISP2P_GetReview01ImageContrast() * 1000;
         if (m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast <=-2 || m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast >=999)
         {
            nRev_Cam1_Image_Contrast = 0 * 1000;
         }
         if (m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast <=-2|| m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast >=999)
         {
            nRev_Cam2_Image_Contrast = 0 * 1000;
         }
      }
      else
      {
         nRev_Cam1_Image_Contrast = 0;
         nRev_Cam2_Image_Contrast = 0;
      }
      /*< LYW 20220415 - #4086 ADD Start >*/
      nFDCGRMSWVersion = m_pSP2P->ISP2P_GetGRMSWVersion();
      nFDCFTPUploaderSWVersion = m_pSP2P->ISP2P_GetFTPUploaderSWVersion();
      nFDCSyncSWVersion = m_pSP2P->ISP2P_GetSyncSWVersion();
      nFDCReviewSWVersion = m_pSP2P->ISP2P_GetReviewSWVersion();
      nFDCWSISWVersion00 = m_pSP2P->ISP2P_GetWSISWVersion(0);
      nFDCWSISWVersion01 = m_pSP2P->ISP2P_GetWSISWVersion(1);
      /*< LYW 20220415 - #4086 ADD End >*/
   }
   /*< LYW 20211109 - #3662 MOD End >*/
   /*< Origin Code >*/
//    if (m_pSP2P != NULL)
//    {
//       if (m_pSP2P->ISP2P_GetCurrentGlassResult() != NULL)
//       {
//
//          nRev_Cam1_Image_Contrast = m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast * 1000;
//          nRev_Cam2_Image_Contrast = m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview01ImageContrast * 1000;
//
//          if (m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast <=-2 || m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast >=999)
//          {
//             nRev_Cam1_Image_Contrast = 0 * 1000;
//          }
//          if (m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast <=-2|| m_pSP2P->ISP2P_GetCurrentGlassResult()->nReview00ImageContrast >=999)
//          {
//             nRev_Cam2_Image_Contrast = 0 * 1000;
//          }
//       }
//       else
//       {
//          nRev_Cam1_Image_Contrast = 0;
//          nRev_Cam2_Image_Contrast = 0;
//       }
//    }
@@ -7903,8 +8168,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];
@@ -7944,7 +8209,6 @@
      nAlignResult01 = 1000;
   }
   //�Ŀ�?
   if (ReviewCamera_GetReviewCameraControl(0) != NULL)
   {
      nReviewAliveCamera00 = ReviewCamera_GetReviewCameraControl(0)->GetConnected() * 1000;
@@ -7976,8 +8240,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) {
@@ -8013,18 +8276,168 @@
   pSignalControl->WritePacketData(_T("16116"), sizeof(nRev_Cam1_Image_Contrast), (short*)&nRev_Cam1_Image_Contrast);
   pSignalControl->WritePacketData(_T("16120"), sizeof(nRev_Cam2_Image_Contrast), (short*)&nRev_Cam2_Image_Contrast);
   pSignalControl->WritePacketData(_T("16124"), sizeof(nRev_PC_HDD_CHECK), (short*)&nRev_PC_HDD_CHECK);
   pSignalControl->WritePacketData(_T("16128"), sizeof(nWSI1_PC_HDD_CHECK), (short*)&nWSI1_PC_HDD_CHECK);
   pSignalControl->WritePacketData(_T("16132"), sizeof(nWSI2_PC_HDD_CHECK), (short*)&nWSI2_PC_HDD_CHECK);
   /*< LYW 20220415 - #4086 ADD Start >*/
   pSignalControl->WritePacketData(_T("16124"), sizeof(nFDCSyncSWVersion), (short*)&nFDCSyncSWVersion);
   pSignalControl->WritePacketData(_T("16128"), sizeof(nFDCReviewSWVersion), (short*)&nFDCReviewSWVersion);
   pSignalControl->WritePacketData(_T("16132"), sizeof(nFDCFTPUploaderSWVersion), (short*)&nFDCFTPUploaderSWVersion);
   pSignalControl->WritePacketData(_T("16136"), sizeof(nFDCGRMSWVersion), (short*)&nFDCGRMSWVersion);
   pSignalControl->WritePacketData(_T("16140"), sizeof(nFDCWSISWVersion00), (short*)&nFDCWSISWVersion00);
   pSignalControl->WritePacketData(_T("16144"), sizeof(nFDCWSISWVersion01), (short*)&nFDCWSISWVersion01);
   /*< LYW 20220415 - #4086 ADD End >*/
   pSignalControl->WritePacketData(_T("16136"), sizeof(nReviewVersion), (short*)&nReviewVersion);
   pSignalControl->WritePacketData(_T("16140"), sizeof(nWSI00Version), (short*)&nWSI00Version);
   pSignalControl->WritePacketData(_T("16144"), sizeof(nWSI01Version), (short*)&nWSI01Version);
//    pSignalControl->WritePacketData(_T("16124"), sizeof(nRev_PC_HDD_CHECK), (short*)&nRev_PC_HDD_CHECK);
//    pSignalControl->WritePacketData(_T("16128"), sizeof(nWSI1_PC_HDD_CHECK), (short*)&nWSI1_PC_HDD_CHECK);
//    pSignalControl->WritePacketData(_T("16132"), sizeof(nWSI2_PC_HDD_CHECK), (short*)&nWSI2_PC_HDD_CHECK);
//
//    pSignalControl->WritePacketData(_T("16136"), sizeof(nReviewVersion), (short*)&nReviewVersion);
//    pSignalControl->WritePacketData(_T("16140"), sizeof(nWSI00Version), (short*)&nWSI00Version);
//    pSignalControl->WritePacketData(_T("16144"), sizeof(nWSI01Version), (short*)&nWSI01Version);
   return;
}
//#3358 KYH FDC ������ ���� ���� ���� ADD END
BOOL CSequenceProcessor_CPJT::CheckZeroReviewAlarm()
{
   CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult();
   if (pGlassResult == NULL) return FALSE;
   int TotalCount = 0;
   //Defect
   const VectorReviewResult *pVecReviewResult = pGlassResult->GetVectorReviewResult();
   if (pVecReviewResult != NULL)
   {
      for (constVectorReviewResultIt it = pVecReviewResult->begin(); it != pVecReviewResult->end(); it++)
      {
         const CReviewResult *pReviewResult = static_cast<const CReviewResult*>(&(*it));
         TotalCount += pReviewResult->m_vecSReviewResult.size();
         for (constVectorSReviewResultIt its = pReviewResult->m_vecSReviewResult.begin(); its != pReviewResult->m_vecSReviewResult.end(); its++)
         {
            if (its->nResultCode > ReviewResult_None)
            {
               return TRUE;
            }
            else
            {
               continue;
            }
         }
      }
   }
   //DefectWSI
   const VectorReviewResult *pVecWsiResult = pGlassResult->GetVectorWsiResult();
   if (pVecWsiResult != NULL)
   {
      for (constVectorReviewResultIt it = pVecWsiResult->begin(); it != pVecWsiResult->end(); it++)
      {
         const CReviewResult *pWsiResult = static_cast<const CReviewResult*>(&(*it));
         TotalCount += pWsiResult->m_vecSReviewResult.size();
         for (constVectorSReviewResultIt its = pWsiResult->m_vecSReviewResult.begin(); its != pWsiResult->m_vecSReviewResult.end(); its++)
         {
            if (its->nResultCode > WsiResult_None)
            {
               return TRUE;
            }
            else
            {
               continue;
            }
         }
      }
   }
   //User Review
   const VectorReviewResult *pVecUserReviewResult = pGlassResult->GetVectorUserResult();
   if (pVecUserReviewResult != NULL)
   {
      for (constVectorReviewResultIt it = pVecUserReviewResult->begin(); it != pVecUserReviewResult->end(); it++)
      {
         const CReviewResult *pUserReviewResult = static_cast<const CReviewResult*>(&(*it));
         TotalCount += pUserReviewResult->m_vecSReviewResult.size();
         for (constVectorSReviewResultIt its = pUserReviewResult->m_vecSReviewResult.begin(); its != pUserReviewResult->m_vecSReviewResult.end(); its++)
         {
            if (its->nResultCode > ReviewResult_None)
            {
               return TRUE;
            }
            else
            {
               continue;
            }
         }
      }
   }
   //User WSI
   const VectorReviewResult *pVecUserWsiResult = pGlassResult->GetVectorUserWsiResult();
   if (pVecUserWsiResult != NULL)
   {
      for (constVectorReviewResultIt it = pVecUserWsiResult->begin(); it != pVecUserWsiResult->end(); it++)
      {
         const CReviewResult *pUserWsiResult = static_cast<const CReviewResult*>(&(*it));
         TotalCount += pUserWsiResult->m_vecSReviewResult.size();
         for (constVectorSReviewResultIt its = pUserWsiResult->m_vecSReviewResult.begin(); its != pUserWsiResult->m_vecSReviewResult.end(); its++)
         {
            if (its->nResultCode > WsiResult_None)
            {
               return TRUE;
            }
            else
            {
               continue;
            }
         }
      }
   }
   if (TotalCount == 0) return TRUE;
   return FALSE;
}
void CSequenceProcessor_CPJT::sendUploadResult2SequenceProcessor(int UploadResult)
{
   int UploadResultFailCount = GetUploadResultFailCount();
   if (UploadResult == FALSE)
   {
      UploadResultFailCount++;
      m_pSP2P->ISP2P_DisplayMessage(_T("Upload Ack is False"));
      if (UploadResultFailCount >= 3)
      {
         //SendSignalToSignalControl(PCControlSendSignalIndex_State, PCControlSend_ResultData_Upload_Fail, 1000);
         m_nStackUploadFailGlassCount++;
         m_pSP2P->ISP2P_DisplayMessage(_T("ResultFile Upload Fail Glass Count = %d"),m_nStackUploadFailGlassCount);
         if (m_nStackUploadFailGlassCount >= m_pSP2P->ISP2P_System_GetNetworkInfo()->m_nResultFileUploadFailAlarmCondition)
         {
            SendSignalToSignalControl(PCControlSendSignalIndex_State, PCControlSend_ResultData_Upload_Fail, 1000);
            m_nStackUploadFailGlassCount = 0;
            m_pSP2P->ISP2P_DisplayMessage(_T("ResultFile Upload Fail Alarm!"));
         }
         SetUploadResultFailCount(-1);
      }
      else
      {
         SetUploadResultFailCount(UploadResultFailCount);
      }
   }
   else
   {
      m_pSP2P->ISP2P_DisplayMessage(_T("Upload Ack is True"));
      m_nStackUploadFailGlassCount = 0;
   }
}
//#3358 KYH FDC  ADD END
DWORD CSequenceProcessor_CPJT::GetDiskUsage()
{
@@ -8062,7 +8475,7 @@
   BOOL bResult = FALSE;
   // PCControl D2300 (�˻� ����)
   // PCControl D2300
   switch(nSignalIndex)
   {
   case PCControlRecv_TimeChange:
@@ -8128,7 +8541,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()"));
@@ -8155,7 +8568,7 @@
   return TRUE;
}
// Local System ���� �ð��� ���� ��û ��Ʈ�ѷ��� �ð��� ó�� ����
// Local System
BOOL CSequenceProcessor_CPJT::SendSystemTime(SYSTEMTIME sysTime)
{
   SYSTEMTIME CurrentTime;
@@ -8302,7 +8715,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;
         }
@@ -8354,8 +8767,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;
         }
      }
@@ -8413,7 +8826,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;
         }
@@ -8513,6 +8926,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!"));
      }
@@ -8520,14 +8934,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();
@@ -8698,10 +9114,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);
@@ -8716,14 +9132,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);
@@ -8922,7 +9345,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();
@@ -8936,13 +9358,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;
@@ -8967,7 +9387,6 @@
   // set last result idx
   pWsiMultiShotResult->SetLastSReviewResultIndex(nCurResultIdx);
   // ������ ����Ʈ���� �԰�, WSI ����� ���� ������...
   if (nCurResultIdx == nEndResultIdx && nCurResultIdx <= pWsiMultiShotResult->GetSReviewResultCount())
   {
      nStartResultIdx = nCurResultIdx + 1;
@@ -8978,8 +9397,7 @@
      pWsiMultiShotResult->SetStartSReviewResultIndex(nStartResultIdx);
      pWsiMultiShotResult->SetEndSReviewResultIndex(nEndResultIdx);
      // ������ ����Ʈ ���� ��������.
      ::Sleep(3000); // ����̴� �ʼ���. ������ ���� ����.
      ::Sleep(3000);
   //   Process_RemainWsiPoint(nModuleIndex);
   }
@@ -9045,7 +9463,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);
@@ -9068,7 +9486,7 @@
   AFM_SetAFMTracking(FALSE);
   SetWsiType(0);
   WSIAllReadySignal(0);
   WSIAllReadySignal(1);
   
   // send wsi start
   if(!WSIUserAllStartSignal())
@@ -9081,7 +9499,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);
@@ -9108,7 +9526,6 @@
   WSIAllReadySignal(1);
   // send wsi start
   // ���� ����
   if (!WSIMultiShotAllStartSignal())
   {
      g_pLog->DisplayMessage(_T("[WSI] WSI MultiShot Start Fail!!"));
@@ -9119,7 +9536,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);
@@ -9182,7 +9599,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;
@@ -9300,7 +9717,8 @@
   VectorDouble vectorCollisionPosX;
   vectorCollisionPosX.clear();
   //WSI
   pMotorControl->GantrySetTwoGantrySyncModeSend(1);
   // WSI result count
   for (int nModuleIdx=0; nModuleIdx<Module_GetModuleStatusCount(); nModuleIdx++)
@@ -9312,7 +9730,6 @@
      CModuleStatus*               pModuleStatus   = Module_GetModuleStatus(nModuleIdx);      
      if (pModuleStatus == NULL) continue;
      //�浹�Ÿ� �ֱ�
      {
         double dCollisionPosX = pWsiUserResult->GetCollisionPositionX() / 1000.0;
         double dCollisionPosY = 0.0;
@@ -9345,7 +9762,9 @@
         {
            int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex());
            g_pLog->DisplayMessage(_T("[Collision Position Set Fail] %d Module, Addr: %d, PosX: %.3lfmm"), nModuleIdx, XAddr, dCollisionPosX);
            return 0;
            /*< LYW 20220610 - #4185 Delete Start >*/
            //return 0;
            /*< LYW 20220610 - #4185 Delete End >*/
         }
      }
@@ -9355,7 +9774,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;
@@ -9388,6 +9807,15 @@
            vectorPosX.push_back(dDefectPosX);
            vectorPosY.push_back(dDefectPosY);            
         }
      }
      if (vectorPosX.empty() == TRUE)
      {
         //3360 LYW_ CF AOI QD Review WSI XY MotorMoving Error START
         g_pLog->DisplayMessage(_T("[GantryAutoGo] No Exist Send Point,TwoGantrySyncMode OFF!"), vectorPosX.size());
         g_pLog->DisplayMessage(_T("[GantryAutoGo] (%d)Gantry Path Send Fail"), pModuleStatus->GetGantryIndex()); //taek 210128
         pMotorControl->GantrySetTwoGantrySyncModeSend(0);
         //3360 LYW_ CF AOI QD Review WSI XY MotorMoving Error END
      }
      if (m_pSP2P->ISP2P_GetReviewProcessor()->CheckMotionComplete() == FALSE)
@@ -9458,17 +9886,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;
@@ -9737,8 +10161,6 @@
      CModuleStatus*               pModuleStatus = Module_GetModuleStatus(nModuleIdx);
      if (pModuleStatus == NULL) continue;
      //�浹�Ÿ� �ֱ�
      {
         double dCollisionPosX = pWsiMultiShotResult->GetCollisionPositionX() / 1000.0;
@@ -9753,20 +10175,22 @@
            int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex());
            g_pLog->DisplayMessage(_T("[Review_CollisionPos] %d Module, Addr: %d, PosX: %.3lf mm"), nModuleIdx, XAddr, dCollisionPosX);
            ///pGlassResult->SetCollisionXPos(nModuleIdx, dCollisionPosX);
            //pGlassResult->SetCollisionXPos(nModuleIdx, dCollisionPosX);
         }
         else
         {
            int XAddr = pMotorControl->GetGantryCollisionXAddr(pModuleStatus->GetGantryIndex());
            g_pLog->DisplayMessage(_T("[Collision Position Set Fail] %d Module, Addr: %d, PosX: %.3lfmm"), nModuleIdx, XAddr, dCollisionPosX);
            return 0;
            /*< LYW 20220610 - #4185 Delete Start >*/
            //return 0;
            /*< LYW 20220610 - #4185 Delete End >*/
         }
         // get result index
         int nStartIdx = pWsiMultiShotResult->GetStartSReviewResultIndex();
         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;
@@ -10207,7 +10631,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;
   
@@ -10258,6 +10682,30 @@
   }   
}
/*< LYW 20220610 - #4185 ADD Start >*/
void CSequenceProcessor_CPJT::CheckGantryMode()
{
   CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl();
   if (pSignalControl == NULL) m_pSP2P->ISP2P_DisplayMessage(_T("[CheckGantryMode] SignalControl is NULL"));
   if (pSignalControl->IsConnected() == FALSE) m_pSP2P->ISP2P_DisplayMessage(_T("[CheckGantryMode] SignalControl is Not Connect"));
   int LeftGantryUse = 0;
   int RightGantryUse = 0;
   pSignalControl->ReadData(_T("10003"), 1, 1, LeftGantryUse);
   pSignalControl->ReadData(_T("10003"), 2, 1, RightGantryUse);
   if (LeftGantryUse == 1 && RightGantryUse == 0)
      m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->SetSingleGantryPath(1);
   else if (LeftGantryUse == 0 && RightGantryUse == 1)
      m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->SetSingleGantryPath(2);
   else
      m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo()->GetRcpSchedulingInfo()->SetSingleGantryPath(0);
   m_pSP2P->ISP2P_DisplayMessage(_T("[CheckGantryMode] GantryMode LeftBit = %d, RightBit = %d"), LeftGantryUse, RightGantryUse);
}
/*< LYW 20220610 - #4185 ADD End >*/
BOOL CSequenceProcessor_CPJT::UpdateMemoryUserReflowPlanInfo(CDitGlassRawClient* pDitSharedGlassRaw)
{
   CRsRcpReviewInfo* pRecipeinfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo();
@@ -10266,18 +10714,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;
@@ -10341,7 +10789,7 @@
BOOL CSequenceProcessor_CPJT::CompareRevType(int nInsType,int nRevType)
{
   //Plan Ÿ�԰� InspectionMode ��
   //Plan InspectionMode
   if(nRevType == CPJT_PlanUser)
   {
     if(nInsType == USER) return TRUE;
@@ -10399,7 +10847,7 @@
   CString strMessage, strResultFilePath, strUploadResultFilePath, strLocalRawPath;
   CString   strUploadRawPath, strUploadImagePath, strAOIRawFileName, strAOIRawFilePath;
   //3-1. ���� ��� ���� ����
   //3-1.
   m_pSP2P->ISP2P_SetReviewResultData(pGlassResult);
   strLocalRawPath      = pNetworkInfo->m_strLocalRawPath;
@@ -10426,7 +10874,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))
@@ -10447,9 +10895,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!"));         
@@ -10469,8 +10917,6 @@
BOOL CSequenceProcessor_CPJT::MoveReviewStartMotorPosition(CGlassResult* pGlassResult,int nReviewType)
{
   //Ȥ�ó� ���ϱ�� ���ܵ�
   //���� �÷��� ù��° ��ġ�� �̵�
   
   double dDefectPosX,dDefectPosY = 0;
   
@@ -10534,7 +10980,7 @@
void CSequenceProcessor_CPJT::SendWsiErrorAlarm_CPJT(int Index) //190801 chm
{   
   //wsi ���� �˶�
   //wsi
   if(Index==1)
   {
      g_pLog->DisplayMessage(_T("[SequenceProcessor_CPJT] WSI Alive Error!!!"));
@@ -10548,7 +10994,7 @@
void CSequenceProcessor_CPJT::SendWsiAlive_CPJT()//190801 chm
{
   //WSI Alive ��ȣ ����
   //WSI Alive
   SetWSIAliveCheck(TRUE);
}
@@ -10574,7 +11020,7 @@
         if(bWsiAliveCheck ==FALSE){
            m_pCSPC->SendWsiErrorAlarm_CPJT(1);
         }
         bWsiAliveCheck=FALSE; //30�ʿ� �ѹ��� 0���� �ʱ�ȭ
         bWsiAliveCheck=FALSE;
      }
   }