Browse Source

循环测试

Jeff 23 years ago
parent
commit
196de83ac7
1 changed files with 57 additions and 54 deletions
  1. 57 54
      scbc.tools/test/test.cpp

+ 57 - 54
scbc.tools/test/test.cpp

@@ -37,71 +37,74 @@ int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
 			return -1;
 		}
 
-		// 1、查询订单是否已下载成功;
-		int nRet = QueryMidInfo(bid.c_str());
-		printf("QueryMidInfo:%d\n", nRet);
-		if ( nRet != 2 )
-		{
-			printf("订单未下载成功,开始下载\n");
-			// 未下载成功,开始后台下载;
-			nRet = DownloadMidData(bid.c_str());
-			printf("DownloadMidData:%d\n", nRet);
-			if ( nRet == 0 )
+		while(true){
+
+			// 1、查询订单是否已下载成功;
+			int nRet = QueryMidInfo(bid.c_str());
+			printf("QueryMidInfo:%d\n", nRet);
+			if ( nRet != 2 )
 			{
-				printf("该批次未导入系统,无法下载,程序退出\n");
-				system("pause");
-				exit(0);
+				printf("订单未下载成功,开始下载\n");
+				// 未下载成功,开始后台下载;
+				nRet = DownloadMidData(bid.c_str());
+				printf("DownloadMidData:%d\n", nRet);
+				if ( nRet == 0 )
+				{
+					printf("该批次未导入系统,无法下载,程序退出\n");
+					system("pause");
+					exit(0);
+				}
 			}
-		}
-		else
-			printf("订单已下载\n");
+			else
+				printf("订单已下载\n");
 
-		// 2、等待下载成功;
-		while ( nRet != 2 )
-		{
-			nRet = QueryMidInfo(bid.c_str());
-			printf("QueryMidInfo:%d\n", nRet);
-			if ( nRet == 2 )
+			// 2、等待下载成功;
+			while ( nRet != 2 )
 			{
-				printf("查询订单已下载成功\n");
+				nRet = QueryMidInfo(bid.c_str());
+				printf("QueryMidInfo:%d\n", nRet);
+				if ( nRet == 2 )
+				{
+					printf("查询订单已下载成功\n");
+				}
+				Sleep(1000);
 			}
-			Sleep(1000);
-		}
 
-		std::string sn = "TEST-TONY-5588";
-		// 3、获取指定sn的keys,用于抄写key;
-		SNKeys keys;
-		nRet = QueryKeyInfo(sn.c_str(), keys);
-		printf("QueryKeyInfo:%d\n", nRet);
+			std::string sn = "TEST-TONY-5588";
+			// 3、获取指定sn的keys,用于抄写key;
+			SNKeys keys;
+			nRet = QueryKeyInfo(sn.c_str(), keys);
+			printf("QueryKeyInfo:%d\n", nRet);
 
-		// 4、抄写成功后,保存抄写结果;
-		if ( true )
-		{
-			nRet = UpdateKeyCopyStatus(sn.c_str());
-			printf("UpdateKeyCopyStatus:%d\n", nRet);
-		}
+			// 4、抄写成功后,保存抄写结果;
+			if ( true )
+			{
+				nRet = UpdateKeyCopyStatus(sn.c_str());
+				printf("UpdateKeyCopyStatus:%d\n", nRet);
+			}
 
-		// 5、单个sn抄写结果上报;
-		nRet = ReportKeyCopyResults(sn.c_str());
-		printf("ReportKeyCopyResults:%d, %s\n", nRet, nRet == 1 ? "上报成功" : "上报失败");
-		if ( nRet == -8 )
-		{
-			nRet = UpdateKeyReportStatus(sn.c_str());
-			printf("UpdateKeyReportStatus:%d\n", nRet);
-		}
+			// 5、单个sn抄写结果上报;
+			nRet = ReportKeyCopyResults(sn.c_str());
+			printf("ReportKeyCopyResults:%d, %s\n", nRet, nRet == 1 ? "上报成功" : "上报失败");
+			if ( nRet == -8 )
+			{
+				nRet = UpdateKeyReportStatus(sn.c_str());
+				printf("UpdateKeyReportStatus:%d\n", nRet);
+			}
 
-		// 6、1000个sn抄写结果上报;
-		nRet = BatchReportKeyCopyResults();
-		printf("BatchReportKeyCopyResults:%d, %s\n", nRet, nRet == 1 ? "上报成功" : "上报失败");
+			// 6、1000个sn抄写结果上报;
+			nRet = BatchReportKeyCopyResults();
+			printf("BatchReportKeyCopyResults:%d, %s\n", nRet, nRet == 1 ? "上报成功" : "上报失败");
 
-		// 7、查询应下载sn数量、实际下载sn数据、抄写成功sn数量、上报成功sn数量;
-		BidInfo binfo;
-		nRet = QueryBidInfo(bid.c_str(), binfo);
-		printf("QueryBidInfo:%d\n", nRet, nRet == 1 ? "查询成功": "查询失败");
+			// 7、查询应下载sn数量、实际下载sn数据、抄写成功sn数量、上报成功sn数量;
+			BidInfo binfo;
+			nRet = QueryBidInfo(bid.c_str(), binfo);
+			printf("QueryBidInfo:%d\n", nRet, nRet == 1 ? "查询成功": "查询失败");
 
-		// 8、删除批次相关表数据(全部表数量)
-		//nRet = RemoveBidData(bid.c_str());
-		//printf("RemoveBidData:%d\n", nRet);
+			// 8、删除批次相关表数据(全部表数量)
+			nRet = RemoveBidData(bid.c_str());
+			printf("RemoveBidData:%d\n", nRet);
+		}
 	}
 
 	system("pause");