| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #ifndef PROJECTINFOMANGER_H
- #define PROJECTINFOMANGER_H
- #include <QObject>
- #include "httprequest.h"
- #include <QQueue>
- #include "struct_/projectinfo.h"
- #include "packinfomanger.h"
- #include <QJsonArray>
- // 处理批号的管理和同步
- class ProjectInfoManger : public QObject
- {
- Q_OBJECT
- public:
- explicit ProjectInfoManger(PackInfoManger *manger, QObject *parent = nullptr);
- enum ReqStatus
- {
- IDIL = 0,
- Load_Server_List = 1,
- Sync_Local_List = 2
- };
- inline QList<QSharedPointer<ProjectInfo>> serverInfo() {return _serverInfo;}
- inline QList<QSharedPointer<ProjectInfo>> cacheInfo() {return _cacheInfo;}
- signals:
- void inited(ProjectInfoManger * manger, bool inited);
- void synced(ProjectInfoManger * manger, bool inited);
- void sync();
- public slots:
- bool loadServerList(bool local);
- bool syncLocalList();
- void setStatus();
- void addNewProject(QSharedPointer<ProjectInfo> pro);
- private slots:
- void doSendLoad();
- void doSendCreate();
- void handleList();
- void result(int code, const QJsonObject & body);
- void handlSync(int code, const QJsonObject & body);
- void handleGetList(int code, const QJsonObject & body);
- void hanldeServerList(QJsonArray & ary,bool inServer = true);
- private:
- ReqStatus _status;
- QQueue<QSharedPointer<ProjectInfo>> _pushQueue;
- PackInfoManger * _manger;
- HttpRequest _requst;
- //saveed;
- QList<QSharedPointer<ProjectInfo>> _serverInfo;
- QList<QSharedPointer<ProjectInfo>> _cacheInfo;
- uint _oneSyncError;
- uint _netErrorCount;
- int _nowJob;
- };
- #endif // PROJECTINFOMANGER_H
|