123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- #pragma once
- #include "scan_common.h"
- #include "DataBaseManagerHolder.h"
- #include "basic_struct.h"
- #include "ImageUploadWorker.h"
- using namespace std;
- class CImgUploader : public IService, public CDataBaseManagerHolder
- {
- enum IMG_UPLOAD_STATE{
- //正在打开下一个批次的数据库
- IMG_UPLOAD_STATE_OPENNING,
- //正在准备
- IMG_UPLOAD_STATE_READYING,
- //正在上传
- IMG_UPLOAD_STATE_UPLOADING,
- //正在关闭当前打开的数据库
- IMG_UPLOAD_STATE_CLOSING,
- //当前数据库已经关闭
- IMG_UPLOAD_STATE_CLOSED,
- };
- struct paper_info{
- string file_name;
- int paper_id;
- string paper_code;
- string student_code;
- int student_id;
- string student_name;
- };
- enum{
- UPLOAD_WORKER_COUNT = 6,
- UPLOAD_TASK_BUFFER_COUNT = (UPLOAD_WORKER_COUNT + 1)
- };
- public:
- CImgUploader(void);
- ~CImgUploader(void);
- int QueryUploadePaperImg(vector<IMG_UPLOAD_TASK>& tasks);
- int SetHandlerWnd(HWND hwnd);
- int ClearUploadedPaperImg();
- int GetCurrentUploadTaskInfo(IMG_UPLOAD_TASK& task);
- protected:
- virtual ServiceState OnStarting(void);
- virtual ServiceState OnRunning(void);
- void handleCompleteTask();
- private:
- CString m_url;
- CString m_urlDeletePaperBatch;
- IMG_UPLOAD_STATE m_current_database_state;
- //表示上传线程是否在上传
- BOOL m_uploading;
- CppSQLite3DB bantch_db;
- int m_last_paper_id;
- BOOL m_current_has_more;
- HWND m_hwnd;
- IMG_UPLOAD_TASK m_task_info;
- CString m_school_id;
- CString m_bantch_dir;
- CImageUploadWorker worker[UPLOAD_WORKER_COUNT];
- CUploadTask taskBuffer[UPLOAD_TASK_BUFFER_COUNT];
- // Logger pTestLogger;
- };
|