|
// ReveiwHistoryDlg.cpp: 구현 파일
|
//
|
|
#include "stdafx.h"
|
#include "ReveiwHistory.h"
|
#include "ReveiwHistoryDlg.h"
|
#include "PathSettingDlg.h"
|
#include "DitGlassRawStruct.h"
|
#include "afxdialogex.h"
|
#include "GlassRawCPJT.h"
|
#include "akGridCtrl/GridCellCheck.h"
|
#include "akImageView.h"
|
#include <algorithm>
|
|
#ifdef _DEBUG
|
#define new DEBUG_NEW
|
#endif
|
|
// 응용 프로그램 정보에 사용되는 CAboutDlg 대화 상자입니다.
|
|
class CAboutDlg : public CDialogEx
|
{
|
public:
|
CAboutDlg();
|
|
// 대화 상자 데이터입니다.
|
#ifdef AFX_DESIGN_TIME
|
enum { IDD = IDD_ABOUTBOX };
|
#endif
|
|
protected:
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 지원입니다.
|
|
// 구현입니다.
|
protected:
|
DECLARE_MESSAGE_MAP()
|
};
|
|
CAboutDlg::CAboutDlg() : CDialogEx(IDD_ABOUTBOX)
|
{
|
}
|
|
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
|
{
|
CDialogEx::DoDataExchange(pDX);
|
}
|
|
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
|
END_MESSAGE_MAP()
|
|
// CReveiwHistoryDlg 대화 상자
|
|
CReveiwHistoryDlg::CReveiwHistoryDlg(CWnd* pParent /*=nullptr*/)
|
: CDialogEx(IDD_DLG_REVIEWHISTORY, pParent)
|
, m_nFileCount(0)
|
{
|
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
|
AddVecFileHeader();
|
AddVecGlassHeader();
|
AddVecDefectHeader();
|
|
m_nSelectedRow = 0;
|
m_nSelectedCol = 0;
|
m_nCount = 0;
|
m_nGlassSelect = 0;
|
m_bDefectAll = false;
|
m_bFirst = false;
|
m_nSizeDefect = 0;
|
m_nSizeImage = 0;
|
m_nDefectCount = 0;
|
m_nImageCount = 0;
|
m_nCellCount = 0;
|
m_bAsending = FALSE;
|
|
for (int i = 0; i < 105; i++)
|
{
|
m_nSelectFile[i] = 0;
|
m_nDefectSize[i] = 0;
|
m_nCellSize[i] = 0;
|
m_nCellSizeTemp[i] = m_nCellSize[i];
|
m_nImageSize[i] = 0;
|
}
|
}
|
|
void CReveiwHistoryDlg::DoDataExchange(CDataExchange* pDX)
|
{
|
CDialogEx::DoDataExchange(pDX);
|
DDX_Control(pDX, IDC_SLIDER_IMG, m_sldImg);
|
DDX_Control(pDX, IDC_EDIT_COUNT, m_ctrCount);
|
DDX_Control(pDX, IDC_CHK_All_DEFECT, m_chkAllDefect);
|
DDX_Control(pDX, IDC_CHK_REVIEW_DEFECT, m_chkReviewDefect);
|
DDX_Control(pDX, IDC_CHK_MUTI, m_chkMuti);
|
DDX_Control(pDX, IDC_CHK_SINGLE, m_chkSingle);
|
DDX_Control(pDX, IDC_STATIC_IMG_REVIEW, m_ctrReviewImage);
|
DDX_Text(pDX, IDC_EDIT_FILE_COUNT, m_nFileCount);
|
DDX_Control(pDX, IDC_EDIT_FILE_COUNT, m_ctlFileCount);
|
DDX_Control(pDX, IDC_PROGRESS_LOAD, m_ctlProgress);
|
}
|
|
BEGIN_MESSAGE_MAP(CReveiwHistoryDlg, CDialogEx)
|
ON_WM_SYSCOMMAND()
|
ON_WM_PAINT()
|
ON_WM_QUERYDRAGICON()
|
ON_WM_DESTROY()
|
ON_WM_SIZE()
|
ON_WM_HSCROLL()
|
ON_BN_CLICKED(IDC_BUTTON_MAPVIEW_FIT, &CReveiwHistoryDlg::OnBnClickedButtonMapviewFit)
|
ON_MESSAGE(UM_FORMMAP_DEFECTSELECT, OnMapDefectSelected)
|
ON_MESSAGE(UM_FORMMAP_DEFECTMOUSEOVER, OnMapDefectMouseOver)
|
ON_COMMAND(ID_OPTION_PATHSETTING, &CReveiwHistoryDlg::OnOptionPathsetting)
|
ON_COMMAND(ID_VIEW_ALLDEFECT, &CReveiwHistoryDlg::OnViewAlldefect)
|
ON_COMMAND(ID_VIEW_REVIEWDEFECT, &CReveiwHistoryDlg::OnViewReviewdefect)
|
ON_COMMAND(ID_ALIGN_VIEW, &CReveiwHistoryDlg::OnAlignView)
|
ON_BN_CLICKED(IDC_BTN_FIND_BIN, &CReveiwHistoryDlg::OnBnClickedBtnFindBin)
|
ON_EN_CHANGE(IDC_EDIT_COUNT, &CReveiwHistoryDlg::OnChangeEditCount)
|
ON_BN_CLICKED(IDC_BUTTON3, &CReveiwHistoryDlg::OnBnClickedButton3)
|
ON_BN_CLICKED(IDC_CHK_All_DEFECT, &CReveiwHistoryDlg::OnClickedChkAllDefect)
|
ON_BN_CLICKED(IDC_CHK_MUTI, &CReveiwHistoryDlg::OnClickedChkMuti)
|
ON_BN_CLICKED(IDC_CHK_REVIEW_DEFECT, &CReveiwHistoryDlg::OnClickedChkReviewDefect)
|
ON_BN_CLICKED(IDC_CHK_SINGLE, &CReveiwHistoryDlg::OnClickedChkSingle)
|
ON_EN_CHANGE(IDC_EDIT_FILE_COUNT, &CReveiwHistoryDlg::OnChangeEditFileCount)
|
END_MESSAGE_MAP()
|
|
// CReveiwHistoryDlg 메시지 처리기
|
|
BOOL CReveiwHistoryDlg::OnInitDialog()
|
{
|
CDialogEx::OnInitDialog();
|
|
// 시스템 메뉴에 "정보..." 메뉴 항목을 추가합니다.
|
|
// IDM_ABOUTBOX는 시스템 명령 범위에 있어야 합니다.
|
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
|
ASSERT(IDM_ABOUTBOX < 0xF000);
|
|
CMenu* pSysMenu = GetSystemMenu(FALSE);
|
if (pSysMenu != nullptr)
|
{
|
BOOL bNameValid;
|
CString strAboutMenu;
|
bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
|
ASSERT(bNameValid);
|
if (!strAboutMenu.IsEmpty())
|
{
|
pSysMenu->AppendMenu(MF_SEPARATOR);
|
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
|
}
|
}
|
|
// 이 대화 상자의 아이콘을 설정합니다. 응용 프로그램의 주 창이 대화 상자가 아닐 경우에는
|
// 프레임워크가 이 작업을 자동으로 수행합니다.
|
SetIcon(m_hIcon, TRUE); // 큰 아이콘을 설정합니다.
|
SetIcon(m_hIcon, FALSE); // 작은 아이콘을 설정합니다.
|
|
GetDlgItem(IDC_STATIC_FORMATIONMAP2)->GetWindowRect(m_picture_rect);
|
GetDlgItem(IDC_STATIC_IMG_INSPECTOR)->GetWindowRect(m_picture_rect2);
|
|
ScreenToClient(m_picture_rect);
|
ScreenToClient(m_picture_rect2);
|
|
GetDlgItem(IDC_STATIC_IMG_ALIGN1)->GetWindowRect(m_Align_rect);
|
GetDlgItem(IDC_STATIC_IMG_ALIGN2)->GetWindowRect(m_Align_rect2);
|
|
ScreenToClient(m_Align_rect);
|
ScreenToClient(m_Align_rect2);
|
|
m_ImageView.CreateGraph(this, m_picture_rect);
|
m_ImageView.SetAutoScale();
|
|
|
// TODO: 여기에 추가 초기화 작업을 추가합니다.
|
if (1)
|
{
|
CRect rectTemp;
|
GetDlgItem(IDC_STATIC_FORMATIONMAP)->GetWindowRect(rectTemp);
|
ScreenToClient(rectTemp);
|
|
m_FormationMap.CreateGraph(this, rectTemp);
|
}
|
|
m_WndArrange.setParentWnd(this);
|
m_WndArrange.addChildWnd(&m_FormationMap, WA_RESIZE_WIDTH | WA_RESIZE_HEIGHT);
|
|
GetDlgItem(IDC_STATIC_FORMATIONMAP)->BringWindowToTop();
|
|
LOG(Dbg, _T("[Processe] Review History Start"));
|
|
CreateUserDirectory();
|
CreateUserClass();
|
|
InitGridReviewLIst(&m_gridReviewList, IDC_STATIC_GRID_GLASS);
|
InitGridDefectLIst(&m_gridDefectInfo, IDC_STATIC_GRID_DEFECT);
|
InitGridGlassLIst(&m_gridGlassInfo, IDC_STATIC_GRID_GLASS_INFO);
|
|
OnViewReviewdefect();
|
|
m_chkReviewDefect.SetCheck(TRUE);
|
m_chkSingle.SetCheck(TRUE);
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
m_ConfigOption.m_nMaxDataNumCell = 200;
|
m_ConfigOption.m_nMaxDataNumDefect = 50000;
|
|
if (m_Server.CreateServer(m_ConfigOption.m_nMaxDataNumCell, m_ConfigOption.m_nMaxDataNumDefect) == FALSE)
|
{
|
LOG(Dbg, _T("[Processe]서버 생성 실패 종료 합니다."));
|
exit(0);
|
}
|
|
m_pGlassRawMaker = NULL;
|
m_ConfigOption.m_nSelectRawType = 3;
|
OnCbnSelchangeComboRawtype();
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
|
SlideInit();
|
Imagenoload();
|
|
m_ctlProgress.SetRange(0, 100);
|
m_ctlProgress.ShowWindow(FALSE);
|
|
return TRUE; // 포커스를 컨트롤에 설정하지 않으면 TRUE를 반환합니다.
|
}
|
|
void CReveiwHistoryDlg::OnDestroy()
|
{
|
CDialogEx::OnDestroy();
|
|
DestroyUserClass();
|
|
m_Filelistfont.DeleteObject();
|
m_Defectfont.DeleteObject();
|
|
LOG(Dbg, _T("[Processe] Review History End"));
|
}
|
|
void CReveiwHistoryDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
{
|
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
|
{
|
CAboutDlg dlgAbout;
|
dlgAbout.DoModal();
|
}
|
else
|
{
|
CDialogEx::OnSysCommand(nID, lParam);
|
}
|
}
|
|
// 대화 상자에 최소화 단추를 추가할 경우 아이콘을 그리려면
|
// 아래 코드가 필요합니다. 문서/뷰 모델을 사용하는 MFC 응용 프로그램의 경우에는
|
// 프레임워크에서 이 작업을 자동으로 수행합니다.
|
|
void CReveiwHistoryDlg::OnPaint()
|
{
|
CPaintDC dc(this); // 그리기를 위한 디바이스 컨텍스트입니다.
|
|
if (IsIconic())
|
{
|
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(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
|
{
|
// if (!m_ReviewImage.IsNull())
|
// {
|
// dc.SetStretchBltMode(COLORONCOLOR);
|
// // 그림을 Picture Control 크기로 화면에 출력한다.
|
// m_ReviewImage.Draw(dc, m_picture_rect);
|
// }
|
//LYW 20210825 #3486 ADD START
|
if (!m_DefectRotateImage.IsNull())
|
{
|
dc.SetStretchBltMode(COLORONCOLOR);
|
// 그림을 Picture Control 크기로 화면에 출력한다.
|
m_DefectRotateImage.Draw(dc, m_picture_rect2);
|
}
|
//LYW 20210825 #3486 ADD END
|
else if (!m_DefectImage.IsNull())
|
{
|
dc.SetStretchBltMode(COLORONCOLOR);
|
// 그림을 Picture Control 크기로 화면에 출력한다.
|
m_DefectImage.Draw(dc, m_picture_rect2);
|
}
|
|
if (!m_AlignFirst.IsNull())
|
{
|
dc.SetStretchBltMode(COLORONCOLOR);
|
m_AlignFirst.Draw(dc, m_Align_rect);
|
}
|
if (!m_AlignSecend.IsNull())
|
{
|
dc.SetStretchBltMode(COLORONCOLOR);
|
m_AlignSecend.Draw(dc, m_Align_rect2);
|
}
|
CDialogEx::OnPaint();
|
}
|
}
|
|
// 사용자가 최소화된 창을 끄는 동안에 커서가 표시되도록 시스템에서
|
// 이 함수를 호출합니다.
|
HCURSOR CReveiwHistoryDlg::OnQueryDragIcon()
|
{
|
return static_cast<HCURSOR>(m_hIcon);
|
}
|
|
BOOL CReveiwHistoryDlg::PreTranslateMessage(MSG * pMsg)
|
{
|
POINT pt;
|
|
pt.x = GET_X_LPARAM(pMsg->lParam);
|
pt.y = GET_Y_LPARAM(pMsg->lParam);
|
|
switch (pMsg->message)
|
{
|
case WM_MOUSEHWHEEL:
|
{
|
|
}
|
break;
|
case WM_MOUSEMOVE:
|
{
|
|
}
|
break;
|
case WM_LBUTTONDOWN:
|
{
|
|
// if (m_picture_rect.left < pt.x && m_picture_rect.right > pt.x && m_picture_rect.top < pt.y && m_picture_rect.bottom > pt.y)
|
// {
|
// if (m_pParentWnd == NULL || !GetImageExist()) return;
|
//
|
// if (pt.x > -1 && pt.x < GetScaleWidth() &&
|
// pt.y > -1 && pt.y < GetScaleHeight())
|
// {
|
// if (m_rectTracker.HitTest(pt) < 0)
|
// {
|
// // just to demonstrate CRectTracker::TrackRubberBand
|
// if (m_rectTracker.TrackRubberBand(this, pt, TRUE))
|
// {
|
// Invalidate();
|
// }
|
// }
|
// else if (m_rectTracker.Track(this, pt, TRUE))
|
// {
|
// Invalidate();
|
// }
|
// }
|
//
|
// CRect rect;
|
// this->GetClientRect(rect);
|
//
|
// pt.x += m_nHScroll;
|
// pt.y += m_nVScroll;
|
// m_pParentWnd->SendMessage(WM_LBUTTONDOWN, static_cast<WPARAM>(nFlags), MAKELPARAM(pt.x, pt.y));
|
// }
|
}
|
break;
|
case WM_LBUTTONUP:
|
{
|
// int a = 1;
|
// return 0;
|
// if (m_picture_rect.left < pt.x && m_picture_rect.right > pt.x && m_picture_rect.top < pt.y && m_picture_rect.bottom > pt.y)
|
// {
|
// if (m_pParentWnd == NULL) return;
|
//
|
// CRect rect;
|
// this->GetClientRect(rect);
|
//
|
// pt.x += m_nHScroll;
|
// pt.y += m_nVScroll;
|
// m_pParentWnd->SendMessage(WM_LBUTTONUP, static_cast<WPARAM>(nFlags), MAKELPARAM(pt.x, pt.y));
|
//
|
// if (GetTrackerRect(m_rtROIRect))
|
// {
|
// m_sROIInfo.nWidthPixel = m_rtROIRect.Width();
|
// m_sROIInfo.nHeightPixel = m_rtROIRect.Height();
|
// m_sROIInfo.dDiagonalPixel = sqrt(double(m_sROIInfo.nWidthPixel*m_sROIInfo.nWidthPixel + m_sROIInfo.nHeightPixel*m_sROIInfo.nHeightPixel));
|
//
|
// m_sROIInfo.dWidthRealUM = m_sROIInfo.nWidthPixel * (m_dResolution / m_dWidthScale);
|
// m_sROIInfo.dHeightRealUM = m_sROIInfo.nHeightPixel * (m_dResolution / m_dHeightScale);
|
// m_sROIInfo.dDiagonalRealUM = sqrt((m_sROIInfo.dWidthRealUM*m_sROIInfo.dWidthRealUM) + (m_sROIInfo.dHeightRealUM*m_sROIInfo.dHeightRealUM));
|
//
|
// Invalidate(TRUE);
|
// }
|
// }
|
//Drow 정보를 보낸다.
|
}
|
break;
|
case WM_KEYDOWN:
|
{
|
if (pMsg->wParam == VK_RETURN)
|
return TRUE;
|
else if (pMsg->wParam == VK_ESCAPE)
|
return TRUE;
|
}
|
break;
|
}
|
|
return __super::PreTranslateMessage(pMsg);
|
}
|
|
void CReveiwHistoryDlg::CreateUserDirectory()
|
{
|
CString str;
|
|
str.Format(_T("%s\\Config\\"), GetExePath());
|
CreateDirectory(str, NULL);
|
|
str.Format(_T("%s\\Log\\"), GetExePath());
|
CreateDirectory(str, NULL);
|
|
LOG(Dbg, _T("[Processe] CreateUserDirectory"));
|
}
|
|
void CReveiwHistoryDlg::CreateUserClass()
|
{
|
CPathSettingDlg::CreateClass();
|
CPathSettingDlg::GetMgr()->Create(this);
|
CPathSettingDlg::GetMgr()->PathSettingLoad();
|
|
CAlignDlg::CreateClass();
|
CAlignDlg::GetMgr()->Create(this);
|
|
akDefectFormation::CreateClass();
|
|
LOG(Dbg, _T("[Processe] CreateUserClass"));
|
}
|
|
void CReveiwHistoryDlg::DestroyUserClass()
|
{
|
CPathSettingDlg::GetMgr()->DestroyWindow();
|
CPathSettingDlg::DestroyClass();
|
|
CAlignDlg::GetMgr()->DestroyWindow();
|
CAlignDlg::DestroyClass();
|
|
akDefectFormation::DestroyClass();
|
|
LOG(Dbg, _T("[Processe] DestroyUserClass"));
|
}
|
|
|
void CReveiwHistoryDlg::AddVecFileHeader()
|
{
|
m_vecStrGridReviewHeader.push_back(" NO ");
|
m_vecStrGridReviewHeader.push_back(" Time ");
|
m_vecStrGridReviewHeader.push_back("열기");
|
m_vecStrGridReviewHeader.push_back("PPID");
|
m_vecStrGridReviewHeader.push_back("GLASS ID");
|
m_vecStrGridReviewHeader.push_back("총 결함 갯수");
|
m_vecStrGridReviewHeader.push_back("리뷰 갯수");
|
m_vecStrGridReviewHeader.push_back("Judge");
|
m_vecStrGridReviewHeader.push_back("File Name");
|
}
|
void CReveiwHistoryDlg::AddVecGlassHeader()
|
{
|
m_vecStrGridGlassHeader.push_back("No");
|
m_vecStrGridGlassHeader.push_back("PPID");
|
m_vecStrGridGlassHeader.push_back("Glass ID");
|
m_vecStrGridGlassHeader.push_back("총 결함 갯수");
|
m_vecStrGridGlassHeader.push_back("리뷰 결함 갯수");
|
m_vecStrGridGlassHeader.push_back("Glass Judge");
|
m_vecStrGridGlassHeader.push_back("Lot ID");
|
m_vecStrGridGlassHeader.push_back("Slot ID");
|
m_vecStrGridGlassHeader.push_back("Slot Number");
|
m_vecStrGridGlassHeader.push_back("Cell Number");
|
m_vecStrGridGlassHeader.push_back("Glass Height");
|
m_vecStrGridGlassHeader.push_back("Glass Width");
|
}
|
void CReveiwHistoryDlg::AddVecDefectHeader()
|
{
|
m_vecStrGridDefectHeader.push_back("No");
|
m_vecStrGridDefectHeader.push_back("Idx");
|
m_vecStrGridDefectHeader.push_back("Loc");
|
m_vecStrGridDefectHeader.push_back("Classification");
|
m_vecStrGridDefectHeader.push_back("Code");
|
m_vecStrGridDefectHeader.push_back("Type");
|
m_vecStrGridDefectHeader.push_back("SubType");
|
m_vecStrGridDefectHeader.push_back("Length");
|
m_vecStrGridDefectHeader.push_back("XSize(um)");
|
m_vecStrGridDefectHeader.push_back("YSize(um)");
|
m_vecStrGridDefectHeader.push_back("Area(um)");
|
m_vecStrGridDefectHeader.push_back("Zone");
|
m_vecStrGridDefectHeader.push_back("DMax");
|
m_vecStrGridDefectHeader.push_back("DMin");
|
m_vecStrGridDefectHeader.push_back("DAvg");
|
m_vecStrGridDefectHeader.push_back("Peak");
|
m_vecStrGridDefectHeader.push_back("Step");
|
m_vecStrGridDefectHeader.push_back("Cam");
|
m_vecStrGridDefectHeader.push_back("Scan");
|
m_vecStrGridDefectHeader.push_back("RMax");
|
m_vecStrGridDefectHeader.push_back("RMin");
|
m_vecStrGridDefectHeader.push_back("RAvg");
|
m_vecStrGridDefectHeader.push_back("Xpos(mm)");
|
m_vecStrGridDefectHeader.push_back("Ypos(mm)");
|
m_vecStrGridDefectHeader.push_back("CellX(mm)");
|
m_vecStrGridDefectHeader.push_back("CellY(mm)");
|
m_vecStrGridDefectHeader.push_back("ScrtRatio");
|
m_vecStrGridDefectHeader.push_back("Density");
|
m_vecStrGridDefectHeader.push_back("MergeState");
|
}
|
|
void CReveiwHistoryDlg::SlideInit()
|
{
|
m_sldImg.SetRange(-1, -1);
|
m_sldImg.SetPos(-1);
|
m_sldImg.SetLineSize(3);
|
m_sldImg.SetPageSize(10);
|
|
int nPos = m_sldImg.GetPos();
|
CString strPos;
|
strPos.Format(_T("%d"), nPos);
|
m_ctrCount.SetWindowText(strPos);
|
|
CString strCount;
|
m_ctlFileCount.SetWindowText("100");
|
m_ctlFileCount.GetWindowText(strCount);
|
|
m_nFileCount = _ttoi(strCount);
|
}
|
|
void CReveiwHistoryDlg::InitGridReviewLIst(CakGridCtrl* pGrid, UINT nRectCtrlID)
|
{
|
std::vector<CString>* pVecHeader = &m_vecStrGridReviewHeader;
|
|
CRect rectGrid;
|
GetDlgItem(nRectCtrlID)->GetWindowRect(&rectGrid);
|
ScreenToClient(&rectGrid);
|
pGrid->Create(rectGrid, this, nRectCtrlID);
|
pGrid->GetDefaultCell(TRUE, FALSE)->SetBackClr(GRID_FIX_COLOR);
|
pGrid->GetDefaultCell(FALSE, TRUE)->SetBackClr(GRID_FIX_COLOR);
|
pGrid->GetDefaultCell(FALSE, FALSE)->SetBackClr(GRID_COLOR);
|
pGrid->SetFixedBkColor(GRID_FIX_COLOR);
|
pGrid->SetGridLines(GVL_BOTH);
|
|
pGrid->SetVirtualMode(FALSE);
|
pGrid->SetCallbackFunc(NULL, 0);
|
pGrid->AllowReorderColumn(FALSE);
|
pGrid->EnableDragRowMode(FALSE);
|
|
pGrid->SetColumnCount((int)pVecHeader->size());
|
pGrid->SetDoubleBuffering(TRUE);
|
pGrid->SetRowCount(2);
|
pGrid->SetFixedRowCount(1);
|
pGrid->SetFixedColumnCount(0);
|
|
pGrid->SetEditable(FALSE);
|
pGrid->EnableSelection(TRUE);
|
pGrid->SetFixedRowSelection(TRUE);
|
pGrid->SetHeaderSort(FALSE);
|
|
// fill it up with stuff
|
pGrid->SetEditable(TRUE);
|
pGrid->EnableDragAndDrop(TRUE);
|
|
int nRowIdx, nColIdx, nRows, nCols, nFixRows, nFixCols;
|
CString strTemp;
|
|
GV_ITEM Item;
|
nRowIdx = 0;
|
nColIdx = 0;
|
Item.mask = GVIF_TEXT;
|
|
Item.row = nRowIdx;
|
Item.col = nColIdx++;
|
strTemp.Format(_T(" No "));
|
Item.strText = strTemp;
|
pGrid->SetItem(&Item);
|
|
Item.row = nRowIdx;
|
Item.col = nColIdx++;
|
strTemp.Format(_T(" Time "));
|
Item.strText = strTemp;
|
pGrid->SetItem(&Item);
|
|
Item.row = nRowIdx;
|
Item.col = nColIdx++;
|
strTemp.Format(_T("열기"));
|
Item.strText = strTemp;
|
pGrid->SetItem(&Item);
|
|
Item.row = nRowIdx;
|
Item.col = nColIdx++;
|
strTemp.Format(_T("PPID"));
|
Item.strText = strTemp;
|
pGrid->SetItem(&Item);
|
|
Item.row = nRowIdx;
|
Item.col = nColIdx++;
|
strTemp.Format(_T("GLASS ID"));
|
Item.strText = strTemp;
|
pGrid->SetItem(&Item);
|
|
Item.row = nRowIdx;
|
Item.col = nColIdx++;
|
strTemp.Format(_T("총 결함 갯수"));
|
Item.strText = strTemp;
|
pGrid->SetItem(&Item);
|
|
Item.row = nRowIdx;
|
Item.col = nColIdx++;
|
strTemp.Format(_T("리뷰 갯수"));
|
Item.strText = strTemp;
|
pGrid->SetItem(&Item);
|
|
Item.row = nRowIdx;
|
Item.col = nColIdx++;
|
strTemp.Format(_T("Judge"));
|
Item.strText = strTemp;
|
pGrid->SetItem(&Item);
|
|
Item.row = nRowIdx++;
|
Item.col = nColIdx;
|
strTemp.Format(_T("File Name"));
|
Item.strText = strTemp;
|
pGrid->SetItem(&Item);
|
|
Item.row = 1;
|
Item.col = 0;
|
strTemp.Format(_T(" "));
|
Item.strText = strTemp;
|
pGrid->SetItem(&Item);
|
|
pGrid->SetCellType(1, 0, RUNTIME_CLASS(CGridCellCheck));
|
|
pGrid->AutoSize();
|
pGrid->Invalidate();
|
|
m_WndArrange.setParentWnd(this);
|
m_WndArrange.addChildWnd(&m_gridReviewList, WA_RESIZE_WIDTH | WA_RESIZE_HEIGHT);
|
}
|
|
void CReveiwHistoryDlg::InitGridGlassLIst(CakGridCtrl* pGrid, UINT nRectCtrlID)
|
{
|
std::vector<CString>* pVecHeader = &m_vecStrGridGlassHeader;
|
|
CRect rectGrid;
|
GetDlgItem(nRectCtrlID)->GetWindowRect(&rectGrid);
|
ScreenToClient(&rectGrid);
|
pGrid->Create(rectGrid, this, nRectCtrlID);
|
|
pGrid->GetDefaultCell(TRUE, FALSE)->SetBackClr(GRID_FIX_COLOR);
|
pGrid->GetDefaultCell(FALSE, TRUE)->SetBackClr(GRID_FIX_COLOR);
|
pGrid->GetDefaultCell(FALSE, FALSE)->SetBackClr(GRID_COLOR);
|
pGrid->SetFixedBkColor(GRID_FIX_COLOR);
|
pGrid->SetGridLines(GVL_BOTH);
|
|
pGrid->SetVirtualMode(TRUE);
|
pGrid->SetCallbackFunc(NULL, 0);
|
pGrid->AllowReorderColumn(FALSE);
|
pGrid->EnableDragRowMode(FALSE);
|
|
pGrid->SetColumnCount((int)pVecHeader->size());
|
pGrid->SetDoubleBuffering(TRUE);
|
pGrid->SetRowCount(2);
|
pGrid->SetFixedRowCount(1);
|
pGrid->SetFixedColumnCount(0);
|
|
pGrid->SetEditable(FALSE);
|
pGrid->EnableSelection(TRUE);
|
pGrid->SetFixedRowSelection(TRUE);
|
pGrid->SetHeaderSort(FALSE);
|
|
// fill it up with stuff
|
pGrid->SetEditable(TRUE);
|
pGrid->EnableDragAndDrop(TRUE);
|
|
pGrid->AutoSize();
|
pGrid->Invalidate();
|
|
m_WndArrange.setParentWnd(this);
|
m_WndArrange.addChildWnd(&m_gridGlassInfo, WA_RESIZE_WIDTH | WA_RESIZE_HEIGHT);
|
}
|
|
void CReveiwHistoryDlg::InitGridDefectLIst(CakGridCtrl* pGrid, UINT nRectCtrlID)
|
{
|
std::vector<CString>* pVecHeader = &m_vecStrGridDefectHeader;
|
|
CRect rectGrid;
|
GetDlgItem(nRectCtrlID)->GetWindowRect(&rectGrid);
|
ScreenToClient(&rectGrid);
|
pGrid->Create(rectGrid, this, nRectCtrlID);
|
|
pGrid->GetDefaultCell(TRUE, FALSE)->SetBackClr(GRID_FIX_COLOR);
|
pGrid->GetDefaultCell(FALSE, TRUE)->SetBackClr(GRID_FIX_COLOR);
|
pGrid->GetDefaultCell(FALSE, FALSE)->SetBackClr(GRID_COLOR);
|
pGrid->SetFixedBkColor(GRID_FIX_COLOR);
|
pGrid->SetGridLines(GVL_BOTH);
|
|
pGrid->SetVirtualMode(TRUE);
|
pGrid->SetCallbackFunc(NULL, 0);
|
pGrid->AllowReorderColumn(FALSE);
|
pGrid->EnableDragRowMode(FALSE);
|
|
pGrid->SetColumnCount((int)pVecHeader->size());
|
pGrid->SetDoubleBuffering(TRUE);
|
pGrid->SetRowCount(2);
|
pGrid->SetFixedRowCount(1);
|
pGrid->SetFixedColumnCount(0);
|
|
pGrid->SetEditable(FALSE);
|
pGrid->EnableSelection(TRUE);
|
pGrid->SetFixedRowSelection(TRUE);
|
pGrid->SetHeaderSort(FALSE);
|
|
// fill it up with stuff
|
pGrid->SetEditable(TRUE);
|
pGrid->EnableDragAndDrop(TRUE);
|
|
pGrid->AutoSize();
|
pGrid->Invalidate();
|
|
m_WndArrange.setParentWnd(this);
|
m_WndArrange.addChildWnd(&m_gridDefectInfo, WA_RESIZE_WIDTH | WA_RESIZE_HEIGHT);
|
}
|
|
BOOL CReveiwHistoryDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
|
{
|
if (m_gridReviewList.GetSafeHwnd() && wParam == (WPARAM)m_gridReviewList.GetDlgCtrlID())
|
{
|
*pResult = 1;
|
GV_DISPINFO *pDispInfo = (GV_DISPINFO*)lParam;
|
if (GVN_GETDISPINFO == pDispInfo->hdr.code)
|
{
|
getDispInfoGlass(pDispInfo->item.col, pDispInfo->item.row, &pDispInfo->item.strText);
|
|
return TRUE;
|
}
|
else if (NM_CLICK == pDispInfo->hdr.code)
|
{
|
if (pDispInfo->item.row == 0)
|
{
|
m_gridReviewList.Refresh();
|
}
|
else if (pDispInfo->item.row > 0)
|
{
|
CGridCellCheck* pCellCheck = NULL;
|
pCellCheck = (CGridCellCheck*)m_gridReviewList.GetCell(pDispInfo->item.row, 0);
|
BOOL bMultiCheck = pCellCheck->GetCheck();
|
|
if (m_nCount == pDispInfo->item.row)
|
{
|
if (m_chkSingle.GetCheck())
|
{
|
if (pCellCheck != NULL)
|
{
|
pCellCheck->SetCheck(FALSE);
|
}
|
}
|
else
|
{
|
if (pCellCheck != NULL)
|
{
|
pCellCheck->SetCheck(!bMultiCheck);
|
}
|
}
|
return TRUE;
|
}
|
m_nCount = pDispInfo->item.row;
|
m_nGlassSelect = pDispInfo->item.row;
|
|
CGridCellCheck* pCellCheck2 = NULL;
|
pCellCheck2 = (CGridCellCheck*)m_gridReviewList.GetCell(m_nGlassSelect, 0);
|
BOOL bMultiCheck2 = pCellCheck->GetCheck();
|
|
if (m_chkSingle.GetCheck())
|
{
|
if (pCellCheck != NULL)
|
{
|
pCellCheck->SetCheck(FALSE);
|
}
|
GlassInfoRest();
|
BinFileOpen(pDispInfo->item.row);
|
}
|
else if(m_chkMuti.GetCheck())
|
{
|
if (bMultiCheck2 == TRUE)
|
{
|
// if (MultiSelectCheck(pDispInfo->item.row))
|
// {
|
//if(pDispInfo->item.row)
|
bool bCheck = false;
|
for (int i = 0; i < 105; i++)
|
{
|
if (m_nSelectFile[i] == pDispInfo->item.row)
|
{
|
bCheck = true;
|
}
|
}
|
if (!bCheck)
|
{
|
InitSelectGlass(pDispInfo->item.row);
|
BinFileOpen(pDispInfo->item.row);
|
}
|
/* }*/
|
}
|
else if(bMultiCheck == FALSE)
|
{
|
MultiSelectCheck(pDispInfo->item.row);
|
SetScrollSetting();
|
}
|
}
|
}
|
// if (!m_chkSingle.GetCheck())
|
// {
|
// for (int i = 0; i < MAX_COUNT + 1; i++)
|
// {
|
// for (int iCol = 0; iCol < m_gridReviewList.GetColumnCount(); iCol++)
|
// {
|
// m_gridReviewList.SetItemState(m_nSelectFile[i], iCol, LVIS_SELECTED);
|
// }
|
// }
|
// m_gridReviewList.Invalidate();
|
// }
|
m_nSelectedCol = pDispInfo->item.col;
|
}
|
else if (GVN_ODCACHEHINT == pDispInfo->hdr.code)
|
{
|
GV_CACHEHINT *pCacheHint = (GV_CACHEHINT*)pDispInfo;
|
}
|
}
|
else if (m_gridGlassInfo.GetSafeHwnd() && wParam == (WPARAM)m_gridGlassInfo.GetDlgCtrlID())
|
{
|
*pResult = 1;
|
GV_DISPINFO *pDispInfo = (GV_DISPINFO*)lParam;
|
if (GVN_GETDISPINFO == pDispInfo->hdr.code)
|
{
|
getDispInfoGlassInfo(pDispInfo->item.col, pDispInfo->item.row, &pDispInfo->item.strText);
|
return TRUE;
|
}
|
else if (NM_CLICK == pDispInfo->hdr.code)
|
{
|
//멀티 모드 일때 선택한 놈의 cell 값을 보여 준다
|
if (!m_chkSingle.GetCheck())
|
{
|
SelectCell(pDispInfo->item.row);
|
}
|
}
|
|
else if (GVN_ODCACHEHINT == pDispInfo->hdr.code)
|
{
|
GV_CACHEHINT *pCacheHint = (GV_CACHEHINT*)pDispInfo;
|
}
|
}
|
else if (m_gridDefectInfo.GetSafeHwnd() && wParam == (WPARAM)m_gridDefectInfo.GetDlgCtrlID())
|
{
|
*pResult = 1;
|
GV_DISPINFO *pDispInfo = (GV_DISPINFO*)lParam;
|
if (GVN_GETDISPINFO == pDispInfo->hdr.code)
|
{
|
getDispInfoDefect(pDispInfo->item.col, pDispInfo->item.row, &pDispInfo->item.strText);
|
|
return TRUE;
|
}
|
else if (NM_CLICK == pDispInfo->hdr.code)
|
{
|
if (pDispInfo->item.row == 0)
|
{
|
SortListDefect(pDispInfo->item.col);
|
m_gridDefectInfo.Refresh();
|
}
|
else if (pDispInfo->item.row > 0)
|
{
|
if (pDispInfo->item.row <= m_Formation.m_vecDefects.size())
|
{
|
_akDefect* pDefectInfo = &m_Formation.m_vecDefects[pDispInfo->item.row - 1];
|
|
m_FormationMap.setSelectDefect(pDefectInfo->m_nDefectID);
|
//ImageShow(pDefectInfo->m_nDefectID);
|
if (!m_bDefectAll)
|
{
|
ImageShow(pDispInfo->item.row - 1);
|
}
|
else
|
{
|
ImageShow(pDefectInfo->m_nDefectID);
|
}
|
//멀티 모델일 때와 아닐 때 구분을 하자
|
//정렬 순서를 사용자가 원하는 순으로 하자
|
if (!m_bDefectAll)
|
{
|
m_sldImg.SetPos(pDispInfo->item.row - 1);
|
|
int nPos = m_sldImg.GetPos();
|
CString strPos;
|
strPos.Format(_T("%d"), nPos);
|
m_ctrCount.SetWindowText(strPos);
|
}
|
}
|
}
|
m_nSelectedCol = pDispInfo->item.col;
|
}
|
|
else if (GVN_ODCACHEHINT == pDispInfo->hdr.code)
|
{
|
GV_CACHEHINT *pCacheHint = (GV_CACHEHINT*)pDispInfo;
|
}
|
}
|
|
return CDialog::OnNotify(wParam, lParam, pResult);
|
}
|
|
void CReveiwHistoryDlg::getDispInfoGlass(int nCol, int nRow, CString* pStrData)
|
{
|
if (nRow < 0) return;
|
|
if (nRow == 0)
|
{
|
*pStrData = m_vecStrGridReviewHeader[nCol];
|
}
|
else
|
{
|
CString strItem;
|
int nDataIndex = nRow - 1;
|
|
if (nDataIndex >= m_vecStrGridReviewList.size()) return;
|
|
_akReviewHeader* pDefectInfo = &m_Formation.m_vecHeader[nRow - 1];
|
|
switch (nCol)
|
{
|
case 0: strItem.Format("%d", nRow); break;
|
case 1: strItem.Format("%s", pDefectInfo->m_strFileTime); break;
|
case 2: strItem.Format("%s", pDefectInfo->m_strLoading); break;
|
case 3: strItem.Format("%s", pDefectInfo->m_strPPID); break;
|
case 4: strItem.Format("%s", pDefectInfo->m_strGlassID); break;
|
case 5: strItem.Format("%d", pDefectInfo->m_nDefectIdx); break;
|
case 6: strItem.Format("%d", pDefectInfo->m_nReviewIdx); break;
|
case 7: strItem.Format("%s", pDefectInfo->m_strJudge); break;
|
case 8: strItem.Format("%s", pDefectInfo->m_strFileName); break;
|
}
|
*pStrData = strItem;
|
}
|
}
|
|
void CReveiwHistoryDlg::getDispInfoGlassInfo(int nCol, int nRow, CString* pStrData)
|
{
|
if (nRow < 0) return;
|
|
if (nRow == 0) //header
|
{
|
*pStrData = m_vecStrGridGlassHeader[nCol];
|
}
|
else
|
{
|
CString strItem;
|
int nDataIndex = nRow - 1;
|
|
if (nDataIndex >= m_Formation.m_vecGlassInfo.size()) return;
|
|
_akGlassInfo* pGlassInfo = &m_Formation.m_vecGlassInfo[nRow - 1];
|
|
if (pGlassInfo == NULL) return;
|
|
switch (nCol)
|
{
|
case 0: strItem.Format("%d", pGlassInfo->m_nGlassSelect); break; //"No");
|
case 1: strItem.Format("%s", pGlassInfo->m_strPPID); break; //"GlassID");
|
case 2: strItem.Format("%s", pGlassInfo->m_strGlassID); break; //PPID
|
case 3: strItem.Format("%d", pGlassInfo->m_nDefectNum); break; //LOT ID
|
case 4: strItem.Format("%d", pGlassInfo->m_nReviewNum); break; //SLOT ID
|
case 5: strItem.Format("%s", pGlassInfo->m_strGlassJudge); break; //Glass Judge
|
case 6: strItem.Format("%s", pGlassInfo->m_strLotID); break; //SLOT NUMBER
|
case 7: strItem.Format("%s", pGlassInfo->m_strSLotID); break; //Cell NUmber
|
case 8: strItem.Format("%d", pGlassInfo->m_nSlot_No); break; //Defect Count
|
case 9: strItem.Format("%d", pGlassInfo->m_nCellNum); break; //Glass size H
|
case 10: strItem.Format("%d", pGlassInfo->m_nGlassSizeHeight); break; //Glass Judge
|
case 11: strItem.Format("%d", pGlassInfo->m_nGlassSizeWidth); break; //Glass size W
|
}
|
*pStrData = strItem;
|
}
|
}
|
|
void CReveiwHistoryDlg::getDispInfoDefect(int nCol, int nRow, CString* pStrData)
|
{
|
if (nRow < 0) return;
|
|
if (nRow == 0) //header
|
{
|
*pStrData = m_vecStrGridDefectHeader[nCol];
|
}
|
else
|
{
|
int nDataIndex = nRow - 1;
|
int iRow = m_nSelectedRow;
|
|
if (nDataIndex >= m_Formation.m_vecDefects.size())
|
{
|
return;
|
}
|
|
_akDefect* pDefectInfo = &m_Formation.m_vecDefects[nRow - 1];
|
|
if (pDefectInfo == NULL)
|
return;
|
|
CString strItem;
|
|
switch (nCol)
|
{
|
case 0: strItem.Format("%d", nRow); break;
|
case 1: strItem.Format("%d", pDefectInfo->m_nDefectID); break;
|
case 2:
|
{
|
strItem = _T("");
|
if (pDefectInfo->m_sDefectLoc == DefectLoc_Pattern)
|
strItem = "Pat";
|
else if (pDefectInfo->m_sDefectLoc == DefectLoc_PAD)
|
strItem = "PAD";
|
else if (pDefectInfo->m_sDefectLoc == DefectLoc_C2C)
|
strItem = "C2C";
|
else if (pDefectInfo->m_sDefectLoc == DefectLoc_Crack)
|
strItem = "Crk";
|
else if (pDefectInfo->m_sDefectLoc == DefectLoc_ASG)
|
strItem = "ASG";
|
else if (pDefectInfo->m_sDefectLoc == DefectLoc_BM)
|
strItem = "BM";
|
else
|
strItem = "Pat";
|
}
|
break;
|
case 3: strItem = pDefectInfo->m_strDefectType; break;
|
case 4: strItem.Format("%s", pDefectInfo->m_strDefectCode); break;
|
case 5:
|
{
|
if (pDefectInfo->m_DefectType == DefectType_RBlack)
|
strItem.Format("RB");
|
else if (pDefectInfo->m_DefectType == DefectType_RWhite)
|
strItem.Format("RW");
|
else if (pDefectInfo->m_DefectType == DefectType_TBlack)
|
strItem.Format("TB");
|
else if (pDefectInfo->m_DefectType == DefectType_TWhite)
|
strItem.Format("TW");
|
else
|
strItem = "UN";
|
}
|
break;
|
case 6:
|
{
|
strItem = _T("");
|
|
if (pDefectInfo->m_DefectSubType == DefectSubType_MC) // Common 05 M/N/C/S/K/*
|
strItem = "MC";
|
else if (pDefectInfo->m_DefectSubType == DefectSubType_Mask)
|
strItem = "MD";
|
else if (pDefectInfo->m_DefectSubType == DefectSubType_Common)
|
strItem = "CD";
|
else if (pDefectInfo->m_DefectSubType == DefectSubType_NoDefect)
|
strItem = "NO";
|
else
|
strItem = "N";
|
}
|
break;
|
case 7: strItem.Format("%d", pDefectInfo->m_nDefectRScale); break;
|
case 8:
|
{
|
strItem = _T("");
|
strItem.Format("% 7d", pDefectInfo->m_nUMSizeX);
|
}
|
break;
|
case 9:
|
{
|
strItem = _T("");
|
strItem.Format("% 7d", pDefectInfo->m_nUMSizeY);
|
}
|
break;
|
case 10:
|
strItem.Format("%d", pDefectInfo->m_nUMSize);
|
break;
|
case 11:
|
{
|
int nValue = 0;
|
for (int i = 105; i >= 0; i--)
|
{
|
if (pDefectInfo->m_sZonePixelCount[i] > 0)
|
nValue += 1;
|
if (i > 0)
|
nValue = nValue << 1;
|
}
|
|
strItem.Format("%04X", nValue);
|
}
|
break;
|
case 12: strItem.Format("%d", pDefectInfo->m_nLevelSrcMax); break;
|
case 13: strItem.Format("%d", pDefectInfo->m_nLevelSrcMin); break;
|
case 14: strItem.Format("%d", pDefectInfo->m_nLevelSrcAvg); break;
|
case 15: strItem.Format("%d", pDefectInfo->m_sDefectPeak); break;
|
case 16:
|
{
|
strItem.Format("%s", pDefectInfo->m_strStackFirst);
|
}
|
break;
|
case 17:
|
{
|
strItem = _T("");
|
strItem.Format("% 4d", pDefectInfo->m_nCameraID);
|
}
|
break;
|
case 18: strItem.Format("%d", pDefectInfo->m_nScanIdx); break;
|
case 19: strItem.Format("%d", pDefectInfo->m_nLevelRefMax); break;
|
case 20: strItem.Format("%d", pDefectInfo->m_nLevelRefMin); break;
|
case 21: strItem.Format("%d", pDefectInfo->m_nLevelRefAvg); break;
|
case 22:
|
{
|
CString str;
|
strItem = _T(" ");
|
str.Format("%5.3f", (double)pDefectInfo->m_nUMCenterAlignX / 1000.0);
|
strItem.Insert(9 - str.GetLength(), str);
|
strItem.TrimRight(" ");
|
}
|
break;
|
case 23:
|
{
|
CString str;
|
strItem = _T(" ");
|
str.Format("% 5.3f", (double)pDefectInfo->m_nUMCenterAlignY / 1000.0);
|
strItem.Insert(9 - str.GetLength(), str);
|
strItem.TrimRight(" ");
|
}
|
break;
|
case 24:
|
{
|
CString str;
|
strItem = _T(" ");
|
|
// Panel x축, y축은 글라스와 반대 [6/9/2017 bhs]
|
if (1)//g_pBasic->GetScanCoordination() == SC_XCoord)
|
str.Format("% 5.3f", (double)pDefectInfo->m_nUMCellX / 1000.0);
|
else
|
str.Format("% 5.3f", (double)pDefectInfo->m_nUMCellY / 1000.0);
|
|
strItem.Insert(9 - str.GetLength(), str);
|
strItem.TrimRight(" ");
|
}
|
break;
|
case 25:
|
{
|
CString str;
|
strItem = _T(" ");
|
|
// Panel x축, y축은 글라스와 반대 [6/9/2017 bhs]
|
if (1)//g_pBasic->GetScanCoordination() == SC_XCoord)
|
str.Format("% 5.3f", (double)pDefectInfo->m_nUMCellY / 1000.0);
|
else
|
str.Format("% 5.3f", (double)pDefectInfo->m_nUMCellX / 1000.0);
|
|
strItem.Insert(9 - str.GetLength(), str);
|
strItem.TrimRight(" ");
|
}
|
break;
|
case 26: strItem.Format("%d", pDefectInfo->m_nScratchRatio); break;
|
case 27: strItem.Format("%d", pDefectInfo->m_nDensity); break;
|
case 28: strItem.Format("%d", pDefectInfo->m_bMergeState); break;
|
}
|
|
*pStrData = strItem;
|
}
|
}
|
|
LRESULT CReveiwHistoryDlg::OnMapDefectSelected(WPARAM wParam, LPARAM lParam)
|
{
|
int nSelectMode = static_cast<int>(lParam);
|
int nSelectDefect = static_cast<int>(wParam);
|
|
if (nSelectMode == 0)
|
{
|
setDefectShow(nSelectDefect, 1);
|
//ImageShow(nSelectDefect);
|
|
if (m_Formation.m_vecImage.size() < 0) return 0;
|
|
for (int i = 0; i < m_Formation.m_vecImage.size(); i++)
|
{
|
if (m_Formation.m_vecImage[i].m_nDefectID == nSelectDefect)
|
{
|
ImageShow(i);
|
break;
|
}
|
}
|
|
if (!m_bDefectAll)
|
{
|
m_sldImg.SetPos(m_nSelectedRow - 1);
|
|
int nPos = m_sldImg.GetPos();
|
CString strPos;
|
strPos.Format(_T("%d"), nPos);
|
m_ctrCount.SetWindowText(strPos);
|
}
|
}
|
else if (nSelectMode == 1)
|
{
|
CAlignDlg* lpDlg = CAlignDlg::GetMgr();
|
m_pDlgAlign->setFormShow(nSelectDefect, 1);
|
}
|
|
return 0;
|
}
|
|
LRESULT CReveiwHistoryDlg::OnListDefectSelected(WPARAM wParam, LPARAM lParam)
|
{
|
int nSelectDefect = static_cast<int>(wParam);
|
int nMode = static_cast<int>(lParam);
|
|
m_FormationMap.setSelectDefect(nSelectDefect);
|
|
return 0;
|
}
|
|
LRESULT CReveiwHistoryDlg::OnMapDefectMouseOver(WPARAM wParam, LPARAM lParam)
|
{
|
int nSelectDefect = static_cast<int>(wParam);
|
int nMode = static_cast<int>(lParam);
|
|
return 0;
|
}
|
|
void CReveiwHistoryDlg::OnBnClickedButtonMapviewFit()
|
{
|
m_FormationMap.SetAutoScale();
|
}
|
|
void CReveiwHistoryDlg::OnSize(UINT nType, int cx, int cy)
|
{
|
CDialogEx::OnSize(nType, cx, cy);
|
|
m_WndArrange.process(cx, cy);
|
m_FormationMap.SetAutoScale();
|
m_ImageView.SetResize();
|
}
|
|
void CReveiwHistoryDlg::OnOptionPathsetting()
|
{
|
// TODO: 여기에 명령 처리기 코드를 추가합니다.
|
CPathSettingDlg::GetMgr()->PathSettingLoad();
|
CPathSettingDlg* lpDlg = CPathSettingDlg::GetMgr();
|
lpDlg->ShowWindow(SW_SHOW);
|
|
LOG(Dbg, _T("[Processe] PathSetting Click"));
|
}
|
|
|
void CReveiwHistoryDlg::OnViewAlldefect()
|
{
|
// TODO: 여기에 명령 처리기 코드를 추가합니다.
|
CMenu *hMenu = GetMenu();
|
if (hMenu->GetMenuState(ID_VIEW_ALLDEFECT, MF_BYCOMMAND) != MF_CHECKED)
|
{
|
hMenu->CheckMenuItem(ID_VIEW_ALLDEFECT, MF_CHECKED);
|
hMenu->CheckMenuItem(ID_VIEW_REVIEWDEFECT, MF_UNCHECKED);
|
m_bDefectAll = true;
|
}
|
else
|
{
|
hMenu->CheckMenuItem(ID_VIEW_REVIEWDEFECT, MF_CHECKED);
|
hMenu->CheckMenuItem(ID_VIEW_ALLDEFECT, MF_UNCHECKED);
|
m_bDefectAll = false;
|
}
|
|
if (m_chkSingle.GetCheck())
|
{
|
GlassInfoRest();
|
BinFileOpen(m_nCount);
|
}
|
else
|
{
|
for(int i=0; i< 105; i++)
|
{
|
int nSelect = m_nSelectFile[i];
|
BinFileOpen(nSelect);
|
}
|
}
|
}
|
|
|
void CReveiwHistoryDlg::OnViewReviewdefect()
|
{
|
// TODO: 여기에 명령 처리기 코드를 추가합니다.
|
CMenu *hMenu = GetMenu();
|
if (hMenu->GetMenuState(ID_VIEW_REVIEWDEFECT, MF_BYCOMMAND) != MF_CHECKED)
|
{
|
hMenu->CheckMenuItem(ID_VIEW_REVIEWDEFECT, MF_CHECKED);
|
hMenu->CheckMenuItem(ID_VIEW_ALLDEFECT, MF_UNCHECKED);
|
m_bDefectAll = false;
|
}
|
else
|
{
|
hMenu->CheckMenuItem(ID_VIEW_REVIEWDEFECT, MF_UNCHECKED);
|
hMenu->CheckMenuItem(ID_VIEW_ALLDEFECT, MF_CHECKED);
|
m_bDefectAll = true;
|
}
|
|
if (m_chkSingle.GetCheck())
|
{
|
GlassInfoRest();
|
BinFileOpen(m_nCount);
|
}
|
else
|
{
|
BinFileOpen(m_nCount);
|
}
|
}
|
|
void CReveiwHistoryDlg::OnAlignView()
|
{
|
// TODO: 여기에 명령 처리기 코드를 추가합니다.
|
CRect rectWindow;
|
GetClientRect(&rectWindow);
|
ClientToScreen(&rectWindow);
|
|
CAlignDlg* lpDlg = CAlignDlg::GetMgr();
|
|
lpDlg->SetWindowPos(NULL, rectWindow.right + 5, rectWindow.top - 50, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
|
lpDlg->ShowWindow(SW_SHOW);
|
lpDlg->DrawnoImage();
|
}
|
|
void CReveiwHistoryDlg::FileTime(CString strPath)
|
{
|
HANDLE h_File = CreateFile(_T(strPath), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
|
if (h_File != INVALID_HANDLE_VALUE)
|
{
|
//** create_time : 생성 날짜, access_time : 마지막 접근날짜, write_time : 마지막 수정 날짜
|
FILETIME create_time, access_time, write_time;
|
//** System Time 취득
|
GetFileTime(h_File, &create_time, &access_time, &write_time);
|
|
//** SystemTime은 UTC형식(Universal Time Coordinated)이기 때문에 그냥 사용 불가능
|
//** 지역시간으로 변경(일반적인 시간 계산법 2015/11/09 21:18:35)
|
SYSTEMTIME write_system_time, write_local_time;
|
FileTimeToSystemTime(&write_time, &write_system_time);
|
|
//** write_local_time변수에 변환되어 저장됨
|
//** 저장된 형태는 WORD형(short)
|
//** wYear, wMonth, wDay, wHour, wMinute, wSecond를 활용하여 사용하면 됨
|
SystemTimeToTzSpecificLocalTime(NULL, &write_system_time, &write_local_time);
|
|
int nYear, nMonth, nDay, nHour, nMinute, nSecond;
|
nYear = write_local_time.wYear;
|
nMonth = write_local_time.wMonth;
|
nDay = write_local_time.wDay;
|
nHour = write_local_time.wHour;
|
nMinute = write_local_time.wMinute;
|
nSecond = write_local_time.wSecond;
|
CString strTime;
|
strTime.Format("%04d-%02d-%02d-%02d-%02d-%02d", nYear, nMonth, nDay, nHour, nMinute, nSecond);
|
|
m_vecStrGridTimeList.push_back(strTime);
|
}
|
}
|
|
CgrmGlassRawData g_RawData;
|
void CReveiwHistoryDlg::OpenFileHeader(CString strPath, CString strFullPath)
|
{
|
if (strPath == "") return;
|
|
CgrmGlassRawData* pRawData = &g_RawData;
|
|
if (m_vecStrGridReviewList.size() < 1) return;
|
|
CPathSettingDlg* pReivewSetting = CPathSettingDlg::GetMgr();
|
CString strBinPath;
|
strBinPath = pReivewSetting->GetBinPath();
|
|
pRawData->ImportGlassRaw(m_Server.GetGlassRawInfo(), NULL);
|
|
strcpy_s(pRawData->GetGlassData()->m_strFileName,64, strPath.GetBuffer());
|
strcpy_s(pRawData->GetGlassData()->m_strPath,256, strBinPath.GetBuffer());
|
|
BOOL bRetReadBin = m_pGlassRawMaker->ReadBinFile(pRawData);
|
|
m_Formation.AddDefectHeaderTemp();
|
_akReviewHeader* pDefectInfo = &m_Formation.m_vecHeaderTemp[m_Formation.m_vecHeaderTemp.size() - 1];
|
|
pDefectInfo->m_nReviewIdx = 0;
|
pDefectInfo->m_strFileTime = m_vecStrGridTimeList[m_Formation.m_vecHeaderTemp.size() - 1];
|
pDefectInfo->m_strFileName = m_vecStrGridReviewList[m_Formation.m_vecHeaderTemp.size() - 1];
|
pDefectInfo->m_strFilePath = strFullPath;
|
|
if (bRetReadBin == FALSE)
|
{
|
pDefectInfo->m_nDefectIdx = 0;
|
pDefectInfo->m_strGlassID = "";
|
pDefectInfo->m_strPPID = "";
|
pDefectInfo->m_nReviewIdx = 0;
|
pDefectInfo->m_strJudge = "";
|
pDefectInfo->m_strLoading = "X";
|
|
return;
|
}
|
|
pDefectInfo->m_strLoading = "O";
|
|
//pRawData->ExportGlassRaw(m_Server.GetGlassRawInfo(), (char*)m_Server.GetGlassData());
|
|
int nDataCount = pRawData->GetGlassData()->m_nDefectNum;
|
|
_grmDefectData* pDefect;
|
_grmGlassData* pGlass;
|
|
CString strTemp;
|
CString strReviewImageName;
|
for (int i = 0; i < pRawData->GetGlassData()->m_nDefectNum; i++)
|
{
|
pDefect = pRawData->GetDefectData(i);//m_Server.GetDefectData(i);
|
pGlass = pRawData->GetGlassData(); //m_Server.GetGlassData();
|
|
pDefectInfo->m_nDefectIdx = pGlass->m_nDefectNum;
|
pDefectInfo->m_strGlassID = pGlass->m_strGlassID;
|
pDefectInfo->m_strPPID = pGlass->m_strPPID;
|
pDefectInfo->m_strJudge = pGlass->m_strGlassJudge;
|
|
|
strReviewImageName = pDefect->m_ReviewDefect.m_strRevImageName;
|
|
if (strReviewImageName == "" || strReviewImageName == "*")
|
{
|
continue;
|
}
|
else
|
{
|
pDefectInfo->m_nReviewIdx = pDefectInfo->m_nReviewIdx + 1;
|
}
|
}
|
}
|
|
void CReveiwHistoryDlg::BinFileOpen(int nCount)
|
{
|
BOOL bNewFile = TRUE;
|
if (nCount < 1) return;
|
|
if (m_vecStrGridReviewPath.size() <= 0) return;
|
|
if (m_vecStrGridReviewPath[nCount-1] == m_strRawFilePath) bNewFile = FALSE;
|
|
if (m_Formation.m_vecHeader.size() < 1) return;
|
|
CString strFileName = m_vecStrGridReviewList[nCount-1];
|
CPathSettingDlg* pReivewSetting = CPathSettingDlg::GetMgr();
|
CString strBinPath;
|
strBinPath = pReivewSetting->GetBinPath();
|
|
CgrmGlassRawData RawData;
|
|
RawData.ImportGlassRaw(m_Server.GetGlassRawInfo(), NULL);
|
|
strcpy(RawData.GetGlassData()->m_strFileName, strFileName.GetBuffer());
|
strcpy(RawData.GetGlassData()->m_strPath, strBinPath.GetBuffer());
|
|
BOOL bRetReadBin = m_pGlassRawMaker->ReadBinFile(&RawData);
|
|
CGridCellCheck* pCellCheck = NULL;
|
pCellCheck = (CGridCellCheck*)m_gridReviewList.GetCell(nCount, 0);
|
|
if (bRetReadBin == FALSE)
|
{
|
AfxMessageBox(_T("로드 실패 하였습니다."), MB_OK | MB_ICONERROR);
|
m_FormationMap.SetAutoScale();
|
LOG(Dbg, _T("[Processe] File Open False"));
|
pCellCheck->SetCheck(FALSE);
|
Imagenoload();
|
return;
|
}
|
|
if (bNewFile && m_chkSingle.GetCheck())
|
{
|
m_FormationMap.m_vecCellRect.clear();
|
m_FormationMap.m_vecTempCellRect.clear();
|
m_FormationMap.clear();
|
m_Formation.Clear();
|
m_Formation.m_vecTempDefects.clear();
|
m_Formation.m_vecTempImage.clear();
|
SetScrollRest();
|
}
|
else if (bNewFile && !m_chkSingle.GetCheck())
|
{
|
if (m_bFirst)
|
{
|
m_bFirst = false;
|
m_FormationMap.m_vecCellRect.clear();
|
}
|
m_FormationMap.clear();
|
m_Formation.m_vecFormation.clear();
|
SetScrollRest();
|
}
|
else if (!bNewFile && !m_chkSingle.GetCheck())
|
{
|
m_FormationMap.clear();
|
m_Formation.m_vecFormation.clear();
|
SetScrollRest();
|
}
|
else
|
{
|
m_FormationMap.clear();
|
m_Formation.m_vecDefects.clear();
|
m_Formation.m_vecFormation.clear();
|
m_Formation.m_vecImage.clear();
|
SetScrollRest();
|
}
|
|
RawData.ExportGlassRaw(m_Server.GetGlassRawInfo(), (char*)m_Server.GetGlassData());
|
|
int nDataCount = RawData.GetGlassData()->m_nDefectNum;
|
int nCellCount = RawData.GetGlassData()->m_nCellNum;
|
|
m_strRawFilePath = m_vecStrGridReviewPath[nCount-1];
|
|
_grmGlassData* pGlass = m_Server.GetGlassData();
|
|
m_FormationMap.m_dGlassSizeWidth = pGlass->m_nGlassSizeWidth / 1000;
|
m_FormationMap.m_dGlassSizeHeight = pGlass->m_nGlassSizeHeight / 1000;
|
|
if (m_bDefectAll == false && m_chkSingle.GetCheck())
|
{
|
AddVecDataDefct(nDataCount);
|
}
|
else if (m_bDefectAll == false && !m_chkSingle.GetCheck())
|
{
|
if(m_Formation.m_vecTempDefects.size() > 0)
|
{
|
int nCount2;
|
nCount2 = MultiInsert(nCount, nDataCount);
|
if (nCount2 == -1)
|
{
|
AddVecDataDefct2(nDataCount);
|
}
|
}
|
else
|
{
|
AddVecDataDefct2(nDataCount);
|
}
|
/*AddVecDataDefct2(nDataCount, nCount);*/
|
}
|
else if (m_bDefectAll == true && !m_chkSingle.GetCheck())
|
{
|
if (m_Formation.m_vecTempDefects.size() > 0)
|
{
|
int nCount2;
|
nCount2 = MultiInsert(nCount, nDataCount);
|
if (nCount2 == -1)
|
{
|
AddVecDataDefectAll2(nDataCount);
|
}
|
}
|
else
|
{
|
AddVecDataDefectAll2(nDataCount);
|
}
|
/*AddVecDataDefectAll2(nDataCount, nCount);*/
|
}
|
else
|
{
|
AddVecDataDefectAll(nDataCount);
|
}
|
|
AddVecDataImage(nDataCount);
|
AddVecCellData(nCellCount);
|
AddVecGlassData(nCount);
|
|
AddVecDateSorting(nDataCount);
|
AddVecImageSorting(nDataCount);
|
AddVecCellSorting(nCellCount);
|
|
m_gridDefectInfo.SetRowCount(m_Formation.m_vecDefects.size() + 1);
|
m_gridDefectInfo.Invalidate();
|
|
m_gridGlassInfo.SetRowCount(m_Formation.m_vecGlassInfo.size() + 1);
|
m_gridGlassInfo.Invalidate();
|
|
int nDefectSize = 0;
|
int nImageSize = 0;
|
int nCellSize = 0;
|
int nNext = MAX_COUNT;
|
|
if (m_chkSingle.GetCheck())
|
{
|
m_nDefectSize[0] = GetDefectCount();//m_Formation.m_vecDefects.size();
|
m_nImageSize[0] = GetImageCount();//m_Formation.m_vecImage.size();
|
m_nCellSize[0] = GetCellCount();
|
|
m_nCellSizeTemp[0] = m_nCellSize[0];
|
|
m_nImageCount = 0;
|
m_nDefectCount = 0;
|
m_nCellCount = 0;
|
}
|
else
|
{
|
|
for (int i = 0; i <= MAX_COUNT; i++)
|
{
|
nDefectSize = GetDefectCount();
|
nImageSize = GetImageCount();
|
nCellSize = GetCellCount();
|
|
//1.값을 순서대로 넣는다
|
if (nDefectSize > 0 || nImageSize > 0 || nCellSize > 0)
|
{
|
if (m_nDefectSize[i] == 0 && m_nImageSize[i] == 0 && m_nCellSize[i] == 0)
|
{
|
m_nDefectSize[i] = GetDefectCount();//m_Formation.m_vecDefects.size();
|
m_nImageSize[i] = GetImageCount();//m_Formation.m_vecImage.size();
|
m_nCellSize[i] = GetCellCount();
|
|
m_nImageCount = 0;
|
m_nDefectCount = 0;
|
m_nCellCount = 0;
|
break;
|
}
|
}
|
//2.마지막 값이면 2번째가 첫번째로 올린 후 넣는다.
|
if (nNext == i)
|
{
|
for (int j = 0; j < MAX_COUNT; j++)
|
{
|
m_nDefectSize[j] = m_nDefectSize[j + 1];
|
m_nImageSize[j] = m_nImageSize[j + 1];
|
m_nCellSize[j] = m_nCellSize[j + 1];
|
m_nCellSizeTemp[j] = m_nCellSize[j];
|
}
|
m_nDefectSize[i] = GetDefectCount();//m_Formation.m_vecDefects.size();
|
m_nImageSize[i] = GetImageCount();//m_Formation.m_vecImage.size();
|
m_nCellSize[i] = GetCellCount();
|
|
m_nCellSizeTemp[i] = m_nCellSize[i];
|
|
m_nImageCount = 0;
|
m_nDefectCount = 0;
|
m_nCellCount = 0;
|
}
|
//3.중간에 값이 빠지면 중간 번째 값을 올린 후 넣는다.
|
|
|
// if (i != 0) //i가 0 이 아니면 count를 높인다.
|
// {
|
// nDefectSize += m_nDefectSize[i];
|
// nImageSize += m_nImageSize[i];
|
// nCellSize += m_nCellSize[i];
|
// }
|
// else if (i == 0 && m_nDefectSize[0] > 0) //i가 0인데 디펙이 있으면 카운터를 높인다.
|
// {
|
// nDefectSize += m_nDefectSize[i];
|
// nImageSize += m_nImageSize[i];
|
// nCellSize += m_nCellSize[i];
|
// }
|
|
// if (m_nDefectSize[0] == 0)
|
// {
|
// m_nDefectSize[i] = GetDefectCount();//m_Formation.m_vecDefects.size();
|
// m_nImageSize[i] = GetImageCount();//m_Formation.m_vecImage.size();
|
// m_nCellSize[i] = GetCellCount();
|
//
|
// m_nImageCount = 0;
|
// m_nDefectCount = 0;
|
// m_nCellCount = 0;
|
// break;
|
// }
|
// else if(i != 0 && m_nDefectSize[i] == 0)
|
// {
|
// m_nDefectSize[i] = GetDefectCount(); //m_Formation.m_vecDefects.size() - nDefectSize;
|
// m_nImageSize[i] = GetImageCount(); //m_Formation.m_vecImage.size() - nImageSize;
|
// m_nCellSize[i] = GetCellCount();
|
//
|
// m_nImageCount = 0;
|
// m_nDefectCount = 0;
|
// m_nCellCount = 0;
|
// break;
|
// }
|
}
|
}
|
|
m_FormationMap.m_pDefectFormation = &m_Formation;
|
m_DefectDisplayOption.m_nShowLabel = -1;
|
m_FormationMap.m_pDefectDisplayOption = &m_DefectDisplayOption;
|
|
CAlignDlg* lpDlg = CAlignDlg::GetMgr();
|
lpDlg->m_pDefectFormation = &m_Formation;
|
lpDlg->m_pDefectDisplayOption = &m_DefectDisplayOption;
|
|
if(bNewFile) m_FormationMap.SetAutoScale();
|
else m_FormationMap.ReDraw(TRUE);
|
|
int nDefectNum = m_Server.GetGlassData()->m_nDefectNum;
|
int nNoneGroupDefect = m_Formation.m_vecImage.size();
|
|
if (m_Formation.m_vecImage.size() > 0)
|
{
|
SetScrollSetting();
|
}
|
}
|
|
void CReveiwHistoryDlg::OnCbnSelchangeComboRawtype()
|
{
|
CGlassRawBase* pNewRawMaker = NULL;
|
|
pNewRawMaker = new CGlassRawCPJT;
|
|
if (m_pGlassRawMaker) delete m_pGlassRawMaker;
|
|
m_pGlassRawMaker = pNewRawMaker;
|
|
m_ConfigOption.m_nSelectRawType = 3;
|
|
}
|
|
void CReveiwHistoryDlg::OnBnClickedBtnFindBin()
|
{
|
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
|
|
|
m_vecStrGridReviewList.clear();
|
m_vecStrGridTimeList.clear();
|
m_vecStrGridReviewPath.clear();
|
m_Formation.m_vecHeader.clear();
|
m_FormationMap.clear();
|
m_Formation.Clear();
|
GlassInfoRest();
|
|
// m_ProgressFile.ModifyStyle(0, PBS_MARQUEE);
|
// m_ProgressFile.ShowWindow(TRUE);
|
// pProgressBar->SetMarquee(TRUE, 30);
|
|
|
CPathSettingDlg* pReivewSetting = CPathSettingDlg::GetMgr();
|
CString strBinPath;
|
strBinPath = pReivewSetting->GetBinPath();
|
|
if (strBinPath == "")
|
{
|
return;
|
}
|
strBinPath += _T("\\*.*");
|
|
CFileFind finder;
|
BOOL bWorking = finder.FindFile(strBinPath);
|
|
// CakFileUtil akFile;
|
// akFile.FindFile(strBinPath.GetBuffer());
|
// VECFINDDATA* pVecFindData = akFile.getFindData();
|
//
|
// for (int i = 0; i < pVecFindData->size(); i++)
|
// {
|
// _DefectList akDefect;
|
// m_vecStrDefectList.push_back(akDefect);
|
// _DefectList* pDefectList = &m_vecStrDefectList[i];
|
//
|
//
|
// TRACE("Craete Time : %d, %s \n", (*pVecFindData)[i].time_create, (*pVecFindData)[i].name);
|
// pDefectList->m_nFileTime = (*pVecFindData)[i].time_create;
|
// pDefectList->m_strFileName = (*pVecFindData)[i].name;
|
// // m_vecStrGridReviewList.push_back((*pVecFindData)[i].name);
|
// // m_vecStrGridTimeList.push_back((*pVecFindData)[i].time_create;
|
// OpenFileHeader((*pVecFindData)[i].name);
|
// }
|
|
|
|
CString fileName;
|
CString DirName;
|
int nCount = 1;
|
m_ctlProgress.ShowWindow(TRUE);
|
int nPersent = 0;
|
|
while (bWorking)
|
{
|
m_ctlProgress.SetPos(nPersent);
|
nPersent++;
|
|
if (nPersent >= 100)
|
{
|
nPersent = 0;
|
}
|
|
//다음 파일 / 폴더 가 존재하면다면 TRUE 반환
|
bWorking = finder.FindNextFile();
|
//파일 일때
|
if (finder.IsArchived())
|
{
|
//파일의 이름
|
CString _fileName = finder.GetFileName();
|
|
// 현재폴더 상위폴더 썸네일파일은 제외
|
if (_fileName == _T(".") ||
|
_fileName == _T("..") ||
|
_fileName == _T("Thumbs.db")) continue;
|
|
CString strFindName = ".bin";
|
CString strFileName, strFileName2;
|
strFileName = _fileName.Right(4); //bin 파일만
|
|
if (strFileName.Compare(strFindName) == 0)
|
{
|
/*if(nCount > m_nFileCount) break; //count 여기서 말고 전체 파일을 다 읽은 후에 다시 소팅하자*/
|
m_vecStrGridReviewList.push_back(_fileName);
|
strFileName2 = strBinPath.Left(strBinPath.GetLength() - 3);
|
strFileName2 += _fileName;
|
m_vecStrGridReviewPath.push_back(strFileName2);
|
FileTime(strFileName2);
|
OpenFileHeader(_fileName, strFileName2);
|
/*nCount++;*/
|
}
|
}
|
}
|
|
//여기에서 재 소팅 후에 필요한 만큼만 넣자
|
{
|
//vec를 정렬 한다.
|
SortFileList(1);
|
//갯수만큼만 복사를 한다
|
//복사한 것을 넣는다.
|
|
}
|
CGridCellCheck* pCellCheck = NULL;
|
//
|
// m_gridReviewList.SetCellType(1, 0, RUNTIME_CLASS(CGridCellCheck));
|
//
|
m_gridReviewList.SetRowCount(m_Formation.m_vecHeader.size() + 1);
|
|
{
|
GV_ITEM Item;
|
int nRowIdx = 0;
|
int nColIdx = 0;
|
CString strTemp;
|
Item.mask = GVIF_TEXT;
|
|
_akReviewHeader *pReview = NULL;
|
|
for (int i = 0; i < m_Formation.m_vecHeader.size(); i++)
|
{
|
m_gridReviewList.SetCellType(i + 1, 0, RUNTIME_CLASS(CGridCellCheck));
|
|
// pCellCheck = (CGridCellCheck*)m_ctrlGridGlassList.GetCell(nRowIdx, nColIdx);
|
//
|
// pCellCheck->SetCheck();
|
|
nColIdx = 0;
|
pReview = &m_Formation.m_vecHeader[i];
|
Item.row = i + 1;
|
Item.col = nColIdx++;
|
strTemp.Format(_T("%d"), i + 1);
|
Item.strText = strTemp;
|
m_gridReviewList.SetItem(&Item);
|
|
Item.row = i + 1;
|
Item.col = nColIdx++;
|
strTemp.Format(_T("%s"), pReview->m_strFileTime);
|
Item.strText = strTemp;
|
m_gridReviewList.SetItem(&Item);
|
|
Item.row = i + 1;
|
Item.col = nColIdx++;
|
strTemp.Format(_T("%s"), pReview->m_strLoading);
|
Item.strText = strTemp;
|
m_gridReviewList.SetItem(&Item);
|
|
Item.row = i + 1;
|
Item.col = nColIdx++;
|
strTemp.Format(_T("%s"), pReview->m_strPPID);
|
Item.strText = strTemp;
|
m_gridReviewList.SetItem(&Item);
|
|
Item.row = i + 1;
|
Item.col = nColIdx++;
|
strTemp.Format(_T("%s"), pReview->m_strGlassID);
|
Item.strText = strTemp;
|
m_gridReviewList.SetItem(&Item);
|
|
Item.row = i + 1;
|
Item.col = nColIdx++;
|
strTemp.Format(_T("%d"), pReview->m_nDefectIdx);
|
Item.strText = strTemp;
|
m_gridReviewList.SetItem(&Item);
|
|
Item.row = i + 1;
|
Item.col = nColIdx++;
|
strTemp.Format(_T("%d"), pReview->m_nReviewIdx);
|
Item.strText = strTemp;
|
m_gridReviewList.SetItem(&Item);
|
|
Item.row = i + 1;
|
Item.col = nColIdx++;
|
strTemp.Format(_T("%s"), pReview->m_strJudge);
|
Item.strText = strTemp;
|
m_gridReviewList.SetItem(&Item);
|
|
Item.row = i + 1;
|
Item.col = nColIdx++;
|
strTemp.Format(_T("%s"), pReview->m_strFileName);
|
Item.strText = strTemp;
|
m_gridReviewList.SetItem(&Item);
|
}
|
|
}
|
m_gridReviewList.Invalidate();
|
|
m_ctlProgress.ShowWindow(FALSE);
|
}
|
|
void CReveiwHistoryDlg::ShowProgressBar()
|
{
|
|
}
|
|
void CReveiwHistoryDlg::setDefectShow(int nDefectID, BOOL bEnsureVisible)
|
{
|
const int nDefectCol = 1;
|
|
if (nDefectID >= 0)
|
{
|
int sajfklwe;
|
sajfklwe = m_gridDefectInfo.GetColumnCount();
|
if (m_nSelectedRow > m_gridDefectInfo.GetColumnCount())
|
{
|
m_nSelectedRow = 0;
|
}
|
|
if(!m_bDefectAll)
|
{
|
if (m_nSelectedRow > m_Formation.m_vecImage.size())
|
{
|
m_nSelectedRow = 0;
|
}
|
}
|
int iRow = m_nSelectedRow;
|
|
for (int iCol = 0; iCol < m_gridDefectInfo.GetColumnCount(); iCol++)
|
{
|
m_gridDefectInfo.SetItemState(iRow, iCol, m_gridDefectInfo.GetItemState(iRow, iCol) & ~GVIS_SELECTED);
|
}
|
}
|
|
for (int i = 0; i < m_Formation.m_vecDefects.size(); i++)
|
{
|
_akDefect* pDefectInfo = &m_Formation.m_vecDefects[i];
|
|
if (pDefectInfo == NULL)
|
return;
|
|
if (pDefectInfo->m_nDefectID == nDefectID)
|
{
|
int iRow = i + 1;
|
for (int iCol = 0; iCol < m_gridDefectInfo.GetColumnCount(); iCol++)
|
{
|
m_gridDefectInfo.SetItemState(iRow, iCol, LVIS_SELECTED);
|
}
|
m_nSelectedRow = iRow;
|
if (bEnsureVisible)
|
{
|
m_gridDefectInfo.EnsureVisible(iRow, m_nSelectedCol);
|
}
|
break;
|
}
|
}
|
|
m_gridDefectInfo.Invalidate();
|
}
|
|
void CReveiwHistoryDlg::ImageShow(int nDefectID)
|
{
|
CPaintDC dc(this);
|
|
if (nDefectID < 0) return;
|
|
m_DefectImage.Destroy();
|
m_ReviewImage.Destroy();
|
//LYW 20210825 #3486 ADD START
|
m_DefectRotateImage.Destroy();
|
//LYW 20210825 #3486 ADD END
|
|
m_AlignFirst.Destroy();
|
m_AlignSecend.Destroy();
|
|
CString DeftectPath, DeftectPath2, AlignPath, AlignPath2;
|
CFileStatus FileOn;
|
TCHAR chFilePath[256] = { 0, };
|
GetModuleFileName(NULL, chFilePath, 256);
|
if (chFilePath == NULL || chFilePath == "") return;
|
|
CString strFolderPath(chFilePath);
|
strFolderPath = strFolderPath.Left(strFolderPath.ReverseFind('\\'));
|
|
strFolderPath = strFolderPath + "\\no-image.png";
|
|
|
//DefectData가 지금 선택된 DefectData를 가져 온다. 이거 수정...
|
|
// _grmDefectData* pDefect = m_Server.GetDefectData(nDefectID);
|
// _grmGlassData* pGlass = m_Server.GetGlassData();
|
int nIndex = 0;
|
//디펙 인덱스와 같은 놈을 찾아라
|
for (int i = 0; i < m_Formation.m_vecImage.size(); i++)
|
{
|
_akReviewList* pImage = NULL;
|
pImage = &m_Formation.m_vecImage[i];
|
|
if (!m_bDefectAll)
|
{
|
nIndex = nDefectID;
|
break;
|
}
|
else
|
{
|
if (pImage->m_nDefectID == nDefectID)
|
{
|
nIndex = i;
|
break;
|
}
|
}
|
}
|
_akReviewList* pImageInfo = &m_Formation.m_vecImage[nIndex];
|
//몇 번째 인지 던진다.
|
|
CString wekfjlwe = pImageInfo->m_strReviewImageName;
|
CString wjkflwe = pImageInfo->m_strAoiImageName;
|
CString jkefawlj = pImageInfo->m_strReviewImagePath;
|
//해당 count를 호출 한다.
|
//파일 이미지를 불러 온다
|
//표현한다.
|
|
|
/* if (pGlass == NULL) return;*/
|
|
//_akReviewList* pDfect2 = &m_Formation.m_vecImage[nDefectID];
|
|
// CString wefjklwef;
|
// wefjklwef = pDfect2->m_strRevewImageName;
|
|
CString strReviewImageName, strInspectorName, strReviewImagePath, strAlignName, strAlignName2;
|
// strReviewImageName = pDefect->m_ReviewDefect.m_strRevImageName;
|
// strInspectorName = pDefect->m_strAoiImageName;
|
// strReviewImagePath = pDefect->m_ReviewDefect.m_strRevImagePath;
|
|
/* pDefect->m_ReviewDefect.m_strRevImagePath*/
|
|
strReviewImageName = wekfjlwe;
|
strInspectorName = wjkflwe;
|
strReviewImagePath = jkefawlj;
|
strAlignName = pImageInfo->m_strAlignFirst; //Glass 값 가져와라
|
strAlignName2 = pImageInfo->m_strAlignSecond;
|
|
// strAlignName.Format(_T("1.jpg"));
|
// strAlignName2.Format(_T("2.jpg"));
|
|
CString strReviewPath;
|
CString strInspectorPath;
|
CString strAlignPath;
|
|
CPathSettingDlg* lpDlg = CPathSettingDlg::GetMgr();
|
strInspectorPath = lpDlg->GetInspectorPath();
|
strReviewPath = lpDlg->GetReviewPath();
|
strAlignPath = lpDlg->GetAlignPath();
|
|
DeftectPath.Format(_T("%s\\%s\\%s"), strReviewPath, strReviewImagePath, strReviewImageName);
|
//DeftectPath2.Format(_T("%s\\%s"), strInspectorPath, strInspectorName);
|
if (strInspectorName == "*" || strInspectorName == "**" || strInspectorName == "***") strInspectorName = "";
|
DeftectPath2.Format(_T("%s\\%s\\%s"), strInspectorPath, pImageInfo->m_strGlassID, strInspectorName);
|
|
AlignPath.Format(_T("%s\\%s\\%s"), strAlignPath, pImageInfo->m_strGlassID, strAlignName);
|
AlignPath2.Format(_T("%s\\%s\\%s"), strAlignPath, pImageInfo->m_strGlassID, strAlignName2);
|
|
if (CFile::GetStatus(DeftectPath, FileOn) && strReviewImageName != "") //파일이 있을 때
|
{
|
CString strTest;
|
strTest = DeftectPath;
|
strcpy(m_strConfigFile, strTest.GetBuffer(0));
|
m_ImageView.SetImageData(m_strConfigFile);
|
m_ImageView.ReDraw();
|
// m_ReviewImage.Load(DeftectPath);
|
// HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), DeftectPath,
|
// IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
|
//
|
//
|
// InvalidateRect(m_picture_rect, FALSE);
|
// dc.SetStretchBltMode(COLORONCOLOR);
|
// m_ReviewImage.Draw(dc, m_picture_rect);
|
}
|
else
|
{
|
CString strTest;
|
strTest = strFolderPath;
|
strcpy(m_strConfigFile, strTest.GetBuffer(0));
|
m_ImageView.SetImageData(m_strConfigFile);
|
m_ImageView.ReDraw();
|
|
// m_ReviewImage.Load(strFolderPath);
|
// HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), strFolderPath,
|
// IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
|
//
|
// InvalidateRect(m_picture_rect, FALSE);
|
// dc.SetStretchBltMode(COLORONCOLOR);
|
// m_ReviewImage.Draw(dc, m_picture_rect);
|
}
|
|
if (CFile::GetStatus(DeftectPath2, FileOn) && strInspectorName != "") //파일이 있을 때
|
{
|
m_DefectImage.Load(DeftectPath2);
|
//LYW 20210825 #3486 ADD START
|
m_DefectRotateImage.Create(m_DefectImage.GetWidth(), m_DefectImage.GetHeight(), m_DefectImage.GetBPP(), 0);
|
ImageRotate(m_DefectImage, m_DefectRotateImage);
|
//LYW 20210825 #3486 ADD END
|
HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), DeftectPath2,
|
IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
|
|
|
InvalidateRect(m_picture_rect2, FALSE);
|
dc.SetStretchBltMode(COLORONCOLOR);
|
//LYW 20210825 #3486 MOD START
|
m_DefectRotateImage.Draw(dc, m_picture_rect2);
|
//LYW 20210825 #3486 MOD END
|
//original
|
//m_DefectImage.Draw(dc, m_picture_rect2);
|
}
|
else
|
{
|
m_DefectImage.Load(strFolderPath);
|
HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), strFolderPath,
|
IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
|
|
InvalidateRect(m_picture_rect2, FALSE);
|
dc.SetStretchBltMode(COLORONCOLOR);
|
m_DefectImage.Draw(dc, m_picture_rect2);
|
}
|
|
if (CFile::GetStatus(AlignPath, FileOn) && strAlignName != "") //파일이 있을 때
|
{
|
m_AlignFirst.Load(AlignPath);
|
HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), AlignPath,
|
IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
|
|
|
InvalidateRect(m_Align_rect, FALSE);
|
dc.SetStretchBltMode(COLORONCOLOR);
|
m_AlignFirst.Draw(dc, m_Align_rect);
|
}
|
else
|
{
|
m_AlignFirst.Load(strFolderPath);
|
HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), strFolderPath,
|
IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
|
|
InvalidateRect(m_Align_rect, FALSE);
|
dc.SetStretchBltMode(COLORONCOLOR);
|
m_AlignFirst.Draw(dc, m_Align_rect);
|
}
|
|
if (CFile::GetStatus(AlignPath2, FileOn) && strAlignName2 != "") //파일이 있을 때
|
{
|
m_AlignSecend.Load(AlignPath2);
|
HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), AlignPath2,
|
IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
|
|
|
InvalidateRect(m_Align_rect2, FALSE);
|
dc.SetStretchBltMode(COLORONCOLOR);
|
m_AlignSecend.Draw(dc, m_Align_rect2);
|
}
|
else
|
{
|
m_AlignSecend.Load(strFolderPath);
|
HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), strFolderPath,
|
IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
|
|
InvalidateRect(m_Align_rect2, FALSE);
|
dc.SetStretchBltMode(COLORONCOLOR);
|
m_AlignSecend.Draw(dc, m_Align_rect2);
|
}
|
}
|
|
void CReveiwHistoryDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
|
{
|
// TODO: 여기에 메시지 처리기 코드를 추가 및/또는 기본값을 호출합니다.
|
if (IDC_SLIDER_IMG == pScrollBar->GetDlgCtrlID())
|
{
|
int nCount = m_sldImg.GetPos();
|
|
CString strPos;
|
strPos.Format(_T("%d"), nCount);
|
m_ctrCount.SetWindowText(strPos);
|
|
if (nCount > -1)
|
{
|
if (m_Formation.m_vecImage.size() <= 0)
|
{
|
SetScrollRest();
|
return;
|
}
|
_akReviewList* pImageInfo = &m_Formation.m_vecImage[nCount];
|
|
m_FormationMap.setSelectDefect(pImageInfo->m_nDefectID);
|
//ImageShow(pImageInfo->m_nDefectID);
|
setDefectShow(pImageInfo->m_nDefectID, 1);
|
}
|
}
|
}
|
|
|
void CReveiwHistoryDlg::OnChangeEditCount()
|
{
|
// TODO: RICHEDIT 컨트롤인 경우, 이 컨트롤은
|
// CDialogEx::OnInitDialog() 함수를 재지정
|
//하고 마스크에 OR 연산하여 설정된 ENM_CHANGE 플래그를 지정하여 CRichEditCtrl().SetEventMask()를 호출하지 않으면
|
// 이 알림 메시지를 보내지 않습니다.
|
|
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
|
|
CString strPos;
|
m_ctrCount.GetWindowText(strPos);
|
|
if (strPos == "") return;
|
|
int nPos = _ttoi(strPos);
|
|
if (nPos < -1)
|
{
|
m_ctrCount.SetWindowText(0);
|
nPos = 0;
|
}
|
else if (nPos > m_Formation.m_vecImage.size()-1)
|
{
|
nPos = m_Formation.m_vecImage.size() - 1;
|
CString strCount;
|
strCount.Format(_T("%d"),nPos);
|
m_ctrCount.SetWindowText(strCount);
|
}
|
|
m_sldImg.SetPos(nPos);
|
|
if (nPos > -1)
|
{
|
if (m_Formation.m_vecImage.size() <= 0)
|
{
|
SetScrollRest();
|
return;
|
}
|
_akReviewList* pImageInfo = &m_Formation.m_vecImage[nPos];
|
|
m_FormationMap.setSelectDefect(pImageInfo->m_nDefectID);
|
//ImageShow(pImageInfo->m_nDefectID/*nPos*/);
|
ImageShow(nPos);
|
setDefectShow(pImageInfo->m_nDefectID, 1);
|
}
|
}
|
|
void CReveiwHistoryDlg::SetScrollSetting()
|
{
|
if (m_Formation.m_vecImage.size() <= 0) return;
|
_akReviewList* pImageInfo = &m_Formation.m_vecImage[m_Formation.m_vecImage.size() - 1];
|
|
int nMinRange = m_Formation.m_vecImage.size()*0.03, nMaxRange = m_Formation.m_vecImage.size()*0.1;
|
|
if (nMinRange <= 0) nMinRange = 1;
|
if (nMaxRange <= 0) nMaxRange = 1;
|
|
m_sldImg.SetRange(0, m_Formation.m_vecImage.size()-1); //범위 설정 최대 이미지 갯수
|
m_sldImg.SetPos(0); //현재 포지션
|
m_sldImg.SetLineSize(nMinRange); //이동할 범위 3%
|
m_sldImg.SetPageSize(nMaxRange); //페이지 업다운 이동 범위 범위 10%
|
|
int nPos = m_sldImg.GetPos();
|
CString strPos;
|
strPos.Format(_T("%d"), nPos);
|
m_ctrCount.SetWindowText(strPos);
|
}
|
|
void CReveiwHistoryDlg::SetScrollRest()
|
{
|
m_sldImg.SetRange(-1, -1);
|
m_sldImg.SetPos(-1);
|
m_sldImg.SetLineSize(3);
|
m_sldImg.SetPageSize(10);
|
|
int nPos = m_sldImg.GetPos();
|
CString strPos;
|
strPos.Format(_T("%d"), nPos);
|
m_ctrCount.SetWindowText(strPos);
|
}
|
|
void CReveiwHistoryDlg::OnBnClickedButton3()
|
{
|
// // TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
|
// CPaintDC dc(this);
|
// HDC hMemDC;
|
//
|
// hMemDC = CreateCompatibleDC(dc);
|
//
|
// m_DefectImage.Destroy();
|
//
|
// CString DeftectPath;
|
// CFileStatus FileOn;
|
// TCHAR chFilePath[256] = { 0, };
|
// GetModuleFileName(NULL, chFilePath, 256);
|
// CString strFolderPath(chFilePath);
|
// strFolderPath = strFolderPath.Left(strFolderPath.ReverseFind('\\'));
|
//
|
// strFolderPath = strFolderPath + "\\no-image.png";
|
// m_DefectImage.Load(strFolderPath);
|
//
|
// HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), strFolderPath,
|
// IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
|
//
|
// InvalidateRect(m_picture_rect, FALSE);
|
//
|
// dc.SetStretchBltMode(COLORONCOLOR);
|
// //StretchBlt(dc, 500, 400, 300, 200, hMemDC, 105, 105, 120, 123, SRCCOPY);
|
// //m_DefectImage.StretchBlt(dc, 0, 0, 100, 100, SRCCOPY);
|
// m_DefectImage.StretchBlt(dc, 0, 0, 500, 200, SRCCOPY);
|
// m_DefectImage.Draw(dc, m_picture_rect);
|
}
|
|
|
void CReveiwHistoryDlg::OnClickedChkAllDefect()
|
{
|
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
|
if (m_chkAllDefect.GetCheck())
|
{
|
if (IDYES == AfxMessageBox(_T("정렬한 값이 모두 초기화 됩니다"), MB_YESNO | MB_ICONWARNING))
|
{
|
m_chkAllDefect.SetCheck(TRUE);
|
m_chkReviewDefect.SetCheck(FALSE);
|
OnViewAlldefect();
|
}
|
else
|
{
|
m_chkAllDefect.SetCheck(FALSE);
|
m_chkReviewDefect.SetCheck(TRUE);
|
}
|
}
|
else
|
{
|
if (IDYES == AfxMessageBox(_T("정렬한 값이 모두 초기화 됩니다"), MB_YESNO | MB_ICONWARNING))
|
{
|
m_chkAllDefect.SetCheck(FALSE);
|
m_chkReviewDefect.SetCheck(TRUE);
|
OnViewReviewdefect();
|
}
|
else
|
{
|
m_chkAllDefect.SetCheck(TRUE);
|
m_chkReviewDefect.SetCheck(FALSE);
|
}
|
}
|
}
|
|
void CReveiwHistoryDlg::OnClickedChkReviewDefect()
|
{
|
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
|
if (m_chkReviewDefect.GetCheck())
|
{
|
if (IDYES == AfxMessageBox(_T("정렬한 값이 모두 초기화 됩니다"), MB_YESNO | MB_ICONWARNING))
|
{
|
m_chkAllDefect.SetCheck(FALSE);
|
m_chkReviewDefect.SetCheck(TRUE);
|
OnViewAlldefect();
|
}
|
else
|
{
|
m_chkAllDefect.SetCheck(TRUE);
|
m_chkReviewDefect.SetCheck(FALSE);
|
}
|
}
|
else
|
{
|
if (IDYES == AfxMessageBox(_T("정렬한 값이 모두 초기화 됩니다"), MB_YESNO | MB_ICONWARNING))
|
{
|
m_chkAllDefect.SetCheck(TRUE);
|
m_chkReviewDefect.SetCheck(FALSE);
|
OnViewReviewdefect();
|
}
|
else
|
{
|
m_chkAllDefect.SetCheck(FALSE);
|
m_chkReviewDefect.SetCheck(TRUE);
|
}
|
}
|
}
|
|
void CReveiwHistoryDlg::OnClickedChkMuti()
|
{
|
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
|
if (m_chkMuti.GetCheck())
|
{
|
if (IDYES == AfxMessageBox(_T("선택한 항목 모두가 지워 집니다"), MB_YESNO | MB_ICONWARNING))
|
{
|
m_chkSingle.SetCheck(FALSE);
|
m_chkMuti.SetCheck(TRUE);
|
|
GlassInfoRest();
|
for (int i = 0; i < 105; i++)
|
{
|
m_nSelectFile[i] = 0;
|
m_nDefectSize[i] = 0;
|
m_nCellSize[i] = 0;
|
m_nImageSize[i] = 0;
|
m_nCellSizeTemp[i] = m_nCellSize[i];
|
}
|
m_Formation.Clear();
|
m_bFirst = true;
|
}
|
else
|
{
|
m_chkSingle.SetCheck(TRUE);
|
m_chkMuti.SetCheck(FALSE);
|
}
|
}
|
else
|
{
|
if (IDYES == AfxMessageBox(_T("선택한 항목 모두가 지워 집니다"), MB_YESNO | MB_ICONWARNING))
|
{
|
m_chkSingle.SetCheck(TRUE);
|
m_chkMuti.SetCheck(FALSE);
|
GlassInfoRest();
|
}
|
else
|
{
|
m_chkSingle.SetCheck(FALSE);
|
m_chkMuti.SetCheck(TRUE);
|
GlassInfoRest();
|
for (int i = 0; i < 105; i++)
|
{
|
m_nSelectFile[i] = 0;
|
m_nDefectSize[i] = 0;
|
m_nCellSize[i] = 0;
|
m_nImageSize[i] = 0;
|
m_nCellSizeTemp[i] = m_nCellSize[i];
|
}
|
m_Formation.Clear();
|
}
|
}
|
}
|
|
void CReveiwHistoryDlg::OnClickedChkSingle()
|
{
|
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
|
if (m_chkSingle.GetCheck())
|
{
|
if (IDYES == AfxMessageBox(_T("선택한 항목 모두가 지워 집니다"), MB_YESNO | MB_ICONWARNING))
|
{
|
m_chkMuti.SetCheck(FALSE);
|
m_chkSingle.SetCheck(TRUE);
|
GlassInfoRest();
|
|
int nRow = 0;
|
nRow = m_gridReviewList.GetRowCount();
|
for (int i = 1; i < nRow; i++)
|
{
|
CGridCellCheck* pCellCheck = NULL;
|
pCellCheck = (CGridCellCheck*)m_gridReviewList.GetCell(i, 0);
|
pCellCheck->SetCheck(FALSE);
|
}
|
m_gridReviewList.Refresh();
|
}
|
else
|
{
|
m_chkSingle.SetCheck(FALSE);
|
m_chkMuti.SetCheck(TRUE);
|
GlassInfoRest();
|
for (int i = 0; i < 105; i++)
|
{
|
m_nSelectFile[i] = 0;
|
m_nDefectSize[i] = 0;
|
m_nCellSize[i] = 0;
|
m_nImageSize[i] = 0;
|
m_nCellSizeTemp[i] = m_nCellSize[i];
|
}
|
}
|
}
|
else
|
{
|
if (IDYES == AfxMessageBox(_T("선택한 항목 모두가 지워 집니다"), MB_YESNO | MB_ICONWARNING))
|
{
|
m_chkMuti.SetCheck(TRUE);
|
m_chkSingle.SetCheck(FALSE);
|
GlassInfoRest();
|
for (int i = 0; i < 105; i++)
|
{
|
m_nSelectFile[i] = 0;
|
m_nDefectSize[i] = 0;
|
m_nCellSize[i] = 0;
|
m_nImageSize[i] = 0;
|
m_nCellSizeTemp[i] = m_nCellSize[i];
|
}
|
m_bFirst = true;
|
}
|
else
|
{
|
m_chkMuti.SetCheck(FALSE);
|
m_chkSingle.SetCheck(TRUE);
|
}
|
}
|
}
|
|
void CReveiwHistoryDlg::Imagenoload()
|
{
|
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
|
CPaintDC dc(this);
|
|
// m_ReviewImage.Destroy();
|
m_DefectImage.Destroy();
|
//LYW 20210825 #3486 ADD START
|
m_DefectRotateImage.Destroy();
|
//LYW 20210825 #3486 ADD END
|
m_AlignFirst.Destroy();
|
m_AlignSecend.Destroy();
|
|
CString DeftectPath;
|
CFileStatus FileOn;
|
TCHAR chFilePath[256] = { 0, };
|
GetModuleFileName(NULL, chFilePath, 256);
|
CString strFolderPath(chFilePath);
|
strFolderPath = strFolderPath.Left(strFolderPath.ReverseFind('\\'));
|
|
strFolderPath = strFolderPath + "\\no-image.png";
|
|
strcpy(m_strConfigFile, strFolderPath.GetBuffer(0));
|
|
m_ImageView.SetImageData(m_strConfigFile);
|
// m_ReviewImage.Load(strFolderPath);
|
m_DefectImage.Load(strFolderPath);
|
m_AlignFirst.Load(strFolderPath);
|
m_AlignSecend.Load(strFolderPath);
|
|
HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), strFolderPath,
|
IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
|
|
// InvalidateRect(m_picture_rect, FALSE);
|
InvalidateRect(m_picture_rect2, FALSE);
|
InvalidateRect(m_Align_rect, FALSE);
|
InvalidateRect(m_Align_rect2, FALSE);
|
|
dc.SetStretchBltMode(COLORONCOLOR);
|
|
m_ImageView.ReDraw();
|
// m_ReviewImage.Draw(dc, m_picture_rect);
|
m_DefectImage.Draw(dc, m_picture_rect2);
|
m_AlignFirst.Draw(dc, m_Align_rect);
|
m_AlignSecend.Draw(dc, m_Align_rect2);
|
}
|
|
//LYW 20210825 #3486 ADD START
|
void CReveiwHistoryDlg::ImageRotate(CImage & SrcImage, CImage & DstImage, double degree/* = 180.0 */)
|
{
|
int Height = SrcImage.GetHeight(); // 세로 길이 저장
|
int Width = SrcImage.GetWidth(); // 가로 길이 저장
|
int new_x, new_y;
|
int R, G, B;
|
int center_x = (SrcImage.GetWidth() / 2); // 회전 중심점
|
int center_y = (SrcImage.GetHeight() / 2); // 회전 중심점
|
|
double seta = 3.14 / (180.0 / degree); // 라디안
|
double CosSeta = cos(seta);
|
double SinSeta = sin(seta);
|
|
for (int y = 0; y < Height; y++)
|
{
|
for (int x = 0; x < Width; x++)
|
{
|
new_x = (int)((x - center_x) * CosSeta - (y - center_y) * SinSeta + center_x);
|
new_y = (int)((x - center_x) * SinSeta + (y - center_y) * CosSeta + center_y);
|
|
if ((new_x < 0) || (new_x > Width) || (new_y < 0) || (new_y > Height))
|
//이미지 범위를 벗어나면 0 값
|
{
|
R = 0;
|
G = 0;
|
B = 0;
|
}
|
else
|
{
|
R = GetRValue(SrcImage.GetPixel(new_x, new_y));
|
G = GetGValue(SrcImage.GetPixel(new_x, new_y));
|
B = GetBValue(SrcImage.GetPixel(new_x, new_y));
|
}
|
DstImage.SetPixel((int)x, (int)y, RGB(R, G, B));
|
new_x = 0; new_y = 0;
|
}
|
}
|
|
}
|
//LYW 20210825 #3486 ADD END
|
|
void CReveiwHistoryDlg::OnChangeEditFileCount()
|
{
|
// TODO: RICHEDIT 컨트롤인 경우, 이 컨트롤은
|
// CDialogEx::OnInitDialog() 함수를 재지정
|
//하고 마스크에 OR 연산하여 설정된 ENM_CHANGE 플래그를 지정하여 CRichEditCtrl().SetEventMask()를 호출하지 않으면
|
// 이 알림 메시지를 보내지 않습니다.
|
|
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
|
CString strCount;
|
m_ctlFileCount.GetWindowText(strCount);
|
m_nFileCount = _ttoi(strCount);
|
}
|
|
BOOL CReveiwHistoryDlg::GetCheckFileLoad(int nCount)
|
{
|
BOOL bNewFile = TRUE;
|
if (nCount == 0) return FALSE;
|
|
if (m_vecStrGridReviewPath.size() <= 0) return FALSE;
|
|
if (m_vecStrGridReviewPath[nCount - 1] == m_strRawFilePath) bNewFile = FALSE;
|
|
if (m_vecStrGridReviewList.size() < 1) return FALSE;
|
|
CString strFileName = m_vecStrGridReviewList[nCount - 1];
|
CPathSettingDlg* pReivewSetting = CPathSettingDlg::GetMgr();
|
CString strBinPath;
|
strBinPath = pReivewSetting->GetBinPath();
|
|
CgrmGlassRawData RawData;
|
|
RawData.ImportGlassRaw(m_Server.GetGlassRawInfo(), NULL);
|
|
strcpy(RawData.GetGlassData()->m_strFileName, strFileName.GetBuffer());
|
strcpy(RawData.GetGlassData()->m_strPath, strBinPath.GetBuffer());
|
|
BOOL bRetReadBin = m_pGlassRawMaker->ReadBinFile(&RawData);
|
|
if (bRetReadBin == FALSE)
|
{
|
m_FormationMap.SetAutoScale();
|
LOG(Dbg, _T("[Processe] File Open False"));
|
Imagenoload();
|
return FALSE;
|
}
|
return TRUE;
|
}
|
|
void CReveiwHistoryDlg::GlassInfoRest()
|
{
|
m_Formation.m_vecGlassInfo.clear();
|
|
for (int i = 0; i < 105; i++)
|
{
|
m_nSelectFile[i] = 0;
|
m_nDefectSize[i] = 0;
|
m_nImageSize[i] = 0;
|
}
|
m_gridGlassInfo.SetRowCount(2);
|
m_gridGlassInfo.Invalidate();
|
}
|
|
BOOL CReveiwHistoryDlg::MultiSelectCheck(int nSelectCount)
|
{
|
if (nSelectCount <= 0) return FALSE;
|
|
//if (m_Formation.m_vecGlassInfo.size() > MAX_COUNT) return FALSE;
|
|
int nDefectSize = 0;
|
int nImageSize = 0;
|
int nCellSize = 0;
|
|
for (int i = 0; i < MAX_COUNT+1; i++)
|
{
|
nDefectSize += m_nDefectSize[i];
|
nImageSize += m_nImageSize[i];
|
nCellSize += m_nCellSize[i];
|
|
if (nSelectCount == m_nSelectFile[i])
|
{
|
for (int j = 0; j < m_Formation.m_vecGlassInfo.size(); j++)
|
{
|
_akGlassInfo* pGlassInfo = &m_Formation.m_vecGlassInfo[j];
|
|
if (pGlassInfo->m_nGlassSelect == m_nSelectFile[i])
|
{
|
m_Formation.m_vecGlassInfo.erase(m_Formation.m_vecGlassInfo.begin() + j);
|
|
if (i == 0)
|
{
|
m_Formation.m_vecDefects.erase(m_Formation.m_vecDefects.begin(), m_Formation.m_vecDefects.begin() + m_nDefectSize[i]);
|
m_Formation.m_vecImage.erase(m_Formation.m_vecImage.begin(), m_Formation.m_vecImage.begin() + m_nImageSize[i]);
|
m_FormationMap.m_vecCellRect.erase(m_FormationMap.m_vecCellRect.begin(), m_FormationMap.m_vecCellRect.begin() + m_nCellSize[i]);
|
m_nCellSize[i] = 0;
|
m_nDefectSize[i] = 0;
|
m_nImageSize[i] = 0;
|
}
|
else if (i != 0 && m_nDefectSize[i] == 0)
|
{
|
|
}
|
else if (i != 0 && m_nDefectSize[i] > 0)
|
{
|
if (m_Formation.m_vecDefects.size() == nDefectSize)
|
{
|
m_Formation.m_vecDefects.clear();
|
//m_Formation.m_vecDefects.erase(m_Formation.m_vecDefects.begin(), m_Formation.m_vecDefects.begin() + m_nDefectSize[i]);
|
}
|
// else
|
// {
|
// m_Formation.m_vecDefects.erase(m_Formation.m_vecDefects.begin() + nDefectSize-1, m_Formation.m_vecDefects.begin() + nDefectSize-1 + m_nDefectSize[i]);
|
// }
|
if (m_Formation.m_vecImage.size() == nImageSize)
|
{
|
m_Formation.m_vecImage.clear();
|
//m_Formation.m_vecImage.erase(m_Formation.m_vecImage.begin(), m_Formation.m_vecImage.begin() + m_nImageSize[i]);
|
}
|
// else
|
// {
|
// m_Formation.m_vecImage.erase(m_Formation.m_vecImage.begin() + nImageSize-1, m_Formation.m_vecImage.begin() + nImageSize-1 + m_nImageSize[i]);
|
// }
|
if (m_FormationMap.m_vecCellRect.size() == nCellSize)
|
{
|
m_FormationMap.m_vecCellRect.clear();
|
//m_FormationMap.m_vecCellRect.erase(m_FormationMap.m_vecCellRect.begin(), m_FormationMap.m_vecCellRect.begin() + m_nCellSize[i]);
|
}
|
// else
|
// {
|
// m_FormationMap.m_vecCellRect.erase(m_FormationMap.m_vecCellRect.begin() + nCellSize, m_FormationMap.m_vecCellRect.begin() + nCellSize + m_nCellSize[i]);
|
// }
|
|
int nCellCount = 0;
|
int nDefectCount = 0;
|
int nImageCount = 0;
|
|
/* int nCount = 0;*/
|
int nCellCount2 = m_nCellSize[i];
|
int nDefectCount2 = m_nDefectSize[i];
|
int nImageCount2 = m_nImageSize[i];
|
|
int nCellCount3 = 0;
|
int nDefectCount3 = 0;
|
int nImageCount3 = 0;
|
|
|
m_nCellSize[i] = 0;
|
m_nDefectSize[i] = 0;
|
m_nImageSize[i] = 0;
|
|
|
|
for (int k = 0; k < MAX_COUNT; k++)
|
{
|
// if (m_nCellSize[k] != 0)
|
// {
|
// nCount++;
|
// }
|
nCellCount = m_nCellSize[k];
|
nDefectCount = m_nDefectSize[k];
|
nImageCount = m_nImageSize[k];
|
|
if (k == 0)
|
{
|
nCellCount3 = 0;
|
nDefectCount3 = 0;
|
nImageCount3 = 0;
|
}
|
else
|
{
|
nCellCount3 += m_nCellSize[k];
|
nDefectCount3 += m_nDefectSize[k];
|
nImageCount3 += m_nImageSize[k];
|
}
|
}
|
|
m_Formation.m_vecDefects.clear();
|
for (int j = 0; j < nDefectSize - nDefectCount2; j++)
|
{
|
_akDefect *pDefectInfo = &m_Formation.m_vecTempDefects[j];
|
double dDefectPosX = pDefectInfo->m_nUMCenterAlignX / 1000.0;
|
double dDefectPosY = pDefectInfo->m_nUMCenterAlignY / 1000.0;
|
|
m_Formation.AddDefect(dDefectPosX, dDefectPosY);
|
m_Formation.m_vecDefects[j] = m_Formation.m_vecTempDefects[j];
|
//디펙 시작 크기 만큼만 복사 한다
|
}
|
if (m_nDefectSize[i + 1] != 0)
|
{
|
int nCount = m_Formation.m_vecDefects.size();
|
for (int j = 0; j < m_Formation.m_vecTempDefects.size() - nDefectSize; j++)
|
{
|
_akDefect *pDefectInfo = &m_Formation.m_vecTempDefects[nDefectSize + j];
|
double dDefectPosX = pDefectInfo->m_nUMCenterAlignX / 1000.0;
|
double dDefectPosY = pDefectInfo->m_nUMCenterAlignY / 1000.0;
|
|
m_Formation.AddDefect(dDefectPosX, dDefectPosY);
|
m_Formation.m_vecDefects[nCount + j] = m_Formation.m_vecTempDefects[nDefectSize +j];
|
}
|
}
|
|
m_Formation.m_vecImage.clear();
|
for (int j = 0; j < nImageSize - nImageCount2; j++)
|
{
|
m_Formation.AddDefectImage();
|
m_Formation.m_vecImage[j] = m_Formation.m_vecTempImage[j];
|
//디펙 시작 크기 만큼만 복사 한다
|
}
|
if (m_nImageSize[i + 1] != 0)
|
{
|
int nCount = m_Formation.m_vecImage.size();
|
for (int j = 0; j < m_Formation.m_vecTempImage.size() - nImageSize; j++)
|
{
|
m_Formation.AddDefectImage();
|
m_Formation.m_vecImage[nCount + j] = m_Formation.m_vecTempImage[nImageSize + j];
|
}
|
}
|
|
m_FormationMap.m_vecCellRect.clear();
|
for (int j = 0; j < nCellSize - nCellCount2; j++)
|
{
|
m_FormationMap.AddCell();
|
m_FormationMap.m_vecCellRect[j] = m_FormationMap.m_vecTempCellRect[j];
|
//디펙 시작 크기 만큼만 복사 한다
|
}
|
|
if (m_nCellSize[i + 1] != 0)
|
{
|
int nCount = m_FormationMap.m_vecCellRect.size();
|
for (int j = 0; j < m_FormationMap.m_vecTempCellRect.size() - nCellSize; j++)
|
{
|
m_FormationMap.AddCell();
|
m_FormationMap.m_vecCellRect[nCount + j] = m_FormationMap.m_vecTempCellRect[nCellSize + j];
|
}
|
}
|
}
|
|
m_nSelectFile[i] = 0;
|
|
// for (int i = 0; i < MAX_COUNT + 1; i++)
|
// {
|
// for (int iCol = 0; iCol < m_gridReviewList.GetColumnCount(); iCol++)
|
// {
|
// m_gridReviewList.SetItemState(m_nSelectFile[i], iCol, LVIS_SELECTED);
|
// }
|
// }
|
//
|
// m_gridReviewList.Invalidate();
|
|
// int nSelect = i;
|
// bool bMax = false;
|
// for (nSelect; nSelect < MAX_COUNT; nSelect++)
|
// {
|
// m_nSelectFile[nSelect] = m_nSelectFile[nSelect + 1];
|
// bMax = true;
|
// }
|
// if (bMax)
|
// {
|
// m_nSelectFile[nSelect] = 0;
|
// }
|
// m_nDefectSize[i] = 0;
|
// m_nImageSize[i] = 0;
|
/* m_nCellSize[i] = 0;*/
|
// for (j = 0; j < MAX_COUNT; j++)
|
// {
|
// if (i <= j)
|
// {
|
// m_nCellSize[j] = m_nCellSize[j + 1];
|
// }
|
// }
|
AddVecCellSorting(0);
|
AddVecDateSorting(0);
|
m_gridGlassInfo.SetRowCount(m_Formation.m_vecGlassInfo.size() + 1);
|
m_gridDefectInfo.SetRowCount(m_Formation.m_vecDefects.size() + 1);
|
m_FormationMap.ReDraw(TRUE);
|
return FALSE;
|
}
|
}
|
}
|
}
|
|
if (m_Formation.m_vecGlassInfo.size() >= MAX_COUNT + 1) // 1 base
|
{
|
m_Formation.m_vecGlassInfo.erase(m_Formation.m_vecGlassInfo.begin());
|
|
if (m_nDefectSize[0] != 0)
|
{
|
m_Formation.m_vecDefects.erase(m_Formation.m_vecDefects.begin(), m_Formation.m_vecDefects.begin() + m_nDefectSize[0]);
|
}
|
if (m_nImageSize[0] != 0)
|
{
|
m_Formation.m_vecImage.erase(m_Formation.m_vecImage.begin(), m_Formation.m_vecImage.begin() + m_nImageSize[0]);
|
}
|
if (m_nCellSize[0] != 0)
|
{
|
m_FormationMap.m_vecCellRect.erase(m_FormationMap.m_vecCellRect.begin(), m_FormationMap.m_vecCellRect.begin() + m_nCellSize[0]);
|
}
|
}
|
return TRUE;
|
}
|
|
int CReveiwHistoryDlg::MultiInsert(int nSelectCount, int nDataCount)
|
{
|
if (nSelectCount <= 0) return FALSE;
|
|
//if (m_Formation.m_vecGlassInfo.size() > MAX_COUNT) return FALSE;
|
|
if (m_Formation.m_vecGlassInfo.size() >= MAX_COUNT+1) //1base
|
{
|
m_Formation.m_vecGlassInfo.erase(m_Formation.m_vecGlassInfo.begin());
|
|
if (m_nDefectSize[0] != 0)
|
{
|
m_Formation.m_vecDefects.erase(m_Formation.m_vecDefects.begin(), m_Formation.m_vecDefects.begin() + m_nDefectSize[0]);
|
}
|
if (m_nImageSize[0] != 0)
|
{
|
m_Formation.m_vecImage.erase(m_Formation.m_vecImage.begin(), m_Formation.m_vecImage.begin() + m_nImageSize[0]);
|
}
|
if (m_nCellSize[0] != 0)
|
{
|
m_FormationMap.m_vecCellRect.erase(m_FormationMap.m_vecCellRect.begin(), m_FormationMap.m_vecCellRect.begin() + m_nCellSize[0]);
|
}
|
}
|
|
int nDefectSize = 0;
|
int nImageSize = 0;
|
int nCellSize = 0;
|
|
for (int i = 0; i < MAX_COUNT; i++)
|
{
|
nDefectSize += m_nDefectSize[i];
|
nImageSize += m_nImageSize[i];
|
nCellSize += m_nCellSize[i];
|
|
if (nSelectCount == m_nSelectFile[i])
|
{
|
for (int j = 0; j < m_Formation.m_vecGlassInfo.size(); j++)
|
{
|
_akGlassInfo* pGlassInfo = &m_Formation.m_vecGlassInfo[j];
|
|
if (pGlassInfo->m_nGlassSelect == m_nSelectFile[i])
|
{
|
m_Formation.m_vecGlassInfo.erase(m_Formation.m_vecGlassInfo.begin() + j);
|
|
if (i == 0)
|
{
|
m_Formation.m_vecDefects.erase(m_Formation.m_vecDefects.begin(), m_Formation.m_vecDefects.begin() + m_nDefectSize[i]);
|
m_Formation.m_vecDefects.clear();
|
m_Formation.m_vecImage.erase(m_Formation.m_vecImage.begin(), m_Formation.m_vecImage.begin() + m_nImageSize[i]);
|
m_Formation.m_vecImage.clear();
|
m_FormationMap.m_vecCellRect.erase(m_FormationMap.m_vecCellRect.begin(), m_FormationMap.m_vecCellRect.begin() + m_nCellSize[i]);
|
|
if (m_bDefectAll == false && !m_chkSingle.GetCheck())
|
{
|
AddVecDataDefct2(nDataCount/*, nCount*/);
|
}
|
else if (m_bDefectAll == true && !m_chkSingle.GetCheck())
|
{
|
AddVecDataDefectAll2(nDataCount/*, nCount*/);
|
}
|
}
|
else if (i != 0 && m_nDefectSize[i] == 0)
|
{
|
if (m_bDefectAll == false && !m_chkSingle.GetCheck())
|
{
|
AddVecDataDefct2(nDataCount/*, nCount*/);
|
}
|
else if (m_bDefectAll == true && !m_chkSingle.GetCheck())
|
{
|
AddVecDataDefectAll2(nDataCount/*, nCount*/);
|
}
|
}
|
else if (i != 0 && m_nDefectSize[i] > 0)
|
{
|
if (m_Formation.m_vecDefects.size() == nDefectSize)
|
{
|
m_Formation.m_vecDefects.erase(m_Formation.m_vecDefects.begin(), m_Formation.m_vecDefects.begin() + m_nDefectSize[i]);
|
}
|
// else
|
// {
|
Sleep(1);
|
//n개 까지만 복사 한다. 클리어 후 에
|
m_Formation.m_vecDefects.clear();
|
for (int j = 0; j < nDefectSize-m_nDefectSize[i]; j++)
|
{
|
_akDefect *pDefectInfo = &m_Formation.m_vecTempDefects[j];
|
double dDefectPosX = pDefectInfo->m_nUMCenterAlignX / 1000.0;
|
double dDefectPosY = pDefectInfo->m_nUMCenterAlignY / 1000.0;
|
|
m_Formation.AddDefect(dDefectPosX, dDefectPosY);
|
m_Formation.m_vecDefects[j] = m_Formation.m_vecTempDefects[j];
|
//디펙 시작 크기 만큼만 복사 한다
|
}
|
//생성된 디펙을 추가 한다
|
if (m_bDefectAll == false && !m_chkSingle.GetCheck())
|
{
|
AddVecDataDefct2(nDataCount/*, nCount*/);
|
}
|
else if (m_bDefectAll == true && !m_chkSingle.GetCheck())
|
{
|
AddVecDataDefectAll2(nDataCount/*, nCount*/);
|
}
|
|
// Sleep(1);
|
//
|
// //추가한 디펙 뒤에 붙여 넣는다
|
// if (m_nDefectSize[i + 1] != 0)
|
// {
|
// for (int j = 0; j < m_nDefectSize[i + 1]; j++)
|
// {
|
// int nCount = m_nDefectSize[i - 1];
|
// _akDefect *pDefectInfo = &m_Formation.m_vecTempDefects[nDefectSize + j];
|
// double dDefectPosX = pDefectInfo->m_nUMCenterAlignX / 1000.0;
|
// double dDefectPosY = pDefectInfo->m_nUMCenterAlignY / 1000.0;
|
//
|
// m_Formation.AddDefect(dDefectPosX, dDefectPosY);
|
// m_Formation.m_vecDefects[nCount + j] = m_Formation.m_vecTempDefects[nDefectSize + j];
|
// }
|
// }
|
|
Sleep(1);
|
m_Formation.m_vecImage.clear();
|
for (int j = 0; j < nImageSize - m_nImageSize[i]; j++)
|
{
|
m_Formation.AddDefectImage();
|
m_Formation.m_vecImage[j] = m_Formation.m_vecTempImage[j];
|
//디펙 시작 크기 만큼만 복사 한다
|
}
|
if (m_nImageSize[i + 1] != 0)
|
{
|
int nSize = m_Formation.m_vecTempImage.size() - m_Formation.m_vecImage.size();
|
//시작 부터 끝까지 복사를 한다
|
for (int j = 0; j < nSize; j++)
|
{
|
int nCount = m_nImageSize[i - 1];
|
|
m_Formation.AddDefectImage();
|
m_Formation.m_vecImage[nCount + j] = m_Formation.m_vecTempImage[nCount + j];
|
}
|
}
|
|
Sleep(1);
|
m_FormationMap.m_vecCellRect.clear();
|
for (int j = 0; j < nCellSize - m_nCellSize[i]; j++)
|
{
|
m_FormationMap.AddCell();
|
m_FormationMap.m_vecCellRect[j] = m_FormationMap.m_vecTempCellRect[j];
|
//디펙 시작 크기 만큼만 복사 한다
|
}
|
if (m_nCellSize[i + 1] != 0)
|
{
|
int nSize = m_FormationMap.m_vecTempCellRect.size() - m_FormationMap.m_vecCellRect.size();
|
for (int j = 0; j < nSize; j++)
|
{
|
int nCount = m_nCellSize[i - 1];
|
|
m_FormationMap.AddCell();
|
m_FormationMap.m_vecCellRect[nCount + j] = m_FormationMap.m_vecTempCellRect[nCount + j];
|
//m_FormationMap.m_vecCellRect[nCount + j] = m_FormationMap.m_vecTempCellRect[nCellSize + j];
|
}
|
}
|
|
//m_Formation.m_vecDefects.erase(m_Formation.m_vecDefects.begin() + nDefectSize, m_Formation.m_vecDefects.begin() + nDefectSize + m_nDefectSize[i]);
|
|
// if (m_Formation.m_vecImage.size() == nImageSize)
|
// {
|
// m_Formation.m_vecImage.erase(m_Formation.m_vecImage.begin(), m_Formation.m_vecImage.begin() + m_nImageSize[i]);
|
// }
|
// else
|
// {
|
// m_Formation.m_vecImage.erase(m_Formation.m_vecImage.begin() + nImageSize, m_Formation.m_vecImage.begin() + nImageSize + m_nImageSize[i]);
|
// }
|
}
|
|
//m_nSelectFile[i] = 0;
|
m_nDefectSize[i] = 0;
|
m_nImageSize[i] = 0;
|
m_nCellSize[i] = 0;
|
// for (j = 0; j < MAX_COUNT; j++)
|
// {
|
// if (i <= j)
|
// {
|
// m_nCellSize[j] = m_nCellSize[j + 1];
|
// }
|
// }
|
|
if (m_Formation.m_vecGlassInfo.size() > 0)
|
{
|
m_gridGlassInfo.SetRowCount(m_Formation.m_vecGlassInfo.size() + 1);
|
m_gridDefectInfo.SetRowCount(m_Formation.m_vecDefects.size() + 1);
|
return i;
|
}
|
else
|
{
|
m_gridGlassInfo.SetRowCount(2);
|
m_gridDefectInfo.SetRowCount(2);
|
return i;
|
}
|
return i;
|
}
|
}
|
}
|
}
|
|
// if (m_bDefectAll == false && !m_chkSingle.GetCheck())
|
// {
|
// AddVecDataDefct2(nDataCount/*, nCount*/);
|
// }
|
// else if (m_bDefectAll == true && !m_chkSingle.GetCheck())
|
// {
|
// AddVecDataDefectAll2(nDataCount/*, nCount*/);
|
// }
|
return -1;
|
}
|
|
void CReveiwHistoryDlg::InitSelectGlass(int nSelectCount)
|
{
|
int nCountMax = MAX_COUNT+1;
|
bool bMax = false;
|
for (int i = 0; i < MAX_COUNT+1; i++)
|
{
|
if (nSelectCount != m_nSelectFile[i] && m_nSelectFile[i] == 0)
|
{
|
if (!GetCheckFileLoad(nSelectCount)) return;
|
m_nSelectFile[i] = nSelectCount;
|
bMax = true;
|
break;
|
}
|
}
|
if (!bMax)
|
{
|
for (int j = 0; j < MAX_COUNT; j++)
|
{
|
if (!GetCheckFileLoad(nSelectCount)) return;
|
m_nSelectFile[j] = m_nSelectFile[j + 1];
|
}
|
m_nSelectFile[MAX_COUNT] = nSelectCount;
|
}
|
}
|
|
void CReveiwHistoryDlg::AddVecDataImage(int nDataCount)
|
{
|
for (int i = 0; i < nDataCount; i++)
|
{
|
_grmDefectData* pDefect = m_Server.GetDefectData(i);
|
_grmGlassData* pGlass = m_Server.GetGlassData();
|
|
CString strTemp;
|
int nInfoCount = 0;
|
|
CString strReviewImageName;
|
strReviewImageName = pDefect->m_ReviewDefect.m_strRevImageName;
|
|
if (strReviewImageName == "" || strReviewImageName == "*")
|
{
|
continue;
|
}
|
else
|
{
|
m_Formation.AddDefectImage();
|
SetImageCount();
|
_akReviewList* pImageInfo = &m_Formation.m_vecImage[m_Formation.m_vecImage.size() - 1];
|
|
pImageInfo->m_nDefectID = pDefect->m_nDefectID;
|
strcpy(pImageInfo->m_strAoiImageName, pDefect->m_strAoiImageName);
|
pImageInfo->m_nDefectIdx = pDefect->m_nDefectIdx;
|
pImageInfo->m_strReviewImageName = strReviewImageName;
|
|
strcpy(pImageInfo->m_strAoiImagePath, pDefect->m_strAoiImagePath);
|
strcpy(pImageInfo->m_strReviewImagePath, pDefect->m_ReviewDefect.m_strRevImagePath);
|
strcpy(pImageInfo->m_strAlignFirst, pGlass->m_strAlignFirst);
|
strcpy(pImageInfo->m_strAlignSecond, pGlass->m_strAlignSecond);
|
pImageInfo->m_strGlassID = pGlass->m_strGlassID;
|
}
|
}
|
}
|
|
void CReveiwHistoryDlg::AddVecDataDefct(int nDataCount)
|
{
|
for (int i = 0; i < nDataCount; i++)
|
{
|
_grmDefectData* pDefect = m_Server.GetDefectData(i);
|
|
int nInfoCount = 0;
|
|
CString strReviewImageName;
|
strReviewImageName = pDefect->m_ReviewDefect.m_strRevImageName;
|
|
if (strReviewImageName == "" || strReviewImageName == "*")
|
{
|
continue;
|
}
|
else
|
{
|
double dDefectPosX = pDefect->m_nUMCenterAlignX / 1000.0;
|
double dDefectPosY = pDefect->m_nUMCenterAlignY / 1000.0;
|
|
m_Formation.AddDefect(dDefectPosX, dDefectPosY);
|
SetDefectCount();
|
_akDefect* pDefectInfo = &m_Formation.m_vecDefects[m_Formation.m_vecDefects.size() - 1];
|
|
pDefectInfo->m_nDefectID = pDefect->m_nDefectID;
|
pDefectInfo->m_sDefectLoc = pDefect->m_sDefectLoc;
|
strcpy(pDefectInfo->m_strDefectType, pDefect->m_strDefectType);
|
strcpy(pDefectInfo->m_strDefectCode, pDefect->m_strDefectCode);
|
pDefectInfo->m_DefectType = pDefect->m_DefectType;
|
pDefectInfo->m_DefectSubType = pDefect->m_DefectSubType;
|
pDefectInfo->m_nDefectRScale = pDefect->m_nDefectRScale;
|
pDefectInfo->m_nUMSizeX = pDefect->m_nUMSizeX;
|
pDefectInfo->m_nUMSizeY = pDefect->m_nUMSizeY;
|
pDefectInfo->m_nUMSize = pDefect->m_nUMSize;
|
memcpy(pDefectInfo->m_sZonePixelCount, pDefect->m_sZonePixelCount, sizeof(pDefect->m_sZonePixelCount));
|
pDefectInfo->m_nLevelSrcMax = pDefect->m_nLevelSrcMax;
|
pDefectInfo->m_nLevelSrcMin = pDefect->m_nLevelSrcMin;
|
pDefectInfo->m_nLevelSrcAvg = pDefect->m_nLevelSrcAvg;
|
pDefectInfo->m_sDefectPeak = pDefect->m_sDefectPeak;
|
strcpy(pDefectInfo->m_strStackFirst, pDefect->m_strStackFirst);
|
pDefectInfo->m_nCameraID = pDefect->m_nCameraID;
|
pDefectInfo->m_nScanIdx = pDefect->m_nScanIdx;
|
pDefectInfo->m_nLevelRefMax = pDefect->m_nLevelRefMax;
|
pDefectInfo->m_nLevelRefMin = pDefect->m_nLevelRefMin;
|
pDefectInfo->m_nLevelRefAvg = pDefect->m_nLevelRefAvg;
|
pDefectInfo->m_nUMCenterAlignX = pDefect->m_nUMCenterAlignX;
|
pDefectInfo->m_nUMCenterAlignY = pDefect->m_nUMCenterAlignY;
|
pDefectInfo->m_nUMCellX = pDefect->m_nUMCellX;
|
pDefectInfo->m_nUMCellY = pDefect->m_nUMCellY;
|
pDefectInfo->m_nScratchRatio = pDefect->m_nScratchRatio;
|
pDefectInfo->m_nDensity = pDefect->m_nDensity;
|
pDefectInfo->m_bMergeState = pDefect->m_bMergeState;
|
pDefectInfo->m_nShotIdx = pDefect->m_ReviewDefect.m_nShotIndex;
|
pDefectInfo->m_nModelIdx = pDefect->m_ReviewDefect.m_nModuleIndex;
|
|
for (int j = 0; j < nInfoCount; j++) pDefectInfo->m_strInfos[j].Trim();
|
}
|
}
|
}
|
|
void CReveiwHistoryDlg::AddVecDataDefectAll(int nDataCount)
|
{
|
for (int i = 0; i < nDataCount; i++)
|
{
|
_grmDefectData* pDefect = m_Server.GetDefectData(i);
|
int nInfoCount = 0;
|
|
double dDefectPosX = pDefect->m_nUMCenterAlignX / 1000.0;
|
double dDefectPosY = pDefect->m_nUMCenterAlignY / 1000.0;
|
|
m_Formation.AddDefect(dDefectPosX, dDefectPosY);
|
SetDefectCount();
|
_akDefect* pDefectInfo = &m_Formation.m_vecDefects[m_Formation.m_vecDefects.size() - 1];
|
|
pDefectInfo->m_nDefectID = pDefect->m_nDefectID;
|
pDefectInfo->m_sDefectLoc = pDefect->m_sDefectLoc;
|
strcpy(pDefectInfo->m_strDefectType, pDefect->m_strDefectType);
|
strcpy(pDefectInfo->m_strDefectCode, pDefect->m_strDefectCode);
|
pDefectInfo->m_DefectType = pDefect->m_DefectType;
|
pDefectInfo->m_DefectSubType = pDefect->m_DefectSubType;
|
pDefectInfo->m_nDefectRScale = pDefect->m_nDefectRScale;
|
pDefectInfo->m_nUMSizeX = pDefect->m_nUMSizeX;
|
pDefectInfo->m_nUMSizeY = pDefect->m_nUMSizeY;
|
pDefectInfo->m_nUMSize = pDefect->m_nUMSize;
|
memcpy(pDefectInfo->m_sZonePixelCount, pDefect->m_sZonePixelCount, sizeof(pDefect->m_sZonePixelCount));
|
pDefectInfo->m_nLevelSrcMax = pDefect->m_nLevelSrcMax;
|
pDefectInfo->m_nLevelSrcMin = pDefect->m_nLevelSrcMin;
|
pDefectInfo->m_nLevelSrcAvg = pDefect->m_nLevelSrcAvg;
|
pDefectInfo->m_sDefectPeak = pDefect->m_sDefectPeak;
|
strcpy(pDefectInfo->m_strStackFirst, pDefect->m_strStackFirst);
|
pDefectInfo->m_nCameraID = pDefect->m_nCameraID;
|
pDefectInfo->m_nScanIdx = pDefect->m_nScanIdx;
|
pDefectInfo->m_nLevelRefMax = pDefect->m_nLevelRefMax;
|
pDefectInfo->m_nLevelRefMin = pDefect->m_nLevelRefMin;
|
pDefectInfo->m_nLevelRefAvg = pDefect->m_nLevelRefAvg;
|
pDefectInfo->m_nUMCenterAlignX = pDefect->m_nUMCenterAlignX;
|
pDefectInfo->m_nUMCenterAlignY = pDefect->m_nUMCenterAlignY;
|
pDefectInfo->m_nUMCellX = pDefect->m_nUMCellX;
|
pDefectInfo->m_nUMCellY = pDefect->m_nUMCellY;
|
pDefectInfo->m_nScratchRatio = pDefect->m_nScratchRatio;
|
pDefectInfo->m_nDensity = pDefect->m_nDensity;
|
pDefectInfo->m_bMergeState = pDefect->m_bMergeState;
|
|
CString strReviewImageName;
|
strReviewImageName = pDefect->m_ReviewDefect.m_strRevImageName;
|
|
if (strReviewImageName == "" || strReviewImageName == "*")
|
{
|
pDefectInfo->m_nShotIdx = -1;
|
pDefectInfo->m_nModelIdx = -1;
|
}
|
else
|
{
|
pDefectInfo->m_nShotIdx = pDefect->m_ReviewDefect.m_nShotIndex;
|
pDefectInfo->m_nModelIdx = pDefect->m_ReviewDefect.m_nModuleIndex;
|
}
|
|
|
for (int j = 0; j < nInfoCount; j++) pDefectInfo->m_strInfos[j].Trim();
|
}
|
}
|
|
void CReveiwHistoryDlg::AddVecDataDefct2(int nDataCount/*, int nRawCount*/)
|
{
|
// int nCount = MultiInsert(m_nCount, nDataCount);
|
|
// if(nCount < 0) return;
|
//
|
for (int i = 0; i < nDataCount; i++)
|
{
|
_grmDefectData* pDefect = m_Server.GetDefectData(i);
|
|
int nInfoCount = 0;
|
|
CString strReviewImageName;
|
strReviewImageName = pDefect->m_ReviewDefect.m_strRevImageName;
|
|
if (strReviewImageName == "" || strReviewImageName == "*")
|
{
|
continue;
|
}
|
else
|
{
|
double dDefectPosX = pDefect->m_nUMCenterAlignX / 1000.0;
|
double dDefectPosY = pDefect->m_nUMCenterAlignY / 1000.0;
|
|
m_Formation.AddDefect(dDefectPosX, dDefectPosY);
|
SetDefectCount();
|
|
_akDefect* pDefectInfo = NULL;
|
|
// if (nCount == 0)
|
// {
|
pDefectInfo = &m_Formation.m_vecDefects[m_Formation.m_vecDefects.size() - 1];
|
// }
|
// else
|
// {
|
// //중간에 값 삽입
|
// pDefectInfo = &m_Formation.m_vecDefects[m_Formation.m_vecDefects.size() - 1];
|
// //pDefectInfo = &m_Formation.m_vecDefects[nCount + i];
|
// }
|
|
pDefectInfo->m_nDefectID = pDefect->m_nDefectID;
|
pDefectInfo->m_sDefectLoc = pDefect->m_sDefectLoc;
|
strcpy(pDefectInfo->m_strDefectType, pDefect->m_strDefectType);
|
strcpy(pDefectInfo->m_strDefectCode, pDefect->m_strDefectCode);
|
pDefectInfo->m_DefectType = pDefect->m_DefectType;
|
pDefectInfo->m_DefectSubType = pDefect->m_DefectSubType;
|
pDefectInfo->m_nDefectRScale = pDefect->m_nDefectRScale;
|
pDefectInfo->m_nUMSizeX = pDefect->m_nUMSizeX;
|
pDefectInfo->m_nUMSizeY = pDefect->m_nUMSizeY;
|
pDefectInfo->m_nUMSize = pDefect->m_nUMSize;
|
memcpy(pDefectInfo->m_sZonePixelCount, pDefect->m_sZonePixelCount, sizeof(pDefect->m_sZonePixelCount));
|
pDefectInfo->m_nLevelSrcMax = pDefect->m_nLevelSrcMax;
|
pDefectInfo->m_nLevelSrcMin = pDefect->m_nLevelSrcMin;
|
pDefectInfo->m_nLevelSrcAvg = pDefect->m_nLevelSrcAvg;
|
pDefectInfo->m_sDefectPeak = pDefect->m_sDefectPeak;
|
strcpy(pDefectInfo->m_strStackFirst, pDefect->m_strStackFirst);
|
pDefectInfo->m_nCameraID = pDefect->m_nCameraID;
|
pDefectInfo->m_nScanIdx = pDefect->m_nScanIdx;
|
pDefectInfo->m_nLevelRefMax = pDefect->m_nLevelRefMax;
|
pDefectInfo->m_nLevelRefMin = pDefect->m_nLevelRefMin;
|
pDefectInfo->m_nLevelRefAvg = pDefect->m_nLevelRefAvg;
|
pDefectInfo->m_nUMCenterAlignX = pDefect->m_nUMCenterAlignX;
|
pDefectInfo->m_nUMCenterAlignY = pDefect->m_nUMCenterAlignY;
|
pDefectInfo->m_nUMCellX = pDefect->m_nUMCellX;
|
pDefectInfo->m_nUMCellY = pDefect->m_nUMCellY;
|
pDefectInfo->m_nScratchRatio = pDefect->m_nScratchRatio;
|
pDefectInfo->m_nDensity = pDefect->m_nDensity;
|
pDefectInfo->m_bMergeState = pDefect->m_bMergeState;
|
|
for (int j = 0; j < nInfoCount; j++) pDefectInfo->m_strInfos[j].Trim();
|
}
|
}
|
}
|
|
void CReveiwHistoryDlg::AddVecDataDefectAll2(int nDataCount/*, int nRawCount*/)
|
{
|
for (int i = 0; i < nDataCount; i++)
|
{
|
_grmDefectData* pDefect = m_Server.GetDefectData(i);
|
|
int nInfoCount = 0;
|
|
CString strReviewImageName;
|
strReviewImageName = pDefect->m_ReviewDefect.m_strRevImageName;
|
|
double dDefectPosX = pDefect->m_nUMCenterAlignX / 1000.0;
|
double dDefectPosY = pDefect->m_nUMCenterAlignY / 1000.0;
|
|
m_Formation.AddDefect(dDefectPosX, dDefectPosY);
|
SetDefectCount();
|
|
_akDefect* pDefectInfo = NULL;
|
|
pDefectInfo = &m_Formation.m_vecDefects[m_Formation.m_vecDefects.size() - 1];
|
|
pDefectInfo->m_nDefectID = pDefect->m_nDefectID;
|
pDefectInfo->m_sDefectLoc = pDefect->m_sDefectLoc;
|
strcpy(pDefectInfo->m_strDefectType, pDefect->m_strDefectType);
|
strcpy(pDefectInfo->m_strDefectCode, pDefect->m_strDefectCode);
|
pDefectInfo->m_DefectType = pDefect->m_DefectType;
|
pDefectInfo->m_DefectSubType = pDefect->m_DefectSubType;
|
pDefectInfo->m_nDefectRScale = pDefect->m_nDefectRScale;
|
pDefectInfo->m_nUMSizeX = pDefect->m_nUMSizeX;
|
pDefectInfo->m_nUMSizeY = pDefect->m_nUMSizeY;
|
pDefectInfo->m_nUMSize = pDefect->m_nUMSize;
|
memcpy(pDefectInfo->m_sZonePixelCount, pDefect->m_sZonePixelCount, sizeof(pDefect->m_sZonePixelCount));
|
pDefectInfo->m_nLevelSrcMax = pDefect->m_nLevelSrcMax;
|
pDefectInfo->m_nLevelSrcMin = pDefect->m_nLevelSrcMin;
|
pDefectInfo->m_nLevelSrcAvg = pDefect->m_nLevelSrcAvg;
|
pDefectInfo->m_sDefectPeak = pDefect->m_sDefectPeak;
|
strcpy(pDefectInfo->m_strStackFirst, pDefect->m_strStackFirst);
|
pDefectInfo->m_nCameraID = pDefect->m_nCameraID;
|
pDefectInfo->m_nScanIdx = pDefect->m_nScanIdx;
|
pDefectInfo->m_nLevelRefMax = pDefect->m_nLevelRefMax;
|
pDefectInfo->m_nLevelRefMin = pDefect->m_nLevelRefMin;
|
pDefectInfo->m_nLevelRefAvg = pDefect->m_nLevelRefAvg;
|
pDefectInfo->m_nUMCenterAlignX = pDefect->m_nUMCenterAlignX;
|
pDefectInfo->m_nUMCenterAlignY = pDefect->m_nUMCenterAlignY;
|
pDefectInfo->m_nUMCellX = pDefect->m_nUMCellX;
|
pDefectInfo->m_nUMCellY = pDefect->m_nUMCellY;
|
pDefectInfo->m_nScratchRatio = pDefect->m_nScratchRatio;
|
pDefectInfo->m_nDensity = pDefect->m_nDensity;
|
pDefectInfo->m_bMergeState = pDefect->m_bMergeState;
|
|
for (int j = 0; j < nInfoCount; j++) pDefectInfo->m_strInfos[j].Trim();
|
}
|
|
// for (int i = 0; i < nDataCount; i++)
|
// {
|
// _grmDefectData* pDefect = m_Server.GetDefectData(i);
|
// int nInfoCount = 0;
|
//
|
// double dDefectPosX = pDefect->m_nUMCenterAlignX / 1000.0;
|
// double dDefectPosY = pDefect->m_nUMCenterAlignY / 1000.0;
|
//
|
// m_Formation.AddDefect(dDefectPosX, dDefectPosY);
|
// SetDefectCount();
|
//
|
// _akDefect* pDefectInfo = NULL;
|
//
|
// // if (nCount == 0)
|
// // {
|
// pDefectInfo = &m_Formation.m_vecDefects[m_Formation.m_vecDefects.size() - 1];
|
// // }
|
// // else
|
// // {
|
// // pDefectInfo = &m_Formation.m_vecDefects[nCount + i];
|
// // }
|
//
|
// //m_Formation.m_vecDefects.insert(m_Formation.m_vecDefects.begin() + 1400, pDefect->m_nDefectID);
|
//
|
// pDefectInfo->m_nDefectID = pDefect->m_nDefectID;
|
// pDefectInfo->m_sDefectLoc = pDefect->m_sDefectLoc;
|
// strcpy(pDefectInfo->m_strDefectType, pDefect->m_strDefectType);
|
// strcpy(pDefectInfo->m_strDefectCode, pDefect->m_strDefectCode);
|
// pDefectInfo->m_DefectType = pDefect->m_DefectType;
|
// pDefectInfo->m_DefectSubType = pDefect->m_DefectSubType;
|
// pDefectInfo->m_nDefectRScale = pDefect->m_nDefectRScale;
|
// pDefectInfo->m_nUMSizeX = pDefect->m_nUMSizeX;
|
// pDefectInfo->m_nUMSizeY = pDefect->m_nUMSizeY;
|
// pDefectInfo->m_nUMSize = pDefect->m_nUMSize;
|
// memcpy(pDefectInfo->m_sZonePixelCount, pDefect->m_sZonePixelCount, sizeof(pDefect->m_sZonePixelCount));
|
// pDefectInfo->m_nLevelSrcMax = pDefect->m_nLevelSrcMax;
|
// pDefectInfo->m_nLevelSrcMin = pDefect->m_nLevelSrcMin;
|
// pDefectInfo->m_nLevelSrcAvg = pDefect->m_nLevelSrcAvg;
|
// pDefectInfo->m_sDefectPeak = pDefect->m_sDefectPeak;
|
// strcpy(pDefectInfo->m_strStackFirst, pDefect->m_strStackFirst);
|
// pDefectInfo->m_nCameraID = pDefect->m_nCameraID;
|
// pDefectInfo->m_nScanIdx = pDefect->m_nScanIdx;
|
// pDefectInfo->m_nLevelRefMax = pDefect->m_nLevelRefMax;
|
// pDefectInfo->m_nLevelRefMin = pDefect->m_nLevelRefMin;
|
// pDefectInfo->m_nLevelRefAvg = pDefect->m_nLevelRefAvg;
|
// pDefectInfo->m_nUMCenterAlignX = pDefect->m_nUMCenterAlignX;
|
// pDefectInfo->m_nUMCenterAlignY = pDefect->m_nUMCenterAlignY;
|
// pDefectInfo->m_nUMCellX = pDefect->m_nUMCellX;
|
// pDefectInfo->m_nUMCellY = pDefect->m_nUMCellY;
|
// pDefectInfo->m_nScratchRatio = pDefect->m_nScratchRatio;
|
// pDefectInfo->m_nDensity = pDefect->m_nDensity;
|
// pDefectInfo->m_bMergeState = pDefect->m_bMergeState;
|
//
|
// for (int j = 0; j < nInfoCount; j++) pDefectInfo->m_strInfos[j].Trim();
|
// }
|
}
|
|
void CReveiwHistoryDlg::AddVecGlassData(int nCount)
|
{
|
m_Formation.AddGlassInfo();
|
|
_grmGlassData* pGlass = m_Server.GetGlassData();
|
_akGlassInfo* pGlassInfo = &m_Formation.m_vecGlassInfo[m_Formation.m_vecGlassInfo.size() - 1];
|
|
pGlassInfo->m_nGlassSelect = nCount;
|
pGlassInfo->m_strPPID = pGlass->m_strPPID;
|
pGlassInfo->m_strGlassID = pGlass->m_strGlassID;
|
pGlassInfo->m_nDefectNum = pGlass->m_nDefectNum;
|
pGlassInfo->m_nReviewNum = GetImageCount();
|
pGlassInfo->m_strGlassJudge = pGlass->m_strGlassJudge;
|
pGlassInfo->m_strLotID = pGlass->m_strLotID;
|
pGlassInfo->m_strSLotID = pGlass->m_strSLotID;
|
pGlassInfo->m_nSlot_No = pGlass->m_nSlot_No;
|
pGlassInfo->m_nCellNum = pGlass->m_nCellNum;
|
pGlassInfo->m_nGlassSizeHeight = pGlass->m_nGlassSizeHeight;
|
pGlassInfo->m_nGlassSizeWidth = pGlass->m_nGlassSizeWidth;
|
}
|
|
void CReveiwHistoryDlg::AddVecCellData(int nCellCount)
|
{
|
for (int i = 0; i < nCellCount; i++)
|
{
|
SetCellCount();
|
CakRectd rectCell;
|
_grmCellData* pCellData = m_Server.GetCellData(i);
|
rectCell.left = pCellData->m_rectCellLeft / 1000.0;
|
rectCell.top = pCellData->m_rectCellTop / 1000.0;
|
rectCell.right = pCellData->m_rectCellRight / 1000.0;
|
rectCell.bottom = pCellData->m_rectCellBottom / 1000.0;
|
m_FormationMap.m_vecCellRect.push_back(rectCell);
|
}
|
}
|
|
void CReveiwHistoryDlg::SortListDefect(int nCol)
|
{
|
if (nCol == 0)
|
return;
|
|
/* if (m_pDefectFormation == NULL) return;*/
|
|
m_bAsending = !m_bAsending;
|
|
_akDefect *pDefect;
|
std::vector< std::pair<CString, _akDefect*> > vecString;
|
std::vector< std::pair<double, _akDefect*> > vecValue;
|
CString strValue;
|
double dValue;
|
short sValue[16];
|
|
for (int i = 0; i < m_Formation.m_vecTempDefects.size(); i++)
|
{
|
pDefect = &m_Formation.m_vecTempDefects[i];
|
|
switch (nCol)
|
{
|
case 1: dValue = pDefect->m_nDefectID; break;
|
case 2: dValue = pDefect->m_sDefectLoc; break;
|
case 3: strValue = pDefect->m_strDefectType; break;
|
case 4: strValue = pDefect->m_strDefectCode; break;
|
case 5: dValue = pDefect->m_DefectType; break;
|
case 6: dValue = pDefect->m_DefectSubType; break;
|
case 7: dValue = pDefect->m_nDefectRScale; break;
|
case 8: dValue = pDefect->m_nUMSizeX; break;
|
case 9: dValue = pDefect->m_nUMSizeY; break;
|
case 10: dValue = pDefect->m_nUMSize; break;
|
//case 11: memcpy(sValue, pDefect->m_sZonePixelCount, sizeof(pDefect->m_sZonePixelCount)); break;
|
case 12: dValue = pDefect->m_nLevelSrcMax; break;
|
case 13: dValue = pDefect->m_nLevelSrcMin; break;
|
case 14: dValue = pDefect->m_nLevelSrcAvg; break;
|
case 15: dValue = pDefect->m_sDefectPeak; break;
|
case 16: strValue = pDefect->m_strStackFirst; break;
|
case 17: dValue = pDefect->m_nCameraID; break;
|
case 18: dValue = pDefect->m_nScanIdx; break;
|
case 19: dValue = pDefect->m_nLevelRefMax; break;
|
case 20: dValue = pDefect->m_nLevelRefMin; break;
|
case 21: dValue = pDefect->m_nLevelRefAvg; break;
|
case 22: dValue = pDefect->m_nUMCenterAlignX; break;
|
case 23: dValue = pDefect->m_nUMCenterAlignY; break;
|
case 24: dValue = pDefect->m_nUMCellX; break;
|
case 25: dValue = pDefect->m_nUMCellY; break;
|
case 26: dValue = pDefect->m_nScratchRatio; break;
|
case 27: dValue = pDefect->m_nDensity; break;
|
case 28: dValue = pDefect->m_bMergeState; break;
|
}
|
|
if (strValue.IsEmpty() == FALSE) vecString.push_back(std::make_pair(strValue, pDefect));
|
else vecValue.push_back(std::make_pair(dValue, pDefect));
|
}
|
|
if (!vecString.empty())
|
{
|
if (m_bAsending == TRUE) //오름 차순
|
std::sort(vecString.begin(), vecString.end(), std::greater< std::pair<CString, _akDefect*> >());
|
else //내림 차순
|
std::sort(vecString.begin(), vecString.end(), std::less< std::pair<CString, _akDefect*> >());
|
|
m_Formation.m_vecDefects.clear();
|
std::vector< std::pair<CString, _akDefect*> >::iterator itVec;
|
|
for (itVec = vecString.begin(); itVec != vecString.end(); ++itVec)
|
{
|
m_Formation.m_vecDefects.push_back(*itVec->second);
|
}
|
}
|
else//if (!vecString.empty())
|
{
|
if (m_bAsending == TRUE)
|
std::sort(vecValue.begin(), vecValue.end(), std::greater< std::pair<double, _akDefect*> >());
|
else
|
std::sort(vecValue.begin(), vecValue.end(), std::less< std::pair<double, _akDefect*> >());
|
|
m_Formation.m_vecDefects.clear();
|
std::vector< std::pair<double, _akDefect*> >::iterator itVec;
|
|
for (itVec = vecValue.begin(); itVec != vecValue.end(); ++itVec)
|
{
|
m_Formation.m_vecDefects.push_back(*itVec->second);
|
}
|
}
|
}
|
|
void CReveiwHistoryDlg::AddVecDateSorting(int nDataCount)
|
{
|
m_Formation.m_vecTempDefects.clear();
|
|
for (int i = 0; i < m_Formation.m_vecDefects.size(); i++)
|
{
|
_akDefect* pDefect = &m_Formation.m_vecDefects[i];
|
|
double dDefectPosX = pDefect->m_nUMCenterAlignX / 1000.0;
|
double dDefectPosY = pDefect->m_nUMCenterAlignY / 1000.0;
|
|
m_Formation.AddDefectTemp(dDefectPosX, dDefectPosY);
|
_akDefect* pDefectInfo = &m_Formation.m_vecTempDefects[i];
|
|
pDefectInfo->m_nDefectID = pDefect->m_nDefectID;
|
pDefectInfo->m_sDefectLoc = pDefect->m_sDefectLoc;
|
strcpy(pDefectInfo->m_strDefectType, pDefect->m_strDefectType);
|
strcpy(pDefectInfo->m_strDefectCode, pDefect->m_strDefectCode);
|
pDefectInfo->m_DefectType = pDefect->m_DefectType;
|
pDefectInfo->m_DefectSubType = pDefect->m_DefectSubType;
|
pDefectInfo->m_nDefectRScale = pDefect->m_nDefectRScale;
|
pDefectInfo->m_nUMSizeX = pDefect->m_nUMSizeX;
|
pDefectInfo->m_nUMSizeY = pDefect->m_nUMSizeY;
|
pDefectInfo->m_nUMSize = pDefect->m_nUMSize;
|
memcpy(pDefectInfo->m_sZonePixelCount, pDefect->m_sZonePixelCount, sizeof(pDefect->m_sZonePixelCount));
|
pDefectInfo->m_nLevelSrcMax = pDefect->m_nLevelSrcMax;
|
pDefectInfo->m_nLevelSrcMin = pDefect->m_nLevelSrcMin;
|
pDefectInfo->m_nLevelSrcAvg = pDefect->m_nLevelSrcAvg;
|
pDefectInfo->m_sDefectPeak = pDefect->m_sDefectPeak;
|
strcpy(pDefectInfo->m_strStackFirst, pDefect->m_strStackFirst);
|
pDefectInfo->m_nCameraID = pDefect->m_nCameraID;
|
pDefectInfo->m_nScanIdx = pDefect->m_nScanIdx;
|
pDefectInfo->m_nLevelRefMax = pDefect->m_nLevelRefMax;
|
pDefectInfo->m_nLevelRefMin = pDefect->m_nLevelRefMin;
|
pDefectInfo->m_nLevelRefAvg = pDefect->m_nLevelRefAvg;
|
pDefectInfo->m_nUMCenterAlignX = pDefect->m_nUMCenterAlignX;
|
pDefectInfo->m_nUMCenterAlignY = pDefect->m_nUMCenterAlignY;
|
pDefectInfo->m_nUMCellX = pDefect->m_nUMCellX;
|
pDefectInfo->m_nUMCellY = pDefect->m_nUMCellY;
|
pDefectInfo->m_nScratchRatio = pDefect->m_nScratchRatio;
|
pDefectInfo->m_nDensity = pDefect->m_nDensity;
|
pDefectInfo->m_bMergeState = pDefect->m_bMergeState;
|
}
|
}
|
|
void CReveiwHistoryDlg::AddVecImageSorting(int nDataCount)
|
{
|
m_Formation.m_vecTempImage.clear();
|
|
for (int i = 0; i < m_Formation.m_vecImage.size(); i++)
|
{
|
_akReviewList* pDefect = &m_Formation.m_vecImage[i];
|
|
m_Formation.AddDefectImageTemp();
|
|
_akReviewList* pImageInfo = &m_Formation.m_vecTempImage[i];
|
|
pImageInfo->m_nDefectID = pDefect->m_nDefectID;
|
strcpy(pImageInfo->m_strAoiImageName, pDefect->m_strAoiImageName);
|
pImageInfo->m_nDefectIdx = pDefect->m_nDefectIdx;
|
pImageInfo->m_strReviewImageName = pDefect->m_strReviewImageName;
|
|
strcpy(pImageInfo->m_strAoiImagePath, pDefect->m_strAoiImagePath);
|
strcpy(pImageInfo->m_strReviewImagePath, pDefect->m_strReviewImagePath);
|
|
strcpy(pImageInfo->m_strAlignFirst, pDefect->m_strAlignFirst);
|
strcpy(pImageInfo->m_strAlignSecond, pDefect->m_strAlignSecond);
|
}
|
}
|
|
void CReveiwHistoryDlg::AddVecCellSorting(int nCellCount)
|
{
|
m_FormationMap.m_vecTempCellRect.clear();
|
|
for (int i = 0; i < m_FormationMap.m_vecCellRect.size(); i++)
|
{
|
m_FormationMap.AddCellData();
|
m_FormationMap.m_vecTempCellRect[i] = m_FormationMap.m_vecCellRect[i];
|
}
|
}
|
|
void CReveiwHistoryDlg::SelectCell(int nDataCount)
|
{
|
m_FormationMap.m_vecCellRect.clear();
|
|
if (nDataCount < 1) return;
|
|
int nCellCount = 0;
|
int nCount = 0;
|
int nCount2 = 0;
|
int nCount3 = 0;
|
|
if (nCount == nDataCount) return;
|
|
if (m_Formation.m_vecGlassInfo.size() == 0) return;
|
|
_akGlassInfo* pGlass2 = &m_Formation.m_vecGlassInfo[nDataCount-1];
|
|
nCount2 = pGlass2->m_nCellNum;
|
|
for (int i = 0; i < nDataCount; i++)
|
{
|
if (i == 0)
|
{
|
nCount3 = 0;
|
}
|
else
|
{
|
_akGlassInfo* pGlass = &m_Formation.m_vecGlassInfo[i-1];
|
nCount3 += pGlass->m_nCellNum;
|
}
|
}
|
|
CakRectd rectCell;
|
|
if (m_FormationMap.m_vecTempCellRect.size() - 1 < nCount3) return;
|
|
for (int i = 0; i < nCount2; i++)
|
{
|
CakRectd* pCellData = &m_FormationMap.m_vecTempCellRect[nCount3 + i];
|
rectCell.left = pCellData->left;
|
rectCell.top = pCellData->top;
|
rectCell.right = pCellData->right;
|
rectCell.bottom = pCellData->bottom;
|
m_FormationMap.m_vecCellRect.push_back(rectCell);
|
}
|
|
// for (int i = 0; i < MAX_COUNT+1; i++)
|
// {
|
// if (nCount == nDataCount) break;
|
//
|
// if (m_nCellSize[i] != 0)
|
// {
|
// nCount++;
|
// }
|
// nCellCount = m_nCellSize[i];
|
// nCount2 = i;
|
//
|
// if (i == 0)
|
// {
|
// nCount3 = 0;
|
// }
|
// else
|
// {
|
// nCount3 += m_nCellSize[i-1];
|
// }
|
// }
|
m_FormationMap.ReDraw(TRUE);
|
}
|
|
void CReveiwHistoryDlg::SortFileList(int nCol)
|
{
|
if (nCol == 0)
|
return;
|
|
_akReviewHeader *pReviewHeader;
|
std::vector< std::pair<CString, _akReviewHeader*> > vecString;
|
std::vector< std::pair<double, _akReviewHeader*> > vecValue;
|
CString strValue;
|
double dValue;
|
short sValue[16];
|
|
for (int i = 0; i < m_Formation.m_vecHeaderTemp.size(); i++)
|
{
|
pReviewHeader = &m_Formation.m_vecHeaderTemp[i];
|
|
switch (nCol)
|
{
|
case 1: strValue = pReviewHeader->m_strFileTime; break;
|
case 2: strValue = pReviewHeader->m_strLoading; break;
|
case 3: strValue = pReviewHeader->m_strPPID; break;
|
case 4: strValue = pReviewHeader->m_strGlassID; break;
|
case 5: dValue = pReviewHeader->m_nDefectIdx; break;
|
case 6: dValue = pReviewHeader->m_nReviewIdx; break;
|
case 7: strValue = pReviewHeader->m_strJudge; break;
|
case 8: strValue = pReviewHeader->m_strFileName; break;
|
}
|
|
if (strValue.IsEmpty() == FALSE) vecString.push_back(std::make_pair(strValue, pReviewHeader));
|
else vecValue.push_back(std::make_pair(dValue, pReviewHeader));
|
}
|
|
if (!vecString.empty())
|
{
|
std::sort(vecString.begin(), vecString.end(), std::greater< std::pair<CString, _akReviewHeader*> >());
|
|
m_Formation.m_vecHeader.clear();
|
std::vector< std::pair<CString, _akReviewHeader*> >::iterator itVec;
|
// /*if(nCount > m_nFileCount) break; //count 여기서 말고 전체 파일을 다 읽은 후에 다시 소팅하자*/
|
int nCount = 1;
|
for (itVec = vecString.begin(); itVec != vecString.end(); ++itVec)
|
{
|
if(nCount > m_nFileCount) break;
|
m_Formation.m_vecHeader.push_back(*itVec->second);
|
nCount++;
|
}
|
}
|
else
|
{
|
std::sort(vecValue.begin(), vecValue.end(), std::greater< std::pair<double, _akReviewHeader*> >());
|
|
m_Formation.m_vecHeader.clear();
|
std::vector< std::pair<double, _akReviewHeader*> >::iterator itVec;
|
int nCount = 1;
|
for (itVec = vecValue.begin(); itVec != vecValue.end(); ++itVec)
|
{
|
if (nCount > m_nFileCount) break;
|
m_Formation.m_vecHeader.push_back(*itVec->second);
|
nCount++;
|
}
|
}
|
|
_akReviewHeader *pReview;
|
m_vecStrGridReviewPath.clear();
|
m_vecStrGridReviewList.clear();
|
|
GV_ITEM Item;
|
int nRowIdx = 0;
|
int nColIdx = 0;
|
CString strTemp;
|
Item.mask = GVIF_TEXT;
|
|
for(int i=0; i< m_Formation.m_vecHeader.size(); i++)
|
{
|
pReview = &m_Formation.m_vecHeader[i];
|
m_vecStrGridReviewPath.push_back(pReview->m_strFilePath);
|
m_vecStrGridReviewList.push_back(pReview->m_strFileName);
|
}
|
m_Formation.m_vecHeaderTemp.clear();
|
}
|