|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QSqlDatabase>
|
|
|
|
|
#include <QSqlQuery>
|
|
|
|
|
#include <QSqlRecord>
|
|
|
|
|
#include <QSqlError>
|
|
|
|
|
|
|
|
|
|
#include "ZxDataObjectStrUser.h"
|
|
|
|
|
#include "mProjectManager_global.h"
|
|
|
|
|
|
|
|
|
|
// 图片,临时
|
|
|
|
|
// 20171026 示意图应用
|
|
|
|
|
|
|
|
|
|
class M_PROJECTMANAGER_EXPORT ZxDataSketch : public ZxDataObjectStrUser
|
|
|
|
|
{
|
|
|
|
|
ZX_DECLARE_DYNAMIC
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
ZxDataSketch(ZxDataObject* parent = 0);
|
|
|
|
|
ZxDataSketch(const ZxDataSketch &other);
|
|
|
|
|
virtual ~ZxDataSketch();
|
|
|
|
|
|
|
|
|
|
ZxDataSketch &operator = (const ZxDataSketch &other);
|
|
|
|
|
bool operator == (const ZxDataSketch &other) const;
|
|
|
|
|
bool operator != (const ZxDataSketch &other) const;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// 接口
|
|
|
|
|
virtual ZxDataObject* clone();
|
|
|
|
|
virtual QString type() const;
|
|
|
|
|
|
|
|
|
|
// 加载保存
|
|
|
|
|
virtual bool _parseData(VecVariant vec, int& n); //解析
|
|
|
|
|
virtual bool _sumUpData(VecVariant& vec);
|
|
|
|
|
|
|
|
|
|
// 序列化
|
|
|
|
|
virtual void onSerialize(ZxSerializer* ser);
|
|
|
|
|
virtual void onDeserialize(ZxSerializer* ser);
|
|
|
|
|
|
|
|
|
|
// Icon
|
|
|
|
|
virtual QIcon getIcon(bool expanded) const;
|
|
|
|
|
|
|
|
|
|
// 自动组织加载和保存
|
|
|
|
|
// 先从当前工区,如果没有,则从系统db
|
|
|
|
|
bool loadSketch(QByteArray& o);
|
|
|
|
|
// 保存指定的db, nMode = 0:当前工区,1:系统配置
|
|
|
|
|
bool saveSketch(int nMode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
// 由于示意图涉及到系统db和工区db,所以特殊处理
|
|
|
|
|
// 根据当前的选项获取示意图
|
|
|
|
|
QByteArray _loadSketch(QSqlDatabase& db);
|
|
|
|
|
// 保存
|
|
|
|
|
bool _saveSketch(QSqlDatabase& db);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// MstID
|
|
|
|
|
// virtual void setCode(const QString &sCode);
|
|
|
|
|
//ModelSeries
|
|
|
|
|
// virtual void setName(const QString &sName);
|
|
|
|
|
|
|
|
|
|
void setWBS(const QString& s);
|
|
|
|
|
QString getWBS() const;
|
|
|
|
|
void setWEL(const QString& s);
|
|
|
|
|
QString getWEL() const;
|
|
|
|
|
void setRES(const QString& s);
|
|
|
|
|
QString getRES() const;
|
|
|
|
|
void setBDY(const QString& s);
|
|
|
|
|
QString getBDY() const;
|
|
|
|
|
void setOthers(const QString& s);
|
|
|
|
|
QString getOthers() const;
|
|
|
|
|
|
|
|
|
|
void setSketch(const QByteArray& s);
|
|
|
|
|
QByteArray getSketch() const;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
//MstID
|
|
|
|
|
//ModelSeries
|
|
|
|
|
|
|
|
|
|
QString m_sWBS;
|
|
|
|
|
QString m_sWEL;
|
|
|
|
|
QString m_sRES;
|
|
|
|
|
QString m_sBDY;
|
|
|
|
|
|
|
|
|
|
QString m_sOthers;
|
|
|
|
|
QByteArray m_arrSketch;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 本类的目的通过单例实现对系统下面的示意图配置管理
|
|
|
|
|
// 主要为了速度
|
|
|
|
|
class M_PROJECTMANAGER_EXPORT ZxDataPictureHelper
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// 获取对象,单例模式
|
|
|
|
|
static ZxDataPictureHelper* getInstance();
|
|
|
|
|
// 关闭
|
|
|
|
|
static void closeSysDb();
|
|
|
|
|
|
|
|
|
|
// 获得数据库连接
|
|
|
|
|
QSqlDatabase getSysDb();
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
void reLoadSketches();
|
|
|
|
|
//
|
|
|
|
|
bool checkSketch(QString sSeries,
|
|
|
|
|
QString sWbs,
|
|
|
|
|
QString sWel,
|
|
|
|
|
QString sRes,
|
|
|
|
|
QString sBdy,
|
|
|
|
|
QByteArray& o);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
ZxDataPictureHelper();
|
|
|
|
|
~ZxDataPictureHelper();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
static ZxDataPictureHelper* spZxDbSys;
|
|
|
|
|
QSqlDatabase m_db;
|
|
|
|
|
|
|
|
|
|
VVecVariant m_vvecSketchs;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|