You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWATI/Include/mGui/mGuiSysManager/iWxProjectMigrate.h

168 lines
4.1 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#include <QDomDocument>
#include <QTreeWidgetItem>
#include <QSqlQuery>
#include "mGuiSysManager_global.h"
#include "iDlgBase.h"
namespace Ui {
class iWxProjectMigrate;
}
class ZxTableView;
// 项目迁移配置信息
class PmTableInfo
{
public:
PmTableInfo()
{
sName = "";
sNameCH = "";
bBasic = false;
}
QString sName;//表名
QString sNameCH;//中文表名称
bool bBasic; //是否基础表
};
class M_GUI_SYSMANAGER_EXPORT iWxProjectMigrate : public iDlgBase
{
Q_OBJECT
public:
explicit iWxProjectMigrate(QWidget *parent = 0);
~iWxProjectMigrate();
// 初始化UI
void initUI();
// 项目的上一级路径,不含项目。
void setProjDir(QString sPath, bool bForSrc = true);
// 当前的目的
void setCurProjDest(QString sProj);
private slots:
// 一系列信号
void on_cbxTypeSrc_currentIndexChanged(int index);
void on_cbxTypeDest_currentIndexChanged(int index);
void on_btnFileSrc_clicked();
void on_btnFileDest_clicked();
void slotProjNameCbxItemChanged(int nIndex);
void on_cbxMigrateConfig_clicked();
void on_radioByWell_clicked();
void on_radioByTable_clicked();
void on_radioByOther_clicked();
void on_treeWidget_doubleClicked(const QModelIndex &index);
void on_treeWidget_itemChanged(QTreeWidgetItem *item, int column);
void on_btnSwap_clicked();
void on_btnFresh_clicked();
void on_btnMigrate_clicked();
private:
protected:
// 默认加载
bool loadDbStruct(QVector<PmTableInfo>& vecTableInfos);
// 刷新
void resetOptionViews(bool bRightOnly = false);
// 左右是否相同
bool isSameDb();
// 表格
void initUI_TableViews();
void clearTableViews();
void _clearTableView(ZxTableView* p);
// 刷新响应
void freshTableInfos(QString sSql, \
ZxTableView* pTableView);
void freshConfigSetting();
void freshDbTypeSetting(bool bSrc);
// 数据库关联
bool buildDbConns(bool bForceReopen = true);
bool _buildConn(QSqlDatabase& o, \
bool bSrc, \
bool bForceReopen);
bool closeDbConns();
// 清空
// 树Option
void resetTreeOptions();
// 创建节点
QTreeWidgetItem* createTreeItem(QTreeWidgetItem* pItemParent, \
QString sTag, \
QVariant oData = QVariant());
// 树三态选择控制函数,内部
void updateParents(QTreeWidgetItem *item);
void updateChildren(QTreeWidgetItem *item);
// 删除空值节点
void removeNullItems();
void removeNullItem(QTreeWidgetItem* pParent, \
QString sTableName);
// 所有井名
bool getWellNames(QStringList &list);
// 下拉
void fillProjCbxOfFileType(QString sPath, bool bForSrc = true);
// 获取当前Item对应的Sql
QString getSqlOfItem(QTreeWidgetItem* pItem);
// 层级从Top 0,1依次
int getLevelOfItem(QTreeWidgetItem* pItem);
// 迁移
void runMigrate();
QMap<QString, QStringList> getSelOptions(); //选择统计
QStringList getSelWells(QTreeWidgetItem* pItem);
bool _migrateConfig();
bool _migrateData(QString& sTable,
QStringList& listWells,
QString& s);
bool parseTableInfo(QString sTableName, \
QStringList& listFields, \
VecInt& vecIsBlob);
VVecVariant readDataOf(QString sSql, VecInt& vecIsBlobs);
bool writeDataOf(VVecVariant& vvec, QString sTableName);
private:
Ui::iWxProjectMigrate *ui;
// 树三态选择的控制变量
bool m_bChangeFromUser;
bool m_bChangeToParent;
// 迁移配置树形结构从xml解析得到
QVector<PmTableInfo> m_vecTableInfos;
// 临时,当前井列表
QStringList m_listWells;
ZxTableView* m_pTableViewSrc;
ZxTableView* m_pTableViewDest;
QSqlDatabase m_dbSrc;
QSqlDatabase m_dbDest;
QStringList m_listOtherTableNames;
QMap<QString, QString> m_mapSqls; //个别的Sql
};