瀏覽代碼

添加调试结束时间。

JeffWang 2 年之前
父節點
當前提交
69bdec8bda

+ 108 - 150
Source/OGCAssistTool/OGCAssistTool/DataImpl.cpp

@@ -3,56 +3,6 @@
 #include "CharEncoding.h"
 #include "Global.h"
 
-// MID表;
-#define _CREATE_MID_TABLE_ \
-	"CREATE TABLE mid \
-(bid  TEXT(16) NOT NULL,\
-number  INTEGER NOT NULL,\
-pid  INTEGER NOT NULL,\
-ctype  TEXT(32) NOT NULL,\
-version  TEXT(32) NOT NULL,\
-purl  TEXT NOT NULL,\
-psize  INTEGER NOT NULL,\
-pmd5  TEXT(32) NOT NULL,\
-status  INTEGER NOT NULL DEFAULT 0,\
-start_date  DATETIME DEFAULT current_timestamp,\
-finish_date  DATETIME DEFAULT '',\
-des  TEXT NOT NULL DEFAULT \"未下载\",\
-PRIMARY KEY (bid ASC));"
-#define _SELECT_MID_TABLE_ "SELECT bid, number, pid, ctype, version, purl, psize, pmd5, status, start_date, finish_date, des FROM mid"
-#define _INSERT_MID_TABLE_ "INSERT INTO mid(bid, number, pid, ctype, version, purl, psize, pmd5)VALUES\
-(%s, %s, %s, %s, %s, %s, %s, %s);"
-
-// Key表;
-#define _CREATE_KEYS_TABLE_ \
-	"CREATE TABLE keys \
-(bid  TEXT(16) NOT NULL,\
-sn  TEXT(32) PRIMARY KEY NOT NULL,\
-pid  INTEGER NOT NULL,\
-keys  TEXT NOT NULL,\
-copy_date  DATETIME DEFAULT '',\
-report_date  DATETIME DEFAULT '');"
-#define _SELECT_KEYS_TABLE_ "SELECT bid, pid, sn, keys, copy_date, report_date FROM keys"
-
-// Log表;
-#define _CREATE_LOG_TABLE_ \
-	"CREATE TABLE log \
-(bid  TEXT(16) NOT NULL,\
-type  TEXT(32) NOT NULL,\
-sn  TEXT(32) NOT NULL,\
-content  TEXT NOT NULL,\
-gdate  DATETIME DEFAULT current_timestamp,\
-report_date  DATETIME DEFAULT '',\
-PRIMARY KEY (type, sn));"
-#define _SELECT_LOG_TABLE_ "SELECT type, bid, sn, content, gdate, report_date FROM log"
-
-#define _SELECT_BID_INFO__ \
-	"select ifnull(mid.number,0) as tc, \
-count(keys.bid) as ac,\
-count(case when keys.copy_date <> '' then '抄写成功' end) as cc,\
-count(case when keys.report_date <> '' and keys.copy_date <> '' then '上报成功' end) as rc \
-from mid inner join keys on mid.bid = keys.bid where mid.bid = '%s';"
-
 #define FREE_MSG if ( psqlite_error )  \
 	printf("%s\n",psqlite_error),\
 	sqlite3_free(psqlite_error),\
@@ -204,23 +154,25 @@ 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.strTestTime, 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.strStartTime, sn_data.strFinishTime, 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 strTestTime, 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 strStartTime, std::string strFinishTime,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, TestTime, ElapsedTime, TestResult, DEAvgValue, DEValue, Outcome) VALUES ('";
+	std::string strInsert = "INSERT INTO DebugSN(OrderID, Line, SN, StartTime, FinishTime, ElapsedTime, TestResult, DEAvgValue, DEValue, Outcome) VALUES ('";
 	strInsert.append(strOrder);
 	strInsert.append("','");
 	strInsert.append(strLine);
 	strInsert.append("','");
 	strInsert.append(strSN);
 	strInsert.append("','");
-	strInsert.append(strTestTime);
+	strInsert.append(strStartTime);
+	strInsert.append("','");
+	strInsert.append(strFinishTime);
 
 	_itoa_s(nElapsed, szValue, 10);
 	strInsert.append("','");
@@ -432,31 +384,33 @@ 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.strTestTime = pazResult[nCol+3];
-		sn_data.strElapsed = pazResult[nCol+4];
+		sn_data.strStartTime = pazResult[nCol+3];
+		sn_data.strFinishTime = pazResult[nCol + 4];
+		sn_data.strElapsed = pazResult[nCol+5];
 		sn_data.nElapsed = atoi(sn_data.strElapsed.c_str());
-		sn_data.strTestResult = pazResult[nCol+5];
-		sn_data.nTestResult = atoi(pazResult[nCol+5]);
-		sn_data.strDeltaAVGEValue = pazResult[nCol+6];
-		sn_data.dDeltaAVGEValue = atof(pazResult[nCol+6]);
-		sn_data.strDeltaEValue = pazResult[nCol+7];
-		sn_data.dDeltaEValue = atof(pazResult[nCol+7]);
-		sn_data.strDetails = pazResult[nCol+8];
+		sn_data.strTestResult = pazResult[nCol+6];
+		sn_data.nTestResult = atoi(pazResult[nCol+6]);
+		sn_data.strDeltaAVGEValue = pazResult[nCol+7];
+		sn_data.dDeltaAVGEValue = atof(pazResult[nCol+7]);
+		sn_data.strDeltaEValue = pazResult[nCol+8];
+		sn_data.dDeltaEValue = atof(pazResult[nCol+8]);
+		sn_data.strDetails = pazResult[nCol+9];
 #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.strTestTime = CharEncoding::UTF82ASCII(pazResult[nCol+3]);
-		sn_data.strElapsed = CharEncoding::UTF82ASCII(pazResult[nCol+4]);
-		sn_data.nElapsed = atoi(pazResult[nCol+4]);
-		sn_data.strTestResult = CharEncoding::UTF82ASCII(pazResult[nCol+5]);
-		sn_data.nTestResult = atoi(pazResult[nCol+5]);
-		sn_data.strDeltaAVGEValue = CharEncoding::UTF82ASCII(pazResult[nCol+6]);
-		sn_data.dDeltaAVGEValue = atof(pazResult[nCol+6]);
-		sn_data.strDeltaEValue = CharEncoding::UTF82ASCII(pazResult[nCol+7]);
-		sn_data.dDeltaEValue = atof(pazResult[nCol+7]);
-		sn_data.strDetails = CharEncoding::UTF82ASCII(pazResult[nCol+8]);
+		sn_data.strStartTime = CharEncoding::UTF82ASCII(pazResult[nCol+3]);
+		sn_data.strFinishTime = CharEncoding::UTF82ASCII(pazResult[nCol + 4]);
+		sn_data.strElapsed = CharEncoding::UTF82ASCII(pazResult[nCol+5]);
+		sn_data.nElapsed = atoi(pazResult[nCol+5]);
+		sn_data.strTestResult = CharEncoding::UTF82ASCII(pazResult[nCol+6]);
+		sn_data.nTestResult = atoi(pazResult[nCol+6]);
+		sn_data.strDeltaAVGEValue = CharEncoding::UTF82ASCII(pazResult[nCol+7]);
+		sn_data.dDeltaAVGEValue = atof(pazResult[nCol+7]);
+		sn_data.strDeltaEValue = CharEncoding::UTF82ASCII(pazResult[nCol+8]);
+		sn_data.dDeltaEValue = atof(pazResult[nCol+8]);
+		sn_data.strDetails = CharEncoding::UTF82ASCII(pazResult[nCol+9]);
 #endif
 	}
 
@@ -495,31 +449,33 @@ INT CDataImpl::QuerySNData(std::string strOrder, std::vector<TB_SN> &vtSNdata)
 		it->strOrder = pazResult[i*nCol+0];
 		it->strSN = pazResult[i*nCol+1];
 		it->strLine = pazResult[i*nCol+2];
-		it->strTestTime = pazResult[i*nCol+3];
-		it->strElapsed = pazResult[i*nCol+4];
+		it->strStartTime = pazResult[i*nCol+3];
+		it->strFinishTime = pazResult[i * nCol + 4];
+		it->strElapsed = pazResult[i*nCol+5];
 		it->nElapsed = atoi(it->strElapsed.c_str());
-		it->strTestResult = pazResult[i*nCol+5];
-		it->nTestResult = atoi(pazResult[i*nCol+5]);
-		it->strDeltaAVGEValue = pazResult[i*nCol+6];
-		it->dDeltaAVGEValue = atof(pazResult[i*nCol+6]);
-		it->strDeltaEValue = pazResult[i*nCol+7];
-		it->dDeltaEValue = atof(pazResult[i*nCol+7]);
-		it->strDetails = pazResult[i*nCol+8];
+		it->strTestResult = pazResult[i*nCol+6];
+		it->nTestResult = atoi(pazResult[i*nCol+6]);
+		it->strDeltaAVGEValue = pazResult[i*nCol+7];
+		it->dDeltaAVGEValue = atof(pazResult[i*nCol+7]);
+		it->strDeltaEValue = pazResult[i*nCol+8];
+		it->dDeltaEValue = atof(pazResult[i*nCol+8]);
+		it->strDetails = pazResult[i*nCol+9];
 #else
 		// 由Native for SQLite3插入的数据,都是utf8格式;
 		it->strOrder = CharEncoding::UTF82ASCII(pazResult[i*nCol+0]);
 		it->strSN = CharEncoding::UTF82ASCII(pazResult[i*nCol+1]);
 		it->strLine = CharEncoding::UTF82ASCII(pazResult[i*nCol+2]);
-		it->strTestTime = CharEncoding::UTF82ASCII(pazResult[i*nCol+3]);
-		it->strElapsed = CharEncoding::UTF82ASCII(pazResult[i*nCol+4]);
-		it->nElapsed = atoi(pazResult[i*nCol+4]);
-		it->strTestResult = CharEncoding::UTF82ASCII(pazResult[i*nCol+5]);
-		it->nTestResult = atoi(pazResult[i*nCol+5]);
-		it->strDeltaAVGEValue = CharEncoding::UTF82ASCII(pazResult[i*nCol+6]);
-		it->dDeltaAVGEValue = atof(pazResult[i*nCol+6]);
-		it->strDeltaEValue = CharEncoding::UTF82ASCII(pazResult[i*nCol+7]);
-		it->dDeltaEValue = atof(pazResult[i*nCol+7]);
-		it->strDetails = CharEncoding::UTF82ASCII(pazResult[i*nCol+8]);
+		it->strStartTime = CharEncoding::UTF82ASCII(pazResult[i*nCol+3]);
+		it->strFinishTime = CharEncoding::UTF82ASCII(pazResult[i * nCol + 4]);
+		it->strElapsed = CharEncoding::UTF82ASCII(pazResult[i*nCol+5]);
+		it->nElapsed = atoi(pazResult[i*nCol+5]);
+		it->strTestResult = CharEncoding::UTF82ASCII(pazResult[i*nCol+6]);
+		it->nTestResult = atoi(pazResult[i*nCol+6]);
+		it->strDeltaAVGEValue = CharEncoding::UTF82ASCII(pazResult[i*nCol+7]);
+		it->dDeltaAVGEValue = atof(pazResult[i*nCol+7]);
+		it->strDeltaEValue = CharEncoding::UTF82ASCII(pazResult[i*nCol+8]);
+		it->dDeltaEValue = atof(pazResult[i*nCol+8]);
+		it->strDetails = CharEncoding::UTF82ASCII(pazResult[i*nCol+9]);
 #endif
 	}
 
@@ -557,34 +513,36 @@ INT CDataImpl::QuerySNData(std::vector<TB_SN> &vtSNData, std::string strBeginTim
 	for(int i = 1; i <= nRow; i++, it++)
 	{
 #ifndef USE_UTF8
-		it->strOrder = pazResult[i*nCol+0];
-		it->strSN = pazResult[i*nCol+1];
-		it->strLine = pazResult[i*nCol+2];
-		it->strTestTime = pazResult[i*nCol+3];
-		it->strElapsed = pazResult[i*nCol+4];
+		it->strOrder = pazResult[i * nCol + 0];
+		it->strSN = pazResult[i * nCol + 1];
+		it->strLine = pazResult[i * nCol + 2];
+		it->strStartTime = pazResult[i * nCol + 3];
+		it->strFinishTime = pazResult[i * nCol + 4];
+		it->strElapsed = pazResult[i * nCol + 5];
 		it->nElapsed = atoi(it->strElapsed.c_str());
-		it->strTestResult = pazResult[i*nCol+5];
-		it->nTestResult = atoi(pazResult[i*nCol+5]);
-		it->strDeltaAVGEValue = pazResult[i*nCol+6];
-		it->dDeltaAVGEValue = atof(pazResult[i*nCol+6]);
-		it->strDeltaEValue = pazResult[i*nCol+7];
-		it->dDeltaEValue = atof(pazResult[i*nCol+7]);
-		it->strDetails = pazResult[i*nCol+8];
+		it->strTestResult = pazResult[i * nCol + 6];
+		it->nTestResult = atoi(pazResult[i * nCol + 6]);
+		it->strDeltaAVGEValue = pazResult[i * nCol + 7];
+		it->dDeltaAVGEValue = atof(pazResult[i * nCol + 7]);
+		it->strDeltaEValue = pazResult[i * nCol + 8];
+		it->dDeltaEValue = atof(pazResult[i * nCol + 8]);
+		it->strDetails = pazResult[i * nCol + 9];
 #else
 		// 由Native for SQLite3插入的数据,都是utf8格式;
-		it->strOrder = CharEncoding::UTF82ASCII(pazResult[i*nCol+0]);
-		it->strSN = CharEncoding::UTF82ASCII(pazResult[i*nCol+1]);
-		it->strLine = CharEncoding::UTF82ASCII(pazResult[i*nCol+2]);
-		it->strTestTime = CharEncoding::UTF82ASCII(pazResult[i*nCol+3]);
-		it->strElapsed = CharEncoding::UTF82ASCII(pazResult[i*nCol+4]);
-		it->nElapsed = atoi(pazResult[i*nCol+4]);
-		it->strTestResult = CharEncoding::UTF82ASCII(pazResult[i*nCol+5]);
-		it->nTestResult = atoi(pazResult[i*nCol+5]);
-		it->strDeltaAVGEValue = CharEncoding::UTF82ASCII(pazResult[i*nCol+6]);
-		it->dDeltaAVGEValue = atof(pazResult[i*nCol+6]);
-		it->strDeltaEValue = CharEncoding::UTF82ASCII(pazResult[i*nCol+7]);
-		it->dDeltaEValue = atof(pazResult[i*nCol+7]);
-		it->strDetails = CharEncoding::UTF82ASCII(pazResult[i*nCol+8]);
+		it->strOrder = CharEncoding::UTF82ASCII(pazResult[i * nCol + 0]);
+		it->strSN = CharEncoding::UTF82ASCII(pazResult[i * nCol + 1]);
+		it->strLine = CharEncoding::UTF82ASCII(pazResult[i * nCol + 2]);
+		it->strStartTime = CharEncoding::UTF82ASCII(pazResult[i * nCol + 3]);
+		it->strFinishTime = CharEncoding::UTF82ASCII(pazResult[i * nCol + 4]);
+		it->strElapsed = CharEncoding::UTF82ASCII(pazResult[i * nCol + 5]);
+		it->nElapsed = atoi(pazResult[i * nCol + 5]);
+		it->strTestResult = CharEncoding::UTF82ASCII(pazResult[i * nCol + 6]);
+		it->nTestResult = atoi(pazResult[i * nCol + 6]);
+		it->strDeltaAVGEValue = CharEncoding::UTF82ASCII(pazResult[i * nCol + 7]);
+		it->dDeltaAVGEValue = atof(pazResult[i * nCol + 7]);
+		it->strDeltaEValue = CharEncoding::UTF82ASCII(pazResult[i * nCol + 8]);
+		it->dDeltaEValue = atof(pazResult[i * nCol + 8]);
+		it->strDetails = CharEncoding::UTF82ASCII(pazResult[i * nCol + 9]);
 #endif
 	}
 
@@ -623,34 +581,36 @@ INT CDataImpl::QuerySNData(std::vector<TB_SN> &vtSNData, std::string strWhere)
 	for(int i = 1; i <= nRow; i++, it++)
 	{
 #ifndef USE_UTF8
-		it->strOrder = pazResult[i*nCol+0];
-		it->strSN = pazResult[i*nCol+1];
-		it->strLine = pazResult[i*nCol+2];
-		it->strTestTime = pazResult[i*nCol+3];
-		it->strElapsed = pazResult[i*nCol+4];
+		it->strOrder = pazResult[i * nCol + 0];
+		it->strSN = pazResult[i * nCol + 1];
+		it->strLine = pazResult[i * nCol + 2];
+		it->strStartTime = pazResult[i * nCol + 3];
+		it->strFinishTime = pazResult[i * nCol + 4];
+		it->strElapsed = pazResult[i * nCol + 5];
 		it->nElapsed = atoi(it->strElapsed.c_str());
-		it->strTestResult = pazResult[i*nCol+5];
-		it->nTestResult = atoi(pazResult[i*nCol+5]);
-		it->strDeltaAVGEValue = pazResult[i*nCol+6];
-		it->dDeltaAVGEValue = atof(pazResult[i*nCol+6]);
-		it->strDeltaEValue = pazResult[i*nCol+7];
-		it->dDeltaEValue = atof(pazResult[i*nCol+7]);
-		it->strDetails = pazResult[i*nCol+8];
+		it->strTestResult = pazResult[i * nCol + 6];
+		it->nTestResult = atoi(pazResult[i * nCol + 6]);
+		it->strDeltaAVGEValue = pazResult[i * nCol + 7];
+		it->dDeltaAVGEValue = atof(pazResult[i * nCol + 7]);
+		it->strDeltaEValue = pazResult[i * nCol + 8];
+		it->dDeltaEValue = atof(pazResult[i * nCol + 8]);
+		it->strDetails = pazResult[i * nCol + 9];
 #else
 		// 由Native for SQLite3插入的数据,都是utf8格式;
-		it->strOrder = CharEncoding::UTF82ASCII(pazResult[i*nCol+0]);
-		it->strSN = CharEncoding::UTF82ASCII(pazResult[i*nCol+1]);
-		it->strLine = CharEncoding::UTF82ASCII(pazResult[i*nCol+2]);
-		it->strTestTime = CharEncoding::UTF82ASCII(pazResult[i*nCol+3]);
-		it->strElapsed = CharEncoding::UTF82ASCII(pazResult[i*nCol+4]);
-		it->nElapsed = atoi(pazResult[i*nCol+4]);
-		it->strTestResult = CharEncoding::UTF82ASCII(pazResult[i*nCol+5]);
-		it->nTestResult = atoi(pazResult[i*nCol+5]);
-		it->strDeltaAVGEValue = CharEncoding::UTF82ASCII(pazResult[i*nCol+6]);
-		it->dDeltaAVGEValue = atof(pazResult[i*nCol+6]);
-		it->strDeltaEValue = CharEncoding::UTF82ASCII(pazResult[i*nCol+7]);
-		it->dDeltaEValue = atof(pazResult[i*nCol+7]);
-		it->strDetails = CharEncoding::UTF82ASCII(pazResult[i*nCol+8]);
+		it->strOrder = CharEncoding::UTF82ASCII(pazResult[i * nCol + 0]);
+		it->strSN = CharEncoding::UTF82ASCII(pazResult[i * nCol + 1]);
+		it->strLine = CharEncoding::UTF82ASCII(pazResult[i * nCol + 2]);
+		it->strStartTime = CharEncoding::UTF82ASCII(pazResult[i * nCol + 3]);
+		it->strFinishTime = CharEncoding::UTF82ASCII(pazResult[i * nCol + 4]);
+		it->strElapsed = CharEncoding::UTF82ASCII(pazResult[i * nCol + 5]);
+		it->nElapsed = atoi(pazResult[i * nCol + 5]);
+		it->strTestResult = CharEncoding::UTF82ASCII(pazResult[i * nCol + 6]);
+		it->nTestResult = atoi(pazResult[i * nCol + 6]);
+		it->strDeltaAVGEValue = CharEncoding::UTF82ASCII(pazResult[i * nCol + 7]);
+		it->dDeltaAVGEValue = atof(pazResult[i * nCol + 7]);
+		it->strDeltaEValue = CharEncoding::UTF82ASCII(pazResult[i * nCol + 8]);
+		it->dDeltaEValue = atof(pazResult[i * nCol + 8]);
+		it->strDetails = CharEncoding::UTF82ASCII(pazResult[i * nCol + 9]);
 #endif
 	}
 
@@ -754,10 +714,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.strTestTime, 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.strStartTime, sn_data.strFinishTime, 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, 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 strStartTime, std::string strFinishTime, int nElapsed, int nTestResult, double dAVGDeltaEVlaue, DOUBLE dDeltaEValue, std::string strDetails)
 {
 	if(m_psqlite3 == NULL)
 		return FALSE;
@@ -767,8 +727,10 @@ BOOL CDataImpl::UpdateSNData(std::string strOrder,std::string strSN, std::string
 	strInsert.append(strOrder);
 	strInsert.append("', Line='");
 	strInsert.append(strLine);
-	strInsert.append("', TestTime='");
-	strInsert.append(strTestTime);
+	strInsert.append("', StartTime='");
+	strInsert.append(strStartTime);
+	strInsert.append("', FinishTime='");
+	strInsert.append(strFinishTime);
 	_itoa_s(nElapsed, szValue, 10);
 	strInsert.append("', ElapsedTime='");
 	strInsert.append(szValue);
@@ -798,10 +760,6 @@ BOOL CDataImpl::UpdateSNData(std::string strOrder,std::string strSN, std::string
 }
 
 
-
-
-
-
 BOOL CDataImpl::DeleteOrder(std::string strOrder)
 {
 	if(m_psqlite3 == NULL)

+ 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 strTesttTime, int nElapsed, int nTestResult, DOUBLE dDeltaAVGEValue, DOUBLE dDeltaEValue, std::string strDetails );
+	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 QueryOrder(std::string strOrder, TB_ORDER &order);
 	INT QueryOrders(std::vector<TB_ORDER> &vtOrders, std::string strWhere="");
@@ -96,7 +96,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, int nElapsed, int nTestResult, double dAVGDeltaEVlaue, DOUBLE dDeltaEValue, std::string strDetails);
+	BOOL UpdateSNData(std::string strOrder,std::string strSN, std::string strLine, std::string strStartTime, std::string strFinishTime,int nElapsed, int nTestResult, double dAVGDeltaEVlaue, DOUBLE dDeltaEValue, std::string strDetails);
 
 	BOOL DeleteOrder(std::string strOrder);//ͬʱɾ³ýËùÓйØÁªµÄSN;
 	BOOL DeleteSNData(std::string strSN);

+ 14 - 2
Source/OGCAssistTool/OGCAssistTool/OGCAssistTool.rc

@@ -157,10 +157,11 @@ BEGIN
     EDITTEXT        EDIT_BATCH_NUM,280,20,78,14,ES_AUTOHSCROLL
     EDITTEXT        EDIT_SN,389,20,98,14,ES_AUTOHSCROLL
     CONTROL         "",IDC_DATETIMEPICKER2,"SysDateTimePick32",DTS_RIGHTALIGN | WS_TABSTOP,156,20,76,15
-    PUSHBUTTON      "查询",BTN_QUERY,662,20,50,14
+    PUSHBUTTON      "查询",BTN_QUERY,616,20,50,14
     LTEXT           "至",IDC_STATIC,146,23,9,8
     COMBOBOX        IDC_COMBO1,539,20,48,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
     CONTROL         "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | LVS_OWNERDATA | WS_BORDER | WS_TABSTOP,7,47,715,270
+    PUSHBUTTON      "导出",BTN_EXPORT,669,20,50,14
 END
 
 PAGE_STATISTICS DIALOGEX 0, 0, 732, 322
@@ -171,12 +172,13 @@ BEGIN
     CONTROL         "创建时间",CHECK_TEST_TIME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,22,48,10
     CONTROL         "",IDC_DATETIMEPICKER1,"SysDateTimePick32",DTS_RIGHTALIGN | WS_TABSTOP,67,20,76,15
     CONTROL         "",IDC_DATETIMEPICKER2,"SysDateTimePick32",DTS_RIGHTALIGN | WS_TABSTOP,156,20,76,15
-    PUSHBUTTON      "查询",BTN_QUERY,662,20,50,14
+    PUSHBUTTON      "查询",BTN_QUERY,616,20,50,14
     LTEXT           "至",IDC_STATIC,146,23,9,8
     COMBOBOX        COMBO_ORDER,281,20,105,150,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
     GROUPBOX        "设置",IDC_STATIC,7,7,715,36
     CONTROL         "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | LVS_OWNERDATA | WS_BORDER | WS_TABSTOP,7,47,715,270
     CONTROL         "批次号",CHECK_BATCH_NUM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,243,22,33,10
+    PUSHBUTTON      "导出",BTN_EXPORT,669,20,50,14
 END
 
 PAGE_CONFIG DIALOGEX 0, 0, 732, 322
@@ -344,6 +346,16 @@ BEGIN
     0
 END
 
+PAGE_LOG AFX_DIALOG_LAYOUT
+BEGIN
+    0
+END
+
+PAGE_STATISTICS AFX_DIALOG_LAYOUT
+BEGIN
+    0
+END
+
 
 /////////////////////////////////////////////////////////////////////////////
 //

+ 8 - 2
Source/OGCAssistTool/OGCAssistTool/PageDebug.cpp

@@ -8,6 +8,7 @@
 #include "CharEncoding.h"
 #include "MESdb.h"
 
+std::string g_strStartTime;
 // 注入;
 extern CInjection g_Injection;
 // OGC Tool无序句柄;
@@ -372,6 +373,7 @@ DWORD CPageDebug::ThreadGoProc(LPVOID lpParam)
 				// 获取Config.dat第七行;
 				TCHAR szConfigPath[MAX_PATH] = {0};
 				_stprintf_s(szConfigPath, _T("%s\\Config.dat"), GLOBAL::g_config.szOGCToolPath);
+				std::string strFinishTime = CharEncoding::UNICODE2ASCII((LPWCH)CTime::GetCurrentTime().Format(_T("%Y-%m-%d %H:%M:%S")).GetString());
 				if ( msg_info.byResult && PathFileExists(szConfigPath) )
 				{
 					CFile file;
@@ -473,7 +475,8 @@ DWORD CPageDebug::ThreadGoProc(LPVOID lpParam)
 											tbSN.nTestResult = bRet;
 											tbSN.strLine = CharEncoding::UNICODE2ASCII(GLOBAL::g_config.szLine);
 											tbSN.nElapsed = dwElapsed;
-											tbSN.strTestTime = CharEncoding::UNICODE2ASCII((LPWCH)CTime::GetCurrentTime().Format(_T("%Y-%m-%d %H:%M:%S")).GetString());
+											tbSN.strStartTime = g_strStartTime;
+											tbSN.strFinishTime = strFinishTime;
 											for ( std::vector<GLOBAL::RGB_PAT>::iterator it = vtRGB.begin(); it != vtRGB.end(); it++ )
 											{
 												if ( GLOBAL::g_config.nDeltaEType == GLOBAL::DeltaE00)
@@ -498,7 +501,8 @@ DWORD CPageDebug::ThreadGoProc(LPVOID lpParam)
 											tbSN.nTestResult = bRet;
 											tbSN.strLine = CharEncoding::UNICODE2ASCII(GLOBAL::g_config.szLine);
 											tbSN.nElapsed = dwElapsed;
-											tbSN.strTestTime = CharEncoding::UNICODE2ASCII((LPWCH)CTime::GetCurrentTime().Format(_T("%Y-%m-%d %H:%M:%S")).GetString());
+											tbSN.strStartTime = g_strStartTime;
+											tbSN.strFinishTime = strFinishTime;
 											for ( std::vector<GLOBAL::RGB_PAT>::iterator it = vtRGB.begin(); it != vtRGB.end(); it++ )
 											{
 												if ( GLOBAL::g_config.nDeltaEType == GLOBAL::DeltaE00)
@@ -695,6 +699,8 @@ void CPageDebug::OnBnClickedTest()
 
 		GetDlgItem(BTN_TEST)->EnableWindow(FALSE);
 		GetDlgItem(EDIT_SN)->EnableWindow(FALSE);
+		// 设置测试开始时间;
+		g_strStartTime = CharEncoding::UNICODE2ASCII((LPWCH)CTime::GetCurrentTime().Format(_T("%Y-%m-%d %H:%M:%S")).GetString());
 		//SetTimer(1, 500, NULL);
 	}
 	else

+ 37 - 1
Source/OGCAssistTool/OGCAssistTool/PageLog.cpp

@@ -32,6 +32,7 @@ BEGIN_MESSAGE_MAP(CPageLog, CDialogEx)
 	ON_WM_CTLCOLOR()
 	ON_BN_CLICKED(BTN_QUERY, &CPageLog::OnBnClickedQuery)
 	ON_NOTIFY(NM_CUSTOMDRAW, IDC_LIST1, &CPageLog::OnNMCustomdrawList1)
+	ON_BN_CLICKED(BTN_EXPORT, &CPageLog::OnBnClickedExport)
 END_MESSAGE_MAP()
 
 
@@ -139,6 +140,12 @@ void CPageLog::OnBnClickedQuery()
 	{
 		CString strOrder;
 		GetDlgItemText(EDIT_BATCH_NUM, strOrder);
+		if (strOrder.IsEmpty())
+		{
+			MessageBox(_T("批次号不能空!"), _T("提示"), MB_ICONWARNING);
+			return;
+		}
+
 		if ( strWhere.size() )
 			strWhere.append(" and OrderID='");
 		else
@@ -151,6 +158,12 @@ void CPageLog::OnBnClickedQuery()
 	{
 		CString strSN;
 		GetDlgItemText(EDIT_SN, strSN);
+		if (strSN.IsEmpty())
+		{
+			MessageBox(_T("SN不能空!"), _T("提示"), MB_ICONWARNING);
+			return;
+		}
+
 		if ( strWhere.size() )
 			strWhere.append(" and SN='");
 		else
@@ -174,6 +187,11 @@ void CPageLog::OnBnClickedQuery()
 				strWhere.append(nCurSel ? "1" : "0");
 				strWhere.append("'");
 			}
+			else
+			{
+				MessageBox(_T("结果不能空选项!"), _T("提示"), MB_ICONWARNING);
+				return;
+			}
 		}
 	}
 
@@ -195,7 +213,7 @@ void CPageLog::UpdateList(std::vector<TB_SN> &vtSNData)
 		CStringArray arryString;
 		arryString.Add(CharEncoding::ASCII2UNICODE(it->strOrder.c_str()));
 		arryString.Add(CharEncoding::ASCII2UNICODE(it->strSN.c_str()));
-		arryString.Add(CharEncoding::ASCII2UNICODE(it->strTestTime.c_str()));
+		arryString.Add(CharEncoding::ASCII2UNICODE(it->strStartTime.c_str()));
 		arryString.Add(CharEncoding::ASCII2UNICODE(it->strElapsed.c_str()));
 		arryString.Add(it->strTestResult == "1" ? _T("PASS") : _T("FAIL"));
 		arryString.Add(CharEncoding::ASCII2UNICODE(it->strDeltaAVGEValue.c_str()));
@@ -231,3 +249,21 @@ void CPageLog::OnNMCustomdrawList1(NMHDR *pNMHDR, LRESULT *pResult)
 		*pResult = CDRF_DODEFAULT;
 	}
 }
+
+
+void CPageLog::OnBnClickedExport()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (m_ctrlList.GetItemCount() == 0)
+	{
+		MessageBox(_T("无数据可导出!"), _T("提示"), MB_ICONWARNING);
+		return;
+	}
+
+	CString strHeader = _T("批次号,SN,调试开始,调试耗时,调试结束,调试结果,DeltaE结果值,Delta标准值");
+	INT nCount = m_ctrlList.m_AryList.GetCount();
+	for ( int i = 0; i < nCount; i++ )
+	{
+		m_ctrlList.m_AryList.ElementAt(i);
+	}
+}

+ 1 - 0
Source/OGCAssistTool/OGCAssistTool/PageLog.h

@@ -30,4 +30,5 @@ public:
 	afx_msg void OnBnClickedQuery();
 	void UpdateList(std::vector<TB_SN> &vtSNData);
 	afx_msg void OnNMCustomdrawList1(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnBnClickedExport();
 };

+ 18 - 0
Source/OGCAssistTool/OGCAssistTool/PageStatistics.cpp

@@ -35,6 +35,7 @@ BEGIN_MESSAGE_MAP(CPageStatistics, CDialogEx)
 	ON_BN_CLICKED(CHECK_BATCH_NUM, &CPageStatistics::OnBnClickedBatchNum)
 	ON_BN_CLICKED(BTN_QUERY, &CPageStatistics::OnBnClickedQuery)
 	ON_NOTIFY(NM_CUSTOMDRAW, IDC_LIST1, &CPageStatistics::OnNMCustomdrawList1)
+	ON_BN_CLICKED(BTN_EXPORT, &CPageStatistics::OnBnClickedExport)
 END_MESSAGE_MAP()
 
 
@@ -159,6 +160,12 @@ void CPageStatistics::OnBnClickedQuery()
 	{
 		CString strOrder;
 		GetDlgItemText(COMBO_ORDER, strOrder);
+		if (strOrder.IsEmpty())
+		{
+			MessageBox(_T("批次号不能空!"), _T("提示"), MB_ICONWARNING);
+			return;
+		}
+
 		if ( strWhere.size() )
 			strWhere.append(" and DebugSN.OrderID='");
 		else
@@ -217,3 +224,14 @@ void CPageStatistics::OnNMCustomdrawList1(NMHDR *pNMHDR, LRESULT *pResult)
 		*pResult = CDRF_DODEFAULT;
 	}
 }
+
+
+void CPageStatistics::OnBnClickedExport()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (m_ctrlList.GetItemCount() == 0)
+	{
+		MessageBox(_T("无数据可导出!"), _T("提示"), MB_ICONWARNING);
+		return;
+	}
+}

+ 1 - 0
Source/OGCAssistTool/OGCAssistTool/PageStatistics.h

@@ -32,4 +32,5 @@ public:
 	afx_msg void OnBnClickedQuery();
 	void UpdateList(std::vector<TB_STATIS> &vtStatis);
 	afx_msg void OnNMCustomdrawList1(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnBnClickedExport();
 };

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

@@ -17,7 +17,8 @@ typedef struct __TB_SN__
 	std::string strOrder;
 	std::string strSN;
 	std::string strLine;
-	std::string strTestTime;
+	std::string strStartTime;
+	std::string strFinishTime;
 	std::string strElapsed;
 	std::string strTestResult;
 	std::string strDeltaEValue;
@@ -55,7 +56,8 @@ PRIMARY KEY(OrderID));"
 OrderID TEXT(32) NOT NULL, \
 SN TEXT(32) NOT NULL, \
 Line TEXT(8) NOT NULL, \
-TestTime DATETIME NOT NULL, \
+StartTime DATETIME NOT NULL, \
+FinishTime DATETIME NOT NULL, \
 ElapsedTime INTEGER NOT NULL,\
 TestResult INTEGER NOT NULL, \
 DEAvgValue REAL NOT NULL, \
@@ -73,7 +75,7 @@ PRIMARY KEY(SN));"
 
 // ²éѯ±í;
 #define _SELECT_ORDER_ "SELECT OrderID, DEType, DEValue, Mode, CreateTime FROM DebugOrders"
-#define _SELECT_SN_ "SELECT OrderID, SN,Line,TestTime,ElapsedTime,TestResult,DEAvgValue,DEValue,Outcome FROM DebugSN"
+#define _SELECT_SN_ "SELECT OrderID, SN,Line,StartTime,FinishTime,ElapsedTime,TestResult,DEAvgValue,DEValue,Outcome FROM DebugSN"
 #define _STATIS_ "select CreateTime, DebugSN.OrderID, \
 case Mode when '0' then 'Online' else 'Offlien' end as 'Mode', \
 count(1) as 'TotalCount', \

+ 3 - 2
Source/OGCAssistTool/OGCAssistTool/resource.h

@@ -55,14 +55,15 @@
 #define COMBO_ORDER                     1025
 #define CHECK_SN_GET                    1026
 #define CB_LINE                         1027
+#define BTN_EXPORT                      1028
 
 // Next default values for new objects
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        137
+#define _APS_NEXT_RESOURCE_VALUE        139
 #define _APS_NEXT_COMMAND_VALUE         32771
-#define _APS_NEXT_CONTROL_VALUE         1028
+#define _APS_NEXT_CONTROL_VALUE         1029
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif

+ 14 - 0
Source/OGCAssistTool/OGCAssistTool/stdafx.h

@@ -59,6 +59,20 @@ typedef std::string TString;
 #include "log4z.h"
 using namespace zsummer::log4z;
 
+// 空白单元格;
+typedef struct RecordBlank
+{
+	const unsigned short opcode = 0x201; // 0x201;
+	const unsigned short length = 0x06;  // 0x6;
+	// 所在行;
+	unsigned short Row = 0;
+	// 所在列;
+	unsigned short Column = 0;
+	// 单元格样式;
+	unsigned short CellStyle = 0;
+} REC_BLANK, * LPREC_BLANK;
+
+
 #ifdef _UNICODE
 #if defined _M_IX86
 #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")