IdentifyService.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #pragma once
  2. #include "scan_common.h"
  3. #include "DataBaseHolder.h"
  4. #include <boost/smart_ptr.hpp>
  5. #include "../Identifier/schema_struct.h"
  6. #include "basic_struct_result.h"
  7. #include "basic_struct.h"
  8. #include "../Schema/schema_struct.h"
  9. #include "DataBaseManagerHolder.h"
  10. class CIdentifyTaskManager;
  11. class CImgUploader;
  12. class CSeparateThreadTwainFeeder;
  13. class CRescanFromServerFeeder;
  14. class CAutoCreateSchemaFeeder;
  15. class CFolderFeeder;
  16. class CManualMatchFeeder;
  17. class CIdentifor;
  18. class CResultHandler;
  19. class CResultUploader;
  20. class CStudentMatcher;
  21. class IFeeder;
  22. class CBatchService;
  23. class CIdentifyService :public IService, public CDataBaseHolder, public CDataBaseManagerHolder
  24. {
  25. public:
  26. CIdentifyService(CBatchService *batchService);
  27. virtual ~CIdentifyService();
  28. int SetHandlerWnd(HWND hwnd);
  29. void ReadScan(FEEDER_TYPE feederType, const ScanParam & param);
  30. void SetFolderPageNumber(int nCount);//设置文件图片搜索类筛选模板参数
  31. int ReIdentify(const int paper_id, const std::vector<img_param>& params);
  32. int SetDirs(const CString& bantch_dir, const CString&norimg_dir, const CString&excimg_dir, CString img_clips_dir, const CString&img_alynasis_dir, const CString&img_alynasis_result_dir, const CString&img_down_load_dir, const std::string& muban_img_dir);
  33. int continueScan(const std::string& img_dir);
  34. void setSchema(boost::shared_ptr<const identify::schema::ISCH_Schema> schema, boost::shared_ptr<const HANDLE_INFO> handleInfo);
  35. void SetQr(int student_paper_id, bool bUseQr, const std::string&strQR);
  36. virtual BOOL SupportPause(void);
  37. /*初始化服务*/
  38. virtual void InitService();
  39. void setMainService(bool isMainService);
  40. const boost::shared_ptr<const HANDLE_INFO>& GetHandleInfo();
  41. void SerErrorHandle(bool bErrorHandle);
  42. void SetBianShiBieBianShangChuan(bool bSC){ m_bBianSBBianUpload = bSC; }
  43. boost::shared_ptr<CResultHandler> GetResultHander(){ return m_result_handler; };
  44. protected:
  45. virtual ServiceState OnStarting(void);
  46. virtual ServiceState OnRunning(void);
  47. virtual ServiceState OnPausing(void);
  48. virtual ServiceState OnResuming(void);
  49. virtual ServiceState OnStoping(void);
  50. protected:
  51. boost::shared_ptr<CIdentifyTaskManager> taskManager;
  52. //TWAIN扫描仪图像送入器
  53. boost::shared_ptr<CSeparateThreadTwainFeeder> m_twain_feeder;
  54. boost::shared_ptr<CRescanFromServerFeeder> m_server_feeder;
  55. boost::shared_ptr<CAutoCreateSchemaFeeder> m_auto_schema_feeder;
  56. //文件夹图像送入器
  57. boost::shared_ptr<CFolderFeeder> m_folder_feeder;
  58. //重新识别图像送入器
  59. boost::shared_ptr<CManualMatchFeeder> m_manualmatch_feeder;
  60. //当前图像送入器
  61. boost::shared_ptr<IFeeder > m_current_feeder;
  62. //试卷识别服务
  63. boost::shared_ptr<CIdentifor> m_identifor;
  64. //识别结果处理服务
  65. boost::shared_ptr<CResultHandler> m_result_handler;
  66. boost::shared_ptr<CStudentMatcher> m_student_matcher;
  67. CBatchService* batch_service;
  68. FEEDER_TYPE m_feeder_type;//当前图像送入器类型
  69. boost::shared_ptr<const identify::schema::ISCH_Schema> m_schema;
  70. boost::shared_ptr<const HANDLE_INFO> m_handleInfo;
  71. HWND m_hwnd;
  72. //批次号
  73. CString m_bantch_code;
  74. //本次扫描原始图像存放目录
  75. CString m_norimg_dir;
  76. CString m_excimg_dir;
  77. CString m_img_clips_dir;
  78. CString m_img_alynasis_dir;
  79. CString m_img_alynasis_result_dir;
  80. CString m_img_down_load_dir;
  81. std::string m_muban_img_dir;
  82. //当前批次的数据库的ID
  83. int m_database_id;
  84. CString m_bantch_dir;
  85. //标记是否非正常关闭
  86. BOOL m_abnormal_stop;
  87. CString m_paper_code;
  88. long m_examCourseId;
  89. long m_examId;
  90. std::string m_examName;
  91. std::string m_courseName;
  92. bool isMainService;
  93. bool isReIdentify;
  94. bool m_bErrorHandle;
  95. bool m_bBianSBBianUpload;
  96. public:
  97. int m_nOnlineScanType;
  98. };