[ref]暂时先回退下同步711的,跟fes的提交区分开下
This commit is contained in:
parent
31e08c60c4
commit
cb3d1ca061
@ -63,6 +63,3 @@ LIBS += -L$$SRC_ROOT_PATH/../$$ISCS6000_OS$$DIR_DEBUG_RELEASE/
|
||||
QMAKE_RPATHLINKDIR += $$PWD/../../platform/$$ISCS6000_OS$$DIR_DEBUG_RELEASE/
|
||||
QMAKE_RPATHLINKDIR += $$SRC_ROOT_PATH/../$$ISCS6000_OS$$DIR_DEBUG_RELEASE/
|
||||
|
||||
TR_EXCLUDE += $$SRC_ROOT_PATH/3rd/* \
|
||||
$$PWD/../../platform/src/3rd/*
|
||||
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
TEMPLATE=subdirs
|
||||
CONFIG += ordered
|
||||
SUBDIRS+= \
|
||||
# fileSync \
|
||||
NavigationApi \
|
||||
NavigationTool \
|
||||
IconActTool
|
||||
SUBDIRS+= fileSync NavigationApi NavigationTool IconActTool
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
|
||||
CFileOpt::CFileOpt()
|
||||
{
|
||||
std::string currentPath = iot_public::CFileUtil::getCurModuleDir();
|
||||
std::string currentPath = kbd_public::CFileUtil::getCurModuleDir();
|
||||
readColorCofig(QString::fromStdString(currentPath) + "/../../data/model/colorConfig.xml", m_strategyMap);
|
||||
readIconDefaultStrategy(QString::fromStdString(currentPath) + "/../../data/model/toolbox.xml", m_iconDefaultStrategyMap);
|
||||
}
|
||||
|
||||
@ -11,18 +11,14 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
CIconActDialog::CIconActDialog(QWidget *parent) :
|
||||
CustomUiDialog(parent),
|
||||
QDialog(parent),
|
||||
ui(new Ui::CIconActDialog),
|
||||
m_pTableModel(Q_NULLPTR),
|
||||
m_pFileOpt(Q_NULLPTR)
|
||||
{
|
||||
setWindowTitle(tr("图元动作"));
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
initialize();
|
||||
|
||||
CustomUiDialog::setAutoLayout(true);
|
||||
}
|
||||
|
||||
CIconActDialog::~CIconActDialog()
|
||||
@ -163,7 +159,7 @@ void CIconActDialog::initialize()
|
||||
m_actMap.insert(ACT_LEFT_DOUCLICK, tr("左键双击"));
|
||||
m_simMap.insert(SIM_FORBID, tr("禁止"));
|
||||
m_simMap.insert(SIM_ALLOW, tr("允许"));
|
||||
std::string currentPath = iot_public::CFileUtil::getCurModuleDir();
|
||||
std::string currentPath = kbd_public::CFileUtil::getCurModuleDir();
|
||||
CTableDelegate * iconDelegate = new CTableDelegate(this, CTableDelegate::IconFile);
|
||||
iconDelegate->setFilePath(QString::fromStdString(currentPath) + "/../../data/icon/");
|
||||
CTableDelegate * actnDelegate = new CTableDelegate(this, CTableDelegate::ComboBox);
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#ifndef CICONACTDIALOG_H
|
||||
#define CICONACTDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMap>
|
||||
#include "pub_widget/CustomDialog.h"
|
||||
|
||||
namespace Ui {
|
||||
class CIconActDialog;
|
||||
@ -10,7 +10,7 @@ class CIconActDialog;
|
||||
|
||||
class CTableModel;
|
||||
class CFileOpt;
|
||||
class CIconActDialog : public CustomUiDialog
|
||||
class CIconActDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@ -46,6 +46,19 @@
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_addBtn">
|
||||
<property name="sizePolicy">
|
||||
@ -96,19 +109,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
@ -45,8 +45,7 @@ FORMS += \
|
||||
LIBS += \
|
||||
-lpub_utility_api \
|
||||
-llog4cplus \
|
||||
-lpub_logger_api \
|
||||
-lpub_widget
|
||||
-lpub_logger_api
|
||||
|
||||
COMMON_PRI=$$PWD/../../../common.pri
|
||||
exists($$COMMON_PRI) {
|
||||
|
||||
@ -3,44 +3,15 @@
|
||||
#include <QTextCodec>
|
||||
#include "common/QtAppGlobalSet.h"
|
||||
#include "CIconActDialog.h"
|
||||
#include "pub_utility_api/FileStyle.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
iot_common::doQtAppGlobalSet();
|
||||
kbd_common::doQtAppGlobalSet();
|
||||
|
||||
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
|
||||
QTextCodec::setCodecForLocale(codec);
|
||||
|
||||
QApplication a(argc, argv);
|
||||
|
||||
QString qss = QString();
|
||||
std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss","zh","light");
|
||||
|
||||
QFile qssfile1(QString::fromStdString(strFullPath));
|
||||
qssfile1.open(QFile::ReadOnly);
|
||||
if (qssfile1.isOpen())
|
||||
{
|
||||
qss += QLatin1String(qssfile1.readAll());
|
||||
qssfile1.close();
|
||||
}
|
||||
|
||||
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("IconActTool.qss","zh","light");
|
||||
QFile qssfile2(QString::fromStdString(strFullPath));
|
||||
qssfile2.open(QFile::ReadOnly);
|
||||
if (qssfile2.isOpen())
|
||||
{
|
||||
qss += QLatin1String(qssfile2.readAll());
|
||||
qssfile2.close();
|
||||
}
|
||||
|
||||
if (!qss.isEmpty())
|
||||
{
|
||||
qApp->setStyleSheet(qss);
|
||||
}
|
||||
|
||||
// qApp->setFont(QFont("Microsoft YaHei",10));
|
||||
|
||||
CIconActDialog w;
|
||||
w.show();
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
CJsonOpt::CJsonOpt()
|
||||
{
|
||||
std::string currentPath = iot_public::CFileUtil::getCurModuleDir();
|
||||
std::string currentPath = kbd_public::CFileUtil::getCurModuleDir();
|
||||
QDir dir(QString::fromStdString(currentPath));
|
||||
dir.cdUp();
|
||||
dir.cdUp();
|
||||
|
||||
@ -13,13 +13,10 @@
|
||||
const int Item_Role = Qt::UserRole + 1;
|
||||
|
||||
CNavigationDialog::CNavigationDialog(QWidget *parent) :
|
||||
CustomUiMainWindow(parent),
|
||||
QDialog(parent),
|
||||
ui(new Ui::CNavigationDialog),
|
||||
m_itemIndex(0)
|
||||
{
|
||||
setWindowTitle(tr("导航栏配置工具"));
|
||||
CustomUiMainWindow::setAutoLayout(true);
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
initialize();
|
||||
@ -74,7 +71,7 @@ void CNavigationDialog::initialize()
|
||||
CTreeItemDelegate *boxDelegate2 = new CTreeItemDelegate(this, CTreeItemDelegate::ComboBox);
|
||||
boxDelegate2->setComboMap(m_mapType);
|
||||
|
||||
std::string currentPath = iot_public::CFileUtil::getCurModuleDir();
|
||||
std::string currentPath = kbd_public::CFileUtil::getCurModuleDir();
|
||||
QDir dir(QString::fromStdString(currentPath));
|
||||
dir.cdUp();
|
||||
dir.cdUp();
|
||||
@ -571,12 +568,12 @@ void CNavigationDialog::onConfirmClicked()
|
||||
QMessageBox::information(this, tr("提示"), tr("保存失败!"), QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
|
||||
accept();
|
||||
}
|
||||
|
||||
void CNavigationDialog::onCancelClicked()
|
||||
{
|
||||
|
||||
reject();
|
||||
}
|
||||
|
||||
void CNavigationDialog::onExport()
|
||||
@ -786,7 +783,7 @@ QMap<int, QString> CNavigationDialog::makePathMap()
|
||||
{
|
||||
QMap<int, QString> fileMap;
|
||||
QDir picDir(m_strFileHomePath + "pic" + QDir::separator());
|
||||
std::string exePath = iot_public::CFileUtil::getCurModuleDir();
|
||||
std::string exePath = kbd_public::CFileUtil::getCurModuleDir();
|
||||
fileMap.insert(SWITCH_GRAPH, picDir.path());
|
||||
fileMap.insert(LOAD_WEBURL, picDir.path());
|
||||
fileMap.insert(EXTERN_PRO, QString::fromStdString(exePath));
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
#ifndef CNAVIGATIONDIALOG_H
|
||||
#define CNAVIGATIONDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "gui/GraphTool/NavigationApi/CJsonOpt.h"
|
||||
#include "model_excel/xlsx/xlsxdocument.h"
|
||||
#include "pub_widget/CustomMainWindow.h"
|
||||
|
||||
namespace Ui {
|
||||
class CNavigationDialog;
|
||||
@ -12,7 +12,7 @@ class CNavigationDialog;
|
||||
extern const int Item_Role; //< 节点数-仅导入使用
|
||||
|
||||
class QTreeWidgetItem;
|
||||
class CNavigationDialog : public CustomUiMainWindow
|
||||
class CNavigationDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@ -1,31 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CNavigationDialog</class>
|
||||
<widget class="QMainWindow" name="CNavigationDialog">
|
||||
<widget class="QDialog" name="CNavigationDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
<width>1087</width>
|
||||
<height>673</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
<string>导航栏配置工具</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
@ -264,7 +275,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
||||
@ -45,8 +45,7 @@ LIBS += \
|
||||
-lpub_logger_api \
|
||||
-lpub_utility_api \
|
||||
-lmodel_excel \
|
||||
-lNavigationApi \
|
||||
-lpub_widget
|
||||
-lNavigationApi
|
||||
|
||||
COMMON_PRI=$$PWD/../../../common.pri
|
||||
exists($$COMMON_PRI) {
|
||||
|
||||
@ -2,40 +2,12 @@
|
||||
#include <QApplication>
|
||||
#include "common/QtAppGlobalSet.h"
|
||||
#include "CNavigationDialog.h"
|
||||
#include "pub_utility_api/FileStyle.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
iot_common::doQtAppGlobalSet();
|
||||
kbd_common::doQtAppGlobalSet();
|
||||
|
||||
QApplication a(argc, argv);
|
||||
QString qss = QString();
|
||||
std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss","zh","light");
|
||||
|
||||
QFile qssfile1(QString::fromStdString(strFullPath));
|
||||
qssfile1.open(QFile::ReadOnly);
|
||||
if (qssfile1.isOpen())
|
||||
{
|
||||
qss += QLatin1String(qssfile1.readAll());
|
||||
qssfile1.close();
|
||||
}
|
||||
|
||||
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("NavigationTool.qss","zh","light");
|
||||
QFile qssfile2(QString::fromStdString(strFullPath));
|
||||
qssfile2.open(QFile::ReadOnly);
|
||||
if (qssfile2.isOpen())
|
||||
{
|
||||
qss += QLatin1String(qssfile2.readAll());
|
||||
qssfile2.close();
|
||||
}
|
||||
|
||||
if (!qss.isEmpty())
|
||||
{
|
||||
qApp->setStyleSheet(qss);
|
||||
}
|
||||
|
||||
// qApp->setFont(QFont("Microsoft YaHei",10));
|
||||
|
||||
CNavigationDialog w;
|
||||
w.show();
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ namespace Ui {
|
||||
class CConfirmDialog;
|
||||
}
|
||||
|
||||
using namespace iot_sys;
|
||||
using namespace kbd_sys;
|
||||
class CConfirmDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -18,7 +18,7 @@ CFileSyncDialog::CFileSyncDialog(QDialog *parent) :
|
||||
{
|
||||
QTextCodec::setCodecForLocale(QTextCodec::codecForName("utf8"));
|
||||
|
||||
if(iot_public::getCurLanguage() == "en")
|
||||
if(kbd_public::getCurLanguage() == "en")
|
||||
{
|
||||
QTranslator * sysTranslator = new QTranslator(this);
|
||||
sysTranslator->load(":/fileSync_en.qm");
|
||||
@ -289,7 +289,7 @@ void CFileSyncDialog::getFileInfos(const QString &path, QFileInfoList &list)
|
||||
|
||||
void CFileSyncDialog::getSvnFile(const QString &path, QMap<QString, stFileStatus> &name, QString& error)
|
||||
{
|
||||
QVector<iot_sys::stFileStatus> vecFileStatus;
|
||||
QVector<kbd_sys::stFileStatus> vecFileStatus;
|
||||
|
||||
QStringList list;
|
||||
list.append(path);
|
||||
|
||||
@ -26,7 +26,7 @@ struct stSelectedPath
|
||||
QStringList path;
|
||||
};
|
||||
|
||||
using namespace iot_sys;
|
||||
using namespace kbd_sys;
|
||||
class CFileSyncDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
iot_common::doQtAppGlobalSet();
|
||||
kbd_common::doQtAppGlobalSet();
|
||||
|
||||
QApplication a(argc, argv);
|
||||
CFileSyncDialog w;
|
||||
|
||||
@ -8,6 +8,3 @@ SUBDIRS += \
|
||||
GraphTool \
|
||||
plugin
|
||||
|
||||
TRANSLATIONS += \
|
||||
product_en.ts\
|
||||
product_fr.ts
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
#include "pub_utility_api/I18N.h"
|
||||
#include "pub_utility_api/FileStyle.h"
|
||||
|
||||
using namespace iot_public;
|
||||
using namespace iot_dbms;
|
||||
using namespace kbd_public;
|
||||
using namespace kbd_dbms;
|
||||
|
||||
//#ff0000 255,0,0
|
||||
//#ff7414 255,116,20
|
||||
@ -24,7 +24,7 @@ CAlarmStatistics::CAlarmStatistics(QWidget *parent,bool editMode) :
|
||||
ui->comboBox_location->setView(new QListView());
|
||||
// 加载qss文件
|
||||
QString qss = QString();
|
||||
std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
||||
std::string strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
||||
QFile qssfile1(QString::fromStdString(strFullPath));
|
||||
qssfile1.open(QFile::ReadOnly);
|
||||
if (qssfile1.isOpen())
|
||||
@ -38,7 +38,7 @@ CAlarmStatistics::CAlarmStatistics(QWidget *parent,bool editMode) :
|
||||
qDebug() << "public.qss 无法打开!";
|
||||
}
|
||||
|
||||
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("alarm_statistics.qss") ;
|
||||
strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("alarm_statistics.qss") ;
|
||||
QFile qssfile2(QString::fromStdString(strFullPath));
|
||||
qssfile2.open(QFile::ReadOnly);
|
||||
if (qssfile2.isOpen())
|
||||
@ -87,6 +87,7 @@ CAlarmStatistics::~CAlarmStatistics()
|
||||
delete m_pProcessDialog;
|
||||
m_pProcessDialog = NULL;
|
||||
|
||||
m_pQueryThread->wait();
|
||||
delete m_pQueryThread;
|
||||
m_pQueryThread = NULL;
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
class CAlarmStatisticsPluginWidget : public QWidget, public CPluginWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID HMI_WidgetPlugin_IID)
|
||||
Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0")
|
||||
Q_INTERFACES(CPluginWidgetInterface)
|
||||
|
||||
public:
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#include "CCompareQueryThread.h"
|
||||
|
||||
using namespace iot_public;
|
||||
using namespace iot_dbms;
|
||||
using namespace kbd_public;
|
||||
using namespace kbd_dbms;
|
||||
|
||||
CCompareQueryThread::CCompareQueryThread()
|
||||
{
|
||||
|
||||
@ -46,7 +46,7 @@ public:
|
||||
int getAlarmLevelIndexById( int nId, SAlarmLevel* &pAlarmLevel );
|
||||
|
||||
public:
|
||||
iot_dbms::CDbApi* m_pDb; // 数据库接口
|
||||
kbd_dbms::CDbApi* m_pDb; // 数据库接口
|
||||
CAlarmModel* m_pAlarmModel; // 详细告警信息显示窗的model
|
||||
QList<QColor> m_listAlarmLevelColor; // 告警优先级的颜色集合
|
||||
QList<SAlarmLevel*> m_listAlarmLevel; // 告警级别列表
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#include "CStatisticsQueryThread.h"
|
||||
|
||||
using namespace iot_public;
|
||||
using namespace iot_dbms;
|
||||
using namespace kbd_public;
|
||||
using namespace kbd_dbms;
|
||||
|
||||
CStatisticsQueryThread::CStatisticsQueryThread()
|
||||
{
|
||||
|
||||
@ -37,7 +37,7 @@ public:
|
||||
void getWavePath( QString sAppTagName, QString& sPath, QString& sErrorMsg );
|
||||
|
||||
public:
|
||||
iot_dbms::CDbApi* m_pDb; // 数据库接口
|
||||
kbd_dbms::CDbApi* m_pDb; // 数据库接口
|
||||
CAlarmModel* m_pAlarmModel; // 详细告警信息显示窗的model
|
||||
QList<QColor> m_listAlarmLevelColor; // 告警优先级的颜色集合
|
||||
QList<SAlarmLevel*> m_listAlarmLevel; // 告警级别列表
|
||||
|
||||
@ -33,8 +33,8 @@ void CWaveListDialog::addFileNameList( QString sPath, QStringList listName )
|
||||
|
||||
void CWaveListDialog::slotShowWave( QListWidgetItem* pItem )
|
||||
{
|
||||
const std::string strPath = std::move(iot_public::CFileUtil::getPathOfBinFile(
|
||||
std::string("WaveAnalyze") + iot_public::CFileUtil::getProcSuffix()));
|
||||
const std::string strPath = std::move(kbd_public::CFileUtil::getPathOfBinFile(
|
||||
std::string("WaveAnalyze") + kbd_public::CFileUtil::getProcSuffix()));
|
||||
if(strPath.empty())
|
||||
{
|
||||
LOGERROR("未找到可执行文件WaveAnalyze");
|
||||
|
||||
@ -6,12 +6,12 @@
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
iot_public::StartLogSystem( "BASE", "alarm_statistics" );
|
||||
kbd_public::StartLogSystem( "BASE", "alarm_statistics" );
|
||||
|
||||
CAlarmStatistics w( 0, false );
|
||||
w.show();
|
||||
int nRet = a.exec();
|
||||
|
||||
iot_public::StopLogSystem();
|
||||
kbd_public::StopLogSystem();
|
||||
return nRet;
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ void AddObjAlarmDialog::initMember()
|
||||
{
|
||||
if(m_pWriteDb == NULL)
|
||||
{
|
||||
m_pWriteDb = new iot_dbms::CDbApi(DB_CONN_MODEL_WRITE);
|
||||
m_pWriteDb = new kbd_dbms::CDbApi(DB_CONN_MODEL_WRITE);
|
||||
m_pWriteDb->open();
|
||||
}
|
||||
if(m_model == NULL)
|
||||
|
||||
@ -69,7 +69,7 @@ private slots:
|
||||
private:
|
||||
Ui::AddObjAlarmDialog *ui;
|
||||
|
||||
iot_dbms::CDbApi *m_pWriteDb;
|
||||
kbd_dbms::CDbApi *m_pWriteDb;
|
||||
|
||||
QMap<int,QCheckBox*> m_alarmActionCheckMap;//选中的告警动作
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ AlarmManageForm::AlarmManageForm(QWidget *parent,bool edit) :
|
||||
ui->setupUi(this);
|
||||
QString qss = QString();
|
||||
|
||||
std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
||||
std::string strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
||||
QFile qssfile1(QString::fromStdString(strFullPath));
|
||||
qssfile1.open(QFile::ReadOnly);
|
||||
if (qssfile1.isOpen())
|
||||
@ -30,7 +30,7 @@ AlarmManageForm::AlarmManageForm(QWidget *parent,bool edit) :
|
||||
qDebug() << "public.qss 无法打开!";
|
||||
}
|
||||
|
||||
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("alarmmng.qss") ;
|
||||
strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("alarmmng.qss") ;
|
||||
QFile qssfile2(QString::fromStdString(strFullPath));
|
||||
qssfile2.open(QFile::ReadOnly);
|
||||
if (qssfile2.isOpen())
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
class AlarmManagePluginWidget : public QObject, public CPluginWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID HMI_WidgetPlugin_IID)
|
||||
Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0")
|
||||
Q_INTERFACES(CPluginWidgetInterface)
|
||||
|
||||
public:
|
||||
|
||||
@ -52,7 +52,7 @@ AlarmManageWidget::AlarmManageWidget(QWidget *parent, bool editMode) :
|
||||
initView();
|
||||
m_pThread->start();
|
||||
}
|
||||
QDir dir(QString::fromStdString(iot_public::CFileUtil::getCurModuleDir()));
|
||||
QDir dir(QString::fromStdString(kbd_public::CFileUtil::getCurModuleDir()));
|
||||
dir.cdUp();
|
||||
dir.cdUp();
|
||||
dir.cd("data");
|
||||
@ -86,8 +86,8 @@ void AlarmManageWidget::initMember()
|
||||
}
|
||||
|
||||
AlarmMng::instance()->moveToThread(m_pThread);
|
||||
m_pWriteDb = new iot_dbms::CDbApi(DB_CONN_MODEL_WRITE);
|
||||
m_pReadDb = new iot_dbms::CDbApi(DB_CONN_MODEL_READ);
|
||||
m_pWriteDb = new kbd_dbms::CDbApi(DB_CONN_MODEL_WRITE);
|
||||
m_pReadDb = new kbd_dbms::CDbApi(DB_CONN_MODEL_READ);
|
||||
if(!m_pWriteDb->open())
|
||||
{
|
||||
LOGERROR("打开数据库失败,error:%s",m_pWriteDb->getLastErrorString().toStdString().c_str());
|
||||
@ -202,7 +202,7 @@ bool AlarmManageWidget::initCurUser()
|
||||
{
|
||||
m_userId = -1;
|
||||
m_usergId = -1;
|
||||
iot_service::CPermMngApiPtr permMngPtr = iot_service::getPermMngInstance("base");
|
||||
kbd_service::CPermMngApiPtr permMngPtr = kbd_service::getPermMngInstance("base");
|
||||
if(permMngPtr == NULL || (PERM_NORMAL != permMngPtr->PermDllInit()))
|
||||
{
|
||||
LOGERROR("权限接口初始化失败!");
|
||||
|
||||
@ -126,8 +126,8 @@ private:
|
||||
|
||||
QMap<int,int> m_alarmLevelIndexMap;
|
||||
|
||||
iot_dbms::CDbApi *m_pReadDb;
|
||||
iot_dbms::CDbApi *m_pWriteDb;
|
||||
kbd_dbms::CDbApi *m_pReadDb;
|
||||
kbd_dbms::CDbApi *m_pWriteDb;
|
||||
|
||||
int m_userId;
|
||||
int m_usergId;
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
#include <QMutexLocker>
|
||||
#include <QSqlQuery>
|
||||
|
||||
using namespace iot_dbms;
|
||||
using namespace iot_public;
|
||||
using namespace kbd_dbms;
|
||||
using namespace kbd_public;
|
||||
using namespace std;
|
||||
|
||||
AlarmMng *AlarmMng::pInstance = NULL;
|
||||
@ -249,7 +249,7 @@ QList<QString> AlarmMng::getDiText()
|
||||
|
||||
bool AlarmMng::getNomRptEditPerm()
|
||||
{
|
||||
iot_service::CPermMngApiPtr permMngPtr = iot_service::getPermMngInstance("base");
|
||||
kbd_service::CPermMngApiPtr permMngPtr = kbd_service::getPermMngInstance("base");
|
||||
if(permMngPtr == NULL || (PERM_NORMAL != permMngPtr->PermDllInit()))
|
||||
{
|
||||
LOGERROR("权限接口初始化失败!");
|
||||
@ -278,12 +278,12 @@ AlarmMng::AlarmMng()
|
||||
{
|
||||
mutex = new QMutex;
|
||||
|
||||
m_pReadDb = new iot_dbms::CDbApi(DB_CONN_MODEL_READ);
|
||||
m_pReadDb = new kbd_dbms::CDbApi(DB_CONN_MODEL_READ);
|
||||
if(!m_pReadDb->open())
|
||||
{
|
||||
LOGERROR("打开数据库失败,error:%s",m_pReadDb->getLastErrorString().toStdString().c_str());
|
||||
}
|
||||
m_rtdbAccess = new iot_dbms::CRdbAccess();
|
||||
m_rtdbAccess = new kbd_dbms::CRdbAccess();
|
||||
loadLocInfo();
|
||||
loadDevgInfo();
|
||||
loadDevInfo();
|
||||
@ -298,7 +298,7 @@ AlarmMng::AlarmMng()
|
||||
|
||||
void AlarmMng::loadLocInfo()
|
||||
{
|
||||
iot_service::CPermMngApiPtr permMngPtr = iot_service::getPermMngInstance("base");
|
||||
kbd_service::CPermMngApiPtr permMngPtr = kbd_service::getPermMngInstance("base");
|
||||
if(permMngPtr == NULL || (PERM_NORMAL != permMngPtr->PermDllInit()))
|
||||
{
|
||||
LOGERROR("权限接口初始化失败!");
|
||||
@ -320,8 +320,8 @@ void AlarmMng::loadLocInfo()
|
||||
id_value.second = "description";
|
||||
if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str()))
|
||||
{
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
iot_dbms::CRdbQueryResult result;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
kbd_dbms::CRdbQueryResult result;
|
||||
std::vector<std::string> columns;
|
||||
columns.push_back(id_value.first);
|
||||
columns.push_back(id_value.second);
|
||||
@ -332,8 +332,8 @@ void AlarmMng::loadLocInfo()
|
||||
m_locMap.clear();
|
||||
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||
{
|
||||
iot_dbms::CVarType key;
|
||||
iot_dbms::CVarType value;
|
||||
kbd_dbms::CVarType key;
|
||||
kbd_dbms::CVarType value;
|
||||
result.getColumnValue(nIndex, 0, key);
|
||||
result.getColumnValue(nIndex, 1, value);
|
||||
|
||||
|
||||
@ -119,9 +119,9 @@ private:
|
||||
static AlarmMng * pInstance;
|
||||
|
||||
|
||||
iot_dbms::CDbApi * m_pReadDb;
|
||||
kbd_dbms::CDbApi * m_pReadDb;
|
||||
|
||||
iot_dbms::CRdbAccess * m_rtdbAccess;
|
||||
kbd_dbms::CRdbAccess * m_rtdbAccess;
|
||||
QMap<int,QString> m_locMap; //<车站ID,车站描述>
|
||||
QMap<QString,QString> m_devgMap; //<设备组标签,设备组描述>
|
||||
QMap<QString,QString> m_devMap; //<设备标签,设备描述>
|
||||
|
||||
@ -8,13 +8,13 @@ int main(int argc, char *argv[])
|
||||
QApplication a(argc, argv);
|
||||
|
||||
std::string name="admin";
|
||||
std::string password ="admin";
|
||||
iot_public::StartLogSystem("HMI", "hmi");
|
||||
std::string password ="kbdct";
|
||||
kbd_public::StartLogSystem("HMI", "hmi");
|
||||
|
||||
iot_net::initMsgBus("HMI", "HMI");
|
||||
kbd_net::initMsgBus("HMI", "HMI");
|
||||
|
||||
int group =1;
|
||||
iot_service::CPermMngApiPtr perm = iot_service::getPermMngInstance("base");
|
||||
kbd_service::CPermMngApiPtr perm = kbd_service::getPermMngInstance("base");
|
||||
if(!perm || PERM_NORMAL != perm->PermDllInit())
|
||||
{
|
||||
return -1;
|
||||
@ -29,9 +29,9 @@ int main(int argc, char *argv[])
|
||||
w.show();
|
||||
a.exec();
|
||||
}
|
||||
iot_net::releaseMsgBus();
|
||||
kbd_net::releaseMsgBus();
|
||||
|
||||
iot_public::StopLogSystem();
|
||||
kbd_public::StopLogSystem();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -498,7 +498,7 @@ int CAddShieldDialog::getMonthOption()
|
||||
|
||||
bool CAddShieldDialog::getCurUser(int &userId, int &usergId, QString &hostName, int &locationId)
|
||||
{
|
||||
iot_service::CPermMngApiPtr permMngPtr = iot_service::getPermMngInstance("base");
|
||||
kbd_service::CPermMngApiPtr permMngPtr = kbd_service::getPermMngInstance("base");
|
||||
if(permMngPtr == NULL || (PERM_NORMAL != permMngPtr->PermDllInit()))
|
||||
{
|
||||
LOGERROR("权限接口初始化失败!");
|
||||
@ -514,9 +514,9 @@ bool CAddShieldDialog::getCurUser(int &userId, int &usergId, QString &hostName,
|
||||
LOGERROR("获取当前登录用户失败!");
|
||||
return false;
|
||||
}
|
||||
iot_public::SNodeInfo stNodeInfo;
|
||||
iot_public::CSysInfoInterfacePtr spSysInfo;
|
||||
if (!iot_public::createSysInfoInstance(spSysInfo))
|
||||
kbd_public::SNodeInfo stNodeInfo;
|
||||
kbd_public::CSysInfoInterfacePtr spSysInfo;
|
||||
if (!kbd_public::createSysInfoInstance(spSysInfo))
|
||||
{
|
||||
LOGERROR("创建系统信息访问库实例失败!");
|
||||
return false;
|
||||
|
||||
@ -21,7 +21,7 @@ CAlarmShield::CAlarmShield(QWidget *parent, bool editMode) :
|
||||
if(!editMode)
|
||||
{
|
||||
QString style = QString();
|
||||
std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
||||
std::string strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
||||
QFile file1(QString::fromStdString(strFullPath));
|
||||
if (file1.open(QIODevice::ReadOnly))
|
||||
{
|
||||
@ -31,7 +31,7 @@ CAlarmShield::CAlarmShield(QWidget *parent, bool editMode) :
|
||||
}
|
||||
file1.close();
|
||||
|
||||
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("alarmShield.qss") ;
|
||||
strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("alarmShield.qss") ;
|
||||
QFile file2(QString::fromStdString(strFullPath));
|
||||
if (file2.open(QIODevice::ReadOnly))
|
||||
{
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
class CAlarmShieldPluginWidget : public QObject, public CPluginWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID HMI_WidgetPlugin_IID)
|
||||
Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0")
|
||||
Q_INTERFACES(CPluginWidgetInterface)
|
||||
|
||||
public:
|
||||
|
||||
@ -150,7 +150,7 @@ QMap<int, QString> CDbInfoManage::getShieldPropMap()
|
||||
|
||||
bool CDbInfoManage::loadShieldObj(const int &shieldId, QList<ST_Shield_Obj> &objList)
|
||||
{
|
||||
iot_dbms::CDbApi objReadDb(DB_CONN_MODEL_READ);
|
||||
kbd_dbms::CDbApi objReadDb(DB_CONN_MODEL_READ);
|
||||
bool ret = objReadDb.open();
|
||||
if(!ret)
|
||||
{
|
||||
@ -188,7 +188,7 @@ bool CDbInfoManage::loadShieldObj(const int &shieldId, QList<ST_Shield_Obj> &obj
|
||||
|
||||
bool CDbInfoManage::loadShieldObj(const QStringList &objList, QMap<int, QList<ST_Shield_Obj> > &objMap)
|
||||
{
|
||||
iot_dbms::CDbApi objReadDb(DB_CONN_MODEL_READ);
|
||||
kbd_dbms::CDbApi objReadDb(DB_CONN_MODEL_READ);
|
||||
bool ret = objReadDb.open();
|
||||
if(!ret)
|
||||
{
|
||||
@ -232,7 +232,7 @@ bool CDbInfoManage::loadShieldObj(const QStringList &objList, QMap<int, QList<ST
|
||||
|
||||
bool CDbInfoManage::loadShieldInfo(const QList<int> &objList, QList<ST_Shield_Info> &infoList)
|
||||
{
|
||||
iot_dbms::CDbApi objReadDb(DB_CONN_MODEL_READ);
|
||||
kbd_dbms::CDbApi objReadDb(DB_CONN_MODEL_READ);
|
||||
bool ret = objReadDb.open();
|
||||
if(!ret)
|
||||
{
|
||||
@ -820,13 +820,13 @@ bool CDbInfoManage::checkOptPerm(const std::vector<int> &vecRegionOptId, const s
|
||||
CDbInfoManage::CDbInfoManage()
|
||||
{
|
||||
initPermMng();
|
||||
m_rtdbAccess = new iot_dbms::CRdbAccess();
|
||||
m_pWriteDb = new iot_dbms::CDbApi(DB_CONN_MODEL_WRITE);
|
||||
m_rtdbAccess = new kbd_dbms::CRdbAccess();
|
||||
m_pWriteDb = new kbd_dbms::CDbApi(DB_CONN_MODEL_WRITE);
|
||||
m_pWriteDb->open();
|
||||
|
||||
// m_tagInfo.reserve(5000);
|
||||
|
||||
iot_dbms::CDbApi objReadDb(DB_CONN_MODEL_READ);
|
||||
kbd_dbms::CDbApi objReadDb(DB_CONN_MODEL_READ);
|
||||
bool ret = objReadDb.open();
|
||||
if(!ret)
|
||||
{
|
||||
@ -845,7 +845,7 @@ CDbInfoManage::CDbInfoManage()
|
||||
|
||||
void CDbInfoManage::initPermMng()
|
||||
{
|
||||
m_ptrPermMng = iot_service::getPermMngInstance("base");
|
||||
m_ptrPermMng = kbd_service::getPermMngInstance("base");
|
||||
if(m_ptrPermMng == NULL || (PERM_NORMAL != m_ptrPermMng->PermDllInit()))
|
||||
{
|
||||
LOGERROR("权限接口初始化失败!");
|
||||
@ -892,8 +892,8 @@ void CDbInfoManage::loadRTLocation()
|
||||
std::string strTableName = "sys_model_location_info";
|
||||
if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str()))
|
||||
{
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
iot_dbms::CRdbQueryResult result;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
kbd_dbms::CRdbQueryResult result;
|
||||
std::vector<std::string> columns;
|
||||
columns.push_back("location_id");
|
||||
columns.push_back("tag_name");
|
||||
@ -906,9 +906,9 @@ void CDbInfoManage::loadRTLocation()
|
||||
m_locationTag.clear();
|
||||
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||
{
|
||||
iot_dbms::CVarType location_id;
|
||||
iot_dbms::CVarType tag_name;
|
||||
iot_dbms::CVarType description;
|
||||
kbd_dbms::CVarType location_id;
|
||||
kbd_dbms::CVarType tag_name;
|
||||
kbd_dbms::CVarType description;
|
||||
result.getColumnValue(nIndex, 0, location_id);
|
||||
result.getColumnValue(nIndex, 1, tag_name);
|
||||
result.getColumnValue(nIndex, 2, description);
|
||||
@ -930,7 +930,7 @@ void CDbInfoManage::loadRTLocation()
|
||||
m_rtdbAccess->close();
|
||||
}
|
||||
|
||||
void CDbInfoManage::loadDevGroupInfo(iot_dbms::CDbApi &objReadDb)
|
||||
void CDbInfoManage::loadDevGroupInfo(kbd_dbms::CDbApi &objReadDb)
|
||||
{
|
||||
QSqlQuery query;
|
||||
|
||||
@ -974,7 +974,7 @@ void CDbInfoManage::loadDevGroupInfo(iot_dbms::CDbApi &objReadDb)
|
||||
}
|
||||
}
|
||||
|
||||
void CDbInfoManage::loadDeviceInfo(iot_dbms::CDbApi &objReadDb)
|
||||
void CDbInfoManage::loadDeviceInfo(kbd_dbms::CDbApi &objReadDb)
|
||||
{
|
||||
QSqlQuery query;
|
||||
|
||||
@ -1002,7 +1002,7 @@ void CDbInfoManage::loadDeviceInfo(iot_dbms::CDbApi &objReadDb)
|
||||
}
|
||||
}
|
||||
|
||||
void CDbInfoManage::loadPointInfo(iot_dbms::CDbApi &objReadDb)
|
||||
void CDbInfoManage::loadPointInfo(kbd_dbms::CDbApi &objReadDb)
|
||||
{
|
||||
QSqlQuery query;
|
||||
QStringList listType;
|
||||
@ -1045,7 +1045,7 @@ void CDbInfoManage::loadPointInfo(iot_dbms::CDbApi &objReadDb)
|
||||
}
|
||||
}
|
||||
|
||||
void CDbInfoManage::loadUserInfo(iot_dbms::CDbApi &objReadDb)
|
||||
void CDbInfoManage::loadUserInfo(kbd_dbms::CDbApi &objReadDb)
|
||||
{
|
||||
QSqlQuery query;
|
||||
QString sql = QString("select perm_id,perm_alias from rm_user_def");
|
||||
@ -1059,7 +1059,7 @@ void CDbInfoManage::loadUserInfo(iot_dbms::CDbApi &objReadDb)
|
||||
}
|
||||
}
|
||||
|
||||
void CDbInfoManage::loadShieldDefine(iot_dbms::CDbApi &objReadDb)
|
||||
void CDbInfoManage::loadShieldDefine(kbd_dbms::CDbApi &objReadDb)
|
||||
{
|
||||
QSqlQuery query;
|
||||
QString sql = QString("select shield_id,description,shield_prop from opt_shield_define");
|
||||
@ -1074,7 +1074,7 @@ void CDbInfoManage::loadShieldDefine(iot_dbms::CDbApi &objReadDb)
|
||||
}
|
||||
}
|
||||
|
||||
void CDbInfoManage::loadShieldProperty(iot_dbms::CDbApi &objReadDb)
|
||||
void CDbInfoManage::loadShieldProperty(kbd_dbms::CDbApi &objReadDb)
|
||||
{
|
||||
QSqlQuery query;
|
||||
QString sql = QString("select actual_value,display_value from dict_menu_info where menu_name = '%1' ").arg("屏蔽属性");
|
||||
@ -1091,7 +1091,7 @@ void CDbInfoManage::loadShieldProperty(iot_dbms::CDbApi &objReadDb)
|
||||
bool CDbInfoManage::getMaxId(int &timeId, int &shieldId)
|
||||
{
|
||||
bool ret = false;
|
||||
iot_dbms::CDbApi readDb(DB_CONN_MODEL_READ);
|
||||
kbd_dbms::CDbApi readDb(DB_CONN_MODEL_READ);
|
||||
if(!readDb.open())
|
||||
{
|
||||
return false;
|
||||
|
||||
@ -57,20 +57,20 @@ private:
|
||||
QString getJoinStr(const QList<int> &list, char c);
|
||||
|
||||
void loadRTLocation();
|
||||
void loadDevGroupInfo(iot_dbms::CDbApi &objReadDb);
|
||||
void loadDeviceInfo(iot_dbms::CDbApi &objReadDb);
|
||||
void loadPointInfo(iot_dbms::CDbApi &objReadDb);
|
||||
void loadUserInfo(iot_dbms::CDbApi &objReadDb);
|
||||
void loadShieldDefine(iot_dbms::CDbApi &objReadDb);
|
||||
void loadShieldProperty(iot_dbms::CDbApi &objReadDb);
|
||||
void loadDevGroupInfo(kbd_dbms::CDbApi &objReadDb);
|
||||
void loadDeviceInfo(kbd_dbms::CDbApi &objReadDb);
|
||||
void loadPointInfo(kbd_dbms::CDbApi &objReadDb);
|
||||
void loadUserInfo(kbd_dbms::CDbApi &objReadDb);
|
||||
void loadShieldDefine(kbd_dbms::CDbApi &objReadDb);
|
||||
void loadShieldProperty(kbd_dbms::CDbApi &objReadDb);
|
||||
|
||||
bool getMaxId(int &timeId, int &shieldId);
|
||||
|
||||
private:
|
||||
static CDbInfoManage * m_pInstance;
|
||||
iot_service::CPermMngApiPtr m_ptrPermMng;
|
||||
iot_dbms::CRdbAccess * m_rtdbAccess;
|
||||
iot_dbms::CDbApi *m_pWriteDb;
|
||||
kbd_service::CPermMngApiPtr m_ptrPermMng;
|
||||
kbd_dbms::CRdbAccess * m_rtdbAccess;
|
||||
kbd_dbms::CDbApi *m_pWriteDb;
|
||||
QMap<QString, int> m_regionMap;
|
||||
QMap<int, QString> m_locationInfo;
|
||||
QMap<int, QString> m_locationTag;
|
||||
|
||||
@ -86,8 +86,6 @@ E_Tree_ItemType CDevTreeModel::currentType()
|
||||
|
||||
QVariant CDevTreeModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
Q_UNUSED(section);
|
||||
|
||||
if(role == Qt::DisplayRole)
|
||||
{
|
||||
if(orientation == Qt::Horizontal)
|
||||
|
||||
@ -8,8 +8,8 @@ CHeaderView::CHeaderView(QWidget *parent, int nAddCheckBoxColumn):
|
||||
QHeaderView(Qt::Horizontal, parent),
|
||||
m_bChecked(false)
|
||||
{
|
||||
m_indicatorCheck = iot_public::CFileUtil::getPathOfResFile("gui/icon/alarm/ckb-select.png").c_str();
|
||||
m_indicatorUnCheck = iot_public::CFileUtil::getPathOfResFile("gui/icon/alarm/unchecked.png").c_str();
|
||||
m_indicatorCheck = kbd_public::CFileUtil::getPathOfResFile("gui/icon/alarm/ckb-select.png").c_str();
|
||||
m_indicatorUnCheck = kbd_public::CFileUtil::getPathOfResFile("gui/icon/alarm/unchecked.png").c_str();
|
||||
|
||||
setSectionsClickable(true);
|
||||
connect(this, SIGNAL(sectionClicked(int)), this, SLOT(onHeaderClicked(int)));
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
iot_public::StartLogSystem("", "hmi");
|
||||
kbd_public::StartLogSystem("", "hmi");
|
||||
|
||||
iot_service::CPermMngApiPtr perm = iot_service::getPermMngInstance("base");
|
||||
kbd_service::CPermMngApiPtr perm = kbd_service::getPermMngInstance("base");
|
||||
if(!perm || PERM_NORMAL != perm->PermDllInit())
|
||||
{
|
||||
return -1;
|
||||
@ -25,6 +25,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
a.exec();
|
||||
|
||||
iot_public::StopLogSystem();
|
||||
kbd_public::StopLogSystem();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
class CAlarmStatisPluginWidget : public QObject, public CPluginWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID HMI_WidgetPlugin_IID)
|
||||
Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0")
|
||||
Q_INTERFACES(CPluginWidgetInterface)
|
||||
public:
|
||||
CAlarmStatisPluginWidget(QObject *parent = 0);
|
||||
|
||||
@ -2,18 +2,18 @@
|
||||
#include "dbms/db_api_ex/CDbApi.h"
|
||||
#include "CStatisCommon.h"
|
||||
|
||||
using namespace iot_dbms;
|
||||
using namespace kbd_dbms;
|
||||
|
||||
CDataInfoManage *CDataInfoManage::m_pInstance = NULL;
|
||||
|
||||
CDataInfoManage::CDataInfoManage()
|
||||
{
|
||||
m_rtdbAccess = new iot_dbms::CRdbAccess();
|
||||
m_rtdbNetAcs = new iot_dbms::CRdbNetApi();
|
||||
m_rtdbAccess = new kbd_dbms::CRdbAccess();
|
||||
m_rtdbNetAcs = new kbd_dbms::CRdbNetApi();
|
||||
m_nDomain = CN_InvalidDomainId;
|
||||
if(iot_public::createSysInfoInstance(m_ptrSysInfo))
|
||||
if(kbd_public::createSysInfoInstance(m_ptrSysInfo))
|
||||
{
|
||||
iot_public::SNodeInfo sNodeInfo;
|
||||
kbd_public::SNodeInfo sNodeInfo;
|
||||
m_ptrSysInfo->getLocalNodeInfo(sNodeInfo);
|
||||
m_nDomain = sNodeInfo.nDomainId;
|
||||
}
|
||||
@ -205,8 +205,8 @@ void CDataInfoManage::loadAlarmLevel()
|
||||
std::string strTableName = "alarm_level_define";
|
||||
if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str()))
|
||||
{
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
iot_dbms::CRdbQueryResult result;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
kbd_dbms::CRdbQueryResult result;
|
||||
std::vector<std::string> columns;
|
||||
columns.push_back("priority_id");
|
||||
columns.push_back("priority_name");
|
||||
@ -224,9 +224,9 @@ void CDataInfoManage::loadAlarmLevel()
|
||||
m_alarmOrderMap.clear();
|
||||
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||
{
|
||||
iot_dbms::CVarType key;
|
||||
iot_dbms::CVarType value;
|
||||
iot_dbms::CVarType order;
|
||||
kbd_dbms::CVarType key;
|
||||
kbd_dbms::CVarType value;
|
||||
kbd_dbms::CVarType order;
|
||||
result.getColumnValue(nIndex, 0, key);
|
||||
result.getColumnValue(nIndex, 1, value);
|
||||
result.getColumnValue(nIndex, 2, order);
|
||||
@ -245,8 +245,8 @@ void CDataInfoManage::loadLocation()
|
||||
std::string strTableName = "sys_model_location_info";
|
||||
if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str()))
|
||||
{
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
iot_dbms::CRdbQueryResult result;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
kbd_dbms::CRdbQueryResult result;
|
||||
std::vector<std::string> columns;
|
||||
columns.push_back("location_id");
|
||||
columns.push_back("description");
|
||||
@ -260,10 +260,10 @@ void CDataInfoManage::loadLocation()
|
||||
{
|
||||
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||
{
|
||||
iot_dbms::CVarType id;
|
||||
iot_dbms::CVarType desc;
|
||||
iot_dbms::CVarType p_id;
|
||||
iot_dbms::CVarType type;
|
||||
kbd_dbms::CVarType id;
|
||||
kbd_dbms::CVarType desc;
|
||||
kbd_dbms::CVarType p_id;
|
||||
kbd_dbms::CVarType type;
|
||||
result.getColumnValue(nIndex, 0, id);
|
||||
result.getColumnValue(nIndex, 1, desc);
|
||||
result.getColumnValue(nIndex, 2, p_id);
|
||||
@ -300,8 +300,8 @@ void CDataInfoManage::loadDevType()
|
||||
std::string strTableName = "dev_type_def";
|
||||
if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str()))
|
||||
{
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
iot_dbms::CRdbQueryResult result;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
kbd_dbms::CRdbQueryResult result;
|
||||
std::vector<std::string> columns;
|
||||
columns.push_back("dev_type_id");
|
||||
columns.push_back("description");
|
||||
@ -311,8 +311,8 @@ void CDataInfoManage::loadDevType()
|
||||
m_devTypeMap.clear();
|
||||
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||
{
|
||||
iot_dbms::CVarType key;
|
||||
iot_dbms::CVarType value;
|
||||
kbd_dbms::CVarType key;
|
||||
kbd_dbms::CVarType value;
|
||||
result.getColumnValue(nIndex, 0, key);
|
||||
result.getColumnValue(nIndex, 1, value);
|
||||
|
||||
@ -327,7 +327,7 @@ void CDataInfoManage::loadDevInfo()
|
||||
{
|
||||
std::string strTableName = "dev_info";
|
||||
m_rtdbNetAcs->connect(m_nDomain, CN_AppId_PSCADA);
|
||||
iot_idl::RdbRet objRet;
|
||||
kbd_idlfile::RdbRet objRet;
|
||||
std::vector<std::string> columns;
|
||||
columns.push_back("tag_name");
|
||||
columns.push_back("description");
|
||||
@ -389,8 +389,8 @@ void CDataInfoManage::loadAlarmStatus()
|
||||
std::string strTableName = "alarm_status_define";
|
||||
if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str()))
|
||||
{
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
iot_dbms::CRdbQueryResult result;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
kbd_dbms::CRdbQueryResult result;
|
||||
std::vector<std::string> columns;
|
||||
columns.push_back("alarm_type");
|
||||
columns.push_back("status_value");
|
||||
@ -401,9 +401,9 @@ void CDataInfoManage::loadAlarmStatus()
|
||||
m_alarmStatusMap.clear();
|
||||
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||
{
|
||||
iot_dbms::CVarType alarm_type;
|
||||
iot_dbms::CVarType status_value;
|
||||
iot_dbms::CVarType alarm_manner;
|
||||
kbd_dbms::CVarType alarm_type;
|
||||
kbd_dbms::CVarType status_value;
|
||||
kbd_dbms::CVarType alarm_manner;
|
||||
result.getColumnValue(nIndex, 0, alarm_type);
|
||||
result.getColumnValue(nIndex, 1, status_value);
|
||||
result.getColumnValue(nIndex, 2, alarm_manner);
|
||||
@ -424,8 +424,8 @@ void CDataInfoManage::loadAlarmManner()
|
||||
std::string strTableName = "alarm_manner_define";
|
||||
if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str()))
|
||||
{
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
iot_dbms::CRdbQueryResult result;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
kbd_dbms::CRdbQueryResult result;
|
||||
std::vector<std::string> columns;
|
||||
columns.push_back("manner_id");
|
||||
columns.push_back("alarm_priority");
|
||||
@ -435,8 +435,8 @@ void CDataInfoManage::loadAlarmManner()
|
||||
m_alarmMannerMap.clear();
|
||||
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||
{
|
||||
iot_dbms::CVarType key;
|
||||
iot_dbms::CVarType value;
|
||||
kbd_dbms::CVarType key;
|
||||
kbd_dbms::CVarType value;
|
||||
result.getColumnValue(nIndex, 0, key);
|
||||
result.getColumnValue(nIndex, 1, value);
|
||||
|
||||
@ -460,7 +460,7 @@ void CDataInfoManage::loadDevPoint()
|
||||
for(int nIndex=0; nIndex<listTable.length(); nIndex++)
|
||||
{
|
||||
m_rtdbNetAcs->connect(m_nDomain, CN_AppId_PSCADA);
|
||||
iot_idl::RdbRet objRet;
|
||||
kbd_idlfile::RdbRet objRet;
|
||||
std::vector<std::string> columns;
|
||||
columns.push_back("tag_name");
|
||||
columns.push_back("device");
|
||||
|
||||
@ -43,9 +43,9 @@ private:
|
||||
void loadDevPoint();
|
||||
|
||||
private:
|
||||
iot_dbms::CRdbAccess * m_rtdbAccess;
|
||||
iot_dbms::CRdbNetApi * m_rtdbNetAcs;
|
||||
iot_public::CSysInfoInterfacePtr m_ptrSysInfo;
|
||||
kbd_dbms::CRdbAccess * m_rtdbAccess;
|
||||
kbd_dbms::CRdbNetApi * m_rtdbNetAcs;
|
||||
kbd_public::CSysInfoInterfacePtr m_ptrSysInfo;
|
||||
int m_nDomain;
|
||||
QMap<int, QString> m_alarmLevelMap; //< alarm_level_define PRIORITY_ID - PRIORITY_NAME
|
||||
QMap<int, int > m_alarmOrderMap; //< alarm_level_define PRIORITY_ID - PRIORITY_ORDER
|
||||
|
||||
@ -17,7 +17,7 @@ void CHisEventManage::queryHisEventStatis(int location, int devType, qint64 star
|
||||
{
|
||||
QTime time;
|
||||
time.start();
|
||||
iot_dbms::CTsdbConnPtr tsdbConnPtr;
|
||||
kbd_dbms::CTsdbConnPtr tsdbConnPtr;
|
||||
if(!getValidTsdbConnPtr(tsdbConnPtr))
|
||||
{
|
||||
LOGERROR("CTsdbQuery: 未获取到有效的TSDB连接!");
|
||||
@ -40,7 +40,7 @@ void CHisEventManage::queryHisEventContrast(QList<int> selectedList, qint64 star
|
||||
{
|
||||
QTime time;
|
||||
time.start();
|
||||
iot_dbms::CTsdbConnPtr tsdbConnPtr;
|
||||
kbd_dbms::CTsdbConnPtr tsdbConnPtr;
|
||||
if(!getValidTsdbConnPtr(tsdbConnPtr))
|
||||
{
|
||||
LOGERROR("CTsdbQuery: 未获取到有效的TSDB连接!");
|
||||
@ -69,7 +69,7 @@ void CHisEventManage::queryHisEventContrast(QList<int> selectedList, qint64 star
|
||||
emit updateHisEventContrast(record);
|
||||
}
|
||||
|
||||
bool CHisEventManage::getValidTsdbConnPtr(iot_dbms::CTsdbConnPtr &ptr)
|
||||
bool CHisEventManage::getValidTsdbConnPtr(kbd_dbms::CTsdbConnPtr &ptr)
|
||||
{
|
||||
if(m_tsdbConnPtr != NULL)
|
||||
{
|
||||
|
||||
@ -19,7 +19,7 @@ public slots:
|
||||
void queryHisEventContrast(QList<int> selectedList, qint64 startTime, qint64 endTime, EN_STATIS_STYLE style);
|
||||
|
||||
private:
|
||||
bool getValidTsdbConnPtr(iot_dbms::CTsdbConnPtr &ptr);
|
||||
bool getValidTsdbConnPtr(kbd_dbms::CTsdbConnPtr &ptr);
|
||||
|
||||
signals:
|
||||
void updateHisEventStatis(const QMap<qint64, QMap<int, int> > &event);
|
||||
@ -27,7 +27,7 @@ signals:
|
||||
void updateHisEventContrast(const QMap<QString, QMap<int, int> > &event);
|
||||
|
||||
private:
|
||||
iot_dbms::CTsdbConnPtr m_tsdbConnPtr;
|
||||
kbd_dbms::CTsdbConnPtr m_tsdbConnPtr;
|
||||
};
|
||||
|
||||
#endif // CHISEVENTMANAGE_H
|
||||
|
||||
@ -28,7 +28,7 @@ CMainWidget::~CMainWidget()
|
||||
{
|
||||
if(!m_editMode)
|
||||
{
|
||||
iot_dbms::releaseTsdbApi();
|
||||
kbd_dbms::releaseTsdbApi();
|
||||
}
|
||||
|
||||
if(m_pHisEventManage)
|
||||
@ -76,7 +76,7 @@ void CMainWidget::initialize()
|
||||
|
||||
if(!m_editMode)
|
||||
{
|
||||
iot_dbms::initTsdbApi();
|
||||
kbd_dbms::initTsdbApi();
|
||||
|
||||
loadAlarmColor();
|
||||
|
||||
@ -87,7 +87,7 @@ void CMainWidget::initialize()
|
||||
void CMainWidget::initStyleSheet()
|
||||
{
|
||||
QString style = QString();
|
||||
std::string strFullPath = iot_public::CFileStyle
|
||||
std::string strFullPath = kbd_public::CFileStyle
|
||||
::getPathOfStyleFile("public.qss") ;
|
||||
QFile file1(QString::fromStdString(strFullPath));
|
||||
if (file1.open(QIODevice::ReadOnly))
|
||||
@ -98,7 +98,7 @@ void CMainWidget::initStyleSheet()
|
||||
}
|
||||
file1.close();
|
||||
|
||||
strFullPath = iot_public::CFileStyle
|
||||
strFullPath = kbd_public::CFileStyle
|
||||
::getPathOfStyleFile("AlarmStatisWidget.qss") ;
|
||||
QFile file2(QString::fromStdString(strFullPath));
|
||||
if (file2.open(QIODevice::ReadOnly))
|
||||
@ -116,7 +116,7 @@ void CMainWidget::initStyleSheet()
|
||||
|
||||
void CMainWidget::loadAlarmColor()
|
||||
{
|
||||
QString filePath = QString::fromStdString(iot_public::CFileUtil::getCurModuleDir())
|
||||
QString filePath = QString::fromStdString(kbd_public::CFileUtil::getCurModuleDir())
|
||||
+ QString("../../data/model/alarm_color_define.xml");
|
||||
|
||||
QDomDocument document;
|
||||
|
||||
@ -32,7 +32,7 @@ CTsdbQuery::~CTsdbQuery()
|
||||
{
|
||||
int64 resultSize = 0;
|
||||
//< 释放结果集
|
||||
std::vector<std::vector<iot_dbms::SHisEventPoint> *>::iterator res = m_pVecResult->begin();
|
||||
std::vector<std::vector<kbd_dbms::SHisEventPoint> *>::iterator res = m_pVecResult->begin();
|
||||
while(res != m_pVecResult->end())
|
||||
{
|
||||
resultSize += (*res)->size();
|
||||
@ -98,8 +98,8 @@ bool CTsdbQuery::queryEventByUnit(qint64 startTime, qint64 endTime, QMap<QString
|
||||
|
||||
for(size_t nIndex(0); nIndex < m_pVecResult->size(); nIndex++)
|
||||
{
|
||||
std::vector<iot_dbms::SHisEventPoint> *evetVector = m_pVecResult->at(nIndex);
|
||||
std::vector<iot_dbms::SHisEventPoint>::iterator iter = evetVector->begin();
|
||||
std::vector<kbd_dbms::SHisEventPoint> *evetVector = m_pVecResult->at(nIndex);
|
||||
std::vector<kbd_dbms::SHisEventPoint>::iterator iter = evetVector->begin();
|
||||
for(; iter != evetVector->end(); iter++)
|
||||
{
|
||||
int priority = getAlarmLevel(m_pVecMpKey->at(nIndex).m_pszTagName,
|
||||
@ -189,8 +189,8 @@ void CTsdbQuery::parseResult(qint64 startTime, qint64 endTime, EN_STATIS_MODE mo
|
||||
{
|
||||
for(size_t nIndex(0); nIndex < m_pVecResult->size(); nIndex++)
|
||||
{
|
||||
std::vector<iot_dbms::SHisEventPoint> *evetVector = m_pVecResult->at(nIndex);
|
||||
std::vector<iot_dbms::SHisEventPoint>::iterator iter = evetVector->begin();
|
||||
std::vector<kbd_dbms::SHisEventPoint> *evetVector = m_pVecResult->at(nIndex);
|
||||
std::vector<kbd_dbms::SHisEventPoint>::iterator iter = evetVector->begin();
|
||||
qint64 time = startTime;
|
||||
qint64 addTime = getAddMsecByMode(time, mode);
|
||||
for(; iter != evetVector->end(); iter++)
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#include "tsdb_api/TsdbApi.h"
|
||||
#include "db_his_query_api/DbHisQueryBase.h"
|
||||
|
||||
using namespace iot_dbms;
|
||||
using namespace kbd_dbms;
|
||||
class CTsdbQuery
|
||||
{
|
||||
public:
|
||||
@ -28,7 +28,7 @@ private:
|
||||
std::vector<std::vector<SHisEventPoint> *> *m_pVecResult;
|
||||
|
||||
private:
|
||||
iot_dbms::CTsdbConnPtr m_tsdbConnPtr;
|
||||
kbd_dbms::CTsdbConnPtr m_tsdbConnPtr;
|
||||
QString m_strDevice;
|
||||
};
|
||||
|
||||
|
||||
@ -7,23 +7,23 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
iot_public::StartLogSystem("HMI", "AlarmStatisWidget");
|
||||
if (!(iot_net::initMsgBus("HMI", "HMI")))
|
||||
kbd_public::StartLogSystem("HMI", "AlarmStatisWidget");
|
||||
if (!(kbd_net::initMsgBus("HMI", "HMI")))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
iot_service::CPermMngApiPtr perm = iot_service::getPermMngInstance("base");
|
||||
kbd_service::CPermMngApiPtr perm = kbd_service::getPermMngInstance("base");
|
||||
if(!perm || PERM_NORMAL != perm->PermDllInit())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(perm->SysLogin("admin", "admin", 1, 12*60*60, "hmi") != 0)
|
||||
if(perm->SysLogin("admin", "kbdct", 1, 12*60*60, "hmi") != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// iot_service::CDpcdaForApp::initGlobalThread();
|
||||
// kbd_service::CDpcdaForApp::initGlobalThread();
|
||||
|
||||
{
|
||||
LOGINFO("=========================== AlarmStatisWidget ===========================");
|
||||
@ -35,10 +35,10 @@ int main(int argc, char *argv[])
|
||||
app.exec();
|
||||
}
|
||||
|
||||
// iot_service::CDpcdaForApp::releaseGlobalThread();
|
||||
// kbd_service::CDpcdaForApp::releaseGlobalThread();
|
||||
|
||||
iot_net::releaseMsgBus();
|
||||
iot_public::StopLogSystem();
|
||||
kbd_net::releaseMsgBus();
|
||||
kbd_public::StopLogSystem();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ void CAccidentReviewDialog::initView()
|
||||
void CAccidentReviewDialog::initTree()
|
||||
{
|
||||
QMap<int, QList<QPair<int, ST_NODE>>> m_mapNav;
|
||||
readNavJson(QString::fromStdString(iot_public::CFileUtil::getCurModuleDir())
|
||||
readNavJson(QString::fromStdString(kbd_public::CFileUtil::getCurModuleDir())
|
||||
+ QString("../../data/model/NavigationWidget.json"), m_mapNav);
|
||||
QList<QPair<int, ST_NODE>> nodeList = m_mapNav.value(-1);
|
||||
for(int nIndex=0; nIndex<nodeList.length(); nIndex++)
|
||||
@ -78,7 +78,7 @@ void CAccidentReviewDialog::initTree()
|
||||
|
||||
void CAccidentReviewDialog::getFilterNames(const QString &path)
|
||||
{
|
||||
QString filePath = QString::fromStdString(iot_public::CFileUtil::getCurModuleDir())
|
||||
QString filePath = QString::fromStdString(kbd_public::CFileUtil::getCurModuleDir())
|
||||
+ QString("../../data/pic/");
|
||||
m_fileNameList = getAllFile(filePath, filePath, path);
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
#include "CAlarmMsgManage.h"
|
||||
#include <QDebug>
|
||||
#include "CAlarmDataCollect.h"
|
||||
using namespace iot_service;
|
||||
using namespace kbd_service;
|
||||
CAiAlarmDataCollect * CAiAlarmDataCollect::m_pInstance = NULL;
|
||||
CAiAlarmDataCollect::CAiAlarmDataCollect()
|
||||
: CIntelliAlmApi4Clt(),
|
||||
@ -12,7 +12,7 @@ CAiAlarmDataCollect::CAiAlarmDataCollect()
|
||||
m_pAlternateTimer(Q_NULLPTR)
|
||||
{
|
||||
m_rtdbMutex = new QMutex();
|
||||
m_rtdbPriorityOrderAccess = new iot_dbms::CRdbAccess();
|
||||
m_rtdbPriorityOrderAccess = new kbd_dbms::CRdbAccess();
|
||||
m_rtdbPriorityOrderAccess->open("base", "alarm_level_define");
|
||||
}
|
||||
|
||||
@ -68,25 +68,25 @@ bool CAiAlarmDataCollect::isFaultRecallState()
|
||||
return m_bFaultRecallState;
|
||||
}
|
||||
|
||||
bool CAiAlarmDataCollect::requestDelAlm(iot_idl::SIntelliAlmDel &objDelAlm)
|
||||
bool CAiAlarmDataCollect::requestDelAlm(kbd_idlfile::SIntelliAlmDel &objDelAlm)
|
||||
{
|
||||
LOGDEBUG("请求删除!");
|
||||
return iot_service::CIntelliAlmApi4Clt::requestDelAlm(objDelAlm);
|
||||
return kbd_service::CIntelliAlmApi4Clt::requestDelAlm(objDelAlm);
|
||||
}
|
||||
|
||||
bool CAiAlarmDataCollect::requestSeprAlm(iot_idl::SIntelliAlmSepr &objSeprAlm)
|
||||
bool CAiAlarmDataCollect::requestSeprAlm(kbd_idlfile::SIntelliAlmSepr &objSeprAlm)
|
||||
{
|
||||
LOGDEBUG("请求分离!");
|
||||
return iot_service::CIntelliAlmApi4Clt::requestSeprAlm(objSeprAlm);
|
||||
return kbd_service::CIntelliAlmApi4Clt::requestSeprAlm(objSeprAlm);
|
||||
}
|
||||
|
||||
bool CAiAlarmDataCollect::requestMergeAlm(iot_idl::SIntelliAlmMerge &objMergeAlm)
|
||||
bool CAiAlarmDataCollect::requestMergeAlm(kbd_idlfile::SIntelliAlmMerge &objMergeAlm)
|
||||
{
|
||||
LOGDEBUG("请求合并!");
|
||||
return iot_service::CIntelliAlmApi4Clt::requestMergeAlm(objMergeAlm);
|
||||
return kbd_service::CIntelliAlmApi4Clt::requestMergeAlm(objMergeAlm);
|
||||
}
|
||||
|
||||
void CAiAlarmDataCollect::handleAllAlmMsg(int nDomainId, iot_idl::SIntelliAlmAdd &objAllAlm)
|
||||
void CAiAlarmDataCollect::handleAllAlmMsg(int nDomainId, kbd_idlfile::SIntelliAlmAdd &objAllAlm)
|
||||
{
|
||||
LOGINFO("========== AiAlarmDataCollect handleAllAlmMsg ==========");
|
||||
|
||||
@ -98,7 +98,7 @@ void CAiAlarmDataCollect::handleAllAlmMsg(int nDomainId, iot_idl::SIntelliAlmAdd
|
||||
QList<AiAlarmMsgPtr> almList;
|
||||
for(int nAddMsgIndex(0); nAddMsgIndex < nAlarmCount; nAddMsgIndex++)
|
||||
{
|
||||
iot_idl::SIntelliAlmInfo msg = objAllAlm.alm_info(nAddMsgIndex);
|
||||
kbd_idlfile::SIntelliAlmInfo msg = objAllAlm.alm_info(nAddMsgIndex);
|
||||
AiAlarmMsgPtr alm(new CAiAlarmMsgInfo());
|
||||
alm->initialize(msg);
|
||||
alm->priorityOrder = queryPriorityOrder(alm->priority);
|
||||
@ -109,7 +109,7 @@ void CAiAlarmDataCollect::handleAllAlmMsg(int nDomainId, iot_idl::SIntelliAlmAdd
|
||||
emit sigMsgRefresh();
|
||||
}
|
||||
|
||||
void CAiAlarmDataCollect::handleAddAlmMsg(iot_idl::SIntelliAlmAdd &objAddAlm)
|
||||
void CAiAlarmDataCollect::handleAddAlmMsg(kbd_idlfile::SIntelliAlmAdd &objAddAlm)
|
||||
{
|
||||
LOGINFO("========== AiAlarmDataCollect handleAddAlmMsg ==========");
|
||||
QMutexLocker locker(m_rtdbMutex);
|
||||
@ -118,7 +118,7 @@ void CAiAlarmDataCollect::handleAddAlmMsg(iot_idl::SIntelliAlmAdd &objAddAlm)
|
||||
QList<AiAlarmMsgPtr> almList;
|
||||
for(int nAddMsgIndex(0); nAddMsgIndex < nAlarmCount; nAddMsgIndex++)
|
||||
{
|
||||
iot_idl::SIntelliAlmInfo msg = objAddAlm.alm_info(nAddMsgIndex);
|
||||
kbd_idlfile::SIntelliAlmInfo msg = objAddAlm.alm_info(nAddMsgIndex);
|
||||
AiAlarmMsgPtr alm(new CAiAlarmMsgInfo());
|
||||
alm->initialize(msg);
|
||||
alm->priorityOrder = queryPriorityOrder(alm->priority);
|
||||
@ -128,7 +128,7 @@ void CAiAlarmDataCollect::handleAddAlmMsg(iot_idl::SIntelliAlmAdd &objAddAlm)
|
||||
LOGDEBUG("AiAlarmDataCollect handleAddAlmMsg():count[%d]",nAlarmCount);
|
||||
}
|
||||
|
||||
void CAiAlarmDataCollect::handleDelAlmMsg(iot_idl::SIntelliAlmDel &objDelAlm)
|
||||
void CAiAlarmDataCollect::handleDelAlmMsg(kbd_idlfile::SIntelliAlmDel &objDelAlm)
|
||||
{
|
||||
LOGINFO("========== AiAlarmDataCollect handleDelAlmMsg ==========");
|
||||
QMutexLocker locker(m_rtdbMutex);
|
||||
@ -144,7 +144,7 @@ void CAiAlarmDataCollect::handleDelAlmMsg(iot_idl::SIntelliAlmDel &objDelAlm)
|
||||
LOGDEBUG("AiAlarmDataCollect handleDelAlmMsg():count[%d]",nAlarmCount);
|
||||
}
|
||||
|
||||
void CAiAlarmDataCollect::handleBrokenAlmMsg(iot_idl::SIntelliAlmBroken &objBrokenAlm)
|
||||
void CAiAlarmDataCollect::handleBrokenAlmMsg(kbd_idlfile::SIntelliAlmBroken &objBrokenAlm)
|
||||
{
|
||||
//先保证能够编译通过
|
||||
LOGINFO("========== AiAlarmDataCollect handleBrokenAlmMsg ==========");
|
||||
@ -160,7 +160,7 @@ void CAiAlarmDataCollect::handleBrokenAlmMsg(iot_idl::SIntelliAlmBroken &objBrok
|
||||
LOGDEBUG("AiAlarmDataCollect handleBrokenAlmMsg():count[%d]",nAlarmCount);
|
||||
}
|
||||
|
||||
void CAiAlarmDataCollect::handleReleaseAlmMsg(iot_idl::SIntelliAlmRelease &objReleaseAlm)
|
||||
void CAiAlarmDataCollect::handleReleaseAlmMsg(kbd_idlfile::SIntelliAlmRelease &objReleaseAlm)
|
||||
{
|
||||
//先保证能够编译通过
|
||||
LOGINFO("========== AiAlarmDataCollect handleReleaseAlmMsg ==========");
|
||||
@ -226,8 +226,8 @@ void CAiAlarmDataCollect::slotSwitchFaultRecallState(bool bFaultRecallState)
|
||||
|
||||
int CAiAlarmDataCollect::queryPriorityOrder(int &id)
|
||||
{
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbPriorityOrderAccess);
|
||||
iot_dbms::CVarType value = -1000;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbPriorityOrderAccess);
|
||||
kbd_dbms::CVarType value = -1000;
|
||||
m_rtdbPriorityOrderAccess->getColumnValueByKey((void*)&id, "priority_order", value);
|
||||
return value.toInt();
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
#include "net_msg_bus_api/MsgBusApi.h"
|
||||
#include "dbms/rdb_api/CRdbAccess.h"
|
||||
|
||||
class CAiAlarmDataCollect : public QObject, public iot_service::CIntelliAlmApi4Clt
|
||||
class CAiAlarmDataCollect : public QObject, public kbd_service::CIntelliAlmApi4Clt
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -25,21 +25,21 @@ public:
|
||||
|
||||
bool isFaultRecallState();
|
||||
|
||||
virtual bool requestDelAlm(iot_idl::SIntelliAlmDel &objDelAlm);
|
||||
virtual bool requestDelAlm(kbd_idlfile::SIntelliAlmDel &objDelAlm);
|
||||
|
||||
virtual bool requestSeprAlm(iot_idl::SIntelliAlmSepr &objSeprAlm);
|
||||
virtual bool requestSeprAlm(kbd_idlfile::SIntelliAlmSepr &objSeprAlm);
|
||||
|
||||
virtual bool requestMergeAlm(iot_idl::SIntelliAlmMerge &objMergeAlm);
|
||||
virtual bool requestMergeAlm(kbd_idlfile::SIntelliAlmMerge &objMergeAlm);
|
||||
|
||||
virtual void handleAllAlmMsg(int nDomainId,iot_idl::SIntelliAlmAdd &objAllAlm);
|
||||
virtual void handleAllAlmMsg(int nDomainId,kbd_idlfile::SIntelliAlmAdd &objAllAlm);
|
||||
|
||||
virtual void handleAddAlmMsg(iot_idl::SIntelliAlmAdd &objAddAlm);
|
||||
virtual void handleAddAlmMsg(kbd_idlfile::SIntelliAlmAdd &objAddAlm);
|
||||
|
||||
virtual void handleDelAlmMsg(iot_idl::SIntelliAlmDel &objDelAlm);
|
||||
virtual void handleDelAlmMsg(kbd_idlfile::SIntelliAlmDel &objDelAlm);
|
||||
|
||||
virtual void handleBrokenAlmMsg(iot_idl::SIntelliAlmBroken &objBrokenAlm);
|
||||
virtual void handleBrokenAlmMsg(kbd_idlfile::SIntelliAlmBroken &objBrokenAlm);
|
||||
|
||||
virtual void handleReleaseAlmMsg(iot_idl::SIntelliAlmRelease &objReleaseAlm);
|
||||
virtual void handleReleaseAlmMsg(kbd_idlfile::SIntelliAlmRelease &objReleaseAlm);
|
||||
signals:
|
||||
//< 启停定时器
|
||||
void sigTimerShot(const bool bStop);
|
||||
@ -77,7 +77,7 @@ private:
|
||||
bool m_bFaultRecallState;
|
||||
QMutex *m_rtdbMutex;
|
||||
QTimer * m_pAlternateTimer;
|
||||
iot_dbms::CRdbAccess * m_rtdbPriorityOrderAccess;
|
||||
kbd_dbms::CRdbAccess * m_rtdbPriorityOrderAccess;
|
||||
static CAiAlarmDataCollect * m_pInstance;
|
||||
};
|
||||
|
||||
|
||||
@ -380,8 +380,8 @@ bool CAiAlarmDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, con
|
||||
wave = QString("%1%2%3").arg("\"").arg(wave).arg("\"");
|
||||
LOGINFO("录波文件为:%s",wave.toStdString().c_str());
|
||||
|
||||
const std::string strProc = std::move(iot_public::CFileUtil::getPathOfBinFile(
|
||||
std::string("WaveAnalyze") + iot_public::CFileUtil::getProcSuffix()));
|
||||
const std::string strProc = std::move(kbd_public::CFileUtil::getPathOfBinFile(
|
||||
std::string("WaveAnalyze") + kbd_public::CFileUtil::getProcSuffix()));
|
||||
if(strProc.empty())
|
||||
LOGERROR("未找到可执行文件WaveAnalyze");
|
||||
else
|
||||
@ -401,8 +401,8 @@ void CAiAlarmDelegate::slotLoadConfig()
|
||||
CAlarmSetMng::instance()->getEmptyInfo(m_emptyBackgroundColor,m_emptyTipColor,m_emptyTip);
|
||||
//CAlarmColorMng::instance()->getActAndFunc(m_act,m_func);
|
||||
|
||||
std::string style = iot_public::CFileStyle::getCurStyle();
|
||||
m_strTrendPath = iot_public::CFileUtil::getPathOfResFile("gui/icon/alarm/trend_"+style+".png").c_str();
|
||||
m_strVideoPath = iot_public::CFileUtil::getPathOfResFile("gui/icon/alarm/video_"+style+".png").c_str();
|
||||
m_strWavePath = iot_public::CFileUtil::getPathOfResFile("gui/icon/alarm/wave_"+style+".png").c_str();
|
||||
std::string style = kbd_public::CFileStyle::getCurStyle();
|
||||
m_strTrendPath = kbd_public::CFileUtil::getPathOfResFile("gui/icon/alarm/trend_"+style+".png").c_str();
|
||||
m_strVideoPath = kbd_public::CFileUtil::getPathOfResFile("gui/icon/alarm/video_"+style+".png").c_str();
|
||||
m_strWavePath = kbd_public::CFileUtil::getPathOfResFile("gui/icon/alarm/wave_"+style+".png").c_str();
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ CAiAlarmMsgInfo::CAiAlarmMsgInfo(const CAiAlarmMsgInfo &other): priority(0)
|
||||
m_tagname_type = other.m_tagname_type;
|
||||
}
|
||||
|
||||
void CAiAlarmMsgInfo::initialize(const iot_idl::SIntelliAlmInfo &alarmInfo)
|
||||
void CAiAlarmMsgInfo::initialize(const kbd_idlfile::SIntelliAlmInfo &alarmInfo)
|
||||
{
|
||||
|
||||
logic_state = (E_AiALARM_LOGICSTATE)alarmInfo.logic_state();
|
||||
|
||||
@ -21,7 +21,7 @@ class CAiAlarmMsgInfo
|
||||
public:
|
||||
CAiAlarmMsgInfo();
|
||||
CAiAlarmMsgInfo(const CAiAlarmMsgInfo &other);
|
||||
void initialize(const iot_idl::SIntelliAlmInfo &alarmInfo);
|
||||
void initialize(const kbd_idlfile::SIntelliAlmInfo &alarmInfo);
|
||||
|
||||
//< [优先级越小表示越大]-智能告警窗调用
|
||||
bool ailessThan(const AlarmMsgPtr &info, E_ALARM_SORTKEY sortkey = E_SORT_PRIORITY);
|
||||
|
||||
@ -2,25 +2,13 @@
|
||||
#include "perm_mng_api/PermMngApi.h"
|
||||
#include "CAlarmCommon.h"
|
||||
#include "pub_logger_api/logger.h"
|
||||
|
||||
//< 屏蔽xml_parser编译告警
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
|
||||
#endif
|
||||
|
||||
#include "boost/property_tree/xml_parser.hpp"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#include "boost/typeof/typeof.hpp"
|
||||
#include "boost/filesystem.hpp"
|
||||
#include "pub_utility_api/FileUtil.h"
|
||||
#include "pub_utility_api/CharUtil.h"
|
||||
|
||||
using namespace iot_public;
|
||||
using namespace kbd_public;
|
||||
using namespace std;
|
||||
|
||||
CAlarmBaseData *CAlarmBaseData::pInstance = NULL;
|
||||
@ -100,8 +88,8 @@ CAlarmBaseData::CAlarmBaseData(QObject *parent) :
|
||||
QObject(parent),
|
||||
m_rtdbAccess(Q_NULLPTR)
|
||||
{
|
||||
m_rtdbAccess = new iot_dbms::CRdbAccess();
|
||||
m_pWriteDb = new iot_dbms::CDbApi(DB_CONN_MODEL_WRITE);
|
||||
m_rtdbAccess = new kbd_dbms::CRdbAccess();
|
||||
m_pWriteDb = new kbd_dbms::CDbApi(DB_CONN_MODEL_WRITE);
|
||||
m_pWriteDb->open();
|
||||
createSysInfoInstance(m_ptrSysInfo);
|
||||
initData();
|
||||
@ -109,7 +97,7 @@ CAlarmBaseData::CAlarmBaseData(QObject *parent) :
|
||||
|
||||
void CAlarmBaseData::loadPermInfo()
|
||||
{
|
||||
iot_service::CPermMngApiPtr permMngPtr = iot_service::getPermMngInstance("base");
|
||||
kbd_service::CPermMngApiPtr permMngPtr = kbd_service::getPermMngInstance("base");
|
||||
m_listPermLocationId.clear();
|
||||
m_listPermRegionId.clear();
|
||||
if(permMngPtr != NULL)
|
||||
@ -151,7 +139,7 @@ int CAlarmBaseData::queryDomainIdByLocId(int loactionId)
|
||||
if(m_ptrSysInfo)
|
||||
{
|
||||
SLocationInfo stLocationInfo;
|
||||
if(iotSuccess == m_ptrSysInfo->getLocationInfoById(loactionId, stLocationInfo))
|
||||
if(kbdSuccess == m_ptrSysInfo->getLocationInfoById(loactionId, stLocationInfo))
|
||||
{
|
||||
return stLocationInfo.nDomainId;
|
||||
}
|
||||
@ -166,12 +154,12 @@ bool CAlarmBaseData::queryAllPointDevGroup(int nDomainId, int nSubsystemId, cons
|
||||
return false;
|
||||
}
|
||||
SAppInfo stAppInfo;
|
||||
if(iotSuccess != m_ptrSysInfo->getAppInfoBySubsystemId(nSubsystemId, stAppInfo))
|
||||
if(kbdSuccess != m_ptrSysInfo->getAppInfoBySubsystemId(nSubsystemId, stAppInfo))
|
||||
{
|
||||
LOGERROR("queryAllPointDevGroup 获取应用ID失败");
|
||||
return false;
|
||||
}
|
||||
iot_dbms::CRdbNetApi rdbNetApi;
|
||||
kbd_dbms::CRdbNetApi rdbNetApi;
|
||||
rdbNetApi.connect(nDomainId, stAppInfo.nId);
|
||||
|
||||
//< 查询所有设备
|
||||
@ -271,8 +259,8 @@ void CAlarmBaseData::loadPriorityDescription()
|
||||
m_priorityDescriptionMap.clear();
|
||||
m_priorityOrderDescriptionMap.clear();
|
||||
m_priorityPermDescriptionMap.clear();
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
iot_dbms::CRdbQueryResult result;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
kbd_dbms::CRdbQueryResult result;
|
||||
std::vector<std::string> columns;
|
||||
columns.push_back("priority_id");
|
||||
columns.push_back("priority_order");
|
||||
@ -282,9 +270,9 @@ void CAlarmBaseData::loadPriorityDescription()
|
||||
{
|
||||
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||
{
|
||||
iot_dbms::CVarType key;
|
||||
iot_dbms::CVarType order;
|
||||
iot_dbms::CVarType value;
|
||||
kbd_dbms::CVarType key;
|
||||
kbd_dbms::CVarType order;
|
||||
kbd_dbms::CVarType value;
|
||||
result.getColumnValue(nIndex, 0, key);
|
||||
result.getColumnValue(nIndex, 1, order);
|
||||
result.getColumnValue(nIndex, 2, value);
|
||||
@ -308,8 +296,8 @@ void CAlarmBaseData::loadLocationDescription()
|
||||
m_locationDescriptionMap.clear();
|
||||
m_locationPermDescriptionMap.clear();
|
||||
m_listPermLocationOrder.clear();
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
iot_dbms::CRdbQueryResult result;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
kbd_dbms::CRdbQueryResult result;
|
||||
std::vector<std::string> columns;
|
||||
columns.push_back("location_id");
|
||||
columns.push_back("description");
|
||||
@ -322,11 +310,11 @@ void CAlarmBaseData::loadLocationDescription()
|
||||
{
|
||||
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||
{
|
||||
iot_dbms::CVarType id;
|
||||
iot_dbms::CVarType desc;
|
||||
iot_dbms::CVarType tag;
|
||||
iot_dbms::CVarType type;
|
||||
iot_dbms::CVarType pid;
|
||||
kbd_dbms::CVarType id;
|
||||
kbd_dbms::CVarType desc;
|
||||
kbd_dbms::CVarType tag;
|
||||
kbd_dbms::CVarType type;
|
||||
kbd_dbms::CVarType pid;
|
||||
result.getColumnValue(nIndex, 0, id);
|
||||
result.getColumnValue(nIndex, 1, desc);
|
||||
result.getColumnValue(nIndex, 2, tag);
|
||||
@ -401,8 +389,8 @@ void CAlarmBaseData::loadRegionDescription()
|
||||
{
|
||||
m_regionDescriptionMap.clear();
|
||||
m_regionPermDescriptionMap.clear();
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
iot_dbms::CRdbQueryResult result;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
kbd_dbms::CRdbQueryResult result;
|
||||
std::vector<std::string> columns;
|
||||
columns.push_back("region_id");
|
||||
columns.push_back("description");
|
||||
@ -411,8 +399,8 @@ void CAlarmBaseData::loadRegionDescription()
|
||||
{
|
||||
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||
{
|
||||
iot_dbms::CVarType key;
|
||||
iot_dbms::CVarType value;
|
||||
kbd_dbms::CVarType key;
|
||||
kbd_dbms::CVarType value;
|
||||
result.getColumnValue(nIndex, 0, key);
|
||||
result.getColumnValue(nIndex, 1, value);
|
||||
if(m_listPermRegionId.contains(key.toInt()))
|
||||
@ -432,8 +420,8 @@ void CAlarmBaseData::loadAlarmTypeDescription()
|
||||
if(m_rtdbAccess->open("base", "alarm_type_define"))
|
||||
{
|
||||
m_alarmTypeDescriptionMap.clear();
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
iot_dbms::CRdbQueryResult result;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
kbd_dbms::CRdbQueryResult result;
|
||||
std::vector<std::string> columns;
|
||||
columns.push_back("type_id");
|
||||
columns.push_back("type_name");
|
||||
@ -442,8 +430,8 @@ void CAlarmBaseData::loadAlarmTypeDescription()
|
||||
{
|
||||
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||
{
|
||||
iot_dbms::CVarType key;
|
||||
iot_dbms::CVarType value;
|
||||
kbd_dbms::CVarType key;
|
||||
kbd_dbms::CVarType value;
|
||||
result.getColumnValue(nIndex, 0, key);
|
||||
result.getColumnValue(nIndex, 1, value);
|
||||
m_alarmTypeDescriptionMap[key.toInt()] = QString::fromStdString(value.toStdString());
|
||||
@ -457,8 +445,8 @@ void CAlarmBaseData::loadAlarmStatusDescription()
|
||||
if(m_rtdbAccess->open("base", "alarm_status_define"))
|
||||
{
|
||||
m_alarmStatusDescriptionMap.clear();
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
iot_dbms::CRdbQueryResult result;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
kbd_dbms::CRdbQueryResult result;
|
||||
std::vector<std::string> columns;
|
||||
columns.push_back("status_value");
|
||||
columns.push_back("display_name");
|
||||
@ -467,8 +455,8 @@ void CAlarmBaseData::loadAlarmStatusDescription()
|
||||
{
|
||||
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||
{
|
||||
iot_dbms::CVarType key;
|
||||
iot_dbms::CVarType value;
|
||||
kbd_dbms::CVarType key;
|
||||
kbd_dbms::CVarType value;
|
||||
result.getColumnValue(nIndex, 0, key);
|
||||
result.getColumnValue(nIndex, 1, value);
|
||||
m_alarmStatusDescriptionMap[key.toInt()] = QString::fromStdString(value.toStdString());
|
||||
@ -482,8 +470,8 @@ void CAlarmBaseData::loadDeviceTypeDescription()
|
||||
if(m_rtdbAccess->open("base", "dev_type_def"))
|
||||
{
|
||||
m_deviceTypeDescriptionMap.clear();
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
iot_dbms::CRdbQueryResult result;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
kbd_dbms::CRdbQueryResult result;
|
||||
std::vector<std::string> columns;
|
||||
columns.push_back("dev_type_id");
|
||||
columns.push_back("description");
|
||||
@ -492,8 +480,8 @@ void CAlarmBaseData::loadDeviceTypeDescription()
|
||||
{
|
||||
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||
{
|
||||
iot_dbms::CVarType key;
|
||||
iot_dbms::CVarType value;
|
||||
kbd_dbms::CVarType key;
|
||||
kbd_dbms::CVarType value;
|
||||
result.getColumnValue(nIndex, 0, key);
|
||||
result.getColumnValue(nIndex, 1, value);
|
||||
m_deviceTypeDescriptionMap[key.toInt()] = QString::fromStdString(value.toStdString());
|
||||
@ -507,8 +495,8 @@ void CAlarmBaseData::loadDeviceGroupDescription()
|
||||
if(m_rtdbAccess->open("base", "dev_group"))
|
||||
{
|
||||
m_deviceGroupDescriptionMap.clear();
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
iot_dbms::CRdbQueryResult result;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
kbd_dbms::CRdbQueryResult result;
|
||||
std::vector<std::string> columns;
|
||||
columns.push_back("tag_name");
|
||||
columns.push_back("description");
|
||||
@ -517,8 +505,8 @@ void CAlarmBaseData::loadDeviceGroupDescription()
|
||||
{
|
||||
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||
{
|
||||
iot_dbms::CVarType key;
|
||||
iot_dbms::CVarType value;
|
||||
kbd_dbms::CVarType key;
|
||||
kbd_dbms::CVarType value;
|
||||
result.getColumnValue(nIndex, 0, key);
|
||||
result.getColumnValue(nIndex, 1, value);
|
||||
m_deviceGroupDescriptionMap[QString::fromStdString(key.toStdString())] = QString::fromStdString(value.toStdString());
|
||||
@ -529,7 +517,7 @@ void CAlarmBaseData::loadDeviceGroupDescription()
|
||||
|
||||
void CAlarmBaseData::loadAlarmShowStatusDescription()
|
||||
{
|
||||
const std::string strConfFullPath = iot_public::CFileUtil::getPathOfCfgFile("alarmStatus.xml");
|
||||
const std::string strConfFullPath = kbd_public::CFileUtil::getPathOfCfgFile("alarmStatus.xml");
|
||||
boost::property_tree::ptree pt;
|
||||
namespace xml = boost::property_tree::xml_parser;
|
||||
m_alarmShowStatusDescriptionMap.clear();
|
||||
@ -565,7 +553,7 @@ void CAlarmBaseData::loadAlarmShowStatusDescription()
|
||||
|
||||
void CAlarmBaseData::loadAlarmOtherStatusDescription()
|
||||
{
|
||||
const std::string strConfFullPath = iot_public::CFileUtil::getPathOfCfgFile("alarmOther.xml");
|
||||
const std::string strConfFullPath = kbd_public::CFileUtil::getPathOfCfgFile("alarmOther.xml");
|
||||
boost::property_tree::ptree pt;
|
||||
namespace xml = boost::property_tree::xml_parser;
|
||||
m_alarmOtherStatusDescriptionMap.clear();
|
||||
@ -593,21 +581,21 @@ void CAlarmBaseData::loadAlarmOtherStatusDescription()
|
||||
}
|
||||
}
|
||||
|
||||
bool CAlarmBaseData::queryAllDeviceDevGroup(iot_dbms::CRdbNetApi &rdbNetApi, const QString &devg, QList<QString> &devList)
|
||||
bool CAlarmBaseData::queryAllDeviceDevGroup(kbd_dbms::CRdbNetApi &rdbNetApi, const QString &devg, QList<QString> &devList)
|
||||
{
|
||||
//< 查询设备组所有设备
|
||||
iot_idl::RdbQuery msgQuery;
|
||||
kbd_idlfile::RdbQuery msgQuery;
|
||||
msgQuery.set_strtablename("dev_info");
|
||||
msgQuery.add_strselectcolnamearr("tag_name");
|
||||
iot_idl::RdbCondition *pCondtion = msgQuery.add_msgcondition();
|
||||
pCondtion->set_enlogic(iot_idl::ENConditionLogic::enumCondAnd);
|
||||
pCondtion->set_enrelation(iot_idl::ENConditionRelation::enumCondEqual);
|
||||
kbd_idlfile::RdbCondition *pCondtion = msgQuery.add_msgcondition();
|
||||
pCondtion->set_enlogic(kbd_idlfile::ENConditionLogic::enumCondAnd);
|
||||
pCondtion->set_enrelation(kbd_idlfile::ENConditionRelation::enumCondEqual);
|
||||
pCondtion->set_strcolumnname("group_tag_name");
|
||||
iot_idl::SVariable *pCondValue = pCondtion->mutable_msgvalue();
|
||||
pCondValue->set_edatatype(iot_idl::DataType::CN_DATATYPE_STRING);
|
||||
kbd_idlfile::SVariable *pCondValue = pCondtion->mutable_msgvalue();
|
||||
pCondValue->set_edatatype(kbd_idlfile::DataType::CN_DATATYPE_STRING);
|
||||
pCondValue->set_strvalue(devg.toStdString());
|
||||
|
||||
iot_idl::RdbRet retMsg;
|
||||
kbd_idlfile::RdbRet retMsg;
|
||||
bool bRet;
|
||||
bRet = rdbNetApi.query(msgQuery, retMsg);
|
||||
if (false == bRet)
|
||||
@ -631,20 +619,20 @@ bool CAlarmBaseData::queryAllDeviceDevGroup(iot_dbms::CRdbNetApi &rdbNetApi, con
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CAlarmBaseData::queryAllPointDevice(iot_dbms::CRdbNetApi &rdbNetApi, const QString &device, const QString &table, QList<QString> &pointList)
|
||||
bool CAlarmBaseData::queryAllPointDevice(kbd_dbms::CRdbNetApi &rdbNetApi, const QString &device, const QString &table, QList<QString> &pointList)
|
||||
{
|
||||
iot_idl::RdbQuery msgQuery;
|
||||
kbd_idlfile::RdbQuery msgQuery;
|
||||
msgQuery.set_strtablename(table.toStdString().c_str());
|
||||
msgQuery.add_strselectcolnamearr("tag_name");
|
||||
iot_idl::RdbCondition *pCondtion = msgQuery.add_msgcondition();
|
||||
pCondtion->set_enlogic(iot_idl::ENConditionLogic::enumCondAnd);
|
||||
pCondtion->set_enrelation(iot_idl::ENConditionRelation::enumCondEqual);
|
||||
kbd_idlfile::RdbCondition *pCondtion = msgQuery.add_msgcondition();
|
||||
pCondtion->set_enlogic(kbd_idlfile::ENConditionLogic::enumCondAnd);
|
||||
pCondtion->set_enrelation(kbd_idlfile::ENConditionRelation::enumCondEqual);
|
||||
pCondtion->set_strcolumnname("device");
|
||||
iot_idl::SVariable *pCondValue = pCondtion->mutable_msgvalue();
|
||||
pCondValue->set_edatatype(iot_idl::DataType::CN_DATATYPE_STRING);
|
||||
kbd_idlfile::SVariable *pCondValue = pCondtion->mutable_msgvalue();
|
||||
pCondValue->set_edatatype(kbd_idlfile::DataType::CN_DATATYPE_STRING);
|
||||
pCondValue->set_strvalue(device.toStdString().c_str());
|
||||
|
||||
iot_idl::RdbRet retMsg;
|
||||
kbd_idlfile::RdbRet retMsg;
|
||||
bool bRet;
|
||||
bRet = rdbNetApi.query(msgQuery, retMsg);
|
||||
if (false == bRet)
|
||||
|
||||
@ -154,7 +154,7 @@ private:
|
||||
* @param rdbNetApi
|
||||
* @param devg
|
||||
*/
|
||||
bool queryAllDeviceDevGroup(iot_dbms::CRdbNetApi &rdbNetApi, const QString &devg, QList<QString> &devList);
|
||||
bool queryAllDeviceDevGroup(kbd_dbms::CRdbNetApi &rdbNetApi, const QString &devg, QList<QString> &devList);
|
||||
/**
|
||||
* @brief queryAllPointDevice 查询表中设备下所有测点
|
||||
* @param rdbNetApi
|
||||
@ -163,13 +163,13 @@ private:
|
||||
* @param pointList "digital.station.G01_dlq.r.value"
|
||||
* @return
|
||||
*/
|
||||
bool queryAllPointDevice(iot_dbms::CRdbNetApi &rdbNetApi, const QString &device, const QString &table, QList<QString> &pointList);
|
||||
bool queryAllPointDevice(kbd_dbms::CRdbNetApi &rdbNetApi, const QString &device, const QString &table, QList<QString> &pointList);
|
||||
|
||||
private:
|
||||
static CAlarmBaseData * pInstance;
|
||||
iot_dbms::CRdbAccess * m_rtdbAccess;
|
||||
iot_dbms::CDbApi *m_pWriteDb;
|
||||
iot_public::CSysInfoInterfacePtr m_ptrSysInfo;
|
||||
kbd_dbms::CRdbAccess * m_rtdbAccess;
|
||||
kbd_dbms::CDbApi *m_pWriteDb;
|
||||
kbd_public::CSysInfoInterfacePtr m_ptrSysInfo;
|
||||
QList<int> m_listPermLocationId; //< 原始告警车站权限
|
||||
QList<int> m_listPermRegionId; //< 原始告警责任区权限
|
||||
QList<int> m_listPermLocationOrder; //< 有权限的loaction_id: 按location_no排序
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
#include "CAiAlarmDataCollect.h"
|
||||
#include "alarm_server_api/AlarmCommonDef.h"
|
||||
|
||||
using namespace iot_service;
|
||||
using namespace iot_dbms;
|
||||
using namespace kbd_service;
|
||||
using namespace kbd_dbms;
|
||||
CAlarmDataCollect * CAlarmDataCollect::m_pInstance = NULL;
|
||||
|
||||
CAlarmDataCollect::CAlarmDataCollect()
|
||||
@ -20,7 +20,7 @@ CAlarmDataCollect::CAlarmDataCollect()
|
||||
m_removeNum(0)
|
||||
{
|
||||
m_rtdbMutex = new QMutex();
|
||||
m_rtdbAccess = new iot_dbms::CRdbAccess();
|
||||
m_rtdbAccess = new kbd_dbms::CRdbAccess();
|
||||
m_rtdbAccess->open("base", "alarm_level_define");
|
||||
}
|
||||
|
||||
@ -138,17 +138,17 @@ void CAlarmDataCollect::slotSwitchFaultRecallState(bool bFaultRecallState)
|
||||
emit sigAlarmOperateEnable(!m_bFaultRecallState);
|
||||
}
|
||||
|
||||
bool CAlarmDataCollect::requestCfmAlm(iot_idl::SAlmCltCfmAlm &objCfmAlm)
|
||||
bool CAlarmDataCollect::requestCfmAlm(kbd_idlfile::SAlmCltCfmAlm &objCfmAlm)
|
||||
{
|
||||
return iot_service::CAlmApiForAlmClt::requestCfmAlm(objCfmAlm);
|
||||
return kbd_service::CAlmApiForAlmClt::requestCfmAlm(objCfmAlm);
|
||||
}
|
||||
|
||||
bool CAlarmDataCollect::requestDelAlm(iot_idl::SAlmCltDelAlm &objDelAlm)
|
||||
bool CAlarmDataCollect::requestDelAlm(kbd_idlfile::SAlmCltDelAlm &objDelAlm)
|
||||
{
|
||||
return iot_service::CAlmApiForAlmClt::requestDelAlm(objDelAlm);
|
||||
return kbd_service::CAlmApiForAlmClt::requestDelAlm(objDelAlm);
|
||||
}
|
||||
|
||||
void CAlarmDataCollect::handleAllAlmMsg(int domainId, iot_idl::SAlmCltAddAlm &objAllAlm)
|
||||
void CAlarmDataCollect::handleAllAlmMsg(int domainId, kbd_idlfile::SAlmCltAddAlm &objAllAlm)
|
||||
{
|
||||
if(!m_referenceCount)
|
||||
{
|
||||
@ -165,7 +165,7 @@ void CAlarmDataCollect::handleAllAlmMsg(int domainId, iot_idl::SAlmCltAddAlm &ob
|
||||
QList<AlarmMsgPtr> almList;
|
||||
for(int nAddMsgIndex(0); nAddMsgIndex < nAlarmCount; nAddMsgIndex++)
|
||||
{
|
||||
iot_idl::SAlmInfoToAlmClt msg = objAllAlm.alm_info(nAddMsgIndex);
|
||||
kbd_idlfile::SAlmInfoToAlmClt msg = objAllAlm.alm_info(nAddMsgIndex);
|
||||
AlarmMsgPtr alm(new CAlarmMsgInfo());
|
||||
alm->initialize(msg);
|
||||
alm->priorityOrder = queryPriorityOrder(alm->priority);
|
||||
@ -194,7 +194,7 @@ void CAlarmDataCollect::handleAllAlmMsg(int domainId, iot_idl::SAlmCltAddAlm &ob
|
||||
}
|
||||
}
|
||||
|
||||
void CAlarmDataCollect::handleAddAlmMsg(iot_idl::SAlmCltAddAlm &objAddAlm)
|
||||
void CAlarmDataCollect::handleAddAlmMsg(kbd_idlfile::SAlmCltAddAlm &objAddAlm)
|
||||
{
|
||||
if(!m_referenceCount)
|
||||
{
|
||||
@ -207,7 +207,7 @@ void CAlarmDataCollect::handleAddAlmMsg(iot_idl::SAlmCltAddAlm &objAddAlm)
|
||||
QList<AlarmMsgPtr> almList;
|
||||
for(int nAddMsgIndex(0); nAddMsgIndex < nAlarmCount; nAddMsgIndex++)
|
||||
{
|
||||
iot_idl::SAlmInfoToAlmClt msg = objAddAlm.alm_info(nAddMsgIndex);
|
||||
kbd_idlfile::SAlmInfoToAlmClt msg = objAddAlm.alm_info(nAddMsgIndex);
|
||||
AlarmMsgPtr alm(new CAlarmMsgInfo());
|
||||
alm->initialize(msg);
|
||||
alm->priorityOrder = queryPriorityOrder(alm->priority);
|
||||
@ -227,7 +227,7 @@ void CAlarmDataCollect::handleAddAlmMsg(iot_idl::SAlmCltAddAlm &objAddAlm)
|
||||
LOGINFO("handleAddAlmMsg END[%d] ",nAlarmCount);
|
||||
}
|
||||
|
||||
void CAlarmDataCollect::handleCfmAlmMsg(iot_idl::SAlmCltCfmAlm &objCfmAlm)
|
||||
void CAlarmDataCollect::handleCfmAlmMsg(kbd_idlfile::SAlmCltCfmAlm &objCfmAlm)
|
||||
{
|
||||
if(!m_referenceCount)
|
||||
{
|
||||
@ -247,7 +247,7 @@ void CAlarmDataCollect::handleCfmAlmMsg(iot_idl::SAlmCltCfmAlm &objCfmAlm)
|
||||
LOGINFO("handleCfmAlmMsg END[%d] ",nAlarmCount);
|
||||
}
|
||||
|
||||
void CAlarmDataCollect::handleDelAlmMsg(iot_idl::SAlmCltDelAlm &objDelAlm)
|
||||
void CAlarmDataCollect::handleDelAlmMsg(kbd_idlfile::SAlmCltDelAlm &objDelAlm)
|
||||
{
|
||||
if(!m_referenceCount)
|
||||
{
|
||||
@ -269,7 +269,7 @@ void CAlarmDataCollect::handleDelAlmMsg(iot_idl::SAlmCltDelAlm &objDelAlm)
|
||||
LOGINFO("handleDelAlmMsg END[%d] ",nAlarmCount);
|
||||
}
|
||||
|
||||
void CAlarmDataCollect::handleReleaseAlmMsg(iot_idl::SAlmCltReleaseAlm &objRelAlm)
|
||||
void CAlarmDataCollect::handleReleaseAlmMsg(kbd_idlfile::SAlmCltReleaseAlm &objRelAlm)
|
||||
{
|
||||
if(!m_referenceCount)
|
||||
{
|
||||
@ -291,7 +291,7 @@ void CAlarmDataCollect::handleReleaseAlmMsg(iot_idl::SAlmCltReleaseAlm &objRelAl
|
||||
LOGINFO("handleReleaseAlmMsg END[%d] ",nAlarmCount);
|
||||
}
|
||||
|
||||
void CAlarmDataCollect::handleLinkWave2AlmMsg(iot_idl::SAlmCltLinkWave2Alm &objWave2Alm)
|
||||
void CAlarmDataCollect::handleLinkWave2AlmMsg(kbd_idlfile::SAlmCltLinkWave2Alm &objWave2Alm)
|
||||
{
|
||||
if(!m_referenceCount)
|
||||
{
|
||||
@ -341,16 +341,16 @@ void CAlarmDataCollect::slotAlarmStateChanged()
|
||||
|
||||
int CAlarmDataCollect::queryPriorityOrder(int &id)
|
||||
{
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
iot_dbms::CVarType value = -1000;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
kbd_dbms::CVarType value = -1000;
|
||||
m_rtdbAccess->getColumnValueByKey((void*)&id, "priority_order", value);
|
||||
return value.toInt();
|
||||
}
|
||||
|
||||
int CAlarmDataCollect::queryAlarmAction(const int &priority)
|
||||
{
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
iot_dbms::CVarType value;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
kbd_dbms::CVarType value;
|
||||
m_rtdbAccess->getColumnValueByKey((void*)&priority, "alarm_actions",value);
|
||||
return value.toInt();
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
#include "net_msg_bus_api/MsgBusApi.h"
|
||||
#include "dbms/rdb_api/CRdbAccess.h"
|
||||
|
||||
class CAlarmDataCollect : public QObject, public iot_service::CAlmApiForAlmClt
|
||||
class CAlarmDataCollect : public QObject, public kbd_service::CAlmApiForAlmClt
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -25,21 +25,21 @@ public:
|
||||
|
||||
bool isFaultRecallState();
|
||||
|
||||
virtual bool requestCfmAlm(iot_idl::SAlmCltCfmAlm &objCfmAlm);
|
||||
virtual bool requestCfmAlm(kbd_idlfile::SAlmCltCfmAlm &objCfmAlm);
|
||||
|
||||
virtual bool requestDelAlm(iot_idl::SAlmCltDelAlm &objDelAlm);
|
||||
virtual bool requestDelAlm(kbd_idlfile::SAlmCltDelAlm &objDelAlm);
|
||||
|
||||
virtual void handleAllAlmMsg(int domainId, iot_idl::SAlmCltAddAlm &objAllAlm);
|
||||
virtual void handleAllAlmMsg(int domainId, kbd_idlfile::SAlmCltAddAlm &objAllAlm);
|
||||
|
||||
virtual void handleAddAlmMsg(iot_idl::SAlmCltAddAlm &objAddAlm);
|
||||
virtual void handleAddAlmMsg(kbd_idlfile::SAlmCltAddAlm &objAddAlm);
|
||||
|
||||
virtual void handleCfmAlmMsg(iot_idl::SAlmCltCfmAlm &objCfmAlm);
|
||||
virtual void handleCfmAlmMsg(kbd_idlfile::SAlmCltCfmAlm &objCfmAlm);
|
||||
|
||||
virtual void handleDelAlmMsg(iot_idl::SAlmCltDelAlm &objDelAlm);
|
||||
virtual void handleDelAlmMsg(kbd_idlfile::SAlmCltDelAlm &objDelAlm);
|
||||
|
||||
virtual void handleReleaseAlmMsg(iot_idl::SAlmCltReleaseAlm &objDelAlm);
|
||||
virtual void handleReleaseAlmMsg(kbd_idlfile::SAlmCltReleaseAlm &objDelAlm);
|
||||
|
||||
virtual void handleLinkWave2AlmMsg(iot_idl::SAlmCltLinkWave2Alm &objWave2Alm);
|
||||
virtual void handleLinkWave2AlmMsg(kbd_idlfile::SAlmCltLinkWave2Alm &objWave2Alm);
|
||||
|
||||
void refresh();
|
||||
signals:
|
||||
@ -95,9 +95,9 @@ private:
|
||||
bool m_bFaultRecallState; //是否处于事故追忆
|
||||
QMutex * m_rtdbMutex;
|
||||
QTimer * m_pAlternateTimer;
|
||||
iot_dbms::CRdbAccess * m_rtdbAccess;
|
||||
iot_dbms::CRdbAccess * m_rtdbAlmLvlDefTab; // 告警等级定义表
|
||||
iot_dbms::CRdbAccess * m_rtdbAlmActDefTab; // 告警动作定义表
|
||||
kbd_dbms::CRdbAccess * m_rtdbAccess;
|
||||
kbd_dbms::CRdbAccess * m_rtdbAlmLvlDefTab; // 告警等级定义表
|
||||
kbd_dbms::CRdbAccess * m_rtdbAlmActDefTab; // 告警动作定义表
|
||||
bool m_bIsNeedUpdate; //< 是否消息确认(每秒更新)
|
||||
bool m_bIsNeedRemove; //< 是否需要删除(每秒更新)
|
||||
bool m_bIsNeedRelease; //< 是否需要释放(每秒更新)-
|
||||
|
||||
@ -269,8 +269,8 @@ bool CAlarmDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const
|
||||
wave = QString("%1%2%3").arg("\"").arg(wave).arg("\"");
|
||||
LOGINFO("录波文件为:%s",wave.toStdString().c_str());
|
||||
|
||||
const std::string strProc = std::move(iot_public::CFileUtil::getPathOfBinFile(
|
||||
std::string("WaveAnalyze") + iot_public::CFileUtil::getProcSuffix()));
|
||||
const std::string strProc = std::move(kbd_public::CFileUtil::getPathOfBinFile(
|
||||
std::string("WaveAnalyze") + kbd_public::CFileUtil::getProcSuffix()));
|
||||
if(strProc.empty())
|
||||
LOGERROR("未找到可执行文件WaveAnalyze");
|
||||
else
|
||||
@ -300,8 +300,8 @@ void CAlarmDelegate::slotLoadConfig()
|
||||
m_isFlash = false;
|
||||
}
|
||||
|
||||
std::string style = iot_public::CFileStyle::getCurStyle();
|
||||
m_strTrendPath = iot_public::CFileUtil::getPathOfResFile("gui/icon/alarm/trend_"+style+".png").c_str();
|
||||
m_strVideoPath = iot_public::CFileUtil::getPathOfResFile("gui/icon/alarm/video_"+style+".png").c_str();
|
||||
m_strWavePath = iot_public::CFileUtil::getPathOfResFile("gui/icon/alarm/wave_"+style+".png").c_str();
|
||||
std::string style = kbd_public::CFileStyle::getCurStyle();
|
||||
m_strTrendPath = kbd_public::CFileUtil::getPathOfResFile("gui/icon/alarm/trend_"+style+".png").c_str();
|
||||
m_strVideoPath = kbd_public::CFileUtil::getPathOfResFile("gui/icon/alarm/video_"+style+".png").c_str();
|
||||
m_strWavePath = kbd_public::CFileUtil::getPathOfResFile("gui/icon/alarm/wave_"+style+".png").c_str();
|
||||
}
|
||||
|
||||
@ -37,20 +37,6 @@ void CAlarmDeviceTreeModel::setupModelData(const QMap<int, QVector<SDevGroupInfo
|
||||
QModelIndex modelIndex = createIndex(nDevIndex, 0, device);
|
||||
m_devTagIndex.insert(vec.at(nDevIndex).tag_name, modelIndex);
|
||||
m_devNameIndex.insert(locDesc + "." + vec.at(nDevIndex).description, modelIndex);
|
||||
|
||||
if(nDevIndex == vec.size() - 1)
|
||||
{
|
||||
CAlarmDeviceTreeItem * sys_device = new CAlarmDeviceTreeItem(".系统", location);
|
||||
sys_device->setData("", Qt::ItemDataRole(TagRole));
|
||||
sys_device->setData(TYPE_DEVGROUP, Qt::ItemDataRole(TypeRole));
|
||||
sys_device->setData(vec.at(nDevIndex).domain, Qt::ItemDataRole(DomainRole));
|
||||
sys_device->setData(vec.at(nDevIndex).location, Qt::ItemDataRole(LocationRole));
|
||||
sys_device->setData(vec.at(nDevIndex).sub_system, Qt::ItemDataRole(SubsystemRole));
|
||||
sys_device->setData(vec.at(nDevIndex).region, Qt::ItemDataRole(RegionRole));
|
||||
QModelIndex sys_modelIndex = createIndex(nDevIndex+1, 0, sys_device);
|
||||
m_devTagIndex.insert("", sys_modelIndex);
|
||||
m_devNameIndex.insert("", sys_modelIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -174,10 +160,8 @@ QVariant CAlarmDeviceTreeModel::data(const QModelIndex &index, int role) const
|
||||
if (Qt::DisplayRole == role)
|
||||
{
|
||||
const QString &deviceGroup = item->data(Qt::ItemDataRole(TagRole)).toString();
|
||||
int nType = item->data(Qt::ItemDataRole(TypeRole)).toInt();
|
||||
if(deviceGroup.isEmpty() && nType == TYPE_LOCATION)
|
||||
if(deviceGroup.isEmpty())
|
||||
{
|
||||
//区域后面不加数量
|
||||
return item->data(Qt::DisplayRole).toString();
|
||||
}
|
||||
return item->data(Qt::DisplayRole).toString() + QString(" [%1]").arg(m_alarmDeviceGroupStatistical.value(deviceGroup,0));
|
||||
|
||||
@ -10,7 +10,6 @@ CAlarmDeviceTreeView::CAlarmDeviceTreeView(QWidget *parent)
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
void CAlarmDeviceTreeView::contextMenuEvent(QContextMenuEvent *event)
|
||||
{
|
||||
CAlarmDeviceTreeModel * pModel = dynamic_cast<CAlarmDeviceTreeModel *>(model());
|
||||
@ -34,26 +33,25 @@ void CAlarmDeviceTreeView::contextMenuEvent(QContextMenuEvent *event)
|
||||
}
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
void CAlarmDeviceTreeView::contextMenuEvent(QContextMenuEvent *event)
|
||||
{
|
||||
CAlarmDeviceTreeModel * pModel = dynamic_cast<CAlarmDeviceTreeModel *>(model());
|
||||
if(Q_NULLPTR != pModel)
|
||||
{
|
||||
QMenu menu;
|
||||
CAlarmDeviceTreeItem * pItem = static_cast<CAlarmDeviceTreeItem*>(indexAt(event->pos()).internalPointer());
|
||||
if (Q_NULLPTR == pItem)
|
||||
{
|
||||
menu.addAction(tr("全选"), [=](){ pModel->setAllDeviceCheckState(Qt::Checked); });
|
||||
menu.addAction(tr("清空"), [=](){ pModel->setAllDeviceCheckState(Qt::Unchecked); });
|
||||
}
|
||||
else if (Q_NULLPTR != pItem && pItem->childCount() > 0)
|
||||
{
|
||||
menu.addAction(tr("选择"), [=](){ pModel->setDeviceCheckState(indexAt(event->pos()), Qt::Checked); });
|
||||
menu.addAction(tr("清除"), [=](){ pModel->setDeviceCheckState(indexAt(event->pos()), Qt::Unchecked); });
|
||||
}
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
return;
|
||||
}
|
||||
//void CAlarmDeviceTreeView::contextMenuEvent(QContextMenuEvent *event)
|
||||
//{
|
||||
// CAlarmDeviceTreeModel * pModel = dynamic_cast<CAlarmDeviceTreeModel *>(model());
|
||||
// if(Q_NULLPTR != pModel)
|
||||
// {
|
||||
// QMenu menu;
|
||||
// CAlarmDeviceTreeItem * pItem = static_cast<CAlarmDeviceTreeItem*>(indexAt(event->pos()).internalPointer());
|
||||
// if (Q_NULLPTR == pItem)
|
||||
// {
|
||||
// menu.addAction(tr("全选"), [=](){ pModel->setAllDeviceCheckState(Qt::Checked); });
|
||||
// menu.addAction(tr("清空"), [=](){ pModel->setAllDeviceCheckState(Qt::Unchecked); });
|
||||
// }
|
||||
// else if (Q_NULLPTR != pItem && pItem->childCount() > 0)
|
||||
// {
|
||||
// menu.addAction(tr("选择"), [=](){ pModel->setDeviceCheckState(indexAt(event->pos()), Qt::Checked); });
|
||||
// menu.addAction(tr("清除"), [=](){ pModel->setDeviceCheckState(indexAt(event->pos()), Qt::Unchecked); });
|
||||
// }
|
||||
// menu.exec(event->globalPos());
|
||||
// }
|
||||
// return;
|
||||
//}
|
||||
|
||||
@ -41,7 +41,7 @@ CAlarmFilterDialog::CAlarmFilterDialog(QWidget *parent) :
|
||||
ui->setupUi(this);
|
||||
setObjectName("alarm_dialog");
|
||||
QString qss = QString();
|
||||
std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
||||
std::string strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
||||
QFile qssfile1(QString::fromStdString(strFullPath));
|
||||
qssfile1.open(QFile::ReadOnly);
|
||||
if (qssfile1.isOpen())
|
||||
@ -49,7 +49,7 @@ CAlarmFilterDialog::CAlarmFilterDialog(QWidget *parent) :
|
||||
qss += QLatin1String(qssfile1.readAll());
|
||||
qssfile1.close();
|
||||
}
|
||||
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("alarm.qss") ;
|
||||
strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("alarm.qss") ;
|
||||
QFile qssfile2(QString::fromStdString(strFullPath));
|
||||
qssfile2.open(QFile::ReadOnly);
|
||||
if (qssfile2.isOpen())
|
||||
@ -84,7 +84,7 @@ CAlarmFilterDialog::~CAlarmFilterDialog()
|
||||
|
||||
void CAlarmFilterDialog::initialize()
|
||||
{
|
||||
m_rtdbAccess = new iot_dbms::CRdbAccess();
|
||||
m_rtdbAccess = new kbd_dbms::CRdbAccess();
|
||||
|
||||
ui->level->setSelectionMode(QAbstractItemView::MultiSelection);
|
||||
//ui->location->setSelectionMode(QAbstractItemView::MultiSelection);
|
||||
@ -161,12 +161,12 @@ void CAlarmFilterDialog::initialize()
|
||||
ui->status->addItem(value);
|
||||
}
|
||||
|
||||
iot_public::CSysInfoInterfacePtr spSysInfo;
|
||||
if (iot_public::createSysInfoInstance(spSysInfo))
|
||||
kbd_public::CSysInfoInterfacePtr spSysInfo;
|
||||
if (kbd_public::createSysInfoInstance(spSysInfo))
|
||||
{
|
||||
std::vector<iot_public::SSubsystemInfo> vecSubsystemInfo;
|
||||
std::vector<kbd_public::SSubsystemInfo> vecSubsystemInfo;
|
||||
spSysInfo->getAllSubsystemInfo(vecSubsystemInfo);
|
||||
foreach (iot_public::SSubsystemInfo info, vecSubsystemInfo)
|
||||
foreach (kbd_public::SSubsystemInfo info, vecSubsystemInfo)
|
||||
{
|
||||
if(info.nId <= CN_AppId_COMAPP)
|
||||
{
|
||||
@ -717,12 +717,12 @@ void CAlarmFilterDialog::slot_updateCheckStatusState()
|
||||
void CAlarmFilterDialog::slot_updateDevice(const QString &subSystem)
|
||||
{
|
||||
int nSubSystemId = -1;
|
||||
iot_public::CSysInfoInterfacePtr spSysInfo;
|
||||
if (iot_public::createSysInfoInstance(spSysInfo))
|
||||
kbd_public::CSysInfoInterfacePtr spSysInfo;
|
||||
if (kbd_public::createSysInfoInstance(spSysInfo))
|
||||
{
|
||||
std::vector<iot_public::SSubsystemInfo> vecSubsystemInfo;
|
||||
std::vector<kbd_public::SSubsystemInfo> vecSubsystemInfo;
|
||||
spSysInfo->getAllSubsystemInfo(vecSubsystemInfo);
|
||||
foreach (iot_public::SSubsystemInfo info, vecSubsystemInfo)
|
||||
foreach (kbd_public::SSubsystemInfo info, vecSubsystemInfo)
|
||||
{
|
||||
if(subSystem.toStdString() == info.strDesc)
|
||||
{
|
||||
@ -733,34 +733,34 @@ void CAlarmFilterDialog::slot_updateDevice(const QString &subSystem)
|
||||
|
||||
ui->deviceType->clear();
|
||||
|
||||
QList<iot_dbms::CVarType> values;
|
||||
QList<kbd_dbms::CVarType> values;
|
||||
|
||||
if(nSubSystemId != -1)
|
||||
{
|
||||
iot_dbms::CVarType subSystemId = nSubSystemId;
|
||||
kbd_dbms::CVarType subSystemId = nSubSystemId;
|
||||
if(m_rtdbAccess->open("base", "dev_type_def"))
|
||||
{
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
iot_dbms::CONDINFO condition;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||
kbd_dbms::CONDINFO condition;
|
||||
condition.relationop = ATTRCOND_EQU;
|
||||
memcpy(condition.name, "sub_system", strlen("sub_system") );
|
||||
condition.conditionval = subSystemId;
|
||||
std::vector<std::string> columns;
|
||||
columns.push_back("description");
|
||||
|
||||
iot_dbms::CRdbQueryResult result;
|
||||
kbd_dbms::CRdbQueryResult result;
|
||||
if(m_rtdbAccess->select(condition, result, columns))
|
||||
{
|
||||
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||
{
|
||||
iot_dbms::CVarType value;
|
||||
kbd_dbms::CVarType value;
|
||||
result.getColumnValue(nIndex, 0, value);
|
||||
values.append(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (iot_dbms::CVarType value, values)
|
||||
foreach (kbd_dbms::CVarType value, values)
|
||||
{
|
||||
ui->deviceType->addItem(value.c_str());
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ private:
|
||||
private:
|
||||
Ui::CAlarmFilterDialog *ui;
|
||||
|
||||
iot_dbms::CRdbAccess * m_rtdbAccess;
|
||||
kbd_dbms::CRdbAccess * m_rtdbAccess;
|
||||
QMap<int, QString> m_priorityMap;
|
||||
QMap<int, QString> m_locationMap;
|
||||
QMap<int, QString> m_regionMap;
|
||||
|
||||
@ -6,13 +6,13 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1000</width>
|
||||
<height>546</height>
|
||||
<width>657</width>
|
||||
<height>510</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>1000</width>
|
||||
<width>530</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
|
||||
@ -38,7 +38,6 @@
|
||||
#include "CAlarmBaseData.h"
|
||||
#include "CAlarmShiledDialog.h"
|
||||
#include "CAccidentReviewDialog.h"
|
||||
#include "pub_utility_api/FileStyle.h"
|
||||
CAlarmForm::CAlarmForm(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
m_ptrSysInfo(Q_NULLPTR),
|
||||
@ -54,7 +53,7 @@ CAlarmForm::CAlarmForm(QWidget *parent) :
|
||||
m_isNeedAccidentReview(true),
|
||||
m_strAccidenPath(QString())
|
||||
{
|
||||
m_communicator = new iot_net::CMbCommunicator();
|
||||
m_communicator = new kbd_net::CMbCommunicator();
|
||||
qRegisterMetaType<QItemSelection>("QItemSelection");
|
||||
qRegisterMetaType< QList<QVector<QString> > >("QList<QVector<QString> >");
|
||||
qRegisterMetaType<QVector<bool> >("QVector<bool>");
|
||||
@ -64,7 +63,7 @@ CAlarmForm::CAlarmForm(QWidget *parent) :
|
||||
ui->alarmView->setObjectName("alarmView");
|
||||
ui->splitter->setStretchFactor(0,1);
|
||||
ui->splitter->setStretchFactor(1,6);
|
||||
initStyle();
|
||||
|
||||
QHBoxLayout * pHBoxLayout = new QHBoxLayout(ui->deviceView->header());
|
||||
m_pSearchTextEdit = new QLineEdit(ui->deviceView->header());
|
||||
m_pSearchTextEdit->setObjectName("searchTextEdit");
|
||||
@ -133,24 +132,6 @@ CAlarmForm::CAlarmForm(QWidget *parent) :
|
||||
m_thread->start();
|
||||
}
|
||||
|
||||
void CAlarmForm::initStyle(){
|
||||
QString qss = QString();
|
||||
std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("alarmForm.qss") ;
|
||||
QFile qssfile2(QString::fromStdString(strFullPath));
|
||||
qssfile2.open(QFile::ReadOnly);
|
||||
if (qssfile2.isOpen())
|
||||
{
|
||||
qss += QLatin1String(qssfile2.readAll());
|
||||
qssfile2.close();
|
||||
}
|
||||
if(!qss.isEmpty())
|
||||
{
|
||||
setStyleSheet(qss);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
CAlarmForm::~CAlarmForm()
|
||||
{
|
||||
if(m_communicator != Q_NULLPTR)
|
||||
@ -195,13 +176,13 @@ CAlarmForm::~CAlarmForm()
|
||||
|
||||
void CAlarmForm::initialize()
|
||||
{
|
||||
if (!iot_public::createSysInfoInstance(m_ptrSysInfo))
|
||||
if (!kbd_public::createSysInfoInstance(m_ptrSysInfo))
|
||||
{
|
||||
LOGERROR("创建系统信息访问库实例失败!");
|
||||
}
|
||||
if(m_pReadDb == NULL)
|
||||
{
|
||||
m_pReadDb = new iot_dbms::CDbApi(DB_CONN_MODEL_READ);
|
||||
m_pReadDb = new kbd_dbms::CDbApi(DB_CONN_MODEL_READ);
|
||||
if(!m_pReadDb->open())
|
||||
{
|
||||
LOGERROR("数据库打开失败,%s",m_pReadDb->getLastErrorString().toStdString().c_str());
|
||||
@ -226,7 +207,7 @@ void CAlarmForm::initialize()
|
||||
|
||||
//< lingdaoyaoqiu
|
||||
{
|
||||
QSettings columFlags("IOT_HMI", "alarm config");
|
||||
QSettings columFlags("KBD_HMI", "alarm config");
|
||||
if(!columFlags.contains(QString("alarm/colum_0")))
|
||||
{
|
||||
columFlags.setValue(QString("alarm/colum_0"), false); //< 时间
|
||||
@ -235,8 +216,8 @@ void CAlarmForm::initialize()
|
||||
columFlags.setValue(QString("alarm/colum_3"), true); //< 责任区
|
||||
columFlags.setValue(QString("alarm/colum_4"), true); //< 告警类型
|
||||
columFlags.setValue(QString("alarm/colum_5"), false); //< 告警状态
|
||||
columFlags.setValue(QString("alarm/colum_6"), true); //< 确认状态
|
||||
columFlags.setValue(QString("alarm/colum_7"), true); //<
|
||||
columFlags.setValue(QString("alarm/colum_6"), false); //< 确认状态
|
||||
columFlags.setValue(QString("alarm/colum_7"), false); //<
|
||||
}
|
||||
}
|
||||
ui->comboBox->setModel(m_pListWidget1->model());
|
||||
@ -274,7 +255,7 @@ void CAlarmForm::updateAlarmOperatePerm()
|
||||
m_listLocationOptId.clear();
|
||||
m_listRegionDelId.clear();
|
||||
m_listLocationDelId.clear();
|
||||
iot_public::SNodeInfo stNodeInfo;
|
||||
kbd_public::SNodeInfo stNodeInfo;
|
||||
if (!m_ptrSysInfo)
|
||||
{
|
||||
if(!createSysInfoInstance(m_ptrSysInfo))
|
||||
@ -287,7 +268,7 @@ void CAlarmForm::updateAlarmOperatePerm()
|
||||
m_nodeName = stNodeInfo.strName;
|
||||
m_nDomainId = stNodeInfo.nDomainId;
|
||||
|
||||
iot_service::CPermMngApiPtr permMngPtr = iot_service::getPermMngInstance("base");
|
||||
kbd_service::CPermMngApiPtr permMngPtr = kbd_service::getPermMngInstance("base");
|
||||
if(permMngPtr != NULL)
|
||||
{
|
||||
permMngPtr->PermDllInit();
|
||||
@ -711,8 +692,7 @@ void CAlarmForm::setAlarmModel(CAlarmItemModel *model,CAiAlarmTreeModel *treeMod
|
||||
|
||||
connect(ui->alarmView->horizontalHeader(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), m_pModel, SLOT(sortColumn(int,Qt::SortOrder)));
|
||||
connect(ui->aiAlarmTreeView->header(),&QHeaderView::sortIndicatorChanged, m_treeModel,&CAiAlarmTreeModel::sortColumn);
|
||||
//先注释掉,想启用的话可以通过脚本绑定
|
||||
//connect(ui->aiAlarmTreeView,&CAiAlarmTreeView::doubleClicked, this,&CAlarmForm::aiAlmDoubleClicked);
|
||||
connect(ui->aiAlarmTreeView,&CAiAlarmTreeView::doubleClicked, this,&CAlarmForm::aiAlmDoubleClicked);
|
||||
ui->confirm->setEnabled(true);
|
||||
ui->remove->setEnabled(true);
|
||||
//原始告警窗
|
||||
@ -723,7 +703,7 @@ void CAlarmForm::setAlarmModel(CAlarmItemModel *model,CAiAlarmTreeModel *treeMod
|
||||
ui->alarmView->setColumnWidth(5, 150);
|
||||
ui->alarmView->setColumnWidth(6, 120);
|
||||
|
||||
QSettings columFlags("IOT_HMI", "alarm config");
|
||||
QSettings columFlags("KBD_HMI", "alarm config");
|
||||
for(int nColumnIndex(0); nColumnIndex < m_pModel->columnCount() - 1; nColumnIndex++)
|
||||
{
|
||||
bool visible = columFlags.value(QString("alarm/colum_%1").arg(nColumnIndex)).toBool();
|
||||
@ -781,7 +761,7 @@ void CAlarmForm::setAlarmModel(CAlarmItemModel *model)
|
||||
ui->alarmView->setColumnWidth(6, 120);
|
||||
|
||||
|
||||
QSettings columFlags("IOT_HMI", "alarm config");
|
||||
QSettings columFlags("KBD_HMI", "alarm config");
|
||||
for(int nColumnIndex(0); nColumnIndex < m_pModel->columnCount() - 1; nColumnIndex++)
|
||||
{
|
||||
bool visible = columFlags.value(QString("alarm/colum_%1").arg(nColumnIndex)).toBool();
|
||||
@ -794,7 +774,6 @@ void CAlarmForm::setAlarmModel(CAlarmItemModel *model)
|
||||
{
|
||||
connect(m_pDeviceModel, &CAlarmDeviceTreeModel::itemCheckStateChanged, this, &CAlarmForm::deviceGroupFilterChanged);
|
||||
connect(m_pDeviceModel, &CAlarmDeviceTreeModel::inhibitDevGroupAlm, this, &CAlarmForm::slotInhibitDevGroupAlm);
|
||||
connect(CAlarmDataCollect::instance(),&CAlarmDataCollect::sigDevTreeUpdate,m_pDeviceModel,&CAlarmDeviceTreeModel::slotDevTreeUpdate);
|
||||
}
|
||||
initFilter();
|
||||
}
|
||||
@ -1358,7 +1337,7 @@ void CAlarmForm::contextMenuStack0Event(QContextMenuEvent *event)
|
||||
connect(action, &QAction::triggered, [=](){
|
||||
ui->alarmView->setColumnHidden(nColumnIndex, !action->isChecked());
|
||||
ui->aiAlarmTreeView->setColumnHidden(nColumnIndex, !action->isChecked());
|
||||
QSettings columFlags("IOT_HMI", "alarm config");
|
||||
QSettings columFlags("KBD_HMI", "alarm config");
|
||||
columFlags.setValue(QString("alarm/colum_%1").arg(nColumnIndex), !action->isChecked());
|
||||
});
|
||||
}
|
||||
@ -1481,7 +1460,7 @@ void CAlarmForm::contextMenuStack1Event(QContextMenuEvent *event)
|
||||
connect(action, &QAction::triggered, [=](){
|
||||
ui->alarmView->setColumnHidden(nColumnIndex, !action->isChecked());
|
||||
ui->aiAlarmTreeView->setColumnHidden(nColumnIndex, !action->isChecked());
|
||||
QSettings columFlags("IOT_HMI", "alarm config");
|
||||
QSettings columFlags("KBD_HMI", "alarm config");
|
||||
columFlags.setValue(QString("alarm/colum_%1").arg(nColumnIndex), !action->isChecked());
|
||||
});
|
||||
}
|
||||
@ -1659,7 +1638,7 @@ void CAlarmForm::removeAlarm0()
|
||||
}
|
||||
QList<AlarmMsgPtr> listInfo = m_pModel->getListShowAlarmInfo();
|
||||
//声明告警删除package
|
||||
QMap<int, iot_idl::SAlmCltDelAlm *> pkgMap; //Domain-DelPkg;
|
||||
QMap<int, kbd_idlfile::SAlmCltDelAlm *> pkgMap; //Domain-DelPkg;
|
||||
int permSkip = -1; //< 不具备确认权限时是否跳过: 0-单步跳过、1-全部跳过
|
||||
int unConfirmSkip = -1; //< 未确认告警是否跳过: 0-单步跳过、1-全部跳过
|
||||
|
||||
@ -1755,17 +1734,17 @@ void CAlarmForm::removeAlarm0()
|
||||
}
|
||||
|
||||
//构建告警删除package
|
||||
QMap<int, iot_idl::SAlmCltDelAlm *>::iterator it = pkgMap.find(info->domain_id);
|
||||
QMap<int, kbd_idlfile::SAlmCltDelAlm *>::iterator it = pkgMap.find(info->domain_id);
|
||||
if(it == pkgMap.end())
|
||||
{
|
||||
iot_idl::SAlmCltDelAlm * pkg = new iot_idl::SAlmCltDelAlm();
|
||||
kbd_idlfile::SAlmCltDelAlm * pkg = new kbd_idlfile::SAlmCltDelAlm();
|
||||
pkg->set_domain_id(info->domain_id);
|
||||
pkgMap[info->domain_id] = pkg;
|
||||
}
|
||||
pkgMap.value(info->domain_id)->add_uuid_base64(info->uuid_base64.toStdString());
|
||||
}
|
||||
//请求删除
|
||||
foreach (iot_idl::SAlmCltDelAlm * pkg, pkgMap)
|
||||
foreach (kbd_idlfile::SAlmCltDelAlm * pkg, pkgMap)
|
||||
{
|
||||
if(CAlarmDataCollect::instance()->requestDelAlm(*pkg)!= true)
|
||||
{
|
||||
@ -1792,8 +1771,8 @@ void CAlarmForm::removeAlarm1()
|
||||
QList<AiAlarmMsgPtr> aimsgList; //选中的智能告警
|
||||
QList<AlarmMsgPtr> msgList; //选中的原始告警
|
||||
//声明智能告警删除package
|
||||
QMap<int, iot_idl::SIntelliAlmDel *> aipkgMap; //Domain-DelPkg; ai
|
||||
QMap<int, iot_idl::SAlmCltDelAlm *> pkgMap; //Domain-DelPkg; alarm
|
||||
QMap<int, kbd_idlfile::SIntelliAlmDel *> aipkgMap; //Domain-DelPkg; ai
|
||||
QMap<int, kbd_idlfile::SAlmCltDelAlm *> pkgMap; //Domain-DelPkg; alarm
|
||||
int permSkip = -1; //< 不具备确认权限时是否跳过: 0-单步跳过、1-全部跳过
|
||||
int unConfirmSkip = -1; //< 未确认告警是否跳过: 0-单步跳过、1-全部跳过
|
||||
QModelIndexList::iterator modelIndexIter = modelIndexList.begin();
|
||||
@ -1916,10 +1895,10 @@ void CAlarmForm::removeAlarm1()
|
||||
}
|
||||
}
|
||||
//构建告警删除package
|
||||
QMap<int, iot_idl::SAlmCltDelAlm *>::iterator it = pkgMap.find(info->domain_id);
|
||||
QMap<int, kbd_idlfile::SAlmCltDelAlm *>::iterator it = pkgMap.find(info->domain_id);
|
||||
if(it == pkgMap.end())
|
||||
{
|
||||
iot_idl::SAlmCltDelAlm * pkg = new iot_idl::SAlmCltDelAlm();
|
||||
kbd_idlfile::SAlmCltDelAlm * pkg = new kbd_idlfile::SAlmCltDelAlm();
|
||||
pkg->set_domain_id(info->domain_id);
|
||||
pkgMap[info->domain_id] = pkg;
|
||||
}
|
||||
@ -2012,17 +1991,17 @@ void CAlarmForm::removeAlarm1()
|
||||
}
|
||||
int domain_id = aimsgList.at(aialarm)->domain_id;
|
||||
QString aiuuid = aimsgList.at(aialarm)->uuid_base64;
|
||||
QMap<int, iot_idl::SIntelliAlmDel *>::iterator it = aipkgMap.find(domain_id);
|
||||
QMap<int, kbd_idlfile::SIntelliAlmDel *>::iterator it = aipkgMap.find(domain_id);
|
||||
if(it == aipkgMap.end())
|
||||
{
|
||||
iot_idl::SIntelliAlmDel * pkg = new iot_idl::SIntelliAlmDel();
|
||||
kbd_idlfile::SIntelliAlmDel * pkg = new kbd_idlfile::SIntelliAlmDel();
|
||||
pkg->set_domain_id(domain_id);
|
||||
aipkgMap[domain_id] = pkg;
|
||||
}
|
||||
aipkgMap.value(domain_id)->add_uuid_base64(aiuuid.toStdString());
|
||||
}
|
||||
//请求删除
|
||||
foreach (iot_idl::SAlmCltDelAlm * pkg, pkgMap)
|
||||
foreach (kbd_idlfile::SAlmCltDelAlm * pkg, pkgMap)
|
||||
{
|
||||
if(CAlarmDataCollect::instance()->requestDelAlm(*pkg)!= true)
|
||||
{
|
||||
@ -2032,7 +2011,7 @@ void CAlarmForm::removeAlarm1()
|
||||
qDeleteAll(pkgMap);
|
||||
pkgMap.clear();
|
||||
//请求删除
|
||||
foreach (iot_idl::SIntelliAlmDel * pkg, aipkgMap)
|
||||
foreach (kbd_idlfile::SIntelliAlmDel * pkg, aipkgMap)
|
||||
{
|
||||
if(CAiAlarmDataCollect::instance()->requestDelAlm(*pkg) != true)
|
||||
{
|
||||
@ -2061,7 +2040,7 @@ void CAlarmForm::confirmAlarm0()
|
||||
|
||||
//构建告警确认package
|
||||
QMap<QString,AlarmMsgPtr> msgMap; //要确认的告警
|
||||
QMap<QString, iot_idl::SAlmCltCfmAlm *> pkgMap; //Domain-DelPkg;
|
||||
QMap<QString, kbd_idlfile::SAlmCltCfmAlm *> pkgMap; //Domain-DelPkg;
|
||||
|
||||
int permSkip = -1; //< 不具备确认权限时是否跳过: 0-单步跳过、1-全部跳过
|
||||
QModelIndexList::iterator modelIndexIter = modelIndexList.begin();
|
||||
@ -2121,10 +2100,10 @@ void CAlarmForm::confirmAlarm0()
|
||||
}
|
||||
|
||||
QString key = QString("%1_%2_%3").arg(almIter.value()->domain_id).arg(almIter.value()->alm_type).arg(almIter.value()->app_id);
|
||||
QMap<QString, iot_idl::SAlmCltCfmAlm *>::iterator it = pkgMap.find(key);
|
||||
QMap<QString, kbd_idlfile::SAlmCltCfmAlm *>::iterator it = pkgMap.find(key);
|
||||
if(it == pkgMap.end())
|
||||
{
|
||||
iot_idl::SAlmCltCfmAlm * pkg = new iot_idl::SAlmCltCfmAlm();
|
||||
kbd_idlfile::SAlmCltCfmAlm * pkg = new kbd_idlfile::SAlmCltCfmAlm();
|
||||
pkg->set_node_name(m_nodeName);
|
||||
pkg->set_user_id(m_userId);
|
||||
pkg->set_confirm_time(QDateTime::currentMSecsSinceEpoch());
|
||||
@ -2139,7 +2118,7 @@ void CAlarmForm::confirmAlarm0()
|
||||
}
|
||||
|
||||
//请求确认
|
||||
foreach (iot_idl::SAlmCltCfmAlm * pkg, pkgMap)
|
||||
foreach (kbd_idlfile::SAlmCltCfmAlm * pkg, pkgMap)
|
||||
{
|
||||
if(CAlarmDataCollect::instance()->requestCfmAlm(*pkg) != true)
|
||||
{
|
||||
@ -2167,7 +2146,7 @@ void CAlarmForm::confirmAlarm1()
|
||||
QMap<QString,AlarmMsgPtr> msgMap; //要确认的告警
|
||||
msgMap.clear();
|
||||
//构建告警确认package
|
||||
QMap<QString, iot_idl::SAlmCltCfmAlm *> pkgMap; //Domain-DelPkg;
|
||||
QMap<QString, kbd_idlfile::SAlmCltCfmAlm *> pkgMap; //Domain-DelPkg;
|
||||
int permSkip = -1; //< 不具备确认权限时是否跳过: 0-单步跳过、1-全部跳过
|
||||
QModelIndexList::iterator modelIndexIter = modelIndexList.begin();
|
||||
for(;modelIndexIter != modelIndexList.end();modelIndexIter++)
|
||||
@ -2252,10 +2231,10 @@ void CAlarmForm::confirmAlarm1()
|
||||
}
|
||||
}
|
||||
QString key = QString("%1_%2_%3").arg(almIter.value()->domain_id).arg(almIter.value()->alm_type).arg(almIter.value()->app_id);
|
||||
QMap<QString, iot_idl::SAlmCltCfmAlm *>::iterator it = pkgMap.find(key);
|
||||
QMap<QString, kbd_idlfile::SAlmCltCfmAlm *>::iterator it = pkgMap.find(key);
|
||||
if(it == pkgMap.end())
|
||||
{
|
||||
iot_idl::SAlmCltCfmAlm * pkg = new iot_idl::SAlmCltCfmAlm();
|
||||
kbd_idlfile::SAlmCltCfmAlm * pkg = new kbd_idlfile::SAlmCltCfmAlm();
|
||||
pkg->set_node_name(m_nodeName);
|
||||
pkg->set_user_id(m_userId);
|
||||
pkg->set_confirm_time(QDateTime::currentMSecsSinceEpoch());
|
||||
@ -2268,7 +2247,7 @@ void CAlarmForm::confirmAlarm1()
|
||||
pkgMap.value(key)->add_time_stamp(almIter.value()->time_stamp);
|
||||
pkgMap.value(key)->add_uuid_base64(almIter.value()->uuid_base64.toStdString());
|
||||
}
|
||||
foreach (iot_idl::SAlmCltCfmAlm * pkg, pkgMap)
|
||||
foreach (kbd_idlfile::SAlmCltCfmAlm * pkg, pkgMap)
|
||||
{
|
||||
if(CAlarmDataCollect::instance()->requestCfmAlm(*pkg) != true)
|
||||
{
|
||||
@ -2333,7 +2312,7 @@ void CAlarmForm::rightMerge1()
|
||||
}
|
||||
}
|
||||
}
|
||||
QMap<int, iot_idl::SIntelliAlmMerge *> pkgMap;
|
||||
QMap<int, kbd_idlfile::SIntelliAlmMerge *> pkgMap;
|
||||
QList<AlarmMsgPtr> listPtr;
|
||||
listPtr.clear();
|
||||
int permSkip = -1;
|
||||
@ -2420,7 +2399,7 @@ void CAlarmForm::rightMerge1()
|
||||
int32 domain_id = listPtr.at(x)->domain_id;
|
||||
if(!pkgMap.keys().contains(domain_id))
|
||||
{
|
||||
iot_idl::SIntelliAlmMerge *pkg =new iot_idl::SIntelliAlmMerge();
|
||||
kbd_idlfile::SIntelliAlmMerge *pkg =new kbd_idlfile::SIntelliAlmMerge();
|
||||
pkg->set_domain_id(domain_id);
|
||||
pkgMap[domain_id] = pkg;
|
||||
}
|
||||
@ -2440,7 +2419,7 @@ void CAlarmForm::rightMerge1()
|
||||
pkgMap.clear();
|
||||
return ;
|
||||
}
|
||||
foreach (iot_idl::SIntelliAlmMerge * pkg, pkgMap)
|
||||
foreach (kbd_idlfile::SIntelliAlmMerge * pkg, pkgMap)
|
||||
{
|
||||
if(CAiAlarmDataCollect::instance()->requestMergeAlm(*pkg) != true)
|
||||
{
|
||||
@ -2561,7 +2540,7 @@ void CAlarmForm::rightSepr1()
|
||||
}
|
||||
//拼包
|
||||
int domain_id = msgList.at(0)->domain_id;
|
||||
iot_idl::SIntelliAlmSepr *pkg = new iot_idl::SIntelliAlmSepr();
|
||||
kbd_idlfile::SIntelliAlmSepr *pkg = new kbd_idlfile::SIntelliAlmSepr();
|
||||
pkg->set_domain_id(domain_id);
|
||||
for(int index(0);index<msgList.size();index++)
|
||||
{
|
||||
@ -2919,19 +2898,21 @@ void CAlarmForm::test(QStringList tagList)
|
||||
|
||||
void CAlarmForm::inhibitAlm(const AlarmMsgPtr &alm)
|
||||
{
|
||||
iot_net::CMbMessage msg;
|
||||
kbd_net::CMbMessage msg;
|
||||
msg.setSubject(alm->sub_system, CH_HMI_TO_OPT_OPTCMD_DOWN);
|
||||
SOptTagSet sOptTagSet;
|
||||
SOptTagQueue optTagQueue;
|
||||
COptTagSet cOptTagSet;
|
||||
|
||||
if(createReqHead(sOptTagSet.stHead,alm)!= iotSuccess)
|
||||
if(createReqHead(sOptTagSet.stHead,alm)!= kbdSuccess)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
QString keyIdTag = alm->key_id_tag;
|
||||
if(keyIdTag.endsWith(".value"))
|
||||
{
|
||||
keyIdTag.replace(QString(".value"),QString(".status"));
|
||||
//禁止告警和实时数据代码一致,要不实时数据 插件取消告警会失败;
|
||||
// keyIdTag.replace(QString(".value"),QString(".status"));
|
||||
}else
|
||||
{
|
||||
return ;
|
||||
@ -2946,7 +2927,7 @@ void CAlarmForm::inhibitAlm(const AlarmMsgPtr &alm)
|
||||
optTagQueue.nSubSystem = alm->sub_system;
|
||||
|
||||
sOptTagSet.vecTagQueue.push_back(optTagQueue);
|
||||
std::string content = COptTagSet::generate(sOptTagSet);
|
||||
std::string content = cOptTagSet.generate(sOptTagSet);
|
||||
|
||||
msg.setMsgType(MT_OPT_PINHIBIT_ALARM);
|
||||
|
||||
@ -2964,7 +2945,7 @@ void CAlarmForm::inhibitAlm(const AlarmMsgPtr &alm)
|
||||
|
||||
bool CAlarmForm::permCheck(int location, int region)
|
||||
{
|
||||
iot_service::CPermMngApiPtr permMngPtr = iot_service::getPermMngInstance("base");
|
||||
kbd_service::CPermMngApiPtr permMngPtr = kbd_service::getPermMngInstance("base");
|
||||
if(permMngPtr != NULL)
|
||||
{
|
||||
permMngPtr->PermDllInit();
|
||||
@ -3017,7 +2998,7 @@ int CAlarmForm::createReqHead(SOptReqHead &head, const AlarmMsgPtr &alm)
|
||||
if(!createSysInfoInstance(m_ptrSysInfo))
|
||||
{
|
||||
LOGERROR("创建系统信息访问库实例失败!");
|
||||
return iotFailed;
|
||||
return kbdFailed;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3027,19 +3008,19 @@ int CAlarmForm::createReqHead(SOptReqHead &head, const AlarmMsgPtr &alm)
|
||||
int loginSec;
|
||||
std::string instanceName;
|
||||
|
||||
iot_service::CPermMngApiPtr permMng = iot_service::getPermMngInstance("base");
|
||||
kbd_service::CPermMngApiPtr permMng = kbd_service::getPermMngInstance("base");
|
||||
if(permMng != NULL)
|
||||
{
|
||||
if(permMng->PermDllInit() != PERM_NORMAL)
|
||||
{
|
||||
LOGERROR("权限接口初始化失败!");
|
||||
return iotFailed;
|
||||
return kbdFailed;
|
||||
}else
|
||||
{
|
||||
if(PERM_NORMAL != permMng->CurUser(userID, usergID, level, loginSec, instanceName))
|
||||
{
|
||||
userID = -1;
|
||||
return iotFailed;
|
||||
return kbdFailed;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3049,7 +3030,7 @@ int CAlarmForm::createReqHead(SOptReqHead &head, const AlarmMsgPtr &alm)
|
||||
|
||||
if(m_ptrSysInfo != Q_NULLPTR)
|
||||
{
|
||||
iot_public::SAppInfo stAppInfo;
|
||||
kbd_public::SAppInfo stAppInfo;
|
||||
m_ptrSysInfo->getAppInfoBySubsystemId(alm->sub_system,stAppInfo);
|
||||
head.nAppID = stAppInfo.nId;
|
||||
}else
|
||||
@ -3063,7 +3044,7 @@ int CAlarmForm::createReqHead(SOptReqHead &head, const AlarmMsgPtr &alm)
|
||||
head.nUserGroupID = usergID;
|
||||
head.nOptTime = QDateTime::currentDateTime().toMSecsSinceEpoch();
|
||||
|
||||
return iotSuccess;
|
||||
return kbdSuccess;
|
||||
}
|
||||
|
||||
void CAlarmForm::reloadDevTree()
|
||||
|
||||
@ -49,7 +49,7 @@ public:
|
||||
void initialize();
|
||||
|
||||
void init();
|
||||
void initStyle();
|
||||
|
||||
void setAlarmModel(CAlarmItemModel * model, CAiAlarmTreeModel *treeModel);
|
||||
|
||||
void setAlarmModel(CAlarmItemModel * model);
|
||||
@ -214,8 +214,8 @@ private:
|
||||
int createReqHead(SOptReqHead &head, const AlarmMsgPtr &alm);
|
||||
|
||||
private:
|
||||
iot_public::CSysInfoInterfacePtr m_ptrSysInfo;
|
||||
iot_dbms::CDbApi *m_pReadDb;
|
||||
kbd_public::CSysInfoInterfacePtr m_ptrSysInfo;
|
||||
kbd_dbms::CDbApi *m_pReadDb;
|
||||
|
||||
QLineEdit * m_pSearchTextEdit;
|
||||
QPushButton * m_pSearchButton;
|
||||
@ -231,7 +231,7 @@ private:
|
||||
CAiAlarmDelegate * m_aiDelegate;
|
||||
CAlarmDeviceTreeModel * m_pDeviceModel;
|
||||
CAiAlarmTreeModel *m_treeModel;
|
||||
iot_net::CMbCommunicator *m_communicator;
|
||||
kbd_net::CMbCommunicator *m_communicator;
|
||||
int m_userId;
|
||||
std::string m_nodeName;
|
||||
int m_nDomainId;
|
||||
|
||||
@ -40,55 +40,25 @@
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<property name="bottomMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="3" column="0">
|
||||
<widget class="QFrame" name="frame_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@ -96,27 +66,255 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QPushButton" name="inhibit">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>当前显示数量:</string>
|
||||
<string>禁止列表</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="filter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>过滤</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="print">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>导出</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>优先级:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>位置:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>113</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>告警状态:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>138</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>时间:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="showRow">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@ -129,14 +327,21 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>过滤告警数量:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>当前显示数量:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="filterRow">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@ -153,9 +358,6 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
@ -164,13 +366,16 @@
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>1000</width>
|
||||
<width>16777215</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>智能告警</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@ -181,31 +386,67 @@
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>800</width>
|
||||
<width>13</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="set">
|
||||
<widget class="QPushButton" name="confirm">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<width>45</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确认</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="remove">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>删除</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="inhiAlarm">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>禁止告警</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="set">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -218,7 +459,7 @@
|
||||
<widget class="QPushButton" name="closeBtn">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<width>45</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -228,9 +469,11 @@
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
@ -260,7 +503,7 @@
|
||||
</widget>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
@ -279,7 +522,7 @@
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<item row="0" column="0">
|
||||
<widget class="CAlarmView" name="alarmView">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@ -335,332 +578,6 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item row="0" column="11">
|
||||
<widget class="QPushButton" name="inhibit">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>禁止列表</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>优先级:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>位置:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="10">
|
||||
<widget class="QPushButton" name="filter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>65</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>65</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>过滤</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="12">
|
||||
<widget class="QPushButton" name="print">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>65</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>65</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>导出</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="13">
|
||||
<widget class="QPushButton" name="remove">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>65</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>删除</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QComboBox" name="comboBox_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>1000</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>1000</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="15">
|
||||
<widget class="QPushButton" name="inhiAlarm">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>禁止告警</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="14">
|
||||
<widget class="QPushButton" name="confirm">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>65</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确认</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="9">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>时间:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>告警状态:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QComboBox" name="comboBox_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@ -17,7 +17,7 @@ CAlarmInhibitDialog::CAlarmInhibitDialog(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QString qss = QString();
|
||||
std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
||||
std::string strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
||||
QFile qssfile1(QString::fromStdString(strFullPath));
|
||||
qssfile1.open(QFile::ReadOnly);
|
||||
if (qssfile1.isOpen())
|
||||
@ -25,7 +25,7 @@ CAlarmInhibitDialog::CAlarmInhibitDialog(QWidget *parent) :
|
||||
qss += QLatin1String(qssfile1.readAll());
|
||||
qssfile1.close();
|
||||
}
|
||||
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("alarm.qss") ;
|
||||
strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("alarm.qss") ;
|
||||
QFile qssfile2(QString::fromStdString(strFullPath));
|
||||
qssfile2.open(QFile::ReadOnly);
|
||||
if (qssfile2.isOpen())
|
||||
|
||||
@ -8,19 +8,7 @@
|
||||
#include "CAlarmMsgManage.h"
|
||||
#include "perm_mng_api/PermMngApi.h"
|
||||
#include <QDebug>
|
||||
|
||||
//< 屏蔽xml_parser编译告警
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
|
||||
#endif
|
||||
|
||||
#include "boost/property_tree/xml_parser.hpp"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#include "boost/typeof/typeof.hpp"
|
||||
#include "boost/filesystem.hpp"
|
||||
#include "Common.h"
|
||||
@ -34,7 +22,7 @@
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using namespace iot_public;
|
||||
using namespace kbd_public;
|
||||
using namespace std;
|
||||
const int DOCK_ROW_COUNT = 3;
|
||||
const int MAX_ROW_COUNT = 15000;
|
||||
@ -363,11 +351,11 @@ void CAlarmItemModel::sortColumn(int column, Qt::SortOrder order)
|
||||
{
|
||||
if(order == Qt::AscendingOrder)
|
||||
{
|
||||
m_order = Qt::AscendingOrder;
|
||||
m_order = Qt::DescendingOrder;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_order = Qt::DescendingOrder;
|
||||
m_order = Qt::AscendingOrder;
|
||||
}
|
||||
m_sortKey = (E_ALARM_SORTKEY)column;
|
||||
beginResetModel();
|
||||
|
||||
@ -16,8 +16,13 @@
|
||||
#include "CAlarmSetMng.h"
|
||||
#include "service/alarm_server_api/AlarmCommonDef.h"
|
||||
#include "CAlarmMsgManage.h"
|
||||
#include <QDomDocument>
|
||||
#include <QDomElement>
|
||||
#include <QDomNode>
|
||||
#include <QDomNodeList>
|
||||
#include <QRegExp>
|
||||
|
||||
using namespace iot_public;
|
||||
using namespace kbd_public;
|
||||
CAlarmMediaPlayer * CAlarmMediaPlayer::m_pInstance = NULL;
|
||||
CAlarmMediaPlayer *CAlarmMediaPlayer::instance()
|
||||
{
|
||||
@ -32,7 +37,7 @@ CAlarmMediaPlayer::CAlarmMediaPlayer()
|
||||
:m_bHaveValidAudioDev(true),m_pMediaPlayer(Q_NULLPTR),m_pTextToSpeech(Q_NULLPTR),m_pTimerCheckAudioDev(Q_NULLPTR),m_voice(100)
|
||||
{
|
||||
m_readFlag = true;
|
||||
QDir dir(QString::fromStdString(iot_public::CFileUtil::getCurModuleDir()));
|
||||
QDir dir(QString::fromStdString(kbd_public::CFileUtil::getCurModuleDir()));
|
||||
dir.cdUp();
|
||||
dir.cdUp();
|
||||
dir.cd("data");
|
||||
@ -178,6 +183,40 @@ void CAlarmMediaPlayer::initSpeech()
|
||||
}
|
||||
}
|
||||
}
|
||||
//添加语音转文本处理条件
|
||||
QFile file(kbd_public::CFileUtil::getPathOfCfgFile("alarmSpeechTextTrans.xml" , CN_DIR_PRODUCT).c_str());
|
||||
if (!file.open(QFile::ReadWrite))
|
||||
{
|
||||
LOGERROR("打开语音文本转换文件失败,默认不进行语音转换");
|
||||
return;
|
||||
}
|
||||
|
||||
QDomDocument doc;
|
||||
if (!doc.setContent(&file))
|
||||
{
|
||||
file.close();
|
||||
LOGERROR("打开语音文本转换文件失败,默认不进行语音转换");
|
||||
return;
|
||||
}
|
||||
file.close();
|
||||
|
||||
QDomElement root = doc.documentElement();
|
||||
if(root.isElement())
|
||||
{
|
||||
QDomNodeList nodeList = root.childNodes();
|
||||
for(int i = 0 ; i < nodeList.count() ; i++)
|
||||
{
|
||||
QDomNode node = nodeList.at(i);
|
||||
if(node.isElement())
|
||||
{
|
||||
QDomElement element = node.toElement();
|
||||
if(element.tagName() == "Condition" && element.attribute("enable") == "true")
|
||||
{
|
||||
m_mapSpeechTxtTrans.insert(element.attribute("key"),element.attribute("value"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -224,6 +263,17 @@ void CAlarmMediaPlayer::insertAudioCuesStop(const AlarmMsgPtr &info)
|
||||
}
|
||||
}
|
||||
|
||||
void CAlarmMediaPlayer::speechTextTrans(QString &strContent)
|
||||
{
|
||||
// strContent = "110KV回路503弹簧开关10A保护A线";
|
||||
//文本转换处理
|
||||
auto iter = m_mapSpeechTxtTrans.begin();
|
||||
for(;iter != m_mapSpeechTxtTrans.end() ; iter++)
|
||||
{
|
||||
strContent.replace(QRegExp(iter.key() , Qt::CaseInsensitive) , iter.value());
|
||||
}
|
||||
}
|
||||
|
||||
void CAlarmMediaPlayer::setVolumeEnable(bool bEnable)
|
||||
{
|
||||
if(bEnable)
|
||||
@ -417,6 +467,8 @@ void CAlarmMediaPlayer::updateAudioCuesSpeech()
|
||||
|
||||
if(!alarmContent.isEmpty())
|
||||
{
|
||||
//读取配置文件,更改读取方式
|
||||
speechTextTrans(alarmContent);
|
||||
m_pTextToSpeech->say(alarmContent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,6 +53,8 @@ private:
|
||||
|
||||
void insertAudioCuesStop(const AlarmMsgPtr &info);
|
||||
|
||||
void speechTextTrans(QString &strContent);//读取配置文件,调整文本语音输出
|
||||
|
||||
private slots:
|
||||
/**
|
||||
* @brief playerStateChanged 播放器状态变化
|
||||
@ -90,6 +92,7 @@ private:
|
||||
QString m_engine;
|
||||
QString m_language;
|
||||
QString m_voiceName;
|
||||
QMap<QString,QString> m_mapSpeechTxtTrans;
|
||||
|
||||
bool m_readFlag;
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ CAlarmMsgInfo::CAlarmMsgInfo(const CAlarmMsgInfo &other): m_alarmAction(0)
|
||||
wave_file = other.wave_file;
|
||||
}
|
||||
|
||||
void CAlarmMsgInfo::initialize(const iot_idl::SAlmInfoToAlmClt &alarmInfo)
|
||||
void CAlarmMsgInfo::initialize(const kbd_idlfile::SAlmInfoToAlmClt &alarmInfo)
|
||||
{
|
||||
alm_type = alarmInfo.alm_type();
|
||||
alm_status = alarmInfo.alm_status();
|
||||
|
||||
@ -30,7 +30,7 @@ class CAlarmMsgInfo
|
||||
public:
|
||||
CAlarmMsgInfo();
|
||||
CAlarmMsgInfo(const CAlarmMsgInfo &other);
|
||||
void initialize(const iot_idl::SAlmInfoToAlmClt &alarmInfo);
|
||||
void initialize(const kbd_idlfile::SAlmInfoToAlmClt &alarmInfo);
|
||||
int getCameraInfoByTag(const QString &tag);
|
||||
|
||||
//< [优先级越小表示越大]-原始告警窗调用
|
||||
|
||||
@ -8,18 +8,7 @@
|
||||
#include <QDebug>
|
||||
#include "perm_mng_api/PermMngApi.h"
|
||||
|
||||
//< 屏蔽xml_parser编译告警
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
|
||||
#endif
|
||||
|
||||
#include "boost/property_tree/xml_parser.hpp"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#include "boost/typeof/typeof.hpp"
|
||||
#include "boost/filesystem.hpp"
|
||||
#include "Common.h"
|
||||
@ -28,7 +17,7 @@
|
||||
#include "pub_logger_api/logger.h"
|
||||
#include "CAlarmBaseData.h"
|
||||
|
||||
using namespace iot_public;
|
||||
using namespace kbd_public;
|
||||
using namespace std;
|
||||
|
||||
CAlarmMsgManage *CAlarmMsgManage::pInstance = NULL;
|
||||
@ -48,7 +37,7 @@ CAlarmMsgManage::CAlarmMsgManage()
|
||||
m_nAlmTotal(0)
|
||||
{
|
||||
mutex = new QMutex();
|
||||
QDir dir(QString::fromStdString(iot_public::CFileUtil::getCurModuleDir()));
|
||||
QDir dir(QString::fromStdString(kbd_public::CFileUtil::getCurModuleDir()));
|
||||
dir.cdUp();
|
||||
dir.cdUp();
|
||||
dir.cd("data");
|
||||
@ -71,13 +60,13 @@ CAlarmMsgManage::CAlarmMsgManage()
|
||||
m_all.clear();
|
||||
m_aiall.clear();
|
||||
|
||||
m_rtdbAlarmActionAccess = new iot_dbms::CRdbAccess();
|
||||
m_rtdbAlarmActionAccess = new kbd_dbms::CRdbAccess();
|
||||
m_rtdbAlarmActionAccess->open("base", "alarm_level_define");
|
||||
|
||||
m_rtdbLocationDescriptionAccess = new iot_dbms::CRdbAccess();
|
||||
m_rtdbLocationDescriptionAccess = new kbd_dbms::CRdbAccess();
|
||||
m_rtdbLocationDescriptionAccess->open("base", "sys_model_location_info");
|
||||
|
||||
m_rtdbAppDescriptionAccess = new iot_dbms::CRdbAccess();
|
||||
m_rtdbAppDescriptionAccess = new kbd_dbms::CRdbAccess();
|
||||
m_rtdbAppDescriptionAccess->open("base", "sys_model_app_info");
|
||||
|
||||
loadPermInfo();
|
||||
@ -212,18 +201,12 @@ void CAlarmMsgManage::updataDevGroupByDev(QString devGroup, QString device)
|
||||
}
|
||||
}
|
||||
|
||||
const QHash<int, QMap<QString, QSet<QString> > > &CAlarmMsgManage::getLocNotConfirmAlmInfo() const
|
||||
QHash<int, QMap<QString, QSet<QString> > > CAlarmMsgManage::getLocNotConfirmAlmInfo()
|
||||
{
|
||||
QMutexLocker locker(mutex);
|
||||
return m_alarmLNCAlm;
|
||||
}
|
||||
|
||||
const QHash<int, QMap<int, QSet<QString> > > &CAlarmMsgManage::getLocPriorityNotConfirmAlmInfo() const
|
||||
{
|
||||
QMutexLocker locker(mutex);
|
||||
return m_alarmLNCPAlm;
|
||||
}
|
||||
|
||||
void CAlarmMsgManage::getAllInhibitAlm(QList<AlarmMsgPtr> &almList)
|
||||
{
|
||||
QMutexLocker locker(mutex);
|
||||
@ -946,80 +929,42 @@ void CAlarmMsgManage::locSubStats(const AlarmMsgPtr &msg)
|
||||
}
|
||||
}
|
||||
|
||||
void CAlarmMsgManage::addNotConfirmAlm(const AlarmMsgPtr &msg)
|
||||
void CAlarmMsgManage::addNotConfirmAlm(int locId, const QString &devg, const QString &uuid)
|
||||
{
|
||||
//< 按设备组
|
||||
QHash<int,QMap<QString,QSet<QString> > >::iterator it =m_alarmLNCAlm.find(msg->location_id);
|
||||
QHash<int,QMap<QString,QSet<QString> > >::iterator it =m_alarmLNCAlm.find(locId);
|
||||
if(it != m_alarmLNCAlm.end())
|
||||
{
|
||||
QMap<QString,QSet<QString> > &devgMap = it.value();
|
||||
QMap<QString,QSet<QString> >::iterator pos = devgMap.find(msg->dev_group_tag);
|
||||
QMap<QString,QSet<QString> >::iterator pos = devgMap.find(devg);
|
||||
if(pos != devgMap.end())
|
||||
{
|
||||
pos.value().insert(msg->uuid_base64);
|
||||
pos.value().insert(uuid);
|
||||
}else
|
||||
{
|
||||
QSet<QString> uuidSet;
|
||||
uuidSet.insert(msg->uuid_base64);
|
||||
devgMap[msg->dev_group_tag] = uuidSet;
|
||||
uuidSet.insert(uuid);
|
||||
devgMap[devg] = uuidSet;
|
||||
}
|
||||
}else
|
||||
{
|
||||
QMap<QString,QSet<QString> > devgMap;
|
||||
QSet<QString> uuidSet;
|
||||
uuidSet.insert(msg->uuid_base64);
|
||||
devgMap[msg->dev_group_tag] = uuidSet;
|
||||
m_alarmLNCAlm[msg->location_id] = devgMap;
|
||||
}
|
||||
|
||||
//< 按告警等级
|
||||
QHash<int,QMap<int,QSet<QString> > >::iterator pIt =m_alarmLNCPAlm.find(msg->location_id);
|
||||
if(pIt != m_alarmLNCPAlm.end())
|
||||
{
|
||||
QMap<int,QSet<QString> > &pMap = pIt.value();
|
||||
QMap<int,QSet<QString> >::iterator pos = pMap.find(msg->priority);
|
||||
if(pos != pMap.end())
|
||||
{
|
||||
pos.value().insert(msg->uuid_base64);
|
||||
}else
|
||||
{
|
||||
QSet<QString> uuidSet;
|
||||
uuidSet.insert(msg->uuid_base64);
|
||||
pMap[msg->priority] = uuidSet;
|
||||
}
|
||||
}else
|
||||
{
|
||||
QMap<int,QSet<QString> > pMap;
|
||||
QSet<QString> uuidSet;
|
||||
uuidSet.insert(msg->uuid_base64);
|
||||
pMap[msg->priority] = uuidSet;
|
||||
m_alarmLNCPAlm[msg->location_id] = pMap;
|
||||
uuidSet.insert(uuid);
|
||||
devgMap[devg] = uuidSet;
|
||||
m_alarmLNCAlm[locId] = devgMap;
|
||||
}
|
||||
}
|
||||
|
||||
void CAlarmMsgManage::delNotConfirmAlm(const AlarmMsgPtr &msg)
|
||||
void CAlarmMsgManage::delNotConfirmAlm(int locId, const QString &devg, const QString &uuid)
|
||||
{
|
||||
//< 按设备组
|
||||
QHash<int,QMap<QString,QSet<QString> > >::iterator it =m_alarmLNCAlm.find(msg->location_id);
|
||||
QHash<int,QMap<QString,QSet<QString> > >::iterator it =m_alarmLNCAlm.find(locId);
|
||||
if(it != m_alarmLNCAlm.end())
|
||||
{
|
||||
QMap<QString,QSet<QString> > &devgMap = it.value();
|
||||
QMap<QString,QSet<QString> >::iterator pos = devgMap.find(msg->dev_group_tag);
|
||||
QMap<QString,QSet<QString> >::iterator pos = devgMap.find(devg);
|
||||
if(pos != devgMap.end())
|
||||
{
|
||||
pos.value().remove(msg->uuid_base64);
|
||||
}
|
||||
}
|
||||
|
||||
//< 按告警等级
|
||||
QHash<int,QMap<int,QSet<QString> > >::iterator pIt =m_alarmLNCPAlm.find(msg->location_id);
|
||||
if(pIt != m_alarmLNCPAlm.end())
|
||||
{
|
||||
QMap<int,QSet<QString> > &pMap = pIt.value();
|
||||
QMap<int,QSet<QString> >::iterator pos = pMap.find(msg->priority);
|
||||
if(pos != pMap.end())
|
||||
{
|
||||
pos.value().remove(msg->uuid_base64);
|
||||
pos.value().remove(uuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1135,7 +1080,7 @@ void CAlarmMsgManage::initAlarm()
|
||||
|
||||
if(E_ALS_ALARM == (*itpos)->logic_state || E_ALS_RETURN == (*itpos)->logic_state )//未确认数量(界面显示未确认)
|
||||
{
|
||||
addNotConfirmAlm(*itpos);
|
||||
addNotConfirmAlm((*itpos)->location_id,(*itpos)->dev_group_tag,(*itpos)->uuid_base64);
|
||||
++m_nNDelComAlarmCount;
|
||||
}
|
||||
updateMsgAction((*itpos));
|
||||
@ -1369,7 +1314,7 @@ void CAlarmMsgManage::addAlarmMsg(const QList<AlarmMsgPtr> &msgList)
|
||||
}
|
||||
if(E_ALS_ALARM == (*itpos)->logic_state || E_ALS_RETURN == (*itpos)->logic_state )//未确认数量(界面显示未确认)
|
||||
{
|
||||
addNotConfirmAlm(*itpos);
|
||||
addNotConfirmAlm((*itpos)->location_id,(*itpos)->dev_group_tag,(*itpos)->uuid_base64);
|
||||
++m_nNDelComAlarmCount;
|
||||
}
|
||||
updateMsgAction(*itpos);
|
||||
@ -1445,7 +1390,7 @@ void CAlarmMsgManage::confirmAlarmMsg(const QList<QString> &uuidList)
|
||||
oldMsg->logic_state = E_ALS_RETURN_CFM;
|
||||
--m_nNDelComAlarmCount;
|
||||
}
|
||||
delNotConfirmAlm(oldMsg);
|
||||
delNotConfirmAlm(oldMsg->location_id,oldMsg->dev_group_tag,oldMsg->uuid_base64);
|
||||
}else
|
||||
{
|
||||
AlarmMsgPtr oldMsg_ = m_all.value(uuid, NULL);
|
||||
@ -1502,7 +1447,7 @@ int CAlarmMsgManage::removeAlarmMsg(const QList<QString> &uuidList)
|
||||
}
|
||||
if(E_ALS_ALARM == oldMsg->logic_state)
|
||||
{
|
||||
delNotConfirmAlm(oldMsg);
|
||||
delNotConfirmAlm(oldMsg->location_id,oldMsg->dev_group_tag,oldMsg->uuid_base64);
|
||||
--m_nNDelComAlarmCount;
|
||||
oldMsg->logic_state = E_ALS_ALARM_DEL;
|
||||
}
|
||||
@ -1512,7 +1457,7 @@ int CAlarmMsgManage::removeAlarmMsg(const QList<QString> &uuidList)
|
||||
}
|
||||
else if(E_ALS_RETURN == oldMsg->logic_state)
|
||||
{
|
||||
delNotConfirmAlm(oldMsg);
|
||||
delNotConfirmAlm(oldMsg->location_id,oldMsg->dev_group_tag,oldMsg->uuid_base64);
|
||||
--m_nNDelComAlarmCount;
|
||||
oldMsg->logic_state = E_ALS_RETURN_DEL;
|
||||
}
|
||||
@ -1629,7 +1574,7 @@ void CAlarmMsgManage::removeAlarmMsgByDomainID(const int &domainId)
|
||||
{
|
||||
if(E_ALS_ALARM == (*it)->logic_state || E_ALS_RETURN == (*it)->logic_state)
|
||||
{
|
||||
delNotConfirmAlm(*it);
|
||||
delNotConfirmAlm((*it)->location_id,(*it)->dev_group_tag,(*it)->uuid_base64);
|
||||
--m_nNDelComAlarmCount;
|
||||
}
|
||||
removeAudioCues(it.value());
|
||||
@ -1843,7 +1788,7 @@ void CAlarmMsgManage::msgArrived()
|
||||
|
||||
if(E_ALS_ALARM == m_listMsgAddCache.at(num)->logic_state || E_ALS_RETURN == m_listMsgAddCache.at(num)->logic_state )//未删除未确认数量(界面显示未确认)
|
||||
{
|
||||
addNotConfirmAlm(m_listMsgAddCache.at(num));
|
||||
addNotConfirmAlm(m_listMsgAddCache.at(num)->location_id,m_listMsgAddCache.at(num)->dev_group_tag,m_listMsgAddCache.at(num)->uuid_base64);
|
||||
++m_nNDelComAlarmCount;
|
||||
}
|
||||
updateMsgAction(m_listMsgAddCache.at(num));
|
||||
@ -1923,24 +1868,24 @@ void CAlarmMsgManage::dealDelayAi()
|
||||
|
||||
int CAlarmMsgManage::queryAlarmAction(const int &priority)
|
||||
{
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbAlarmActionAccess);
|
||||
iot_dbms::CVarType value;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbAlarmActionAccess);
|
||||
kbd_dbms::CVarType value;
|
||||
m_rtdbAlarmActionAccess->getColumnValueByKey((void*)&priority, "alarm_actions",value);
|
||||
return value.toInt();
|
||||
}
|
||||
|
||||
QString CAlarmMsgManage::queryLocationDescription(int id)
|
||||
{
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbLocationDescriptionAccess);
|
||||
iot_dbms::CVarType value;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbLocationDescriptionAccess);
|
||||
kbd_dbms::CVarType value;
|
||||
m_rtdbLocationDescriptionAccess->getColumnValueByKey((void*)&id, "description", value);
|
||||
return value.c_str();
|
||||
}
|
||||
|
||||
QString CAlarmMsgManage::queryAppDescription(int id)
|
||||
{
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbAppDescriptionAccess);
|
||||
iot_dbms::CVarType value;
|
||||
kbd_dbms::CTableLockGuard locker(*m_rtdbAppDescriptionAccess);
|
||||
kbd_dbms::CVarType value;
|
||||
m_rtdbAppDescriptionAccess->getColumnValueByKey((void*)&id, "description", value);
|
||||
return value.c_str();
|
||||
}
|
||||
|
||||
@ -79,8 +79,7 @@ public:
|
||||
QHash<int,QMap<int,int> > getLocAlmInfo();
|
||||
void updataDevGroupByDev(QString devGroup, QString device);
|
||||
|
||||
const QHash<int,QMap<QString,QSet<QString> > > &getLocNotConfirmAlmInfo() const;
|
||||
const QHash<int, QMap<int, QSet<QString> > > &getLocPriorityNotConfirmAlmInfo() const;
|
||||
QHash<int,QMap<QString,QSet<QString> > > getLocNotConfirmAlmInfo();
|
||||
|
||||
void getAllInhibitAlm(QList<AlarmMsgPtr> &almList);
|
||||
signals:
|
||||
@ -268,14 +267,18 @@ private:
|
||||
void locSubStats(const AlarmMsgPtr &msg);
|
||||
/**
|
||||
* @brief addNotConfirmAlm 添加未确认的告警uuid
|
||||
* @param msg
|
||||
* @param locId
|
||||
* @param devg
|
||||
* @param uuid
|
||||
*/
|
||||
void addNotConfirmAlm(const AlarmMsgPtr &msg);
|
||||
void addNotConfirmAlm(int locId,const QString &devg,const QString &uuid);
|
||||
/**
|
||||
* @brief delNotConfirmAlm 从未确认的告警uuid集合中删除(删除的不一定被确认 可能是数据重发)
|
||||
* @param msg
|
||||
* @param locId
|
||||
* @param devg
|
||||
* @param uuid
|
||||
*/
|
||||
void delNotConfirmAlm(const AlarmMsgPtr &msg);
|
||||
void delNotConfirmAlm(int locId,const QString &devg,const QString &uuid);
|
||||
signals:
|
||||
/**
|
||||
* @brief sigAiMsgRemove 通知智能告警模型删除智能告警
|
||||
@ -369,9 +372,9 @@ private:
|
||||
|
||||
QMutex * mutex;
|
||||
|
||||
iot_dbms::CRdbAccess * m_rtdbAlarmActionAccess;
|
||||
iot_dbms::CRdbAccess * m_rtdbLocationDescriptionAccess;
|
||||
iot_dbms::CRdbAccess * m_rtdbAppDescriptionAccess;
|
||||
kbd_dbms::CRdbAccess * m_rtdbAlarmActionAccess;
|
||||
kbd_dbms::CRdbAccess * m_rtdbLocationDescriptionAccess;
|
||||
kbd_dbms::CRdbAccess * m_rtdbAppDescriptionAccess;
|
||||
|
||||
int m_nNDelComAlarmCount; //< 未删除未确认数量 N--not Del--delete Com--confirm
|
||||
QHash<QString, AlarmMsgPtr> m_infos;
|
||||
@ -403,7 +406,6 @@ private:
|
||||
QHash<int,QMap<int,int > > m_alarmLPAlm; //< <车站id,<告警等级,告警数量> >
|
||||
|
||||
QHash<int,QMap<QString,QSet<QString> > > m_alarmLNCAlm;//< <车站id,<设备组,<未确认告警uuid> > >
|
||||
QHash<int,QMap<int,QSet<QString> > > m_alarmLNCPAlm;//< <车站id,<告警等级,<未确认告警uuid> > >
|
||||
|
||||
QList<AiAlarmMsgPtr> m_delaydeal; //延迟处理的智能告警
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ CAlarmPlugin::CAlarmPlugin(QWidget *parent, bool editMode)
|
||||
#ifdef OS_LINUX
|
||||
QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() + "/plugins");
|
||||
#endif
|
||||
std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
||||
std::string strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
||||
QFile qssfile1(QString::fromStdString(strFullPath));
|
||||
qssfile1.open(QFile::ReadOnly);
|
||||
if (qssfile1.isOpen())
|
||||
@ -49,7 +49,7 @@ CAlarmPlugin::CAlarmPlugin(QWidget *parent, bool editMode)
|
||||
qss += QLatin1String(qssfile1.readAll());
|
||||
qssfile1.close();
|
||||
}
|
||||
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("alarm.qss") ;
|
||||
strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("alarm.qss") ;
|
||||
QFile qssfile2(QString::fromStdString(strFullPath));
|
||||
qssfile2.open(QFile::ReadOnly);
|
||||
if (qssfile2.isOpen())
|
||||
@ -242,7 +242,7 @@ void CAlarmPlugin::initialize(int mode)
|
||||
|
||||
void CAlarmPlugin::loadConfig()
|
||||
{
|
||||
QFile file(iot_public::CFileUtil::getPathOfCfgFile("intelli_alm_cfg.xml",CN_DIR_PLATFORM).c_str());
|
||||
QFile file(kbd_public::CFileUtil::getPathOfCfgFile("intelli_alm_cfg.xml",CN_DIR_PLATFORM).c_str());
|
||||
if (!file.open(QFile::ReadWrite))
|
||||
{
|
||||
LOGERROR("打开智能告警配置文件失败,默认不启动");
|
||||
@ -332,7 +332,7 @@ int CAlarmPlugin::confirmAlarm(const QList<AlarmMsgPtr> &msgs)
|
||||
return cofirmNum;
|
||||
}
|
||||
//< 可能有部分告警没有确认权限
|
||||
QMap<QString, iot_idl::SAlmCltCfmAlm *> pkgMap; //Domain-DelPkg;
|
||||
QMap<QString, kbd_idlfile::SAlmCltCfmAlm *> pkgMap; //Domain-DelPkg;
|
||||
for(int nIndex(0); nIndex < msgs.size(); nIndex++)
|
||||
{
|
||||
AlarmMsgPtr info = msgs.at(nIndex);
|
||||
@ -362,10 +362,10 @@ int CAlarmPlugin::confirmAlarm(const QList<AlarmMsgPtr> &msgs)
|
||||
if(regionEnable && locationEnable)
|
||||
{
|
||||
QString key = QString("%1_%2_%3").arg(info->domain_id).arg(info->alm_type).arg(info->app_id);
|
||||
QMap<QString, iot_idl::SAlmCltCfmAlm *>::iterator it = pkgMap.find(key);
|
||||
QMap<QString, kbd_idlfile::SAlmCltCfmAlm *>::iterator it = pkgMap.find(key);
|
||||
if(it == pkgMap.end())
|
||||
{
|
||||
iot_idl::SAlmCltCfmAlm * pkg = new iot_idl::SAlmCltCfmAlm();
|
||||
kbd_idlfile::SAlmCltCfmAlm * pkg = new kbd_idlfile::SAlmCltCfmAlm();
|
||||
pkg->set_node_name(m_currentNodeName);
|
||||
pkg->set_user_id(m_currentUsrId);
|
||||
pkg->set_confirm_time(QDateTime::currentMSecsSinceEpoch());
|
||||
@ -381,7 +381,7 @@ int CAlarmPlugin::confirmAlarm(const QList<AlarmMsgPtr> &msgs)
|
||||
}
|
||||
}
|
||||
//请求确认
|
||||
foreach (iot_idl::SAlmCltCfmAlm * pkg, pkgMap)
|
||||
foreach (kbd_idlfile::SAlmCltCfmAlm * pkg, pkgMap)
|
||||
{
|
||||
if(CAlarmDataCollect::instance()->requestCfmAlm(*pkg) != true)
|
||||
{
|
||||
@ -406,7 +406,7 @@ int CAlarmPlugin::removeAlarm(const QList<AlarmMsgPtr> &msgs)
|
||||
return -1;
|
||||
}
|
||||
//< 可能有部分告警没有删除权限
|
||||
QMap<int32, iot_idl::SAlmCltDelAlm *> pkgMap;
|
||||
QMap<int32, kbd_idlfile::SAlmCltDelAlm *> pkgMap;
|
||||
for(int nIndex(0); nIndex < msgs.size(); nIndex++)
|
||||
{
|
||||
AlarmMsgPtr info = msgs.at(nIndex);
|
||||
@ -432,10 +432,10 @@ int CAlarmPlugin::removeAlarm(const QList<AlarmMsgPtr> &msgs)
|
||||
}
|
||||
if(regionEnable && locationEnable)
|
||||
{
|
||||
QMap<int32, iot_idl::SAlmCltDelAlm *>::iterator it = pkgMap.find(info->domain_id);
|
||||
QMap<int32, kbd_idlfile::SAlmCltDelAlm *>::iterator it = pkgMap.find(info->domain_id);
|
||||
if(it == pkgMap.end())
|
||||
{
|
||||
iot_idl::SAlmCltDelAlm * pkg = new iot_idl::SAlmCltDelAlm();
|
||||
kbd_idlfile::SAlmCltDelAlm * pkg = new kbd_idlfile::SAlmCltDelAlm();
|
||||
pkg->set_domain_id(info->domain_id);
|
||||
pkgMap[info->domain_id] = pkg;
|
||||
}
|
||||
@ -443,7 +443,7 @@ int CAlarmPlugin::removeAlarm(const QList<AlarmMsgPtr> &msgs)
|
||||
}
|
||||
}
|
||||
//请求删除
|
||||
foreach (iot_idl::SAlmCltDelAlm * pkg, pkgMap)
|
||||
foreach (kbd_idlfile::SAlmCltDelAlm * pkg, pkgMap)
|
||||
{
|
||||
if(CAlarmDataCollect::instance()->requestDelAlm(*pkg) != true)
|
||||
{
|
||||
@ -693,13 +693,13 @@ int CAlarmPlugin::getLocNotConfirmAlmCount(int loc)
|
||||
{
|
||||
return count;
|
||||
}
|
||||
const QHash<int,QMap<QString,QSet<QString> > > &locCountMap = CAlarmMsgManage::instance()->getLocNotConfirmAlmInfo();
|
||||
QHash<int,QMap<QString,QSet<QString> > > locCountMap = CAlarmMsgManage::instance()->getLocNotConfirmAlmInfo();
|
||||
|
||||
QHash<int,QMap<QString,QSet<QString> > >::const_iterator it = locCountMap.find(loc);
|
||||
QHash<int,QMap<QString,QSet<QString> > >::iterator it = locCountMap.find(loc);
|
||||
if(it !=locCountMap.end())
|
||||
{
|
||||
QMap<QString,QSet<QString> > devgCountMap = it.value();
|
||||
QMap<QString,QSet<QString> >::const_iterator pos = devgCountMap.begin();
|
||||
QMap<QString,QSet<QString> >::iterator pos = devgCountMap.begin();
|
||||
while (pos != devgCountMap.end()) {
|
||||
|
||||
count += pos.value().count();
|
||||
@ -710,28 +710,6 @@ int CAlarmPlugin::getLocNotConfirmAlmCount(int loc)
|
||||
return count;
|
||||
}
|
||||
|
||||
QStringList CAlarmPlugin::getLocNotConfirmAlmInfo(int loc)
|
||||
{
|
||||
QStringList result;
|
||||
result.clear();
|
||||
if(loc < 0){
|
||||
return result;
|
||||
}
|
||||
const QHash<int, QMap<int,QSet<QString> > > &locCountMap = CAlarmMsgManage::instance()->getLocPriorityNotConfirmAlmInfo();
|
||||
QHash<int, QMap<int,QSet<QString> > >::const_iterator it = locCountMap.find(loc);
|
||||
if(it != locCountMap.end())
|
||||
{
|
||||
const QMap<int,QSet<QString> > &pMap = it.value();
|
||||
QMap<int,QSet<QString> >::const_iterator pos = pMap.constBegin();
|
||||
while (pos != pMap.constEnd())
|
||||
{
|
||||
result.append( QString("%1_%2").arg(pos.key()).arg(pos.value().count()) );
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int CAlarmPlugin::getDevgNotConfirmAlmCount(const QString &devg)
|
||||
{
|
||||
int count =0;
|
||||
@ -739,13 +717,13 @@ int CAlarmPlugin::getDevgNotConfirmAlmCount(const QString &devg)
|
||||
{
|
||||
return count;
|
||||
}
|
||||
const QHash<int,QMap<QString,QSet<QString> > > &locCountMap = CAlarmMsgManage::instance()->getLocNotConfirmAlmInfo();
|
||||
QHash<int,QMap<QString,QSet<QString> > > locCountMap = CAlarmMsgManage::instance()->getLocNotConfirmAlmInfo();
|
||||
|
||||
QHash<int,QMap<QString,QSet<QString> > >::const_iterator it = locCountMap.begin();
|
||||
QHash<int,QMap<QString,QSet<QString> > >::iterator it = locCountMap.begin();
|
||||
while (it !=locCountMap.end())
|
||||
{
|
||||
QMap<QString,QSet<QString> > devgCountMap = it.value();
|
||||
QMap<QString,QSet<QString> >::const_iterator pos = devgCountMap.find(devg);
|
||||
QMap<QString,QSet<QString> >::iterator pos = devgCountMap.find(devg);
|
||||
if(pos != devgCountMap.end())
|
||||
{
|
||||
count = pos.value().count();
|
||||
@ -925,18 +903,6 @@ void CAlarmPlugin::setDeviceGroup(const QString &deviceGroup)
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CAlarmPlugin::setPriorityFilter(int PriorityFilter)
|
||||
{
|
||||
bool isCheck = true;
|
||||
QList<int> priorityList;
|
||||
priorityList.append(PriorityFilter);
|
||||
if(m_pModel)
|
||||
{
|
||||
m_pModel->setPriorityFilter(isCheck,priorityList);
|
||||
}
|
||||
}
|
||||
|
||||
void CAlarmPlugin::setPointTag(const QString &pointList)
|
||||
{
|
||||
if(m_bIsEditMode || E_Alarm_Pop != m_mode)
|
||||
@ -1389,9 +1355,9 @@ void CAlarmPlugin::updateAlarmOperatePerm()
|
||||
m_vecRegionDelId.clear();
|
||||
m_vecLocationDelId.clear();
|
||||
|
||||
iot_public::SNodeInfo stNodeInfo;
|
||||
iot_public::CSysInfoInterfacePtr spSysInfo;
|
||||
if (!iot_public::createSysInfoInstance(spSysInfo))
|
||||
kbd_public::SNodeInfo stNodeInfo;
|
||||
kbd_public::CSysInfoInterfacePtr spSysInfo;
|
||||
if (!kbd_public::createSysInfoInstance(spSysInfo))
|
||||
{
|
||||
LOGERROR("创建系统信息访问库实例失败!");
|
||||
return;
|
||||
@ -1399,7 +1365,7 @@ void CAlarmPlugin::updateAlarmOperatePerm()
|
||||
spSysInfo->getLocalNodeInfo(stNodeInfo);
|
||||
|
||||
m_currentNodeName = stNodeInfo.strName;
|
||||
iot_service::CPermMngApiPtr permMngPtr = iot_service::getPermMngInstance("base");
|
||||
kbd_service::CPermMngApiPtr permMngPtr = kbd_service::getPermMngInstance("base");
|
||||
if(permMngPtr != NULL)
|
||||
{
|
||||
permMngPtr->PermDllInit();
|
||||
|
||||
@ -102,12 +102,6 @@ public slots:
|
||||
* @return 未确认告警条数
|
||||
*/
|
||||
int getLocNotConfirmAlmCount(int loc);
|
||||
/**
|
||||
* @brief getLocNotConfirmAlmInfo 获取车站未确认告警数量(优先级分组)
|
||||
* @param loc 位置id
|
||||
* @return QString 格式为: 告警等级_告警数量 ex:1_23 含义为 告警等级为1的告警数量为23
|
||||
*/
|
||||
QStringList getLocNotConfirmAlmInfo(int loc);
|
||||
/**
|
||||
* @brief getDevgNotConfirmAlmCount 获取设备组的未确认告警条数
|
||||
* @param devg 设备组
|
||||
@ -213,20 +207,11 @@ public slots:
|
||||
* @param device 设备
|
||||
*/
|
||||
void setDevice(const QString &device);
|
||||
|
||||
|
||||
/**
|
||||
* @brief setDeviceGroup 设置设备组显示
|
||||
* @param deviceGroup 设备组
|
||||
*/
|
||||
void setDeviceGroup(const QString &deviceGroup);
|
||||
|
||||
/**
|
||||
* @brief setPriorityFilter 设置优先级
|
||||
* @param deviceGroup 优先级
|
||||
*/
|
||||
void setPriorityFilter(int PriorityFilter);
|
||||
|
||||
/**
|
||||
* @brief setPointTag 设置点过滤(已无效,保留只为兼容)
|
||||
* @param pointList 点集合
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
class CAlarmPluginWidget : public QObject, public CPluginWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID HMI_WidgetPlugin_IID)
|
||||
Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0")
|
||||
Q_INTERFACES(CPluginWidgetInterface)
|
||||
|
||||
public:
|
||||
|
||||
@ -25,7 +25,7 @@ CAlarmSetDlg::CAlarmSetDlg(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QString qss = QString();
|
||||
std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
||||
std::string strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
||||
QFile qssfile1(QString::fromStdString(strFullPath));
|
||||
qssfile1.open(QFile::ReadOnly);
|
||||
if (qssfile1.isOpen())
|
||||
@ -33,7 +33,7 @@ CAlarmSetDlg::CAlarmSetDlg(QWidget *parent) :
|
||||
qss += QLatin1String(qssfile1.readAll());
|
||||
qssfile1.close();
|
||||
}
|
||||
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("alarm.qss") ;
|
||||
strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("alarm.qss") ;
|
||||
QFile qssfile2(QString::fromStdString(strFullPath));
|
||||
qssfile2.open(QFile::ReadOnly);
|
||||
if (qssfile2.isOpen())
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#include "pub_utility_api/FileUtil.h"
|
||||
#include "CAlarmBaseData.h"
|
||||
|
||||
using namespace iot_public;
|
||||
using namespace kbd_public;
|
||||
using namespace std;
|
||||
|
||||
CAlarmSetMng *CAlarmSetMng::pInstance = NULL;
|
||||
@ -41,7 +41,7 @@ CAlarmSetMng::CAlarmSetMng()
|
||||
void CAlarmSetMng::loadXMLCfg()
|
||||
{
|
||||
m_colorMap.clear();
|
||||
QString filePath = QString::fromStdString(iot_public::CFileUtil::getCurModuleDir()) + QString("../../data/model/alarm_color_define.xml");
|
||||
QString filePath = QString::fromStdString(kbd_public::CFileUtil::getCurModuleDir()) + QString("../../data/model/alarm_color_define.xml");
|
||||
QDomDocument document;
|
||||
QFile file(filePath);
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
|
||||
@ -66,7 +66,7 @@ private:
|
||||
static CAlarmSetMng * pInstance;
|
||||
|
||||
|
||||
iot_dbms::CRdbAccess * m_rtdbAccess;
|
||||
kbd_dbms::CRdbAccess * m_rtdbAccess;
|
||||
|
||||
QMap<int, QString> m_priorityOrderDescriptionMap;
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ CAlarmShiledDialog::CAlarmShiledDialog(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QString qss = QString();
|
||||
std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
||||
std::string strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
||||
QFile qssfile1(QString::fromStdString(strFullPath));
|
||||
qssfile1.open(QFile::ReadOnly);
|
||||
if (qssfile1.isOpen())
|
||||
@ -23,7 +23,7 @@ CAlarmShiledDialog::CAlarmShiledDialog(QWidget *parent) :
|
||||
qss += QLatin1String(qssfile1.readAll());
|
||||
qssfile1.close();
|
||||
}
|
||||
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("alarm.qss") ;
|
||||
strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("alarm.qss") ;
|
||||
QFile qssfile2(QString::fromStdString(strFullPath));
|
||||
qssfile2.open(QFile::ReadOnly);
|
||||
if (qssfile2.isOpen())
|
||||
@ -80,7 +80,7 @@ QWidget *CAlarmShiledDialog::createCustomWidget(const QString &name)
|
||||
}
|
||||
fileName += ".so";
|
||||
#endif
|
||||
std::string filePath = iot_public::CFileUtil::getPathOfBinFile(fileName.toStdString());
|
||||
std::string filePath = kbd_public::CFileUtil::getPathOfBinFile(fileName.toStdString());
|
||||
path = QString::fromStdString(filePath);
|
||||
QPluginLoader loader(path);
|
||||
QObject *plugin = loader.instance();
|
||||
|
||||
@ -305,7 +305,7 @@ void CAlarmWidget::confirmAlarm(const int &row)
|
||||
return;
|
||||
}
|
||||
|
||||
iot_idl::SAlmCltCfmAlm * pkg = new iot_idl::SAlmCltCfmAlm();
|
||||
kbd_idlfile::SAlmCltCfmAlm * pkg = new kbd_idlfile::SAlmCltCfmAlm();
|
||||
pkg->set_node_name(m_nodeName);
|
||||
pkg->set_user_id(m_userId);
|
||||
pkg->set_confirm_time(QDateTime::currentMSecsSinceEpoch());
|
||||
@ -355,9 +355,9 @@ void CAlarmWidget::setEnableLevel(bool isNeed)
|
||||
|
||||
bool CAlarmWidget::updateAlarmOperatePerm()
|
||||
{
|
||||
iot_public::SNodeInfo stNodeInfo;
|
||||
iot_public::CSysInfoInterfacePtr spSysInfo;
|
||||
if (!iot_public::createSysInfoInstance(spSysInfo))
|
||||
kbd_public::SNodeInfo stNodeInfo;
|
||||
kbd_public::CSysInfoInterfacePtr spSysInfo;
|
||||
if (!kbd_public::createSysInfoInstance(spSysInfo))
|
||||
{
|
||||
LOGERROR("创建系统信息访问库实例失败!");
|
||||
return false;
|
||||
@ -368,7 +368,7 @@ bool CAlarmWidget::updateAlarmOperatePerm()
|
||||
m_listRegionOptId.clear();
|
||||
m_listLocationDelId.clear();
|
||||
m_listRegionDelId.clear();
|
||||
iot_service::CPermMngApiPtr permMngPtr = iot_service::getPermMngInstance("base");
|
||||
kbd_service::CPermMngApiPtr permMngPtr = kbd_service::getPermMngInstance("base");
|
||||
if(permMngPtr != NULL)
|
||||
{
|
||||
permMngPtr->PermDllInit();
|
||||
|
||||
@ -12,7 +12,7 @@ int main(int argc, char *argv[])
|
||||
//<初始化消息总线
|
||||
QStringList arguments=QCoreApplication::arguments();
|
||||
std::string name="admin";
|
||||
std::string password ="admin";
|
||||
std::string password ="kbdct";
|
||||
int group =1;
|
||||
for(int index(0);index<arguments.size();index++)
|
||||
{
|
||||
@ -41,12 +41,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
}
|
||||
iot_public::StartLogSystem("HMI", "hmi");
|
||||
if (!(iot_net::initMsgBus("HMI", "HMI")))
|
||||
kbd_public::StartLogSystem("HMI", "hmi");
|
||||
if (!(kbd_net::initMsgBus("HMI", "HMI")))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
iot_service::CPermMngApiPtr perm = iot_service::getPermMngInstance("base");
|
||||
kbd_service::CPermMngApiPtr perm = kbd_service::getPermMngInstance("base");
|
||||
if(!perm || PERM_NORMAL != perm->PermDllInit())
|
||||
{
|
||||
return -1;
|
||||
@ -67,8 +67,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
//<释放消息总线
|
||||
iot_net::releaseMsgBus();
|
||||
iot_public::StopLogSystem();
|
||||
kbd_net::releaseMsgBus();
|
||||
kbd_public::StopLogSystem();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1,121 +0,0 @@
|
||||
QT += core sql xml multimedia webenginewidgets texttospeech
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TEMPLATE = lib
|
||||
TARGET = AlarmWidget_pad
|
||||
|
||||
CONFIG += plugin
|
||||
|
||||
|
||||
HEADERS = \
|
||||
CAlarmBaseData.h \
|
||||
CAlarmItemModel.h \
|
||||
CAlarmShiledDialog.h \
|
||||
CAlarmView.h \
|
||||
CAlarmDelegate.h \
|
||||
CAlarmForm.h \
|
||||
CAlarmFilterDialog.h \
|
||||
CAlarmWidget.h \
|
||||
CAlarmDataCollect.h \
|
||||
CAlarmMsgInfo.h \
|
||||
CAlarmPlugin.h \
|
||||
CAlarmMsgManage.h \
|
||||
CAlarmPluginWidget.h \
|
||||
CAlarmMediaPlayer.h \
|
||||
CTableViewPrinter.h \
|
||||
CAlarmInhibitDialog.h \
|
||||
CAlarmDeviceTreeItem.h \
|
||||
CAlarmDeviceTreeModel.h \
|
||||
CAlarmDeviceTreeView.h \
|
||||
CAlarmCommon.h \
|
||||
CMyListWidget.h \
|
||||
CMyCalendar.h \
|
||||
CMyCheckBox.h \
|
||||
CAiAlarmTreeView.h \
|
||||
CAiAlarmMsgInfo.h \
|
||||
CAiAlarmDataCollect.h \
|
||||
CAiAlarmTreeItem.h \
|
||||
CAiAlarmTreeModel.h \
|
||||
CAiAlarmDelegate.h \
|
||||
CDisposalPlanDialog.h \
|
||||
CTreeViewPrinter.h \
|
||||
CPdfPrinter.h \
|
||||
CAlarmTaskMngDlg.h \
|
||||
CAlarmSetDlg.h \
|
||||
CAlarmColorInfo.h \
|
||||
CAlarmSetMng.h \
|
||||
CAlarmColorWidget.h \
|
||||
CAccidentReviewDialog.h \
|
||||
../../../../../platform/src/include/service/operate_server_api/JsonMessageStruct.h \
|
||||
../../../../../platform/src/include/service/operate_server_api/JsonOptCommand.h
|
||||
|
||||
SOURCES = \
|
||||
CAlarmBaseData.cpp \
|
||||
CAlarmItemModel.cpp \
|
||||
CAlarmShiledDialog.cpp \
|
||||
CAlarmView.cpp \
|
||||
CAlarmDelegate.cpp \
|
||||
CAlarmForm.cpp \
|
||||
CAlarmFilterDialog.cpp \
|
||||
CAlarmWidget.cpp \
|
||||
CAlarmDataCollect.cpp \
|
||||
CAlarmMsgInfo.cpp \
|
||||
CAlarmPlugin.cpp \
|
||||
CAlarmMsgManage.cpp \
|
||||
CAlarmPluginWidget.cpp \
|
||||
CAlarmMediaPlayer.cpp \
|
||||
CTableViewPrinter.cpp \
|
||||
CAlarmInhibitDialog.cpp \
|
||||
CAlarmDeviceTreeModel.cpp \
|
||||
CAlarmDeviceTreeItem.cpp \
|
||||
CAlarmDeviceTreeView.cpp \
|
||||
CMyListWidget.cpp \
|
||||
CMyCalendar.cpp \
|
||||
CMyCheckBox.cpp \
|
||||
CAiAlarmTreeView.cpp \
|
||||
CAiAlarmMsgInfo.cpp \
|
||||
CAiAlarmDataCollect.cpp \
|
||||
CAiAlarmTreeItem.cpp \
|
||||
CAiAlarmTreeModel.cpp \
|
||||
CAiAlarmDelegate.cpp \
|
||||
CDisposalPlanDialog.cpp \
|
||||
CTreeViewPrinter.cpp \
|
||||
CPdfPrinter.cpp \
|
||||
CAlarmTaskMngDlg.cpp \
|
||||
CAlarmSetDlg.cpp \
|
||||
CAlarmColorInfo.cpp \
|
||||
CAlarmSetMng.cpp \
|
||||
CAlarmColorWidget.cpp \
|
||||
CAccidentReviewDialog.cpp \
|
||||
../../../../../platform/src/include/service/operate_server_api/JsonOptCommand.cpp
|
||||
|
||||
FORMS += \
|
||||
CAlarmFilterDialog.ui \
|
||||
CAlarmForm.ui \
|
||||
CAlarmInhibitDialog.ui \
|
||||
CAlarmShiledDialog.ui \
|
||||
CMyCalendar.ui \
|
||||
CDisposalPlanDialog.ui \
|
||||
CAlarmTaskMngDlg.ui \
|
||||
CAlarmSetDlg.ui \
|
||||
CAlarmColorWidget.ui
|
||||
|
||||
|
||||
LIBS += -llog4cplus -lboost_system -lboost_filesystem -lprotobuf -lpub_logger_api -ldb_base_api -ldb_api_ex -lpub_utility_api -lrdb_api -lrdb_net_api -lperm_mng_api -lpub_sysinfo_api
|
||||
LIBS += -lnet_msg_bus_api -lalarm_server_api -lintelli_alm_api -lpub_excel -lidong_srv_api
|
||||
LIBS += -ldb_his_mng_api
|
||||
|
||||
win32{
|
||||
# CAlarmMediaPlayer.cpp 检测声卡的代码使用
|
||||
LIBS += -lole32
|
||||
}
|
||||
|
||||
include($$PWD/../../../idl_files/idl_files.pri)
|
||||
|
||||
COMMON_PRI=$$PWD/../../../common.pri
|
||||
exists($$COMMON_PRI) {
|
||||
include($$COMMON_PRI)
|
||||
}else {
|
||||
error("FATAL error: can not find common.pri")
|
||||
}
|
||||
@ -1,289 +0,0 @@
|
||||
#include "CAccidentReviewDialog.h"
|
||||
#include "public/pub_utility_api/FileUtil.h"
|
||||
#include "public/pub_logger_api/logger.h"
|
||||
#include <QTreeWidget>
|
||||
#include <QPushButton>
|
||||
#include <QGridLayout>
|
||||
#include <QSpacerItem>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
|
||||
CAccidentReviewDialog::CAccidentReviewDialog(const QString &path, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
resize(350,450);
|
||||
getFilterNames(path);
|
||||
initView();
|
||||
initTree();
|
||||
}
|
||||
|
||||
CAccidentReviewDialog::~CAccidentReviewDialog()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString CAccidentReviewDialog::getCurrentGraph()
|
||||
{
|
||||
if(m_treeWidget->currentItem())
|
||||
{
|
||||
return m_treeWidget->currentItem()->data(0, Qt::UserRole).toString();
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
void CAccidentReviewDialog::initView()
|
||||
{
|
||||
setWindowTitle(tr("事故追忆"));
|
||||
m_treeWidget = new QTreeWidget(this);
|
||||
m_treeWidget->headerItem()->setHidden(true);
|
||||
|
||||
QSpacerItem * spacer = new QSpacerItem(10, 0, QSizePolicy::Preferred);
|
||||
m_confirmBtn = new QPushButton(tr("确认"), this);
|
||||
m_cancelBtn = new QPushButton(tr("取消"), this);
|
||||
connect(m_confirmBtn, &QPushButton::clicked, this, &CAccidentReviewDialog::slotConfirm);
|
||||
connect(m_cancelBtn, &QPushButton::clicked, this, &CAccidentReviewDialog::slotCancel);
|
||||
|
||||
QGridLayout * layout = new QGridLayout();
|
||||
layout->addWidget(m_treeWidget, 0, 0, 1, 3);
|
||||
layout->addItem(spacer, 1, 0);
|
||||
layout->addWidget(m_confirmBtn, 1, 1);
|
||||
layout->addWidget(m_cancelBtn, 1, 2);
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
void CAccidentReviewDialog::initTree()
|
||||
{
|
||||
QMap<int, QList<QPair<int, ST_NODE>>> m_mapNav;
|
||||
readNavJson(QString::fromStdString(iot_public::CFileUtil::getCurModuleDir())
|
||||
+ QString("../../data/model/NavigationWidget.json"), m_mapNav);
|
||||
QList<QPair<int, ST_NODE>> nodeList = m_mapNav.value(-1);
|
||||
for(int nIndex=0; nIndex<nodeList.length(); nIndex++)
|
||||
{
|
||||
QTreeWidgetItem *item = getAddLevelItem(nodeList[nIndex].second);
|
||||
if(item == NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
m_treeWidget->addTopLevelItem(item);
|
||||
|
||||
addChildLevelItem(item, nodeList[nIndex], m_mapNav);
|
||||
}
|
||||
treeFilter();
|
||||
m_treeWidget->expandAll();
|
||||
}
|
||||
|
||||
void CAccidentReviewDialog::getFilterNames(const QString &path)
|
||||
{
|
||||
QString filePath = QString::fromStdString(iot_public::CFileUtil::getCurModuleDir())
|
||||
+ QString("../../data/pic/");
|
||||
m_fileNameList = getAllFile(filePath, filePath, path);
|
||||
}
|
||||
|
||||
QStringList CAccidentReviewDialog::getAllFile(const QString &path, const QString &relativePath, const QString &filter)
|
||||
{
|
||||
QDir dir(path);
|
||||
QDir relativeDir(relativePath);
|
||||
QStringList allFile;
|
||||
|
||||
QString fileName;
|
||||
QFileInfoList fileList = dir.entryInfoList(QDir::Files | QDir::NoSymLinks);
|
||||
for(QFileInfo &file : fileList)
|
||||
{
|
||||
fileName = relativeDir.relativeFilePath(file.filePath());
|
||||
if(fileName.contains(filter))
|
||||
{
|
||||
allFile.append(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
QFileInfoList folderList = dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
for(QFileInfo &folder : folderList)
|
||||
{
|
||||
allFile.append(getAllFile(folder.absoluteFilePath(), relativePath, filter));
|
||||
}
|
||||
|
||||
return allFile;
|
||||
}
|
||||
|
||||
void CAccidentReviewDialog::treeFilter()
|
||||
{
|
||||
bool topShow,childShow,leafShow;
|
||||
int nTopCount = m_treeWidget->topLevelItemCount();
|
||||
for(int nTopIndex(0); nTopIndex<nTopCount; nTopIndex++)
|
||||
{
|
||||
QTreeWidgetItem * topItem = m_treeWidget->topLevelItem(nTopIndex);
|
||||
topShow = m_fileNameList.contains(topItem->data(0, Qt::UserRole).toString());
|
||||
|
||||
int nChildCount = topItem->childCount();
|
||||
for(int nChildIndex(0); nChildIndex<nChildCount; nChildIndex++)
|
||||
{
|
||||
QTreeWidgetItem * childItem = topItem->child(nChildIndex);
|
||||
childShow = m_fileNameList.contains(childItem->data(0, Qt::UserRole).toString());
|
||||
|
||||
int nLeafCount = childItem->childCount();
|
||||
for(int nLeafIndex(0); nLeafIndex<nLeafCount; nLeafIndex++)
|
||||
{
|
||||
QTreeWidgetItem * leafItem = childItem->child(nLeafIndex);
|
||||
leafShow = m_fileNameList.contains(leafItem->data(0, Qt::UserRole).toString());
|
||||
leafItem->setHidden(!leafShow);
|
||||
if(leafShow)
|
||||
{
|
||||
childShow = true;
|
||||
}
|
||||
}
|
||||
childItem->setHidden(!childShow);
|
||||
if(childShow)
|
||||
{
|
||||
topShow = true;
|
||||
}
|
||||
}
|
||||
topItem->setHidden(!topShow);
|
||||
}
|
||||
}
|
||||
|
||||
void CAccidentReviewDialog::slotConfirm()
|
||||
{
|
||||
if(m_treeWidget->currentItem() == NULL)
|
||||
{
|
||||
QMessageBox::information(this, tr("提示"), tr("请选择一张画面!"), QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
QString data = m_treeWidget->currentItem()->data(0, Qt::UserRole).toString();
|
||||
if(data.isEmpty() || !m_fileNameList.contains(data))
|
||||
{
|
||||
QMessageBox::information(this, tr("提示"), tr("请选择其他画面!"), QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
accept();
|
||||
}
|
||||
|
||||
void CAccidentReviewDialog::slotCancel()
|
||||
{
|
||||
reject();
|
||||
}
|
||||
|
||||
void CAccidentReviewDialog::addChildLevelItem(QTreeWidgetItem *item, const QPair<int, ST_NODE> &node,
|
||||
const QMap<int, QList<QPair<int, ST_NODE> > > &navMap)
|
||||
{
|
||||
const QList<QPair<int, ST_NODE> > childList = navMap.value(node.first);
|
||||
for(int nIndex=0; nIndex<childList.length(); nIndex++)
|
||||
{
|
||||
QTreeWidgetItem *childItem = getAddLevelItem(childList[nIndex].second);
|
||||
if(childItem == NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
item->addChild(childItem);
|
||||
|
||||
addChildLevelItem(childItem, childList[nIndex], navMap);
|
||||
}
|
||||
}
|
||||
|
||||
QTreeWidgetItem *CAccidentReviewDialog::getAddLevelItem(const ST_NODE &st_node)
|
||||
{
|
||||
if(st_node.used == Disable)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
QTreeWidgetItem * childItem = new QTreeWidgetItem();
|
||||
childItem->setData(0, Qt::DisplayRole, st_node.name);
|
||||
childItem->setData(0, Qt::UserRole, st_node.data);
|
||||
return childItem;
|
||||
}
|
||||
|
||||
void CAccidentReviewDialog::readNavJson(const QString &path, QMap<int, QList<QPair<int, ST_NODE> > > &map)
|
||||
{
|
||||
QFile file(path);
|
||||
QByteArray readJson;
|
||||
if(file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
readJson = file.readAll();
|
||||
file.close();
|
||||
}
|
||||
QJsonParseError readError;
|
||||
QJsonDocument readJsonResponse = QJsonDocument::fromJson(readJson, &readError);
|
||||
if(readError.error != QJsonParseError::NoError)
|
||||
{
|
||||
LOGERROR("CJsonReader error: %d, string: %s", readError.error, readError.errorString().toStdString().c_str());
|
||||
return;
|
||||
}
|
||||
QJsonObject root = readJsonResponse.object();
|
||||
if(root.contains("items"))
|
||||
{
|
||||
QJsonArray itemArray = root.value("items").toArray();
|
||||
int nItemNumber = 0;
|
||||
for(int nIndex(0); nIndex< itemArray.size(); nIndex++)
|
||||
{
|
||||
ST_NODE st_Node_Top;
|
||||
QJsonObject topLevelObject = itemArray[nIndex].toObject();
|
||||
makeStButton(st_Node_Top, topLevelObject);
|
||||
QPair<int, ST_NODE> topMap;
|
||||
int nTopNumber = nItemNumber;
|
||||
topMap.first = nItemNumber++;
|
||||
topMap.second = st_Node_Top;
|
||||
|
||||
QJsonArray childArray = topLevelObject.value("items").toArray();
|
||||
for(int nChildIndex(0); nChildIndex< childArray.size(); nChildIndex++)
|
||||
{
|
||||
ST_NODE st_Node_Child;
|
||||
QJsonObject childLevelObject = childArray[nChildIndex].toObject();
|
||||
makeStButton(st_Node_Child, childLevelObject);
|
||||
QPair<int, ST_NODE> childMap;
|
||||
int nChildNumber = nItemNumber;
|
||||
childMap.first = nItemNumber++;
|
||||
childMap.second = st_Node_Child;
|
||||
|
||||
QJsonArray leafArray = childLevelObject.value("items").toArray();
|
||||
for(int nLeafIndex(0); nLeafIndex< leafArray.size(); nLeafIndex++)
|
||||
{
|
||||
ST_NODE st_Node_Leaf;
|
||||
QJsonObject leafLevelObject = leafArray[nLeafIndex].toObject();
|
||||
makeStButton(st_Node_Leaf, leafLevelObject);
|
||||
QPair<int, ST_NODE> leafMap;
|
||||
leafMap.first = nItemNumber++;
|
||||
leafMap.second = st_Node_Leaf;
|
||||
map[nChildNumber].append(leafMap);
|
||||
}
|
||||
map[nTopNumber].append(childMap);
|
||||
}
|
||||
map[-1].append(topMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CAccidentReviewDialog::makeStButton(ST_NODE &st_Node, const QJsonObject &object)
|
||||
{
|
||||
if(!object.value("name").isUndefined())
|
||||
{
|
||||
st_Node.name = object.value("name").toString();
|
||||
}
|
||||
if(!object.value("icon").isUndefined())
|
||||
{
|
||||
st_Node.icon = object.value("icon").toString();
|
||||
}
|
||||
if(!object.value("data").isUndefined())
|
||||
{
|
||||
st_Node.data = object.value("data").toString();
|
||||
}
|
||||
if(!object.value("opt").isUndefined())
|
||||
{
|
||||
st_Node.type = object.value("opt").toInt();
|
||||
}
|
||||
if(!object.value("used").isUndefined())
|
||||
{
|
||||
st_Node.used = object.value("used").toInt();
|
||||
}
|
||||
if(!object.value("web").isUndefined())
|
||||
{
|
||||
st_Node.web = object.value("web").toInt();
|
||||
}
|
||||
if(!object.value("webData").isUndefined())
|
||||
{
|
||||
st_Node.webData = object.value("webData").toString();
|
||||
}
|
||||
}
|
||||
@ -1,56 +0,0 @@
|
||||
#ifndef CACCIDENTREVIEWDIALOG_H
|
||||
#define CACCIDENTREVIEWDIALOG_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QDialog>
|
||||
#include <QMap>
|
||||
|
||||
struct ST_NODE
|
||||
{
|
||||
QString name;
|
||||
int used;
|
||||
int type;
|
||||
QString icon;
|
||||
int web;
|
||||
QString data;
|
||||
QString webData;
|
||||
};
|
||||
|
||||
class QTreeWidget;
|
||||
class QTreeWidgetItem;
|
||||
class CAccidentReviewDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Node_Enable{Enable = 1,Disable = 2};
|
||||
CAccidentReviewDialog(const QString &path, QWidget *parent = Q_NULLPTR);
|
||||
~CAccidentReviewDialog();
|
||||
|
||||
QString getCurrentGraph();
|
||||
|
||||
private slots:
|
||||
void slotConfirm();
|
||||
void slotCancel();
|
||||
|
||||
private:
|
||||
void initView();
|
||||
void initTree();
|
||||
void getFilterNames(const QString &path);
|
||||
QStringList getAllFile(const QString &path, const QString &relativePath,
|
||||
const QString &filter);
|
||||
void treeFilter();
|
||||
|
||||
void addChildLevelItem(QTreeWidgetItem *item, const QPair<int, ST_NODE> &node,
|
||||
const QMap<int, QList<QPair<int, ST_NODE> > > &navMap);
|
||||
QTreeWidgetItem* getAddLevelItem(const ST_NODE& st_node);
|
||||
void readNavJson(const QString &path, QMap<int, QList<QPair<int, ST_NODE>>>& map);
|
||||
void makeStButton(ST_NODE &st_Node, const QJsonObject &object);
|
||||
|
||||
private:
|
||||
QTreeWidget * m_treeWidget;
|
||||
QPushButton * m_confirmBtn;
|
||||
QPushButton * m_cancelBtn;
|
||||
QStringList m_fileNameList;
|
||||
};
|
||||
|
||||
#endif // CACCIDENTREVIEWDIALOG_H
|
||||
@ -1,239 +0,0 @@
|
||||
#include "CAiAlarmDataCollect.h"
|
||||
#include "pub_logger_api/logger.h"
|
||||
#include "CAlarmMsgManage.h"
|
||||
#include <QDebug>
|
||||
#include "CAlarmDataCollect.h"
|
||||
using namespace iot_service;
|
||||
CAiAlarmDataCollect * CAiAlarmDataCollect::m_pInstance = NULL;
|
||||
CAiAlarmDataCollect::CAiAlarmDataCollect()
|
||||
: CIntelliAlmApi4Clt(),
|
||||
m_referenceCount(0),
|
||||
m_bFaultRecallState(false),
|
||||
m_pAlternateTimer(Q_NULLPTR)
|
||||
{
|
||||
m_rtdbMutex = new QMutex();
|
||||
m_rtdbPriorityOrderAccess = new iot_dbms::CRdbAccess();
|
||||
m_rtdbPriorityOrderAccess->open("base", "alarm_level_define");
|
||||
}
|
||||
|
||||
CAiAlarmDataCollect::~CAiAlarmDataCollect()
|
||||
{
|
||||
LOGDEBUG("CAiAlarmDataCollect::~CAiAlarmDataCollect()");
|
||||
qDebug() << "~CAiAlarmDataCollect()";
|
||||
}
|
||||
|
||||
void CAiAlarmDataCollect::refrence()
|
||||
{
|
||||
m_referenceCount++;
|
||||
}
|
||||
|
||||
int CAiAlarmDataCollect::getRefrenceCount()
|
||||
{
|
||||
return m_referenceCount;
|
||||
}
|
||||
|
||||
CAiAlarmDataCollect *CAiAlarmDataCollect::instance()
|
||||
{
|
||||
if(NULL == m_pInstance)
|
||||
{
|
||||
m_pInstance = new CAiAlarmDataCollect();
|
||||
}
|
||||
return m_pInstance;
|
||||
}
|
||||
|
||||
void CAiAlarmDataCollect::initialize()
|
||||
{
|
||||
resumeThread();
|
||||
if(!m_pAlternateTimer)
|
||||
{
|
||||
m_pAlternateTimer = new QTimer();
|
||||
m_pAlternateTimer->setInterval(1000);
|
||||
connect(m_pAlternateTimer, &QTimer::timeout, this, &CAiAlarmDataCollect::slotAiAlarmStateChanged);
|
||||
connect(this, &CAiAlarmDataCollect::sigTimerShot, this, &CAiAlarmDataCollect::slotTimerShot, Qt::QueuedConnection);
|
||||
}
|
||||
if(!m_bFaultRecallState)
|
||||
{
|
||||
emit sigTimerShot(true);
|
||||
}
|
||||
}
|
||||
|
||||
void CAiAlarmDataCollect::release()
|
||||
{
|
||||
emit sigTimerShot(false);
|
||||
suspendThread(true);
|
||||
}
|
||||
|
||||
bool CAiAlarmDataCollect::isFaultRecallState()
|
||||
{
|
||||
return m_bFaultRecallState;
|
||||
}
|
||||
|
||||
bool CAiAlarmDataCollect::requestDelAlm(iot_idl::SIntelliAlmDel &objDelAlm)
|
||||
{
|
||||
LOGDEBUG("请求删除!");
|
||||
return iot_service::CIntelliAlmApi4Clt::requestDelAlm(objDelAlm);
|
||||
}
|
||||
|
||||
bool CAiAlarmDataCollect::requestSeprAlm(iot_idl::SIntelliAlmSepr &objSeprAlm)
|
||||
{
|
||||
LOGDEBUG("请求分离!");
|
||||
return iot_service::CIntelliAlmApi4Clt::requestSeprAlm(objSeprAlm);
|
||||
}
|
||||
|
||||
bool CAiAlarmDataCollect::requestMergeAlm(iot_idl::SIntelliAlmMerge &objMergeAlm)
|
||||
{
|
||||
LOGDEBUG("请求合并!");
|
||||
return iot_service::CIntelliAlmApi4Clt::requestMergeAlm(objMergeAlm);
|
||||
}
|
||||
|
||||
void CAiAlarmDataCollect::handleAllAlmMsg(int nDomainId, iot_idl::SIntelliAlmAdd &objAllAlm)
|
||||
{
|
||||
LOGINFO("========== AiAlarmDataCollect handleAllAlmMsg ==========");
|
||||
|
||||
//< 清空该域缓存
|
||||
QMutexLocker locker(m_rtdbMutex);
|
||||
CAlarmMsgManage::instance()->removeAiAlarmMsgByDomainID(nDomainId);
|
||||
//构建告警
|
||||
int nAlarmCount = objAllAlm.alm_info_size();
|
||||
QList<AiAlarmMsgPtr> almList;
|
||||
for(int nAddMsgIndex(0); nAddMsgIndex < nAlarmCount; nAddMsgIndex++)
|
||||
{
|
||||
iot_idl::SIntelliAlmInfo msg = objAllAlm.alm_info(nAddMsgIndex);
|
||||
AiAlarmMsgPtr alm(new CAiAlarmMsgInfo());
|
||||
alm->initialize(msg);
|
||||
alm->priorityOrder = queryPriorityOrder(alm->priority);
|
||||
almList.append(alm);
|
||||
}
|
||||
CAlarmMsgManage::instance()->addAiAllAlarmMsg(almList);//添加全部完成后,通知model重新拉取数据
|
||||
LOGDEBUG("AiAlarmDataCollect handleAllAlmMsg():count[%d]",nAlarmCount);
|
||||
emit sigMsgRefresh();
|
||||
}
|
||||
|
||||
void CAiAlarmDataCollect::handleAddAlmMsg(iot_idl::SIntelliAlmAdd &objAddAlm)
|
||||
{
|
||||
LOGINFO("========== AiAlarmDataCollect handleAddAlmMsg ==========");
|
||||
QMutexLocker locker(m_rtdbMutex);
|
||||
//构建告警
|
||||
int nAlarmCount = objAddAlm.alm_info_size();
|
||||
QList<AiAlarmMsgPtr> almList;
|
||||
for(int nAddMsgIndex(0); nAddMsgIndex < nAlarmCount; nAddMsgIndex++)
|
||||
{
|
||||
iot_idl::SIntelliAlmInfo msg = objAddAlm.alm_info(nAddMsgIndex);
|
||||
AiAlarmMsgPtr alm(new CAiAlarmMsgInfo());
|
||||
alm->initialize(msg);
|
||||
alm->priorityOrder = queryPriorityOrder(alm->priority);
|
||||
almList.append(alm);
|
||||
}
|
||||
CAlarmMsgManage::instance()->addAiAlarmMsg(almList); //单独添加的时候,来一条通知一次model添加
|
||||
LOGDEBUG("AiAlarmDataCollect handleAddAlmMsg():count[%d]",nAlarmCount);
|
||||
}
|
||||
|
||||
void CAiAlarmDataCollect::handleDelAlmMsg(iot_idl::SIntelliAlmDel &objDelAlm)
|
||||
{
|
||||
LOGINFO("========== AiAlarmDataCollect handleDelAlmMsg ==========");
|
||||
QMutexLocker locker(m_rtdbMutex);
|
||||
//构建告警
|
||||
int nAlarmCount = objDelAlm.uuid_base64_size();
|
||||
QList<QString> uuidList;
|
||||
for(int nDelMsgIndex(0); nDelMsgIndex < nAlarmCount; nDelMsgIndex++)
|
||||
{
|
||||
QString uuid = QString::fromStdString(objDelAlm.uuid_base64(nDelMsgIndex));
|
||||
uuidList.append(uuid);
|
||||
}
|
||||
CAlarmMsgManage::instance()->delAiAlarmMsg(uuidList);
|
||||
LOGDEBUG("AiAlarmDataCollect handleDelAlmMsg():count[%d]",nAlarmCount);
|
||||
}
|
||||
|
||||
void CAiAlarmDataCollect::handleBrokenAlmMsg(iot_idl::SIntelliAlmBroken &objBrokenAlm)
|
||||
{
|
||||
//先保证能够编译通过
|
||||
LOGINFO("========== AiAlarmDataCollect handleBrokenAlmMsg ==========");
|
||||
QMutexLocker locker(m_rtdbMutex);
|
||||
int nAlarmCount = objBrokenAlm.uuid_base64_size();
|
||||
QList<QString> uuidList;
|
||||
for(int nBrokenMsgIndex(0); nBrokenMsgIndex < nAlarmCount; nBrokenMsgIndex++)
|
||||
{
|
||||
QString uuid = QString::fromStdString(objBrokenAlm.uuid_base64(nBrokenMsgIndex));
|
||||
uuidList.append(uuid);
|
||||
}
|
||||
CAlarmMsgManage::instance()->brokenAiAlarmMsg(uuidList);
|
||||
LOGDEBUG("AiAlarmDataCollect handleBrokenAlmMsg():count[%d]",nAlarmCount);
|
||||
}
|
||||
|
||||
void CAiAlarmDataCollect::handleReleaseAlmMsg(iot_idl::SIntelliAlmRelease &objReleaseAlm)
|
||||
{
|
||||
//先保证能够编译通过
|
||||
LOGINFO("========== AiAlarmDataCollect handleReleaseAlmMsg ==========");
|
||||
QMutexLocker locker(m_rtdbMutex);
|
||||
int nAlarmCount = objReleaseAlm.uuid_base64_size();
|
||||
QList<QString> uuidList;
|
||||
for(int nReleaseMsgIndex(0); nReleaseMsgIndex < nAlarmCount; nReleaseMsgIndex++)
|
||||
{
|
||||
QString uuid = QString::fromStdString(objReleaseAlm.uuid_base64(nReleaseMsgIndex));
|
||||
uuidList.append(uuid);
|
||||
}
|
||||
CAlarmMsgManage::instance()->releaseAiAlarmMsg(uuidList);
|
||||
LOGDEBUG("AiAlarmDataCollect handleReleaseAlmMsg():count[%d]",nAlarmCount);
|
||||
}
|
||||
|
||||
void CAiAlarmDataCollect::destory()
|
||||
{
|
||||
LOGINFO("退出时:CAiAlarmDataCollect::destory()打开窗口的个数m_referenceCount:[%d]",m_referenceCount);
|
||||
if(--m_referenceCount > 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
slotTimerShot(false);
|
||||
suspendThread();
|
||||
{
|
||||
QMutexLocker locker(m_rtdbMutex);
|
||||
if(Q_NULLPTR != m_pAlternateTimer)
|
||||
{
|
||||
m_pAlternateTimer->stop();
|
||||
m_pAlternateTimer->deleteLater();
|
||||
}
|
||||
m_pAlternateTimer = Q_NULLPTR;
|
||||
}
|
||||
delete m_rtdbMutex;
|
||||
delete m_rtdbPriorityOrderAccess;
|
||||
m_pInstance = NULL;
|
||||
delete this;
|
||||
}
|
||||
|
||||
void CAiAlarmDataCollect::slotTimerShot(const bool start)
|
||||
{
|
||||
if(m_pAlternateTimer)
|
||||
{
|
||||
if(start)
|
||||
{
|
||||
m_pAlternateTimer->start();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pAlternateTimer->stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CAiAlarmDataCollect::slotSwitchFaultRecallState(bool bFaultRecallState)
|
||||
{
|
||||
m_bFaultRecallState = bFaultRecallState;
|
||||
release();
|
||||
m_pInstance->reinit(m_bFaultRecallState);
|
||||
CAlarmMsgManage::instance()->release();
|
||||
//initialize();
|
||||
}
|
||||
|
||||
int CAiAlarmDataCollect::queryPriorityOrder(int &id)
|
||||
{
|
||||
iot_dbms::CTableLockGuard locker(*m_rtdbPriorityOrderAccess);
|
||||
iot_dbms::CVarType value = -1000;
|
||||
m_rtdbPriorityOrderAccess->getColumnValueByKey((void*)&id, "priority_order", value);
|
||||
return value.toInt();
|
||||
}
|
||||
|
||||
void CAiAlarmDataCollect::slotAiAlarmStateChanged()
|
||||
{
|
||||
QMutexLocker locker(m_rtdbMutex);
|
||||
CAlarmMsgManage::instance()->dealDelayAi();
|
||||
}
|
||||
@ -1,84 +0,0 @@
|
||||
#ifndef CAIALARMDATACOLLECT_H
|
||||
#define CAIALARMDATACOLLECT_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
#include <QThread>
|
||||
#include <QMap>
|
||||
#include <QTimer>
|
||||
#include "IntelliAlmMsg.pb.h"
|
||||
#include "CAiAlarmMsgInfo.h"
|
||||
#include "net_msg_bus_api/MsgBusApi.h"
|
||||
#include "dbms/rdb_api/CRdbAccess.h"
|
||||
|
||||
class CAiAlarmDataCollect : public QObject, public iot_service::CIntelliAlmApi4Clt
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static CAiAlarmDataCollect *instance();
|
||||
|
||||
virtual ~CAiAlarmDataCollect();
|
||||
|
||||
void refrence();
|
||||
|
||||
int getRefrenceCount();
|
||||
|
||||
bool isFaultRecallState();
|
||||
|
||||
virtual bool requestDelAlm(iot_idl::SIntelliAlmDel &objDelAlm);
|
||||
|
||||
virtual bool requestSeprAlm(iot_idl::SIntelliAlmSepr &objSeprAlm);
|
||||
|
||||
virtual bool requestMergeAlm(iot_idl::SIntelliAlmMerge &objMergeAlm);
|
||||
|
||||
virtual void handleAllAlmMsg(int nDomainId,iot_idl::SIntelliAlmAdd &objAllAlm);
|
||||
|
||||
virtual void handleAddAlmMsg(iot_idl::SIntelliAlmAdd &objAddAlm);
|
||||
|
||||
virtual void handleDelAlmMsg(iot_idl::SIntelliAlmDel &objDelAlm);
|
||||
|
||||
virtual void handleBrokenAlmMsg(iot_idl::SIntelliAlmBroken &objBrokenAlm);
|
||||
|
||||
virtual void handleReleaseAlmMsg(iot_idl::SIntelliAlmRelease &objReleaseAlm);
|
||||
signals:
|
||||
//< 启停定时器
|
||||
void sigTimerShot(const bool bStop);
|
||||
|
||||
//< 定时更新,通知model刷新界面
|
||||
void sigUpdateAlarmView();
|
||||
|
||||
//< 通知所有告警插件禁用/使能告警操作
|
||||
void sigAlarmOperateEnable(const bool &bEnable);
|
||||
|
||||
//< 通知model重新拉取告警消息
|
||||
void sigMsgRefresh();
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
void initialize();
|
||||
|
||||
void release();
|
||||
|
||||
void destory();
|
||||
|
||||
void slotTimerShot(const bool start);
|
||||
|
||||
void slotSwitchFaultRecallState(bool bFaultRecallState);
|
||||
|
||||
private:
|
||||
CAiAlarmDataCollect();
|
||||
|
||||
int queryPriorityOrder(int &id);
|
||||
private slots:
|
||||
void slotAiAlarmStateChanged();
|
||||
private:
|
||||
int m_referenceCount;
|
||||
bool m_bFaultRecallState;
|
||||
QMutex *m_rtdbMutex;
|
||||
QTimer * m_pAlternateTimer;
|
||||
iot_dbms::CRdbAccess * m_rtdbPriorityOrderAccess;
|
||||
static CAiAlarmDataCollect * m_pInstance;
|
||||
};
|
||||
|
||||
#endif // CAIALARMDATACOLLECT_H
|
||||
@ -1,408 +0,0 @@
|
||||
#include "CAiAlarmDelegate.h"
|
||||
#include <QFile>
|
||||
#include "pub_utility_api/FileUtil.h"
|
||||
#include "pub_utility_api/FileStyle.h"
|
||||
#include "pub_logger_api/logger.h"
|
||||
#include <QDomDocument>
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
#include <QApplication>
|
||||
#include <QProcess>
|
||||
|
||||
CAiAlarmDelegate::CAiAlarmDelegate(CAiAlarmTreeModel *model, QObject *parent)
|
||||
: QStyledItemDelegate(parent),
|
||||
m_pModel(model),
|
||||
m_enableTrend(true),
|
||||
m_enableLevel(false),
|
||||
m_enableVideo(true),
|
||||
m_enableWave(true),
|
||||
m_selectIsEmpty(false)
|
||||
{
|
||||
slotLoadConfig();
|
||||
}
|
||||
|
||||
void CAiAlarmDelegate::setEnableTrend(bool isNeed)
|
||||
{
|
||||
m_enableTrend = isNeed;
|
||||
}
|
||||
|
||||
void CAiAlarmDelegate::setEnableLevel(bool isNeed)
|
||||
{
|
||||
m_enableLevel = isNeed;
|
||||
}
|
||||
|
||||
void CAiAlarmDelegate::setEnableVideo(bool isNeed)
|
||||
{
|
||||
m_enableVideo = isNeed;
|
||||
}
|
||||
|
||||
void CAiAlarmDelegate::setEnableWave(bool isNeed)
|
||||
{
|
||||
m_enableWave = isNeed;
|
||||
}
|
||||
|
||||
void CAiAlarmDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
if(!index.isValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
CAiAlarmTreeItem *item = m_pModel->getItem(index);
|
||||
|
||||
bool select = option.state & QStyle::State_Selected;
|
||||
QColor fillColor;
|
||||
QColor penColor;
|
||||
if(item->isAi())
|
||||
{
|
||||
AiAlarmMsgPtr aiptr = NULL;
|
||||
if(item->getAiPtr(aiptr) && aiptr != NULL)
|
||||
{
|
||||
painter->save();
|
||||
|
||||
if(CAlarmMsgManage::instance()->ifhaveNotConfirmAlmByuuid(aiptr->uuid_base64)) //包含的原始告警没有全部被确认
|
||||
{
|
||||
if(select)
|
||||
{
|
||||
fillColor = m_select_background_color;
|
||||
if(m_selectIsEmpty)
|
||||
{
|
||||
penColor = m_colorMap.value(aiptr->priorityOrder).active_text_color;
|
||||
}else
|
||||
{
|
||||
penColor = m_select_text_color;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(aiptr->main_state == E_ALS_RETURN || aiptr->main_state == E_ALS_RETURN_CFM
|
||||
|| aiptr->main_state == E_ALS_RETURN_DEL || aiptr->main_state == E_ALS_RETURN_CFM_DEL)
|
||||
{
|
||||
penColor = m_colorMap.value(aiptr->priorityOrder).resume_text_color;
|
||||
}else
|
||||
{
|
||||
penColor = m_colorMap.value(aiptr->priorityOrder).active_text_color;
|
||||
}
|
||||
|
||||
fillColor = m_colorMap.value(aiptr->priorityOrder).background_color;
|
||||
}
|
||||
}else //此条智能告警可以删除(置灰)
|
||||
{
|
||||
if(select)
|
||||
{
|
||||
fillColor = m_select_background_color;
|
||||
}
|
||||
else
|
||||
{
|
||||
fillColor = m_colorMap.value(aiptr->priorityOrder).confirm_color;
|
||||
}
|
||||
penColor = m_colorMap.value(aiptr->priorityOrder).confirm_text_color;
|
||||
}
|
||||
painter->setPen(penColor);
|
||||
painter->fillRect(option.rect, fillColor);
|
||||
if(m_enableVideo && BUTTON_COLUMN == index.column() && aiptr->m_needVideoAlm)
|
||||
{
|
||||
painter->save();
|
||||
QStyleOptionButton button;
|
||||
button.state |= QStyle::State_Enabled;
|
||||
button.rect = option.rect;
|
||||
|
||||
button.rect.adjust(option.rect.width() - 40, option.rect.height()/2-10, -12, -(option.rect.height()/2-10));
|
||||
button.iconSize = QSize(button.rect.width()+2,button.rect.height()+2);
|
||||
button.icon = QIcon(m_strVideoPath);
|
||||
button.features = QStyleOptionButton::Flat;
|
||||
QApplication::style()->drawControl(QStyle::CE_PushButton,&button,painter);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
if(m_enableLevel && ICON_COLUMN == index.column())
|
||||
{
|
||||
painter->save();
|
||||
QStyleOptionButton button;
|
||||
button.state |= QStyle::State_Enabled;
|
||||
button.rect = option.rect;
|
||||
|
||||
button.rect.adjust(12, option.rect.height()/2-10, -(option.rect.width()-40), -(option.rect.height()/2-10));
|
||||
QString file = m_colorMap.value(aiptr->priorityOrder).icon;
|
||||
button.iconSize = QSize(button.rect.width()+2,button.rect.height()+2);
|
||||
button.icon = QIcon(file);
|
||||
button.features = QStyleOptionButton::Flat;
|
||||
QApplication::style()->drawControl(QStyle::CE_PushButton,&button,painter);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
if( m_enableTrend && BUTTON_COLUMN == index.column() && (aiptr->m_tagname_type == E_TAGNAME_ANA || aiptr->m_tagname_type == E_TAGNAME_ACC))
|
||||
{
|
||||
painter->save();
|
||||
QStyleOptionButton button;
|
||||
button.state |= QStyle::State_Enabled;
|
||||
button.rect = option.rect;
|
||||
|
||||
button.rect.adjust(option.rect.width() - 40 -40, option.rect.height()/2-10, -12-40, -(option.rect.height()/2-10));
|
||||
button.iconSize = QSize(button.rect.width()+2,button.rect.height()+2);
|
||||
button.icon = QIcon(m_strTrendPath);
|
||||
button.features = QStyleOptionButton::Flat;
|
||||
QApplication::style()->drawControl(QStyle::CE_PushButton,&button,painter);
|
||||
painter->restore();
|
||||
}
|
||||
painter->drawText(option.rect, m_pModel->data(index, Qt::TextAlignmentRole).toInt(), m_pModel->data(index).toString());
|
||||
painter->restore();
|
||||
}else
|
||||
{
|
||||
return ;
|
||||
}
|
||||
}else
|
||||
{
|
||||
AlarmMsgPtr ptr = NULL;
|
||||
if(item->getPtr(ptr) && ptr != NULL)
|
||||
{
|
||||
painter->save();
|
||||
if(ptr->logic_state == E_ALS_RETURN || ptr->logic_state == E_ALS_RETURN_DEL)//返回未确认
|
||||
{
|
||||
if(select)
|
||||
{
|
||||
fillColor = m_select_background_color;
|
||||
if(m_selectIsEmpty)
|
||||
{
|
||||
penColor = m_colorMap.value(ptr->priorityOrder).resume_text_color;
|
||||
}else
|
||||
{
|
||||
penColor = m_select_text_color;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
penColor = m_colorMap.value(ptr->priorityOrder).resume_text_color;
|
||||
fillColor = m_colorMap.value(ptr->priorityOrder).background_color;
|
||||
}
|
||||
}else if(ptr->logic_state == E_ALS_ALARM || ptr->logic_state == E_ALS_ALARM_DEL)//告警未确认
|
||||
{
|
||||
if(select)
|
||||
{
|
||||
fillColor = m_select_background_color;
|
||||
if(m_selectIsEmpty)
|
||||
{
|
||||
penColor = m_colorMap.value(ptr->priorityOrder).active_text_color;
|
||||
}else
|
||||
{
|
||||
penColor = m_select_text_color;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
penColor = m_colorMap.value(ptr->priorityOrder).active_text_color;
|
||||
fillColor = m_colorMap.value(ptr->priorityOrder).background_color;
|
||||
}
|
||||
}else
|
||||
{
|
||||
if(select)
|
||||
{
|
||||
fillColor = m_select_background_color;
|
||||
}
|
||||
else
|
||||
{
|
||||
fillColor = m_colorMap.value(ptr->priorityOrder).confirm_color;
|
||||
}
|
||||
penColor = m_colorMap.value(ptr->priorityOrder).confirm_text_color;
|
||||
}
|
||||
painter->setPen(penColor);
|
||||
painter->fillRect(option.rect, fillColor);
|
||||
|
||||
if(m_enableVideo && BUTTON_COLUMN == index.column() && ptr->m_needVideoAlm)
|
||||
{
|
||||
painter->save();
|
||||
QStyleOptionButton button;
|
||||
button.state |= QStyle::State_Enabled;
|
||||
button.rect = option.rect;
|
||||
|
||||
button.rect.adjust(option.rect.width() - 40, option.rect.height()/2-10, -12, -(option.rect.height()/2-10));
|
||||
button.iconSize = QSize(button.rect.width()+2,button.rect.height()+2);
|
||||
button.icon = QIcon(m_strVideoPath);
|
||||
button.features = QStyleOptionButton::Flat;
|
||||
QApplication::style()->drawControl(QStyle::CE_PushButton,&button,painter);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
if(m_enableLevel && ICON_COLUMN == index.column())
|
||||
{
|
||||
painter->save();
|
||||
QStyleOptionButton button;
|
||||
button.state |= QStyle::State_Enabled;
|
||||
button.rect = option.rect;
|
||||
|
||||
button.rect.adjust(12, option.rect.height()/2-10, -(option.rect.width()-40), -(option.rect.height()/2-10));
|
||||
QString file = m_colorMap.value(ptr->priorityOrder).icon;
|
||||
button.iconSize = QSize(button.rect.width()+2,button.rect.height()+2);
|
||||
button.icon = QIcon(file);
|
||||
button.features = QStyleOptionButton::Flat;
|
||||
|
||||
QApplication::style()->drawControl(QStyle::CE_PushButton,&button,painter);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
if( m_enableTrend && BUTTON_COLUMN == index.column() && (ptr->m_tagname_type == E_TAGNAME_ANA || ptr->m_tagname_type == E_TAGNAME_ACC))
|
||||
{
|
||||
painter->save();
|
||||
QStyleOptionButton button;
|
||||
button.state |= QStyle::State_Enabled;
|
||||
button.rect = option.rect;
|
||||
|
||||
button.rect.adjust(option.rect.width() - 40 -40, option.rect.height()/2-10, -12-40, -(option.rect.height()/2-10));
|
||||
button.iconSize = QSize(button.rect.width()+2,button.rect.height()+2);
|
||||
button.icon = QIcon(m_strTrendPath);
|
||||
button.features = QStyleOptionButton::Flat;
|
||||
QApplication::style()->drawControl(QStyle::CE_PushButton,&button,painter);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
if( m_enableWave && BUTTON_COLUMN == index.column() && !ptr->wave_file.isEmpty())
|
||||
{
|
||||
painter->save();
|
||||
QStyleOptionButton button;
|
||||
button.state |= QStyle::State_Enabled;
|
||||
button.rect = option.rect;
|
||||
|
||||
button.rect.adjust(option.rect.width() - 40 -40 -40, option.rect.height()/2-10, -12-40-40, -(option.rect.height()/2-10));
|
||||
button.iconSize = QSize(button.rect.width()+2,button.rect.height()+2);
|
||||
button.icon = QIcon(m_strWavePath);
|
||||
button.features = QStyleOptionButton::Flat;
|
||||
QApplication::style()->drawControl(QStyle::CE_PushButton,&button,painter);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
painter->drawText(option.rect, m_pModel->data(index, Qt::TextAlignmentRole).toInt(), m_pModel->data(index).toString());
|
||||
painter->restore();
|
||||
}else
|
||||
{
|
||||
return ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CAiAlarmDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
|
||||
{
|
||||
if(!index.isValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(index.column() != BUTTON_COLUMN)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
|
||||
CAiAlarmTreeItem *item = m_pModel->getItem(index);
|
||||
if(item->isAi())
|
||||
{
|
||||
AiAlarmMsgPtr ptr = NULL;
|
||||
if(item->getAiPtr(ptr) && ptr != NULL)
|
||||
{
|
||||
if(mouseEvent != NULL && mouseEvent->button() == Qt::LeftButton && mouseEvent->type() == QMouseEvent::MouseButtonPress)
|
||||
{
|
||||
if(m_enableVideo && ptr->m_needVideoAlm)
|
||||
{
|
||||
QStyleOptionButton button;
|
||||
button.rect = option.rect;
|
||||
button.rect.adjust(option.rect.width() - 42, option.rect.height()/2-10, -10, -(option.rect.height()/2-10));
|
||||
QRect rect = button.rect;
|
||||
if(rect.contains(mouseEvent->pos()))
|
||||
{
|
||||
QString pointTag = ptr->key_id_tag;
|
||||
pointTag.remove(pointTag.length()-6,6);
|
||||
emit openVideo(ptr->domain_id,ptr->app_id,pointTag,ptr->time_stamp-VIDEO_TIME,ptr->time_stamp+VIDEO_TIME);
|
||||
}
|
||||
}
|
||||
if( m_enableTrend && (ptr->m_tagname_type == E_TAGNAME_ACC || ptr->m_tagname_type == E_TAGNAME_ANA))
|
||||
{
|
||||
QStyleOptionButton button;
|
||||
button.rect = option.rect;
|
||||
button.rect.adjust(option.rect.width() - 82, option.rect.height()/2-10, -50, -(option.rect.height()/2-10));
|
||||
QRect rect = button.rect;
|
||||
|
||||
if(rect.contains(mouseEvent->pos()))
|
||||
{
|
||||
QStringList trendList;
|
||||
trendList.append(ptr->key_id_tag);
|
||||
emit openTrend(ptr->time_stamp,trendList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else
|
||||
{
|
||||
AlarmMsgPtr ptr = NULL;
|
||||
if(item->getPtr(ptr) && ptr != NULL)
|
||||
{
|
||||
if(m_enableVideo && ptr->m_needVideoAlm)
|
||||
{
|
||||
if(mouseEvent != NULL && mouseEvent->button() == Qt::LeftButton && mouseEvent->type() == QMouseEvent::MouseButtonPress)
|
||||
{
|
||||
QStyleOptionButton button;
|
||||
button.rect = option.rect;
|
||||
button.rect.adjust(option.rect.width() - 42, option.rect.height()/2-10, -10, -(option.rect.height()/2-10));
|
||||
QRect rect = button.rect;
|
||||
QString pointTag = ptr->key_id_tag;
|
||||
pointTag.remove(pointTag.length()-6,6);
|
||||
if(rect.contains(mouseEvent->pos()))
|
||||
{
|
||||
QString pointTag = ptr->key_id_tag;
|
||||
pointTag.remove(pointTag.length()-6,6);
|
||||
emit openVideo(ptr->domain_id,ptr->app_id,pointTag,ptr->time_stamp-VIDEO_TIME,ptr->time_stamp+VIDEO_TIME);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(m_enableTrend && (ptr->m_tagname_type == E_TAGNAME_ACC || ptr->m_tagname_type == E_TAGNAME_ANA))
|
||||
{
|
||||
if(mouseEvent != NULL && mouseEvent->button() == Qt::LeftButton && mouseEvent->type() == QMouseEvent::MouseButtonPress)
|
||||
{
|
||||
QStyleOptionButton button;
|
||||
button.rect = option.rect;
|
||||
button.rect.adjust(option.rect.width() - 82, option.rect.height()/2-10, -50, -(option.rect.height()/2-10));
|
||||
QRect rect = button.rect;
|
||||
if(rect.contains(mouseEvent->pos()))
|
||||
{
|
||||
QStringList trendList;
|
||||
trendList.append(ptr->key_id_tag);
|
||||
emit openTrend(ptr->time_stamp,trendList);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(m_enableWave && !ptr->wave_file.isEmpty())
|
||||
{
|
||||
if(mouseEvent != NULL && mouseEvent->button() == Qt::LeftButton && mouseEvent->type() == QMouseEvent::MouseButtonPress)
|
||||
{
|
||||
QStyleOptionButton button;
|
||||
button.rect = option.rect;
|
||||
button.rect.adjust(option.rect.width() - 122, option.rect.height()/2-10, -90, -(option.rect.height()/2-10));
|
||||
QRect rect = button.rect;
|
||||
if(rect.contains(mouseEvent->pos()))
|
||||
{
|
||||
QString wave = ptr->wave_file;
|
||||
wave = QString("%1%2%3").arg("\"").arg(wave).arg("\"");
|
||||
LOGINFO("录波文件为:%s",wave.toStdString().c_str());
|
||||
|
||||
const std::string strProc = std::move(iot_public::CFileUtil::getPathOfBinFile(
|
||||
std::string("WaveAnalyze") + iot_public::CFileUtil::getProcSuffix()));
|
||||
if(strProc.empty())
|
||||
LOGERROR("未找到可执行文件WaveAnalyze");
|
||||
else
|
||||
QProcess::startDetached(QString("%1 %2").arg(strProc.c_str()).arg(wave));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return QStyledItemDelegate::editorEvent(event, model, option, index);
|
||||
}
|
||||
|
||||
void CAiAlarmDelegate::slotLoadConfig()
|
||||
{
|
||||
CAlarmSetMng::instance()->getColorMap(m_colorMap);
|
||||
CAlarmSetMng::instance()->getSelectInfo(m_selectIsEmpty,m_select_background_color,m_select_text_color);
|
||||
CAlarmSetMng::instance()->getEmptyInfo(m_emptyBackgroundColor,m_emptyTipColor,m_emptyTip);
|
||||
//CAlarmColorMng::instance()->getActAndFunc(m_act,m_func);
|
||||
|
||||
std::string style = iot_public::CFileStyle::getCurStyle();
|
||||
m_strTrendPath = iot_public::CFileUtil::getPathOfResFile("gui/icon/alarm/trend_"+style+".png").c_str();
|
||||
m_strVideoPath = iot_public::CFileUtil::getPathOfResFile("gui/icon/alarm/video_"+style+".png").c_str();
|
||||
m_strWavePath = iot_public::CFileUtil::getPathOfResFile("gui/icon/alarm/wave_"+style+".png").c_str();
|
||||
}
|
||||
@ -1,50 +0,0 @@
|
||||
#ifndef CAIALARMDELEGATE_H
|
||||
#define CAIALARMDELEGATE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QStyledItemDelegate>
|
||||
#include "CAiAlarmTreeModel.h"
|
||||
#include "CAlarmSetMng.h"
|
||||
|
||||
class CAiAlarmDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CAiAlarmDelegate(CAiAlarmTreeModel *model, QObject *parent = 0);
|
||||
void setEnableTrend(bool isNeed);
|
||||
void setEnableLevel(bool isNeed);
|
||||
void setEnableVideo(bool isNeed);
|
||||
void setEnableWave(bool isNeed);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index);
|
||||
signals:
|
||||
void openVideo(int domainId,int appId,QString tag,quint64 startTime,quint64 endTime);
|
||||
void openTrend(quint64 time_stamp,QStringList tagList);
|
||||
|
||||
public slots:
|
||||
void slotLoadConfig();
|
||||
|
||||
private:
|
||||
CAiAlarmTreeModel *m_pModel;
|
||||
|
||||
bool m_enableTrend;
|
||||
bool m_enableLevel;
|
||||
bool m_enableVideo;
|
||||
bool m_enableWave;
|
||||
|
||||
QMap<int,CAlarmColorInfo> m_colorMap;
|
||||
QColor m_select_background_color,m_select_text_color; //选中告警背景色和文字颜色
|
||||
bool m_selectIsEmpty;
|
||||
|
||||
QColor m_emptyBackgroundColor,m_emptyTipColor;
|
||||
QString m_emptyTip;
|
||||
int m_act;
|
||||
int m_func;
|
||||
|
||||
QString m_strWavePath;
|
||||
QString m_strVideoPath;
|
||||
QString m_strTrendPath;
|
||||
};
|
||||
|
||||
#endif // CAIALARMDELEGATE_H
|
||||
@ -1,466 +0,0 @@
|
||||
#include "CAiAlarmMsgInfo.h"
|
||||
#include <QDateTime>
|
||||
#include "CAlarmDataCollect.h"
|
||||
#include <QDebug>
|
||||
|
||||
CAiAlarmMsgInfo::CAiAlarmMsgInfo()
|
||||
{
|
||||
logic_state = E_AiALM_IALS_NORMAL;
|
||||
main_state = E_ALS_BAD;
|
||||
domain_id = -1;
|
||||
priority = -1;
|
||||
time_stamp = 1000;
|
||||
|
||||
uuid_base64 = QString();
|
||||
content = QString();
|
||||
disposal_plan = QString();
|
||||
raw_alm_uuid.clear();
|
||||
|
||||
priorityOrder = -1;
|
||||
deleteFlag = false;
|
||||
brokenFlag = false;
|
||||
releaseFlag = false;
|
||||
m_needVideoAlm =false;
|
||||
app_id = -1;
|
||||
main_uuid_base64 = QString();
|
||||
key_id_tag = QString();
|
||||
m_tagname_type = E_TAGNAME_ERROR;
|
||||
}
|
||||
|
||||
CAiAlarmMsgInfo::CAiAlarmMsgInfo(const CAiAlarmMsgInfo &other): priority(0)
|
||||
{
|
||||
logic_state = other.logic_state;
|
||||
main_state = other.main_state;
|
||||
domain_id = other.domain_id;
|
||||
time_stamp = other.time_stamp;
|
||||
|
||||
uuid_base64 = other.uuid_base64;
|
||||
content = other.content;
|
||||
disposal_plan = other.disposal_plan;
|
||||
raw_alm_uuid = other.raw_alm_uuid;
|
||||
|
||||
priorityOrder = other.priorityOrder;
|
||||
deleteFlag = other.deleteFlag;
|
||||
brokenFlag = other.brokenFlag;
|
||||
releaseFlag = other.releaseFlag;
|
||||
|
||||
m_needVideoAlm = other.m_needVideoAlm;
|
||||
app_id = other.app_id;
|
||||
main_uuid_base64 = other.main_uuid_base64;
|
||||
key_id_tag = other.key_id_tag;
|
||||
m_tagname_type = other.m_tagname_type;
|
||||
}
|
||||
|
||||
void CAiAlarmMsgInfo::initialize(const iot_idl::SIntelliAlmInfo &alarmInfo)
|
||||
{
|
||||
|
||||
logic_state = (E_AiALARM_LOGICSTATE)alarmInfo.logic_state();
|
||||
domain_id = alarmInfo.domain_id();
|
||||
priority = alarmInfo.priority();
|
||||
time_stamp = alarmInfo.time_stamp();
|
||||
|
||||
uuid_base64 = QString::fromStdString(alarmInfo.uuid_base64());
|
||||
content = QString::fromStdString(alarmInfo.content());
|
||||
disposal_plan = QString::fromStdString(alarmInfo.disposal_plan());
|
||||
raw_alm_uuid.clear(); //< 关联的原始告警uuid
|
||||
for(int x(0); x < alarmInfo.raw_alm_uuid_size(); x++)
|
||||
{
|
||||
if(x == 0)
|
||||
{
|
||||
main_uuid_base64 = QString::fromStdString(alarmInfo.raw_alm_uuid(x));
|
||||
}
|
||||
raw_alm_uuid.append(QString::fromStdString(alarmInfo.raw_alm_uuid(x)));
|
||||
}
|
||||
|
||||
priorityOrder = -1;
|
||||
if(logic_state == E_AIALM_IALS_DELETED)
|
||||
{
|
||||
deleteFlag = true;
|
||||
}else
|
||||
{
|
||||
deleteFlag = false;
|
||||
}
|
||||
if(logic_state == E_AIALM_IALS_BROKEN)
|
||||
{
|
||||
brokenFlag = true;
|
||||
}else
|
||||
{
|
||||
brokenFlag = false;
|
||||
}
|
||||
releaseFlag = false;
|
||||
m_needVideoAlm =false;
|
||||
}
|
||||
|
||||
bool CAiAlarmMsgInfo::ailessThan(const AlarmMsgPtr &info, E_ALARM_SORTKEY sortkey)
|
||||
{
|
||||
switch (sortkey) {
|
||||
case E_SORT_PRIORITY:
|
||||
if(priorityOrder > info->priorityOrder)
|
||||
{
|
||||
return true;
|
||||
}else if(priorityOrder < info->priorityOrder)
|
||||
{
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
if(time_stamp < info->time_stamp)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case E_SORT_TIME:
|
||||
if(time_stamp < info->time_stamp)
|
||||
{
|
||||
return true;
|
||||
}else if(time_stamp > info->time_stamp)
|
||||
{
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
if(priorityOrder > info->priorityOrder)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case E_SORT_LOCATION:
|
||||
return false;
|
||||
break;
|
||||
case E_SORT_REGION:
|
||||
return false;
|
||||
break;
|
||||
case E_SORT_TYPE:
|
||||
return false;
|
||||
break;
|
||||
case E_SORT_CONTENT:
|
||||
if(content.isEmpty() && info->content.isEmpty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(content.isEmpty() && (!info->content.isEmpty()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if((!content.isEmpty()) && info->content.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(content < info->content)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(content > info->content)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(time_stamp < info->time_stamp)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case E_SORT_LOGICSTATE:
|
||||
return false;
|
||||
case E_SORT_ALM_STATE:
|
||||
return false;
|
||||
break;
|
||||
case E_SORT_STYLE:
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CAiAlarmMsgInfo::aimoreThan(const AlarmMsgPtr &info, E_ALARM_SORTKEY sortkey)
|
||||
{
|
||||
switch (sortkey) {
|
||||
case E_SORT_PRIORITY:
|
||||
if(priorityOrder < info->priorityOrder)
|
||||
{
|
||||
return true;
|
||||
}else if(priorityOrder > info->priorityOrder)
|
||||
{
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
if(time_stamp < info->time_stamp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case E_SORT_TIME:
|
||||
if(time_stamp > info->time_stamp)
|
||||
{
|
||||
return true;
|
||||
}else if(time_stamp < info->time_stamp)
|
||||
{
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
if(priorityOrder < info->priorityOrder)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case E_SORT_LOCATION:
|
||||
return true;
|
||||
break;
|
||||
case E_SORT_REGION:
|
||||
return true;
|
||||
break;
|
||||
case E_SORT_TYPE:
|
||||
return true;
|
||||
break;
|
||||
case E_SORT_CONTENT:
|
||||
if(content.isEmpty() && info->content.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(content.isEmpty() && (!info->content.isEmpty()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if((!content.isEmpty()) && info->content.isEmpty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(content < info->content)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(content > info->content)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(time_stamp < info->time_stamp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case E_SORT_LOGICSTATE:
|
||||
return true;
|
||||
break;
|
||||
case E_SORT_ALM_STATE:
|
||||
return true;
|
||||
break;
|
||||
case E_SORT_STYLE:
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//< 智能告警-前者小[不包含的字段进行比较排序]
|
||||
bool CAiAlarmMsgInfo::ailessThan(const AiAlarmMsgPtr &info, E_ALARM_SORTKEY sortkey)
|
||||
{
|
||||
switch (sortkey) {
|
||||
case E_SORT_PRIORITY:
|
||||
if(priorityOrder > info->priorityOrder)
|
||||
{
|
||||
return true;
|
||||
}else if(priorityOrder < info->priorityOrder)
|
||||
{
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
if(time_stamp < info->time_stamp)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case E_SORT_TIME:
|
||||
if(time_stamp < info->time_stamp)
|
||||
{
|
||||
return true;
|
||||
}else if(time_stamp > info->time_stamp)
|
||||
{
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
if(priorityOrder > info->priorityOrder)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case E_SORT_LOCATION:
|
||||
return true;
|
||||
break;
|
||||
case E_SORT_REGION:
|
||||
return true;
|
||||
break;
|
||||
case E_SORT_TYPE:
|
||||
return true;
|
||||
break;
|
||||
case E_SORT_CONTENT:
|
||||
if(content.isEmpty() && info->content.isEmpty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(content.isEmpty() && (!info->content.isEmpty()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if((!content.isEmpty()) && info->content.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(content < info->content)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(content > info->content)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(time_stamp < info->time_stamp)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case E_SORT_LOGICSTATE:
|
||||
return true;
|
||||
case E_SORT_ALM_STATE:
|
||||
return true;
|
||||
break;
|
||||
case E_SORT_STYLE:
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CAiAlarmMsgInfo::aimoreThan(const AiAlarmMsgPtr &info, E_ALARM_SORTKEY sortkey)
|
||||
{
|
||||
switch (sortkey) {
|
||||
case E_SORT_PRIORITY:
|
||||
if(priorityOrder < info->priorityOrder)
|
||||
{
|
||||
return true;
|
||||
}else if(priorityOrder > info->priorityOrder)
|
||||
{
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
if(time_stamp < info->time_stamp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case E_SORT_TIME:
|
||||
if(time_stamp > info->time_stamp)
|
||||
{
|
||||
return true;
|
||||
}else if(time_stamp < info->time_stamp)
|
||||
{
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
if(priorityOrder < info->priorityOrder)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case E_SORT_LOCATION:
|
||||
return false;
|
||||
break;
|
||||
case E_SORT_REGION:
|
||||
return false;
|
||||
break;
|
||||
case E_SORT_TYPE:
|
||||
return false;
|
||||
break;
|
||||
case E_SORT_CONTENT:
|
||||
if(content.isEmpty() && info->content.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(content.isEmpty() && (!info->content.isEmpty()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if((!content.isEmpty()) && info->content.isEmpty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(content < info->content)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(content > info->content)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(time_stamp < info->time_stamp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case E_SORT_LOGICSTATE:
|
||||
return false;
|
||||
break;
|
||||
case E_SORT_ALM_STATE:
|
||||
return false;
|
||||
break;
|
||||
case E_SORT_STYLE:
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool operator==(const CAiAlarmMsgInfo &source, const CAiAlarmMsgInfo &target)
|
||||
{
|
||||
if(source.uuid_base64 == target.uuid_base64)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
// //替换式告警且车站、测点ID相同
|
||||
// if((0 == source.if_water_alm) && (0 == target.if_water_alm) && (source.location_id == target.location_id) && (source.key_id_tag == target.key_id_tag))
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// //流水账告警且时标、告警内容相同
|
||||
// else if((1 == source.if_water_alm) && (1 == target.if_water_alm) && (source.location_id == target.location_id) && (source.time_stamp == target.time_stamp) && (source.content == target.content))
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
}
|
||||
@ -1,60 +0,0 @@
|
||||
#ifndef CAIALARMMSGINFO_H
|
||||
#define CAIALARMMSGINFO_H
|
||||
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QStringList>
|
||||
#include <QSharedPointer>
|
||||
#include "intelli_alm_api/CIntelliAlmApi4Clt.h"
|
||||
#include <QVector>
|
||||
#include <QString>
|
||||
#include <CAlarmCommon.h>
|
||||
#include <CAlarmMsgInfo.h>
|
||||
enum E_AiALARM_LOGICSTATE
|
||||
{
|
||||
E_AiALM_IALS_NORMAL = 1, //正常
|
||||
E_AIALM_IALS_DELETED = 2, //已删除
|
||||
E_AIALM_IALS_BROKEN = 3, //不完整的
|
||||
};
|
||||
class CAiAlarmMsgInfo
|
||||
{
|
||||
public:
|
||||
CAiAlarmMsgInfo();
|
||||
CAiAlarmMsgInfo(const CAiAlarmMsgInfo &other);
|
||||
void initialize(const iot_idl::SIntelliAlmInfo &alarmInfo);
|
||||
|
||||
//< [优先级越小表示越大]-智能告警窗调用
|
||||
bool ailessThan(const AlarmMsgPtr &info, E_ALARM_SORTKEY sortkey = E_SORT_PRIORITY);
|
||||
bool aimoreThan(const AlarmMsgPtr &info, E_ALARM_SORTKEY sortkey = E_SORT_PRIORITY);
|
||||
|
||||
bool ailessThan(const AiAlarmMsgPtr &info, E_ALARM_SORTKEY sortkey = E_SORT_PRIORITY);
|
||||
bool aimoreThan(const AiAlarmMsgPtr &info, E_ALARM_SORTKEY sortkey = E_SORT_PRIORITY);
|
||||
|
||||
E_AiALARM_LOGICSTATE logic_state; //< 状态
|
||||
E_ALARM_LOGICSTATE main_state; //< 主告警逻辑状态
|
||||
qint32 domain_id; //< 域ID
|
||||
qint32 priority; //< 告警优先级id
|
||||
quint64 time_stamp; //< 时标(RFC1305、POSIX时标标准)
|
||||
QString uuid_base64; //< uuid 主键
|
||||
QString content; //< 告警内容
|
||||
QString disposal_plan; //< 处置预案
|
||||
QVector<QString> raw_alm_uuid; //< 关联的原始告警uuid
|
||||
//< Extend
|
||||
qint32 priorityOrder; //< 优先级
|
||||
bool deleteFlag; //< 是否被删除
|
||||
bool brokenFlag; //< 是否不完整
|
||||
bool releaseFlag; //< 是否被释放
|
||||
//和主原始告警相关
|
||||
bool m_needVideoAlm; //是否需要视频告警
|
||||
qint32 app_id; //主原始告警应用id
|
||||
QString main_uuid_base64; //主原始告警uuid
|
||||
QString key_id_tag; //主原始告警标签
|
||||
E_TAGNAME_TYPE m_tagname_type;
|
||||
};
|
||||
|
||||
bool operator==(const CAiAlarmMsgInfo &source, const CAiAlarmMsgInfo &target);
|
||||
|
||||
Q_DECLARE_METATYPE(CAiAlarmMsgInfo)
|
||||
Q_DECLARE_METATYPE(AiAlarmMsgPtr)
|
||||
|
||||
#endif // CAIALARMMSGINFO_H
|
||||
@ -1,416 +0,0 @@
|
||||
#include "CAiAlarmTreeItem.h"
|
||||
#include "CAiAlarmMsgInfo.h"
|
||||
#include "CAlarmMsgInfo.h"
|
||||
#include "CAlarmCommon.h"
|
||||
#include "pub_logger_api/logger.h"
|
||||
#include <QDateTime>
|
||||
#include <QMap>
|
||||
#include "CAlarmBaseData.h"
|
||||
CAiAlarmTreeItem::CAiAlarmTreeItem(const QVector<QVariant> &data, CAiAlarmTreeItem *parent)
|
||||
: m_uuid(QString()),
|
||||
m_bIsAi(false),
|
||||
m_parent(parent),
|
||||
m_data(data),
|
||||
m_alarmPtr(NULL),
|
||||
m_aialarmPtr(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CAiAlarmTreeItem::~CAiAlarmTreeItem()
|
||||
{
|
||||
qDeleteAll(m_child);
|
||||
m_child.clear();
|
||||
}
|
||||
|
||||
CAiAlarmTreeItem *CAiAlarmTreeItem::child(int row)
|
||||
{
|
||||
return m_child.at(row);
|
||||
}
|
||||
|
||||
CAiAlarmTreeItem *CAiAlarmTreeItem::parent()
|
||||
{
|
||||
return m_parent;
|
||||
}
|
||||
|
||||
int CAiAlarmTreeItem::childCount() const
|
||||
{
|
||||
return m_child.count();
|
||||
}
|
||||
|
||||
int CAiAlarmTreeItem::columnCount() const
|
||||
{
|
||||
return m_data.count();
|
||||
}
|
||||
|
||||
int CAiAlarmTreeItem::childNumber() const
|
||||
{
|
||||
if(m_parent)
|
||||
{
|
||||
return m_parent->m_child.indexOf(const_cast<CAiAlarmTreeItem*>(this));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
QVariant CAiAlarmTreeItem::data(int column, int role)
|
||||
{
|
||||
if(E_DisplayRole == role)
|
||||
{
|
||||
if(m_bIsAi == true)
|
||||
{
|
||||
return aigetDataByColumn(column);
|
||||
}else
|
||||
{
|
||||
return getDataByColumn(column);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
|
||||
bool CAiAlarmTreeItem::setData(int column, const QVariant &value, int role)
|
||||
{
|
||||
Q_UNUSED(role)
|
||||
Q_UNUSED(value)
|
||||
if (column < 0 || column >= m_data.size())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CAiAlarmTreeItem::setPtr(AlarmMsgPtr ptr)
|
||||
{
|
||||
m_alarmPtr = ptr;
|
||||
m_bIsAi = false;
|
||||
m_uuid = ptr->uuid_base64;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CAiAlarmTreeItem::setAiPtr(AiAlarmMsgPtr aiPtr)
|
||||
{
|
||||
m_aialarmPtr = aiPtr;
|
||||
m_bIsAi = true;
|
||||
m_uuid = aiPtr->uuid_base64;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CAiAlarmTreeItem::insertChildren(int position, int count, int columns)
|
||||
{
|
||||
if (position < 0 || position > m_child.size())
|
||||
return false;
|
||||
|
||||
for (int row = 0; row < count; ++row) {
|
||||
QVector<QVariant> data(columns);
|
||||
CAiAlarmTreeItem *item = new CAiAlarmTreeItem(data, this);
|
||||
m_child.insert(position, item);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CAiAlarmTreeItem::removeChildren(int position, int count, int columns)
|
||||
{
|
||||
Q_UNUSED(columns)
|
||||
if (position < 0 || position + count > m_child.size())
|
||||
return false;
|
||||
|
||||
for (int row = 0; row < count; ++row)
|
||||
delete m_child.takeAt(position);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CAiAlarmTreeItem::isAi()
|
||||
{
|
||||
return m_bIsAi;
|
||||
}
|
||||
|
||||
AlarmMsgPtr CAiAlarmTreeItem::ptr()
|
||||
{
|
||||
if(m_alarmPtr == NULL)
|
||||
return NULL;
|
||||
else
|
||||
return m_alarmPtr;
|
||||
}
|
||||
|
||||
bool CAiAlarmTreeItem::getPtr(AlarmMsgPtr &ptr)
|
||||
{
|
||||
if(!m_bIsAi &&m_alarmPtr != NULL)
|
||||
{
|
||||
ptr = m_alarmPtr;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr = NULL;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool CAiAlarmTreeItem::getAiPtr(AiAlarmMsgPtr &aiPtr)
|
||||
{
|
||||
if(m_bIsAi &&m_aialarmPtr != NULL)
|
||||
{
|
||||
aiPtr = m_aialarmPtr;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
aiPtr = NULL;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
QList<AlarmMsgPtr> CAiAlarmTreeItem::getChildAlarmPtr()
|
||||
{
|
||||
QList<AlarmMsgPtr> ptrList;
|
||||
foreach (CAiAlarmTreeItem* item, m_child) {
|
||||
if(item->ptr() != NULL)
|
||||
{
|
||||
ptrList.append(item->ptr());
|
||||
}
|
||||
}
|
||||
return ptrList;
|
||||
}
|
||||
|
||||
int CAiAlarmTreeItem::index(const QString uuid)
|
||||
{
|
||||
for(int index(0);index<m_child.count();index++)
|
||||
{
|
||||
if(m_child.at(index)->m_uuid == uuid)
|
||||
{
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool CAiAlarmTreeItem::lessThan(CAiAlarmTreeItem *info, E_ALARM_SORTKEY sortkey)
|
||||
{
|
||||
AiAlarmMsgPtr aiptr = NULL;
|
||||
AlarmMsgPtr ptr= NULL;
|
||||
if(m_bIsAi)
|
||||
{
|
||||
if(info->isAi())
|
||||
{
|
||||
if(info->getAiPtr(aiptr) && aiptr != NULL)
|
||||
return m_aialarmPtr->ailessThan(aiptr,sortkey);
|
||||
}else
|
||||
{
|
||||
if(info->getPtr(ptr) && ptr != NULL)
|
||||
return m_aialarmPtr->ailessThan(ptr,sortkey);
|
||||
}
|
||||
|
||||
}else
|
||||
{
|
||||
if(info->isAi())
|
||||
{
|
||||
if(info->getAiPtr(aiptr) && aiptr != NULL)
|
||||
return m_alarmPtr->ailessThan(aiptr,sortkey);
|
||||
}else
|
||||
{
|
||||
if(info->getPtr(ptr) && ptr != NULL)
|
||||
return m_alarmPtr->ailessThan(ptr,sortkey);
|
||||
}
|
||||
}
|
||||
LOGERROR("lessThan():比较大小出错!");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CAiAlarmTreeItem::moreThan(CAiAlarmTreeItem *info, E_ALARM_SORTKEY sortkey)
|
||||
{
|
||||
AiAlarmMsgPtr aiptr = NULL;
|
||||
AlarmMsgPtr ptr= NULL;
|
||||
if(m_bIsAi)
|
||||
{
|
||||
if(info->isAi())
|
||||
{
|
||||
if(info->getAiPtr(aiptr) && aiptr != NULL)
|
||||
return m_aialarmPtr->aimoreThan(aiptr,sortkey);
|
||||
}else
|
||||
{
|
||||
if(info->getPtr(ptr) && ptr != NULL)
|
||||
return m_aialarmPtr->aimoreThan(ptr,sortkey);
|
||||
}
|
||||
}else
|
||||
{
|
||||
if(info->isAi())
|
||||
{
|
||||
if(info->getAiPtr(aiptr) && aiptr != NULL)
|
||||
return m_alarmPtr->aimoreThan(aiptr,sortkey);
|
||||
}else
|
||||
{
|
||||
if(info->getPtr(ptr) && ptr != NULL)
|
||||
return m_alarmPtr->aimoreThan(ptr,sortkey);
|
||||
}
|
||||
}
|
||||
LOGERROR("moreThan():比较大小出错!");
|
||||
return false;
|
||||
}
|
||||
|
||||
QList<CAiAlarmTreeItem *> CAiAlarmTreeItem::getChild()
|
||||
{
|
||||
return m_child;
|
||||
}
|
||||
|
||||
void CAiAlarmTreeItem::setChild(QList<CAiAlarmTreeItem *> itemList)
|
||||
{
|
||||
m_child.clear();
|
||||
m_child = itemList;
|
||||
}
|
||||
|
||||
QList<CAiAlarmTreeItem *> CAiAlarmTreeItem::getChildItemList()
|
||||
{
|
||||
return m_child;
|
||||
}
|
||||
|
||||
QVector<QString> CAiAlarmTreeItem::getContent()
|
||||
{
|
||||
QVector<QString> vec;
|
||||
for(int index(0);index<m_data.size();index++)
|
||||
{
|
||||
vec.append(m_data[index].toString());
|
||||
}
|
||||
return vec;
|
||||
}
|
||||
|
||||
QVariant CAiAlarmTreeItem::aigetDataByColumn(int column)
|
||||
{
|
||||
if(m_aialarmPtr != NULL)
|
||||
{
|
||||
switch (column) {
|
||||
case TIME:
|
||||
m_data[0] = QDateTime::fromMSecsSinceEpoch(m_aialarmPtr->time_stamp).toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||
return m_data[0];
|
||||
case PRIORITY:
|
||||
m_data[1] = CAlarmBaseData::instance()->queryPriorityDesc(m_aialarmPtr->priority);
|
||||
return m_data[1];
|
||||
case LOCATION:
|
||||
m_data[2] = CAlarmMsgManage::instance()->queryLocationDesc(m_aialarmPtr->uuid_base64);
|
||||
return m_data[2];
|
||||
case REGION:
|
||||
m_data[3] ="-";
|
||||
return m_data[3];
|
||||
case TYPE:
|
||||
m_data[4] ="-";
|
||||
return "-";
|
||||
case STATUS:
|
||||
m_data[5] ="-";
|
||||
return "-";
|
||||
case RETURNSTATUS:
|
||||
m_data[6] ="-";
|
||||
return "-";
|
||||
case CONFIRM:
|
||||
m_data[7] = QString("%1/%2").arg(getConfirm()).arg(m_child.size());
|
||||
return m_data[7];
|
||||
case CONTENT:
|
||||
m_data[8] = m_aialarmPtr->content;
|
||||
return m_data[8];
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant CAiAlarmTreeItem::getDataByColumn(int column)
|
||||
{
|
||||
if(m_alarmPtr != NULL)
|
||||
{
|
||||
switch (column) {
|
||||
case TIME:
|
||||
{
|
||||
m_data[0] = QDateTime::fromMSecsSinceEpoch(m_alarmPtr->time_stamp).toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||
return m_data[0];
|
||||
}
|
||||
case PRIORITY:
|
||||
{
|
||||
m_data[1] = CAlarmBaseData::instance()->queryPriorityDesc(m_alarmPtr->priority);
|
||||
return m_data[1];
|
||||
}
|
||||
case LOCATION:
|
||||
{
|
||||
m_data[2] = CAlarmBaseData::instance()->queryLocationDesc(m_alarmPtr->location_id);
|
||||
return m_data[2];
|
||||
}
|
||||
case REGION:
|
||||
{
|
||||
m_data[3] = CAlarmBaseData::instance()->queryRegionDesc(m_alarmPtr->region_id);
|
||||
return m_data[3];
|
||||
}
|
||||
case TYPE:
|
||||
{
|
||||
m_data[4] = CAlarmBaseData::instance()->queryAlarmTypeDesc(m_alarmPtr->alm_type);
|
||||
return m_data[4];
|
||||
}
|
||||
case STATUS:
|
||||
{
|
||||
m_data[5] = CAlarmBaseData::instance()->queryAlarmStatusDesc(m_alarmPtr->alm_status);
|
||||
return m_data[5];
|
||||
}
|
||||
case RETURNSTATUS:
|
||||
{
|
||||
if(E_ALS_ALARM == m_alarmPtr->logic_state || E_ALS_ALARM_CFM == m_alarmPtr->logic_state ||
|
||||
E_ALS_ALARM_DEL == m_alarmPtr->logic_state || E_ALS_ALARM_CFM_DEL == m_alarmPtr->logic_state) //未复归
|
||||
{
|
||||
m_data[6] = QObject::tr("未复归");
|
||||
return m_data[6];
|
||||
}
|
||||
else if(E_ALS_RETURN == m_alarmPtr->logic_state || E_ALS_RETURN_CFM == m_alarmPtr->logic_state ||
|
||||
E_ALS_RETURN_DEL == m_alarmPtr->logic_state || E_ALS_RETURN_CFM_DEL == m_alarmPtr->logic_state)
|
||||
{
|
||||
m_data[6] = QObject::tr("已复归");
|
||||
return m_data[6];
|
||||
}else
|
||||
{
|
||||
m_data[6] = QObject::tr("-");
|
||||
return m_data[6];
|
||||
}
|
||||
}
|
||||
case CONFIRM:
|
||||
{
|
||||
if(E_ALS_ALARM == m_alarmPtr->logic_state || E_ALS_RETURN == m_alarmPtr->logic_state
|
||||
|| E_ALS_ALARM_DEL == m_alarmPtr->logic_state || E_ALS_RETURN_DEL == m_alarmPtr->logic_state) //< 未确认
|
||||
{
|
||||
m_data[7] = QObject::tr("未确认");
|
||||
return m_data[7];
|
||||
}
|
||||
else if(E_ALS_ALARM_CFM == m_alarmPtr->logic_state || E_ALS_RETURN_CFM == m_alarmPtr->logic_state ||
|
||||
E_ALS_ALARM_CFM_DEL == m_alarmPtr->logic_state || E_ALS_RETURN_CFM_DEL == m_alarmPtr->logic_state ||
|
||||
ALS_EVT_ONLY == m_alarmPtr->logic_state)
|
||||
{
|
||||
m_data[7] = QObject::tr("已确认");
|
||||
return m_data[7];
|
||||
}
|
||||
}
|
||||
case CONTENT:
|
||||
{
|
||||
m_data[8] = m_alarmPtr->content;
|
||||
return m_data[8];
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
int CAiAlarmTreeItem::getConfirm()
|
||||
{
|
||||
int size = 0;
|
||||
QList<CAiAlarmTreeItem*>::iterator it = m_child.begin();
|
||||
while (it != m_child.end()) {
|
||||
AlarmMsgPtr ptr;
|
||||
if((*it)->getPtr(ptr))
|
||||
{
|
||||
if(ptr->logic_state == E_ALS_ALARM_CFM || ptr->logic_state == E_ALS_RETURN_CFM
|
||||
|| ptr->logic_state == E_ALS_ALARM_CFM_DEL || ptr->logic_state == E_ALS_RETURN_CFM_DEL || ptr->logic_state == ALS_EVT_ONLY)
|
||||
{
|
||||
size++;
|
||||
}
|
||||
}
|
||||
it++;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
@ -1,81 +0,0 @@
|
||||
#ifndef CAIALARMTREEITEM_H
|
||||
#define CAIALARMTREEITEM_H
|
||||
|
||||
#include <QVector>
|
||||
#include <QVariant>
|
||||
#include "CAlarmMsgManage.h"
|
||||
enum E_ItemDataRole
|
||||
{
|
||||
E_IfAiFlag =0x0101, //< 是否智能告警
|
||||
E_DisplayRole =0x0102,
|
||||
E_UserRole = 0x0103, //< uuid
|
||||
E_CheckStateRole = 0x0104
|
||||
};
|
||||
enum ColumnField
|
||||
{
|
||||
TIME = 0,
|
||||
PRIORITY,
|
||||
LOCATION,
|
||||
REGION,
|
||||
TYPE,
|
||||
STATUS,
|
||||
RETURNSTATUS,
|
||||
CONFIRM,
|
||||
CONTENT
|
||||
};
|
||||
class CAiAlarmTreeItem
|
||||
{
|
||||
public:
|
||||
explicit CAiAlarmTreeItem(const QVector<QVariant> &data,CAiAlarmTreeItem *parent = Q_NULLPTR);
|
||||
~CAiAlarmTreeItem();
|
||||
|
||||
CAiAlarmTreeItem *child(int row);
|
||||
CAiAlarmTreeItem *parent();
|
||||
|
||||
int childCount() const;
|
||||
int columnCount() const;
|
||||
//返回行数
|
||||
int childNumber() const;
|
||||
QVariant data(int column,int role = E_DisplayRole);
|
||||
bool setData(int column,const QVariant &value,int role);
|
||||
bool setPtr(AlarmMsgPtr ptr);
|
||||
bool setAiPtr(AiAlarmMsgPtr aiPtr);
|
||||
bool insertChildren(int position, int count, int columns);
|
||||
bool removeChildren(int position, int count, int columns);
|
||||
bool isAi();
|
||||
|
||||
//若确定是原始告警可以直接使用
|
||||
AlarmMsgPtr ptr();
|
||||
bool getPtr(AlarmMsgPtr &ptr);
|
||||
bool getAiPtr(AiAlarmMsgPtr &aiPtr);
|
||||
QList<AlarmMsgPtr> getChildAlarmPtr();
|
||||
|
||||
int index(const QString uuid);
|
||||
|
||||
bool lessThan(CAiAlarmTreeItem *info, E_ALARM_SORTKEY sortkey = E_SORT_PRIORITY);
|
||||
bool moreThan(CAiAlarmTreeItem* info, E_ALARM_SORTKEY sortkey = E_SORT_PRIORITY);
|
||||
|
||||
QList<CAiAlarmTreeItem*> getChild();
|
||||
void setChild(QList<CAiAlarmTreeItem*> itemList);
|
||||
|
||||
QList<CAiAlarmTreeItem*> getChildItemList();
|
||||
|
||||
QVector<QString> getContent();
|
||||
private:
|
||||
QVariant aigetDataByColumn(int column);
|
||||
QVariant getDataByColumn(int column);
|
||||
int getConfirm();
|
||||
private:
|
||||
QString m_uuid;
|
||||
bool m_bIsAi;
|
||||
QList<CAiAlarmTreeItem*> m_child;
|
||||
CAiAlarmTreeItem *m_parent;
|
||||
|
||||
QVector<QVariant> m_data;
|
||||
AlarmMsgPtr m_alarmPtr;
|
||||
AiAlarmMsgPtr m_aialarmPtr;
|
||||
|
||||
//Qt::CheckState m_checkState;
|
||||
};
|
||||
|
||||
#endif // CAIALARMTREEITEM_H
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user