123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- // test.cpp : 定义控制台应用程序的入口点。
- //
- #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;
- // 初始化 MFC 并在失败时显示错误
- if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
- {
- // TODO: 更改错误代码以符合您的需要
- _tprintf(_T("错误: MFC 初始化失败\n"));
- nRetCode = 1;
- }
- else
- {
- // 1、查询订单是否已下载成功;
- int nRet = QueryMidInfo("IDL144240G");
- printf("QueryMidInfo:%d\n", nRet);
- if ( nRet != 2 )
- {
- // 未下载成功,开始后台下载;
- nRet = DownloadMidData("IDL144240G");
- printf("DownloadMidData:%d\n", nRet);
- if ( nRet == 0 )
- {
- printf("该批次未导入系统,无法下载,程序退出\n");
- system("pause");
- exit(0);
- }
- }
- // 2、等待下载成功;
- while ( nRet != 2 )
- {
- nRet = QueryMidInfo("IDL144240G");
- printf("QueryMidInfo:%d\n", nRet);
- Sleep(1000);
- }
- // 3、获取指定sn的keys,用于抄写key;
- SNKeys keys;
- nRet = QueryKeyInfo("TEST-3311-8811", keys);
- printf("QueryKeyInfo:%d\n", nRet);
- // 4、抄写成功后,保存抄写结果;
- nRet = UpdateKeyCopyStatus("TEST-3311-8811");
- printf("UpdateKeyCopyStatus:%d\n", nRet);
- // 5、单个sn抄写结果上报;
- nRet = ReportKeyCopyResults("TEST-3311-8811");
- printf("ReportKeyCopyResults:%d, %s\n", nRet, nRet == 1 ? "上报成功" : "上报失败");
- if ( nRet == -8 )
- {
- nRet = UpdateKeyReportStatus("TEST-3311-8811");
- printf("UpdateKeyReportStatus:%d\n", nRet);
- }
- // 6、1000个sn抄写结果上报;
- nRet = BatchReportKeyCopyResults();
- printf("BatchReportKeyCopyResults:%d, %s\n", nRet, nRet == 1 ? "上报成功" : "上报失败");
- // 7、查询应下载sn数量、实际下载sn数据、抄写成功sn数量、上报成功sn数量;
- BidInfo binfo;
- nRet = QueryBidInfo("IDL144240G", binfo);
- printf("QueryBidInfo:%d\n", nRet, nRet == 1 ? "查询成功": "查询失败");
- // 8、删除批次相关表数据(全部表数量)
- nRet = RemoveBidData("IDL144240G");
- printf("RemoveBidData:%d\n", nRet);
- }
- system("pause");
- return nRetCode;
- }
|