// DlgModuleInfo.cpp : 구현 파일입니다. #include "stdafx.h" #include "ReviewSystem.h" #include "ReviewSystemDoc.h" #include "DlgModuleInfo.h" #include "afxdialogex.h" #include "CHReviewSetting/SystemInfo.h" #include "DlgControl.h" #include "CHReviewSetting/HeaderInfo.h" #include "CHMotorControls/MotorControlInfo.h" // CDlgModuleInfo 대화 상자입니다. IMPLEMENT_DYNAMIC(CDlgModuleInfo, CDialog) CDlgModuleInfo::CDlgModuleInfo(CWnd* pParent /*=NULL*/) : CDialog(CDlgModuleInfo::IDD, pParent) { m_nGantryNumber = -1; m_nVecHeaderNumber.clear(); m_nVecCameraNumber.clear(); m_nTotalCameraNumb = -1; m_nModuleIndex = -1; m_bUseThetaMotor = 0; } CDlgModuleInfo::~CDlgModuleInfo() { } void CDlgModuleInfo::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_GRID_MOTOR_INFO, m_ctrlMotorInfo); } BEGIN_MESSAGE_MAP(CDlgModuleInfo, CDialog) ON_BN_CLICKED(IDOK, &CDlgModuleInfo::OnBnClickedOk) ON_BN_CLICKED(IDCANCEL, &CDlgModuleInfo::OnBnClickedCancel) ON_MESSAGE(UM_MOTOR_POSITION_UPDATE, &CDlgModuleInfo::OnMotorPositionUpdate) ON_MESSAGE(UM_LIGHT_LEVEL_UPDATE, &CDlgModuleInfo::OnMotorPositionUpdate) ON_MESSAGE(UM_MAGNIFICATION_UPDATE, &CDlgModuleInfo::OnMotorPositionUpdate) ON_MESSAGE(UM_AFM_LEVEL_UPDATE, &CDlgModuleInfo::OnMotorPositionUpdate) ON_MESSAGE(UM_CAMERA_STATUS_UPDATE, &CDlgModuleInfo::OnCameraStatusUpdate) ON_MESSAGE(UM_SELECTED_MODULE_INDEX_UPDATE, &CDlgModuleInfo::OnUpdateSelectedModuleIndex) ON_MESSAGE(UM_THETA_MOTOR_INFO_UPDATE, &CDlgModuleInfo::OnUpdateThetaMotorInfo) ON_MESSAGE(UM_REVIEW_RESULT_UPDATE, &CDlgModuleInfo::OnReviewResultUpdate) ON_MESSAGE(UM_WSI_RESULT_UPDATE, &CDlgModuleInfo::OnReviewResultUpdate) ON_NOTIFY(NM_DBLCLK, IDC_GRID_MOTOR_INFO, &CDlgModuleInfo::OnGridDoubleClick) END_MESSAGE_MAP() // CDlgModuleInfo 메시지 처리기입니다. void CDlgModuleInfo::OnBnClickedOk() { // TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다. // OnOK(); } void CDlgModuleInfo::OnBnClickedCancel() { // TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다. // OnCancel(); } BOOL CDlgModuleInfo::OnInitDialog() { CDialog::OnInitDialog(); if (m_pDMI2P) { const CSystemInfo *pSystemInfo = m_pDMI2P->DMI2P_GetSystemInfo(); if (pSystemInfo) { m_nGantryNumber = pSystemInfo->GetGantryInfoCount(); for(int i = 0; i < m_nGantryNumber; i++) { const CGantryInfo* pGantryInfo = pSystemInfo->GetGantryInfo(i); if(pGantryInfo == NULL) continue; m_nVecHeaderNumber.push_back(pGantryInfo->GetHeaderInfoCount()); for(int j = 0; j < m_nVecHeaderNumber.at(i); j++) { const CHeaderInfo* pHeaderInfo = pGantryInfo->GetHeaderInfo(j); if(pHeaderInfo == NULL) continue; m_nVecCameraNumber.push_back(pHeaderInfo->GetCameraInfoCount()); m_nTotalCameraNumb += m_nVecCameraNumber.at(j); } } } const CMotorControlInfo *pMotorInfo = m_pDMI2P->DMI2P_GetMotorInfo(); if (pMotorInfo) { m_bUseThetaMotor = pMotorInfo->GetUseThetaMotor(); } } InitGridMotorInfo(); OnMotorPositionUpdate(0,0); return TRUE; } void CDlgModuleInfo::InitGridMotorInfo() { enum { MOTOR_GRID_ROW_COUNT = 5, MOTOR_GRID_COL_COUNT = 4 }; int nRowIdx, nColIdx, nRows, nCols, nFixRows, nFixCols; CString strTemp; CRect rt; nRows =(int)m_nVecCameraNumber.size() + m_bUseThetaMotor + 1; nCols = 14; nFixRows = 1; nFixCols = 1; nRowIdx = 0; nColIdx = 0; CFont font; VERIFY(font.CreateFont( 16, // nHeight 5, // nWidth 0, // nEscapement 0, // nOrientation FW_NORMAL, // nWeight FALSE, // bItalic FALSE, // bUnderline 0, // cStrikeOut ANSI_CHARSET, // nCharSet OUT_DEFAULT_PRECIS, // nOutPrecision CLIP_DEFAULT_PRECIS, // nClipPrecision DEFAULT_QUALITY, // nQuality DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily _T("MS Shell Dlg"))); // lpszFacename m_ctrlMotorInfo.SetFont(&font); m_ctrlMotorInfo.GetClientRect(&rt); m_ctrlMotorInfo.GetDefaultCell(TRUE, FALSE)->SetBackClr(RGB(180, 210, 247)); m_ctrlMotorInfo.GetDefaultCell(FALSE, TRUE)->SetBackClr(RGB(180, 210, 247));; m_ctrlMotorInfo.GetDefaultCell(FALSE, FALSE)->SetBackClr(RGB(255, 255, 255)); m_ctrlMotorInfo.SetRowCount(nRows); m_ctrlMotorInfo.SetColumnCount(nCols); m_ctrlMotorInfo.SetFixedRowCount(nFixRows); m_ctrlMotorInfo.SetFixedColumnCount(nFixCols); m_ctrlMotorInfo.SetColumnWidth(0, 45); GV_ITEM Item; //col Item.mask = GVIF_TEXT; Item.row = nRowIdx; Item.col = nColIdx++; strTemp.Format(_T("Module")); Item.strText = strTemp; m_ctrlMotorInfo.SetItem(&Item); Item.col = nColIdx++; strTemp.Format(_T("Gantry")); Item.strText = strTemp; m_ctrlMotorInfo.SetItem(&Item); m_ctrlMotorInfo.SetColumnWidth(nColIdx-1, 45); Item.col = nColIdx++; strTemp.Format(_T("Header")); Item.strText = strTemp; m_ctrlMotorInfo.SetItem(&Item); m_ctrlMotorInfo.SetColumnWidth(nColIdx-1, 45); Item.col = nColIdx++; strTemp.Format(_T("Motor X(mm)")); Item.strText = strTemp; m_ctrlMotorInfo.SetItem(&Item); m_ctrlMotorInfo.SetColumnWidth(nColIdx-1, 70); Item.col = nColIdx++; strTemp.Format(_T("Motor Y(mm)")); Item.strText = strTemp; m_ctrlMotorInfo.SetItem(&Item); m_ctrlMotorInfo.SetColumnWidth(nColIdx-1, 70); Item.col = nColIdx++; strTemp.Format(_T("Glass X(mm)")); Item.strText = strTemp; m_ctrlMotorInfo.SetItem(&Item); m_ctrlMotorInfo.SetColumnWidth(nColIdx-1, 70); Item.col = nColIdx++; strTemp.Format(_T("Glass Y(mm)")); Item.strText = strTemp; m_ctrlMotorInfo.SetItem(&Item); m_ctrlMotorInfo.SetColumnWidth(nColIdx-1, 70); Item.col = nColIdx++; strTemp.Format(_T("CenterX(mm)")); Item.strText = strTemp; m_ctrlMotorInfo.SetItem(&Item); m_ctrlMotorInfo.SetColumnWidth(nColIdx-1, 70); Item.col = nColIdx++; strTemp.Format(_T("CenterY(mm)")); Item.strText = strTemp; m_ctrlMotorInfo.SetItem(&Item); m_ctrlMotorInfo.SetColumnWidth(nColIdx-1, 70); /*Item.col = nColIdx++; strTemp.Format(_T("cenX(mm)")); Item.strText = strTemp; m_ctrlMotorInfo.SetItem(&Item); m_ctrlMotorInfo.SetColumnWidth(nColIdx-1, 100); Item.col = nColIdx++; strTemp.Format(_T("cenY(mm)")); Item.strText = strTemp; m_ctrlMotorInfo.SetItem(&Item); m_ctrlMotorInfo.SetColumnWidth(nColIdx-1, 100);*/ Item.col = nColIdx++; strTemp.Format(_T("Mag Level")); Item.strText = strTemp; m_ctrlMotorInfo.SetItem(&Item); m_ctrlMotorInfo.SetColumnWidth(nColIdx-1, 70); Item.col = nColIdx++; strTemp.Format(_T("Light Level")); Item.strText = strTemp; m_ctrlMotorInfo.SetItem(&Item); m_ctrlMotorInfo.SetColumnWidth(nColIdx-1, 60); Item.col = nColIdx++; strTemp.Format(_T("AFM Level")); Item.strText = strTemp; m_ctrlMotorInfo.SetItem(&Item); m_ctrlMotorInfo.SetColumnWidth(nColIdx-1, 60); Item.col = nColIdx++; strTemp.Format(_T("Done(ea)")); Item.strText = strTemp; m_ctrlMotorInfo.SetItem(&Item); m_ctrlMotorInfo.SetColumnWidth(nColIdx-1, 65); Item.col = nColIdx++; strTemp.Format(_T("Do(ea)")); Item.strText = strTemp; m_ctrlMotorInfo.SetItem(&Item); m_ctrlMotorInfo.SetColumnWidth(nColIdx-1, 65); nRowIdx = 1; nColIdx = 0; for(int i = 0; i < m_nVecCameraNumber.size(); i++) { Item.row = nRowIdx++; Item.col = nColIdx; strTemp.Format(_T("%02d"),i); Item.strText = strTemp; m_ctrlMotorInfo.SetItem(&Item); } nRowIdx = 1; nColIdx = 1; int GantryColldx = 1; int HeaderColIdx = 2; for(int i = 0; i < m_nGantryNumber; i++) { for(int j = 0; j < m_nVecHeaderNumber.at(i); j++) { Item.row = nRowIdx; Item.col = GantryColldx; strTemp.Format(_T("%02d"),i); Item.strText = strTemp; m_ctrlMotorInfo.SetItem(&Item); Item.row = nRowIdx++; Item.col = HeaderColIdx; strTemp.Format(_T("%02d"),j); Item.strText = strTemp; m_ctrlMotorInfo.SetItem(&Item); } } if (m_bUseThetaMotor) { } m_ctrlMotorInfo.SetEditable(FALSE); } void CDlgModuleInfo::SetCameraNumber(int nGantryNumber, std::vector nVecHeaderNumber, std::vector nVecCameraNumber, int nTotalCameraNumb) { m_nGantryNumber = nGantryNumber; m_nVecHeaderNumber = nVecHeaderNumber; m_nVecCameraNumber = nVecCameraNumber; m_nTotalCameraNumb = nTotalCameraNumb; } void CDlgModuleInfo::UpdateThetaMotorInfo(const SThetaMotorInfo* pThetaMotorInfo) { if (pThetaMotorInfo==NULL) return; this->PostMessage(UM_THETA_MOTOR_INFO_UPDATE, (WPARAM)pThetaMotorInfo); } void CDlgModuleInfo::UpdateMotorPosition(int nModuleIndex, BOOL bSelected, const SMotorPosition* pMotorPosition) { if (pMotorPosition==NULL) return; this->PostMessage(UM_MOTOR_POSITION_UPDATE, (WPARAM)nModuleIndex, (LPARAM)pMotorPosition); } void CDlgModuleInfo::UpdateMotorStatus(int nModuleIndex, const SMotorStatus* pMotorStatus) { if (pMotorStatus==NULL) return; this->PostMessage(UM_MOTOR_STATUS_UPDATE, (WPARAM)nModuleIndex, (LPARAM) pMotorStatus); } void CDlgModuleInfo::UpdateCameraControl(int nModuleIndex, const SCameraControl *pCameraControl, const SCameraInfo* pCameraInfo) { if(pCameraControl == NULL) return ; this->SendMessage(UM_CAMERA_STATUS_UPDATE, (WPARAM)nModuleIndex, (LPARAM)pCameraControl); } void CDlgModuleInfo::UpdateSelectedModuleIndex(int nModuleIndex, const CModuleStatus* pModuleStatus) { if(nModuleIndex < 0) return ; this->SendMessage(UM_SELECTED_MODULE_INDEX_UPDATE, (WPARAM)nModuleIndex, NULL); } LRESULT CDlgModuleInfo::OnUpdateSelectedModuleIndex(WPARAM wParam, LPARAM lParam) { m_nModuleIndex = (int)wParam; CCellID FocusedID = m_ctrlMotorInfo.GetFocusCell(); for(int ColIdx = 1; ColIdx < 14; ColIdx++) m_ctrlMotorInfo.SetItemBkColour(m_nModuleIndex + 1,ColIdx,RGB(255,255,255)); int FocusedCol = FocusedID.row-1; for(int ColIdx = 1; ColIdx < 14; ColIdx++) { if(ColIdx ==8 || ColIdx ==7 ) { m_ctrlMotorInfo.SetItemBkColour(m_nModuleIndex + 1,ColIdx,RGB(206,251,201)); m_ctrlMotorInfo.SetItemBkColour(0,ColIdx,RGB(255, 255, 247)); } else { m_ctrlMotorInfo.SetItemBkColour(m_nModuleIndex + 1,ColIdx,RGB(255,255,0)); m_ctrlMotorInfo.SetItemBkColour(0,ColIdx,RGB(180, 210, 247)); } } m_ctrlMotorInfo.Invalidate(FALSE); return 1; } LRESULT CDlgModuleInfo::OnUpdateThetaMotorInfo(WPARAM wParam, LPARAM lParam) { const SThetaMotorInfo *pThetaMotorInfo = (const SThetaMotorInfo*)wParam; if(pThetaMotorInfo == NULL) return 1; int nRowIdx = (int)m_nVecCameraNumber.size() + m_bUseThetaMotor; CString strItemText; int nColIdx = 0; // theta (deg) m_ctrlMotorInfo.SetItemText(nRowIdx, nColIdx++, _T("Rotate")); // theta (deg) nColIdx = 3; strItemText.Format(_T("%.06lf"), pThetaMotorInfo->dPosition); m_ctrlMotorInfo.SetItemText(nRowIdx, nColIdx++, strItemText); // status strItemText.Format(_T("%d"), pThetaMotorInfo->lStatus); m_ctrlMotorInfo.SetItemText(nRowIdx, nColIdx++, strItemText); m_ctrlMotorInfo.Invalidate(FALSE); return 0; return 1; } LRESULT CDlgModuleInfo::OnMotorPositionUpdate(WPARAM wParam, LPARAM lParam) { int nModuleIndex = (int)wParam; const SMotorPosition *pMotorPosition = (const SMotorPosition*)lParam; if(pMotorPosition == NULL) return 1; if(m_pDMI2P == NULL) return 0; int nRowIdx = (int)wParam + 1, nColIdx = 3; CString strItemText; strItemText.Format(_T("%.03lf"), pMotorPosition->dMotorPosX); m_ctrlMotorInfo.SetItemText(nRowIdx, nColIdx++, strItemText); //Motor Y strItemText.Format(_T("%.03lf"), pMotorPosition->dMotorPosY); m_ctrlMotorInfo.SetItemText(nRowIdx, nColIdx++, strItemText); // Glass X strItemText.Format(_T("%.03lf"), pMotorPosition->dGlassPosX); m_ctrlMotorInfo.SetItemText(nRowIdx, nColIdx++, strItemText); //Glass Y strItemText.Format(_T("%.03lf"), pMotorPosition->dGlassPosY); m_ctrlMotorInfo.SetItemText(nRowIdx, nColIdx++, strItemText); //CDlgControl* pDlgControl = CDlgControl::GetInstance(); //181226 인라인 오프라인 설비별 x,y축 표시 변경 double dCenterGlassPosX=0., dCenterGlassPosY=0.; const CSystemInfo *pSystemInfo = m_pDMI2P->DMI2P_GetSystemInfo(); double dCenterGlassPosXTemp=0., dCenterGlassPosYTemp=0.; if(pSystemInfo == NULL) return 0; //210402 //if (pSystemInfo->m_nMachineType == 0 || pSystemInfo->m_nMachineType == 1 || pSystemInfo->m_nMachineType == 2) //원판 //{ dCenterGlassPosX = pMotorPosition->dGlassPosX; dCenterGlassPosY = pMotorPosition->dGlassPosY; m_pDMI2P->DMI2P_GetCenterCoordinate(dCenterGlassPosX, dCenterGlassPosY); //} //else //분판 //{ // dCenterGlassPosXTemp = pMotorPosition->dGlassPosX; // dCenterGlassPosYTemp = pMotorPosition->dGlassPosY; // m_pDMI2P->DMI2P_GetCenterCoordinate(dCenterGlassPosXTemp, dCenterGlassPosYTemp); // dCenterGlassPosY = dCenterGlassPosXTemp; // dCenterGlassPosX = dCenterGlassPosYTemp; //} // Glass X strItemText.Format(_T("%.03lf"), dCenterGlassPosX); m_ctrlMotorInfo.SetItemText(nRowIdx, nColIdx++, strItemText); //Glass Y strItemText.Format(_T("%.03lf"), dCenterGlassPosY); m_ctrlMotorInfo.SetItemText(nRowIdx, nColIdx++, strItemText); m_ctrlMotorInfo.Invalidate(FALSE); return 0; } void CDlgModuleInfo::OnGridDoubleClick(NMHDR *pNotifyStruct, LRESULT* pResult) { CCellID FocusedID = m_ctrlMotorInfo.GetFocusCell(); for(int ColIdx = 1; ColIdx < 12; ColIdx++) { m_ctrlMotorInfo.SetItemBkColour(m_nModuleIndex + 1,ColIdx,RGB(255,255,255)); } int FocusedCol = FocusedID.row-1; if(FocusedCol >= 0) { m_nModuleIndex = FocusedCol; m_pDMI2P->DMI2P_SetSelectedModuleIndex(m_nModuleIndex); } for(int ColIdx = 1; ColIdx < 12; ColIdx++) { m_ctrlMotorInfo.SetItemBkColour(m_nModuleIndex + 1,ColIdx,RGB(255,255,0)); m_ctrlMotorInfo.SetItemBkColour(0,ColIdx,RGB(180, 210, 247)); } m_ctrlMotorInfo.Invalidate(FALSE); } LRESULT CDlgModuleInfo::OnCameraStatusUpdate(WPARAM wParam, LPARAM lParam) { int nModuleIndex = (int)wParam; int nReviewedDefectCount = 0; int nReviewDefectCount = 0; const SCameraControl *pCameraControl = (const SCameraControl*)lParam; if(pCameraControl == NULL) return 1; int nRowIdx = (int)wParam + 1, nColIdx = 9; CString strItemText; strItemText.Format(_T("%d"), pCameraControl->nZoomLevel); m_ctrlMotorInfo.SetItemText(nRowIdx, nColIdx++, strItemText); //Motor Y strItemText.Format(_T("%d"), pCameraControl->nLightLevel); m_ctrlMotorInfo.SetItemText(nRowIdx, nColIdx++, strItemText); strItemText.Format(_T("%d"), pCameraControl->nAFMLevel); m_ctrlMotorInfo.SetItemText(nRowIdx, nColIdx++, strItemText); strItemText.Format(_T("%d"), nReviewedDefectCount); m_ctrlMotorInfo.SetItemText(nRowIdx, nColIdx++, strItemText); strItemText.Format(_T("%d"), nReviewDefectCount); m_ctrlMotorInfo.SetItemText(nRowIdx, nColIdx++, strItemText); m_ctrlMotorInfo.Invalidate(FALSE); return 1; } void CDlgModuleInfo::UpdateReviewResult(int nModuleIndex, const CGlassResult* pGlassResult,int nPlanIndex) { if (pGlassResult==NULL) return; m_pGlassResult = pGlassResult; this->PostMessage(UM_REVIEW_RESULT_UPDATE); this->PostMessage(UM_REVIEW_DEFECT_RESULT_UPDATE); //1218 } LRESULT CDlgModuleInfo::OnReviewResultUpdate(WPARAM wParam, LPARAM lParam) { if (m_pGlassResult==NULL) return 0; CString strItemText; int nRowIdx = (int)wParam + 1, nColIdx = 12; int nReviewedDefectCount = 0; int nReviewDefectCount = 0; int nTotalDefectCount = m_pGlassResult->GetDefectResultCount(); int nWsiReviewedDefectCount = 0; int nWsiReviewDefectCount = 0; const VectorReviewResult *pVecReviewResult = m_pGlassResult->GetVectorReviewResult(); m_pGlassResult->GetWsiScheduleResult(1); if (pVecReviewResult==NULL) return 0; //const SCameraControl *pCameraControl = (const SCameraControl*)lParam; //if(pCameraControl == NULL) return 1; for(constVectorReviewResultIt it=pVecReviewResult->begin();it!=pVecReviewResult->end();it++) { const CReviewResult *pReviewResult = static_cast(&(*it)); nReviewDefectCount += (int)pReviewResult->m_vecSReviewResult.size(); for(constVectorSReviewResultIt its=pReviewResult->m_vecSReviewResult.begin(); its!=pReviewResult->m_vecSReviewResult.end();its++) { if (its->nResultCode>ReviewResult_None) { nReviewedDefectCount++; nWsiReviewDefectCount++; } } } strItemText.Format(_T("%d"), nReviewedDefectCount); m_ctrlMotorInfo.SetItemText(nRowIdx, nColIdx++,strItemText); strItemText.Format(_T("%d"), nReviewDefectCount); m_ctrlMotorInfo.SetItemText(nRowIdx, nColIdx++,strItemText); m_ctrlMotorInfo.Invalidate(FALSE); return 1; }