[ref]同步711 实时列表插件,有差异,711更新
This commit is contained in:
parent
7470b86880
commit
46de2e029d
@ -1,4 +1,4 @@
|
||||
#include "CDbInterface.h"
|
||||
#include "CDbInterface.h"
|
||||
#include "public/pub_logger_api/logger.h"
|
||||
|
||||
using namespace iot_dbms;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#ifndef CDBINTERFACE_H
|
||||
#ifndef CDBINTERFACE_H
|
||||
#define CDBINTERFACE_H
|
||||
|
||||
#include <QMap>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#ifndef CPOINTPUBLIC_H
|
||||
#ifndef CPOINTPUBLIC_H
|
||||
#define CPOINTPUBLIC_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
#include "CPointRealDataWidget.h"
|
||||
#include "CPointRealDataWidget.h"
|
||||
#include "CDbInterface.h"
|
||||
#include "CRealTableModel.h"
|
||||
#include "CRealDataCollect.h"
|
||||
#include <QGridLayout>
|
||||
#include <QTableView>
|
||||
#include <QHeaderView>
|
||||
#include "pub_utility_api/FileStyle.h"
|
||||
|
||||
CPointRealDataWidget::CPointRealDataWidget(bool editMode, QWidget *parent)
|
||||
: QWidget(parent),
|
||||
@ -72,6 +73,34 @@ void CPointRealDataWidget::initialize()
|
||||
m_pTimer->start(1000);
|
||||
}
|
||||
|
||||
void CPointRealDataWidget::initStyle()
|
||||
{
|
||||
QString qss = QString();
|
||||
std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
||||
QFile qssfile1(QString::fromStdString(strFullPath));
|
||||
qssfile1.open(QFile::ReadOnly);
|
||||
if (qssfile1.isOpen())
|
||||
{
|
||||
qss += QLatin1String(qssfile1.readAll());
|
||||
//setStyleSheet(qss);
|
||||
qssfile1.close();
|
||||
}
|
||||
|
||||
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("PointRealDataWidget.qss") ;
|
||||
QFile qssfile2(QString::fromStdString(strFullPath));
|
||||
qssfile2.open(QFile::ReadOnly);
|
||||
if (qssfile2.isOpen())
|
||||
{
|
||||
qss += QLatin1String(qssfile2.readAll());
|
||||
//setStyleSheet(qss);
|
||||
qssfile2.close();
|
||||
}
|
||||
if(!qss.isEmpty())
|
||||
{
|
||||
setStyleSheet(qss);
|
||||
}
|
||||
}
|
||||
|
||||
void CPointRealDataWidget::switchAppcontext(int appContext)
|
||||
{
|
||||
if(m_objAppContext == appContext)
|
||||
@ -272,6 +301,167 @@ QString CPointRealDataWidget::addPoint(int GroupNo, const QStringList &RealTagLi
|
||||
return "";
|
||||
}
|
||||
|
||||
QString CPointRealDataWidget::addRealPoint(int GroupNo, const QString &strRealTagList)
|
||||
{
|
||||
if(m_groupMap.find(GroupNo) == m_groupMap.constEnd())
|
||||
{
|
||||
return tr("未找到组号%1!").arg(QString::number(GroupNo));
|
||||
}
|
||||
|
||||
QStringList RealTagList = strRealTagList.split(";");
|
||||
if (RealTagList.count() == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
//< 得到所有可能的点标签
|
||||
QMap<QString, QStringList> tagMap;
|
||||
QString devGroup;
|
||||
foreach (QString RealTag, RealTagList) {
|
||||
if(RealTag.isEmpty() || RealTag.split(".").length() != 7)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (devGroup.isEmpty())
|
||||
{
|
||||
devGroup = truncTag(RealTag, "g");
|
||||
}
|
||||
tagMap[devGroup].append(RealTag);
|
||||
|
||||
QString tagName = RealTag;
|
||||
SRealData realData;
|
||||
QString temp;
|
||||
QString table = truncTag(tagName, "t");
|
||||
QString vlast = truncTag(tagName, "v");
|
||||
if (vlast == "channel")
|
||||
{
|
||||
temp = CDbInterface::instance()->readChannelTag(truncTag(tagName, "d"), table);
|
||||
}
|
||||
else
|
||||
{
|
||||
temp = CDbInterface::instance()->readPointInfo(truncTag(tagName, "p"), table);
|
||||
}
|
||||
if (temp.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (vlast == "channel")
|
||||
{
|
||||
realData.tag_name = temp;
|
||||
realData.description = m_channelTxList[0];
|
||||
realData.table_name = "fes_channel_para";
|
||||
realData.column = "status";
|
||||
realData.type = TYPE_CHANNEL;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_tagMap[GroupNo].append(QVariant::fromValue(tagName));
|
||||
realData.tag_name = truncTag(tagName, "p");
|
||||
realData.description = temp.section(",", 0, 0);
|
||||
realData.table_name = table;
|
||||
if (realData.table_name == "analog" || realData.table_name == "accuml")
|
||||
{
|
||||
realData.unit = temp.section(",", 1, 1);
|
||||
}
|
||||
else if (realData.table_name == "digital" || realData.table_name == "mix")
|
||||
{
|
||||
realData.stateTextName = temp.section(",", 1, 1);
|
||||
}
|
||||
}
|
||||
realData.nDomainId = CDbInterface::instance()->readDomainId(truncTag(tagName, "l"));
|
||||
realData.nAppId = CDbInterface::instance()->readAppId(truncTag(tagName, "a"));
|
||||
|
||||
m_groupMap[GroupNo].append(realData);
|
||||
if (realData.type == TYPE_POINT)
|
||||
{
|
||||
m_pDpcdaForApp->subscribe(realData.table_name.toStdString(), realData.tag_name.toStdString(), realData.column.toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
QTableView *view = m_tableMap.value(GroupNo);
|
||||
if(view)
|
||||
{
|
||||
CRealTableModel *model = dynamic_cast<CRealTableModel*>(view->model());
|
||||
model->updateRealData(m_groupMap[GroupNo]);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
QString CPointRealDataWidget::addCommPoint(int GroupNo, const QString &strRealTagList)
|
||||
{
|
||||
if(m_groupMap.find(GroupNo) == m_groupMap.constEnd())
|
||||
{
|
||||
return tr("未找到组号%1!").arg(QString::number(GroupNo));
|
||||
}
|
||||
|
||||
QStringList RealTagList = strRealTagList.split(";");
|
||||
if (RealTagList.count() == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
//< 得到所有可能的点标签
|
||||
QMap<QString, QStringList> tagMap;
|
||||
QString devGroup;
|
||||
foreach (QString RealTag, RealTagList) {
|
||||
if(RealTag.isEmpty() || RealTag.split(".").length() != 7)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (devGroup.isEmpty())
|
||||
{
|
||||
devGroup = truncTag(RealTag, "g");
|
||||
}
|
||||
tagMap[devGroup].append(RealTag);
|
||||
|
||||
QString tagName = RealTag;
|
||||
SRealData realData;
|
||||
QString temp;
|
||||
QString table = truncTag(tagName, "t");
|
||||
|
||||
temp = CDbInterface::instance()->readPointInfo(truncTag(tagName, "p"), table);
|
||||
|
||||
if (temp.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
m_tagMap[GroupNo].append(QVariant::fromValue(tagName));
|
||||
realData.tag_name = truncTag(tagName, "p");
|
||||
realData.description = temp.section(",", 0, 0);
|
||||
realData.table_name = table;
|
||||
if (realData.table_name == "digital")
|
||||
{
|
||||
realData.stateTextName = temp.section(",", 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
realData.nDomainId = CDbInterface::instance()->readDomainId(truncTag(tagName, "l"));
|
||||
realData.nAppId = CDbInterface::instance()->readAppId(truncTag(tagName, "a"));
|
||||
|
||||
m_groupMap[GroupNo].append(realData);
|
||||
if (realData.type == TYPE_POINT)
|
||||
{
|
||||
m_pDpcdaForApp->subscribe(realData.table_name.toStdString(), realData.tag_name.toStdString(), realData.column.toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
QTableView *view = m_tableMap.value(GroupNo);
|
||||
if(view)
|
||||
{
|
||||
CRealTableModel *model = dynamic_cast<CRealTableModel*>(view->model());
|
||||
model->setColumnCount(4);
|
||||
model->setShowCommunicationsDetail(true);
|
||||
model->updateRealData(m_groupMap[GroupNo]);
|
||||
}
|
||||
return "";
|
||||
|
||||
|
||||
}
|
||||
|
||||
QVariantList CPointRealDataWidget::getPointList(int GroupNo)
|
||||
{
|
||||
return m_tagMap.value(GroupNo);
|
||||
@ -341,6 +531,19 @@ void CPointRealDataWidget::setHeaderVisible(int GroupNo, int header, bool visibl
|
||||
}
|
||||
}
|
||||
|
||||
void CPointRealDataWidget::setHeaderDesc(int GroupNo, const QString& headerDescs)
|
||||
{
|
||||
QTableView *view = m_tableMap.value(GroupNo);
|
||||
if(!view)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CRealTableModel *model = dynamic_cast<CRealTableModel*>(view->model());
|
||||
QStringList headerDescList = headerDescs.split(",");
|
||||
model->setHeaderLabels(headerDescList);
|
||||
}
|
||||
|
||||
void CPointRealDataWidget::setShowGrid(int GroupNo, bool isShow)
|
||||
{
|
||||
QTableView *view = m_tableMap.value(GroupNo);
|
||||
@ -394,6 +597,20 @@ void CPointRealDataWidget::setChannelText(const QString &text, const QString &no
|
||||
}
|
||||
}
|
||||
|
||||
void CPointRealDataWidget::clear(int groupNo)
|
||||
{
|
||||
QTableView *view = m_tableMap.value(groupNo);
|
||||
if(view)
|
||||
{
|
||||
CRealTableModel *model = dynamic_cast<CRealTableModel*>(view->model());
|
||||
QList<SRealData> data;
|
||||
model->updateRealData(data);
|
||||
|
||||
m_tagMap[groupNo] = QVariantList();
|
||||
m_groupMap[groupNo] = data;
|
||||
}
|
||||
}
|
||||
|
||||
void CPointRealDataWidget::updatePointValue(const QSet<int> &groupSet)
|
||||
{
|
||||
foreach (const int &groupNo, groupSet)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#ifndef CPOINTREALDATAWIDGET_H
|
||||
#ifndef CPOINTREALDATAWIDGET_H
|
||||
#define CPOINTREALDATAWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
@ -20,7 +20,12 @@ public:
|
||||
|
||||
void initialize();
|
||||
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
void initStyle();
|
||||
|
||||
/**
|
||||
* @brief switchAppcontext 切换数据来源
|
||||
* @param appContext 1: 实时数据 2: 事故反演
|
||||
@ -37,7 +42,7 @@ public slots:
|
||||
int addGroup(const QStringList &name, int row, int column);
|
||||
|
||||
/**
|
||||
* @brief addPoint 往组内添加测点
|
||||
* @brief addPoint 往组内添加测点,根据这个关联的测点所属的组找到所有的相关测点列表进行显示
|
||||
* @param GroupNo 组号
|
||||
* @param RealTagList 关联测点列表 "station1.PSCADA.digital.station1.NQ-G01_NRINC.OC1.value"
|
||||
* @param PointList 测点列表 "digital.OC1.value"
|
||||
@ -45,6 +50,22 @@ public slots:
|
||||
*/
|
||||
QString addPoint(int GroupNo, const QStringList &RealTagList, const QStringList &PointList);
|
||||
|
||||
/**
|
||||
* @brief addRealPoint 往组内添加测点,插入的列表是什么就是什么
|
||||
* @param GroupNo 组号
|
||||
* @param RealTagList 关联测点列表 "station1.PSCADA.digital.station1.NQ-G01_NRINC.OC1.value;station1.PSCADA.digital.station1.NQ-G01_NRINC.OC1.value"
|
||||
* @return 成功返回空字符串,失败返回错误信息
|
||||
*/
|
||||
QString addRealPoint(int GroupNo, const QString& strRealTagList);
|
||||
|
||||
/**
|
||||
* @brief addRealPoint 往组内添加通讯测点,插入的列表是什么就是什么,额外显示通讯参数
|
||||
* @param GroupNo 组号
|
||||
* @param RealTagList 关联测点列表 "station1.PSCADA.digital.station1.NQ-G01_NRINC.OC1.value;station1.PSCADA.digital.station1.NQ-G01_NRINC.OC1.value"
|
||||
* @return 成功返回空字符串,失败返回错误信息
|
||||
*/
|
||||
QString addCommPoint(int GroupNo, const QString& strRealTagList);
|
||||
|
||||
/**
|
||||
* @brief getPointList 获取组内测点列表
|
||||
* @param GroupNo 组号
|
||||
@ -83,6 +104,14 @@ public slots:
|
||||
*/
|
||||
void setHeaderVisible(int GroupNo, int header = Qt::Horizontal, bool visible = true);
|
||||
|
||||
/**
|
||||
* @brief setHeaderVisible 设置表头描述
|
||||
* @param GroupNo 组号
|
||||
* @param header 1:水平 2:垂直
|
||||
* @param visible 是否显示
|
||||
*/
|
||||
void setHeaderDesc(int GroupNo, const QString& headerDescs);
|
||||
|
||||
/**
|
||||
* @brief setShowGrid 设置是否显示表格网格线
|
||||
* @param GroupNo 组号
|
||||
@ -113,6 +142,8 @@ public slots:
|
||||
*/
|
||||
void setChannelText(const QString& text, const QString &normal, const QString &abnormal);
|
||||
|
||||
void clear(int groupNo);
|
||||
|
||||
private slots:
|
||||
void updatePointValue(const QSet<int> &groupSet);
|
||||
void updatePointValue(int groupNo, QList<SRealData> data);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include "CPointRealPluginWidget.h"
|
||||
#include "CPointRealPluginWidget.h"
|
||||
#include "CPointRealDataWidget.h"
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#ifndef CPOINTREALPLUGINWIDGET_H
|
||||
#ifndef CPOINTREALPLUGINWIDGET_H
|
||||
#define CPOINTREALPLUGINWIDGET_H
|
||||
|
||||
#include <QObject>
|
||||
@ -7,7 +7,7 @@
|
||||
class CPointRealPluginWidget : public QObject, public CPluginWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID HMI_WidgetPlugin_IID)
|
||||
Q_INTERFACES(CPluginWidgetInterface)
|
||||
|
||||
public:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include "CRealDataCollect.h"
|
||||
#include "CRealDataCollect.h"
|
||||
#include <QTimer>
|
||||
|
||||
CRealDataCollect* CRealDataCollect::m_pInstance = NULL;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#ifndef CREALDATACOLLECT_H
|
||||
#ifndef CREALDATACOLLECT_H
|
||||
#define CREALDATACOLLECT_H
|
||||
|
||||
#include <QMap>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include "CRealTableModel.h"
|
||||
#include "CRealTableModel.h"
|
||||
#include "CDbInterface.h"
|
||||
|
||||
CRealTableModel::CRealTableModel(QObject *parent, const QStringList &header)
|
||||
@ -51,6 +51,11 @@ QVariant CRealTableModel::headerData(int section, Qt::Orientation orientation, i
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
void CRealTableModel::setHeaderLabels(const QStringList& headers)
|
||||
{
|
||||
m_header = headers;
|
||||
}
|
||||
|
||||
int CRealTableModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid())
|
||||
@ -145,4 +150,9 @@ QVariant CRealTableModel::data(const QModelIndex &index, int role) const
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
void CRealTableModel::setShowCommunicationsDetail(bool showCommunicationsDetail)
|
||||
{
|
||||
m_showCommunicationsDetail = showCommunicationsDetail;
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#ifndef CREALTABLEMODEL_H
|
||||
#ifndef CREALTABLEMODEL_H
|
||||
#define CREALTABLEMODEL_H
|
||||
|
||||
#include <QFont>
|
||||
@ -24,17 +24,22 @@ public:
|
||||
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
|
||||
void setHeaderLabels(const QStringList& headers);
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
void setShowCommunicationsDetail(bool showCommunicationsDetail);
|
||||
|
||||
private:
|
||||
QStringList m_header;
|
||||
int nColumnCount;
|
||||
QList<SRealData> m_listRealData;
|
||||
QStringList m_channelTxList;
|
||||
QFont m_valueFont;
|
||||
bool m_showCommunicationsDetail;
|
||||
};
|
||||
|
||||
#endif // CREALTABLEMODEL_H
|
||||
|
||||
@ -47,7 +47,8 @@ LIBS += \
|
||||
-lpub_logger_api \
|
||||
-lprotobuf \
|
||||
-lnet_msg_bus_api \
|
||||
-ldp_chg_data_api
|
||||
-ldp_chg_data_api \
|
||||
-lpub_utility_api
|
||||
|
||||
include($$PWD/../../../idl_files/idl_files.pri)
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include <QApplication>
|
||||
#include <QApplication>
|
||||
#include "CPointRealDataWidget.h"
|
||||
#include "net/net_msg_bus_api/MsgBusApi.h"
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user