SmartEvaluationService.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #pragma once
  2. #include "scan_common.h"
  3. #include "FolderFeeder.h"
  4. #include "Identifor.h"
  5. #include "ResultUploader.h"
  6. #include "basic_struct.h"
  7. #include "SeparateThreadTwainFeeder.h"
  8. #include "ImgUploader.h"
  9. #include "basic_struct_result.h"
  10. #include "StudentMatcher.h"
  11. #include "CManualMatchFeeder.h"
  12. #include "RescanFromServerFeeder.h"
  13. #include "..\Schema\schema_struct.h"
  14. #include "DataBaseManagerHolder.h"
  15. class CSmartEvaluationService :public IService,public CDataBaseManagerHolder
  16. {
  17. public:
  18. CSmartEvaluationService(void);
  19. ~CSmartEvaluationService(void);
  20. public:
  21. /************************************************************************/
  22. /* 注册窗口,识别模块遇到问题将向该窗口发送消息 */
  23. /************************************************************************/
  24. int SetHandlerWnd(HWND hwnd);
  25. /************************************************************************/
  26. /* 添加重新扫描的图像 */
  27. /************************************************************************/
  28. int AddRescanPic(const char * pic_path);
  29. /************************************************************************/
  30. /* 清除重新扫描的图像 */
  31. /************************************************************************/
  32. int ClearRescanPic();
  33. /************************************************************************/
  34. /* 准备扫描 */
  35. /************************************************************************/
  36. int ReadyScan(FEEDER_TYPE feederType, const ScanParam & param);
  37. int QueryExceptionPaper(const long exception_type, vector<STUDENT_INFO>& studentList);
  38. int QueryPaperDetail(const int paper_id, PAPER_DETAIL &paper_detail, vector<PAGE_DETAIL> &pageList, vector<GROUP_QUESTION> &questionList);
  39. int UpdatePaperStudent(const int paper_id, const std::string examinee_id, const std::string student_code, const std::string studentName, const long schoolId);
  40. int ReIdentify(const int paper_id, const std::vector<img_param>& params);
  41. //忽略试卷
  42. int IgnorePaper(const int paper_id);
  43. //忽略异常
  44. int IgnoreException(const long exceptions);
  45. //开始上传
  46. int StartUploadPaper(HWND hWnd);
  47. //放弃本次扫描结果
  48. int GiveUpCurrentBatch();
  49. virtual BOOL SupportPause(void);
  50. /*从文件夹扫描继续扫描时设置扫描路径*/
  51. int SetFolderScanDir(const std::string& img_dir);
  52. virtual BOOL Stop(void);
  53. //查询异常卷总数
  54. int QueryExptionPaperCount(int & total_count);
  55. //查询异常类型信息
  56. int QueryExptionTypeInfo(vector<EXCEPTION_TYPE_INFO> & infos);
  57. int LoadSchema(long long examId, std::string examName, long examCourseId, std::string courseName, std::string schemaPath);
  58. int SetCookie(CString path, CString name, CString value);
  59. void saveQuestionStd(long long examId, std::string examName, long examCourseId, std::string courseName, std::vector<schema::SCHEMA_QUESTION> &questions);
  60. int QueryNormalPaper(vector<STUDENT_INFO> & studentList);
  61. int QueryMubanImgPath(int page_index, std::string& imgPath);
  62. int QueryMubanImgCount(int& page_count);
  63. int SetLocalServerCookie(CString name, CString value);
  64. protected:
  65. virtual ServiceState OnStarting( void );
  66. virtual ServiceState OnRunning( void );
  67. virtual ServiceState OnStoping(void);
  68. virtual ServiceState OnPausing(void);
  69. virtual ServiceState OnResuming(void);
  70. private:
  71. CIdentifyTaskManager taskManager;
  72. CImgUploader m_img_uploader;
  73. CSeparateThreadTwainFeeder m_twain_feeder;//TWAIN扫描仪图像送入器
  74. CRescanFromServerFeeder m_server_feeder;
  75. CFolderFeeder m_folder_feeder;//文件夹图像送入器
  76. CManualMatchFeeder m_manualmatch_feeder;//重新识别图像送入器
  77. CIdentifor m_identifor;//试卷识别服务
  78. CResultHandler m_result_handler;//识别结果处理服务
  79. CResultUploader m_result_uploader;//成绩上传服务
  80. IFeeder * m_current_feeder;//当前图像送入器
  81. FEEDER_TYPE m_feeder_type;//当前图像送入器类型
  82. RTL_CRITICAL_SECTION bantch_db_lock;
  83. CppSQLite3DB bantch_db;
  84. HWND m_hwnd;
  85. //批次号
  86. CString m_bantch_code;
  87. //本次扫描原始图像存放目录
  88. CString m_norimg_dir;
  89. CString m_excimg_dir;
  90. CString m_img_clips_dir;
  91. CString m_img_alynasis_dir;
  92. CString m_img_alynasis_result_dir;
  93. //当前批次的数据库的ID
  94. int m_database_id;
  95. CString m_bantch_dir;
  96. //标记是否非正常关闭
  97. BOOL m_abnormal_stop;
  98. CString m_paper_code;
  99. std::string m_muban_img_dir;
  100. boost::shared_ptr<const ISCH_Schema> m_schema;
  101. boost::shared_ptr<const HANDLE_INFO> m_handleInfo;
  102. schema::SCHEMA m_schema0;
  103. CStudentMatcher m_student_matcher;
  104. long m_examCourseId;
  105. long m_examId;
  106. CString m_img_down_load_dir;
  107. std::string m_examName;
  108. std::string m_courseName;
  109. };