Explorar o código

显示List列表。

JeffWang %!s(int64=3) %!d(string=hai) anos
pai
achega
7845844016

+ 37 - 47
Source/OGCAssistTool/OGCAssistTool/DataImpl.cpp

@@ -204,25 +204,23 @@ INT CDataImpl::InsertOrder(std::string strOrder, std::string strDeltaEType, std:
 
 INT CDataImpl::InsertSN(const TB_SN &sn_data)
 {
-	return InsertSN(sn_data.strOrder, sn_data.strLine, sn_data.strSN, sn_data.strStartTime, sn_data.strFinishedTime, sn_data.nElapsed, sn_data.nTestResult, sn_data.dDeltaAVGEValue, sn_data.dDeltaEValue, sn_data.strDetails);
+	return InsertSN(sn_data.strOrder, sn_data.strLine, sn_data.strSN, sn_data.strTestTime, sn_data.nElapsed, sn_data.nTestResult, sn_data.dDeltaAVGEValue, sn_data.dDeltaEValue, sn_data.strDetails);
 }
 
-INT CDataImpl::InsertSN(std::string strOrder, std::string strLine, std::string strSN, std::string strStartTime, std::string strFinishTime, int nElapsed, int nTestResult, DOUBLE dDeltaAVGEValue, DOUBLE dDeltaEValue, std::string strDetails )
+INT CDataImpl::InsertSN(std::string strOrder, std::string strLine, std::string strSN, std::string strTestTime, int nElapsed, int nTestResult, DOUBLE dDeltaAVGEValue, DOUBLE dDeltaEValue, std::string strDetails )
 {
 	if(m_psqlite3 == NULL)
 		return -1;
 
 	char szValue[16] = {0};
-	std::string strInsert = "INSERT INTO DebugSN(OrderID, Line, SN, StartTime, FinishTime, ElapsedTime, TestResult, DEAvgValue, Outcome) VALUES ('";
+	std::string strInsert = "INSERT INTO DebugSN(OrderID, Line, SN, TestTime, ElapsedTime, TestResult, DEAvgValue, Outcome) VALUES ('";
 	strInsert.append(strOrder);
 	strInsert.append("','");
 	strInsert.append(strLine);
 	strInsert.append("','");
 	strInsert.append(strSN);
 	strInsert.append("','");
-	strInsert.append(strStartTime);
-	strInsert.append("','");
-	strInsert.append(strFinishTime);
+	strInsert.append(strTestTime);
 
 	_itoa_s(nElapsed, szValue, 10);
 	strInsert.append("','");
@@ -373,23 +371,21 @@ INT CDataImpl::QuerySNData(std::string strSN, TB_SN &sn_data)
 		sn_data.strOrder = pazResult[nCol+0];
 		sn_data.strSN = pazResult[nCol+1];
 		sn_data.strLine = pazResult[nCol+2];
-		sn_data.strStartTime = pazResult[nCol+3];
-		sn_data.strFinishedTime = pazResult[nCol+4];
-		sn_data.nElapsed = atoi(pazResult[nCol+5]);
-		sn_data.nTestResult = atoi(pazResult[nCol+6]);
-		sn_data.dDeltaAVGEValue = atof(pazResult[nCol+7]);
-		sn_data.strDetails = pazResult[nCol+8];
+		sn_data.strTestTime = pazResult[nCol+3];
+		sn_data.nElapsed = atoi(pazResult[nCol+4]);
+		sn_data.nTestResult = atoi(pazResult[nCol+5]);
+		sn_data.dDeltaAVGEValue = atof(pazResult[nCol+6]);
+		sn_data.strDetails = pazResult[nCol+7];
 #else
 		// 由Native for SQLite3插入的数据,都是utf8格式;
 		sn_data.strOrder = CharEncoding::UTF82ASCII(pazResult[nCol+0]);
 		sn_data.strSN = CharEncoding::UTF82ASCII(pazResult[nCol+1]);
 		sn_data.strLine = CharEncoding::UTF82ASCII(pazResult[nCol+2]);
-		sn_data.strStartTime = CharEncoding::UTF82ASCII(pazResult[nCol+3]);
-		sn_data.strFinishedTime = CharEncoding::UTF82ASCII(pazResult[nCol+4]);
-		sn_data.nElapsed = atoi(pazResult[nCol+5]);
-		sn_data.nTestResult = atoi(pazResult[nCol+6]);
-		sn_data.dDeltaAVGEValue = atof(pazResult[nCol+7]);
-		sn_data.strDetails = CharEncoding::UTF82ASCII(pazResult[nCol+8]);
+		sn_data.strTestTime = CharEncoding::UTF82ASCII(pazResult[nCol+3]);
+		sn_data.nElapsed = atoi(pazResult[nCol+4]);
+		sn_data.nTestResult = atoi(pazResult[nCol+5]);
+		sn_data.dDeltaAVGEValue = atof(pazResult[nCol+6]);
+		sn_data.strDetails = CharEncoding::UTF82ASCII(pazResult[nCol+7]);
 #endif
 	}
 
@@ -428,23 +424,21 @@ INT CDataImpl::QuerySNData(std::string strOrder, std::vector<TB_SN> &vtSNdata)
 		it->strOrder = pazResult[nCol*i+0];
 		it->strSN = pazResult[nCol*i+1];
 		it->strLine = pazResult[nCol*i+2];
-		it->strStartTime = pazResult[nCol*i+3];
-		it->strFinishedTime = pazResult[nCol*i+4];
-		it->nElapsed = atoi(pazResult[nCol*i+5]);
-		it->nTestResult = atoi(pazResult[nCol*i+6]);
-		it->dDeltaAVGEValue = atof(pazResult[nCol*i+7]);
-		it->strDetails = pazResult[nCol*i+8];
+		it->strTestTime = pazResult[nCol*i+3];
+		it->nElapsed = atoi(pazResult[nCol*i+4]);
+		it->nTestResult = atoi(pazResult[nCol*i+5]);
+		it->dDeltaAVGEValue = atof(pazResult[nCol*i+6]);
+		it->strDetails = pazResult[nCol*i+7];
 #else
 		// 由Native for SQLite3插入的数据,都是utf8格式;
 		it->strOrder = CharEncoding::UTF82ASCII(pazResult[nCol*i+0]);
 		it->strSN = CharEncoding::UTF82ASCII(pazResult[nCol*i+1]);
 		it->strLine = CharEncoding::UTF82ASCII(pazResult[nCol*i+2]);
-		it->strStartTime = CharEncoding::UTF82ASCII(pazResult[nCol*i+3]);
-		it->strFinishedTime = CharEncoding::UTF82ASCII(pazResult[nCol*i+4]);
-		it->nElapsed = atoi(pazResult[nCol*i+5]);
-		it->nTestResult = atoi(pazResult[nCol*i+6]);
-		it->dDeltaAVGEValue = atof(pazResult[nCol*i+7]);
-		it->strDetails = CharEncoding::UTF82ASCII(pazResult[nCol*i+8]);
+		it->strTestTime = CharEncoding::UTF82ASCII(pazResult[nCol*i+3]);
+		it->nElapsed = atoi(pazResult[nCol*i+4]);
+		it->nTestResult = atoi(pazResult[nCol*i+5]);
+		it->dDeltaAVGEValue = atof(pazResult[nCol*i+6]);
+		it->strDetails = CharEncoding::UTF82ASCII(pazResult[nCol*i+7]);
 #endif
 	}
 
@@ -485,23 +479,21 @@ INT CDataImpl::QuerySNData(std::vector<TB_SN> &vtSNData, std::string strBeginTim
 		it->strOrder = pazResult[nCol*i+0];
 		it->strSN = pazResult[nCol*i+1];
 		it->strLine = pazResult[nCol*i+2];
-		it->strStartTime = pazResult[nCol*i+3];
-		it->strFinishedTime = pazResult[nCol*i+4];
-		it->nElapsed = atoi(pazResult[nCol*i+5]);
-		it->nTestResult = atoi(pazResult[nCol*i+6]);
-		it->dDeltaAVGEValue = atof(pazResult[nCol*i+7]);
-		it->strDetails = pazResult[nCol*i+8];
+		it->strTestTime = pazResult[nCol*i+3];
+		it->nElapsed = atoi(pazResult[nCol*i+4]);
+		it->nTestResult = atoi(pazResult[nCol*i+5]);
+		it->dDeltaAVGEValue = atof(pazResult[nCol*i+6]);
+		it->strDetails = pazResult[nCol*i+7];
 #else
 		// 由Native for SQLite3插入的数据,都是utf8格式;
 		it->strOrder = CharEncoding::UTF82ASCII(pazResult[nCol*i+0]);
 		it->strSN = CharEncoding::UTF82ASCII(pazResult[nCol*i+1]);
 		it->strLine = CharEncoding::UTF82ASCII(pazResult[nCol*i+2]);
-		it->strStartTime = CharEncoding::UTF82ASCII(pazResult[nCol*i+3]);
-		it->strFinishedTime = CharEncoding::UTF82ASCII(pazResult[nCol*i+4]);
-		it->nElapsed = atoi(pazResult[nCol*i+5]);
-		it->nTestResult = atoi(pazResult[nCol*i+6]);
-		it->dDeltaAVGEValue = atof(pazResult[nCol*i+7]);
-		it->strDetails = CharEncoding::UTF82ASCII(pazResult[nCol*i+8]);
+		it->strTestTime = CharEncoding::UTF82ASCII(pazResult[nCol*i+3]);
+		it->nElapsed = atoi(pazResult[nCol*i+4]);
+		it->nTestResult = atoi(pazResult[nCol*i+5]);
+		it->dDeltaAVGEValue = atof(pazResult[nCol*i+6]);
+		it->strDetails = CharEncoding::UTF82ASCII(pazResult[nCol*i+7]);
 #endif
 	}
 
@@ -547,10 +539,10 @@ BOOL CDataImpl::UpdateOrder(std::string strOrder, std::string strDeltaEType, std
 
 BOOL CDataImpl::UpdateSNData(TB_SN &sn_data)
 {
-	return UpdateSNData(sn_data.strOrder, sn_data.strSN, sn_data.strLine, sn_data.strStartTime, sn_data.strFinishedTime, sn_data.nElapsed, sn_data.nTestResult, sn_data.dDeltaAVGEValue, sn_data.dDeltaEValue, sn_data.strDetails);
+	return UpdateSNData(sn_data.strOrder, sn_data.strSN, sn_data.strLine, sn_data.strTestTime, sn_data.nElapsed, sn_data.nTestResult, sn_data.dDeltaAVGEValue, sn_data.dDeltaEValue, sn_data.strDetails);
 }
 
-BOOL CDataImpl::UpdateSNData(std::string strOrder,std::string strSN, std::string strLine, std::string strTestTime, std::string strFinishedTime, int nElapsed, int nTestResult, double dAVGDeltaEVlaue, DOUBLE dDeltaEValue, std::string strDetails)
+BOOL CDataImpl::UpdateSNData(std::string strOrder,std::string strSN, std::string strLine, std::string strTestTime, int nElapsed, int nTestResult, double dAVGDeltaEVlaue, DOUBLE dDeltaEValue, std::string strDetails)
 {
 	if(m_psqlite3 == NULL)
 		return FALSE;
@@ -560,10 +552,8 @@ BOOL CDataImpl::UpdateSNData(std::string strOrder,std::string strSN, std::string
 	strInsert.append(strOrder);
 	strInsert.append("', Line='");
 	strInsert.append(strLine);
-	strInsert.append("', StartTime='");
+	strInsert.append("', TestTime='");
 	strInsert.append(strTestTime);
-	strInsert.append("', FinishTime='");
-	strInsert.append(strFinishedTime);
 	_itoa_s(nElapsed, szValue, 10);
 	strInsert.append("', ElapsedTime='");
 	strInsert.append(szValue);

+ 2 - 2
Source/OGCAssistTool/OGCAssistTool/DataImpl.h

@@ -82,7 +82,7 @@ public:
 	INT InsertOrder(const TB_ORDER &order);
 	INT InsertOrder(std::string strOrder, std::string strDeltaEType, std::string strDeltaEValue, int nMode);
 	INT InsertSN(const TB_SN &sn_data);
-	INT InsertSN(std::string strOrder, std::string strLine, std::string strSN, std::string strStartTime, std::string strFinishTime, int nElapsed, int nTestResult, DOUBLE dDeltaAVGEValue, DOUBLE dDeltaEValue, std::string strDetails );
+	INT InsertSN(std::string strOrder, std::string strLine, std::string strSN, std::string strTesttTime, int nElapsed, int nTestResult, DOUBLE dDeltaAVGEValue, DOUBLE dDeltaEValue, std::string strDetails );
 
 	INT QueryOrder(std::string strOrder, TB_ORDER &order);
 	INT QueryOrders(std::vector<TB_ORDER> &vtOrders, std::string strBeginTime, std::string EndTime);
@@ -93,7 +93,7 @@ public:
 	BOOL UpdateOrder(TB_ORDER &order);
 	BOOL UpdateOrder(std::string strOrder, std::string strDeltaEType, std::string strDeltaEValue, int nMode);
 	BOOL UpdateSNData(TB_SN &sn_data);
-	BOOL UpdateSNData(std::string strOrder,std::string strSN, std::string strLine, std::string strTestTime, std::string strFinishedTime, int nElapsed, int nTestResult, double dAVGDeltaEVlaue, DOUBLE dDeltaEValue, std::string strDetails);
+	BOOL UpdateSNData(std::string strOrder,std::string strSN, std::string strLine, std::string strTestTime, int nElapsed, int nTestResult, double dAVGDeltaEVlaue, DOUBLE dDeltaEValue, std::string strDetails);
 
 	BOOL DeleteOrder(std::string strOrder);//ͬʱɾ³ýËùÓйØÁªµÄSN;
 	BOOL DeleteSNData(std::string strSN);

+ 25 - 8
Source/OGCAssistTool/OGCAssistTool/ListSortCtrl.cpp

@@ -3,7 +3,7 @@
 
 #include "stdafx.h"
 #include "ListSortCtrl.h"
-//#include "..\MD5\MD5.h"
+#include "MD5.h"
 #include <strsafe.h>
 
 // CListSortCtrl
@@ -199,7 +199,7 @@ BOOL CListSortCtrl::SetHeadings( IN LPCTSTR pszText, ... )
 	LoadColumnInfo();
 	SetExtendedStyle(LVS_EX_FLATSB|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_HEADERDRAGDROP);
 
-	SetListFont(_T("ËÎÌå"), 11);
+	//SetListFont(_T("ËÎÌå"), 11);
 
 	return TRUE;
 }
@@ -281,6 +281,19 @@ void CListSortCtrl::OnLvnGetdispinfo(NMHDR *pNMHDR, LRESULT *pResult)
 	{
 		//_tcscpy_s(pItem->pszText, pItem->cchTextMax, m_AryList.ElementAt(pItem->iItem).ElementAt(pItem->iSubItem));
 		StringCbCopy(pItem->pszText, pItem->cchTextMax, m_AryList.ElementAt(pItem->iItem).ElementAt(pItem->iSubItem));
+
+#if 1
+		NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
+		if ( pItem->iSubItem == 4 )
+		{
+			TCHAR szValue[10] = {0};
+			_stprintf_s(szValue, _T("%0.3f"), GLOBAL::g_config.dDeltaEValue);
+			if ( _tcscmp(szValue, pItem->pszText) == 1 )
+			{
+				pLVCD->clrTextBk = RGB(255,0,0);
+			}
+		}
+#endif
 	}
 	*pResult = 0;
 }
@@ -296,12 +309,16 @@ void CListSortCtrl::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult)
 	}
 	else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
 	{
-		INT npos = pLVCD->nmcd.dwItemSpec;
-		if ( npos % 2 )
+		double dValue = _tstof(m_AryList.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(4).GetString());
+		if ( GLOBAL::g_config.dDeltaEValue > dValue )
+		{
+			pLVCD->clrText = RGB(235,10,10);
+		}
+
+		if ( pLVCD->nmcd.dwItemSpec % 2 )
 			pLVCD->clrTextBk = m_clrLightGrid;
 		else 
 			pLVCD->clrTextBk = m_clrDarkGrid;
-
 		*pResult = CDRF_DODEFAULT;
 	}
 }
@@ -320,9 +337,9 @@ void CListSortCtrl::LoadColumnInfo()
 	ASSERT( m_nNumColumns > 0 );
 	UINT nBytes = 0;
 	BYTE* buf = NULL;
-	//CMD5 md5;
-	//md5.SetBYTEText((BYTE*)m_strSection.GetString(), m_strSection.GetLength()*sizeof(TCHAR));
-	//m_strSection = md5.GetMD5Digest();
+	CMD5 md5;
+	md5.SetBYTEText((BYTE*)m_strSection.GetString(), m_strSection.GetLength()*sizeof(TCHAR));
+	m_strSection = md5.GetMD5Digest();
 
 	if( AfxGetApp()->GetProfileBinary( _T("sortlist"), m_strSection, &buf, &nBytes ) )
 	{

+ 1 - 1
Source/OGCAssistTool/OGCAssistTool/OGCAssistTool.rc

@@ -131,7 +131,7 @@ BEGIN
     CONTROL         "",SPIN_EVALUE,"msctls_updown32",UDS_ARROWKEYS,443,18,11,14
     EDITTEXT        EDIT_SN,514,18,154,14,ES_AUTOHSCROLL
     LTEXT           "SN:",IDC_STATIC,500,21,11,8
-    CONTROL         "",LIST_DEBUG_DATA,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,41,717,242
+    CONTROL         "",LIST_DEBUG_DATA,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | LVS_OWNERDATA | WS_BORDER | WS_TABSTOP,7,41,717,242
     GROUPBOX        "½á¹û£º",IDC_STATIC,7,284,717,31
     LTEXT           "¡øEƽ¾ùÖµ£º",IDC_STATIC,15,298,43,8
     EDITTEXT        EDIT_ARG_EVALUE,64,295,73,14,ES_AUTOHSCROLL | ES_READONLY

+ 16 - 0
Source/OGCAssistTool/OGCAssistTool/OGCAssistTool.vcproj

@@ -447,6 +447,14 @@
 				RelativePath=".\HyperLink.h"
 				>
 			</File>
+			<File
+				RelativePath=".\ListSortCtrl.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\ListSortCtrl.h"
+				>
+			</File>
 			<File
 				RelativePath=".\ShadeButtonST.cpp"
 				>
@@ -455,6 +463,14 @@
 				RelativePath=".\ShadeButtonST.h"
 				>
 			</File>
+			<File
+				RelativePath=".\SortHeaderCtrl.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\SortHeaderCtrl.h"
+				>
+			</File>
 			<File
 				RelativePath=".\SubLabel.cpp"
 				>

+ 105 - 10
Source/OGCAssistTool/OGCAssistTool/PageDebug.cpp

@@ -147,6 +147,7 @@ HBRUSH CPageDebug::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
 
 void CPageDebug::InitListCtrl()
 {
+#if 0
 	m_ctrlList.InsertColumn( 0, _T("序号"));
 	m_ctrlList.SetColumnWidth( 0, 50 );
 	m_ctrlList.InsertColumn( 1, _T("R"));
@@ -157,6 +158,17 @@ void CPageDebug::InitListCtrl()
 	m_ctrlList.SetColumnWidth( 3, 100);
 	m_ctrlList.InsertColumn( 4, _T("▲E实际值"));
 	m_ctrlList.SetColumnWidth(4, 100);
+#else
+	m_ctrlList.SetListFont(_T("新宋体"), 12, TRUE);
+	m_ctrlList.SetHeadings(
+		_T("序号,90"),
+		_T("R,90"),
+		_T("G,90"),
+		_T("B,90"),
+		_T("▲E实际值,90"),
+		NULL
+		);	
+#endif
 }
 
 HWND MyFindWindow(LPCTSTR lpClassName)
@@ -422,6 +434,63 @@ DWORD CPageDebug::ThreadGoProc(LPVOID lpParam)
 											m_pDlg->m_lable_result.SetText(_T("失败"));
 											m_pDlg->m_lable_result.SetBkColor(COLOR_RED);
 										}
+
+										// 更新数据库;
+										TB_SN tbSN;
+										CHAR szValue[MAX_PATH] = {0};
+										GetDlgItemTextA(m_pDlg->m_hWnd, EDIT_SN, szValue, MAX_PATH);
+										if ( GLOBAL::g_db.QuerySNData(szValue, tbSN) > 0 )
+										{// 存在数据;
+											tbSN.strOrder = m_pDlg->m_szOrderNum;
+											tbSN.dDeltaAVGEValue = dAVGValue;
+											tbSN.dDeltaEValue = GLOBAL::g_config.dDeltaEValue;
+											tbSN.nTestResult = bRet;
+											tbSN.strLine = CharEncoding::UNICODE2ASCII(GLOBAL::g_config.szLine);
+											tbSN.nElapsed = dwElapsed;
+											tbSN.strTestTime = "datetime('now','localtime'))";
+											for ( std::vector<GLOBAL::RGB_PAT>::iterator it = vtRGB.begin(); it != vtRGB.begin(); it++ )
+											{
+												if ( GLOBAL::g_config.nDeltaEType == GLOBAL::DeltaE00)
+													sprintf_s(szValue, "%s,%s,%s,%s;", it->R.c_str(), it->G.c_str(), it->B.c_str(), it->deltaE00.c_str());
+												if ( GLOBAL::g_config.nDeltaEType == GLOBAL::DeltaE76)
+													sprintf_s(szValue, "%s,%s,%s,%s;", it->R.c_str(), it->G.c_str(), it->B.c_str(), it->deltaE76.c_str());
+												if ( GLOBAL::g_config.nDeltaEType == GLOBAL::DeltaE94)
+													sprintf_s(szValue, "%s,%s,%s,%s;", it->R.c_str(), it->G.c_str(), it->B.c_str(), it->deltaE94.c_str());
+
+												tbSN.strDetails.append(szValue);
+											}
+
+											// 更新;
+											GLOBAL::g_db.UpdateSNData(tbSN);
+										}
+										else
+										{
+											tbSN.strOrder = m_pDlg->m_szOrderNum;
+											tbSN.strSN = szValue;
+											tbSN.dDeltaAVGEValue = dAVGValue;
+											tbSN.dDeltaEValue = GLOBAL::g_config.dDeltaEValue;
+											tbSN.nTestResult = bRet;
+											tbSN.strLine = CharEncoding::UNICODE2ASCII(GLOBAL::g_config.szLine);
+											tbSN.nElapsed = dwElapsed;
+											tbSN.strTestTime = "datetime('now','localtime'))";
+											for ( std::vector<GLOBAL::RGB_PAT>::iterator it = vtRGB.begin(); it != vtRGB.begin(); it++ )
+											{
+												if ( GLOBAL::g_config.nDeltaEType == GLOBAL::DeltaE00)
+													sprintf_s(szValue, "%s,%s,%s,%s;", it->R.c_str(), it->G.c_str(), it->B.c_str(), it->deltaE00.c_str());
+												if ( GLOBAL::g_config.nDeltaEType == GLOBAL::DeltaE76)
+													sprintf_s(szValue, "%s,%s,%s,%s;", it->R.c_str(), it->G.c_str(), it->B.c_str(), it->deltaE76.c_str());
+												if ( GLOBAL::g_config.nDeltaEType == GLOBAL::DeltaE94)
+													sprintf_s(szValue, "%s,%s,%s,%s;", it->R.c_str(), it->G.c_str(), it->B.c_str(), it->deltaE94.c_str());
+
+												tbSN.strDetails.append(szValue);
+											}
+
+											// 新增;
+											GLOBAL::g_db.InsertSN(tbSN);
+										}
+
+										// 更新List列表;
+										m_pDlg->UpdateList(vtRGB);
 									}
 								}
 							}
@@ -727,27 +796,25 @@ void CPageDebug::OnBnClickedLock()
 	// 数据库操作;
 	if ( bCheckLock )
 	{
-		CHAR szOrderNum[MAX_PATH] = {0};
-		CHAR szDeltaEValue[MAX_PATH] = {0};
-		GetDlgItemTextA(m_hWnd, EDIT_BATCH_NUMBER, szOrderNum, MAX_PATH);
-		GetDlgItemTextA(m_hWnd, EDIT_EVALUE, szDeltaEValue, MAX_PATH);
+		GetDlgItemTextA(m_hWnd, EDIT_BATCH_NUMBER, m_szOrderNum, MAX_PATH);
+		GetDlgItemTextA(m_hWnd, EDIT_EVALUE, m_szDeltaEValue, MAX_PATH);
 
-		if ( GLOBAL::g_config.nDeltaEType != -1 && strlen(szOrderNum) > 0 && strlen(szDeltaEValue))
+		if ( GLOBAL::g_config.nDeltaEType != -1 && strlen(m_szOrderNum) > 0 && strlen(m_szDeltaEValue))
 		{
-			if ( GLOBAL::IsDigitStringA(szDeltaEValue) != -1 )
+			if ( GLOBAL::IsDigitStringA(m_szDeltaEValue) != -1 )
 			{
 				CHAR szType[3] = {0};
 				_itoa_s(GLOBAL::g_config.nDeltaEType, szType, 10);		
 
 				// 查询订单是否存在;
 				TB_ORDER tbOrder;
-				if ( GLOBAL::g_db.QueryOrder(szOrderNum, tbOrder) < 1)
+				if ( GLOBAL::g_db.QueryOrder(m_szOrderNum, tbOrder) < 1)
 				{
 					// 新增订单;
 					tbOrder.nMode = GLOBAL::g_config.nOffline;
-					tbOrder.strOrder = szOrderNum;
+					tbOrder.strOrder = m_szOrderNum;
 					tbOrder.strDeltaEType = szType;
-					tbOrder.strDeltaEValue = szDeltaEValue;
+					tbOrder.strDeltaEValue = m_szDeltaEValue;
 
 					GLOBAL::g_db.InsertOrder(tbOrder);
 				}
@@ -756,7 +823,7 @@ void CPageDebug::OnBnClickedLock()
 					// 更新订单;
 					tbOrder.nMode = GLOBAL::g_config.nOffline;
 					tbOrder.strDeltaEType = szType;
-					tbOrder.strDeltaEValue = szDeltaEValue;
+					tbOrder.strDeltaEValue = m_szDeltaEValue;
 
 					GLOBAL::g_db.UpdateOrder(tbOrder);
 				}
@@ -782,3 +849,31 @@ void CPageDebug::OnCbnSelchangeEtype()
 		WritePrivateProfileString(_T("BATCH"), _T("EType"), szValue, GLOBAL::g_szConfigFile);		
 	}
 }
+
+void CPageDebug::UpdateList(std::vector<GLOBAL::RGB_PAT> &vtRGB)
+{
+	int nIndex = 0;
+	CString strValue;
+	//GetDlgItemText(EDIT_EVALUE, strValue);	
+	m_ctrlList.RemoveAll();
+	m_ctrlList.m_AryList.SetSize(vtRGB.size(), 1);
+	for (std::vector<GLOBAL::RGB_PAT>::iterator it = vtRGB.begin(); it != vtRGB.end(); it++)
+	{
+		CStringArray arryString;
+		strValue.Format(_T("%d"), nIndex+1);
+		arryString.Add(strValue);
+		arryString.Add(CharEncoding::ASCII2UNICODE(it->R.c_str()));
+		arryString.Add(CharEncoding::ASCII2UNICODE(it->G.c_str()));
+		arryString.Add(CharEncoding::ASCII2UNICODE(it->B.c_str()));
+		if ( GLOBAL::g_config.nDeltaEType == GLOBAL::DeltaE00)
+			arryString.Add(CharEncoding::ASCII2UNICODE(it->deltaE00.c_str()));
+		if ( GLOBAL::g_config.nDeltaEType == GLOBAL::DeltaE76)
+			arryString.Add(CharEncoding::ASCII2UNICODE(it->deltaE76.c_str()));
+		if ( GLOBAL::g_config.nDeltaEType == GLOBAL::DeltaE94)
+			arryString.Add(CharEncoding::ASCII2UNICODE(it->deltaE94.c_str()));
+		//arryString.Add(strValue);
+		m_ctrlList.m_AryList.ElementAt(nIndex++).Copy(arryString);
+	}
+	//m_ctrlList.m_AryList.SetSize(vtRGB.size(), 1);
+	m_ctrlList.SetItemCountEx(vtRGB.size());
+}

+ 9 - 1
Source/OGCAssistTool/OGCAssistTool/PageDebug.h

@@ -2,6 +2,8 @@
 #include "afxcmn.h"
 #include "afxwin.h"
 #include "SubLabel.h"
+#include "SortHeaderCtrl.h"
+#include "ListSortCtrl.h"
 
 // ÏûÏ¢;
 #define WM_CONNECT_PRO			(WM_USER + 1001)
@@ -28,7 +30,8 @@ protected:
 public:
 	virtual BOOL OnInitDialog();
 	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
-	CListCtrl m_ctrlList;
+	//CListCtrl m_ctrlList;
+	CListSortCtrl m_ctrlList;
 	void InitListCtrl();
 	inline void ShowOGCWnd(int nCmdShow = SW_SHOW)
 	{
@@ -61,4 +64,9 @@ public:
 	afx_msg void OnCbnSelchangeEtype();
 	CComboBox m_cbDeltaEType;
 	CLabel m_lable_result;
+	CHAR m_szOrderNum[MAX_PATH];
+	CHAR m_szDeltaEValue[MAX_PATH];
+	CHAR m_szSN[MAX_PATH];
+	void UpdateList(std::vector<GLOBAL::RGB_PAT> &vtRGB);
+	afx_msg void OnNMCustomdrawDebugData(NMHDR *pNMHDR, LRESULT *pResult);
 };

+ 3 - 5
Source/OGCAssistTool/OGCAssistTool/TableInfo.h

@@ -16,8 +16,7 @@ typedef struct __TB_SN__
 	std::string strOrder;
 	std::string strSN;
 	std::string strLine;
-	std::string strStartTime;
-	std::string strFinishedTime;
+	std::string strTestTime;
 	int nElapsed;
 	int nTestResult;
 	DOUBLE dDeltaEValue;			// 标准值;多加这个变量为防止离线模式反复变化该值;
@@ -38,8 +37,7 @@ PRIMARY KEY(OrderID));"
 OrderID TEXT(32) NOT NULL, \
 SN TEXT(32) NOT NULL, \
 Line TEXT(8) NOT NULL, \
-StartTime DATETIME NOT NULL, \
-FinishTime DATETIME NOT NULL, \
+TestTime DATETIME NOT NULL, \
 ElapsedTime INTEGER NOT NULL,\
 TestResult INTEGER NOT NULL, \
 DEAvgValue REAL NOT NULL, \
@@ -57,7 +55,7 @@ PRIMARY KEY(SN));"
 
 // 查询表;
 #define _SELECT_ORDER_ "SELECT OrderID, DEType, DEValue, Mode, CreateTime FROM DebugOrders"
-#define _SELECT_SN_ "SELECT OrderID, SN,Line,StartTime,FinishTime,ElapsedTime,TestResult,DEAvgValue,Outcome FROM DebugSN"
+#define _SELECT_SN_ "SELECT OrderID, SN,Line,TestTime,ElapsedTime,TestResult,DEAvgValue,Outcome FROM DebugSN"
 
 // 删除记录;
 #define _DELETE_ORDER_ ""