// ReviewRecipeEditorDlg.cpp : ±¸Çö ÆÄÀÏ // #include "stdafx.h" #include "ReviewRecipeEditor.h" #include "ReviewRecipeEditorDlg.h" #include "DlgCreateRecipe.h" #include "DlgLogin.h" #include "RMMInfoWriter.h" #include "atlconv.h" #ifdef _DEBUG #define new DEBUG_NEW #endif // CReviewRecipeEditorDlg ´ëÈ­ »óÀÚ CReviewRecipeEditorDlg::CReviewRecipeEditorDlg(CWnd* pParent /*=NULL*/) : CDialog(CReviewRecipeEditorDlg::IDD, pParent) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); m_pDlgRcpGlassInfo = NULL; m_pDlgCommon = NULL; m_pDlgReviewFilter = NULL; m_pDlgWSIFilter = NULL; m_pDlgMeasure = NULL; m_pDlgAlign = NULL; m_pDlgDefectFind = NULL; m_pRsReviewManager = NULL; m_pRsMeasureManager = NULL; m_pRsAlignManager = NULL; m_pRsGlassTypeInfoManager = NULL; m_pRsDefectFindManager = NULL; m_pSysSystemManager = NULL; m_pSysGlassTypeManager = NULL; m_strCurrentRecipeName = _T(""); m_bReviewSystemPC = TRUE; pReviewRecipeEditor = NULL; m_pDlgJudgement = NULL; } CReviewRecipeEditorDlg::~CReviewRecipeEditorDlg() { if(m_pDlgRcpGlassInfo) { delete m_pDlgRcpGlassInfo; m_pDlgRcpGlassInfo = NULL; } if(m_pDlgWSIFilter) { delete m_pDlgWSIFilter; m_pDlgWSIFilter = NULL; } if(m_pDlgReviewFilter) { delete m_pDlgReviewFilter; m_pDlgReviewFilter = NULL; } if(m_pDlgCommon) { delete m_pDlgCommon; m_pDlgCommon = NULL; } if(m_pDlgMeasure) { delete m_pDlgMeasure; m_pDlgMeasure = NULL; } if(m_pDlgAlign) { delete m_pDlgAlign; m_pDlgAlign = NULL; } if(m_pDlgDefectFind) { delete m_pDlgDefectFind; m_pDlgDefectFind = NULL; } if(m_pRsReviewManager) { delete m_pRsReviewManager; m_pRsReviewManager = NULL; } if(m_pRsMeasureManager) { delete m_pRsMeasureManager; m_pRsMeasureManager = NULL; } if(m_pRsAlignManager) { delete m_pRsAlignManager; m_pRsAlignManager = NULL; } if(m_pRsDefectFindManager) { delete m_pRsDefectFindManager; m_pRsDefectFindManager = NULL; } if(m_pRsGlassTypeInfoManager) { delete m_pRsGlassTypeInfoManager; m_pRsGlassTypeInfoManager = NULL; } if(m_pSysSystemManager) { delete m_pSysSystemManager; m_pSysSystemManager = NULL; } if(m_pSysGlassTypeManager) { delete m_pSysGlassTypeManager; m_pSysGlassTypeManager = NULL; } if (m_pDlgJudgement) { delete m_pDlgJudgement; m_pDlgJudgement = NULL; } } void CReviewRecipeEditorDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_GRID_RCP_EDITOR_RECIPE_LIST, m_ctrlGridRecipeList); DDX_Control(pDX, IDC_TAB_REVIEW_RCP_EDITOR_MAIN_TAB, m_ctrlTabMain); //DDX_Control(pDX, IDC_STATIC_SELECT_RCIPE, m_SelectedRecipe); DDX_Control(pDX, IDC_EDIT_SELECT_RCIPE, m_SelectedRecipe); } BEGIN_MESSAGE_MAP(CReviewRecipeEditorDlg, CDialog) ON_WM_PAINT() ON_WM_QUERYDRAGICON() //}}AFX_MSG_MAP ON_BN_CLICKED(IDC_BUTTON_REVIEW_RCP_EDITOR_CREATE, &CReviewRecipeEditorDlg::OnBnClickedButtonReviewRcpEditorCreate) ON_BN_CLICKED(IDC_BUTTON_REVIEW_RCP_EDITOR_DELETE, &CReviewRecipeEditorDlg::OnBnClickedButtonReviewRcpEditorDelete) ON_BN_CLICKED(IDC_BUTTON_REVIEW_RCP_EDITOR_LOAD, &CReviewRecipeEditorDlg::OnBnClickedButtonReviewRcpEditorLoad) ON_BN_CLICKED(IDC_BUTTON_REVIEW_RCP_EDITOR_SAVE, &CReviewRecipeEditorDlg::OnBnClickedButtonReviewRcpEditorSave) ON_BN_CLICKED(IDC_BUTTON_REVIEWRCP_EDITOR_EXIT, &CReviewRecipeEditorDlg::OnBnClickedButtonReviewrcpEditorExit) ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_REVIEW_RCP_EDITOR_MAIN_TAB, &CReviewRecipeEditorDlg::OnTcnSelchangeTabReviewRcpEditorMainTab) ON_NOTIFY(NM_DBLCLK, IDC_GRID_RCP_EDITOR_RECIPE_LIST, &CReviewRecipeEditorDlg::OnGridDblClick) ON_STN_CLICKED(IDC_STATIC_SELECT_RCIPE, &CReviewRecipeEditorDlg::OnStnClickedStaticSelectRcipe) ON_WM_COPYDATA() END_MESSAGE_MAP() // CReviewRecipeEditorDlg ¸Þ½ÃÁö 󸮱â BOOL CReviewRecipeEditorDlg::OnInitDialog() { CDialog::OnInitDialog(); // ÀÌ ´ëÈ­ »óÀÚÀÇ ¾ÆÀÌÄÜÀ» ¼³Á¤ÇÕ´Ï´Ù. ÀÀ¿ë ÇÁ·Î±×·¥ÀÇ ÁÖ Ã¢ÀÌ ´ëÈ­ »óÀÚ°¡ ¾Æ´Ò °æ¿ì¿¡´Â // ÇÁ·¹ÀÓ¿öÅ©°¡ ÀÌ ÀÛ¾÷À» ÀÚµ¿À¸·Î ¼öÇàÇÕ´Ï´Ù. SetIcon(m_hIcon, TRUE); // Å« ¾ÆÀÌÄÜÀ» ¼³Á¤ÇÕ´Ï´Ù. SetIcon(m_hIcon, FALSE); // ÀÛÀº ¾ÆÀÌÄÜÀ» ¼³Á¤ÇÕ´Ï´Ù. // TODO: ¿©±â¿¡ Ãß°¡ ÃʱâÈ­ ÀÛ¾÷À» Ãß°¡ÇÕ´Ï´Ù. //m_bReviewSystemPC = IsReviewSystemPC(); m_bReviewSystemPC = TRUE; pReviewRecipeEditor = this; if(m_bReviewSystemPC) { CreateReviewRecipeDirectory(); } ReadReviewSystemConfigFile(); CreateManager(); CreateTabDlg(); InitTabControl(); InitRecipeListGridControl(); RefreshRecipeList(); return TRUE; // Æ÷Ä¿½º¸¦ ÄÁÆ®·Ñ¿¡ ¼³Á¤ÇÏÁö ¾ÊÀ¸¸é TRUE¸¦ ¹ÝȯÇÕ´Ï´Ù. } // ´ëÈ­ »óÀÚ¿¡ ÃÖ¼ÒÈ­ ´ÜÃ߸¦ Ãß°¡ÇÒ °æ¿ì ¾ÆÀÌÄÜÀ» ±×¸®·Á¸é // ¾Æ·¡ Äڵ尡 ÇÊ¿äÇÕ´Ï´Ù. ¹®¼­/ºä ¸ðµ¨À» »ç¿ëÇÏ´Â MFC ÀÀ¿ë ÇÁ·Î±×·¥ÀÇ °æ¿ì¿¡´Â // ÇÁ·¹ÀÓ¿öÅ©¿¡¼­ ÀÌ ÀÛ¾÷À» ÀÚµ¿À¸·Î ¼öÇàÇÕ´Ï´Ù. void CReviewRecipeEditorDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // ±×¸®±â¸¦ À§ÇÑ µð¹ÙÀ̽º ÄÁÅØ½ºÆ® SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); // Ŭ¶óÀÌ¾ðÆ® »ç°¢Çü¿¡¼­ ¾ÆÀÌÄÜÀ» °¡¿îµ¥¿¡ ¸ÂÃä´Ï´Ù. int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // ¾ÆÀÌÄÜÀ» ±×¸³´Ï´Ù. dc.DrawIcon(x, y, m_hIcon); } else { CDialog::OnPaint(); } } // »ç¿ëÀÚ°¡ ÃÖ¼ÒÈ­µÈ âÀ» ²ô´Â µ¿¾È¿¡ Ä¿¼­°¡ Ç¥½ÃµÇµµ·Ï ½Ã½ºÅÛ¿¡¼­ // ÀÌ ÇÔ¼ö¸¦ È£ÃâÇÕ´Ï´Ù. HCURSOR CReviewRecipeEditorDlg::OnQueryDragIcon() { return static_cast(m_hIcon); } void CReviewRecipeEditorDlg::OnBnClickedButtonReviewRcpEditorCreate() { // TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù. BOOL bUseRecipeInfo = FALSE; int nIdx; CString strRecipeName, strNewRecipeName, strMessage; CString strSrcPath, strNewPath, strTemp; CCellID cellID = m_ctrlGridRecipeList.GetFocusCell(); if(cellID.row > 0 && cellID.col > 0) { strRecipeName = m_ctrlGridRecipeList.GetItemText(cellID.row, 1); strMessage.Format(_T("Do you want to create new recipe using %s recipe information?"), strRecipeName);//_T("%s ·¹½ÃÇÇ Á¤º¸¸¦ ÀÌ¿ëÇÏ¿© »ý¼ºÇϽðڽÀ´Ï±î?"), strRecipeName); //if (IDYES == AfxMessageBox(strMessage, MB_YESNO | MB_ICONQUESTION)) //{ bUseRecipeInfo = TRUE; //} } if (CreateRecipe(strNewRecipeName) == FALSE) { return; } if (GetRecipeValidityCheck(strNewRecipeName, strMessage) != TRUE) { AfxMessageBox(strMessage); return; } if(m_bReviewSystemPC) { strNewPath.Format(_T("%s\\%s.rcp"), _REVIEW_RECIPE_PATH_, strNewRecipeName); } else { strTemp.Format(_T("%s\\%s.rcp"), _REVIEW_RECIPE_PATH_, strNewRecipeName); nIdx = strTemp.Find(_T("\\")); if(nIdx != -1) { strTemp = strTemp.Mid(nIdx + 1); strNewPath.Format(_T("\\\\%s\\C\\%s"), NETIP_A2E_REVIEW_SYSTEM, strTemp); } else { strNewPath.Format(_T("\\\\%s\\C\\DIT_Review\\Recipe\\%s.rcp"), NETIP_A2E_REVIEW_SYSTEM, strNewRecipeName); } } if(bUseRecipeInfo) { if(m_bReviewSystemPC) { strSrcPath.Format(_T("%s\\%s.rcp"), _REVIEW_RECIPE_PATH_, strRecipeName); } else { strTemp.Format(_T("%s\\%s.rcp"), _REVIEW_RECIPE_PATH_, strRecipeName); nIdx = strTemp.Find(_T("\\")); if(nIdx != -1) { strTemp = strTemp.Mid(nIdx + 1); strSrcPath.Format(_T("\\\\%s\\C\\%s"), NETIP_A2E_REVIEW_SYSTEM, strTemp); } else { strSrcPath.Format(_T("\\\\%s\\C\\DIT_Review\\Recipe\\%s.rcp"), NETIP_A2E_REVIEW_SYSTEM, strRecipeName); } } if(CopyFile(strSrcPath, strNewPath, FALSE) == FALSE) { strMessage.Format(_T("Fail to create %s recipe"));//_T("%s ·¹½ÃÇÇ »ý¼º ½ÇÆÐ!")); AfxMessageBox(strMessage); } else { //LYW_#3344_CF AOI Review Config File ¹é¾÷ ±â´É °³¼± ADD START CString strBackupPath = _REVIEW_RECIPE_BACKUP_PATH_CPJT; CreateDirectory(strBackupPath, NULL); // set backup file CString strBackupFile = _T(""); CString strSource, strDest; strSource.Format(_T("%s\\%s.rcp"), _REVIEW_RECIPE_PATH_, strNewRecipeName); strDest.Format(_T("%s\\%s.rcp"), strBackupPath, strNewRecipeName); CopyFile(strSource, strDest, TRUE); //LYW_#3344_CF AOI Review Config File ¹é¾÷ ±â´É °³¼± ADD END // [2017:4:17]-[WEZASW] : CIM(Recipe) º¸°í Ç׸ñ Ãß°¡. COPYDATA_RECIPE2REV copyData; copyData.Message = MsgRecipe2Rev_RecipeCreate; copyData.nPPID = _ttoi(strNewRecipeName); this->SendData2ReviewSystem(©Data); } } else { CFile file; if(file.Open(strNewPath, CFile::modeCreate | CFile::modeWrite) == FALSE) { strMessage.Format(_T("Fail to create %s recipe"));//_T("%s ·¹½ÃÇÇ »ý¼º ½ÇÆÐ!")); AfxMessageBox(strMessage); } else { strMessage.Format(_T("Please select the default file!"));//_T("¸ÕÀú ±âº» ÆÄÀÏÀ» ¼±ÅÃÇØÁÖ¼¼¿ä!")); AfxMessageBox(strMessage); } file.Close(); } RefreshRecipeList(); CRMMInfoWriter rmmInfoWriter; int nMachineType = m_pDlgReviewFilter->GetMachineType(); rmmInfoWriter.WriteRmm(nMachineType); } BOOL CReviewRecipeEditorDlg::CreateRecipe(CString& strNewRecipeName) { CDlgCreateRecipe createRecipeDlg; if(IDOK == createRecipeDlg.DoModal()) { strNewRecipeName = createRecipeDlg.m_strRecipeName; return TRUE; } else { strNewRecipeName = _T("default"); return FALSE; } } void CReviewRecipeEditorDlg::OnBnClickedButtonReviewRcpEditorDelete() { // TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù. int nIdx; CString strRecipeName, strPath, strMessage, strTemp; CCellID cellID = m_ctrlGridRecipeList.GetFocusCell(); if (cellID.row > 0 && cellID.col > 0) { strRecipeName = m_ctrlGridRecipeList.GetItemText(cellID.row, 1); if (m_bReviewSystemPC) { strPath.Format(_T("%s\\%s.rcp"), _REVIEW_RECIPE_PATH_, strRecipeName); } else { strTemp.Format(_T("%s\\%s.rcp"), _REVIEW_RECIPE_PATH_, strRecipeName); nIdx = strTemp.Find(_T("\\")); if (nIdx != -1) { strTemp = strTemp.Mid(nIdx + 1); strPath.Format(_T("\\\\%s\\C\\%s"), NETIP_A2E_REVIEW_SYSTEM, strTemp); } else { strPath.Format(_T("\\\\%s\\C\\DIT_Review\\Recipe\\%s.rcp"), NETIP_A2E_REVIEW_SYSTEM, strRecipeName); } } //_T("%s ·¹½ÃÇǸ¦ »èÁ¦ÇϽðڽÀ´Ï±î?"), strRecipeName); strMessage.Format(_T("Do you want to delete %s recipe?"), strRecipeName); if (IDYES == AfxMessageBox(strMessage, MB_YESNO | MB_ICONQUESTION)) { // [2017:5:20]-[WEZASW] : ÇöÀç Àû¿ëµÈ Recipe(PPID)´Â »èÁ¦ ±ÝÁö ¿äû. if (strRecipeName.Compare(m_strCurrentRecipeName) == 0) { strMessage.Format(_T("Currently applied Recipe(%s) can not be deleted!"), strRecipeName); AfxMessageBox(strMessage); return; } DeleteFile(strPath); //LYW_#3344_CF AOI Review Config File ¹é¾÷ ±â´É °³¼± ADD START CString strBackupPath = _REVIEW_RECIPE_BACKUP_PATH_CPJT; CString strDest; strDest.Format(_T("%s\\%s.rcp"), strBackupPath, strRecipeName); DeleteFile(strDest); //LYW_#3344_CF AOI Review Config File ¹é¾÷ ±â´É °³¼± ADD END // [2017:4:17]-[WEZASW] : CIM(Recipe) º¸°í Ç׸ñ Ãß°¡. COPYDATA_RECIPE2REV copyData; copyData.Message = MsgRecipe2Rev_RecipeDelete; copyData.nPPID = _ttoi(strRecipeName); this->SendData2ReviewSystem(©Data); } } else { AfxMessageBox(_T("Please select recipe."));//_T("·¹½ÃÇǸ¦ ¼±ÅÃÇϼ¼¿ä.")); } RefreshRecipeList(); CRMMInfoWriter rmmInfoWriter; int nMachineType = m_pDlgReviewFilter->GetMachineType(); rmmInfoWriter.WriteRmm(nMachineType); } void CReviewRecipeEditorDlg::OnBnClickedButtonReviewRcpEditorLoad() { // TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù. BOOL bReturn; CString strRecipeName; CCellID cellID = m_ctrlGridRecipeList.GetFocusCell(); if(cellID.row > 0 && cellID.col > 0) { strRecipeName = m_ctrlGridRecipeList.GetItemText(cellID.row, 1); bReturn = ReadRecipeFile(strRecipeName); if(TRUE == bReturn) { m_strCurrentRecipeName = strRecipeName; // [2017:4:17]-[WEZASW] : CIM(Recipe) º¸°í Ç׸ñ Ãß°¡. COPYDATA_RECIPE2REV copyData; copyData.Message = MsgRecipe2Rev_RecipeChange; copyData.nPPID = _ttoi(m_strCurrentRecipeName); this->SendData2ReviewSystem(©Data); } else { m_strCurrentRecipeName = _T(""); } UpdateTabDialogData(); } else { AfxMessageBox(_T("Please select recipe."));//_T("·¹½ÃÇǸ¦ ¼±ÅÃÇϼ¼¿ä.")); } } COPYDATA_RECIPE2REV* CReviewRecipeEditorDlg::GetRecipe2ReviewData() { return &m_DataRecipe2Rev; } BOOL CReviewRecipeEditorDlg::SendData2ReviewSystem(COPYDATA_RECIPE2REV* pData) { HWND hWnd = ::FindWindow(NULL, _REVIEW_SYSTEM_TITLE_); if (hWnd && pData) { COPYDATASTRUCT cds; cds.dwData = COPYDATA_RECIPEEDITOR2REVIEWSYSTEM; cds.cbData = sizeof(COPYDATA_RECIPE2REV); cds.lpData = pData; ::SendMessage(hWnd, WM_COPYDATA, 0, (LPARAM)(LPVOID)&cds); return TRUE; } return FALSE; } void CReviewRecipeEditorDlg::ReviewRcpEditorSave(CString RecipeName) { CString strMessage; if (RecipeName.IsEmpty()) { AfxMessageBox(_T("Seleted recipe is not exist.")); } else { BOOL bRet; CString strMessage; bRet = SaveRecipeFile(RecipeName); if (bRet) { // [2017:4:17]-[WEZASW] : CIM(Recipe) º¸°í Ç׸ñ Ãß°¡. COPYDATA_RECIPE2REV copyData; copyData.Message = MsgRecipe2Rev_RecipeModify; copyData.nPPID = _ttoi(RecipeName); this->SendData2ReviewSystem(©Data); CString strBackupPath = _REVIEW_RECIPE_BACKUP_PATH_; CreateDirectory(strBackupPath, NULL); // set backup file CString strBackupFile = _T(""); CTime time = CTime::GetCurrentTime(); strBackupFile.Format(_T("%04d-%02d-%02d_%02d-%02d-%02d"), time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond()); // file copy to backup path // strBackupFile = strBackupPath + m_strCurrentRecipeName + strBackupFile; CString strSource, strDest; strSource.Format(_T("%s\\%s.rcp"), _REVIEW_RECIPE_PATH_, RecipeName); strDest.Format(_T("%s\\%s_%s.rcp"), strBackupPath, RecipeName, strBackupFile); CopyFile(strSource, strDest, TRUE); //LYW_#3344_CF AOI Review Config File ¹é¾÷ ±â´É °³¼± ADD START strBackupPath = _REVIEW_RECIPE_BACKUP_PATH_CPJT; CreateDirectory(strBackupPath, NULL); strSource.Format(_T("%s\\%s.rcp"), _REVIEW_RECIPE_PATH_, RecipeName); strDest.Format(_T("%s\\%s.rcp"), strBackupPath, RecipeName); CopyFile(strSource, strDest, TRUE); //LYW_#3344_CF AOI Review Config File ¹é¾÷ ±â´É °³¼± ADD END strMessage.Format(_T("Complete to save %s recipe!"), RecipeName); //AfxMessageBox(strMessage); } else { strMessage.Format(_T("Fail to save %s recipe!"), RecipeName); //AfxMessageBox(strMessage); } RefreshRecipeList(); } } void CReviewRecipeEditorDlg::OnBnClickedButtonReviewRcpEditorSave() { // TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù. CString strMessage; if (m_strCurrentRecipeName.IsEmpty()) { AfxMessageBox(_T("Seleted recipe is not exist.")); } else { BOOL bRet; CString strMessage; bRet = SaveRecipeFile(m_strCurrentRecipeName); if (bRet) { // [2017:4:17]-[WEZASW] : CIM(Recipe) º¸°í Ç׸ñ Ãß°¡. COPYDATA_RECIPE2REV copyData; copyData.Message = MsgRecipe2Rev_RecipeModify; copyData.nPPID = _ttoi(m_strCurrentRecipeName); this->SendData2ReviewSystem(©Data); CString strBackupPath = _REVIEW_RECIPE_BACKUP_PATH_; CreateDirectory(strBackupPath, NULL); // set backup file CString strBackupFile = _T(""); CTime time = CTime::GetCurrentTime(); strBackupFile.Format(_T("%04d-%02d-%02d_%02d-%02d-%02d"), time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond()); // file copy to backup path // strBackupFile = strBackupPath + m_strCurrentRecipeName + strBackupFile; CString strSource, strDest; strSource.Format(_T("%s\\%s.rcp"), _REVIEW_RECIPE_PATH_, m_strCurrentRecipeName); strDest.Format(_T("%s\\%s_%s.rcp"), strBackupPath, m_strCurrentRecipeName, strBackupFile); CopyFile(strSource, strDest, TRUE); //LYW_#3344_CF AOI Review Config File ¹é¾÷ ±â´É °³¼± ADD START strBackupPath = _REVIEW_RECIPE_BACKUP_PATH_CPJT; CreateDirectory(strBackupPath, NULL); strSource.Format(_T("%s\\%s.rcp"), _REVIEW_RECIPE_PATH_, m_strCurrentRecipeName); strDest.Format(_T("%s\\%s.rcp"), strBackupPath, m_strCurrentRecipeName); CopyFile(strSource, strDest, FALSE); //LYW_#3344_CF AOI Review Config File ¹é¾÷ ±â´É °³¼± ADD END strMessage.Format(_T("Complete to save %s recipe!"), m_strCurrentRecipeName); AfxMessageBox(strMessage); } else { strMessage.Format(_T("Fail to save %s recipe!"), m_strCurrentRecipeName); AfxMessageBox(strMessage); } RefreshRecipeList(); } CRMMInfoWriter rmmInfoWriter; int nMachineType = m_pDlgReviewFilter->GetMachineType(); if (rmmInfoWriter.WriteRmm(nMachineType) == FALSE) { strMessage.Format(_T("Fail to save RMM INFO!")); AfxMessageBox(strMessage); } } void CReviewRecipeEditorDlg::OnBnClickedButtonReviewrcpEditorExit() { // TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù. DestroyWindow(); } void CReviewRecipeEditorDlg::CreateReviewRecipeDirectory() { CreateDirectory(_REVIEW_BASE_PATH_, NULL); CreateDirectory(_REVIEW_RECIPE_PATH_, NULL); } void CReviewRecipeEditorDlg::CreateManager() { m_pRsReviewManager = new CRcp_RsReviewManager; m_pRsMeasureManager = new CRcp_RsMeasureManager; m_pRsAlignManager = new CRcp_RsAlignManager; m_pRsDefectFindManager = new CRcp_RsDefectFindManager; m_pRsGlassTypeInfoManager = new CRcp_RsGlassTypeInfoManager; } void CReviewRecipeEditorDlg::CreateTabDlg() { CRect rtCtrl; m_ctrlTabMain.GetWindowRect(&rtCtrl); ScreenToClient(&rtCtrl); rtCtrl.DeflateRect(2, 22, 3, 2); m_pDlgCommon = new CDlgCommon; m_pDlgCommon->Create(CDlgCommon::IDD, this); m_pDlgCommon->MoveWindow(rtCtrl); m_pDlgCommon->ShowWindow(SW_SHOW); m_pDlgReviewFilter = new CDlgReview(0, m_pSysSystemManager->GetSystemInfo()->m_nMachineType); m_pDlgReviewFilter->Create(CDlgReview::IDD, this); m_pDlgReviewFilter->MoveWindow(rtCtrl); m_pDlgWSIFilter = new CDlgReview(1, m_pSysSystemManager->GetSystemInfo()->m_nMachineType); m_pDlgWSIFilter->Create(CDlgReview::IDD, this); m_pDlgWSIFilter->MoveWindow(rtCtrl); m_pDlgMeasure = new CDlgMeasure; m_pDlgMeasure->Create(CDlgMeasure::IDD, this); m_pDlgMeasure->MoveWindow(rtCtrl); m_pDlgAlign = new CDlgAlign; m_pDlgAlign->Create(CDlgAlign::IDD, this); m_pDlgAlign->MoveWindow(rtCtrl); m_pDlgDefectFind = new CDlgDefectFind; m_pDlgDefectFind->Create(CDlgDefectFind::IDD, this); m_pDlgDefectFind->MoveWindow(rtCtrl); m_pDlgRcpGlassInfo = new CDlgRcpGlassInfo; m_pDlgRcpGlassInfo->Create(CDlgRcpGlassInfo::IDD, this); m_pDlgRcpGlassInfo->MoveWindow(rtCtrl); m_pDlgJudgement = new CDlgJudgement; m_pDlgJudgement->Create(CDlgJudgement::IDD, this); m_pDlgJudgement->MoveWindow(rtCtrl); } void CReviewRecipeEditorDlg::InitTabControl() { int nIdx = 0; m_ctrlTabMain.InsertItem(nIdx++, _T("Common")); //_T(" °øÅë ")); m_ctrlTabMain.InsertItem(nIdx++, _T("Review")); //_T(" ¸®ºä ")); m_ctrlTabMain.InsertItem(nIdx++, _T("WSI")); //_T(" WSI ")); m_ctrlTabMain.InsertItem(nIdx++, _T("Align")); //_T(" ¾ó¶óÀÎ ")); m_ctrlTabMain.InsertItem(nIdx++, _T("Judgement")); //_T(" ÆÇÁ¤ ")); // ¹Ì»ç¿ëÀ¸·Î Á¦¿Ü // m_ctrlTabMain.InsertItem(nIdx++, _T("Measure")); //_T(" ÃøÁ¤ ")); // m_ctrlTabMain.InsertItem(nIdx++, _T("Finding Defect")); //_T(" °áÇÔã±â ")); //m_ctrlTabMain.InsertItem(nIdx++, _T("Glass")); //_T(" Glass Info ")); } void CReviewRecipeEditorDlg::InitRecipeListGridControl() { int nRowIdx, nColIdx, nRows, nCols, nFixRows, nFixCols; CString strTemp; CRect rect; GV_ITEM Item; nRows = RECIPE_LIST_GRID_ROW_COUNT; nCols = RECIPE_LIST_GRID_COL_COUNT; nFixRows = 1; nFixCols = 1; nRowIdx = 0; nColIdx = 0; m_ctrlGridRecipeList.GetWindowRect(&rect); m_ctrlGridRecipeList.GetDefaultCell(FALSE, FALSE)->SetBackClr(RGB(0xFF, 0xFF, 0xE0)); m_ctrlGridRecipeList.SetRowCount(nRows); m_ctrlGridRecipeList.SetColumnCount(nCols); m_ctrlGridRecipeList.SetFixedRowCount(nFixRows); m_ctrlGridRecipeList.SetFixedColumnCount(nFixCols); m_ctrlGridRecipeList.SetColumnWidth(nColIdx++, 50); m_ctrlGridRecipeList.SetColumnWidth(nColIdx++, 150); m_ctrlGridRecipeList.SetColumnWidth(nColIdx++, rect.Width() - 205); m_ctrlGridRecipeList.SetEditable(FALSE); m_ctrlGridRecipeList.SetListMode(TRUE); nColIdx = 0; Item.mask = GVIF_TEXT; Item.row = nRowIdx; Item.col = nColIdx++; strTemp.Format(_T("Index"));//_T("À妽º")); Item.strText = strTemp; m_ctrlGridRecipeList.SetItem(&Item); Item.row = nRowIdx; Item.col = nColIdx++; strTemp.Format(_T("Recipe Name"));//_T("·¹½ÃÇÇ À̸§")); Item.strText = strTemp; m_ctrlGridRecipeList.SetItem(&Item); Item.row = nRowIdx; Item.col = nColIdx++; strTemp.Format(_T("Last Modified Date"));//_T("ÃÖÁ¾ ¼öÁ¤ ³¯Â¥")); Item.strText = strTemp; m_ctrlGridRecipeList.SetItem(&Item); } void CReviewRecipeEditorDlg::RefreshRecipeList() { GV_ITEM Item; int i, nRecipeCount, nRowIdx, nColIdx; CCellRange cellRange; CString strTemp; CStringArray strArrayRecipeName, strArrayLastWriteTime; FindRecipeFile(strArrayRecipeName, strArrayLastWriteTime); nRowIdx = 1; nRecipeCount = (int)strArrayRecipeName.GetCount(); if(nRecipeCount > 0) { cellRange = m_ctrlGridRecipeList.GetSelectedCellRange(); m_ctrlGridRecipeList.SetRowCount(nRecipeCount + 1); for(i = 0; i < nRecipeCount; i++) { //·¹½ÃÇÇ À妽º nColIdx = 0; Item.mask = GVIF_TEXT; Item.row = nRowIdx; Item.col = nColIdx; strTemp.Format(_T("%02d"), i); Item.strText = strTemp; m_ctrlGridRecipeList.SetItem(&Item); //·¹½ÃÇÇ À̸§ nColIdx++; strTemp = strArrayRecipeName.GetAt(i); m_ctrlGridRecipeList.SetItemText(nRowIdx, nColIdx, strTemp); m_ctrlGridRecipeList.SetItemState(nRowIdx, nColIdx, GVIS_READONLY); //ÃÖÁ¾ ¼öÁ¤ ³¯Â¥ nColIdx++; strTemp = strArrayLastWriteTime.GetAt(i); m_ctrlGridRecipeList.SetItemText(nRowIdx, nColIdx, strTemp); m_ctrlGridRecipeList.SetItemState(nRowIdx, nColIdx, GVIS_READONLY); m_ctrlGridRecipeList.RedrawRow(nRowIdx); nRowIdx++; } m_ctrlGridRecipeList.SetSelectedRange(cellRange); } } void CReviewRecipeEditorDlg::FindRecipeFile(CStringArray& strArrayRecipeName, CStringArray& strArrayLastWriteTime) { BOOL bReturn; int nIdx; CTime timeLastWrite; CFileFind finder; CString strSearchPath, strRecipeName, strLastWriteTime, strTemp; if(m_bReviewSystemPC) { strSearchPath.Format(_T("%s\\*.rcp"), _REVIEW_RECIPE_PATH_); } else { strTemp.Format(_T("%s\\*.rcp"), _REVIEW_RECIPE_PATH_); nIdx = strTemp.Find(_T("\\")); if(nIdx != -1) { strTemp = strTemp.Mid(nIdx + 1); strSearchPath.Format(_T("\\\\%s\\C\\%s"), NETIP_A2E_REVIEW_SYSTEM, strTemp); } else { strSearchPath.Format(_T("\\\\%s\\C\\DIT_Review\\Recipe\\*.rcp"), NETIP_A2E_REVIEW_SYSTEM); } } bReturn = finder.FindFile(strSearchPath); BOOL wrongRecipe = FALSE; while(bReturn) { wrongRecipe = FALSE; bReturn = finder.FindNextFile(); if(finder.IsDots()) continue; if(finder.IsDirectory()) continue; strRecipeName = finder.GetFileTitle(); //181213 /*for (int i = 0; i < strRecipeName.GetLength(); i++) { if (strRecipeName.GetAt(i) < '0' || strRecipeName.GetAt(i) > '9') { wrongRecipe = TRUE; break; } } if (wrongRecipe == TRUE) { if (strRecipeName != _T("Default")) continue; }*/ finder.GetLastWriteTime(timeLastWrite); strLastWriteTime.Format(_T("%04d-%02d-%02d[%02d:%02d:%02d]"), timeLastWrite.GetYear(), timeLastWrite.GetMonth(), timeLastWrite.GetDay(), timeLastWrite.GetHour(), timeLastWrite.GetMinute(), timeLastWrite.GetSecond()); strArrayRecipeName.Add(strRecipeName); strArrayLastWriteTime.Add(strLastWriteTime); } finder.Close(); } BOOL CReviewRecipeEditorDlg::ReadRecipeFile(CString strRecipeName) { BOOL bReturn = TRUE; int nIdx; CString strPath, strTemp; if(m_bReviewSystemPC) { strPath.Format(_T("%s\\%s.rcp"), _REVIEW_RECIPE_PATH_, strRecipeName); } else { strTemp.Format(_T("%s\\%s.rcp"), _REVIEW_RECIPE_PATH_, strRecipeName); nIdx = strTemp.Find(_T("\\")); if(nIdx != -1) { strTemp = strTemp.Mid(nIdx + 1); strPath.Format(_T("\\\\%s\\C\\%s"), NETIP_A2E_REVIEW_SYSTEM, strTemp); } else { strPath.Format(_T("\\\\%s\\C\\DIT_Review\\Recipe\\%s.rcp"), NETIP_A2E_REVIEW_SYSTEM, strRecipeName); } } CMacroFile macroFile; macroFile.Clear(); if (FALSE == macroFile.Read(strPath)) { TRACE(_T("CRecipeEditorDlg::ReadRecipeFile() fail to read recipe file\n")); bReturn = FALSE; } else { if(m_pRsReviewManager) { m_pRsReviewManager->GetProfile(macroFile); } if(m_pRsMeasureManager) { m_pRsMeasureManager->GetProfile(macroFile); } if(m_pRsAlignManager) { m_pRsAlignManager->GetProfile(macroFile); } if(m_pRsDefectFindManager) { m_pRsDefectFindManager->GetProfile(macroFile); } if(m_pRsGlassTypeInfoManager) { m_pRsGlassTypeInfoManager->GetProfile(macroFile); } } return bReturn; } BOOL CReviewRecipeEditorDlg::SaveRecipeFile(CString strRecipeName) { BOOL bReturn = TRUE; int nIdx; CString strPath, strTemp; CMacroFile macroFile; macroFile.Clear(); if(m_pRsReviewManager) { m_pRsReviewManager->SetProfile(macroFile); } if(m_pRsMeasureManager) { m_pRsMeasureManager->SetProfile(macroFile); } if(m_pRsAlignManager) { m_pRsAlignManager->SetProfile(macroFile); } if(m_pRsDefectFindManager) { m_pRsDefectFindManager->SetProfile(macroFile); } if(m_pRsGlassTypeInfoManager) { m_pRsGlassTypeInfoManager->SetProfile(macroFile); } if(m_bReviewSystemPC) { strPath.Format(_T("%s\\%s.rcp"), _REVIEW_RECIPE_PATH_, strRecipeName); } else { strTemp.Format(_T("%s\\%s.rcp"), _REVIEW_RECIPE_PATH_, strRecipeName); nIdx = strTemp.Find(_T("\\")); if(nIdx != -1) { strTemp = strTemp.Mid(nIdx + 1); strPath.Format(_T("\\\\%s\\C\\%s"), NETIP_A2E_REVIEW_SYSTEM, strTemp); } else { strPath.Format(_T("\\\\%s\\C\\DIT_Review\\Recipe\\%s.rcp"), NETIP_A2E_REVIEW_SYSTEM, strRecipeName); } } bReturn = macroFile.Write(strPath); return bReturn; } void CReviewRecipeEditorDlg::UpdateTabDialogData() { if(m_pDlgCommon) { m_pDlgCommon->UpdateDialogData(); } if(m_pDlgReviewFilter) { m_pDlgReviewFilter->UpdateDialogData(0); } if(m_pDlgWSIFilter) { m_pDlgWSIFilter->UpdateDialogData(1); } if(m_pDlgMeasure) { m_pDlgMeasure->UpdateDialogData(); } if(m_pDlgAlign) { m_pDlgAlign->UpdateDialogData(); } if(m_pDlgDefectFind) { m_pDlgDefectFind->UpdateDialogData(); } if(m_pDlgRcpGlassInfo) { m_pDlgRcpGlassInfo->UpdateDialogData(); } if (m_pDlgJudgement) { m_pDlgJudgement->UpdateDialogData(); } } BOOL CReviewRecipeEditorDlg::ReadReviewSystemConfigFile() { BOOL bReturn = TRUE; int nIdx; CString strPath, strTemp; if(m_bReviewSystemPC) { strPath = _REVIEW_SERVER_SYSTEM_SETTING_FILE_PATH_; } else { strTemp = _REVIEW_SERVER_SYSTEM_SETTING_FILE_PATH_; nIdx = strTemp.Find(_T("\\")); if(nIdx != -1) { strTemp = strTemp.Mid(nIdx + 1); strPath.Format(_T("\\\\%s\\C\\%s"), NETIP_A2E_REVIEW_SYSTEM, strTemp); } else { strPath.Format(_T("\\\\%s\\C\\DIT_Review\\ReviewServerConfig\\SystemSetting.cfg"), NETIP_A2E_REVIEW_SYSTEM); } } CMacroFile macroFile; macroFile.Clear(); if (FALSE == macroFile.Read(strPath)) { TRACE(_T("CReviewRecipeEditorDlg::ReadReviewSystemConfigFile() fail to read system config file\n")); bReturn = FALSE; } else { m_pSysSystemManager = new CSys_SystemManager; m_pSysGlassTypeManager = new CSys_GlassTypeManager; if(m_pSysSystemManager) { m_pSysSystemManager->GetProfile(macroFile); } if(m_pSysGlassTypeManager) { m_pSysGlassTypeManager->GetProfile(macroFile); } } return bReturn; } void CReviewRecipeEditorDlg::OnTcnSelchangeTabReviewRcpEditorMainTab(NMHDR *pNMHDR, LRESULT *pResult) { // TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù. RecipeMainTab nTabIdx; nTabIdx = (RecipeMainTab)m_ctrlTabMain.GetCurSel(); // [2017:1:25]-[WEZASW] : SystemMachine_B7E_WSI ¼³ºñ ºÐ¸®(WSI À¯/¹«) switch(GetCurrentTapIndex(nTabIdx)) { case COMMON_TAB: m_pDlgCommon->ShowWindow(SW_SHOW); m_pDlgReviewFilter->ShowWindow(SW_HIDE); m_pDlgWSIFilter->ShowWindow(SW_HIDE); m_pDlgMeasure->ShowWindow(SW_HIDE); m_pDlgAlign->ShowWindow(SW_HIDE); m_pDlgDefectFind->ShowWindow(SW_HIDE); m_pDlgRcpGlassInfo->ShowWindow(SW_HIDE); m_pDlgJudgement->ShowWindow(SW_HIDE); break; case REVIEW_TAB: m_pDlgCommon->ShowWindow(SW_HIDE); m_pDlgReviewFilter->ShowWindow(SW_SHOW); m_pDlgWSIFilter->ShowWindow(SW_HIDE); m_pDlgMeasure->ShowWindow(SW_HIDE); m_pDlgAlign->ShowWindow(SW_HIDE); m_pDlgDefectFind->ShowWindow(SW_HIDE); m_pDlgRcpGlassInfo->ShowWindow(SW_HIDE); m_pDlgJudgement->ShowWindow(SW_HIDE); break; case WSI_TAB: m_pDlgCommon->ShowWindow(SW_HIDE); m_pDlgReviewFilter->ShowWindow(SW_HIDE); m_pDlgWSIFilter->ShowWindow(SW_SHOW); m_pDlgMeasure->ShowWindow(SW_HIDE); m_pDlgAlign->ShowWindow(SW_HIDE); m_pDlgDefectFind->ShowWindow(SW_HIDE); m_pDlgRcpGlassInfo->ShowWindow(SW_HIDE); m_pDlgJudgement->ShowWindow(SW_HIDE); break; case MEASURE_TAB: m_pDlgCommon->ShowWindow(SW_HIDE); m_pDlgReviewFilter->ShowWindow(SW_HIDE); m_pDlgWSIFilter->ShowWindow(SW_HIDE); m_pDlgMeasure->ShowWindow(SW_SHOW); m_pDlgAlign->ShowWindow(SW_HIDE); m_pDlgDefectFind->ShowWindow(SW_HIDE); m_pDlgRcpGlassInfo->ShowWindow(SW_HIDE); m_pDlgJudgement->ShowWindow(SW_HIDE); break; case ALIGN_TAB: m_pDlgCommon->ShowWindow(SW_HIDE); m_pDlgReviewFilter->ShowWindow(SW_HIDE); m_pDlgWSIFilter->ShowWindow(SW_HIDE); m_pDlgMeasure->ShowWindow(SW_HIDE); m_pDlgAlign->ShowWindow(SW_SHOW); m_pDlgDefectFind->ShowWindow(SW_HIDE); m_pDlgRcpGlassInfo->ShowWindow(SW_HIDE); m_pDlgJudgement->ShowWindow(SW_HIDE); break; case DEFECT_FIND_TAB: m_pDlgCommon->ShowWindow(SW_HIDE); m_pDlgReviewFilter->ShowWindow(SW_HIDE); m_pDlgWSIFilter->ShowWindow(SW_HIDE); m_pDlgMeasure->ShowWindow(SW_HIDE); m_pDlgAlign->ShowWindow(SW_HIDE); m_pDlgDefectFind->ShowWindow(SW_SHOW); m_pDlgRcpGlassInfo->ShowWindow(SW_HIDE); m_pDlgJudgement->ShowWindow(SW_HIDE); break; case GLASSINFO_TAB: m_pDlgCommon->ShowWindow(SW_HIDE); m_pDlgReviewFilter->ShowWindow(SW_HIDE); m_pDlgWSIFilter->ShowWindow(SW_HIDE); m_pDlgMeasure->ShowWindow(SW_HIDE); m_pDlgAlign->ShowWindow(SW_HIDE); m_pDlgDefectFind->ShowWindow(SW_HIDE); m_pDlgRcpGlassInfo->ShowWindow(SW_SHOW); m_pDlgJudgement->ShowWindow(SW_HIDE); break; case JUDGE_TAB: m_pDlgCommon->ShowWindow(SW_HIDE); m_pDlgReviewFilter->ShowWindow(SW_HIDE); m_pDlgWSIFilter->ShowWindow(SW_HIDE); m_pDlgMeasure->ShowWindow(SW_HIDE); m_pDlgAlign->ShowWindow(SW_HIDE); m_pDlgDefectFind->ShowWindow(SW_HIDE); m_pDlgRcpGlassInfo->ShowWindow(SW_HIDE); m_pDlgJudgement->ShowWindow(SW_SHOW); break; default: break; } *pResult = 0; } void CReviewRecipeEditorDlg::OnGridDblClick(NMHDR *pNotifyStruct, LRESULT* pResult) { int nIdx; NM_GRIDVIEW* pItem = (NM_GRIDVIEW*) pNotifyStruct; nIdx = pItem->iRow - 1; if(nIdx >= 0) { SetSelectedRecipeInfo(); } m_SelectedRecipe.SetWindowText(m_strCurrentRecipeName); } void CReviewRecipeEditorDlg::OnCancel() { // TODO: ¿©±â¿¡ Ư¼öÈ­µÈ Äڵ带 Ãß°¡ ¹×/¶Ç´Â ±âº» Ŭ·¡½º¸¦ È£ÃâÇÕ´Ï´Ù. //_T("·¹½ÃÇÇ ¿¡µðÅÍ ÇÁ·Î±×·¥À» Á¾·áÇϽðڽÀ´Ï±î?"), MB_YESNO | MB_ICONQUESTION)) if (IDNO == AfxMessageBox(_T("Do you want to exit recipe editor program?"), MB_YESNO | MB_ICONERROR)) { return; } CDialog::OnCancel(); } BOOL CReviewRecipeEditorDlg::IsReviewSystemPC() { BOOL bRet = FALSE; int i, nCount; CString strReviewSystemIP, strHostIP, strTemp; CStringArray strArrayHostIPAddress; GetCurrentIPAddress(strArrayHostIPAddress); strReviewSystemIP = NETIP_A2E_REVIEW_SYSTEM; nCount = (int)strArrayHostIPAddress.GetCount(); for(i = 0; i < nCount; i++) { strHostIP = strArrayHostIPAddress.GetAt(i); if(strHostIP.Find(strReviewSystemIP) != -1) { bRet = TRUE; break; } } return bRet; } void CReviewRecipeEditorDlg::GetCurrentIPAddress(CStringArray& strArrayIPAddress) { int i; CString strIPAddress; WSADATA wsadata; if(!WSAStartup(DESIRED_WINSOCK_VERSION, &wsadata )) { if(wsadata.wVersion >= MINIMUM_WINSOCK_VERSION) { HOSTENT *p_host_info; IN_ADDR in; char host_name[128]={0, }; gethostname(host_name, 128); p_host_info = gethostbyname(host_name); if(p_host_info != NULL) { for(i = 0; p_host_info->h_addr_list[i]; i++) { memcpy(&in, p_host_info->h_addr_list[i], 4); strIPAddress = inet_ntoa( in ); strArrayIPAddress.Add(strIPAddress); } } } WSACleanup(); } } CSystemInfo* CReviewRecipeEditorDlg::GetSys_SystemInfo() { if (m_pSysSystemManager==NULL) return NULL; return m_pSysSystemManager->GetSystemInfo(); } CGantryInfo* CReviewRecipeEditorDlg::GetSys_GantryInfo(int nGantryIdx) { if (m_pSysSystemManager==NULL) return NULL; CSystemInfo *pSystemInfo = m_pSysSystemManager->GetSystemInfo(); if (pSystemInfo==NULL) return NULL; return pSystemInfo->GetGantryInfo(nGantryIdx); } CHeaderInfo* CReviewRecipeEditorDlg::GetSys_HeaderInfo(int nGantryIdx, int nHeaderIdx) { CGantryInfo *pGantryInfo = GetSys_GantryInfo(nGantryIdx); if (pGantryInfo==NULL) return NULL; return pGantryInfo->GetHeaderInfo(nHeaderIdx); } CCameraControlInfo_Plus* CReviewRecipeEditorDlg::GetSys_CameraInfo(int nGantryIdx, int nHeaderIdx, int nCameraIdx) { CHeaderInfo *pHeaderInfo = GetSys_HeaderInfo(nGantryIdx, nHeaderIdx); if (pHeaderInfo==NULL) return NULL; return pHeaderInfo->GetCameraInfo(nCameraIdx); } CLightControlInfo* CReviewRecipeEditorDlg::GetSys_LightInfo(int nGantryIdx, int nHeaderIdx, int nLightIdx) { CHeaderInfo *pHeaderInfo = GetSys_HeaderInfo(nGantryIdx, nHeaderIdx); if (pHeaderInfo==NULL) return NULL; return pHeaderInfo->GetLightInfo(nLightIdx); } CLensChangeControlInfo* CReviewRecipeEditorDlg::GetSys_RevolverInfo(int nGantryIdx, int nHeaderIdx, int nRevolverIdx) { CHeaderInfo *pHeaderInfo = GetSys_HeaderInfo(nGantryIdx, nHeaderIdx); if (pHeaderInfo==NULL) return NULL; return pHeaderInfo->GetRevolverInfo(nRevolverIdx); } CAfmControlInfo* CReviewRecipeEditorDlg::GetSys_AFMInfo(int nGantryIdx, int nHeaderIdx, int nAFMIdx) { CHeaderInfo *pHeaderInfo = GetSys_HeaderInfo(nGantryIdx, nHeaderIdx); if (pHeaderInfo==NULL) return NULL; return pHeaderInfo->GetAFMInfo(nAFMIdx); } void CReviewRecipeEditorDlg::OnStnClickedStaticSelectRcipe() { // TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù. } BOOL CReviewRecipeEditorDlg::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct) { if (pCopyDataStruct->dwData == COPYDATA_RECIPEEDITOR2REVIEWSYSTEM) { COPYDATA_RECIPE2REV* pCopyData = (COPYDATA_RECIPE2REV*)pCopyDataStruct->lpData; switch (pCopyData->Message) { case MsgRev2Recipe_StandardCameraGlassPos: m_DataRecipe2Rev.dStandardCameraGlassPosX = pCopyData->dStandardCameraGlassPosX; m_DataRecipe2Rev.dStandardCameraGlassPosY = pCopyData->dStandardCameraGlassPosY; break; } } return CDialog::OnCopyData(pWnd, pCopyDataStruct); } int CReviewRecipeEditorDlg::GetCurrentTapIndex(int nCurTap) { TCITEM tcTapItem; // Get the current tab item text. TCHAR buffer[10] = {0}; tcTapItem.pszText = buffer; tcTapItem.cchTextMax = 10; tcTapItem.mask = TCIF_TEXT; if (m_ctrlTabMain.GetItem(nCurTap, &tcTapItem) == FALSE) { return -1; } CString strItem; USES_CONVERSION; strItem = tcTapItem.pszText; if (strItem.Compare(_T("Common")) == 0) { return COMMON_TAB; } else if (strItem.Compare(_T("Review")) == 0) { return REVIEW_TAB; } else if (strItem.Compare(_T("WSI")) == 0) { return WSI_TAB; } else if (strItem.Compare(_T("Align")) == 0) { return ALIGN_TAB; } else if (strItem.Compare(_T("Measure")) == 0) { return MEASURE_TAB; } else if (strItem.Compare(_T("Finding")) == 0) { return DEFECT_FIND_TAB; } else if (strItem.Compare(_T("Glass")) == 0) { return GLASSINFO_TAB; } else if (strItem.Compare(_T("Judgement")) == 0) { return JUDGE_TAB; } else { return -1; } } BOOL CReviewRecipeEditorDlg::SetSelectedRecipeInfo() { BOOL bSuccess = FALSE; CString strRecipeName; CCellID cellID = m_ctrlGridRecipeList.GetFocusCell(); if(cellID.row > 0 && cellID.col > 0) { strRecipeName = m_ctrlGridRecipeList.GetItemText(cellID.row, 1); bSuccess = ReadRecipeFile(strRecipeName); if(bSuccess == TRUE) { m_strCurrentRecipeName = strRecipeName; m_SelectedRecipe.SetBackground(RGB(0,255,0)); } else { m_strCurrentRecipeName = _T(""); m_SelectedRecipe.SetBackground(RGB(255,0,0)); } UpdateTabDialogData(); } else { AfxMessageBox(_T("Please select recipe."));//_T("·¹½ÃÇǸ¦ ¼±ÅÃÇϼ¼¿ä.")); } return bSuccess; } BOOL CReviewRecipeEditorDlg::GetRecipeValidityCheck(CString strRecipeName, CString& strMessage) { BOOL bSuccess = TRUE; // Áߺ¹ Recipe »ý¼º ±ÝÁö. CFileFind finder; CString strRecipeFile; strRecipeFile.Format(_T("%s\\%s.rcp"), _REVIEW_RECIPE_PATH_, strRecipeName); if (finder.FindFile(strRecipeFile) == TRUE) { strMessage.Format(_T("The recipe(%s) to create already exists."), strRecipeName); bSuccess = FALSE; } finder.Close(); return bSuccess; } CReviewRecipeEditorDlg* CReviewRecipeEditorDlg::GetInstance() { if(pReviewRecipeEditor == NULL) { pReviewRecipeEditor = new CReviewRecipeEditorDlg; } return pReviewRecipeEditor; } CReviewRecipeEditorDlg* CReviewRecipeEditorDlg::pReviewRecipeEditor;