123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- #include "stdafx.h"
- #include "test.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #endif
- CWinApp theApp;
- using namespace std;
- int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
- {
- int nRetCode = 0;
-
- if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
- {
-
- _tprintf(_T("错误: MFC 初始化失败\n"));
- nRetCode = 1;
- }
- else
- {
- std::string bid = "DXM1900259";
-
- if ( !ScbcInit(bid.c_str()) )
- {
- printf("初始化失败\n");
- return -1;
- }
-
- int i = 1000;
- while(i--){
- printf("\n\n******************No.%ld******************\n", i);
-
- 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 )
- {
- printf("该批次未导入系统,无法下载,程序退出\n");
- continue;
- }
- }
- else
- printf("订单已下载\n");
-
- while ( nRet != 2 )
- {
- nRet = QueryMidInfo(bid.c_str());
- printf("QueryMidInfo:%d\n", nRet);
- if ( nRet == 2 )
- {
- printf("查询订单已下载成功\n");
- }
- Sleep(1000);
- }
- std::string sn = "TEST-TONY-5588";
-
- SNKeys keys;
- nRet = QueryKeyInfo(sn.c_str(), keys);
- printf("QueryKeyInfo:%d\n", nRet);
-
- if ( true )
- {
- nRet = UpdateKeyCopyStatus(sn.c_str());
- printf("UpdateKeyCopyStatus:%d\n", nRet);
- }
-
-
- 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);
- }
-
- while((nRet = BatchReportKeyCopyResults()) == 1)
- printf("BatchReportKeyCopyResults:%d, %s\n", nRet, nRet == 1 ? "上报成功" : "上报失败");
-
- BidInfo binfo;
- nRet = QueryBidInfo(bid.c_str(), binfo);
- printf("QueryBidInfo:%d\n", nRet, nRet == 1 ? "查询成功": "查询失败");
- printf("15秒后,开始删除订单信息\n");
- Sleep(15000);
-
- nRet = RemoveBidData(bid.c_str());
- printf("RemoveBidData:%d\n", nRet);
- printf("删除订单信息成功\n");
- }
- }
- system("pause");
- return nRetCode;
- }
|