test.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // test.cpp : 定义控制台应用程序的入口点。
  2. //
  3. #include "stdafx.h"
  4. #include "test.h"
  5. #ifdef _DEBUG
  6. #define new DEBUG_NEW
  7. #endif
  8. // 唯一的应用程序对象
  9. CWinApp theApp;
  10. using namespace std;
  11. int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
  12. {
  13. int nRetCode = 0;
  14. // 初始化 MFC 并在失败时显示错误
  15. if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
  16. {
  17. // TODO: 更改错误代码以符合您的需要
  18. _tprintf(_T("错误: MFC 初始化失败\n"));
  19. nRetCode = 1;
  20. }
  21. else
  22. {
  23. // 1、查询订单是否已下载成功;
  24. int nRet = QueryMidInfo("IDL144240G");
  25. printf("QueryMidInfo:%d\n", nRet);
  26. if ( nRet != 2 )
  27. {
  28. // 未下载成功,开始后台下载;
  29. nRet = DownloadMidData("IDL144240G");
  30. printf("DownloadMidData:%d\n", nRet);
  31. }
  32. // 2、等待下载成功;
  33. while ( nRet != 2 )
  34. {
  35. nRet = QueryMidInfo("IDL144240G");
  36. printf("QueryMidInfo:%d\n", nRet);
  37. Sleep(1000);
  38. }
  39. // 单个sn抄写结果上报;
  40. nRet = ReportKeyCopyResults("TEST-3311-8811");
  41. printf("ReportKeyCopyResults:%d\n", nRet);
  42. // 1000个sn抄写结果上报;
  43. nRet = BatchReportKeyCopyResults();
  44. printf("BatchReportKeyCopyResults:%d\n", nRet);
  45. }
  46. system("pause");
  47. return nRetCode;
  48. }