From ffe71aadfdcb4a9ea2ac4d8d320983d42ef3cad5 Mon Sep 17 00:00:00 2001
From: LYW <leeyeanwoo@diteam.co.kr>
Date: 화, 14 9월 2021 15:19:39 +0900
Subject: [PATCH] 버그 수정

---
 ReviewHistory/ReveiwHistory/GlassRawCPJT.cpp | 2279 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 2,279 insertions(+), 0 deletions(-)

diff --git a/ReviewHistory/ReveiwHistory/GlassRawCPJT.cpp b/ReviewHistory/ReveiwHistory/GlassRawCPJT.cpp
new file mode 100644
index 0000000..4b6b6bb
--- /dev/null
+++ b/ReviewHistory/ReveiwHistory/GlassRawCPJT.cpp
@@ -0,0 +1,2279 @@
+癤�#include "StdAfx.h"
+#include "GlassRawCPJT.h"
+#include "akLoggerExt.h"
+#include "MacroResultFile.h"
+#include "akCore/akFileUtil.h"
+#include "akGridData.h"
+
+//#include "AOIDefinitionType.h"
+//#include "AOIDefinition.h"
+ 
+#define LOCAL_INDEX_PATH			"D:\\DIT_ResultData\\Index\\"	  
+#define LOCAL_REV_IMAGE_PATH		"D:\\ResultData\\UploadImage\\" 
+#define LOCAL_AOI_IMAGE_PATH		"D:\\Image\\Defect\\" 
+#define LOCAL_MURA_IMAGE_PATH		"D:\\DIT_ResultData\\Mura\\IMG\\" 
+#define LOCAL_DEEP_PATH				"D:\\DIT_ResultData\\Deeplearning\\"
+
+#define LOCAL_RTMS_INFO_PATH		"D:\\RTMS_TEMP\\"
+
+#define LOCAL_RAWPATH_INFO_INI_PATH	"D:\\ResultData\\"
+#define RAWINFO_FILE_NAME			"RESULT_INFO.ini"
+
+#define LOCAL_AOIRAWDFS_PATH		"D:\\DIT_ResultData\\Raw"
+#define LOCAL_AOIRAWBIN_PATH		"D:\\DIT_ResultData\\RawBin"
+#define NETWORK_AOIRAWDFS_PATH		"\\\\126.100.100.1\\d\\DIT_ResultData\\Raw"
+#define NETWORK_AOIRAWBIN_PATH		"\\\\126.100.100.1\\d\\DIT_ResultData\\RawBin"
+
+#define NETWORK_AOIRAWFILE_SUB_PATH "\\\\126.100.100.1\\d\\Raw_im\\"
+#define NETWORK_AOI_IMAGE_PATH		"\\\\126.100.100.1\\d\\Image\\Defect\\" 
+//0404NWH
+#define NETWORK_MURARAW_PATH		"\\\\126.100.100.1\\d\\DIT_ResultData\\Mura\\RAW" //0405nwh
+#define NETWORK_MURA_IMAGE_PATH		"\\\\126.100.100.1\\d\\DIT_ResultData\\Mura\\IMG" //0405nwh
+
+char* g_pCellCode = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+
+void _TimeDelay(int delay)
+{
+	MSG		msg;
+	BOOL	fRst = FALSE;
+
+	clock_t lBlockTime = delay + clock();
+
+	while (lBlockTime > clock())
+	{
+		fRst = (BOOL)PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
+		if (fRst)
+		{
+			TranslateMessage(&msg);
+			DispatchMessage(&msg);
+		}
+		Sleep(10);
+	}
+}
+
+CGlassRawCPJT::CGlassRawCPJT(void)
+{
+	CreateDirectory("D:\\RTMS_Signal", NULL);
+	CreateDirectory(LOCAL_AOIRAWDFS_PATH, NULL);
+	CreateDirectory(LOCAL_AOIRAWBIN_PATH, NULL);
+	CreateDirectory("D:\\Raw_im", NULL);
+	m_MuraResultFile.readOptionFile("C:\\DIT_Review\\ReviewServerConfig\\MacroInfo.cfg");
+
+	m_GlassRawRTMS.SetMuraResult(&m_MuraResultFile);
+	m_nWriteRawDefectIdx = 1;
+	m_bReviewEndCheck = FALSE;
+}
+
+CGlassRawCPJT::~CGlassRawCPJT(void)
+{
+}
+
+BOOL CGlassRawCPJT::SequenceGlassLoading( CgrmGlassRawData* pData )
+{
+	//�뒪�깮湲곕뒫
+	if(m_StackResult.getStackUse())
+	{
+		//201218 CJH - Stack Download �떆�룄
+		SendMessageFTPDownloadStack(pData->GetGlassData());
+
+		m_StackResult.StackFileReadStart(pData->GetGlassData()->m_strGlassID);
+	}
+	
+
+	return TRUE;
+}
+
+BOOL CGlassRawCPJT::SequenceInspectEnd( CgrmGlassRawData* pData )
+{
+	m_bReviewEndCheck = FALSE;
+	//210128
+	m_tmReviewEnd = m_tmReviewStart = CTime::GetCurrentTime();
+	pData->GetGlassData()->m_tmReviewEnd = m_tmReviewEnd;      // Insp End �떆 Raw �뾽濡쒕뱶濡�, E_TIME, LD_TIME �엯�젰 [ 21-03-18 KJG ]
+	m_tmFileCreateTime = CTime::GetCurrentTime();
+
+	//�뿬湲곗뿉�꽌 �씪�씤蹂꾨줈 �뙆�씪紐�, �샊�� Path �쐞移� 寃곗젙�븯硫대맖. AOIServer �샊�� ReviewServer�뿉�꽌 �븞�빐�룄�맖 [源��깭�쁽2019/9/4]
+	pData->GetGlassData()->m_strFileName;
+	{
+		_grmGlassData* pGlassData = pData->GetGlassData();
+		CTime CurrTime = pGlassData->m_tmGlassLoading;
+		CString strTime=_T(""), strFileName=_T("");
+		strTime.Format(_T("%04d%02d%02d_%02d%02d%02d"),
+			
+			CurrTime.GetYear(), CurrTime.GetMonth(), CurrTime.GetDay(), CurrTime.GetHour(), CurrTime.GetMinute(), CurrTime.GetSecond());
+		strFileName.Format("%s_%s_%s.bin", pGlassData->m_strGlassID, pGlassData->m_strStepID, strTime.GetBuffer(0));
+
+		strcpy(pData->GetGlassData()->m_strFileName, strFileName.GetBuffer(0));
+	}
+	strcpy(pData->GetGlassData()->m_strPath, LOCAL_AOIRAWBIN_PATH);
+
+	
+	if(!WriteBinFile(pData))
+		return FALSE;
+	
+	
+	if (1) ReadMuraFile(pData);
+
+	
+	if (WriteAOIFile(pData) == FALSE)
+		return FALSE;
+
+	// [C-PRJ] Image Upload Define - KHT (2020/11/19)
+	_TimeDelay(5000); // �씠誘몄� 蹂듭궗 �떆媛� ��湲�
+	//210218 CJH - 寃��궗 醫낅즺�떆 寃곌낵�뙆�씪 諛� CCD Image �뾽濡쒕뱶
+	SendMessageFTPUploadRaw(pData->GetGlassData());
+	SendMessageFTPUploadImage(pData->GetGlassData(), FTPCMD_AOI_IMAGE);
+	SendMessageFTPUploadImage(pData->GetGlassData(), FTPCMD_MURA_IMAGE);//0405nwh
+
+	return TRUE;
+}
+
+BOOL CGlassRawCPJT::SequenceReviewStart( CgrmGlassRawData* pData )
+{
+	//210128
+	m_tmReviewStart = m_tmReviewEnd = CTime::GetCurrentTime();
+
+	//�뿬湲곗뿉�꽌 �씪�씤蹂꾨줈 �뙆�씪紐�, �샊�� Path �쐞移� 寃곗젙�븯硫대맖. AOIServer �샊�� ReviewServer�뿉�꽌 �븞�빐�룄�맖 [源��깭�쁽2019/9/4]
+	pData->GetGlassData()->m_strFileName;
+	strcpy(pData->GetGlassData()->m_strPath, NETWORK_AOIRAWBIN_PATH);
+	
+	//strcpy(pData->GetGlassData()->m_strPath, LOCAL_AOIRAWBIN_PATH);
+
+	CString strFindFile;
+	int nCloseTime = 600*100000;//sec
+	int nReTryTime = 30;
+	{
+		CTime tmReviewLoading = CTime::GetCurrentTime();
+		CString strWild;
+		
+		strWild.Format("%s\\%s_%s_*.bin", pData->GetGlassData()->m_strPath, pData->GetGlassData()->m_strGlassID,pData->GetGlassData()->m_strStepID);
+		CakFileUtil akFileFinder;
+		while(nReTryTime--)
+		{
+			akFileFinder.FindFile(strWild.GetBuffer(0), FALSE);
+			VECFINDDATA* pFindData = akFileFinder.getFindData();
+			int nFileNamePos = strlen(akFileFinder.getProcessPath());
+			std::map<LONGLONG, CString> mapSpanFileName;
+			for(int i=0; i<pFindData->size(); i++)
+			{
+				char* pFileName = &((*pFindData)[i]).name[nFileNamePos];
+				{
+					CakParser parser;
+					parser.process(pFileName, "_.");
+					if(parser.getTokNum() < 4) continue;
+
+					int nDataTime[8]={};
+					{
+						int nTokIndex=0;
+						const char* pGlassId = parser.getTokStr(nTokIndex++);
+						const char* pStepId = parser.getTokStr(nTokIndex++);
+						char* pDate = &pFileName[parser.getTokPos(nTokIndex++)];
+						char* pTime = &pFileName[parser.getTokPos(nTokIndex++)];
+
+						nDataTime[0] = (pDate[0]-'0')*1000 + (pDate[1]-'0')*100 + (pDate[2]-'0')*10+ (pDate[3]-'0')*1;
+						nDataTime[1] = (pDate[4]-'0')*10+ (pDate[5]-'0')*1;
+						nDataTime[2] = (pDate[6]-'0')*10+ (pDate[7]-'0')*1;
+						nDataTime[3] = (pTime[0]-'0')*10+ (pTime[1]-'0')*1;
+						nDataTime[4] = (pTime[2]-'0')*10+ (pTime[3]-'0')*1;
+						nDataTime[5] = (pTime[4]-'0')*10+ (pTime[5]-'0')*1;
+					}
+					
+					CTime tmTemp(nDataTime[0], nDataTime[1], nDataTime[2], nDataTime[3], nDataTime[4], nDataTime[5] );
+					CTimeSpan tmSpan = tmReviewLoading-tmTemp;
+					mapSpanFileName.insert(std::make_pair(tmSpan.GetTotalSeconds(), pFileName));
+				}
+			}
+
+			if(mapSpanFileName.empty() == FALSE)
+			{
+				if(mapSpanFileName.begin()->first < nCloseTime)
+				{
+					//媛��옣 理쒓렐 寃곌낵�뙆�씪 李얘린 �꽦怨� [源��깭�쁽 2019/7/17]
+					strFindFile = mapSpanFileName.begin()->second;
+					break;
+				}
+			}
+			akFileFinder.clear();
+			Sleep(100);
+		}
+	}
+
+	if(strFindFile.IsEmpty()) return FALSE;
+
+	strcpy(pData->GetGlassData()->m_strFileName, strFindFile.GetBuffer(0));
+
+
+	if(!ReadBinFile(pData))
+		return FALSE;
+
+	strcpy(pData->GetGlassData()->m_strPath, LOCAL_AOIRAWBIN_PATH);
+
+	pData->GetGlassData()->m_tmReviewLoading = m_tmReviewStart;
+
+	return TRUE;
+}
+
+
+BOOL CGlassRawCPJT::SequenceReviewEnd( CgrmGlassRawData* pData )
+{ 
+	m_bReviewEndCheck = TRUE;
+	m_tmReviewEnd = m_tmReviewStart = CTime::GetCurrentTime();
+	m_tmFileCreateTime = CTime::GetCurrentTime();
+	pData->GetGlassData()->m_tmReviewEnd = m_tmReviewEnd;
+	
+	//�뿬湲곗뿉�꽌 �씪�씤蹂꾨줈 �뙆�씪紐�, �샊�� Path �쐞移� 寃곗젙�븯硫대맖. AOIServer �샊�� ReviewServer�뿉�꽌 �븞�빐�룄�맖 [源��깭�쁽2019/9/4]
+	pData->GetGlassData()->m_strFileName;
+	strcpy(pData->GetGlassData()->m_strPath, NETWORK_AOIRAWDFS_PATH);
+
+	if(1) ReadMuraFile(pData);
+
+  	if(WriteAOIFile(pData) == FALSE)
+  		return FALSE;
+
+	//210126 CJH - Review End�뿉�꽌留� RTMS 寃곌낵�뙆�씪 �깮�꽦�븯�룄濡� 蹂�寃�
+	if (m_GlassRawRTMS.WriteAOIFile(pData) == FALSE)
+		return FALSE;
+
+	if(1)
+	{
+		_grmGlassData* pGlassData = pData->GetGlassData();
+
+		SendMessageFTPUploadRaw(pGlassData);
+		SendMessageFTPUploadImage(pGlassData, FTPCMD_AOI_IMAGE);
+		SendMessageFTPUploadImage(pGlassData, FTPCMD_REVIEW_IMAGE);
+		SendMessageFTPUploadImage(pGlassData, FTPCMD_MURA_IMAGE);//0405nwh
+
+	}
+	
+	
+
+	
+	return TRUE;
+}
+
+BOOL CGlassRawCPJT::SequenceFtpUpload(char* pRawFilePathName)
+{
+	// Manual Upload 湲곕뒫 [21-02-05 KJG]
+	CTime tmFileCreate;
+	_grmGlassData GlassData;
+	_grmGlassData* pGlassData = &GlassData;
+
+	//�젙蹂� �뼸�뼱�삤湲� [源��깭�쁽 2019/1/25]
+	char* pFileName = CakFileUtil::getFileName(pRawFilePathName);
+	char* pext = CakFileUtil::getFileExt(pRawFilePathName);
+
+	if (!strcmp(pext, "") == FALSE) return FALSE; // �솗�옣�옄媛� �뾾�쓬
+
+	CakParser parser;
+	FILE* pf = fopen(pRawFilePathName, "r");
+	if (pf)
+	{
+		CString strParse, strLDTime;		
+		char buffer[512];
+		fgets(buffer, 512, pf);
+		fgets(buffer, 512, pf);
+		fgets(buffer, 512, pf);
+		fgets(buffer, 512, pf);
+		parser.process(buffer, " ");
+
+		if (parser.getTokNum() < 20) return FALSE;
+		strParse = parser.getTokStr(0);
+		if (strParse != "DATA") return FALSE;
+		strParse = parser.getTokStr(1);
+		if (strParse != "PANEL") return FALSE;
+
+		strcpy(pGlassData->m_strProcessID, "");
+		strcpy(pGlassData->m_strProductID, "");
+		strcpy(pGlassData->m_strLotID, "");
+		strcpy(pGlassData->m_strStepID, "");
+		strcpy(pGlassData->m_strGlassID, "");
+
+		strcpy(pGlassData->m_strProcessID, parser.getTokStr(4));
+		strcpy(pGlassData->m_strProductID, parser.getTokStr(5));
+		strcpy(pGlassData->m_strLotID, parser.getTokStr(5));		   // C-PJT - m_strLotID = m_strProductID
+		strcpy(pGlassData->m_strStepID, parser.getTokStr(6));
+		strcpy(pGlassData->m_strGlassID, parser.getTokStr(9));
+		strLDTime = parser.getTokStr(19);
+
+		if (pGlassData->m_strProcessID == "" || pGlassData->m_strProductID == "" || pGlassData->m_strLotID == "" || pGlassData->m_strStepID == "" || pGlassData->m_strGlassID == "")
+		{
+			AKLOG("Manual Upload Fail : Parsing Data is Empty");
+			return FALSE;
+		}
+		int nYear = _ttoi(strLDTime.Left(4));
+		int nMon = _ttoi(strLDTime.Mid(4, 2));
+		int nDay = _ttoi(strLDTime.Mid(6, 2));
+		int nHour = _ttoi(strLDTime.Mid(8, 2));
+		int nMin = _ttoi(strLDTime.Mid(10, 2));
+		int nSec = _ttoi(strLDTime.Mid(12, 2));
+		pGlassData->m_tmGlassLoading = CTime(nYear, nMon, nDay, nHour, nMin, nSec);
+
+		m_tmFileCreateTime = CTime::GetCurrentTime();
+		strcpy(pGlassData->m_strPath, NETWORK_AOIRAWDFS_PATH);
+
+		SendMessageFTPUploadRaw(pGlassData);
+		SendMessageFTPUploadImage(pGlassData, FTPCMD_AOI_IMAGE);
+		SendMessageFTPUploadImage(pGlassData, FTPCMD_REVIEW_IMAGE);
+		AKLOG("Manual Success : %s File Send FTPUploader Command", pRawFilePathName);
+		
+	}
+	else
+	{
+		AKLOG("Manual Upload Fail : Can't Open File");
+		return FALSE;
+	}
+	
+	fclose(pf);
+
+
+	return TRUE;
+}
+
+
+BOOL CGlassRawCPJT::WriteAOIFile( CgrmGlassRawData* pData )
+{
+	BOOL bResult = TRUE;
+	
+	bResult &= MakeAOIFile(pData);
+	
+	m_GlassRawAna.MakeAnaFile(pData);
+	//m_GlassRawRTMS.WriteAOIFile(pData);
+
+	AKLOG("WriteAOIFile Complete");
+	return bResult;
+}
+
+BOOL CGlassRawCPJT::MakeAOIFile( CgrmGlassRawData* pData )
+{
+	AKLOG("MakeAOIFile Start");
+	m_nWriteRawDefectIdx = 1;
+
+	_grmGlassData* pGlass = pData->GetGlassData();
+	CString strFilePathName;
+	CString strFileName;//�뙆�씪�깮�꽦 �떆媛� �븣臾몄뿉 �뿬湲곗꽌 �젙�솗�븯寃� �뙆�씪紐� �떎�떆 �젙�젙
+	{
+		//Glass �젙蹂�
+		CTime CurrTime = m_tmReviewEnd;
+		CString strTime;
+		strTime.Format(_T("%04d%02d%02d_%02d%02d%02d"),
+			CurrTime.GetYear(), CurrTime.GetMonth(), CurrTime.GetDay(), CurrTime.GetHour(), CurrTime.GetMinute(), CurrTime.GetSecond());
+		strFileName.Format("%s", pGlass->m_strGlassID); // �떊湲곕� �봽濡� �슂泥� �솗�옣�옄 �궘�젣
+	}
+	
+	strFilePathName.Format("%s\\%s", pGlass->m_strPath, strFileName);//pGlass->m_strFileName);
+	//strFilePathName.Format("C:\\AOIServer\\NFS\\RAW\\%s", pData->GetGlassData()->m_strFileName);
+	
+	// 湲��씪�뒪 ID留� 議댁옱�븯�뿬 �옱寃��궗 �떆 �뙆�씪 �깮�꽦 �떎�뙣. �궘�젣�븳�떎
+	DeleteFile(strFilePathName);
+	//FILE* pf = fopen(strFilePathName.GetBuffer(0), "w");
+	FILE* pf = fopen(strFilePathName.GetBuffer(0), "w");
+	if(pf == NULL)
+	{
+		AKLOG("MakeAOIFile Fail : [%s]", strFilePathName.GetBuffer(0));
+		return FALSE;
+	}
+	
+	
+	
+	CString strBuffer;
+	CString strLine;
+
+	//////////////////////////////////////////////////////////////////////////
+	//HEDER ITEM
+	{
+		makeDataHeader(strLine, pGlass);
+		fprintf(pf, "%s\n", strLine.GetBuffer(0));
+	}
+
+
+	//////////////////////////////////////////////////////////////////////////
+	//GLASSDATA
+	{
+		makeDataGlass(strLine, pGlass);
+		fprintf(pf, "%s\n", strLine.GetBuffer(0));
+	}
+	
+	//////////////////////////////////////////////////////////////////////////
+	//CELL & DEFECT DATA
+	{
+		
+		//make
+		{
+			for (int iCell = 0; iCell < pData->GetGlassData()->m_nCellNum; iCell++)
+			{
+				_grmCellData* pCell = pData->GetCellData(iCell);
+				makeDataCell(strLine, pData, pCell);
+				fprintf(pf, "%s\n", strLine);
+
+				for (int iDefect = 0; iDefect < pData->GetGlassData()->m_nDefectNum; iDefect++)
+				{
+					_grmDefectData* pDefect = pData->GetDefectData(iDefect);
+					if (pDefect->m_nCellIdx != iCell) continue;
+					//210203 CJH - CutOff ���긽 寃곌낵�뙆�씪 �옉�꽦 �젣�쇅
+					if (pDefect->m_bDefectCutoff == TRUE) continue;
+
+					if (makeDataDefect(strLine, pData, pDefect))
+					{
+						fprintf(pf, "%s\n", strLine);
+					}
+				}
+
+			}
+		}
+	}
+	
+	
+
+
+	
+	AKLOG("MakeAOIFile Complete : [%s]", strFilePathName.GetBuffer(0));
+	fclose(pf);
+	return TRUE;
+}
+
+void CGlassRawCPJT::makeDataHeader( CString& strLine, _grmGlassData* pGlassData )
+{
+	strLine.Empty();
+	CString strValue;
+	
+	strValue = "ITEM PANEL MODULETYPE MODULEID PROCESSID PRODUCTID STEPID PROD_TYPE BATCHID H_PANELID E_PANELID P_PANELID OPERID COMP_COUNT PPID GRADE CODE R_GRADE MAP_IMAGE L_TIME U_TIME S_TIME E_TIME T_DEFECT TR PR TB TW RB RW T_STACK MAX_AVG_GRAY MAX_PORTION OK_CELL RJ_CELL RW_CELL NR_CELL CSTID SLOT_NO JOB_END TD_DEFECT SD_DEFECT PD_DEFECT SP_DEFECT PAD_GATE PAD_DATA M_DEFECT C_DEFECT BR_DEFECT IMG_COUNT RECIPE SHRINK RAW_CUT"; //53ea
+	strLine += strValue; strLine += "\n";
+	strValue = "ITEM SUBPANEL SUBPANELID COORD_X COORD_Y SIZE_X SIZE_Y GATELINE DATALINE GRADE CODE R_GRADE T_DEFECT TD_DEFECT SD_DEFECT PD_DEFECT SP_DEFECT PAD_GATE PAD_DATA M_DEFECT C_DEFECT PRO_IMAGE AVG_GRAY_0 PORTION_0 CORNER_GRAY_0 AVG_AMP_0 FFT_VAR_0 FFT_VAH_0 FFT_VAQ_0 FFT_PK_0 AVG_GRAY_1 PORTION_1 CORNER_GRAY_1 AVG_AMP_1 FFT_VAR_1 FFT_VAH_1 FFT_VAQ_1 FFT_PK_1 AVG_GRAY_2 PORTION_2 CORNER_GRAY_2 AVG_AMP_2 FFT_VAR_2 FFT_VAH_2 FFT_VAQ_2 FFT_PK_2 AVG_GRAY_3 PORTION_3 CORNER_GRAY_3 AVG_AMP_3 FFT_VAR_3 FFT_VAH_3 FFT_VAQ_3 FFT_PK_3"; //54ea 21-06-21 Mura Data 異붽�
+	strLine += strValue; strLine += "\n";
+	//210405
+	//ITEM DEFECT ID DEF_NO COORD_X COORD_Y GATELINE DATALINE SIZE_S SIZE_W SIZE_L SIZE_H GRADE CODE STACK_FLAG STACK_COUNT STACK_STEP IMAGE_FILE DSC_CODE VC_CODE DCR_CODE DEFECT_SIZE REPEAT_DEFECT WSI_HEIGHT CS_HEIGHT C_GRADE GRAY_MIN GRAY_MAX GRAY_AVG GRAY_DEF WSI_IMAGE USE_CCDIMAGE SCAN_NUM CAM_POSITION CCD_NO R_GRAY_MIN R_GRAY_MAX R_GRAY_AVG SCAN_AI REVIEW_AI INS_MODE INS_CHANNEL COMPACTNESS THICKNESS MAJOR MINOR WSI_TYPE DEFECT_TYPE SHRINK
+	strValue = "ITEM DEFECT ID DEF_NO COORD_X COORD_Y GATELINE DATALINE SIZE_S SIZE_W SIZE_L SIZE_H GRADE CODE STACK_FLAG STACK_COUNT STACK_STEP IMAGE_FILE DSC_CODE VC_CODE DCR_CODE DEFECT_SIZE REPEAT_DEFECT WSI_HEIGHT CS_HEIGHT C_GRADE GRAY_MIN GRAY_MAX GRAY_AVG GRAY_DEF WSI_IMAGE USE_CCDIMAGE SCAN_NUM CAM_POSITION CCD_NO R_GRAY_MIN R_GRAY_MAX R_GRAY_AVG R_HEIGHT G_HEIGHT B_HEIGHT INS_CHANNEL COMPACTNESS THICKNESS MAJOR MINOR WSI_TYPE DEFECT_TYPE SHRINK CLASS_CODE"; //50ea    
+	strLine += strValue;
+
+}
+#define SPRINTRAWSTART char strItemValue[1024];int nItemValueLen, nItemValuePos = 0;memset(strItemValue, ' ', sizeof(char)*1024)
+#define SPRINTRAW(ITEMSIZE, fmt, ...) nItemValueLen = sprintf(strItemValue+nItemValuePos, fmt,##__VA_ARGS__); strItemValue[nItemValuePos+ nItemValueLen] = ' ';nItemValuePos+=ITEMSIZE+1
+#define SPRINTRAWEND strItemValue[nItemValuePos - 1] = 0; strLine = strItemValue
+void CGlassRawCPJT::makeDataGlass( CString& strLine, _grmGlassData* pGlassData )
+{
+	SPRINTRAWSTART;
+
+	CString strValue;
+	
+	/* PANEL ITEM	
+	01   4   ITEM			// ITEM Separator
+	02   5   PANEL			// PANEL Separator
+	03   5   MODULETYPE		// Module Type
+	04   27  MODULEID		// Module ID
+	05   20  PROCESSID		// ProcessID
+	06   20  PRODUCTID		// ProductID
+	07   10  STEPID			// StepID
+	08   2   PROD_TYPE		// Prod Type
+	09   12  BATCHID		// Batch ID
+	10   12  H_PANELID		// Host Panel ID
+	11   12  E_PANELID		// Panel ID Reading by VCR
+	12   12  P_PANELID		// Pair Panel ID
+	13   16  OPERID			// Perator ID or Module ID
+	14   3   COMP_COUNT		// Cell Count
+	15   16  PPID			// PPID (Recipe Name)
+	16   4   GRADE			// Grade (Judgement)
+	17   4   CODE			// Grade Code (Judgement Code)
+	18   4   R_GRADE		// Grade by Operator (Re-Judgement)
+	19   16  MAP_IMAGE		// Map Image File Name
+	20   14  L_TIME			// Cassette or Conveyor�뿉�꽌 OUT�맂 �떆媛�
+	21   14  U_TIME			// Cassette or Conveyor�뿉�꽌 IN�맂 �떆媛�
+	22   14  S_TIME			// Stage�뿉�꽌 寃��궗/怨꾩륫 �떆�옉�맂 �떆媛�
+	23   14  E_TIME			// Stage�뿉�꽌 寃��궗/怨꾩륫 醫낅즺�맂 �떆媛�
+	24   12   T_DEFECT		// Common Item 1 - Total Defect Count
+	25   12   TR         // Panel �젙蹂� 02
+	26   12   PR         // Panel �젙蹂� 03
+	27   12   TB         // Panel �젙蹂� 04
+	28   12   TW         // Panel �젙蹂� 05
+	29   12   RB         // Panel �젙蹂� 06
+	30   12   RW         // Panel �젙蹂� 07
+	31   12   T_STACK         // SD+SP �닔
+	32   12   BMDF		    // Panel �젙蹂� 09 -> 蹂�寃� MAX_AVG_GRAY 04/12
+	33   12   CJ			// Panel �젙蹂� 10 -> 蹂�寃� MAX_PORTION 04/12
+	34   12   OK_CELL		// OK Cell Count
+	35   12   RJ_CELL		// RJ Cell Count
+	36   12   RW_CELL		// RW Cell Count
+	37   12   NR_CELL		// NR Cell Count
+	38   12   MASK_CELL		// MASK Cell Count - CST ID
+	39   12   A_CELL			// �씠�긽 Cell Count - SLOT NO
+	40   12   P_CELL			// Pattern Shift Cell Count - JOB END
+	41   12   TD_DEFECT		// Total Defect Count -> TD Defect Count
+	42   12   SD_DEFECT		// SD Defect Count
+	43   12   PD_DEFECT		// PD Defect Count
+	44   12   SP_DEFECT		// SP Defect Count
+	45   12   PAD_GATE		// PAD Gate 遺덈웾 �닔
+	46   12   PAD_DATA		// PAD Data 遺덈웾 �닔
+	47   12   M_DEFECT		// MASK 遺덈웾 �닔
+	48   12   C_DEFECT		// COMMON 遺덈웾
+	49   12   BR_DEFECT		// SCRATCH 遺덈웾 �닔
+	50   12   CRACK			// Crack 遺덈웾 �닔 - Image 珥ъ긽 媛��닔
+	51   12   P_SHIFT			// Pattern Shift 遺덈웾 �닔 - �젅�떆�뵾 �씠由�
+	*/
+
+	//////////////////////////////////////////////////////////////////////////
+	// [源��깭�쁽2020/9/15]
+	// SPRINTRAW(�뜲�씠�꽣 �겕湲�, "VALUE");
+
+	// 01   4   ITEM			// ITEM Separator
+	SPRINTRAW(4, "DATA");
+	// 02   5   PANEL		// PANEL Separator	
+	SPRINTRAW(5, "PANEL");
+	// 03   5   MODULETYPE	// Module Type	
+	/*SPRINTRAW(5, "*");*/
+	if (strlen(pGlassData->m_strEquipID) == 0)
+	{
+		SPRINTRAW(5, "*");
+	}
+	else
+	{
+		CString temp = pGlassData->m_strEquipID;
+		SPRINTRAW(5, "%s", temp.Left(5));
+	}
+	// 04   27  MODULEID		// Module ID	
+	if (strlen(pGlassData->m_strOperID) == 0)
+	{
+		SPRINTRAW(27, "*");
+	}
+	else
+	{
+		SPRINTRAW(27, "%s", pGlassData->m_strOperID);
+	}
+	// 05   20  PROCESSID	// ProcessID	
+	if (strlen(pGlassData->m_strProcessID) == 0)
+	{
+		SPRINTRAW(20, "*");
+	}
+	else
+	{
+		SPRINTRAW(20, "%s", pGlassData->m_strProcessID);
+	}
+	// 06   20  PRODUCTID	// ProductID	
+	if (strlen(pGlassData->m_strProductID) == 0)
+	{
+		SPRINTRAW(20, "*");
+	}
+	else
+	{
+		SPRINTRAW(20, "%s", pGlassData->m_strProductID);
+	}
+	// 07   10  STEPID		// StepID
+	if (strlen(pGlassData->m_strStepID) == 0)
+	{
+		SPRINTRAW(10, "*");
+	}
+	else
+	{
+		SPRINTRAW(10, "%s", pGlassData->m_strStepID);
+	}
+	// 08   2   PROD_TYPE	// Prod Type	
+	if (strlen(pGlassData->m_strProdType) == 0)
+	{
+		SPRINTRAW(2, "*");
+	}
+	else
+	{
+		SPRINTRAW(2, "%s", pGlassData->m_strProdType);
+	}
+	// 09   12  BATCHID		// Batch ID	 - Glass ID �븵 6�옄由�
+	strValue = pGlassData->m_strGlassID;
+	SPRINTRAW(12, "%s", strValue.Left(6));
+	// 10   12  H_PANELID	// Host Panel ID	
+	if (strlen(pGlassData->m_strGlassID) == 0)
+	{
+		SPRINTRAW(12, "*");
+	}
+	else
+	{
+		SPRINTRAW(12, "%s", pGlassData->m_strGlassID);
+	}
+	// 11   12  E_PANELID	// Panel ID Reading by VCR	
+	if (strlen(pGlassData->m_strEPPID) == 0)
+	{
+		SPRINTRAW(12, "*");
+	}
+	else
+	{
+		SPRINTRAW(12, "%s", pGlassData->m_strEPPID);
+	}
+	// 12   12  P_PANELID	// Pair Panel ID	
+	if (strlen(pGlassData->m_strPairHPanelID) == 0)
+	{
+		SPRINTRAW(12, "*");
+	}
+	else
+	{
+		SPRINTRAW(12, "%s", pGlassData->m_strPairHPanelID);
+	}
+	// 13   16  OPERID		// Perator ID or Module ID	
+	if (strlen(pGlassData->m_strOperID) == 0)
+	{
+		SPRINTRAW(16, "*");
+	}
+	else
+	{
+		SPRINTRAW(16, "%s", pGlassData->m_strOperID);
+	}	
+	// 14   3   COMP_COUNT	// Cell Count	
+	SPRINTRAW(3, "%d", pGlassData->m_nCellNum);
+	// 15   16  PPID			// PPID (Recipe Name)	
+	if (strlen(pGlassData->m_strPPID) == 0)
+	{
+		SPRINTRAW(16, "*");
+	}
+	else
+	{
+		SPRINTRAW(16, "%s", pGlassData->m_strPPID);
+	}
+	// 16   4   GRADE		// Grade (Judgement)
+	if (strlen(pGlassData->m_strGlassJudge) == 0)
+	{
+		SPRINTRAW(4, "*");
+	}
+	else
+	{
+		SPRINTRAW(4, "%s", pGlassData->m_strGlassJudge);
+	}
+	// 17   4   CODE			// Grade Code (Judgement Code)
+	if (strlen(pGlassData->m_strGlassCode) == 0)
+	{
+		SPRINTRAW(4, "*");
+	}
+	else
+	{
+		SPRINTRAW(4, "%s", pGlassData->m_strGlassCode);
+	}
+	// 18   4   R_GRADE		// Grade by Operator (Re-Judgement)	
+	SPRINTRAW(4, "*");
+	// 19   16  MAP_IMAGE	// Map Image File Name	
+//	if (strlen(pGlassData->m_strFileName) == 0)
+//	{
+//		SPRINTRAW(16, "*");
+//	}
+//	else
+//	{
+//		SPRINTRAW(16, "%s", pGlassData->m_strFileName);
+//	}
+	SPRINTRAW(16, "map01.jpg"); //Defect Map �옄由우닔媛� 20�옄由ш� �꽆�뒗�떎..
+	// 20   14  L_TIME		// Cassette or Conveyor�뿉�꽌 OUT�맂 �떆媛�	
+	strValue.Format("%04d%02d%02d%02d%02d%02d"			// START_TIME
+		, pGlassData->m_tmGlassLoading.GetYear()
+		, pGlassData->m_tmGlassLoading.GetMonth()
+		, pGlassData->m_tmGlassLoading.GetDay()
+		, pGlassData->m_tmGlassLoading.GetHour()
+		, pGlassData->m_tmGlassLoading.GetMinute()
+		, pGlassData->m_tmGlassLoading.GetSecond());
+	SPRINTRAW(14, "%s", (LPSTR)(LPCTSTR)strValue);
+	// 21   14  U_TIME		// Cassette or Conveyor�뿉�꽌 IN�맂 �떆媛�	
+	strValue.Format("%04d%02d%02d%02d%02d%02d"			// E_TIME
+		, pGlassData->m_tmReviewEnd.GetYear()
+		, pGlassData->m_tmReviewEnd.GetMonth()
+		, pGlassData->m_tmReviewEnd.GetDay()
+		, pGlassData->m_tmReviewEnd.GetHour()
+		, pGlassData->m_tmReviewEnd.GetMinute()
+		, pGlassData->m_tmReviewEnd.GetSecond());
+	SPRINTRAW(14, "%s", (LPSTR)(LPCTSTR)strValue);
+	// 22   14  S_TIME		// Stage�뿉�꽌 寃��궗/怨꾩륫 �떆�옉�맂 �떆媛�	
+	strValue.Format("%04d%02d%02d%02d%02d%02d"			// START_TIME
+		, pGlassData->m_tmInspectionStart.GetYear()
+		, pGlassData->m_tmInspectionStart.GetMonth()
+		, pGlassData->m_tmInspectionStart.GetDay()
+		, pGlassData->m_tmInspectionStart.GetHour()
+		, pGlassData->m_tmInspectionStart.GetMinute()
+		, pGlassData->m_tmInspectionStart.GetSecond());
+	SPRINTRAW(14, "%s", (LPSTR)(LPCTSTR)strValue);
+	// 23   14  E_TIME		// Stage�뿉�꽌 寃��궗/怨꾩륫 醫낅즺�맂 �떆媛�
+	strValue.Format("%04d%02d%02d%02d%02d%02d"			// E_TIME
+		, pGlassData->m_tmReviewEnd.GetYear()
+		, pGlassData->m_tmReviewEnd.GetMonth()
+		, pGlassData->m_tmReviewEnd.GetDay()
+		, pGlassData->m_tmReviewEnd.GetHour()
+		, pGlassData->m_tmReviewEnd.GetMinute()
+		, pGlassData->m_tmReviewEnd.GetSecond());
+	SPRINTRAW(14, "%s", (LPSTR)(LPCTSTR)strValue);
+	// 24   6   T_DEFECT		// Common Item 1 - Total Defect Count	
+	SPRINTRAW(12, "%d", pGlassData->m_nDefectNum - pGlassData->m_nCutOffDefectNum); //210203 CJH - Cutoff 寃고븿�� �쟾泥닿컻�닔�뿉�꽌 �젣�쇅�빐以��떎.
+	// 25   6   TR		// Panel �젙蹂� 02	
+	SPRINTRAW(12, "%d", pGlassData->m_nDefectNumJudgeTR);
+	// 26   6   PR		// Panel �젙蹂� 03	
+	SPRINTRAW(12, "%d", pGlassData->m_nDefectNumJudgePR);
+	// 27   6   TB		// Panel �젙蹂� 04	
+	SPRINTRAW(12, "%d", pGlassData->m_nDefectNumTypeTB);
+	// 28   6   TW		// Panel �젙蹂� 05	
+	SPRINTRAW(12, "%d", pGlassData->m_nDefectNumTypeTW);
+	// 29   6   RB		// Panel �젙蹂� 06	
+	SPRINTRAW(12, "%d", pGlassData->m_nDefectNumTypeRB);
+	// 30   6   RW		// Panel �젙蹂� 07	
+	SPRINTRAW(12, "%d", pGlassData->m_nDefectNumTypeRW);
+	// 31   6   T_STACK		// Panel �젙蹂� 08	SD+SP �닔 �엯�젰
+	SPRINTRAW(12, "%d", pGlassData->m_nDefectNumStackSD + pGlassData->m_nDefectNumStackSP);
+	//32   6   BMDF	    // Panel �젙蹂� 09 -> 蹂�寃� MAX_AVG_GRAY 04/12 nwh
+	if (strlen(pGlassData->m_strMaxAvgGray) == 0)
+	{
+		SPRINTRAW(12, "*");
+	}
+	else
+	{
+		SPRINTRAW(12, "%s", pGlassData->m_strMaxAvgGray);
+	}	
+	// 33   6   CJ			// Panel �젙蹂� 10 -> 蹂�寃� MAX_PORTION  04/12 nwh
+	if (strlen(pGlassData->m_strMaxPortion) == 0)
+	{
+		SPRINTRAW(12, "*");
+	}
+	else
+	{
+		SPRINTRAW(12, "%s", pGlassData->m_strMaxPortion);
+	}
+	// 34   6   OK_CELL		// OK Cell Count	
+	SPRINTRAW(12, "*");
+	// 35   6   RJ_CELL		// RJ Cell Count	
+	SPRINTRAW(12, "*");
+	// 36   6   RW_CELL		// RW Cell Count	
+	SPRINTRAW(12, "*");
+	// 37   6   NR_CELL		// NR Cell Count	
+	SPRINTRAW(12, "*");
+	// 38   6   MASK_CELL		// MASK Cell Count	//201215 CJH - CSTID濡� 蹂�寃�
+	if (strlen(pGlassData->m_strCSTID) == 0)
+	{
+		SPRINTRAW(12, "*");
+	}
+	else
+	{
+		SPRINTRAW(12, "%s", pGlassData->m_strCSTID);
+	}	
+
+	SPRINTRAW(12, "%d", pGlassData->m_nSlot_No);    // SLot_No 異붽� [ 21-03-18 KJG ]
+
+	SPRINTRAW(12, "%d", pGlassData->m_bJob_end);    // Job_end 異붽� [ 21-03-18 KJG ]
+
+	// 41   6   TD_DEFECT		// TD Defect Count	-> �쁽怨듭젙�뿉�꽌 �굹�삩 紐⑤뱺 寃고븿 : Total - SD
+	SPRINTRAW(12, "%d", pGlassData->m_nDefectNumStackTD);
+	// 42   6   SD_DEFECT		// SD Defect Count  -> TD 寃고븿�뿉�꽌 Stack 寃고븿�쓣 �젣�쇅�븳 寃고븿(�슦由� �꽕鍮꾩뿉�꽌 泥� 諛쒓껄�맂 寃고븿)	
+	SPRINTRAW(12, "%d", pGlassData->m_nDefectNumStackSD);
+	// 43   6   PD_DEFECT		// PD Defect Count	-> �쁽�옱 怨듭젙�뿉�꽌 寃�異쒕맂 �듅�젙 Partial 寃고븿(�궗�뼇�꽌 �긽�뿉�뒗 Zone�씠�씪 �릺�뼱�엳�쑝�굹 �떎吏덉쟻�쑝濡쒕뒗 Classfication�뿉 �넻怨쇰맂 寃고븿)
+	SPRINTRAW(12, "%d", pGlassData->m_nDefectNumStackPD);
+	// 44   6   SP_DEFECT		// SP Defect Count	-> �쁽�옱 怨듭젙�뿉�꽌 寃�異쒕맂 �듅�젙 Partial 寃고븿 以�, �씠�쟾 怨듭젙�쓽 Partial 寃고븿�쓣 �젣�쇅�븳 寃고븿
+	SPRINTRAW(12, "%d", pGlassData->m_nDefectNumStackSP);
+	// 45   6   PAD_GATE		// PAD Gate 遺덈웾 �닔	
+	SPRINTRAW(12, "*");
+	// 46   6   PAD_DATA		// PAD Data 遺덈웾 �닔	
+	SPRINTRAW(12, "*");
+	// 47   6   M_DEFECT		// MASK 遺덈웾 �닔	
+	SPRINTRAW(12, "%d", pGlassData->m_nDefectNumTypeMD);
+	// 48   6   C_DEFECT		// COMMON 遺덈웾	
+	SPRINTRAW(12, "%d", pGlassData->m_nDefectNumTypeCD);
+	// 49   6   S_DEFECT		// SCRATCH 遺덈웾 �닔	
+	SPRINTRAW(12, "*");
+	// 50   6   CRACK		// Crack 遺덈웾 �닔	//201217 CJH - Image 珥ъ긽 媛쒖닔濡� 蹂�寃�
+	//SPRINTRAW(12, "%d", pGlassData->m_nDefectNumLocCrack);
+	SPRINTRAW(12, "%d", pGlassData->m_nReviewNum);
+	// 51 6   P_SHIFT		// Pattern Shift 遺덈웾 �닔	//201217 CJH - Recipe濡� 蹂�寃�
+	if (strlen(pGlassData->m_strRecipeName) == 0)
+	{
+		SPRINTRAW(16, "*");
+	}
+	else if(strlen(pGlassData->m_strRecipeName) <= 16)
+	{
+		SPRINTRAW(16, "%s", pGlassData->m_strRecipeName);
+	}
+	else if (strlen(pGlassData->m_strRecipeName) > 16)
+	{
+		CString temp = pGlassData->m_strRecipeName;  // �젅�떆�뵾 17�옄由� �꽆�뼱媛�硫� DCOLL 諛쒖깮�쑝濡� �삁�쇅泥섎━ [ 21-06-02 KJG ]
+		temp = temp.Left(16);		
+		SPRINTRAW(16, "%s", temp.GetBuffer(0));
+	}
+
+	// 52	12	SHRINK		// Server or Frame Shrink �룞�옉 �뿬遺�
+	if (strlen(pGlassData->m_strShrinked) == 0)
+	{
+		SPRINTRAW(12, "*");
+	}
+	else
+	{
+		SPRINTRAW(12, "%s", pGlassData->m_strShrinked);
+	}
+	// 53	12	RAW_CUT		// RAW �엯�젰 Defect �닔�웾 �긽�븳 �궗�슜�뿬遺�
+	if (pGlassData->m_bRawCutoff)
+	{
+		SPRINTRAW(12, "USE");
+	}
+	else
+	{
+		SPRINTRAW(12, "UNUSE");
+	}
+
+	SPRINTRAWEND;   //以묒슂!!! �젮 留덉�留됱뿉 瑗� �엳�뼱�빞�븿!!!(�궘�젣湲덉�) [源��깭�쁽2020/9/23]
+}
+
+void CGlassRawCPJT::makeDataCell( CString& strLine, CgrmGlassRawData* pData, _grmCellData* pCellData )
+{
+	SPRINTRAWSTART;
+
+	/* SUBPanel ITEM
+	01 4  ITEM				// ITEM
+	02 8  SUBPANEL			// SUBPANEL
+	03 12 SUBPANELID		// Subpanel ID
+	04 7  COORD_X			// X Beginnign Coord
+	05 7  COORD_Y			// Y Beginning Coord
+	06 7  SIZE_X			// X-axis Size
+	07 7  SIZE_Y			// Y-axis Size
+	08 6  GATELINE			// GateLine
+	09 6  DATALINE			// DataLine
+	10 4  GRADE				// Grade (Judgement)
+	11 4  CODE				// Grade Code (Judgement)
+	12 4  R_GRADE			// Grade by Operator (Re-Judgement)
+	13 12  T_DEFECT			// Total Defect Count
+	14 12  TD_DEFECT		// TD Defect Count
+	15 12  SD_DEFECT		// SD Defect Count
+	16 12  PD_DEFECT		// PD Defect Count
+	17 12  SP_DEFECT		// SP Defect Coun
+	18 12  PAD_GATE			// PAD Gate Defect Count
+	19 12  PAD_DATA			// PAD Data Defect Count
+	20 12  M_DEFECT			// MASK Defect Count
+	21 12  C_DEFECT			// COMMON Defect Count
+	22 12  S_DEFECT			// SCRATCH Defect Count
+	23 12  CRACK				// CRACK Defect Count
+	24 12  P_SHIFT			// Pattern Shift Defect Count
+	*/
+
+	// 01 4  ITEM				// ITEM
+	SPRINTRAW(4, "DATA");
+	// 02 8  SUBPANEL			// SUBPANEL
+	SPRINTRAW(8, "SUBPANEL");
+	// 03 12 SUBPANELID			// Subpanel ID
+	//SPRINTRAW(12, "%d", pCellData->m_nCellID);
+	SPRINTRAW(12, "%s%c%c", pData->GetGlassData()->m_strGlassID, '0' + pCellData->m_nCellID / 36, g_pCellCode[pCellData->m_nCellID % 36]);
+	
+	// 湲��씪�뒪 �썝�젏 湲곗� Y醫뚰몴 諛섎� 
+	// 肄붾꼫而� 湲곗��쑝濡� 寃곌낵�뙆�씪 醫뚰몴媛� �깮�꽦�릺�뒗�뜲 怨좉컼�궗�뿉 紐낇솗�븳 �솗�씤 �븘�슂
+	// Server�뒗 紐⑤뱺 醫뚰몴瑜� 湲��씪�뒪 �썝�젏 湲곗��쑝濡� �븯�뒗�뜲 肄붾꼫而� 湲곗��씠 �릺�뼱�빞�븯�뒗吏� 遊먯빞�븿
+	// �� �쐞移섎뒗 湲��씪�뒪 �썝�젏, 醫뚰몴�뒗 肄붾꼫而�???
+	// 210129 CJH - �� �썝�젏 �쐞移섏뿉 �뵲�씪 醫뚰몴�쐞移� 蹂�寃� LeftTop(1,-1) RightTop(-1,-1) LeftBottom(1,1) RightBottom(-1,1)
+	if (pCellData->m_nCellXDir == 1)
+	{
+		// 04 7  COORD_X			// X Beginning Coord
+		SPRINTRAW(8, "%d", pCellData->m_rectCellLeft);
+	}
+	else
+	{
+		// 04 7  COORD_X			// X Beginning Coord
+		SPRINTRAW(8, "%d", pCellData->m_rectCellRight);
+	}	
+
+	if (pCellData->m_nCellYDir == 1)
+	{
+		// 05 7  COORD_Y			// Y Beginning Coord	//Top�쓣 �빐�빞 �젣��濡� 媛믪씠 �뱾�뼱媛�...Rect遺��꽣 �옒紐� �뱾�뼱媛��뒗�벏
+		SPRINTRAW(8, "%d", pCellData->m_rectCellTop * -1);
+	}
+	else
+	{
+		// 05 7  COORD_Y			// Y Beginning Coord
+		SPRINTRAW(8, "%d", pCellData->m_rectCellBottom * -1);
+	}
+	// 06 7  SIZE_X				// X-axis Size
+	SPRINTRAW(7, "%d", pCellData->m_rectCellRight - pCellData->m_rectCellLeft);
+	// 07 7  SIZE_Y				// Y-axis Size
+	SPRINTRAW(7, "%d", pCellData->m_rectCellBottom - pCellData->m_rectCellTop);
+	// 08 6  GATELINE			// 珥� GateLine �닔
+	SPRINTRAW(6, "%d", pCellData->m_nGateNum);
+	// 09 6  DATALINE			// 珥� DataLine �닔
+	SPRINTRAW(6, "%d", pCellData->m_nDataNum);
+	// 10 4  GRADE				// Grade (Judgement)
+	SPRINTRAW(4, "%s", GetDefectInfoToString(DMT_DefectJudge, pCellData->m_nJudgement));
+	
+	// 11 4  CODE				// Grade Code (Judgement)
+	SPRINTRAW(4, "OOOO");
+	// 12 4  R_GRADE			// Grade by Operator (Re-Judgement)
+	SPRINTRAW(4, "*");
+	// 13 6  T_DEFECT			// Total Defect Count
+	SPRINTRAW(12, "%d", pCellData->getTotalDefectNum());
+	// 14 6  TD_DEFECT			// TD Defect Count - total defect
+	SPRINTRAW(12, "%d", pCellData->m_nDefectTDCount);
+	// 15 6  SD_DEFECT			// SD Defect Count - stack defect 
+	SPRINTRAW(12, "%d", pCellData->m_nDefectSDCount);
+	// 16 6  PD_DEFECT			// PD Defect Count - partial defect
+	SPRINTRAW(12, "%d", pCellData->m_nDefectPDCount);
+	// 17 6  SP_DEFECT			// SP Defect Count - stack partial 
+	SPRINTRAW(12, "%d", pCellData->m_nDefectSPCount);
+	// 18 6  PAD_GATE			// PAD Gate Defect Count
+	SPRINTRAW(12, "*");
+	// 19 6  PAD_DATA			// PAD Data Defect Count
+	SPRINTRAW(12, "*");
+	// 20 6  M_DEFECT			// MASK Defect Count
+	SPRINTRAW(12, "%d", pCellData->m_nDefectNumTypeMD);
+	// 21 6  C_DEFECT			// COMMON Defect Count
+	SPRINTRAW(12, "%d", pCellData->m_nDefectNumTypeCD);
+
+	// 22 6  S_DEFECT  -> 22 6  PRO_IMAGE 蹂�寃�	 nwh0404	
+	if (strlen(pCellData->m_strProImage))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strProImage);
+	}
+	else
+	{
+		SPRINTRAW(12,"*");
+	}
+
+	// 23 12  AVG_GRAY_0
+	if (strlen(pCellData->m_strAvgGray_0))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strAvgGray_0);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 24 12 PORTION_0
+	if (strlen(pCellData->m_strPortion_0))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strPortion_0);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+	
+	//kyh 0622
+	// 25 12 CORNER_GRAY_0
+	if (strlen(pCellData->m_strCorner_Gray_0))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strCorner_Gray_0);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 26 12 AVG_AMP_0
+	if (strlen(pCellData->m_strAvgAmp_0))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strAvgAmp_0);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 27 12 FFT_VAR_0
+	if (strlen(pCellData->m_strFFTVar_0))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strFFTVar_0);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 28 12 FFT_VAH_0
+	if (strlen(pCellData->m_strFFTVah_0))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strFFTVah_0);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 29 12 FFT_VAQ_0
+	if (strlen(pCellData->m_strFFTVaq_0))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strFFTVaq_0);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 30 12 FFT_PK_0
+	if (strlen(pCellData->m_strFFTPK_0))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strFFTPK_0);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 31 12  AVG_GRAY_1
+	if (strlen(pCellData->m_strAvgGray_1))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strAvgGray_1);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+	// 32 12 PORTION_1
+	if (strlen(pCellData->m_strPortion_1))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strPortion_1);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	//kyh 0622
+	// 33 12 CORNER_GRAY_1
+	if (strlen(pCellData->m_strCorner_Gray_1))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strCorner_Gray_1);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 34 12 AVG_AMP_1
+	if (strlen(pCellData->m_strAvgAmp_1))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strAvgAmp_1);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 35 12 FFT_VAR_1
+	if (strlen(pCellData->m_strFFTVar_1))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strFFTVar_1);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 36 12 FFT_VAH_1
+	if (strlen(pCellData->m_strFFTVah_1))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strFFTVah_1);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 37 12 FFT_VAQ_1
+	if (strlen(pCellData->m_strFFTVaq_1))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strFFTVaq_1);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 38 12 FFT_PK_1
+	if (strlen(pCellData->m_strFFTPK_1))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strFFTPK_1);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 39 12  AVG_GRAY_2
+	if (strlen(pCellData->m_strAvgGray_2))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strAvgGray_2);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+	// 40 12 PORTION_2
+	if (strlen(pCellData->m_strPortion_2))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strPortion_2);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	//kyh 0622
+	// 41 12 CORNER_GRAY_2
+	if (strlen(pCellData->m_strCorner_Gray_2))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strCorner_Gray_2);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 42 12 AVG_AMP_2
+	if (strlen(pCellData->m_strAvgAmp_2))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strAvgAmp_2);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 43 12 FFT_VAR_2
+	if (strlen(pCellData->m_strFFTVar_2))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strFFTVar_2);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 44 12 FFT_VAH_2
+	if (strlen(pCellData->m_strFFTVah_2))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strFFTVah_2);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 45 12 FFT_VAQ_2
+	if (strlen(pCellData->m_strFFTVaq_2))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strFFTVaq_2);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 46 12 FFT_PK_2
+	if (strlen(pCellData->m_strFFTPK_2))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strFFTPK_2);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 47 12  AVG_GRAY_3
+	if (strlen(pCellData->m_strAvgGray_3))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strAvgGray_3);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+	// 48 12 PORTION_3
+	if (strlen(pCellData->m_strPortion_3))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strPortion_3);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	//kyh 0622
+	// 49 12 CORNER_GRAY_3
+	if (strlen(pCellData->m_strCorner_Gray_3))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strCorner_Gray_3);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 50 12 AVG_AMP_3
+	if (strlen(pCellData->m_strAvgAmp_3))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strAvgAmp_3);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 51 12 FFT_VAR_3
+	if (strlen(pCellData->m_strFFTVar_3))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strFFTVar_3);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 52 12 FFT_VAH_3
+	if (strlen(pCellData->m_strFFTVah_3))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strFFTVah_3);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 53 12 FFT_VAQ_3
+	if (strlen(pCellData->m_strFFTVaq_3))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strFFTVaq_3);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 54 12 FFT_PK_3
+	if (strlen(pCellData->m_strFFTPK_3))
+	{
+		SPRINTRAW(12, "%s", pCellData->m_strFFTPK_3);
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	SPRINTRAWEND;   //以묒슂!!! �젮 留덉�留됱뿉 瑗� �엳�뼱�빞�븿!!!(�궘�젣湲덉�) [源��깭�쁽2020/9/23]
+}
+
+BOOL CGlassRawCPJT::makeDataDefect( CString& strLine, CgrmGlassRawData* pData, _grmDefectData* pDefectData )
+{
+	SPRINTRAWSTART;
+	CString		strItem;
+	/* DEFECT ITEM
+		// 01   4    ITEM			// ITEM
+		// 02   6    DEFECT			// DEFECT
+		// 03   12   ID				// Subpanel ID
+		// 04   5    DEF_NO			// Defect Number of Panel
+		// 05   7    COORD_X		// Defect Location from origin point X
+		// 06   7    COORD_Y		// Defect Location from origin point Y
+		// 07   6    GATELINE		// Defect Gateline
+		// 08   6    DATALINE		// Defect Dataline
+		// 09   4    SIZE_S			// Defect Size (Square)
+		// 10   4    SIZE_W			// Defect Size (Width)
+		// 11   4    SIZE_L			// Defect Size (Length)
+		// 12   4    SIZE_H			// Defect Size (Height)
+		// 13   4    GRADE			// Defect Grade
+		// 14   4    CODE			// Defect Code
+		// 15   2    STACK_FLAG		// Current Defect Flag
+		// 16   2    STACK_COUNT	// Count of Defect detected step
+		// 17   60   STACK_STEP		// Flow(Step) of defect detection
+		// 18   16   IMAGE_FILE		// Image file Name
+		// 19   12   DSC Code
+		// 20   12   Image 遺꾨쪟 Code
+		// 21   12   遺덈웾�씠 �쐞移섑븳 Zone No �엯�젰
+		// 22   12   遺덈웾 �겕湲� (L,H,M,S)
+		// 23   12   M/N/C/S/K/*
+		// 24   12   誘몄궗�슜
+		// 25   12   誘몄궗�슜
+		// 26   12   �쟾 STEP �뙋�젙 D/F �쑀臾�
+		// 27   12   Gray Min
+		// 28   12   Gray Max
+		// 29   12   Gray Average
+		// 30   12   Defect Peak
+		// 31   12   誘몄궗�슜
+		// 32   12   誘몄궗�슜
+		// 33   12   Scan 踰덊샇
+		// 34   12   Camera ID
+		// 35   12   誘몄궗�슜
+		// 36   12   R_SRC_MIN
+		// 37   12   R_SRC_MAX
+		// 38   12   R_SRC_AVG
+		// 39   12   Scan AI 遺꾨쪟寃곌낵
+		// 40   12   Review AI 遺꾨쪟寃곌낵
+		// 41   12   寃�異쒕え�뱶 (Dark or Bright)
+		// 42   12   寃�異쒖콈�꼸 RGB
+	*/
+
+	// 01   4    ITEM			// ITEM
+	SPRINTRAW(4, "DATA");
+	// 02   6    DEFECT			// DEFECT
+	SPRINTRAW(6, "DEFECT");
+	// 03   12   ID				// Subpanel ID
+	SPRINTRAW(12, "%s%c%c", pData->GetGlassData()->m_strGlassID, '0' + pDefectData->m_nCellIdx / 36, g_pCellCode[pDefectData->m_nCellIdx % 36]);
+	// 04   5    DEF_NO			// Defect Number of Panel
+	// RAW �뙆�씪�슜 Defect Index 
+	//SPRINTRAW(5, "%d", pDefectData->m_nDefectIdx);
+	SPRINTRAW(5, "%d", m_nWriteRawDefectIdx++);
+	// 05   8    COORD_X		// Defect Location from origin point X
+	SPRINTRAW(8, "%d", pDefectData->m_nUMCenterAlignX);
+	// 06   8    COORD_Y		// Defect Location from origin point Y
+	// �떊湲곕��봽濡� �슂泥� �엫�떆 �닔�젙 
+	SPRINTRAW(8, "%d", pDefectData->m_nUMCenterAlignY*-1);
+	// 07   6    GATELINE		// Defect Gateline
+	SPRINTRAW(6, "%d", pDefectData->m_nCellGate);
+	// 08   6    DATALINE		// Defect Dataline
+	SPRINTRAW(6, "%d", pDefectData->m_nCellData);
+	// 09   4    SIZE_S			// Defect Size (Square)
+	if (abs(pDefectData->m_nPixelSize) > 9999) {
+		SPRINTRAW(4, "%d",9999);
+	}
+	else
+	{
+		SPRINTRAW(4, "%d", pDefectData->m_nPixelSize);
+	}
+
+	// 10   4    SIZE_W			// Defect Size (Width)
+	if (abs(pDefectData->m_nUMSizeX) > 9999) {
+		SPRINTRAW(4, "%d", 9999);
+	}
+	else
+	{
+		
+		SPRINTRAW(4, "%d", pDefectData->m_nUMSizeX);
+	}
+
+	// 11   4    SIZE_L			// Defect Size (Length)
+	if (abs(pDefectData->m_nUMSizeY) > 9999) {
+		SPRINTRAW(4, "%d", 9999);
+	}
+	else
+	{
+		SPRINTRAW(4, "%d", pDefectData->m_nUMSizeY);
+	
+	}
+
+	// 12   4    SIZE_H			// Defect Size (Height)
+	if (abs(pDefectData->m_nDefectRScale) > 9999) {
+		SPRINTRAW(4, "%d", 9999);
+	}
+	else
+	{
+		strItem.Format("%d", pDefectData->m_nDefectRScale);
+		SPRINTRAW(4, "%.4s", strItem.GetBuffer(0));
+	}
+
+
+	// 13   4    GRADE			// Defect Grade
+	SPRINTRAW(4, "%s", GetDefectInfoToString(DMT_DefectJudge, pDefectData->m_DefectJudgement));
+	// 14   4    CODE			// Defect Code
+	if (strlen(pDefectData->m_strDefectCode))
+	{
+		SPRINTRAW(4, "%.4s", pDefectData->m_strDefectCode);
+	}
+	else
+	{
+		SPRINTRAW(4, "*");
+	}	
+	// 15   2    STACK_FLAG		// Current Defect Flag  //201221 CJH - TD/SD/PD/SP
+	if (pDefectData->m_StackInfo == Stack_Unknown)
+	{
+		SPRINTRAW(2, "%s", "UK");
+	}
+	else if (pDefectData->m_StackInfo == Stack_TD)
+	{
+		SPRINTRAW(2, "%s", "TD");
+	}
+	else if (pDefectData->m_StackInfo == Stack_SD)
+	{
+		SPRINTRAW(2, "%s", "SD");
+	}
+	else if (pDefectData->m_StackInfo == Stack_PD)
+	{
+		SPRINTRAW(2, "%s", "PD");
+	}
+	else if (pDefectData->m_StackInfo == Stack_SP)
+	{
+		SPRINTRAW(2, "%s", "SP");
+	}
+	else
+	{
+		SPRINTRAW(2, "*");
+	}
+	// 16   2    STACK_COUNT	// Count of Defect detected step
+	SPRINTRAW(2, "%2d", pDefectData->m_nStackStepCount);
+	// 17   60   STACK_STEP		// Flow(Step) of defect detection
+	if (strlen(pDefectData->m_strStackFirst))
+	{
+		SPRINTRAW(60, "%s", pDefectData->m_strStackFirst);
+	}
+	else
+	{
+		SPRINTRAW(60, "*");
+	}
+	// 18   16   IMAGE_FILE		// Image file Name
+	// 寃��궗 �씠誘몄� 誘몄궗�슜 
+	if (strlen(pDefectData->m_ReviewDefect.m_strRevImageName))
+	{
+		SPRINTRAW(16, "%s", pDefectData->m_ReviewDefect.m_strRevImageName);
+	}
+	else
+	{
+		SPRINTRAW(16, "*");
+	}
+	// 19   12    DSC_CODE		// Common 01 DSC Code
+	SPRINTRAW(12, "*");
+	// 20   12    VC_CODE		// Common 02 Image 遺꾨쪟 Code
+	SPRINTRAW(12, "*");
+	// 21   12    ZONE_NO		// Common 03 遺덈웾�씠 �쐞移섑븳 Zone No �엯�젰
+	// Zone Data
+	int nValue = 0;
+	for (int i = 15; i >= 0; i--)
+	{
+		if (pDefectData->m_sZonePixelCount[i] > 0)
+			nValue += 1;
+		if (i > 0)
+			nValue = nValue << 1;
+	}
+	SPRINTRAW(12, "%04X", nValue);
+
+	// 22   12    DEFECT_SIZE	// Common 04 遺덈웾 �겕湲� (L,H,M,S)
+	if (pDefectData->m_DefectSizeType == SizeType_Small)
+	{
+		SPRINTRAW(12, "S");
+	}
+	else if (pDefectData->m_DefectSizeType == SizeType_Mid)
+	{
+		SPRINTRAW(12, "M");
+	}
+	else if (pDefectData->m_DefectSizeType == SizeType_Large)
+	{
+		SPRINTRAW(12, "L");
+	}
+	else if (pDefectData->m_DefectSizeType == SizeType_Huge)
+	{
+		SPRINTRAW(12, "H");
+	}
+	else if (pDefectData->m_DefectSizeType == SizeType_Ultra)
+	{
+		SPRINTRAW(12, "U");
+	}
+	else
+	{
+		SPRINTRAW(12, "S");
+	}
+	//SizeType_Small
+	// 23   12    REPEAT_DEFECT	// Common 05 M/N/C/S/K/*
+	if (pDefectData->m_DefectSubType == DefectSubType_MC)
+	{
+		SPRINTRAW(12, "MC");
+	}
+	else if (pDefectData->m_DefectSubType == DefectSubType_Mask)
+	{
+		SPRINTRAW(12, "MD");
+	}
+	else if (pDefectData->m_DefectSubType == DefectSubType_Common)
+	{
+		SPRINTRAW(12, "CD");
+	}
+	else if (pDefectData->m_DefectSubType == DefectSubType_NoDefect)
+	{
+		SPRINTRAW(12, "NO");
+	}
+	else
+	{
+		SPRINTRAW(12, "N");
+	}
+	// 24   12    	// Common 06 誘몄궗�슜 -> WSI �넂�씠 湲곗엯  	
+	//m_nPlanType == ditRaw::RTP_WSI �씠嫄몃줈 鍮꾧탳�븯�땲源� 媛��걫 鍮꾧탳�븞�릺怨� �꽆�뼱媛� 210205
+	if (pDefectData->m_ReviewDefect.m_nWsi_Type == 2)
+	{
+		SPRINTRAW(12, "%.03lf", pDefectData->m_ReviewDefect.m_fWsi_ResultData[1]);
+		
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+	// 25   12    	// Common 07 誘몄궗�슜 -> CS �넂�씠 湲곗엯 
+	if (pDefectData->m_ReviewDefect.m_nWsi_Type == 2)
+	{
+		SPRINTRAW(12, "%.03lf", pDefectData->m_ReviewDefect.m_fWsi_ResultData[3]);
+
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+	// 26   12    	// Common 08 �쟾 STEP �뙋�젙 D/F �쑀臾� 
+	SPRINTRAW(12, "*");
+	// 27   12    GRAY_MIN		// Common 09 Gray Min
+	SPRINTRAW(12, "%d", pDefectData->m_nLevelSrcMin);
+	// 28   12    GRAY_MAX		// Common 10 Gray Max
+	SPRINTRAW(12, "%d", pDefectData->m_nLevelSrcMax);
+	// 29   12    GRAY_AVG		// Common 11 Gray Average
+	SPRINTRAW(12, "%d", pDefectData->m_nLevelSrcAvg);
+	// 30   12    GRAY_DEF		// Common 12 Defect Peak
+	if (static_cast<int>(pDefectData->m_sDefectPeak) == 0)
+	{
+		SPRINTRAW(12, "1");
+	}
+	else
+	{ 
+		SPRINTRAW(12, "%d", pDefectData->m_sDefectPeak);
+	}
+
+	// 31 NO USE -> WSI Image Name 
+	if (pDefectData->m_ReviewDefect.m_nWsi_Type == 2)
+	{
+		if (strlen(pDefectData->m_ReviewDefect.m_strWsi_3DImageFilename))
+		{
+		SPRINTRAW(12, "%s", pDefectData->m_ReviewDefect.m_strWsi_3DImageFilename);
+		}
+		else
+		{
+			SPRINTRAW(12, "*");
+		}
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+	// 32 NO USE -> CCD Image �쑀臾�
+	if (strlen(pDefectData->m_strAoiImageName))
+	{
+		SPRINTRAW(12, "O");
+	}
+	else
+	{
+		SPRINTRAW(12, "X");
+	}
+	// 33   12    CAM_POSITION	// Common 15 Scan 踰덊샇
+	SPRINTRAW(12, "%d", pDefectData->m_nScanIdx);
+	// 34   12    CAM_POSITION	// Common 16 Camera ID
+	SPRINTRAW(12, "%d", pDefectData->m_nCameraID);
+	// 35   12    Defect Idx				// Common 25 Defect Idx
+	SPRINTRAW(12, "%d", pDefectData->m_nDefectIdx);
+	// 36   12    R_SRC_MIN		// Common 18 R_SRC_MIN
+	SPRINTRAW(12, "%d", pDefectData->m_nLevelRefMin);
+	// 37   12    R_SRC_MAX		// Common 19 R_SRC_MAX
+	SPRINTRAW(12, "%d", pDefectData->m_nLevelRefMax);
+	// 38   12    R_SRC_AVG		// Common 20 R_SRC_AVG
+	SPRINTRAW(12, "%d", pDefectData->m_nLevelRefAvg);
+	// 39   12    Scan AI 遺꾨쪟寃곌낵			// Common 21 怨좉컼�궗 �엯�젰==>>>> 0405蹂�寃폳SI R Height//210405
+	if (pDefectData->m_ReviewDefect.m_nWsi_Type == 2)
+	{
+		SPRINTRAW(12, "%.03lf", pDefectData->m_ReviewDefect.m_fWsi_ResultData[4]);
+
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+	// 40   12    Review AI 遺꾨쪟寃곌낵		// Common 22 怨좉컼�궗 �엯�젰==>>>> 0405蹂�寃폳SI G Height//210405
+	if (pDefectData->m_ReviewDefect.m_nWsi_Type == 2)
+	{
+		SPRINTRAW(12, "%.03lf", pDefectData->m_ReviewDefect.m_fWsi_ResultData[5]);
+
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+	// 41   12    寃�異쒕え�뱶 (Dark or Bright)	// Common 23 怨좉컼�궗 �엯�젰==>>>> 0405蹂�寃폳SI B Height//210405
+	if (pDefectData->m_ReviewDefect.m_nWsi_Type == 2)
+	{
+		SPRINTRAW(12, "%.03lf", pDefectData->m_ReviewDefect.m_fWsi_ResultData[6]);
+
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+	// 42   12    寃�異쒖콈�꼸 RGB				// Common 24 怨좉컼�궗 �엯�젰 
+	CString strData;  // 寃�異� 梨꾨꼸 異붽� ex) 0, 1, 2 [ 21-03-23 KJG ] 
+	int nLayers = pDefectData->m_nHliLayers;
+	strItem = _T("");
+	for (int i = 0; i < 8; i++)
+	{
+		if (nLayers & 1)
+		{
+			if (strItem.IsEmpty()) strData.Format("%d", i);
+			else strData.Format(",%d", i);
+			strItem += strData;
+		}
+		nLayers = nLayers >> 1;
+	}
+	SPRINTRAW(12, "%s", strItem);
+
+	// 43	12	  Compactness			//201215 CJH - 43~46 �떊洹� Defect Feature 寃곌낵�뙆�씪 異붽�
+	SPRINTRAW(12, "%d", pDefectData->m_nCompact);
+	// 44	12	  Thickness
+	SPRINTRAW(12, "%d", pDefectData->m_nThickness);
+	// 45	12	  Major
+	SPRINTRAW(12, "%d", pDefectData->m_nMajor);
+	// 46	12	  Minor
+	SPRINTRAW(12, "%d", pDefectData->m_nMinor);
+	// 47	12	  WSI Defect Type 0 normal 1 metal 2Huge 3diffuse 4 trashy
+	if (pDefectData->m_ReviewDefect.m_nWsi_Type == 2)
+	{
+		if (strlen(GetWsiDefectType(pDefectData->m_ReviewDefect.m_fWsi_ResultData[0])))
+		{
+		SPRINTRAW(12, "%s", GetWsiDefectType(pDefectData->m_ReviewDefect.m_fWsi_ResultData[0]));
+	        }
+	        else
+	        {
+		SPRINTRAW(12, "*");
+	        }
+	}
+	else
+	{
+		SPRINTRAW(12, "*");
+	}
+
+	// 48	12	Defect Type 異붽� [ 21-03-23 KJG ]
+	if (pDefectData->m_DefectType == DefectType_RBlack)
+	{
+		SPRINTRAW(12, "RB");
+	}
+	else if (pDefectData->m_DefectType == DefectType_RWhite)
+	{
+		SPRINTRAW(12, "RW");
+	}
+	else if (pDefectData->m_DefectType == DefectType_TBlack)
+	{
+		SPRINTRAW(12, "TB");
+	}
+	else if (pDefectData->m_DefectType == DefectType_TWhite)
+	{
+		SPRINTRAW(12, "TW");
+	}
+	else
+	{
+		SPRINTRAW(12, "UN");
+	}
+	
+	// 49	12	 Frame Shrink �젙蹂� 異붽�
+	SPRINTRAW(12, "%d", pDefectData->m_bShrinked);
+	
+	// 50   12    CLASS_NO		// Zone Classification NO
+	// Zone Data
+	nValue = 0;
+	for (int i = 15; i >= 0; i--)
+	{
+		if (pDefectData->m_sZoneClassPixelCount[i] > 0)
+			nValue += 1;
+		if (i > 0)
+			nValue = nValue << 1;
+	}
+	SPRINTRAW(12, "%04X", nValue);
+
+	SPRINTRAWEND;   //以묒슂!!! �젮 留덉�留됱뿉 瑗� �엳�뼱�빞�븿!!!(�궘�젣湲덉�) [源��깭�쁽2020/9/23]
+
+	return TRUE;
+}
+
+BOOL CGlassRawCPJT::ReadMuraFile( CgrmGlassRawData* pData )//0404nwh
+{
+	CString strMacroFilePath;
+	{
+		strMacroFilePath.Format("%s\\%s", NETWORK_MURARAW_PATH, pData->GetGlassData()->m_strGlassID);
+		
+		CFileFind FF;
+
+		if (FF.FindFile(strMacroFilePath))
+		{
+			FF.FindNextFile();
+			strMacroFilePath = FF.GetFilePath();
+			FF.Close();
+		}
+		else
+		{
+			AKLOG("Find Macro File Fail. [%s]", strMacroFilePath);
+			return FALSE;
+		}
+	}
+	////Mura Image Server �듅�젙 �뤃�뜑�뿉 ���옣
+	CString strMacroImageSrcPath;
+	CString strMacroImageTarPath;
+
+	strMacroImageSrcPath.Format("%s\\%s", NETWORK_MURA_IMAGE_PATH, pData->GetGlassData()->m_strGlassID);
+	strMacroImageTarPath.Format("%s\\%s\\MuraImage", NETWORK_AOI_IMAGE_PATH, pData->GetGlassData()->m_strGlassID); //�깮媛곸��빐蹂댁옄
+
+	//CreateDirectory("D:\\Image\\Defect\\Mura",NULL); �븞�빐�룄�맆嫄곌컳�쓬
+	if (strMacroImageSrcPath.IsEmpty() == FALSE)
+	{
+		AKLOG("Macro Image File Copy Start[%s]", strMacroImageTarPath);
+		CakFileUtil::CopyFolder(strMacroImageSrcPath.GetBuffer(0), strMacroImageTarPath.GetBuffer(0), FALSE);
+
+		if (m_bReviewEndCheck == TRUE)
+		{
+			CakFileUtil::DeleteFolder(strMacroImageSrcPath.GetBuffer(0), FALSE);
+		}
+		AKLOG("Macro Image File Copy End");
+	}
+
+	///Mura 寃곌낵�뙆�씪 �씫怨� �벐湲� �궘�젣
+	if (m_MuraResultFile.openFile_Mura(strMacroFilePath.GetBuffer(0)) == TRUE)
+	{
+		AKLOG("Macro File Read Success : %dItem", m_MuraResultFile.GetSubPanelNum());
+		if (m_bReviewEndCheck == TRUE)
+		{
+			DeleteFile(strMacroFilePath);
+		}
+	}
+	else
+	{
+		AKLOG("Macro File Read Fail[%s]", strMacroFilePath);
+		//DeleteFile(strMacroResultTargetPath); 
+		return FALSE;
+	}
+	return TRUE;
+}
+
+
+void CGlassRawCPJT::SendMessageFTPUploadRaw( _grmGlassData* pGlassData )
+{
+	if(pGlassData == NULL) return;
+	HWND hWnd = ::FindWindow(NULL, "FTPUploader");
+	if(hWnd == NULL) return;
+
+	char strServerFolder[256] = {};
+	char strServerFile[256] = {};
+	char strLocalFolder[256] = {};
+	char pLocalFile[256] = {}; 
+	char strRTMSFile[32] = {};
+	char strServerRawFileSubPath[256] = {};
+	char strServer_SubFileName[32] = {};
+
+	GetFormatDescription(FTPCMD_RAW, strServerFolder, strServerFile, strLocalFolder, pLocalFile, strRTMSFile, strServerRawFileSubPath, strServer_SubFileName,pGlassData); //taek 201211
+  
+	CFTPCopyDataParam upParam;
+	strcpy(upParam.m_strServer_FolderName,			strServerFolder);
+	strcpy(upParam.m_strServer_FileName,			strServerFile);
+	strcpy(upParam.m_strLocal_FolderName,			strLocalFolder);
+	strcpy(upParam.m_strLocal_FileName,				pLocalFile);
+	strcpy(upParam.m_strServer_SubFilePath,         strServerRawFileSubPath);
+	strcpy(upParam.m_strServer_SubFileName,         strServer_SubFileName);
+	strcpy(upParam.m_strServer_SignalFolderName,	"");
+	strcpy(upParam.m_strServer_SignalFileName,		"");
+	strcpy(upParam.m_strRTMS_FileName, ""); //taek 201211
+	upParam.m_nCreateSignalFile							= FALSE;//m_ctrlCreateSignal.GetCheck();
+	upParam.m_nSendResultCode							= FALSE;//m_ctrlResultAck.GetCheck();
+	upParam.m_nProcessType								= CFTPCopyDataParam::FTPProcessType_UpFile;
+	// [C-PRJ] Image Upload Define - KHT (2020/11/19)
+	upParam.m_nDataType									= CFTPCopyDataParam::FTPDataType_Raw;
+
+	COPYDATASTRUCT cds;
+	cds.dwData = CFTPCopyDataParam::FTPCopyDataCmd_RawUpload;
+	cds.cbData = sizeof(CFTPCopyDataParam);
+	cds.lpData = &upParam;
+
+	DWORD dwReturn = 0;
+	if(SendMessageTimeout(hWnd, WM_COPYDATA, NULL, (LPARAM)&cds, SMTO_NORMAL, 30000, (PDWORD_PTR)(dwReturn)) == FALSE)
+	{
+	}
+
+}
+
+void CGlassRawCPJT::SendMessageFTPDownloadStack( _grmGlassData* pGlassData )
+{
+	if(pGlassData == NULL) return;
+	HWND hWnd = ::FindWindow(NULL, "FTPUploader");
+	if(hWnd == NULL) return;
+
+	char strServerFolder[256] = {};
+	char strServerFile[256] = {};
+	char strLocalFolder[256] = {};
+	char pLocalFile[256] = {}; 
+	char strRTMSFile[32] = {};
+	char strServerRawFileSubPath[256] = {};
+	char strServer_SubFileName[256] = {};
+
+	GetFormatDescription(FTPCMD_STACK, strServerFolder, strServerFile, strLocalFolder, pLocalFile, strRTMSFile, strServerRawFileSubPath, strServer_SubFileName,pGlassData);
+
+	CFTPCopyDataParam upParam;
+	strcpy(upParam.m_strServer_FolderName,			strServerFolder);
+	strcpy(upParam.m_strServer_FileName,			strServerFile);
+	strcpy(upParam.m_strLocal_FolderName,			strLocalFolder);
+	strcpy(upParam.m_strLocal_FileName,				pLocalFile);
+	strcpy(upParam.m_strServer_SignalFolderName,	"");
+	strcpy(upParam.m_strServer_SignalFileName,		"");
+	strcpy(upParam.m_strRTMS_FileName, "");
+	upParam.m_nCreateSignalFile							= FALSE;//m_ctrlCreateSignal.GetCheck();
+	upParam.m_nSendResultCode							= FALSE;//m_ctrlResultAck.GetCheck();
+	upParam.m_nProcessType								= CFTPCopyDataParam::FTPProcessType_DownFile;
+	// [C-PRJ] Image Upload Define - KHT (2020/11/19)
+	upParam.m_nDataType									= CFTPCopyDataParam::FTPDataType_Stack;
+
+	COPYDATASTRUCT cds;
+	cds.dwData = CFTPCopyDataParam::FTPCopyDataCmd_RawDownload;
+	cds.cbData = sizeof(CFTPCopyDataParam);
+	cds.lpData = &upParam;
+
+	DWORD dwReturn = 0;
+	if(SendMessageTimeout(hWnd, WM_COPYDATA, NULL, (LPARAM)&cds, SMTO_NORMAL, 20000, (PDWORD_PTR)(dwReturn)) == FALSE)
+	{
+	}
+}
+
+void CGlassRawCPJT::SendMessageFTPDownloadDataFile( _grmGlassData* pGlassData )
+{
+	if(pGlassData == NULL) return;
+	HWND hWnd = ::FindWindow(NULL, "FTPDownloader");
+	if(hWnd == NULL) return;
+
+	char strServerFolder[256] = {};
+	char strServerFile[256] = {};
+	char strLocalFolder[256] = {};
+	char pLocalFile[256] = {}; 
+
+	//GetFormatDescription(FTPCMD_DATAFILE, strServerFolder, strServerFile, strLocalFolder, pLocalFile, pGlassData);
+	{
+		CString strGlassIDOrg = pGlassData->m_strGlassID; 
+		CString strGlassID = strGlassIDOrg.Left(12);
+		sprintf(strServerFolder, "%s", pGlassData->m_strCassetteSequenceNo);
+		sprintf(strServerFile, "%s.dat", strGlassID.GetBuffer(0));  
+		sprintf(strLocalFolder,  "D:\\DIT_ResultData\\DownloadData"); 
+		sprintf(pLocalFile,  "%s.dat", strGlassID.GetBuffer(0)); 
+	}
+
+	CFTPCopyDataParam upParam;
+	strcpy(upParam.m_strServer_FolderName,			strServerFolder);
+	strcpy(upParam.m_strServer_FileName,			strServerFile);
+	strcpy(upParam.m_strLocal_FolderName,			strLocalFolder);
+	strcpy(upParam.m_strLocal_FileName,				pLocalFile);
+	strcpy(upParam.m_strServer_SignalFolderName,	"");
+	strcpy(upParam.m_strServer_SignalFileName,		"");
+	upParam.m_nCreateSignalFile							= FALSE;//m_ctrlCreateSignal.GetCheck();
+	upParam.m_nSendResultCode							= FALSE;//m_ctrlResultAck.GetCheck();
+	upParam.m_nProcessType								= CFTPCopyDataParam::FTPProcessType_DownFile;
+	// [C-PRJ] Image Upload Define - KHT (2020/11/19)
+	upParam.m_nDataType = CFTPCopyDataParam::FTPDataType_Unknown;
+
+	COPYDATASTRUCT cds;
+	cds.dwData = CFTPCopyDataParam::FTPCopyDataCmd_RawDownload;
+	cds.cbData = sizeof(CFTPCopyDataParam);
+	cds.lpData = &upParam;
+
+	DWORD dwReturn = 0;
+	if(SendMessageTimeout(hWnd, WM_COPYDATA, NULL, (LPARAM)&cds, SMTO_NORMAL, 20000, (PDWORD_PTR)(dwReturn)) == FALSE)
+	{
+	}
+}
+
+void CGlassRawCPJT::SendMessageFTPUploadImage( _grmGlassData* pGlassData, emFTPCommand sort)
+{  
+	if(pGlassData == NULL) return;
+	HWND hWnd = ::FindWindow(NULL, "FTPUploader");
+	if(hWnd == NULL) return;
+
+	char strServerFolder[256] = {};
+	char strServerFile[32];// = "*.*";
+	char strLocalFolder[256] = {};
+	char strLocalFile[32];// = "*.*"; 
+	char strRTMSFile[256] = {}; //taek 201211
+	char strServerRawFileSubPath[256] = {};
+	char strServer_SubFileName[256] = {};
+
+	GetFormatDescription(sort, strServerFolder, strServerFile, strLocalFolder, strLocalFile, strRTMSFile, strServerRawFileSubPath, strServer_SubFileName,pGlassData); //taek 201211
+ 
+	CFTPCopyDataParam upParam;
+	strcpy(upParam.m_strServer_FolderName,			strServerFolder);
+	strcpy(upParam.m_strServer_FileName,			strServerFile);
+	strcpy(upParam.m_strLocal_FolderName,			strLocalFolder);
+	strcpy(upParam.m_strLocal_FileName,				strLocalFile);
+	strcpy(upParam.m_strServer_SignalFolderName,	"");
+	strcpy(upParam.m_strServer_SignalFileName,		"");
+	strcpy(upParam.m_strRTMS_FileName, 				strRTMSFile); //taek 201211
+	upParam.m_nCreateSignalFile							= FALSE;
+	upParam.m_nSendResultCode							= FALSE;
+	upParam.m_nProcessType								= CFTPCopyDataParam::FTPProcessType_UpFile;
+	// [C-PRJ] Image Upload Define - KHT (2020/11/19)
+	upParam.m_nDataType									= CFTPCopyDataParam::FTPDataType_Image;
+
+	COPYDATASTRUCT cds;
+	cds.dwData = CFTPCopyDataParam::FTPCopyDataCmd_ImageUpload; // FTP Uploader�뿉�꽌�뒗 援щ텇�릺�뼱 �엳吏� �븡�쓬!
+	cds.cbData = sizeof(CFTPCopyDataParam);
+	cds.lpData = &upParam;
+
+	DWORD dwReturn = 0;
+	if(SendMessageTimeout(hWnd, WM_COPYDATA, NULL, (LPARAM)&cds, SMTO_NORMAL, 20000, (PDWORD_PTR)(dwReturn)) == FALSE)
+	{
+	}
+}
+  
+
+BOOL CGlassRawCPJT::SendMessageFTPUploadIndexFile( _grmGlassData* pGlassData )
+{  
+	if(pGlassData == NULL) 
+		return FALSE;
+
+	HWND hWnd = ::FindWindow(NULL, "FTPUploader");
+	if(hWnd == NULL) return FALSE;
+
+
+	char strServerFolder[256] = {};
+	char strServerFile[256] = {};
+	char strLocalFolder[256] = {};
+	char pLocalFile[256] = {}; 
+	char strRTMSFile[32] = {};
+	char strServerRawFileSubPath[256];
+	char strServer_SubFileName[256] = {};
+
+	GetFormatDescription(FTPCMD_INDEX, strServerFolder, strServerFile, strLocalFolder, pLocalFile, strRTMSFile, strServerRawFileSubPath, strServer_SubFileName, pGlassData);
+
+
+	// 	if(0)//test 
+	// 	{
+	// 		sprintf(strServerFolder, "HDD1/DIT/TestC");
+	// 		ServerFile = "ftptestfile.txt";
+	// 
+	// 		sprintf(strLocalFolder, "D:");
+	// 		pLocalFile = "ftptestfile.txt";
+	// 	}
+
+
+	CFTPCopyDataParam upParam;
+	strcpy(upParam.m_strServer_FolderName,			strServerFolder);
+	strcpy(upParam.m_strServer_FileName,			strServerFile);
+	strcpy(upParam.m_strLocal_FolderName,			strLocalFolder);
+	strcpy(upParam.m_strLocal_FileName,				pLocalFile);
+	strcpy(upParam.m_strServer_SignalFolderName,	"");
+	strcpy(upParam.m_strServer_SignalFileName,		"");
+	strcpy(upParam.m_strRTMS_FileName, "");
+	upParam.m_nCreateSignalFile							= FALSE;//m_ctrlCreateSignal.GetCheck();
+	upParam.m_nSendResultCode							= FALSE;//m_ctrlResultAck.GetCheck();
+	upParam.m_nProcessType								= CFTPCopyDataParam::FTPProcessType_UpFile;
+	// [C-PRJ] Image Upload Define - KHT (2020/11/19)
+	upParam.m_nDataType									= CFTPCopyDataParam::FTPDataType_Index;
+
+	COPYDATASTRUCT cds;
+	cds.dwData = CFTPCopyDataParam::FTPCopyDataCmd_RawUpload;
+	cds.cbData = sizeof(CFTPCopyDataParam);
+	cds.lpData = &upParam;
+
+	DWORD dwReturn = 0;
+	if(SendMessageTimeout(hWnd, WM_COPYDATA, NULL, (LPARAM)&cds, SMTO_NORMAL, 20000, (PDWORD_PTR)(dwReturn)) == FALSE)
+	{
+	}
+	return TRUE;
+}
+
+void CGlassRawCPJT::GetFormatDescription(emFTPCommand sort, char* pServerPath, char* pServerFile, char* pLocalPath, char* pLocalFile, char* pRTMSFile, char* pServerFileSubPath, char* pServerFileSubName, _grmGlassData* pGlassData) //taek 201211
+{  
+	CString strGlassID = pGlassData->m_strGlassID;
+	//For test
+	//if (strlen(strGlassID) == 0) strGlassID = "HPANELID";
+
+	CString strGlassIDLevel6th = strGlassID.Left(6);
+	CString strGlassIDLevel5th = strGlassID.Left(5);
+	CString strGlassIDLevel8th = strGlassID.Left(8);
+	
+	CString strLotID = pGlassData->m_strLotID;
+	CString strStepID = pGlassData->m_strStepID;
+	CString strProcessID = pGlassData->m_strProcessID;
+	//For test
+	//if (strlen(strStepID) == 0) strStepID = "F11112";
+
+	strLotID.MakeLower();
+	strStepID.MakeLower();
+	strGlassID.MakeLower();
+	strGlassIDLevel6th.MakeLower();
+	strProcessID.MakeLower();
+
+	switch(sort)
+	{ 
+	case FTPCMD_AOI_IMAGE:
+		{
+			if(strGlassID.GetLength() > 6)
+				sprintf(pServerPath, "\\%s\\%s\\%s\\%s\\", strProcessID, strStepID, strGlassIDLevel6th, strGlassID);
+			else
+				sprintf(pServerPath, "\\%s\\%s\\%s\\", strProcessID, strStepID, strGlassIDLevel6th);
+
+			sprintf(pLocalPath, "%s%s", LOCAL_AOI_IMAGE_PATH, strGlassID.GetBuffer(0));  
+			strcpy(pServerFile, "*.*");
+			strcpy(pLocalFile, "*.*");
+		}
+		break;
+	case FTPCMD_REVIEW_IMAGE: 
+		{
+			CTime time = m_tmFileCreateTime;
+
+			CString strTime = NULL;
+			CString strInsEndTime = NULL;
+
+			strTime = pGlassData->m_tmGlassLoading.Format("%Y%m%d%H%M%S");
+			strInsEndTime = pGlassData->m_tmInspectionEND.Format("%Y%m%d%H%M%S");
+
+			if (strGlassID.GetLength() > 6)
+				sprintf(pServerPath, "\\%s\\%s\\%s\\%s\\", strProcessID, strStepID, strGlassIDLevel6th, strGlassID);
+			else
+				sprintf(pServerPath, "\\%s\\%s\\%s\\", strProcessID, strStepID, strGlassIDLevel6th);
+
+			sprintf(pLocalPath, "%s%s_%s", LOCAL_REV_IMAGE_PATH, strGlassID.GetBuffer(0), strTime);
+			strcpy(pServerFile, "*.*");
+			strcpy(pLocalFile, "*.*");
+            //Result ini 由щ럭 �씠誘몄� path 梨꾩슦湲�
+            CString strRawFilePathName = NULL;
+            CString strLine = NULL;
+			CString strPath = NULL;
+            strRawFilePathName += LOCAL_RAWPATH_INFO_INI_PATH;
+            strRawFilePathName += RAWINFO_FILE_NAME;
+            FILE* pf = fopen(strRawFilePathName.GetBuffer(0), "a");
+			if(pf != NULL)
+            {
+				strLine = pServerPath;
+				strPath = strLine.Left(strLine.GetLength() - 1);
+            	fprintf(pf, "IMGPATH= Z:\%s\n", strPath.GetBuffer(0));
+            	fprintf(pf, "DISK=FILESERVER\n");
+				fclose(pf);
+			}
+
+			//RTMS 寃곌낵 �뙆�씪 �뾽濡쒕뱶
+			CString strRTMSPathFileName = NULL;
+			CString strRTMSFileName = NULL;
+
+			strRTMSFileName.Format("%s#%s#%04d%02d%02d%02d%02d%02d.Signal", pGlassData->m_strEquipID, pGlassData->m_strProductID, time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond());
+
+			strRTMSPathFileName += LOCAL_RTMS_INFO_PATH;
+			strRTMSPathFileName += strRTMSFileName;
+
+			// 			strRTMSFileName = strRawFilePath.Left(strRawFilePath.GetLength()-1); //taek 留덉�留� 媛� 鍮쇨퀬 媛��졇�삤湲� test
+
+			FILE* pfile = fopen(strRTMSPathFileName.GetBuffer(0), "a");
+
+			sprintf(pRTMSFile, "%s", strRTMSPathFileName); //taek 201211
+
+			if (pfile != NULL)
+			{
+				fprintf(pfile, "MODULE_ID = %s\n", pGlassData->m_strEquipID);
+				fprintf(pfile, "PRODUCT_ID = %s\n", pGlassData->m_strProductID);
+				fprintf(pfile, "PROCESS_ID = %s\n", pGlassData->m_strProcessID);
+				fprintf(pfile, "STEP_ID = %s\n", pGlassData->m_strStepID);
+				fprintf(pfile, "PANEL_ID = %s\n", pGlassData->m_strGlassID);
+				fprintf(pfile, "RESULT = *\n");
+				fprintf(pfile, "REASON_CODE = *\n");
+				fprintf(pfile, "RDP_PATH_RAW = \\cfq1raw1cai1coi%s\n", GetRawFilePath());
+				fprintf(pfile, "RDP_PATH_IMAGE = \\cfq1img1cai1coi%s\n", strLine.Left(strLine.GetLength() - 1));
+				fprintf(pfile, "INSP_TIME = %s\n", strInsEndTime);
+				fclose(pfile);
+			}
+		}
+		break;
+	case FTPCMD_RAW:   
+		{
+			CTime time = m_tmFileCreateTime;
+			SetRawFilePath("");
+
+			CString strFileName;//�뙆�씪�깮�꽦 �떆媛� �븣臾몄뿉 �뿬湲곗꽌 �젙�솗�븯寃� �뙆�씪紐� �떎�떆 �젙�젙
+			{
+				//Glass �젙蹂�
+				CTime CurrTime = m_tmFileCreateTime;
+				CString strTime;
+				strTime.Format(_T("%04d%02d%02d_%02d%02d%02d"),
+					CurrTime.GetYear(), CurrTime.GetMonth(), CurrTime.GetDay(), CurrTime.GetHour(), CurrTime.GetMinute(), CurrTime.GetSecond());
+				// �떆媛�, �솗�옣�옄 �뾾�빊 [11/20/2020 Server]
+				strFileName.Format("%s", pGlassData->m_strGlassID);
+				strFileName.MakeLower();
+			}
+			/*sprintf(pServerPath, "%s\\%04d%02d%02d\\%s\\%s\\%s\\Data", pGlassData->m_strEquipID, time.GetYear(), time.GetMonth(), time.GetDay(),
+				strGlassIDLevel5th.GetBuffer(0),
+				strGlassIDLevel8th.GetBuffer(0),
+				strGlassID.GetBuffer(0)); */
+		
+			//if (strGlassID.GetLength() > 6)
+			//	sprintf(pServerPath, "\\%s\\%s\\%s\\%s\\", strLotID, strStepID, strGlassIDLevel6th, strGlassID);
+			//else
+				sprintf(pServerPath, "\\%s\\%s\\%s\\", strProcessID, strStepID, strGlassIDLevel6th);
+			
+			sprintf(pLocalPath, "%s", pGlassData->m_strPath);
+
+			sprintf(pServerFile, "%s", strFileName.GetBuffer(0)); 
+			sprintf(pLocalFile, "%s", strFileName.GetBuffer(0)); 
+
+			CString strServerSubRawFilePath= NULL;
+			CString strServerSubRawFileName = NULL;
+			{
+				strServerSubRawFilePath += NETWORK_AOIRAWFILE_SUB_PATH;
+
+				CString strTime;
+				CTime CurrTime = m_tmFileCreateTime;
+				strTime.Format(_T("%04d%02d%02d_%02d%02d%02d"),
+					CurrTime.GetYear(), CurrTime.GetMonth(), CurrTime.GetDay(), CurrTime.GetHour(), CurrTime.GetMinute(), CurrTime.GetSecond());
+				// �떆媛�, �솗�옣�옄 �뾾�빊 [11/20/2020 Server]
+				strServerSubRawFileName.Format("\\%s_%s", pGlassData->m_strGlassID, strTime);
+				//strServerSubRawFilePath += strServerSubRawFileName;
+				BOOL bIsBDI = strcmp((pGlassData->m_strLine), _T("BDI")) == 0 ? TRUE : FALSE;  // BDI �씤 寃쎌슦 InspectorEnd �떆�뿉 SubFile �깮�꽦 [ 21-03-23 KJG ]
+				if (m_bReviewEndCheck || bIsBDI)  // InspectEnd �떆�뿉�뒗 SubFile 誘몄깮�꽦 蹂�寃� [ 21-03-18 KJG ] 
+				{
+					sprintf(pServerFileSubName, "%s", strServerSubRawFileName.GetBuffer(0));
+					sprintf(pServerFileSubPath, "%s", strServerSubRawFilePath.GetBuffer(0));
+				}
+				else
+				{
+					sprintf(pServerFileSubName, "%s", "");
+					sprintf(pServerFileSubPath, "%s", "");
+				}
+
+			}
+
+			//Result ini raw �뙆�씪�씠由�(path�룷�븿)write
+			CString strRawFilePathName = NULL;
+			CString strLine = NULL;
+			strRawFilePathName += LOCAL_RAWPATH_INFO_INI_PATH;
+			strRawFilePathName += RAWINFO_FILE_NAME;
+			FILE* pf = fopen(strRawFilePathName.GetBuffer(0), "w");
+			if(pf != NULL)
+			{
+				strLine = pServerPath + strFileName;
+				fprintf(pf, "[RESULT_PATH]\n");
+				fprintf(pf, "RAWPATH= X:\%s\n", strLine.GetBuffer(0));
+				SetRawFilePath(strLine.GetBuffer(0));
+				fprintf(pf, "SUMPATH= \n");
+				fclose(pf);
+			} 
+		}
+		break;
+	case FTPCMD_STACK:
+		{
+		//201218 CJH - Stack Download 寃쎈줈 �꽕�젙
+			sprintf(pServerPath, "\\stack\\%s\\%s\\%s", strProcessID,
+				strStepID, 
+				strGlassIDLevel6th.GetBuffer(0)); 
+
+			sprintf(pServerFile, "%s", 
+				strGlassID);
+
+			sprintf(pLocalPath, "%s", m_StackResult.getStackLocalPath()); 
+			sprintf(pLocalFile, "%s", strGlassID.GetBuffer(0)); 
+		}
+		break;
+		
+		case FTPCMD_MURA_IMAGE: //0404nwh
+		{	//
+			/*CTime time = m_tmFileCreateTime;
+			sprintf(pServerPath, "%s\\%04d%02d%02d\\%s\\%s\\%s\\Image", pGlassData->m_strEquipID, time.GetYear(), time.GetMonth(), time.GetDay(), 
+				strGlassIDLevel5th.GetBuffer(0), 
+				strGlassIDLevel8th.GetBuffer(0),
+				strGlassID.GetBuffer(0)); 
+				
+							sprintf(pLocalPath, "%s%s", LOCAL_MURA_IMAGE_PATH, strGlassID.GetBuffer(0));
+			strcpy(pServerFile, "*.*");
+			strcpy(pLocalFile, "*.*");*/
+		
+			if (strGlassID.GetLength() > 6)
+				sprintf(pServerPath, "\\%s\\%s\\%s\\%s\\", strProcessID, strStepID, strGlassIDLevel6th, strGlassID);
+			else
+				sprintf(pServerPath, "\\%s\\%s\\%s\\", strProcessID, strStepID, strGlassIDLevel6th);
+
+			sprintf(pLocalPath, "%s%s", LOCAL_MURA_IMAGE_PATH, strGlassID.GetBuffer(0)); 
+			strcpy(pServerFile, "*.*");
+			strcpy(pLocalFile, "*.*"); 
+		}
+		
+		break;
+	case FTPCMD_INDEX:
+		{
+			CTime time = m_tmFileCreateTime;
+			sprintf(pServerPath, "INDEX\\%s", pGlassData->m_strEquipID);
+			sprintf(pServerFile, "%04d%02d%02d_%s.csv", time.GetYear(), time.GetMonth(), time.GetDay(),	pGlassData->m_strStepID); 
+
+			sprintf(pLocalPath, "%s", LOCAL_INDEX_PATH); 
+			sprintf(pLocalFile, "%s", pServerFile); 
+		}
+		break;
+
+	case FTPCMD_LINK:   
+		{ 
+			CTime time = m_tmFileCreateTime;
+			CString strFileName;//�뙆�씪�깮�꽦 �떆媛� �븣臾몄뿉 �뿬湲곗꽌 �젙�솗�븯寃� �뙆�씪紐� �떎�떆 �젙�젙
+			{
+				//Glass �젙蹂�
+				CTime CurrTime = m_tmFileCreateTime;
+				CString strTime;
+				strTime.Format(_T("%04d%02d%02d_%02d%02d%02d"),
+					CurrTime.GetYear(), CurrTime.GetMonth(), CurrTime.GetDay(), CurrTime.GetHour(), CurrTime.GetMinute(), CurrTime.GetSecond());
+				strFileName.Format("%s_%s_%s.csv", pGlassData->m_strOperID, pGlassData->m_strGlassID, strTime.GetBuffer(0));
+			}
+			sprintf(pServerPath, "%s\\%s\\%s\\%s\\%s", "LINK", pGlassData->m_strEquipID, 
+				strGlassIDLevel5th.GetBuffer(0), 
+				strGlassIDLevel8th.GetBuffer(0),
+				strGlassID.GetBuffer(0)); 
+
+			sprintf(pLocalPath, "%s", pGlassData->m_strPath);
+
+			sprintf(pServerFile, "%s", strFileName.GetBuffer(0)); 
+			sprintf(pLocalFile, "%s", strFileName.GetBuffer(0)); 
+		}
+		break;
+	} 
+
+
+}
+ 
+
+
+CString CGlassRawCPJT::GetDefectInfoToString(emDefectMemberType nDefectInfoType, int nParam)
+{  
+	CString sStr;
+	switch(nDefectInfoType)
+	{
+	case DMT_DefectJudge:// Judge
+		{
+			switch (nParam)
+			{
+			case Judge_OK:			sStr.Format("OK");
+				break;
+			case Judge_RP:			sStr.Format("RP");
+				break;
+			case Judge_NG:			sStr.Format("NG");
+				break;
+			case Judge_TR:			sStr.Format("TR");
+				break;
+			case Judge_PR:			sStr.Format("PR");
+				break;
+			case Judge_PT:			sStr.Format("PT");
+				break;
+			case Judge_Review:		sStr.Format("RV");
+				break;
+			case Judge_RC:			sStr.Format("RC");
+				break;
+			case Judge_Size:		sStr.Format("SZ");
+				break;
+			case Judge_VI:			sStr.Format("VI");
+				break;
+			case Judge_Rework:		sStr.Format("RW");
+				break;
+			case Judge_Unknown:		sStr.Format("OK");//sStr.Format("Unknown");	//Unknown�룄 �씪�떒 OK
+				break;
+			default:				sStr.Format("OK");//sStr.Format("Ets");		
+				break;
+			}
+		}
+		break;
+
+	case DMT_DefectSizeType: 
+		{
+			sStr = "S";
+			switch(nParam)
+			{
+				//case SizeType_Unknown:	 sStr.Format("U");	break; 
+			case 1/*SizeType_Small*/:	 sStr.Format("S");
+				break; 
+			case 2/*SizeType_Mid*/:		 sStr.Format("M");
+				break; 
+			case 3/*SizeType_Large*/:	 sStr.Format("L");
+				break; 
+			case 4/*SizeType_Huge*/:		 sStr.Format("O");
+				break;
+				//case SizeType_Ultra:	 sStr.Format("Ultra");		break;
+				//default:				 sStr.Format("Ets");		break;
+			}
+		}
+		break;
+
+
+	}
+	return sStr;
+}
+
+CString CGlassRawCPJT::GetWsiDefectType(int nType)
+{
+	CString strDefectType=_T("");
+	switch (nType)
+	{
+	case 0:		 strDefectType.Format("normal");
+		break;
+	case 1:		 strDefectType.Format("metal");
+		break;
+	case 2:		 strDefectType.Format("huge");
+		break;
+	case 3:		 strDefectType.Format("diffuse");
+		break;
+	case 4:		 strDefectType.Format("trashy");
+		break;
+	}
+	return strDefectType;
+}
+

--
Gitblit v1.9.3