From 3ce48f6dbeb537e252edb0d62c88a28796e36674 Mon Sep 17 00:00:00 2001 From: SWK <sungwk82@diteam.co.kr> Date: 월, 26 12월 2022 15:04:42 +0900 Subject: [PATCH] ongoing60 #4403 CF AOI Review TACT 지연 개선 1. 신호 출력 방식 재개선 - 유지 시간이 없는 신호는 바로 출력 진행하도록 변경 2. 불필요 Delay 제거 및 시퀀스 변경 - 얼라인 측정 종료 처리 간 제어 신호 먼저 출력 후 카메라 Stop으로 변경 - 물류 정보 읽기 처리 후 1000ms Delay 삭제 - 얼라인 측정 시작(카메라 Live Start) 후 Delay 300ms -> 100ms(이미지 들어오는 시간 확보 필요) - ReadRawFile 처리 시작 전 500ms Delay 삭제 - Path Scheduling 완료 후 Review Ready 신호 출력 전 1000ms Delay 삭제 3. 버그 수정 - 이미지 저장 경로 생성 간 예외 처리 부분 버그 수정 4. 로그 시간 출력 불합리 개선 - 로그 시간이 파일 출력 시점으로 작성되어 로그 스래드 지연 시 시간이 맞지 않는 불합리 있음 - 로그 시간은 로그 발생 시점에 시간 저장, 해당 시간 이용하여 파일에 기록하도록 변경 --- ReviewSystem/ReviewSystem/DisplayMessage.cpp | 76 +++++++++++++++++++++++++++++--------- 1 files changed, 58 insertions(+), 18 deletions(-) diff --git a/ReviewSystem/ReviewSystem/DisplayMessage.cpp b/ReviewSystem/ReviewSystem/DisplayMessage.cpp index 2581069..a223f03 100644 --- a/ReviewSystem/ReviewSystem/DisplayMessage.cpp +++ b/ReviewSystem/ReviewSystem/DisplayMessage.cpp @@ -33,7 +33,9 @@ void CDisplayMessage::SetPath(const CString& strPath) { m_strLogPath = strPath; - + CString m_GlobalLogPath; + m_strLogFile.Format(_T("D:\\DIT_LogData\\%04d%02d%02d"), m_strLogPath, m_TimeLogFile.GetYear(), m_TimeLogFile.GetMonth(), m_TimeLogFile.GetDay()); + CreateDirectory(m_strLogFile, NULL); CreateDirectory(m_strLogPath, NULL); MakeLogFile(); @@ -42,6 +44,10 @@ BOOL CDisplayMessage::MakeLogFile() { // Log 泥섎━ + CString m_GlobalLogPath; + m_strLogFile.Format(_T("D:\\DIT_LogData\\%04d%02d%02d"), m_TimeLogFile.GetYear(), m_TimeLogFile.GetMonth(), m_TimeLogFile.GetDay()); + CreateDirectory(m_strLogFile, NULL); + if (m_strLogPath.IsEmpty()) return FALSE; @@ -67,8 +73,14 @@ // { // m_pDM2P->DM2P_DisplayMessage(strMessage); // } - CString* pstrLog = new CString(strMessage); - PostThreadMessage(m_ThreadId, WM_DIPLAY_LOG, reinterpret_cast<WPARAM>(pstrLog), 0); + /*< SWK 20221226 - #4403 MOD Start >*/ +// CString* pstrLog = new CString(strMessage); +// PostThreadMessage(m_ThreadId, WM_DIPLAY_LOG, reinterpret_cast<WPARAM>(pstrLog), 0); + pLogData plogdata = new LogData; + ::GetLocalTime(&plogdata->currentTime); + plogdata->strLog = strMessage; + PostThreadMessage(m_ThreadId, WM_DIPLAY_LOG, reinterpret_cast<WPARAM>(plogdata), 0); + /*< SWK 20221226 - #4403 MOD End >*/ } // #3417 LYWCF AOI Review �쟾�꽕鍮� Log Process媛쒖꽑 ADD END @@ -78,13 +90,26 @@ { va_list list; TCHAR strText[2000] = {0}; + try + { + va_start(list, lpstrFormat); + _vstprintf_s(strText, lpstrFormat, list); + va_end(list); - va_start(list, lpstrFormat); - _vstprintf_s(strText, lpstrFormat, list); - va_end(list); + /*< SWK 20221226 - #4403 MOD Start >*/ +// CString* pstrLog = new CString(strText); +// PostThreadMessage(m_ThreadId, WM_DIPLAY_LOG, reinterpret_cast<WPARAM>(pstrLog), 0); + pLogData plogdata = new LogData; + ::GetLocalTime(&plogdata->currentTime); + plogdata->strLog = strText; + PostThreadMessage(m_ThreadId, WM_DIPLAY_LOG, reinterpret_cast<WPARAM>(plogdata), 0); + /*< SWK 20221226 - #4403 MOD End >*/ + } + catch (...) + { + return; + } - CString* pstrLog = new CString(strText); - PostThreadMessage(m_ThreadId, WM_DIPLAY_LOG, reinterpret_cast<WPARAM>(pstrLog), 0); // WriteToFile(strText); // @@ -96,23 +121,28 @@ // #3417 LYWCF AOI Review �쟾�꽕鍮� Log Process媛쒖꽑 ADD END // #3417 LYWCF AOI Review �쟾�꽕鍮� Log Process媛쒖꽑 ADD START -void CDisplayMessage::ThreadDisplayMessage(const CString& strMessage) +//< SWK 20221226 - #4403 MOD > +//void CDisplayMessage::ThreadDisplayMessage(const CString& strMessage) +void CDisplayMessage::ThreadDisplayMessage(const LogData& logdata) { - WriteToFile(strMessage); + WriteToFile(logdata.currentTime, logdata.strLog); if (m_pDM2P) { - m_pDM2P->DM2P_DisplayMessage(strMessage); + m_pDM2P->DM2P_DisplayMessage(logdata.strLog); } } - -BOOL CDisplayMessage::WriteToFile(const CString& strMessage) +//< SWK 20221226 - #4403 MOD > +//BOOL CDisplayMessage::WriteToFile(const CString& strMessage) +BOOL CDisplayMessage::WriteToFile(const SYSTEMTIME& t, const CString& strMessage) { if(m_pFileLog == NULL) return FALSE; //EnterCriticalSection(&m_csLog); - CTime time = CTime::GetCurrentTime(); + //< SWK 20221226 - #4403 MOD > +// CTime time = CTime::GetCurrentTime(); + CTime time(t); CString strTimeStamp = _T(""); // �궇吏쒓� 諛붾�뚮㈃ �뙆�씪紐낆쓣 媛깆떊�빐�꽌 �벖�떎. if ((time.GetMonth() != m_TimeLogFile.GetMonth()) || (time.GetDay() != m_TimeLogFile.GetDay()) || !m_pFileLog) @@ -124,7 +154,10 @@ TCHAR strCommand = 0xFEFF; CString strLog = _T(""); //strTimeStamp.Format(_T("[%02d:%02d:%02d]"), time.GetHour(), time.GetMinute(), time.GetSecond()); - strTimeStamp.Format(_T("[%02d:%02d:%02d:%02d:%02d:%02d]"), time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond()); + /*< SWK 20221221 - #4403 MOD Start >*/ +// strTimeStamp.Format(_T("[%02d:%02d:%02d_%02d:%02d:%02d]"), time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond()); + strTimeStamp.Format(_T("[%02d:%02d:%02d_%02d:%02d:%02d.%03d]"), time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond(), t.wMilliseconds); + /*< SWK 20221221 - #4403 MOD End >*/ #ifdef UNICODE strLog.Format(_T("%c%s %s\r\n"), strCommand, strTimeStamp, strMessage); #else @@ -141,17 +174,24 @@ return TRUE; } -DWORD RunThreadDisplayLog(LPVOID param) +DWORD CDisplayMessage::RunThreadDisplayLog(LPVOID param) { MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { - CString* pstrLog = reinterpret_cast<CString*>(msg.wParam); + //< SWK 20221226 - #4403 MOD > +// CString* pstrLog = reinterpret_cast<CString*>(msg.wParam); + CDisplayMessage::pLogData plogdata = reinterpret_cast<CDisplayMessage::pLogData>(msg.wParam); switch (msg.message) { case WM_DIPLAY_LOG: - g_pLog->ThreadDisplayMessage(*pstrLog); + /*< SWK 20221226 - #4403 MOD Start >*/ +// g_pLog->ThreadDisplayMessage(*pstrLog); +// delete pstrLog; + g_pLog->ThreadDisplayMessage(*plogdata); + delete plogdata; + /*< SWK 20221226 - #4403 MOD End >*/ break; default: -- Gitblit v1.9.3