[ref]暂时先回退下同步711的,跟fes的提交区分开下

This commit is contained in:
shi_jq 2025-03-14 15:07:39 +08:00
parent 31e08c60c4
commit cb3d1ca061
1723 changed files with 299508 additions and 431136 deletions

View File

@ -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 += $$PWD/../../platform/$$ISCS6000_OS$$DIR_DEBUG_RELEASE/
QMAKE_RPATHLINKDIR += $$SRC_ROOT_PATH/../$$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/*

View File

@ -1,7 +1,3 @@
TEMPLATE=subdirs TEMPLATE=subdirs
CONFIG += ordered CONFIG += ordered
SUBDIRS+= \ SUBDIRS+= fileSync NavigationApi NavigationTool IconActTool
# fileSync \
NavigationApi \
NavigationTool \
IconActTool

View File

@ -11,7 +11,7 @@
CFileOpt::CFileOpt() 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); readColorCofig(QString::fromStdString(currentPath) + "/../../data/model/colorConfig.xml", m_strategyMap);
readIconDefaultStrategy(QString::fromStdString(currentPath) + "/../../data/model/toolbox.xml", m_iconDefaultStrategyMap); readIconDefaultStrategy(QString::fromStdString(currentPath) + "/../../data/model/toolbox.xml", m_iconDefaultStrategyMap);
} }

View File

@ -11,18 +11,14 @@
#include <QMessageBox> #include <QMessageBox>
CIconActDialog::CIconActDialog(QWidget *parent) : CIconActDialog::CIconActDialog(QWidget *parent) :
CustomUiDialog(parent), QDialog(parent),
ui(new Ui::CIconActDialog), ui(new Ui::CIconActDialog),
m_pTableModel(Q_NULLPTR), m_pTableModel(Q_NULLPTR),
m_pFileOpt(Q_NULLPTR) m_pFileOpt(Q_NULLPTR)
{ {
setWindowTitle(tr("图元动作"));
ui->setupUi(this); ui->setupUi(this);
initialize(); initialize();
CustomUiDialog::setAutoLayout(true);
} }
CIconActDialog::~CIconActDialog() CIconActDialog::~CIconActDialog()
@ -163,7 +159,7 @@ void CIconActDialog::initialize()
m_actMap.insert(ACT_LEFT_DOUCLICK, tr("左键双击")); m_actMap.insert(ACT_LEFT_DOUCLICK, tr("左键双击"));
m_simMap.insert(SIM_FORBID, tr("禁止")); m_simMap.insert(SIM_FORBID, tr("禁止"));
m_simMap.insert(SIM_ALLOW, 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); CTableDelegate * iconDelegate = new CTableDelegate(this, CTableDelegate::IconFile);
iconDelegate->setFilePath(QString::fromStdString(currentPath) + "/../../data/icon/"); iconDelegate->setFilePath(QString::fromStdString(currentPath) + "/../../data/icon/");
CTableDelegate * actnDelegate = new CTableDelegate(this, CTableDelegate::ComboBox); CTableDelegate * actnDelegate = new CTableDelegate(this, CTableDelegate::ComboBox);

View File

@ -1,8 +1,8 @@
#ifndef CICONACTDIALOG_H #ifndef CICONACTDIALOG_H
#define CICONACTDIALOG_H #define CICONACTDIALOG_H
#include <QDialog>
#include <QMap> #include <QMap>
#include "pub_widget/CustomDialog.h"
namespace Ui { namespace Ui {
class CIconActDialog; class CIconActDialog;
@ -10,7 +10,7 @@ class CIconActDialog;
class CTableModel; class CTableModel;
class CFileOpt; class CFileOpt;
class CIconActDialog : public CustomUiDialog class CIconActDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT

View File

@ -46,6 +46,19 @@
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout"> <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> <item>
<widget class="QPushButton" name="m_addBtn"> <widget class="QPushButton" name="m_addBtn">
<property name="sizePolicy"> <property name="sizePolicy">
@ -96,19 +109,6 @@
</property> </property>
</widget> </widget>
</item> </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> </layout>
</item> </item>
</layout> </layout>

View File

@ -45,8 +45,7 @@ FORMS += \
LIBS += \ LIBS += \
-lpub_utility_api \ -lpub_utility_api \
-llog4cplus \ -llog4cplus \
-lpub_logger_api \ -lpub_logger_api
-lpub_widget
COMMON_PRI=$$PWD/../../../common.pri COMMON_PRI=$$PWD/../../../common.pri
exists($$COMMON_PRI) { exists($$COMMON_PRI) {

View File

@ -3,44 +3,15 @@
#include <QTextCodec> #include <QTextCodec>
#include "common/QtAppGlobalSet.h" #include "common/QtAppGlobalSet.h"
#include "CIconActDialog.h" #include "CIconActDialog.h"
#include "pub_utility_api/FileStyle.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
iot_common::doQtAppGlobalSet(); kbd_common::doQtAppGlobalSet();
QTextCodec *codec = QTextCodec::codecForName("UTF-8"); QTextCodec *codec = QTextCodec::codecForName("UTF-8");
QTextCodec::setCodecForLocale(codec); QTextCodec::setCodecForLocale(codec);
QApplication a(argc, argv); 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; CIconActDialog w;
w.show(); w.show();

View File

@ -10,7 +10,7 @@
CJsonOpt::CJsonOpt() CJsonOpt::CJsonOpt()
{ {
std::string currentPath = iot_public::CFileUtil::getCurModuleDir(); std::string currentPath = kbd_public::CFileUtil::getCurModuleDir();
QDir dir(QString::fromStdString(currentPath)); QDir dir(QString::fromStdString(currentPath));
dir.cdUp(); dir.cdUp();
dir.cdUp(); dir.cdUp();

View File

@ -13,13 +13,10 @@
const int Item_Role = Qt::UserRole + 1; const int Item_Role = Qt::UserRole + 1;
CNavigationDialog::CNavigationDialog(QWidget *parent) : CNavigationDialog::CNavigationDialog(QWidget *parent) :
CustomUiMainWindow(parent), QDialog(parent),
ui(new Ui::CNavigationDialog), ui(new Ui::CNavigationDialog),
m_itemIndex(0) m_itemIndex(0)
{ {
setWindowTitle(tr("导航栏配置工具"));
CustomUiMainWindow::setAutoLayout(true);
ui->setupUi(this); ui->setupUi(this);
initialize(); initialize();
@ -74,7 +71,7 @@ void CNavigationDialog::initialize()
CTreeItemDelegate *boxDelegate2 = new CTreeItemDelegate(this, CTreeItemDelegate::ComboBox); CTreeItemDelegate *boxDelegate2 = new CTreeItemDelegate(this, CTreeItemDelegate::ComboBox);
boxDelegate2->setComboMap(m_mapType); boxDelegate2->setComboMap(m_mapType);
std::string currentPath = iot_public::CFileUtil::getCurModuleDir(); std::string currentPath = kbd_public::CFileUtil::getCurModuleDir();
QDir dir(QString::fromStdString(currentPath)); QDir dir(QString::fromStdString(currentPath));
dir.cdUp(); dir.cdUp();
dir.cdUp(); dir.cdUp();
@ -571,12 +568,12 @@ void CNavigationDialog::onConfirmClicked()
QMessageBox::information(this, tr("提示"), tr("保存失败!"), QMessageBox::Ok); QMessageBox::information(this, tr("提示"), tr("保存失败!"), QMessageBox::Ok);
return; return;
} }
accept();
} }
void CNavigationDialog::onCancelClicked() void CNavigationDialog::onCancelClicked()
{ {
reject();
} }
void CNavigationDialog::onExport() void CNavigationDialog::onExport()
@ -786,7 +783,7 @@ QMap<int, QString> CNavigationDialog::makePathMap()
{ {
QMap<int, QString> fileMap; QMap<int, QString> fileMap;
QDir picDir(m_strFileHomePath + "pic" + QDir::separator()); 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(SWITCH_GRAPH, picDir.path());
fileMap.insert(LOAD_WEBURL, picDir.path()); fileMap.insert(LOAD_WEBURL, picDir.path());
fileMap.insert(EXTERN_PRO, QString::fromStdString(exePath)); fileMap.insert(EXTERN_PRO, QString::fromStdString(exePath));

View File

@ -1,9 +1,9 @@
#ifndef CNAVIGATIONDIALOG_H #ifndef CNAVIGATIONDIALOG_H
#define CNAVIGATIONDIALOG_H #define CNAVIGATIONDIALOG_H
#include <QDialog>
#include "gui/GraphTool/NavigationApi/CJsonOpt.h" #include "gui/GraphTool/NavigationApi/CJsonOpt.h"
#include "model_excel/xlsx/xlsxdocument.h" #include "model_excel/xlsx/xlsxdocument.h"
#include "pub_widget/CustomMainWindow.h"
namespace Ui { namespace Ui {
class CNavigationDialog; class CNavigationDialog;
@ -12,7 +12,7 @@ class CNavigationDialog;
extern const int Item_Role; //< 节点数-仅导入使用 extern const int Item_Role; //< 节点数-仅导入使用
class QTreeWidgetItem; class QTreeWidgetItem;
class CNavigationDialog : public CustomUiMainWindow class CNavigationDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT

View File

@ -1,269 +1,279 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>CNavigationDialog</class> <class>CNavigationDialog</class>
<widget class="QMainWindow" name="CNavigationDialog"> <widget class="QDialog" name="CNavigationDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>1087</width>
<height>600</height> <height>673</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>MainWindow</string> <string>导航栏配置工具</string>
</property> </property>
<widget class="QWidget" name="centralwidget"> <layout class="QGridLayout" name="gridLayout_2">
<layout class="QGridLayout" name="gridLayout_2"> <property name="leftMargin">
<item row="0" column="0"> <number>0</number>
<widget class="QFrame" name="frame"> </property>
<property name="frameShape"> <property name="topMargin">
<enum>QFrame::NoFrame</enum> <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::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>6</number>
</property> </property>
<property name="frameShadow"> <property name="topMargin">
<enum>QFrame::Plain</enum> <number>6</number>
</property> </property>
<property name="lineWidth"> <property name="rightMargin">
<number>1</number> <number>6</number>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <property name="bottomMargin">
<property name="leftMargin"> <number>6</number>
<number>6</number> </property>
</property> <item row="0" column="0">
<property name="topMargin"> <layout class="QHBoxLayout" name="horizontalLayout">
<number>6</number> <item>
</property> <widget class="QPushButton" name="m_add">
<property name="rightMargin"> <property name="minimumSize">
<number>6</number> <size>
</property> <width>21</width>
<property name="bottomMargin"> <height>21</height>
<number>6</number> </size>
</property>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="m_add">
<property name="minimumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="toolTip">
<string>添加节点</string>
</property>
<property name="text">
<string>+</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_upAdd">
<property name="minimumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="toolTip">
<string>添加子节点</string>
</property>
<property name="text">
<string>∟</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_delete">
<property name="minimumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="toolTip">
<string>删除节点</string>
</property>
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_clear">
<property name="minimumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="toolTip">
<string>清空节点</string>
</property>
<property name="text">
<string>×</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_moveUp">
<property name="minimumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="toolTip">
<string>上移节点</string>
</property>
<property name="text">
<string>↑</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_moveDown">
<property name="minimumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="toolTip">
<string>下移节点</string>
</property>
<property name="text">
<string>↓</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>484</width>
<height>17</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="m_import">
<property name="text">
<string>导入</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_export">
<property name="text">
<string>导出</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="3">
<widget class="CTreeWidget" name="m_treeWidget">
<column>
<property name="text">
<string notr="true">1</string>
</property> </property>
</column> <property name="maximumSize">
</widget> <size>
</item> <width>21</width>
<item row="2" column="0" colspan="3"> <height>21</height>
<layout class="QHBoxLayout" name="horizontalLayout_2"> </size>
<item> </property>
<spacer name="horizontalSpacer"> <property name="toolTip">
<property name="orientation"> <string>添加节点</string>
<enum>Qt::Horizontal</enum> </property>
</property> <property name="text">
<property name="sizeHint" stdset="0"> <string>+</string>
<size> </property>
<width>40</width> </widget>
<height>20</height> </item>
</size> <item>
</property> <widget class="QPushButton" name="m_upAdd">
</spacer> <property name="minimumSize">
</item> <size>
<item> <width>21</width>
<widget class="QPushButton" name="m_confirm"> <height>21</height>
<property name="text"> </size>
<string>确认</string> </property>
</property> <property name="maximumSize">
</widget> <size>
</item> <width>21</width>
<item> <height>21</height>
<widget class="QPushButton" name="m_cancel"> </size>
<property name="text"> </property>
<string>取消</string> <property name="toolTip">
</property> <string>添加子节点</string>
</widget> </property>
</item> <property name="text">
<item> <string>∟</string>
<spacer name="horizontalSpacer_2"> </property>
<property name="orientation"> </widget>
<enum>Qt::Horizontal</enum> </item>
</property> <item>
<property name="sizeHint" stdset="0"> <widget class="QPushButton" name="m_delete">
<size> <property name="minimumSize">
<width>40</width> <size>
<height>20</height> <width>21</width>
</size> <height>21</height>
</property> </size>
</spacer> </property>
</item> <property name="maximumSize">
</layout> <size>
</item> <width>21</width>
</layout> <height>21</height>
</widget> </size>
</item> </property>
</layout> <property name="toolTip">
</widget> <string>删除节点</string>
</property>
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_clear">
<property name="minimumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="toolTip">
<string>清空节点</string>
</property>
<property name="text">
<string>×</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_moveUp">
<property name="minimumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="toolTip">
<string>上移节点</string>
</property>
<property name="text">
<string>↑</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_moveDown">
<property name="minimumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="toolTip">
<string>下移节点</string>
</property>
<property name="text">
<string>↓</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>484</width>
<height>17</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="m_import">
<property name="text">
<string>导入</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_export">
<property name="text">
<string>导出</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="3">
<widget class="CTreeWidget" name="m_treeWidget">
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
<item row="2" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
<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_confirm">
<property name="text">
<string>确认</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_cancel">
<property name="text">
<string>取消</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<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>
</widget>
</item>
</layout>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<customwidgets> <customwidgets>

View File

@ -45,8 +45,7 @@ LIBS += \
-lpub_logger_api \ -lpub_logger_api \
-lpub_utility_api \ -lpub_utility_api \
-lmodel_excel \ -lmodel_excel \
-lNavigationApi \ -lNavigationApi
-lpub_widget
COMMON_PRI=$$PWD/../../../common.pri COMMON_PRI=$$PWD/../../../common.pri
exists($$COMMON_PRI) { exists($$COMMON_PRI) {

View File

@ -2,40 +2,12 @@
#include <QApplication> #include <QApplication>
#include "common/QtAppGlobalSet.h" #include "common/QtAppGlobalSet.h"
#include "CNavigationDialog.h" #include "CNavigationDialog.h"
#include "pub_utility_api/FileStyle.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
iot_common::doQtAppGlobalSet(); kbd_common::doQtAppGlobalSet();
QApplication a(argc, argv); 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; CNavigationDialog w;
w.show(); w.show();

View File

@ -9,7 +9,7 @@ namespace Ui {
class CConfirmDialog; class CConfirmDialog;
} }
using namespace iot_sys; using namespace kbd_sys;
class CConfirmDialog : public QDialog class CConfirmDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT

View File

@ -18,7 +18,7 @@ CFileSyncDialog::CFileSyncDialog(QDialog *parent) :
{ {
QTextCodec::setCodecForLocale(QTextCodec::codecForName("utf8")); QTextCodec::setCodecForLocale(QTextCodec::codecForName("utf8"));
if(iot_public::getCurLanguage() == "en") if(kbd_public::getCurLanguage() == "en")
{ {
QTranslator * sysTranslator = new QTranslator(this); QTranslator * sysTranslator = new QTranslator(this);
sysTranslator->load(":/fileSync_en.qm"); 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) void CFileSyncDialog::getSvnFile(const QString &path, QMap<QString, stFileStatus> &name, QString& error)
{ {
QVector<iot_sys::stFileStatus> vecFileStatus; QVector<kbd_sys::stFileStatus> vecFileStatus;
QStringList list; QStringList list;
list.append(path); list.append(path);

View File

@ -26,7 +26,7 @@ struct stSelectedPath
QStringList path; QStringList path;
}; };
using namespace iot_sys; using namespace kbd_sys;
class CFileSyncDialog : public QDialog class CFileSyncDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT

View File

@ -5,7 +5,7 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
iot_common::doQtAppGlobalSet(); kbd_common::doQtAppGlobalSet();
QApplication a(argc, argv); QApplication a(argc, argv);
CFileSyncDialog w; CFileSyncDialog w;

View File

@ -8,6 +8,3 @@ SUBDIRS += \
GraphTool \ GraphTool \
plugin plugin
TRANSLATIONS += \
product_en.ts\
product_fr.ts

View File

@ -3,8 +3,8 @@
#include "pub_utility_api/I18N.h" #include "pub_utility_api/I18N.h"
#include "pub_utility_api/FileStyle.h" #include "pub_utility_api/FileStyle.h"
using namespace iot_public; using namespace kbd_public;
using namespace iot_dbms; using namespace kbd_dbms;
//#ff0000 255,0,0 //#ff0000 255,0,0
//#ff7414 255,116,20 //#ff7414 255,116,20
@ -24,7 +24,7 @@ CAlarmStatistics::CAlarmStatistics(QWidget *parent,bool editMode) :
ui->comboBox_location->setView(new QListView()); ui->comboBox_location->setView(new QListView());
// 加载qss文件 // 加载qss文件
QString qss = QString(); 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)); QFile qssfile1(QString::fromStdString(strFullPath));
qssfile1.open(QFile::ReadOnly); qssfile1.open(QFile::ReadOnly);
if (qssfile1.isOpen()) if (qssfile1.isOpen())
@ -38,7 +38,7 @@ CAlarmStatistics::CAlarmStatistics(QWidget *parent,bool editMode) :
qDebug() << "public.qss 无法打开!"; qDebug() << "public.qss 无法打开!";
} }
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("alarm_statistics.qss") ; strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("alarm_statistics.qss") ;
QFile qssfile2(QString::fromStdString(strFullPath)); QFile qssfile2(QString::fromStdString(strFullPath));
qssfile2.open(QFile::ReadOnly); qssfile2.open(QFile::ReadOnly);
if (qssfile2.isOpen()) if (qssfile2.isOpen())
@ -87,6 +87,7 @@ CAlarmStatistics::~CAlarmStatistics()
delete m_pProcessDialog; delete m_pProcessDialog;
m_pProcessDialog = NULL; m_pProcessDialog = NULL;
m_pQueryThread->wait();
delete m_pQueryThread; delete m_pQueryThread;
m_pQueryThread = NULL; m_pQueryThread = NULL;

View File

@ -8,7 +8,7 @@
class CAlarmStatisticsPluginWidget : public QWidget, public CPluginWidgetInterface class CAlarmStatisticsPluginWidget : public QWidget, public CPluginWidgetInterface
{ {
Q_OBJECT Q_OBJECT
Q_PLUGIN_METADATA(IID HMI_WidgetPlugin_IID) Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0")
Q_INTERFACES(CPluginWidgetInterface) Q_INTERFACES(CPluginWidgetInterface)
public: public:

View File

@ -1,7 +1,7 @@
#include "CCompareQueryThread.h" #include "CCompareQueryThread.h"
using namespace iot_public; using namespace kbd_public;
using namespace iot_dbms; using namespace kbd_dbms;
CCompareQueryThread::CCompareQueryThread() CCompareQueryThread::CCompareQueryThread()
{ {

View File

@ -46,7 +46,7 @@ public:
int getAlarmLevelIndexById( int nId, SAlarmLevel* &pAlarmLevel ); int getAlarmLevelIndexById( int nId, SAlarmLevel* &pAlarmLevel );
public: public:
iot_dbms::CDbApi* m_pDb; // 数据库接口 kbd_dbms::CDbApi* m_pDb; // 数据库接口
CAlarmModel* m_pAlarmModel; // 详细告警信息显示窗的model CAlarmModel* m_pAlarmModel; // 详细告警信息显示窗的model
QList<QColor> m_listAlarmLevelColor; // 告警优先级的颜色集合 QList<QColor> m_listAlarmLevelColor; // 告警优先级的颜色集合
QList<SAlarmLevel*> m_listAlarmLevel; // 告警级别列表 QList<SAlarmLevel*> m_listAlarmLevel; // 告警级别列表

View File

@ -1,7 +1,7 @@
#include "CStatisticsQueryThread.h" #include "CStatisticsQueryThread.h"
using namespace iot_public; using namespace kbd_public;
using namespace iot_dbms; using namespace kbd_dbms;
CStatisticsQueryThread::CStatisticsQueryThread() CStatisticsQueryThread::CStatisticsQueryThread()
{ {

View File

@ -37,7 +37,7 @@ public:
void getWavePath( QString sAppTagName, QString& sPath, QString& sErrorMsg ); void getWavePath( QString sAppTagName, QString& sPath, QString& sErrorMsg );
public: public:
iot_dbms::CDbApi* m_pDb; // 数据库接口 kbd_dbms::CDbApi* m_pDb; // 数据库接口
CAlarmModel* m_pAlarmModel; // 详细告警信息显示窗的model CAlarmModel* m_pAlarmModel; // 详细告警信息显示窗的model
QList<QColor> m_listAlarmLevelColor; // 告警优先级的颜色集合 QList<QColor> m_listAlarmLevelColor; // 告警优先级的颜色集合
QList<SAlarmLevel*> m_listAlarmLevel; // 告警级别列表 QList<SAlarmLevel*> m_listAlarmLevel; // 告警级别列表

View File

@ -33,8 +33,8 @@ void CWaveListDialog::addFileNameList( QString sPath, QStringList listName )
void CWaveListDialog::slotShowWave( QListWidgetItem* pItem ) void CWaveListDialog::slotShowWave( QListWidgetItem* pItem )
{ {
const std::string strPath = std::move(iot_public::CFileUtil::getPathOfBinFile( const std::string strPath = std::move(kbd_public::CFileUtil::getPathOfBinFile(
std::string("WaveAnalyze") + iot_public::CFileUtil::getProcSuffix())); std::string("WaveAnalyze") + kbd_public::CFileUtil::getProcSuffix()));
if(strPath.empty()) if(strPath.empty())
{ {
LOGERROR("未找到可执行文件WaveAnalyze"); LOGERROR("未找到可执行文件WaveAnalyze");

View File

@ -6,12 +6,12 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
iot_public::StartLogSystem( "BASE", "alarm_statistics" ); kbd_public::StartLogSystem( "BASE", "alarm_statistics" );
CAlarmStatistics w( 0, false ); CAlarmStatistics w( 0, false );
w.show(); w.show();
int nRet = a.exec(); int nRet = a.exec();
iot_public::StopLogSystem(); kbd_public::StopLogSystem();
return nRet; return nRet;
} }

View File

@ -98,7 +98,7 @@ void AddObjAlarmDialog::initMember()
{ {
if(m_pWriteDb == NULL) 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(); m_pWriteDb->open();
} }
if(m_model == NULL) if(m_model == NULL)

View File

@ -69,7 +69,7 @@ private slots:
private: private:
Ui::AddObjAlarmDialog *ui; Ui::AddObjAlarmDialog *ui;
iot_dbms::CDbApi *m_pWriteDb; kbd_dbms::CDbApi *m_pWriteDb;
QMap<int,QCheckBox*> m_alarmActionCheckMap;//选中的告警动作 QMap<int,QCheckBox*> m_alarmActionCheckMap;//选中的告警动作

View File

@ -16,7 +16,7 @@ AlarmManageForm::AlarmManageForm(QWidget *parent,bool edit) :
ui->setupUi(this); ui->setupUi(this);
QString qss = QString(); 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)); QFile qssfile1(QString::fromStdString(strFullPath));
qssfile1.open(QFile::ReadOnly); qssfile1.open(QFile::ReadOnly);
if (qssfile1.isOpen()) if (qssfile1.isOpen())
@ -30,7 +30,7 @@ AlarmManageForm::AlarmManageForm(QWidget *parent,bool edit) :
qDebug() << "public.qss 无法打开!"; qDebug() << "public.qss 无法打开!";
} }
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("alarmmng.qss") ; strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("alarmmng.qss") ;
QFile qssfile2(QString::fromStdString(strFullPath)); QFile qssfile2(QString::fromStdString(strFullPath));
qssfile2.open(QFile::ReadOnly); qssfile2.open(QFile::ReadOnly);
if (qssfile2.isOpen()) if (qssfile2.isOpen())

View File

@ -8,7 +8,7 @@
class AlarmManagePluginWidget : public QObject, public CPluginWidgetInterface class AlarmManagePluginWidget : public QObject, public CPluginWidgetInterface
{ {
Q_OBJECT Q_OBJECT
Q_PLUGIN_METADATA(IID HMI_WidgetPlugin_IID) Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0")
Q_INTERFACES(CPluginWidgetInterface) Q_INTERFACES(CPluginWidgetInterface)
public: public:

View File

@ -52,7 +52,7 @@ AlarmManageWidget::AlarmManageWidget(QWidget *parent, bool editMode) :
initView(); initView();
m_pThread->start(); m_pThread->start();
} }
QDir dir(QString::fromStdString(iot_public::CFileUtil::getCurModuleDir())); QDir dir(QString::fromStdString(kbd_public::CFileUtil::getCurModuleDir()));
dir.cdUp(); dir.cdUp();
dir.cdUp(); dir.cdUp();
dir.cd("data"); dir.cd("data");
@ -86,8 +86,8 @@ void AlarmManageWidget::initMember()
} }
AlarmMng::instance()->moveToThread(m_pThread); AlarmMng::instance()->moveToThread(m_pThread);
m_pWriteDb = new iot_dbms::CDbApi(DB_CONN_MODEL_WRITE); m_pWriteDb = new kbd_dbms::CDbApi(DB_CONN_MODEL_WRITE);
m_pReadDb = new iot_dbms::CDbApi(DB_CONN_MODEL_READ); m_pReadDb = new kbd_dbms::CDbApi(DB_CONN_MODEL_READ);
if(!m_pWriteDb->open()) if(!m_pWriteDb->open())
{ {
LOGERROR("打开数据库失败,error:%s",m_pWriteDb->getLastErrorString().toStdString().c_str()); LOGERROR("打开数据库失败,error:%s",m_pWriteDb->getLastErrorString().toStdString().c_str());
@ -202,7 +202,7 @@ bool AlarmManageWidget::initCurUser()
{ {
m_userId = -1; m_userId = -1;
m_usergId = -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())) if(permMngPtr == NULL || (PERM_NORMAL != permMngPtr->PermDllInit()))
{ {
LOGERROR("权限接口初始化失败!"); LOGERROR("权限接口初始化失败!");

View File

@ -126,8 +126,8 @@ private:
QMap<int,int> m_alarmLevelIndexMap; QMap<int,int> m_alarmLevelIndexMap;
iot_dbms::CDbApi *m_pReadDb; kbd_dbms::CDbApi *m_pReadDb;
iot_dbms::CDbApi *m_pWriteDb; kbd_dbms::CDbApi *m_pWriteDb;
int m_userId; int m_userId;
int m_usergId; int m_usergId;

View File

@ -6,8 +6,8 @@
#include <QMutexLocker> #include <QMutexLocker>
#include <QSqlQuery> #include <QSqlQuery>
using namespace iot_dbms; using namespace kbd_dbms;
using namespace iot_public; using namespace kbd_public;
using namespace std; using namespace std;
AlarmMng *AlarmMng::pInstance = NULL; AlarmMng *AlarmMng::pInstance = NULL;
@ -249,7 +249,7 @@ QList<QString> AlarmMng::getDiText()
bool AlarmMng::getNomRptEditPerm() 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())) if(permMngPtr == NULL || (PERM_NORMAL != permMngPtr->PermDllInit()))
{ {
LOGERROR("权限接口初始化失败!"); LOGERROR("权限接口初始化失败!");
@ -278,12 +278,12 @@ AlarmMng::AlarmMng()
{ {
mutex = new QMutex; 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()) if(!m_pReadDb->open())
{ {
LOGERROR("打开数据库失败,error:%s",m_pReadDb->getLastErrorString().toStdString().c_str()); LOGERROR("打开数据库失败,error:%s",m_pReadDb->getLastErrorString().toStdString().c_str());
} }
m_rtdbAccess = new iot_dbms::CRdbAccess(); m_rtdbAccess = new kbd_dbms::CRdbAccess();
loadLocInfo(); loadLocInfo();
loadDevgInfo(); loadDevgInfo();
loadDevInfo(); loadDevInfo();
@ -298,7 +298,7 @@ AlarmMng::AlarmMng()
void AlarmMng::loadLocInfo() 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())) if(permMngPtr == NULL || (PERM_NORMAL != permMngPtr->PermDllInit()))
{ {
LOGERROR("权限接口初始化失败!"); LOGERROR("权限接口初始化失败!");
@ -320,8 +320,8 @@ void AlarmMng::loadLocInfo()
id_value.second = "description"; id_value.second = "description";
if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str())) if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str()))
{ {
iot_dbms::CTableLockGuard locker(*m_rtdbAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
iot_dbms::CRdbQueryResult result; kbd_dbms::CRdbQueryResult result;
std::vector<std::string> columns; std::vector<std::string> columns;
columns.push_back(id_value.first); columns.push_back(id_value.first);
columns.push_back(id_value.second); columns.push_back(id_value.second);
@ -332,8 +332,8 @@ void AlarmMng::loadLocInfo()
m_locMap.clear(); m_locMap.clear();
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++) for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
{ {
iot_dbms::CVarType key; kbd_dbms::CVarType key;
iot_dbms::CVarType value; kbd_dbms::CVarType value;
result.getColumnValue(nIndex, 0, key); result.getColumnValue(nIndex, 0, key);
result.getColumnValue(nIndex, 1, value); result.getColumnValue(nIndex, 1, value);

View File

@ -119,9 +119,9 @@ private:
static AlarmMng * pInstance; 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<int,QString> m_locMap; //<车站ID,车站描述>
QMap<QString,QString> m_devgMap; //<设备组标签,设备组描述> QMap<QString,QString> m_devgMap; //<设备组标签,设备组描述>
QMap<QString,QString> m_devMap; //<设备标签,设备描述> QMap<QString,QString> m_devMap; //<设备标签,设备描述>

View File

@ -8,13 +8,13 @@ int main(int argc, char *argv[])
QApplication a(argc, argv); QApplication a(argc, argv);
std::string name="admin"; std::string name="admin";
std::string password ="admin"; std::string password ="kbdct";
iot_public::StartLogSystem("HMI", "hmi"); kbd_public::StartLogSystem("HMI", "hmi");
iot_net::initMsgBus("HMI", "HMI"); kbd_net::initMsgBus("HMI", "HMI");
int group =1; 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()) if(!perm || PERM_NORMAL != perm->PermDllInit())
{ {
return -1; return -1;
@ -29,9 +29,9 @@ int main(int argc, char *argv[])
w.show(); w.show();
a.exec(); a.exec();
} }
iot_net::releaseMsgBus(); kbd_net::releaseMsgBus();
iot_public::StopLogSystem(); kbd_public::StopLogSystem();
return 0; return 0;
} }

View File

@ -498,7 +498,7 @@ int CAddShieldDialog::getMonthOption()
bool CAddShieldDialog::getCurUser(int &userId, int &usergId, QString &hostName, int &locationId) 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())) if(permMngPtr == NULL || (PERM_NORMAL != permMngPtr->PermDllInit()))
{ {
LOGERROR("权限接口初始化失败!"); LOGERROR("权限接口初始化失败!");
@ -514,9 +514,9 @@ bool CAddShieldDialog::getCurUser(int &userId, int &usergId, QString &hostName,
LOGERROR("获取当前登录用户失败!"); LOGERROR("获取当前登录用户失败!");
return false; return false;
} }
iot_public::SNodeInfo stNodeInfo; kbd_public::SNodeInfo stNodeInfo;
iot_public::CSysInfoInterfacePtr spSysInfo; kbd_public::CSysInfoInterfacePtr spSysInfo;
if (!iot_public::createSysInfoInstance(spSysInfo)) if (!kbd_public::createSysInfoInstance(spSysInfo))
{ {
LOGERROR("创建系统信息访问库实例失败!"); LOGERROR("创建系统信息访问库实例失败!");
return false; return false;

View File

@ -21,7 +21,7 @@ CAlarmShield::CAlarmShield(QWidget *parent, bool editMode) :
if(!editMode) if(!editMode)
{ {
QString style = QString(); 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)); QFile file1(QString::fromStdString(strFullPath));
if (file1.open(QIODevice::ReadOnly)) if (file1.open(QIODevice::ReadOnly))
{ {
@ -31,7 +31,7 @@ CAlarmShield::CAlarmShield(QWidget *parent, bool editMode) :
} }
file1.close(); file1.close();
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("alarmShield.qss") ; strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("alarmShield.qss") ;
QFile file2(QString::fromStdString(strFullPath)); QFile file2(QString::fromStdString(strFullPath));
if (file2.open(QIODevice::ReadOnly)) if (file2.open(QIODevice::ReadOnly))
{ {

View File

@ -7,7 +7,7 @@
class CAlarmShieldPluginWidget : public QObject, public CPluginWidgetInterface class CAlarmShieldPluginWidget : public QObject, public CPluginWidgetInterface
{ {
Q_OBJECT Q_OBJECT
Q_PLUGIN_METADATA(IID HMI_WidgetPlugin_IID) Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0")
Q_INTERFACES(CPluginWidgetInterface) Q_INTERFACES(CPluginWidgetInterface)
public: public:

View File

@ -150,7 +150,7 @@ QMap<int, QString> CDbInfoManage::getShieldPropMap()
bool CDbInfoManage::loadShieldObj(const int &shieldId, QList<ST_Shield_Obj> &objList) 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(); bool ret = objReadDb.open();
if(!ret) 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) 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(); bool ret = objReadDb.open();
if(!ret) 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) 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(); bool ret = objReadDb.open();
if(!ret) if(!ret)
{ {
@ -820,13 +820,13 @@ bool CDbInfoManage::checkOptPerm(const std::vector<int> &vecRegionOptId, const s
CDbInfoManage::CDbInfoManage() CDbInfoManage::CDbInfoManage()
{ {
initPermMng(); initPermMng();
m_rtdbAccess = new iot_dbms::CRdbAccess(); m_rtdbAccess = new kbd_dbms::CRdbAccess();
m_pWriteDb = new iot_dbms::CDbApi(DB_CONN_MODEL_WRITE); m_pWriteDb = new kbd_dbms::CDbApi(DB_CONN_MODEL_WRITE);
m_pWriteDb->open(); m_pWriteDb->open();
// m_tagInfo.reserve(5000); // m_tagInfo.reserve(5000);
iot_dbms::CDbApi objReadDb(DB_CONN_MODEL_READ); kbd_dbms::CDbApi objReadDb(DB_CONN_MODEL_READ);
bool ret = objReadDb.open(); bool ret = objReadDb.open();
if(!ret) if(!ret)
{ {
@ -845,7 +845,7 @@ CDbInfoManage::CDbInfoManage()
void CDbInfoManage::initPermMng() void CDbInfoManage::initPermMng()
{ {
m_ptrPermMng = iot_service::getPermMngInstance("base"); m_ptrPermMng = kbd_service::getPermMngInstance("base");
if(m_ptrPermMng == NULL || (PERM_NORMAL != m_ptrPermMng->PermDllInit())) if(m_ptrPermMng == NULL || (PERM_NORMAL != m_ptrPermMng->PermDllInit()))
{ {
LOGERROR("权限接口初始化失败!"); LOGERROR("权限接口初始化失败!");
@ -892,8 +892,8 @@ void CDbInfoManage::loadRTLocation()
std::string strTableName = "sys_model_location_info"; std::string strTableName = "sys_model_location_info";
if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str())) if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str()))
{ {
iot_dbms::CTableLockGuard locker(*m_rtdbAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
iot_dbms::CRdbQueryResult result; kbd_dbms::CRdbQueryResult result;
std::vector<std::string> columns; std::vector<std::string> columns;
columns.push_back("location_id"); columns.push_back("location_id");
columns.push_back("tag_name"); columns.push_back("tag_name");
@ -906,9 +906,9 @@ void CDbInfoManage::loadRTLocation()
m_locationTag.clear(); m_locationTag.clear();
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++) for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
{ {
iot_dbms::CVarType location_id; kbd_dbms::CVarType location_id;
iot_dbms::CVarType tag_name; kbd_dbms::CVarType tag_name;
iot_dbms::CVarType description; kbd_dbms::CVarType description;
result.getColumnValue(nIndex, 0, location_id); result.getColumnValue(nIndex, 0, location_id);
result.getColumnValue(nIndex, 1, tag_name); result.getColumnValue(nIndex, 1, tag_name);
result.getColumnValue(nIndex, 2, description); result.getColumnValue(nIndex, 2, description);
@ -930,7 +930,7 @@ void CDbInfoManage::loadRTLocation()
m_rtdbAccess->close(); m_rtdbAccess->close();
} }
void CDbInfoManage::loadDevGroupInfo(iot_dbms::CDbApi &objReadDb) void CDbInfoManage::loadDevGroupInfo(kbd_dbms::CDbApi &objReadDb)
{ {
QSqlQuery query; 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; 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; QSqlQuery query;
QStringList listType; 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; QSqlQuery query;
QString sql = QString("select perm_id,perm_alias from rm_user_def"); 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; QSqlQuery query;
QString sql = QString("select shield_id,description,shield_prop from opt_shield_define"); 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; QSqlQuery query;
QString sql = QString("select actual_value,display_value from dict_menu_info where menu_name = '%1' ").arg("屏蔽属性"); 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 CDbInfoManage::getMaxId(int &timeId, int &shieldId)
{ {
bool ret = false; bool ret = false;
iot_dbms::CDbApi readDb(DB_CONN_MODEL_READ); kbd_dbms::CDbApi readDb(DB_CONN_MODEL_READ);
if(!readDb.open()) if(!readDb.open())
{ {
return false; return false;

View File

@ -57,20 +57,20 @@ private:
QString getJoinStr(const QList<int> &list, char c); QString getJoinStr(const QList<int> &list, char c);
void loadRTLocation(); void loadRTLocation();
void loadDevGroupInfo(iot_dbms::CDbApi &objReadDb); void loadDevGroupInfo(kbd_dbms::CDbApi &objReadDb);
void loadDeviceInfo(iot_dbms::CDbApi &objReadDb); void loadDeviceInfo(kbd_dbms::CDbApi &objReadDb);
void loadPointInfo(iot_dbms::CDbApi &objReadDb); void loadPointInfo(kbd_dbms::CDbApi &objReadDb);
void loadUserInfo(iot_dbms::CDbApi &objReadDb); void loadUserInfo(kbd_dbms::CDbApi &objReadDb);
void loadShieldDefine(iot_dbms::CDbApi &objReadDb); void loadShieldDefine(kbd_dbms::CDbApi &objReadDb);
void loadShieldProperty(iot_dbms::CDbApi &objReadDb); void loadShieldProperty(kbd_dbms::CDbApi &objReadDb);
bool getMaxId(int &timeId, int &shieldId); bool getMaxId(int &timeId, int &shieldId);
private: private:
static CDbInfoManage * m_pInstance; static CDbInfoManage * m_pInstance;
iot_service::CPermMngApiPtr m_ptrPermMng; kbd_service::CPermMngApiPtr m_ptrPermMng;
iot_dbms::CRdbAccess * m_rtdbAccess; kbd_dbms::CRdbAccess * m_rtdbAccess;
iot_dbms::CDbApi *m_pWriteDb; kbd_dbms::CDbApi *m_pWriteDb;
QMap<QString, int> m_regionMap; QMap<QString, int> m_regionMap;
QMap<int, QString> m_locationInfo; QMap<int, QString> m_locationInfo;
QMap<int, QString> m_locationTag; QMap<int, QString> m_locationTag;

View File

@ -86,8 +86,6 @@ E_Tree_ItemType CDevTreeModel::currentType()
QVariant CDevTreeModel::headerData(int section, Qt::Orientation orientation, int role) const QVariant CDevTreeModel::headerData(int section, Qt::Orientation orientation, int role) const
{ {
Q_UNUSED(section);
if(role == Qt::DisplayRole) if(role == Qt::DisplayRole)
{ {
if(orientation == Qt::Horizontal) if(orientation == Qt::Horizontal)

View File

@ -8,8 +8,8 @@ CHeaderView::CHeaderView(QWidget *parent, int nAddCheckBoxColumn):
QHeaderView(Qt::Horizontal, parent), QHeaderView(Qt::Horizontal, parent),
m_bChecked(false) m_bChecked(false)
{ {
m_indicatorCheck = iot_public::CFileUtil::getPathOfResFile("gui/icon/alarm/ckb-select.png").c_str(); m_indicatorCheck = kbd_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_indicatorUnCheck = kbd_public::CFileUtil::getPathOfResFile("gui/icon/alarm/unchecked.png").c_str();
setSectionsClickable(true); setSectionsClickable(true);
connect(this, SIGNAL(sectionClicked(int)), this, SLOT(onHeaderClicked(int))); connect(this, SIGNAL(sectionClicked(int)), this, SLOT(onHeaderClicked(int)));

View File

@ -5,9 +5,9 @@
int main(int argc, char *argv[]) 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()) if(!perm || PERM_NORMAL != perm->PermDllInit())
{ {
return -1; return -1;
@ -25,6 +25,6 @@ int main(int argc, char *argv[])
a.exec(); a.exec();
iot_public::StopLogSystem(); kbd_public::StopLogSystem();
return 0; return 0;
} }

View File

@ -7,7 +7,7 @@
class CAlarmStatisPluginWidget : public QObject, public CPluginWidgetInterface class CAlarmStatisPluginWidget : public QObject, public CPluginWidgetInterface
{ {
Q_OBJECT Q_OBJECT
Q_PLUGIN_METADATA(IID HMI_WidgetPlugin_IID) Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0")
Q_INTERFACES(CPluginWidgetInterface) Q_INTERFACES(CPluginWidgetInterface)
public: public:
CAlarmStatisPluginWidget(QObject *parent = 0); CAlarmStatisPluginWidget(QObject *parent = 0);

View File

@ -2,18 +2,18 @@
#include "dbms/db_api_ex/CDbApi.h" #include "dbms/db_api_ex/CDbApi.h"
#include "CStatisCommon.h" #include "CStatisCommon.h"
using namespace iot_dbms; using namespace kbd_dbms;
CDataInfoManage *CDataInfoManage::m_pInstance = NULL; CDataInfoManage *CDataInfoManage::m_pInstance = NULL;
CDataInfoManage::CDataInfoManage() CDataInfoManage::CDataInfoManage()
{ {
m_rtdbAccess = new iot_dbms::CRdbAccess(); m_rtdbAccess = new kbd_dbms::CRdbAccess();
m_rtdbNetAcs = new iot_dbms::CRdbNetApi(); m_rtdbNetAcs = new kbd_dbms::CRdbNetApi();
m_nDomain = CN_InvalidDomainId; 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_ptrSysInfo->getLocalNodeInfo(sNodeInfo);
m_nDomain = sNodeInfo.nDomainId; m_nDomain = sNodeInfo.nDomainId;
} }
@ -205,8 +205,8 @@ void CDataInfoManage::loadAlarmLevel()
std::string strTableName = "alarm_level_define"; std::string strTableName = "alarm_level_define";
if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str())) if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str()))
{ {
iot_dbms::CTableLockGuard locker(*m_rtdbAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
iot_dbms::CRdbQueryResult result; kbd_dbms::CRdbQueryResult result;
std::vector<std::string> columns; std::vector<std::string> columns;
columns.push_back("priority_id"); columns.push_back("priority_id");
columns.push_back("priority_name"); columns.push_back("priority_name");
@ -224,9 +224,9 @@ void CDataInfoManage::loadAlarmLevel()
m_alarmOrderMap.clear(); m_alarmOrderMap.clear();
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++) for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
{ {
iot_dbms::CVarType key; kbd_dbms::CVarType key;
iot_dbms::CVarType value; kbd_dbms::CVarType value;
iot_dbms::CVarType order; kbd_dbms::CVarType order;
result.getColumnValue(nIndex, 0, key); result.getColumnValue(nIndex, 0, key);
result.getColumnValue(nIndex, 1, value); result.getColumnValue(nIndex, 1, value);
result.getColumnValue(nIndex, 2, order); result.getColumnValue(nIndex, 2, order);
@ -245,8 +245,8 @@ void CDataInfoManage::loadLocation()
std::string strTableName = "sys_model_location_info"; std::string strTableName = "sys_model_location_info";
if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str())) if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str()))
{ {
iot_dbms::CTableLockGuard locker(*m_rtdbAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
iot_dbms::CRdbQueryResult result; kbd_dbms::CRdbQueryResult result;
std::vector<std::string> columns; std::vector<std::string> columns;
columns.push_back("location_id"); columns.push_back("location_id");
columns.push_back("description"); columns.push_back("description");
@ -260,10 +260,10 @@ void CDataInfoManage::loadLocation()
{ {
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++) for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
{ {
iot_dbms::CVarType id; kbd_dbms::CVarType id;
iot_dbms::CVarType desc; kbd_dbms::CVarType desc;
iot_dbms::CVarType p_id; kbd_dbms::CVarType p_id;
iot_dbms::CVarType type; kbd_dbms::CVarType type;
result.getColumnValue(nIndex, 0, id); result.getColumnValue(nIndex, 0, id);
result.getColumnValue(nIndex, 1, desc); result.getColumnValue(nIndex, 1, desc);
result.getColumnValue(nIndex, 2, p_id); result.getColumnValue(nIndex, 2, p_id);
@ -300,8 +300,8 @@ void CDataInfoManage::loadDevType()
std::string strTableName = "dev_type_def"; std::string strTableName = "dev_type_def";
if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str())) if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str()))
{ {
iot_dbms::CTableLockGuard locker(*m_rtdbAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
iot_dbms::CRdbQueryResult result; kbd_dbms::CRdbQueryResult result;
std::vector<std::string> columns; std::vector<std::string> columns;
columns.push_back("dev_type_id"); columns.push_back("dev_type_id");
columns.push_back("description"); columns.push_back("description");
@ -311,8 +311,8 @@ void CDataInfoManage::loadDevType()
m_devTypeMap.clear(); m_devTypeMap.clear();
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++) for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
{ {
iot_dbms::CVarType key; kbd_dbms::CVarType key;
iot_dbms::CVarType value; kbd_dbms::CVarType value;
result.getColumnValue(nIndex, 0, key); result.getColumnValue(nIndex, 0, key);
result.getColumnValue(nIndex, 1, value); result.getColumnValue(nIndex, 1, value);
@ -327,7 +327,7 @@ void CDataInfoManage::loadDevInfo()
{ {
std::string strTableName = "dev_info"; std::string strTableName = "dev_info";
m_rtdbNetAcs->connect(m_nDomain, CN_AppId_PSCADA); m_rtdbNetAcs->connect(m_nDomain, CN_AppId_PSCADA);
iot_idl::RdbRet objRet; kbd_idlfile::RdbRet objRet;
std::vector<std::string> columns; std::vector<std::string> columns;
columns.push_back("tag_name"); columns.push_back("tag_name");
columns.push_back("description"); columns.push_back("description");
@ -389,8 +389,8 @@ void CDataInfoManage::loadAlarmStatus()
std::string strTableName = "alarm_status_define"; std::string strTableName = "alarm_status_define";
if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str())) if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str()))
{ {
iot_dbms::CTableLockGuard locker(*m_rtdbAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
iot_dbms::CRdbQueryResult result; kbd_dbms::CRdbQueryResult result;
std::vector<std::string> columns; std::vector<std::string> columns;
columns.push_back("alarm_type"); columns.push_back("alarm_type");
columns.push_back("status_value"); columns.push_back("status_value");
@ -401,9 +401,9 @@ void CDataInfoManage::loadAlarmStatus()
m_alarmStatusMap.clear(); m_alarmStatusMap.clear();
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++) for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
{ {
iot_dbms::CVarType alarm_type; kbd_dbms::CVarType alarm_type;
iot_dbms::CVarType status_value; kbd_dbms::CVarType status_value;
iot_dbms::CVarType alarm_manner; kbd_dbms::CVarType alarm_manner;
result.getColumnValue(nIndex, 0, alarm_type); result.getColumnValue(nIndex, 0, alarm_type);
result.getColumnValue(nIndex, 1, status_value); result.getColumnValue(nIndex, 1, status_value);
result.getColumnValue(nIndex, 2, alarm_manner); result.getColumnValue(nIndex, 2, alarm_manner);
@ -424,8 +424,8 @@ void CDataInfoManage::loadAlarmManner()
std::string strTableName = "alarm_manner_define"; std::string strTableName = "alarm_manner_define";
if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str())) if(m_rtdbAccess->open(strApplicationName.c_str(), strTableName.c_str()))
{ {
iot_dbms::CTableLockGuard locker(*m_rtdbAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
iot_dbms::CRdbQueryResult result; kbd_dbms::CRdbQueryResult result;
std::vector<std::string> columns; std::vector<std::string> columns;
columns.push_back("manner_id"); columns.push_back("manner_id");
columns.push_back("alarm_priority"); columns.push_back("alarm_priority");
@ -435,8 +435,8 @@ void CDataInfoManage::loadAlarmManner()
m_alarmMannerMap.clear(); m_alarmMannerMap.clear();
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++) for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
{ {
iot_dbms::CVarType key; kbd_dbms::CVarType key;
iot_dbms::CVarType value; kbd_dbms::CVarType value;
result.getColumnValue(nIndex, 0, key); result.getColumnValue(nIndex, 0, key);
result.getColumnValue(nIndex, 1, value); result.getColumnValue(nIndex, 1, value);
@ -460,7 +460,7 @@ void CDataInfoManage::loadDevPoint()
for(int nIndex=0; nIndex<listTable.length(); nIndex++) for(int nIndex=0; nIndex<listTable.length(); nIndex++)
{ {
m_rtdbNetAcs->connect(m_nDomain, CN_AppId_PSCADA); m_rtdbNetAcs->connect(m_nDomain, CN_AppId_PSCADA);
iot_idl::RdbRet objRet; kbd_idlfile::RdbRet objRet;
std::vector<std::string> columns; std::vector<std::string> columns;
columns.push_back("tag_name"); columns.push_back("tag_name");
columns.push_back("device"); columns.push_back("device");

View File

@ -43,9 +43,9 @@ private:
void loadDevPoint(); void loadDevPoint();
private: private:
iot_dbms::CRdbAccess * m_rtdbAccess; kbd_dbms::CRdbAccess * m_rtdbAccess;
iot_dbms::CRdbNetApi * m_rtdbNetAcs; kbd_dbms::CRdbNetApi * m_rtdbNetAcs;
iot_public::CSysInfoInterfacePtr m_ptrSysInfo; kbd_public::CSysInfoInterfacePtr m_ptrSysInfo;
int m_nDomain; int m_nDomain;
QMap<int, QString> m_alarmLevelMap; //< alarm_level_define PRIORITY_ID - PRIORITY_NAME QMap<int, QString> m_alarmLevelMap; //< alarm_level_define PRIORITY_ID - PRIORITY_NAME
QMap<int, int > m_alarmOrderMap; //< alarm_level_define PRIORITY_ID - PRIORITY_ORDER QMap<int, int > m_alarmOrderMap; //< alarm_level_define PRIORITY_ID - PRIORITY_ORDER

View File

@ -17,7 +17,7 @@ void CHisEventManage::queryHisEventStatis(int location, int devType, qint64 star
{ {
QTime time; QTime time;
time.start(); time.start();
iot_dbms::CTsdbConnPtr tsdbConnPtr; kbd_dbms::CTsdbConnPtr tsdbConnPtr;
if(!getValidTsdbConnPtr(tsdbConnPtr)) if(!getValidTsdbConnPtr(tsdbConnPtr))
{ {
LOGERROR("CTsdbQuery: 未获取到有效的TSDB连接"); LOGERROR("CTsdbQuery: 未获取到有效的TSDB连接");
@ -40,7 +40,7 @@ void CHisEventManage::queryHisEventContrast(QList<int> selectedList, qint64 star
{ {
QTime time; QTime time;
time.start(); time.start();
iot_dbms::CTsdbConnPtr tsdbConnPtr; kbd_dbms::CTsdbConnPtr tsdbConnPtr;
if(!getValidTsdbConnPtr(tsdbConnPtr)) if(!getValidTsdbConnPtr(tsdbConnPtr))
{ {
LOGERROR("CTsdbQuery: 未获取到有效的TSDB连接"); LOGERROR("CTsdbQuery: 未获取到有效的TSDB连接");
@ -69,7 +69,7 @@ void CHisEventManage::queryHisEventContrast(QList<int> selectedList, qint64 star
emit updateHisEventContrast(record); emit updateHisEventContrast(record);
} }
bool CHisEventManage::getValidTsdbConnPtr(iot_dbms::CTsdbConnPtr &ptr) bool CHisEventManage::getValidTsdbConnPtr(kbd_dbms::CTsdbConnPtr &ptr)
{ {
if(m_tsdbConnPtr != NULL) if(m_tsdbConnPtr != NULL)
{ {

View File

@ -19,7 +19,7 @@ public slots:
void queryHisEventContrast(QList<int> selectedList, qint64 startTime, qint64 endTime, EN_STATIS_STYLE style); void queryHisEventContrast(QList<int> selectedList, qint64 startTime, qint64 endTime, EN_STATIS_STYLE style);
private: private:
bool getValidTsdbConnPtr(iot_dbms::CTsdbConnPtr &ptr); bool getValidTsdbConnPtr(kbd_dbms::CTsdbConnPtr &ptr);
signals: signals:
void updateHisEventStatis(const QMap<qint64, QMap<int, int> > &event); void updateHisEventStatis(const QMap<qint64, QMap<int, int> > &event);
@ -27,7 +27,7 @@ signals:
void updateHisEventContrast(const QMap<QString, QMap<int, int> > &event); void updateHisEventContrast(const QMap<QString, QMap<int, int> > &event);
private: private:
iot_dbms::CTsdbConnPtr m_tsdbConnPtr; kbd_dbms::CTsdbConnPtr m_tsdbConnPtr;
}; };
#endif // CHISEVENTMANAGE_H #endif // CHISEVENTMANAGE_H

View File

@ -28,7 +28,7 @@ CMainWidget::~CMainWidget()
{ {
if(!m_editMode) if(!m_editMode)
{ {
iot_dbms::releaseTsdbApi(); kbd_dbms::releaseTsdbApi();
} }
if(m_pHisEventManage) if(m_pHisEventManage)
@ -76,7 +76,7 @@ void CMainWidget::initialize()
if(!m_editMode) if(!m_editMode)
{ {
iot_dbms::initTsdbApi(); kbd_dbms::initTsdbApi();
loadAlarmColor(); loadAlarmColor();
@ -87,7 +87,7 @@ void CMainWidget::initialize()
void CMainWidget::initStyleSheet() void CMainWidget::initStyleSheet()
{ {
QString style = QString(); QString style = QString();
std::string strFullPath = iot_public::CFileStyle std::string strFullPath = kbd_public::CFileStyle
::getPathOfStyleFile("public.qss") ; ::getPathOfStyleFile("public.qss") ;
QFile file1(QString::fromStdString(strFullPath)); QFile file1(QString::fromStdString(strFullPath));
if (file1.open(QIODevice::ReadOnly)) if (file1.open(QIODevice::ReadOnly))
@ -98,7 +98,7 @@ void CMainWidget::initStyleSheet()
} }
file1.close(); file1.close();
strFullPath = iot_public::CFileStyle strFullPath = kbd_public::CFileStyle
::getPathOfStyleFile("AlarmStatisWidget.qss") ; ::getPathOfStyleFile("AlarmStatisWidget.qss") ;
QFile file2(QString::fromStdString(strFullPath)); QFile file2(QString::fromStdString(strFullPath));
if (file2.open(QIODevice::ReadOnly)) if (file2.open(QIODevice::ReadOnly))
@ -116,7 +116,7 @@ void CMainWidget::initStyleSheet()
void CMainWidget::loadAlarmColor() 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"); + QString("../../data/model/alarm_color_define.xml");
QDomDocument document; QDomDocument document;

View File

@ -32,7 +32,7 @@ CTsdbQuery::~CTsdbQuery()
{ {
int64 resultSize = 0; 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()) while(res != m_pVecResult->end())
{ {
resultSize += (*res)->size(); 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++) for(size_t nIndex(0); nIndex < m_pVecResult->size(); nIndex++)
{ {
std::vector<iot_dbms::SHisEventPoint> *evetVector = m_pVecResult->at(nIndex); std::vector<kbd_dbms::SHisEventPoint> *evetVector = m_pVecResult->at(nIndex);
std::vector<iot_dbms::SHisEventPoint>::iterator iter = evetVector->begin(); std::vector<kbd_dbms::SHisEventPoint>::iterator iter = evetVector->begin();
for(; iter != evetVector->end(); iter++) for(; iter != evetVector->end(); iter++)
{ {
int priority = getAlarmLevel(m_pVecMpKey->at(nIndex).m_pszTagName, 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++) for(size_t nIndex(0); nIndex < m_pVecResult->size(); nIndex++)
{ {
std::vector<iot_dbms::SHisEventPoint> *evetVector = m_pVecResult->at(nIndex); std::vector<kbd_dbms::SHisEventPoint> *evetVector = m_pVecResult->at(nIndex);
std::vector<iot_dbms::SHisEventPoint>::iterator iter = evetVector->begin(); std::vector<kbd_dbms::SHisEventPoint>::iterator iter = evetVector->begin();
qint64 time = startTime; qint64 time = startTime;
qint64 addTime = getAddMsecByMode(time, mode); qint64 addTime = getAddMsecByMode(time, mode);
for(; iter != evetVector->end(); iter++) for(; iter != evetVector->end(); iter++)

View File

@ -5,7 +5,7 @@
#include "tsdb_api/TsdbApi.h" #include "tsdb_api/TsdbApi.h"
#include "db_his_query_api/DbHisQueryBase.h" #include "db_his_query_api/DbHisQueryBase.h"
using namespace iot_dbms; using namespace kbd_dbms;
class CTsdbQuery class CTsdbQuery
{ {
public: public:
@ -28,7 +28,7 @@ private:
std::vector<std::vector<SHisEventPoint> *> *m_pVecResult; std::vector<std::vector<SHisEventPoint> *> *m_pVecResult;
private: private:
iot_dbms::CTsdbConnPtr m_tsdbConnPtr; kbd_dbms::CTsdbConnPtr m_tsdbConnPtr;
QString m_strDevice; QString m_strDevice;
}; };

View File

@ -7,23 +7,23 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
iot_public::StartLogSystem("HMI", "AlarmStatisWidget"); kbd_public::StartLogSystem("HMI", "AlarmStatisWidget");
if (!(iot_net::initMsgBus("HMI", "HMI"))) if (!(kbd_net::initMsgBus("HMI", "HMI")))
{ {
return -1; return -1;
} }
iot_service::CPermMngApiPtr perm = iot_service::getPermMngInstance("base"); kbd_service::CPermMngApiPtr perm = kbd_service::getPermMngInstance("base");
if(!perm || PERM_NORMAL != perm->PermDllInit()) if(!perm || PERM_NORMAL != perm->PermDllInit())
{ {
return -1; 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; return -1;
} }
// iot_service::CDpcdaForApp::initGlobalThread(); // kbd_service::CDpcdaForApp::initGlobalThread();
{ {
LOGINFO("=========================== AlarmStatisWidget ==========================="); LOGINFO("=========================== AlarmStatisWidget ===========================");
@ -35,10 +35,10 @@ int main(int argc, char *argv[])
app.exec(); app.exec();
} }
// iot_service::CDpcdaForApp::releaseGlobalThread(); // kbd_service::CDpcdaForApp::releaseGlobalThread();
iot_net::releaseMsgBus(); kbd_net::releaseMsgBus();
iot_public::StopLogSystem(); kbd_public::StopLogSystem();
return 0; return 0;
} }

View File

@ -58,7 +58,7 @@ void CAccidentReviewDialog::initView()
void CAccidentReviewDialog::initTree() void CAccidentReviewDialog::initTree()
{ {
QMap<int, QList<QPair<int, ST_NODE>>> m_mapNav; 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); + QString("../../data/model/NavigationWidget.json"), m_mapNav);
QList<QPair<int, ST_NODE>> nodeList = m_mapNav.value(-1); QList<QPair<int, ST_NODE>> nodeList = m_mapNav.value(-1);
for(int nIndex=0; nIndex<nodeList.length(); nIndex++) for(int nIndex=0; nIndex<nodeList.length(); nIndex++)
@ -78,7 +78,7 @@ void CAccidentReviewDialog::initTree()
void CAccidentReviewDialog::getFilterNames(const QString &path) 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/"); + QString("../../data/pic/");
m_fileNameList = getAllFile(filePath, filePath, path); m_fileNameList = getAllFile(filePath, filePath, path);
} }

View File

@ -3,7 +3,7 @@
#include "CAlarmMsgManage.h" #include "CAlarmMsgManage.h"
#include <QDebug> #include <QDebug>
#include "CAlarmDataCollect.h" #include "CAlarmDataCollect.h"
using namespace iot_service; using namespace kbd_service;
CAiAlarmDataCollect * CAiAlarmDataCollect::m_pInstance = NULL; CAiAlarmDataCollect * CAiAlarmDataCollect::m_pInstance = NULL;
CAiAlarmDataCollect::CAiAlarmDataCollect() CAiAlarmDataCollect::CAiAlarmDataCollect()
: CIntelliAlmApi4Clt(), : CIntelliAlmApi4Clt(),
@ -12,7 +12,7 @@ CAiAlarmDataCollect::CAiAlarmDataCollect()
m_pAlternateTimer(Q_NULLPTR) m_pAlternateTimer(Q_NULLPTR)
{ {
m_rtdbMutex = new QMutex(); m_rtdbMutex = new QMutex();
m_rtdbPriorityOrderAccess = new iot_dbms::CRdbAccess(); m_rtdbPriorityOrderAccess = new kbd_dbms::CRdbAccess();
m_rtdbPriorityOrderAccess->open("base", "alarm_level_define"); m_rtdbPriorityOrderAccess->open("base", "alarm_level_define");
} }
@ -68,25 +68,25 @@ bool CAiAlarmDataCollect::isFaultRecallState()
return m_bFaultRecallState; return m_bFaultRecallState;
} }
bool CAiAlarmDataCollect::requestDelAlm(iot_idl::SIntelliAlmDel &objDelAlm) bool CAiAlarmDataCollect::requestDelAlm(kbd_idlfile::SIntelliAlmDel &objDelAlm)
{ {
LOGDEBUG("请求删除!"); 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("请求分离!"); 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("请求合并!"); 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 =========="); LOGINFO("========== AiAlarmDataCollect handleAllAlmMsg ==========");
@ -98,7 +98,7 @@ void CAiAlarmDataCollect::handleAllAlmMsg(int nDomainId, iot_idl::SIntelliAlmAdd
QList<AiAlarmMsgPtr> almList; QList<AiAlarmMsgPtr> almList;
for(int nAddMsgIndex(0); nAddMsgIndex < nAlarmCount; nAddMsgIndex++) 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()); AiAlarmMsgPtr alm(new CAiAlarmMsgInfo());
alm->initialize(msg); alm->initialize(msg);
alm->priorityOrder = queryPriorityOrder(alm->priority); alm->priorityOrder = queryPriorityOrder(alm->priority);
@ -109,7 +109,7 @@ void CAiAlarmDataCollect::handleAllAlmMsg(int nDomainId, iot_idl::SIntelliAlmAdd
emit sigMsgRefresh(); emit sigMsgRefresh();
} }
void CAiAlarmDataCollect::handleAddAlmMsg(iot_idl::SIntelliAlmAdd &objAddAlm) void CAiAlarmDataCollect::handleAddAlmMsg(kbd_idlfile::SIntelliAlmAdd &objAddAlm)
{ {
LOGINFO("========== AiAlarmDataCollect handleAddAlmMsg =========="); LOGINFO("========== AiAlarmDataCollect handleAddAlmMsg ==========");
QMutexLocker locker(m_rtdbMutex); QMutexLocker locker(m_rtdbMutex);
@ -118,7 +118,7 @@ void CAiAlarmDataCollect::handleAddAlmMsg(iot_idl::SIntelliAlmAdd &objAddAlm)
QList<AiAlarmMsgPtr> almList; QList<AiAlarmMsgPtr> almList;
for(int nAddMsgIndex(0); nAddMsgIndex < nAlarmCount; nAddMsgIndex++) 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()); AiAlarmMsgPtr alm(new CAiAlarmMsgInfo());
alm->initialize(msg); alm->initialize(msg);
alm->priorityOrder = queryPriorityOrder(alm->priority); alm->priorityOrder = queryPriorityOrder(alm->priority);
@ -128,7 +128,7 @@ void CAiAlarmDataCollect::handleAddAlmMsg(iot_idl::SIntelliAlmAdd &objAddAlm)
LOGDEBUG("AiAlarmDataCollect handleAddAlmMsg():count[%d]",nAlarmCount); LOGDEBUG("AiAlarmDataCollect handleAddAlmMsg():count[%d]",nAlarmCount);
} }
void CAiAlarmDataCollect::handleDelAlmMsg(iot_idl::SIntelliAlmDel &objDelAlm) void CAiAlarmDataCollect::handleDelAlmMsg(kbd_idlfile::SIntelliAlmDel &objDelAlm)
{ {
LOGINFO("========== AiAlarmDataCollect handleDelAlmMsg =========="); LOGINFO("========== AiAlarmDataCollect handleDelAlmMsg ==========");
QMutexLocker locker(m_rtdbMutex); QMutexLocker locker(m_rtdbMutex);
@ -144,7 +144,7 @@ void CAiAlarmDataCollect::handleDelAlmMsg(iot_idl::SIntelliAlmDel &objDelAlm)
LOGDEBUG("AiAlarmDataCollect handleDelAlmMsg():count[%d]",nAlarmCount); LOGDEBUG("AiAlarmDataCollect handleDelAlmMsg():count[%d]",nAlarmCount);
} }
void CAiAlarmDataCollect::handleBrokenAlmMsg(iot_idl::SIntelliAlmBroken &objBrokenAlm) void CAiAlarmDataCollect::handleBrokenAlmMsg(kbd_idlfile::SIntelliAlmBroken &objBrokenAlm)
{ {
//先保证能够编译通过 //先保证能够编译通过
LOGINFO("========== AiAlarmDataCollect handleBrokenAlmMsg =========="); LOGINFO("========== AiAlarmDataCollect handleBrokenAlmMsg ==========");
@ -160,7 +160,7 @@ void CAiAlarmDataCollect::handleBrokenAlmMsg(iot_idl::SIntelliAlmBroken &objBrok
LOGDEBUG("AiAlarmDataCollect handleBrokenAlmMsg():count[%d]",nAlarmCount); LOGDEBUG("AiAlarmDataCollect handleBrokenAlmMsg():count[%d]",nAlarmCount);
} }
void CAiAlarmDataCollect::handleReleaseAlmMsg(iot_idl::SIntelliAlmRelease &objReleaseAlm) void CAiAlarmDataCollect::handleReleaseAlmMsg(kbd_idlfile::SIntelliAlmRelease &objReleaseAlm)
{ {
//先保证能够编译通过 //先保证能够编译通过
LOGINFO("========== AiAlarmDataCollect handleReleaseAlmMsg =========="); LOGINFO("========== AiAlarmDataCollect handleReleaseAlmMsg ==========");
@ -226,8 +226,8 @@ void CAiAlarmDataCollect::slotSwitchFaultRecallState(bool bFaultRecallState)
int CAiAlarmDataCollect::queryPriorityOrder(int &id) int CAiAlarmDataCollect::queryPriorityOrder(int &id)
{ {
iot_dbms::CTableLockGuard locker(*m_rtdbPriorityOrderAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbPriorityOrderAccess);
iot_dbms::CVarType value = -1000; kbd_dbms::CVarType value = -1000;
m_rtdbPriorityOrderAccess->getColumnValueByKey((void*)&id, "priority_order", value); m_rtdbPriorityOrderAccess->getColumnValueByKey((void*)&id, "priority_order", value);
return value.toInt(); return value.toInt();
} }

View File

@ -11,7 +11,7 @@
#include "net_msg_bus_api/MsgBusApi.h" #include "net_msg_bus_api/MsgBusApi.h"
#include "dbms/rdb_api/CRdbAccess.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 Q_OBJECT
public: public:
@ -25,21 +25,21 @@ public:
bool isFaultRecallState(); 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: signals:
//< 启停定时器 //< 启停定时器
void sigTimerShot(const bool bStop); void sigTimerShot(const bool bStop);
@ -77,7 +77,7 @@ private:
bool m_bFaultRecallState; bool m_bFaultRecallState;
QMutex *m_rtdbMutex; QMutex *m_rtdbMutex;
QTimer * m_pAlternateTimer; QTimer * m_pAlternateTimer;
iot_dbms::CRdbAccess * m_rtdbPriorityOrderAccess; kbd_dbms::CRdbAccess * m_rtdbPriorityOrderAccess;
static CAiAlarmDataCollect * m_pInstance; static CAiAlarmDataCollect * m_pInstance;
}; };

View File

@ -380,8 +380,8 @@ bool CAiAlarmDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, con
wave = QString("%1%2%3").arg("\"").arg(wave).arg("\""); wave = QString("%1%2%3").arg("\"").arg(wave).arg("\"");
LOGINFO("录波文件为:%s",wave.toStdString().c_str()); LOGINFO("录波文件为:%s",wave.toStdString().c_str());
const std::string strProc = std::move(iot_public::CFileUtil::getPathOfBinFile( const std::string strProc = std::move(kbd_public::CFileUtil::getPathOfBinFile(
std::string("WaveAnalyze") + iot_public::CFileUtil::getProcSuffix())); std::string("WaveAnalyze") + kbd_public::CFileUtil::getProcSuffix()));
if(strProc.empty()) if(strProc.empty())
LOGERROR("未找到可执行文件WaveAnalyze"); LOGERROR("未找到可执行文件WaveAnalyze");
else else
@ -401,8 +401,8 @@ void CAiAlarmDelegate::slotLoadConfig()
CAlarmSetMng::instance()->getEmptyInfo(m_emptyBackgroundColor,m_emptyTipColor,m_emptyTip); CAlarmSetMng::instance()->getEmptyInfo(m_emptyBackgroundColor,m_emptyTipColor,m_emptyTip);
//CAlarmColorMng::instance()->getActAndFunc(m_act,m_func); //CAlarmColorMng::instance()->getActAndFunc(m_act,m_func);
std::string style = iot_public::CFileStyle::getCurStyle(); std::string style = kbd_public::CFileStyle::getCurStyle();
m_strTrendPath = iot_public::CFileUtil::getPathOfResFile("gui/icon/alarm/trend_"+style+".png").c_str(); m_strTrendPath = kbd_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_strVideoPath = kbd_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(); m_strWavePath = kbd_public::CFileUtil::getPathOfResFile("gui/icon/alarm/wave_"+style+".png").c_str();
} }

View File

@ -51,7 +51,7 @@ CAiAlarmMsgInfo::CAiAlarmMsgInfo(const CAiAlarmMsgInfo &other): priority(0)
m_tagname_type = other.m_tagname_type; 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(); logic_state = (E_AiALARM_LOGICSTATE)alarmInfo.logic_state();

View File

@ -21,7 +21,7 @@ class CAiAlarmMsgInfo
public: public:
CAiAlarmMsgInfo(); CAiAlarmMsgInfo();
CAiAlarmMsgInfo(const CAiAlarmMsgInfo &other); 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); bool ailessThan(const AlarmMsgPtr &info, E_ALARM_SORTKEY sortkey = E_SORT_PRIORITY);

View File

@ -2,25 +2,13 @@
#include "perm_mng_api/PermMngApi.h" #include "perm_mng_api/PermMngApi.h"
#include "CAlarmCommon.h" #include "CAlarmCommon.h"
#include "pub_logger_api/logger.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" #include "boost/property_tree/xml_parser.hpp"
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#include "boost/typeof/typeof.hpp" #include "boost/typeof/typeof.hpp"
#include "boost/filesystem.hpp" #include "boost/filesystem.hpp"
#include "pub_utility_api/FileUtil.h" #include "pub_utility_api/FileUtil.h"
#include "pub_utility_api/CharUtil.h" #include "pub_utility_api/CharUtil.h"
using namespace iot_public; using namespace kbd_public;
using namespace std; using namespace std;
CAlarmBaseData *CAlarmBaseData::pInstance = NULL; CAlarmBaseData *CAlarmBaseData::pInstance = NULL;
@ -100,8 +88,8 @@ CAlarmBaseData::CAlarmBaseData(QObject *parent) :
QObject(parent), QObject(parent),
m_rtdbAccess(Q_NULLPTR) m_rtdbAccess(Q_NULLPTR)
{ {
m_rtdbAccess = new iot_dbms::CRdbAccess(); m_rtdbAccess = new kbd_dbms::CRdbAccess();
m_pWriteDb = new iot_dbms::CDbApi(DB_CONN_MODEL_WRITE); m_pWriteDb = new kbd_dbms::CDbApi(DB_CONN_MODEL_WRITE);
m_pWriteDb->open(); m_pWriteDb->open();
createSysInfoInstance(m_ptrSysInfo); createSysInfoInstance(m_ptrSysInfo);
initData(); initData();
@ -109,7 +97,7 @@ CAlarmBaseData::CAlarmBaseData(QObject *parent) :
void CAlarmBaseData::loadPermInfo() void CAlarmBaseData::loadPermInfo()
{ {
iot_service::CPermMngApiPtr permMngPtr = iot_service::getPermMngInstance("base"); kbd_service::CPermMngApiPtr permMngPtr = kbd_service::getPermMngInstance("base");
m_listPermLocationId.clear(); m_listPermLocationId.clear();
m_listPermRegionId.clear(); m_listPermRegionId.clear();
if(permMngPtr != NULL) if(permMngPtr != NULL)
@ -151,7 +139,7 @@ int CAlarmBaseData::queryDomainIdByLocId(int loactionId)
if(m_ptrSysInfo) if(m_ptrSysInfo)
{ {
SLocationInfo stLocationInfo; SLocationInfo stLocationInfo;
if(iotSuccess == m_ptrSysInfo->getLocationInfoById(loactionId, stLocationInfo)) if(kbdSuccess == m_ptrSysInfo->getLocationInfoById(loactionId, stLocationInfo))
{ {
return stLocationInfo.nDomainId; return stLocationInfo.nDomainId;
} }
@ -166,12 +154,12 @@ bool CAlarmBaseData::queryAllPointDevGroup(int nDomainId, int nSubsystemId, cons
return false; return false;
} }
SAppInfo stAppInfo; SAppInfo stAppInfo;
if(iotSuccess != m_ptrSysInfo->getAppInfoBySubsystemId(nSubsystemId, stAppInfo)) if(kbdSuccess != m_ptrSysInfo->getAppInfoBySubsystemId(nSubsystemId, stAppInfo))
{ {
LOGERROR("queryAllPointDevGroup 获取应用ID失败"); LOGERROR("queryAllPointDevGroup 获取应用ID失败");
return false; return false;
} }
iot_dbms::CRdbNetApi rdbNetApi; kbd_dbms::CRdbNetApi rdbNetApi;
rdbNetApi.connect(nDomainId, stAppInfo.nId); rdbNetApi.connect(nDomainId, stAppInfo.nId);
//< 查询所有设备 //< 查询所有设备
@ -271,8 +259,8 @@ void CAlarmBaseData::loadPriorityDescription()
m_priorityDescriptionMap.clear(); m_priorityDescriptionMap.clear();
m_priorityOrderDescriptionMap.clear(); m_priorityOrderDescriptionMap.clear();
m_priorityPermDescriptionMap.clear(); m_priorityPermDescriptionMap.clear();
iot_dbms::CTableLockGuard locker(*m_rtdbAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
iot_dbms::CRdbQueryResult result; kbd_dbms::CRdbQueryResult result;
std::vector<std::string> columns; std::vector<std::string> columns;
columns.push_back("priority_id"); columns.push_back("priority_id");
columns.push_back("priority_order"); columns.push_back("priority_order");
@ -282,9 +270,9 @@ void CAlarmBaseData::loadPriorityDescription()
{ {
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++) for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
{ {
iot_dbms::CVarType key; kbd_dbms::CVarType key;
iot_dbms::CVarType order; kbd_dbms::CVarType order;
iot_dbms::CVarType value; kbd_dbms::CVarType value;
result.getColumnValue(nIndex, 0, key); result.getColumnValue(nIndex, 0, key);
result.getColumnValue(nIndex, 1, order); result.getColumnValue(nIndex, 1, order);
result.getColumnValue(nIndex, 2, value); result.getColumnValue(nIndex, 2, value);
@ -308,8 +296,8 @@ void CAlarmBaseData::loadLocationDescription()
m_locationDescriptionMap.clear(); m_locationDescriptionMap.clear();
m_locationPermDescriptionMap.clear(); m_locationPermDescriptionMap.clear();
m_listPermLocationOrder.clear(); m_listPermLocationOrder.clear();
iot_dbms::CTableLockGuard locker(*m_rtdbAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
iot_dbms::CRdbQueryResult result; kbd_dbms::CRdbQueryResult result;
std::vector<std::string> columns; std::vector<std::string> columns;
columns.push_back("location_id"); columns.push_back("location_id");
columns.push_back("description"); columns.push_back("description");
@ -322,11 +310,11 @@ void CAlarmBaseData::loadLocationDescription()
{ {
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++) for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
{ {
iot_dbms::CVarType id; kbd_dbms::CVarType id;
iot_dbms::CVarType desc; kbd_dbms::CVarType desc;
iot_dbms::CVarType tag; kbd_dbms::CVarType tag;
iot_dbms::CVarType type; kbd_dbms::CVarType type;
iot_dbms::CVarType pid; kbd_dbms::CVarType pid;
result.getColumnValue(nIndex, 0, id); result.getColumnValue(nIndex, 0, id);
result.getColumnValue(nIndex, 1, desc); result.getColumnValue(nIndex, 1, desc);
result.getColumnValue(nIndex, 2, tag); result.getColumnValue(nIndex, 2, tag);
@ -401,8 +389,8 @@ void CAlarmBaseData::loadRegionDescription()
{ {
m_regionDescriptionMap.clear(); m_regionDescriptionMap.clear();
m_regionPermDescriptionMap.clear(); m_regionPermDescriptionMap.clear();
iot_dbms::CTableLockGuard locker(*m_rtdbAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
iot_dbms::CRdbQueryResult result; kbd_dbms::CRdbQueryResult result;
std::vector<std::string> columns; std::vector<std::string> columns;
columns.push_back("region_id"); columns.push_back("region_id");
columns.push_back("description"); columns.push_back("description");
@ -411,8 +399,8 @@ void CAlarmBaseData::loadRegionDescription()
{ {
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++) for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
{ {
iot_dbms::CVarType key; kbd_dbms::CVarType key;
iot_dbms::CVarType value; kbd_dbms::CVarType value;
result.getColumnValue(nIndex, 0, key); result.getColumnValue(nIndex, 0, key);
result.getColumnValue(nIndex, 1, value); result.getColumnValue(nIndex, 1, value);
if(m_listPermRegionId.contains(key.toInt())) if(m_listPermRegionId.contains(key.toInt()))
@ -432,8 +420,8 @@ void CAlarmBaseData::loadAlarmTypeDescription()
if(m_rtdbAccess->open("base", "alarm_type_define")) if(m_rtdbAccess->open("base", "alarm_type_define"))
{ {
m_alarmTypeDescriptionMap.clear(); m_alarmTypeDescriptionMap.clear();
iot_dbms::CTableLockGuard locker(*m_rtdbAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
iot_dbms::CRdbQueryResult result; kbd_dbms::CRdbQueryResult result;
std::vector<std::string> columns; std::vector<std::string> columns;
columns.push_back("type_id"); columns.push_back("type_id");
columns.push_back("type_name"); columns.push_back("type_name");
@ -442,8 +430,8 @@ void CAlarmBaseData::loadAlarmTypeDescription()
{ {
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++) for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
{ {
iot_dbms::CVarType key; kbd_dbms::CVarType key;
iot_dbms::CVarType value; kbd_dbms::CVarType value;
result.getColumnValue(nIndex, 0, key); result.getColumnValue(nIndex, 0, key);
result.getColumnValue(nIndex, 1, value); result.getColumnValue(nIndex, 1, value);
m_alarmTypeDescriptionMap[key.toInt()] = QString::fromStdString(value.toStdString()); m_alarmTypeDescriptionMap[key.toInt()] = QString::fromStdString(value.toStdString());
@ -457,8 +445,8 @@ void CAlarmBaseData::loadAlarmStatusDescription()
if(m_rtdbAccess->open("base", "alarm_status_define")) if(m_rtdbAccess->open("base", "alarm_status_define"))
{ {
m_alarmStatusDescriptionMap.clear(); m_alarmStatusDescriptionMap.clear();
iot_dbms::CTableLockGuard locker(*m_rtdbAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
iot_dbms::CRdbQueryResult result; kbd_dbms::CRdbQueryResult result;
std::vector<std::string> columns; std::vector<std::string> columns;
columns.push_back("status_value"); columns.push_back("status_value");
columns.push_back("display_name"); columns.push_back("display_name");
@ -467,8 +455,8 @@ void CAlarmBaseData::loadAlarmStatusDescription()
{ {
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++) for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
{ {
iot_dbms::CVarType key; kbd_dbms::CVarType key;
iot_dbms::CVarType value; kbd_dbms::CVarType value;
result.getColumnValue(nIndex, 0, key); result.getColumnValue(nIndex, 0, key);
result.getColumnValue(nIndex, 1, value); result.getColumnValue(nIndex, 1, value);
m_alarmStatusDescriptionMap[key.toInt()] = QString::fromStdString(value.toStdString()); m_alarmStatusDescriptionMap[key.toInt()] = QString::fromStdString(value.toStdString());
@ -482,8 +470,8 @@ void CAlarmBaseData::loadDeviceTypeDescription()
if(m_rtdbAccess->open("base", "dev_type_def")) if(m_rtdbAccess->open("base", "dev_type_def"))
{ {
m_deviceTypeDescriptionMap.clear(); m_deviceTypeDescriptionMap.clear();
iot_dbms::CTableLockGuard locker(*m_rtdbAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
iot_dbms::CRdbQueryResult result; kbd_dbms::CRdbQueryResult result;
std::vector<std::string> columns; std::vector<std::string> columns;
columns.push_back("dev_type_id"); columns.push_back("dev_type_id");
columns.push_back("description"); columns.push_back("description");
@ -492,8 +480,8 @@ void CAlarmBaseData::loadDeviceTypeDescription()
{ {
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++) for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
{ {
iot_dbms::CVarType key; kbd_dbms::CVarType key;
iot_dbms::CVarType value; kbd_dbms::CVarType value;
result.getColumnValue(nIndex, 0, key); result.getColumnValue(nIndex, 0, key);
result.getColumnValue(nIndex, 1, value); result.getColumnValue(nIndex, 1, value);
m_deviceTypeDescriptionMap[key.toInt()] = QString::fromStdString(value.toStdString()); m_deviceTypeDescriptionMap[key.toInt()] = QString::fromStdString(value.toStdString());
@ -507,8 +495,8 @@ void CAlarmBaseData::loadDeviceGroupDescription()
if(m_rtdbAccess->open("base", "dev_group")) if(m_rtdbAccess->open("base", "dev_group"))
{ {
m_deviceGroupDescriptionMap.clear(); m_deviceGroupDescriptionMap.clear();
iot_dbms::CTableLockGuard locker(*m_rtdbAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
iot_dbms::CRdbQueryResult result; kbd_dbms::CRdbQueryResult result;
std::vector<std::string> columns; std::vector<std::string> columns;
columns.push_back("tag_name"); columns.push_back("tag_name");
columns.push_back("description"); columns.push_back("description");
@ -517,8 +505,8 @@ void CAlarmBaseData::loadDeviceGroupDescription()
{ {
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++) for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
{ {
iot_dbms::CVarType key; kbd_dbms::CVarType key;
iot_dbms::CVarType value; kbd_dbms::CVarType value;
result.getColumnValue(nIndex, 0, key); result.getColumnValue(nIndex, 0, key);
result.getColumnValue(nIndex, 1, value); result.getColumnValue(nIndex, 1, value);
m_deviceGroupDescriptionMap[QString::fromStdString(key.toStdString())] = QString::fromStdString(value.toStdString()); m_deviceGroupDescriptionMap[QString::fromStdString(key.toStdString())] = QString::fromStdString(value.toStdString());
@ -529,7 +517,7 @@ void CAlarmBaseData::loadDeviceGroupDescription()
void CAlarmBaseData::loadAlarmShowStatusDescription() 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; boost::property_tree::ptree pt;
namespace xml = boost::property_tree::xml_parser; namespace xml = boost::property_tree::xml_parser;
m_alarmShowStatusDescriptionMap.clear(); m_alarmShowStatusDescriptionMap.clear();
@ -565,7 +553,7 @@ void CAlarmBaseData::loadAlarmShowStatusDescription()
void CAlarmBaseData::loadAlarmOtherStatusDescription() 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; boost::property_tree::ptree pt;
namespace xml = boost::property_tree::xml_parser; namespace xml = boost::property_tree::xml_parser;
m_alarmOtherStatusDescriptionMap.clear(); 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.set_strtablename("dev_info");
msgQuery.add_strselectcolnamearr("tag_name"); msgQuery.add_strselectcolnamearr("tag_name");
iot_idl::RdbCondition *pCondtion = msgQuery.add_msgcondition(); kbd_idlfile::RdbCondition *pCondtion = msgQuery.add_msgcondition();
pCondtion->set_enlogic(iot_idl::ENConditionLogic::enumCondAnd); pCondtion->set_enlogic(kbd_idlfile::ENConditionLogic::enumCondAnd);
pCondtion->set_enrelation(iot_idl::ENConditionRelation::enumCondEqual); pCondtion->set_enrelation(kbd_idlfile::ENConditionRelation::enumCondEqual);
pCondtion->set_strcolumnname("group_tag_name"); pCondtion->set_strcolumnname("group_tag_name");
iot_idl::SVariable *pCondValue = pCondtion->mutable_msgvalue(); kbd_idlfile::SVariable *pCondValue = pCondtion->mutable_msgvalue();
pCondValue->set_edatatype(iot_idl::DataType::CN_DATATYPE_STRING); pCondValue->set_edatatype(kbd_idlfile::DataType::CN_DATATYPE_STRING);
pCondValue->set_strvalue(devg.toStdString()); pCondValue->set_strvalue(devg.toStdString());
iot_idl::RdbRet retMsg; kbd_idlfile::RdbRet retMsg;
bool bRet; bool bRet;
bRet = rdbNetApi.query(msgQuery, retMsg); bRet = rdbNetApi.query(msgQuery, retMsg);
if (false == bRet) if (false == bRet)
@ -631,20 +619,20 @@ bool CAlarmBaseData::queryAllDeviceDevGroup(iot_dbms::CRdbNetApi &rdbNetApi, con
return true; 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.set_strtablename(table.toStdString().c_str());
msgQuery.add_strselectcolnamearr("tag_name"); msgQuery.add_strselectcolnamearr("tag_name");
iot_idl::RdbCondition *pCondtion = msgQuery.add_msgcondition(); kbd_idlfile::RdbCondition *pCondtion = msgQuery.add_msgcondition();
pCondtion->set_enlogic(iot_idl::ENConditionLogic::enumCondAnd); pCondtion->set_enlogic(kbd_idlfile::ENConditionLogic::enumCondAnd);
pCondtion->set_enrelation(iot_idl::ENConditionRelation::enumCondEqual); pCondtion->set_enrelation(kbd_idlfile::ENConditionRelation::enumCondEqual);
pCondtion->set_strcolumnname("device"); pCondtion->set_strcolumnname("device");
iot_idl::SVariable *pCondValue = pCondtion->mutable_msgvalue(); kbd_idlfile::SVariable *pCondValue = pCondtion->mutable_msgvalue();
pCondValue->set_edatatype(iot_idl::DataType::CN_DATATYPE_STRING); pCondValue->set_edatatype(kbd_idlfile::DataType::CN_DATATYPE_STRING);
pCondValue->set_strvalue(device.toStdString().c_str()); pCondValue->set_strvalue(device.toStdString().c_str());
iot_idl::RdbRet retMsg; kbd_idlfile::RdbRet retMsg;
bool bRet; bool bRet;
bRet = rdbNetApi.query(msgQuery, retMsg); bRet = rdbNetApi.query(msgQuery, retMsg);
if (false == bRet) if (false == bRet)

View File

@ -154,7 +154,7 @@ private:
* @param rdbNetApi * @param rdbNetApi
* @param devg * @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 * @brief queryAllPointDevice
* @param rdbNetApi * @param rdbNetApi
@ -163,13 +163,13 @@ private:
* @param pointList "digital.station.G01_dlq.r.value" * @param pointList "digital.station.G01_dlq.r.value"
* @return * @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: private:
static CAlarmBaseData * pInstance; static CAlarmBaseData * pInstance;
iot_dbms::CRdbAccess * m_rtdbAccess; kbd_dbms::CRdbAccess * m_rtdbAccess;
iot_dbms::CDbApi *m_pWriteDb; kbd_dbms::CDbApi *m_pWriteDb;
iot_public::CSysInfoInterfacePtr m_ptrSysInfo; kbd_public::CSysInfoInterfacePtr m_ptrSysInfo;
QList<int> m_listPermLocationId; //< 原始告警车站权限 QList<int> m_listPermLocationId; //< 原始告警车站权限
QList<int> m_listPermRegionId; //< 原始告警责任区权限 QList<int> m_listPermRegionId; //< 原始告警责任区权限
QList<int> m_listPermLocationOrder; //< 有权限的loaction_id: 按location_no排序 QList<int> m_listPermLocationOrder; //< 有权限的loaction_id: 按location_no排序

View File

@ -6,8 +6,8 @@
#include "CAiAlarmDataCollect.h" #include "CAiAlarmDataCollect.h"
#include "alarm_server_api/AlarmCommonDef.h" #include "alarm_server_api/AlarmCommonDef.h"
using namespace iot_service; using namespace kbd_service;
using namespace iot_dbms; using namespace kbd_dbms;
CAlarmDataCollect * CAlarmDataCollect::m_pInstance = NULL; CAlarmDataCollect * CAlarmDataCollect::m_pInstance = NULL;
CAlarmDataCollect::CAlarmDataCollect() CAlarmDataCollect::CAlarmDataCollect()
@ -20,7 +20,7 @@ CAlarmDataCollect::CAlarmDataCollect()
m_removeNum(0) m_removeNum(0)
{ {
m_rtdbMutex = new QMutex(); m_rtdbMutex = new QMutex();
m_rtdbAccess = new iot_dbms::CRdbAccess(); m_rtdbAccess = new kbd_dbms::CRdbAccess();
m_rtdbAccess->open("base", "alarm_level_define"); m_rtdbAccess->open("base", "alarm_level_define");
} }
@ -138,17 +138,17 @@ void CAlarmDataCollect::slotSwitchFaultRecallState(bool bFaultRecallState)
emit sigAlarmOperateEnable(!m_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) if(!m_referenceCount)
{ {
@ -165,7 +165,7 @@ void CAlarmDataCollect::handleAllAlmMsg(int domainId, iot_idl::SAlmCltAddAlm &ob
QList<AlarmMsgPtr> almList; QList<AlarmMsgPtr> almList;
for(int nAddMsgIndex(0); nAddMsgIndex < nAlarmCount; nAddMsgIndex++) 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()); AlarmMsgPtr alm(new CAlarmMsgInfo());
alm->initialize(msg); alm->initialize(msg);
alm->priorityOrder = queryPriorityOrder(alm->priority); 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) if(!m_referenceCount)
{ {
@ -207,7 +207,7 @@ void CAlarmDataCollect::handleAddAlmMsg(iot_idl::SAlmCltAddAlm &objAddAlm)
QList<AlarmMsgPtr> almList; QList<AlarmMsgPtr> almList;
for(int nAddMsgIndex(0); nAddMsgIndex < nAlarmCount; nAddMsgIndex++) 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()); AlarmMsgPtr alm(new CAlarmMsgInfo());
alm->initialize(msg); alm->initialize(msg);
alm->priorityOrder = queryPriorityOrder(alm->priority); alm->priorityOrder = queryPriorityOrder(alm->priority);
@ -227,7 +227,7 @@ void CAlarmDataCollect::handleAddAlmMsg(iot_idl::SAlmCltAddAlm &objAddAlm)
LOGINFO("handleAddAlmMsg END[%d] ",nAlarmCount); LOGINFO("handleAddAlmMsg END[%d] ",nAlarmCount);
} }
void CAlarmDataCollect::handleCfmAlmMsg(iot_idl::SAlmCltCfmAlm &objCfmAlm) void CAlarmDataCollect::handleCfmAlmMsg(kbd_idlfile::SAlmCltCfmAlm &objCfmAlm)
{ {
if(!m_referenceCount) if(!m_referenceCount)
{ {
@ -247,7 +247,7 @@ void CAlarmDataCollect::handleCfmAlmMsg(iot_idl::SAlmCltCfmAlm &objCfmAlm)
LOGINFO("handleCfmAlmMsg END[%d] ",nAlarmCount); LOGINFO("handleCfmAlmMsg END[%d] ",nAlarmCount);
} }
void CAlarmDataCollect::handleDelAlmMsg(iot_idl::SAlmCltDelAlm &objDelAlm) void CAlarmDataCollect::handleDelAlmMsg(kbd_idlfile::SAlmCltDelAlm &objDelAlm)
{ {
if(!m_referenceCount) if(!m_referenceCount)
{ {
@ -269,7 +269,7 @@ void CAlarmDataCollect::handleDelAlmMsg(iot_idl::SAlmCltDelAlm &objDelAlm)
LOGINFO("handleDelAlmMsg END[%d] ",nAlarmCount); LOGINFO("handleDelAlmMsg END[%d] ",nAlarmCount);
} }
void CAlarmDataCollect::handleReleaseAlmMsg(iot_idl::SAlmCltReleaseAlm &objRelAlm) void CAlarmDataCollect::handleReleaseAlmMsg(kbd_idlfile::SAlmCltReleaseAlm &objRelAlm)
{ {
if(!m_referenceCount) if(!m_referenceCount)
{ {
@ -291,7 +291,7 @@ void CAlarmDataCollect::handleReleaseAlmMsg(iot_idl::SAlmCltReleaseAlm &objRelAl
LOGINFO("handleReleaseAlmMsg END[%d] ",nAlarmCount); LOGINFO("handleReleaseAlmMsg END[%d] ",nAlarmCount);
} }
void CAlarmDataCollect::handleLinkWave2AlmMsg(iot_idl::SAlmCltLinkWave2Alm &objWave2Alm) void CAlarmDataCollect::handleLinkWave2AlmMsg(kbd_idlfile::SAlmCltLinkWave2Alm &objWave2Alm)
{ {
if(!m_referenceCount) if(!m_referenceCount)
{ {
@ -341,16 +341,16 @@ void CAlarmDataCollect::slotAlarmStateChanged()
int CAlarmDataCollect::queryPriorityOrder(int &id) int CAlarmDataCollect::queryPriorityOrder(int &id)
{ {
iot_dbms::CTableLockGuard locker(*m_rtdbAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
iot_dbms::CVarType value = -1000; kbd_dbms::CVarType value = -1000;
m_rtdbAccess->getColumnValueByKey((void*)&id, "priority_order", value); m_rtdbAccess->getColumnValueByKey((void*)&id, "priority_order", value);
return value.toInt(); return value.toInt();
} }
int CAlarmDataCollect::queryAlarmAction(const int &priority) int CAlarmDataCollect::queryAlarmAction(const int &priority)
{ {
iot_dbms::CTableLockGuard locker(*m_rtdbAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
iot_dbms::CVarType value; kbd_dbms::CVarType value;
m_rtdbAccess->getColumnValueByKey((void*)&priority, "alarm_actions",value); m_rtdbAccess->getColumnValueByKey((void*)&priority, "alarm_actions",value);
return value.toInt(); return value.toInt();
} }

View File

@ -11,7 +11,7 @@
#include "net_msg_bus_api/MsgBusApi.h" #include "net_msg_bus_api/MsgBusApi.h"
#include "dbms/rdb_api/CRdbAccess.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 Q_OBJECT
public: public:
@ -25,21 +25,21 @@ public:
bool isFaultRecallState(); 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(); void refresh();
signals: signals:
@ -95,9 +95,9 @@ private:
bool m_bFaultRecallState; //是否处于事故追忆 bool m_bFaultRecallState; //是否处于事故追忆
QMutex * m_rtdbMutex; QMutex * m_rtdbMutex;
QTimer * m_pAlternateTimer; QTimer * m_pAlternateTimer;
iot_dbms::CRdbAccess * m_rtdbAccess; kbd_dbms::CRdbAccess * m_rtdbAccess;
iot_dbms::CRdbAccess * m_rtdbAlmLvlDefTab; // 告警等级定义表 kbd_dbms::CRdbAccess * m_rtdbAlmLvlDefTab; // 告警等级定义表
iot_dbms::CRdbAccess * m_rtdbAlmActDefTab; // 告警动作定义表 kbd_dbms::CRdbAccess * m_rtdbAlmActDefTab; // 告警动作定义表
bool m_bIsNeedUpdate; //< 是否消息确认(每秒更新) bool m_bIsNeedUpdate; //< 是否消息确认(每秒更新)
bool m_bIsNeedRemove; //< 是否需要删除(每秒更新) bool m_bIsNeedRemove; //< 是否需要删除(每秒更新)
bool m_bIsNeedRelease; //< 是否需要释放(每秒更新)- bool m_bIsNeedRelease; //< 是否需要释放(每秒更新)-

View File

@ -269,8 +269,8 @@ bool CAlarmDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const
wave = QString("%1%2%3").arg("\"").arg(wave).arg("\""); wave = QString("%1%2%3").arg("\"").arg(wave).arg("\"");
LOGINFO("录波文件为:%s",wave.toStdString().c_str()); LOGINFO("录波文件为:%s",wave.toStdString().c_str());
const std::string strProc = std::move(iot_public::CFileUtil::getPathOfBinFile( const std::string strProc = std::move(kbd_public::CFileUtil::getPathOfBinFile(
std::string("WaveAnalyze") + iot_public::CFileUtil::getProcSuffix())); std::string("WaveAnalyze") + kbd_public::CFileUtil::getProcSuffix()));
if(strProc.empty()) if(strProc.empty())
LOGERROR("未找到可执行文件WaveAnalyze"); LOGERROR("未找到可执行文件WaveAnalyze");
else else
@ -300,8 +300,8 @@ void CAlarmDelegate::slotLoadConfig()
m_isFlash = false; m_isFlash = false;
} }
std::string style = iot_public::CFileStyle::getCurStyle(); std::string style = kbd_public::CFileStyle::getCurStyle();
m_strTrendPath = iot_public::CFileUtil::getPathOfResFile("gui/icon/alarm/trend_"+style+".png").c_str(); m_strTrendPath = kbd_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_strVideoPath = kbd_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(); m_strWavePath = kbd_public::CFileUtil::getPathOfResFile("gui/icon/alarm/wave_"+style+".png").c_str();
} }

View File

@ -37,20 +37,6 @@ void CAlarmDeviceTreeModel::setupModelData(const QMap<int, QVector<SDevGroupInfo
QModelIndex modelIndex = createIndex(nDevIndex, 0, device); QModelIndex modelIndex = createIndex(nDevIndex, 0, device);
m_devTagIndex.insert(vec.at(nDevIndex).tag_name, modelIndex); m_devTagIndex.insert(vec.at(nDevIndex).tag_name, modelIndex);
m_devNameIndex.insert(locDesc + "." + vec.at(nDevIndex).description, 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,11 +160,9 @@ QVariant CAlarmDeviceTreeModel::data(const QModelIndex &index, int role) const
if (Qt::DisplayRole == role) if (Qt::DisplayRole == role)
{ {
const QString &deviceGroup = item->data(Qt::ItemDataRole(TagRole)).toString(); const QString &deviceGroup = item->data(Qt::ItemDataRole(TagRole)).toString();
int nType = item->data(Qt::ItemDataRole(TypeRole)).toInt(); if(deviceGroup.isEmpty())
if(deviceGroup.isEmpty() && nType == TYPE_LOCATION)
{ {
//区域后面不加数量 return item->data(Qt::DisplayRole).toString();
return item->data(Qt::DisplayRole).toString();
} }
return item->data(Qt::DisplayRole).toString() + QString(" [%1]").arg(m_alarmDeviceGroupStatistical.value(deviceGroup,0)); return item->data(Qt::DisplayRole).toString() + QString(" [%1]").arg(m_alarmDeviceGroupStatistical.value(deviceGroup,0));
} }

View File

@ -10,7 +10,6 @@ CAlarmDeviceTreeView::CAlarmDeviceTreeView(QWidget *parent)
} }
/*
void CAlarmDeviceTreeView::contextMenuEvent(QContextMenuEvent *event) void CAlarmDeviceTreeView::contextMenuEvent(QContextMenuEvent *event)
{ {
CAlarmDeviceTreeModel * pModel = dynamic_cast<CAlarmDeviceTreeModel *>(model()); CAlarmDeviceTreeModel * pModel = dynamic_cast<CAlarmDeviceTreeModel *>(model());
@ -34,26 +33,25 @@ void CAlarmDeviceTreeView::contextMenuEvent(QContextMenuEvent *event)
} }
return; return;
} }
*/
void CAlarmDeviceTreeView::contextMenuEvent(QContextMenuEvent *event) //void CAlarmDeviceTreeView::contextMenuEvent(QContextMenuEvent *event)
{ //{
CAlarmDeviceTreeModel * pModel = dynamic_cast<CAlarmDeviceTreeModel *>(model()); // CAlarmDeviceTreeModel * pModel = dynamic_cast<CAlarmDeviceTreeModel *>(model());
if(Q_NULLPTR != pModel) // if(Q_NULLPTR != pModel)
{ // {
QMenu menu; // QMenu menu;
CAlarmDeviceTreeItem * pItem = static_cast<CAlarmDeviceTreeItem*>(indexAt(event->pos()).internalPointer()); // CAlarmDeviceTreeItem * pItem = static_cast<CAlarmDeviceTreeItem*>(indexAt(event->pos()).internalPointer());
if (Q_NULLPTR == pItem) // if (Q_NULLPTR == pItem)
{ // {
menu.addAction(tr("全选"), [=](){ pModel->setAllDeviceCheckState(Qt::Checked); }); // menu.addAction(tr("全选"), [=](){ pModel->setAllDeviceCheckState(Qt::Checked); });
menu.addAction(tr("清空"), [=](){ pModel->setAllDeviceCheckState(Qt::Unchecked); }); // menu.addAction(tr("清空"), [=](){ pModel->setAllDeviceCheckState(Qt::Unchecked); });
} // }
else if (Q_NULLPTR != pItem && pItem->childCount() > 0) // 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::Checked); });
menu.addAction(tr("清除"), [=](){ pModel->setDeviceCheckState(indexAt(event->pos()), Qt::Unchecked); }); // menu.addAction(tr("清除"), [=](){ pModel->setDeviceCheckState(indexAt(event->pos()), Qt::Unchecked); });
} // }
menu.exec(event->globalPos()); // menu.exec(event->globalPos());
} // }
return; // return;
} //}

View File

@ -41,7 +41,7 @@ CAlarmFilterDialog::CAlarmFilterDialog(QWidget *parent) :
ui->setupUi(this); ui->setupUi(this);
setObjectName("alarm_dialog"); setObjectName("alarm_dialog");
QString qss = QString(); 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)); QFile qssfile1(QString::fromStdString(strFullPath));
qssfile1.open(QFile::ReadOnly); qssfile1.open(QFile::ReadOnly);
if (qssfile1.isOpen()) if (qssfile1.isOpen())
@ -49,7 +49,7 @@ CAlarmFilterDialog::CAlarmFilterDialog(QWidget *parent) :
qss += QLatin1String(qssfile1.readAll()); qss += QLatin1String(qssfile1.readAll());
qssfile1.close(); qssfile1.close();
} }
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("alarm.qss") ; strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("alarm.qss") ;
QFile qssfile2(QString::fromStdString(strFullPath)); QFile qssfile2(QString::fromStdString(strFullPath));
qssfile2.open(QFile::ReadOnly); qssfile2.open(QFile::ReadOnly);
if (qssfile2.isOpen()) if (qssfile2.isOpen())
@ -84,7 +84,7 @@ CAlarmFilterDialog::~CAlarmFilterDialog()
void CAlarmFilterDialog::initialize() void CAlarmFilterDialog::initialize()
{ {
m_rtdbAccess = new iot_dbms::CRdbAccess(); m_rtdbAccess = new kbd_dbms::CRdbAccess();
ui->level->setSelectionMode(QAbstractItemView::MultiSelection); ui->level->setSelectionMode(QAbstractItemView::MultiSelection);
//ui->location->setSelectionMode(QAbstractItemView::MultiSelection); //ui->location->setSelectionMode(QAbstractItemView::MultiSelection);
@ -161,12 +161,12 @@ void CAlarmFilterDialog::initialize()
ui->status->addItem(value); ui->status->addItem(value);
} }
iot_public::CSysInfoInterfacePtr spSysInfo; kbd_public::CSysInfoInterfacePtr spSysInfo;
if (iot_public::createSysInfoInstance(spSysInfo)) if (kbd_public::createSysInfoInstance(spSysInfo))
{ {
std::vector<iot_public::SSubsystemInfo> vecSubsystemInfo; std::vector<kbd_public::SSubsystemInfo> vecSubsystemInfo;
spSysInfo->getAllSubsystemInfo(vecSubsystemInfo); spSysInfo->getAllSubsystemInfo(vecSubsystemInfo);
foreach (iot_public::SSubsystemInfo info, vecSubsystemInfo) foreach (kbd_public::SSubsystemInfo info, vecSubsystemInfo)
{ {
if(info.nId <= CN_AppId_COMAPP) if(info.nId <= CN_AppId_COMAPP)
{ {
@ -717,12 +717,12 @@ void CAlarmFilterDialog::slot_updateCheckStatusState()
void CAlarmFilterDialog::slot_updateDevice(const QString &subSystem) void CAlarmFilterDialog::slot_updateDevice(const QString &subSystem)
{ {
int nSubSystemId = -1; int nSubSystemId = -1;
iot_public::CSysInfoInterfacePtr spSysInfo; kbd_public::CSysInfoInterfacePtr spSysInfo;
if (iot_public::createSysInfoInstance(spSysInfo)) if (kbd_public::createSysInfoInstance(spSysInfo))
{ {
std::vector<iot_public::SSubsystemInfo> vecSubsystemInfo; std::vector<kbd_public::SSubsystemInfo> vecSubsystemInfo;
spSysInfo->getAllSubsystemInfo(vecSubsystemInfo); spSysInfo->getAllSubsystemInfo(vecSubsystemInfo);
foreach (iot_public::SSubsystemInfo info, vecSubsystemInfo) foreach (kbd_public::SSubsystemInfo info, vecSubsystemInfo)
{ {
if(subSystem.toStdString() == info.strDesc) if(subSystem.toStdString() == info.strDesc)
{ {
@ -733,34 +733,34 @@ void CAlarmFilterDialog::slot_updateDevice(const QString &subSystem)
ui->deviceType->clear(); ui->deviceType->clear();
QList<iot_dbms::CVarType> values; QList<kbd_dbms::CVarType> values;
if(nSubSystemId != -1) if(nSubSystemId != -1)
{ {
iot_dbms::CVarType subSystemId = nSubSystemId; kbd_dbms::CVarType subSystemId = nSubSystemId;
if(m_rtdbAccess->open("base", "dev_type_def")) if(m_rtdbAccess->open("base", "dev_type_def"))
{ {
iot_dbms::CTableLockGuard locker(*m_rtdbAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbAccess);
iot_dbms::CONDINFO condition; kbd_dbms::CONDINFO condition;
condition.relationop = ATTRCOND_EQU; condition.relationop = ATTRCOND_EQU;
memcpy(condition.name, "sub_system", strlen("sub_system") ); memcpy(condition.name, "sub_system", strlen("sub_system") );
condition.conditionval = subSystemId; condition.conditionval = subSystemId;
std::vector<std::string> columns; std::vector<std::string> columns;
columns.push_back("description"); columns.push_back("description");
iot_dbms::CRdbQueryResult result; kbd_dbms::CRdbQueryResult result;
if(m_rtdbAccess->select(condition, result, columns)) if(m_rtdbAccess->select(condition, result, columns))
{ {
for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++) for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
{ {
iot_dbms::CVarType value; kbd_dbms::CVarType value;
result.getColumnValue(nIndex, 0, value); result.getColumnValue(nIndex, 0, value);
values.append(value); values.append(value);
} }
} }
} }
} }
foreach (iot_dbms::CVarType value, values) foreach (kbd_dbms::CVarType value, values)
{ {
ui->deviceType->addItem(value.c_str()); ui->deviceType->addItem(value.c_str());
} }

View File

@ -102,7 +102,7 @@ private:
private: private:
Ui::CAlarmFilterDialog *ui; Ui::CAlarmFilterDialog *ui;
iot_dbms::CRdbAccess * m_rtdbAccess; kbd_dbms::CRdbAccess * m_rtdbAccess;
QMap<int, QString> m_priorityMap; QMap<int, QString> m_priorityMap;
QMap<int, QString> m_locationMap; QMap<int, QString> m_locationMap;
QMap<int, QString> m_regionMap; QMap<int, QString> m_regionMap;

View File

@ -6,13 +6,13 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1000</width> <width>657</width>
<height>546</height> <height>510</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>1000</width> <width>530</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>

View File

@ -38,7 +38,6 @@
#include "CAlarmBaseData.h" #include "CAlarmBaseData.h"
#include "CAlarmShiledDialog.h" #include "CAlarmShiledDialog.h"
#include "CAccidentReviewDialog.h" #include "CAccidentReviewDialog.h"
#include "pub_utility_api/FileStyle.h"
CAlarmForm::CAlarmForm(QWidget *parent) : CAlarmForm::CAlarmForm(QWidget *parent) :
QWidget(parent), QWidget(parent),
m_ptrSysInfo(Q_NULLPTR), m_ptrSysInfo(Q_NULLPTR),
@ -54,7 +53,7 @@ CAlarmForm::CAlarmForm(QWidget *parent) :
m_isNeedAccidentReview(true), m_isNeedAccidentReview(true),
m_strAccidenPath(QString()) m_strAccidenPath(QString())
{ {
m_communicator = new iot_net::CMbCommunicator(); m_communicator = new kbd_net::CMbCommunicator();
qRegisterMetaType<QItemSelection>("QItemSelection"); qRegisterMetaType<QItemSelection>("QItemSelection");
qRegisterMetaType< QList<QVector<QString> > >("QList<QVector<QString> >"); qRegisterMetaType< QList<QVector<QString> > >("QList<QVector<QString> >");
qRegisterMetaType<QVector<bool> >("QVector<bool>"); qRegisterMetaType<QVector<bool> >("QVector<bool>");
@ -64,7 +63,7 @@ CAlarmForm::CAlarmForm(QWidget *parent) :
ui->alarmView->setObjectName("alarmView"); ui->alarmView->setObjectName("alarmView");
ui->splitter->setStretchFactor(0,1); ui->splitter->setStretchFactor(0,1);
ui->splitter->setStretchFactor(1,6); ui->splitter->setStretchFactor(1,6);
initStyle();
QHBoxLayout * pHBoxLayout = new QHBoxLayout(ui->deviceView->header()); QHBoxLayout * pHBoxLayout = new QHBoxLayout(ui->deviceView->header());
m_pSearchTextEdit = new QLineEdit(ui->deviceView->header()); m_pSearchTextEdit = new QLineEdit(ui->deviceView->header());
m_pSearchTextEdit->setObjectName("searchTextEdit"); m_pSearchTextEdit->setObjectName("searchTextEdit");
@ -133,24 +132,6 @@ CAlarmForm::CAlarmForm(QWidget *parent) :
m_thread->start(); 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() CAlarmForm::~CAlarmForm()
{ {
if(m_communicator != Q_NULLPTR) if(m_communicator != Q_NULLPTR)
@ -195,13 +176,13 @@ CAlarmForm::~CAlarmForm()
void CAlarmForm::initialize() void CAlarmForm::initialize()
{ {
if (!iot_public::createSysInfoInstance(m_ptrSysInfo)) if (!kbd_public::createSysInfoInstance(m_ptrSysInfo))
{ {
LOGERROR("创建系统信息访问库实例失败!"); LOGERROR("创建系统信息访问库实例失败!");
} }
if(m_pReadDb == NULL) 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()) if(!m_pReadDb->open())
{ {
LOGERROR("数据库打开失败,%s",m_pReadDb->getLastErrorString().toStdString().c_str()); LOGERROR("数据库打开失败,%s",m_pReadDb->getLastErrorString().toStdString().c_str());
@ -226,7 +207,7 @@ void CAlarmForm::initialize()
//< lingdaoyaoqiu //< lingdaoyaoqiu
{ {
QSettings columFlags("IOT_HMI", "alarm config"); QSettings columFlags("KBD_HMI", "alarm config");
if(!columFlags.contains(QString("alarm/colum_0"))) if(!columFlags.contains(QString("alarm/colum_0")))
{ {
columFlags.setValue(QString("alarm/colum_0"), false); //< 时间 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_3"), true); //< 责任区
columFlags.setValue(QString("alarm/colum_4"), true); //< 告警类型 columFlags.setValue(QString("alarm/colum_4"), true); //< 告警类型
columFlags.setValue(QString("alarm/colum_5"), false); //< 告警状态 columFlags.setValue(QString("alarm/colum_5"), false); //< 告警状态
columFlags.setValue(QString("alarm/colum_6"), true); //< 确认状态 columFlags.setValue(QString("alarm/colum_6"), false); //< 确认状态
columFlags.setValue(QString("alarm/colum_7"), true); //< columFlags.setValue(QString("alarm/colum_7"), false); //<
} }
} }
ui->comboBox->setModel(m_pListWidget1->model()); ui->comboBox->setModel(m_pListWidget1->model());
@ -274,7 +255,7 @@ void CAlarmForm::updateAlarmOperatePerm()
m_listLocationOptId.clear(); m_listLocationOptId.clear();
m_listRegionDelId.clear(); m_listRegionDelId.clear();
m_listLocationDelId.clear(); m_listLocationDelId.clear();
iot_public::SNodeInfo stNodeInfo; kbd_public::SNodeInfo stNodeInfo;
if (!m_ptrSysInfo) if (!m_ptrSysInfo)
{ {
if(!createSysInfoInstance(m_ptrSysInfo)) if(!createSysInfoInstance(m_ptrSysInfo))
@ -287,7 +268,7 @@ void CAlarmForm::updateAlarmOperatePerm()
m_nodeName = stNodeInfo.strName; m_nodeName = stNodeInfo.strName;
m_nDomainId = stNodeInfo.nDomainId; m_nDomainId = stNodeInfo.nDomainId;
iot_service::CPermMngApiPtr permMngPtr = iot_service::getPermMngInstance("base"); kbd_service::CPermMngApiPtr permMngPtr = kbd_service::getPermMngInstance("base");
if(permMngPtr != NULL) if(permMngPtr != NULL)
{ {
permMngPtr->PermDllInit(); 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->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->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->confirm->setEnabled(true);
ui->remove->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(5, 150);
ui->alarmView->setColumnWidth(6, 120); 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++) for(int nColumnIndex(0); nColumnIndex < m_pModel->columnCount() - 1; nColumnIndex++)
{ {
bool visible = columFlags.value(QString("alarm/colum_%1").arg(nColumnIndex)).toBool(); 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); 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++) for(int nColumnIndex(0); nColumnIndex < m_pModel->columnCount() - 1; nColumnIndex++)
{ {
bool visible = columFlags.value(QString("alarm/colum_%1").arg(nColumnIndex)).toBool(); 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::itemCheckStateChanged, this, &CAlarmForm::deviceGroupFilterChanged);
connect(m_pDeviceModel, &CAlarmDeviceTreeModel::inhibitDevGroupAlm, this, &CAlarmForm::slotInhibitDevGroupAlm); connect(m_pDeviceModel, &CAlarmDeviceTreeModel::inhibitDevGroupAlm, this, &CAlarmForm::slotInhibitDevGroupAlm);
connect(CAlarmDataCollect::instance(),&CAlarmDataCollect::sigDevTreeUpdate,m_pDeviceModel,&CAlarmDeviceTreeModel::slotDevTreeUpdate);
} }
initFilter(); initFilter();
} }
@ -1358,7 +1337,7 @@ void CAlarmForm::contextMenuStack0Event(QContextMenuEvent *event)
connect(action, &QAction::triggered, [=](){ connect(action, &QAction::triggered, [=](){
ui->alarmView->setColumnHidden(nColumnIndex, !action->isChecked()); ui->alarmView->setColumnHidden(nColumnIndex, !action->isChecked());
ui->aiAlarmTreeView->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()); columFlags.setValue(QString("alarm/colum_%1").arg(nColumnIndex), !action->isChecked());
}); });
} }
@ -1481,7 +1460,7 @@ void CAlarmForm::contextMenuStack1Event(QContextMenuEvent *event)
connect(action, &QAction::triggered, [=](){ connect(action, &QAction::triggered, [=](){
ui->alarmView->setColumnHidden(nColumnIndex, !action->isChecked()); ui->alarmView->setColumnHidden(nColumnIndex, !action->isChecked());
ui->aiAlarmTreeView->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()); columFlags.setValue(QString("alarm/colum_%1").arg(nColumnIndex), !action->isChecked());
}); });
} }
@ -1659,7 +1638,7 @@ void CAlarmForm::removeAlarm0()
} }
QList<AlarmMsgPtr> listInfo = m_pModel->getListShowAlarmInfo(); QList<AlarmMsgPtr> listInfo = m_pModel->getListShowAlarmInfo();
//声明告警删除package //声明告警删除package
QMap<int, iot_idl::SAlmCltDelAlm *> pkgMap; //Domain-DelPkg; QMap<int, kbd_idlfile::SAlmCltDelAlm *> pkgMap; //Domain-DelPkg;
int permSkip = -1; //< 不具备确认权限时是否跳过: 0-单步跳过、1-全部跳过 int permSkip = -1; //< 不具备确认权限时是否跳过: 0-单步跳过、1-全部跳过
int unConfirmSkip = -1; //< 未确认告警是否跳过: 0-单步跳过、1-全部跳过 int unConfirmSkip = -1; //< 未确认告警是否跳过: 0-单步跳过、1-全部跳过
@ -1755,17 +1734,17 @@ void CAlarmForm::removeAlarm0()
} }
//构建告警删除package //构建告警删除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()) 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); pkg->set_domain_id(info->domain_id);
pkgMap[info->domain_id] = pkg; pkgMap[info->domain_id] = pkg;
} }
pkgMap.value(info->domain_id)->add_uuid_base64(info->uuid_base64.toStdString()); 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) if(CAlarmDataCollect::instance()->requestDelAlm(*pkg)!= true)
{ {
@ -1792,8 +1771,8 @@ void CAlarmForm::removeAlarm1()
QList<AiAlarmMsgPtr> aimsgList; //选中的智能告警 QList<AiAlarmMsgPtr> aimsgList; //选中的智能告警
QList<AlarmMsgPtr> msgList; //选中的原始告警 QList<AlarmMsgPtr> msgList; //选中的原始告警
//声明智能告警删除package //声明智能告警删除package
QMap<int, iot_idl::SIntelliAlmDel *> aipkgMap; //Domain-DelPkg; ai QMap<int, kbd_idlfile::SIntelliAlmDel *> aipkgMap; //Domain-DelPkg; ai
QMap<int, iot_idl::SAlmCltDelAlm *> pkgMap; //Domain-DelPkg; alarm QMap<int, kbd_idlfile::SAlmCltDelAlm *> pkgMap; //Domain-DelPkg; alarm
int permSkip = -1; //< 不具备确认权限时是否跳过: 0-单步跳过、1-全部跳过 int permSkip = -1; //< 不具备确认权限时是否跳过: 0-单步跳过、1-全部跳过
int unConfirmSkip = -1; //< 未确认告警是否跳过: 0-单步跳过、1-全部跳过 int unConfirmSkip = -1; //< 未确认告警是否跳过: 0-单步跳过、1-全部跳过
QModelIndexList::iterator modelIndexIter = modelIndexList.begin(); QModelIndexList::iterator modelIndexIter = modelIndexList.begin();
@ -1916,10 +1895,10 @@ void CAlarmForm::removeAlarm1()
} }
} }
//构建告警删除package //构建告警删除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()) 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); pkg->set_domain_id(info->domain_id);
pkgMap[info->domain_id] = pkg; pkgMap[info->domain_id] = pkg;
} }
@ -2012,17 +1991,17 @@ void CAlarmForm::removeAlarm1()
} }
int domain_id = aimsgList.at(aialarm)->domain_id; int domain_id = aimsgList.at(aialarm)->domain_id;
QString aiuuid = aimsgList.at(aialarm)->uuid_base64; 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()) 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); pkg->set_domain_id(domain_id);
aipkgMap[domain_id] = pkg; aipkgMap[domain_id] = pkg;
} }
aipkgMap.value(domain_id)->add_uuid_base64(aiuuid.toStdString()); 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) if(CAlarmDataCollect::instance()->requestDelAlm(*pkg)!= true)
{ {
@ -2032,7 +2011,7 @@ void CAlarmForm::removeAlarm1()
qDeleteAll(pkgMap); qDeleteAll(pkgMap);
pkgMap.clear(); pkgMap.clear();
//请求删除 //请求删除
foreach (iot_idl::SIntelliAlmDel * pkg, aipkgMap) foreach (kbd_idlfile::SIntelliAlmDel * pkg, aipkgMap)
{ {
if(CAiAlarmDataCollect::instance()->requestDelAlm(*pkg) != true) if(CAiAlarmDataCollect::instance()->requestDelAlm(*pkg) != true)
{ {
@ -2061,7 +2040,7 @@ void CAlarmForm::confirmAlarm0()
//构建告警确认package //构建告警确认package
QMap<QString,AlarmMsgPtr> msgMap; //要确认的告警 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-全部跳过 int permSkip = -1; //< 不具备确认权限时是否跳过: 0-单步跳过、1-全部跳过
QModelIndexList::iterator modelIndexIter = modelIndexList.begin(); 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); 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()) 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_node_name(m_nodeName);
pkg->set_user_id(m_userId); pkg->set_user_id(m_userId);
pkg->set_confirm_time(QDateTime::currentMSecsSinceEpoch()); 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) if(CAlarmDataCollect::instance()->requestCfmAlm(*pkg) != true)
{ {
@ -2167,7 +2146,7 @@ void CAlarmForm::confirmAlarm1()
QMap<QString,AlarmMsgPtr> msgMap; //要确认的告警 QMap<QString,AlarmMsgPtr> msgMap; //要确认的告警
msgMap.clear(); msgMap.clear();
//构建告警确认package //构建告警确认package
QMap<QString, iot_idl::SAlmCltCfmAlm *> pkgMap; //Domain-DelPkg; QMap<QString, kbd_idlfile::SAlmCltCfmAlm *> pkgMap; //Domain-DelPkg;
int permSkip = -1; //< 不具备确认权限时是否跳过: 0-单步跳过、1-全部跳过 int permSkip = -1; //< 不具备确认权限时是否跳过: 0-单步跳过、1-全部跳过
QModelIndexList::iterator modelIndexIter = modelIndexList.begin(); QModelIndexList::iterator modelIndexIter = modelIndexList.begin();
for(;modelIndexIter != modelIndexList.end();modelIndexIter++) 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); 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()) 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_node_name(m_nodeName);
pkg->set_user_id(m_userId); pkg->set_user_id(m_userId);
pkg->set_confirm_time(QDateTime::currentMSecsSinceEpoch()); 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_time_stamp(almIter.value()->time_stamp);
pkgMap.value(key)->add_uuid_base64(almIter.value()->uuid_base64.toStdString()); 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) 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; QList<AlarmMsgPtr> listPtr;
listPtr.clear(); listPtr.clear();
int permSkip = -1; int permSkip = -1;
@ -2420,7 +2399,7 @@ void CAlarmForm::rightMerge1()
int32 domain_id = listPtr.at(x)->domain_id; int32 domain_id = listPtr.at(x)->domain_id;
if(!pkgMap.keys().contains(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); pkg->set_domain_id(domain_id);
pkgMap[domain_id] = pkg; pkgMap[domain_id] = pkg;
} }
@ -2440,7 +2419,7 @@ void CAlarmForm::rightMerge1()
pkgMap.clear(); pkgMap.clear();
return ; return ;
} }
foreach (iot_idl::SIntelliAlmMerge * pkg, pkgMap) foreach (kbd_idlfile::SIntelliAlmMerge * pkg, pkgMap)
{ {
if(CAiAlarmDataCollect::instance()->requestMergeAlm(*pkg) != true) if(CAiAlarmDataCollect::instance()->requestMergeAlm(*pkg) != true)
{ {
@ -2561,7 +2540,7 @@ void CAlarmForm::rightSepr1()
} }
//拼包 //拼包
int domain_id = msgList.at(0)->domain_id; 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); pkg->set_domain_id(domain_id);
for(int index(0);index<msgList.size();index++) for(int index(0);index<msgList.size();index++)
{ {
@ -2919,19 +2898,21 @@ void CAlarmForm::test(QStringList tagList)
void CAlarmForm::inhibitAlm(const AlarmMsgPtr &alm) 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); msg.setSubject(alm->sub_system, CH_HMI_TO_OPT_OPTCMD_DOWN);
SOptTagSet sOptTagSet; SOptTagSet sOptTagSet;
SOptTagQueue optTagQueue; SOptTagQueue optTagQueue;
COptTagSet cOptTagSet;
if(createReqHead(sOptTagSet.stHead,alm)!= iotSuccess) if(createReqHead(sOptTagSet.stHead,alm)!= kbdSuccess)
{ {
return ; return ;
} }
QString keyIdTag = alm->key_id_tag; QString keyIdTag = alm->key_id_tag;
if(keyIdTag.endsWith(".value")) if(keyIdTag.endsWith(".value"))
{ {
keyIdTag.replace(QString(".value"),QString(".status")); //禁止告警和实时数据代码一致,要不实时数据 插件取消告警会失败;
// keyIdTag.replace(QString(".value"),QString(".status"));
}else }else
{ {
return ; return ;
@ -2946,7 +2927,7 @@ void CAlarmForm::inhibitAlm(const AlarmMsgPtr &alm)
optTagQueue.nSubSystem = alm->sub_system; optTagQueue.nSubSystem = alm->sub_system;
sOptTagSet.vecTagQueue.push_back(optTagQueue); sOptTagSet.vecTagQueue.push_back(optTagQueue);
std::string content = COptTagSet::generate(sOptTagSet); std::string content = cOptTagSet.generate(sOptTagSet);
msg.setMsgType(MT_OPT_PINHIBIT_ALARM); msg.setMsgType(MT_OPT_PINHIBIT_ALARM);
@ -2964,7 +2945,7 @@ void CAlarmForm::inhibitAlm(const AlarmMsgPtr &alm)
bool CAlarmForm::permCheck(int location, int region) 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) if(permMngPtr != NULL)
{ {
permMngPtr->PermDllInit(); permMngPtr->PermDllInit();
@ -3017,7 +2998,7 @@ int CAlarmForm::createReqHead(SOptReqHead &head, const AlarmMsgPtr &alm)
if(!createSysInfoInstance(m_ptrSysInfo)) if(!createSysInfoInstance(m_ptrSysInfo))
{ {
LOGERROR("创建系统信息访问库实例失败!"); LOGERROR("创建系统信息访问库实例失败!");
return iotFailed; return kbdFailed;
} }
} }
@ -3027,19 +3008,19 @@ int CAlarmForm::createReqHead(SOptReqHead &head, const AlarmMsgPtr &alm)
int loginSec; int loginSec;
std::string instanceName; std::string instanceName;
iot_service::CPermMngApiPtr permMng = iot_service::getPermMngInstance("base"); kbd_service::CPermMngApiPtr permMng = kbd_service::getPermMngInstance("base");
if(permMng != NULL) if(permMng != NULL)
{ {
if(permMng->PermDllInit() != PERM_NORMAL) if(permMng->PermDllInit() != PERM_NORMAL)
{ {
LOGERROR("权限接口初始化失败!"); LOGERROR("权限接口初始化失败!");
return iotFailed; return kbdFailed;
}else }else
{ {
if(PERM_NORMAL != permMng->CurUser(userID, usergID, level, loginSec, instanceName)) if(PERM_NORMAL != permMng->CurUser(userID, usergID, level, loginSec, instanceName))
{ {
userID = -1; userID = -1;
return iotFailed; return kbdFailed;
} }
} }
} }
@ -3049,7 +3030,7 @@ int CAlarmForm::createReqHead(SOptReqHead &head, const AlarmMsgPtr &alm)
if(m_ptrSysInfo != Q_NULLPTR) if(m_ptrSysInfo != Q_NULLPTR)
{ {
iot_public::SAppInfo stAppInfo; kbd_public::SAppInfo stAppInfo;
m_ptrSysInfo->getAppInfoBySubsystemId(alm->sub_system,stAppInfo); m_ptrSysInfo->getAppInfoBySubsystemId(alm->sub_system,stAppInfo);
head.nAppID = stAppInfo.nId; head.nAppID = stAppInfo.nId;
}else }else
@ -3063,7 +3044,7 @@ int CAlarmForm::createReqHead(SOptReqHead &head, const AlarmMsgPtr &alm)
head.nUserGroupID = usergID; head.nUserGroupID = usergID;
head.nOptTime = QDateTime::currentDateTime().toMSecsSinceEpoch(); head.nOptTime = QDateTime::currentDateTime().toMSecsSinceEpoch();
return iotSuccess; return kbdSuccess;
} }
void CAlarmForm::reloadDevTree() void CAlarmForm::reloadDevTree()

View File

@ -49,7 +49,7 @@ public:
void initialize(); void initialize();
void init(); void init();
void initStyle();
void setAlarmModel(CAlarmItemModel * model, CAiAlarmTreeModel *treeModel); void setAlarmModel(CAlarmItemModel * model, CAiAlarmTreeModel *treeModel);
void setAlarmModel(CAlarmItemModel * model); void setAlarmModel(CAlarmItemModel * model);
@ -214,8 +214,8 @@ private:
int createReqHead(SOptReqHead &head, const AlarmMsgPtr &alm); int createReqHead(SOptReqHead &head, const AlarmMsgPtr &alm);
private: private:
iot_public::CSysInfoInterfacePtr m_ptrSysInfo; kbd_public::CSysInfoInterfacePtr m_ptrSysInfo;
iot_dbms::CDbApi *m_pReadDb; kbd_dbms::CDbApi *m_pReadDb;
QLineEdit * m_pSearchTextEdit; QLineEdit * m_pSearchTextEdit;
QPushButton * m_pSearchButton; QPushButton * m_pSearchButton;
@ -231,7 +231,7 @@ private:
CAiAlarmDelegate * m_aiDelegate; CAiAlarmDelegate * m_aiDelegate;
CAlarmDeviceTreeModel * m_pDeviceModel; CAlarmDeviceTreeModel * m_pDeviceModel;
CAiAlarmTreeModel *m_treeModel; CAiAlarmTreeModel *m_treeModel;
iot_net::CMbCommunicator *m_communicator; kbd_net::CMbCommunicator *m_communicator;
int m_userId; int m_userId;
std::string m_nodeName; std::string m_nodeName;
int m_nDomainId; int m_nDomainId;

View File

@ -40,55 +40,25 @@
<property name="lineWidth"> <property name="lineWidth">
<number>0</number> <number>0</number>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout_4">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin"> <property name="topMargin">
<number>0</number> <number>0</number>
</property> </property>
<property name="rightMargin"> <property name="bottomMargin">
<number>9</number> <number>9</number>
</property> </property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="verticalSpacing"> <property name="verticalSpacing">
<number>6</number> <number>0</number>
</property> </property>
<item row="3" column="0"> <item row="0" column="0">
<widget class="QFrame" name="frame_3"> <widget class="QFrame" name="frame_2">
<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>
</property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::StyledPanel</enum>
</property> </property>
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QGridLayout" name="gridLayout_3">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -96,141 +66,414 @@
<number>0</number> <number>0</number>
</property> </property>
<property name="rightMargin"> <property name="rightMargin">
<number>0</number> <number>9</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item> <property name="verticalSpacing">
<layout class="QHBoxLayout" name="horizontalLayout_3"> <number>0</number>
<property name="leftMargin"> </property>
<number>0</number> <item row="0" column="0">
</property> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="bottomMargin"> <property name="spacing">
<number>0</number> <number>6</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="label"> <widget class="QPushButton" name="inhibit">
<property name="text">
<string>当前显示数量:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="showRow">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>55</width> <width>100</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="text"> <property name="maximumSize">
<string>0</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>过滤告警数量:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="filterRow">
<property name="minimumSize">
<size> <size>
<width>55</width> <width>100</width>
<height>0</height> <height>26</height>
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>0</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>
<width>55</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>过滤告警数量:</string>
</property>
</widget>
</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>
<width>55</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBox">
<property name="minimumSize">
<size>
<width>80</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<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>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>13</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="confirm">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximumSize">
<size>
<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>
<property name="text">
<string>设置</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="closeBtn">
<property name="maximumSize">
<size>
<width>45</width>
<height>26</height>
</size>
</property>
<property name="text">
<string>关闭</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QCheckBox" name="checkBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>1000</width>
<height>26</height>
</size>
</property>
<property name="text">
<string>智能告警</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<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>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="set">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>26</height>
</size>
</property>
<property name="text">
<string>设置</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="closeBtn">
<property name="maximumSize">
<size>
<width>60</width>
<height>26</height>
</size>
</property>
<property name="text">
<string>关闭</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="1" column="0">
<widget class="QSplitter" name="splitter"> <widget class="QSplitter" name="splitter">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -260,7 +503,7 @@
</widget> </widget>
<widget class="QStackedWidget" name="stackedWidget"> <widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="page"> <widget class="QWidget" name="page">
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
@ -279,7 +522,7 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item row="1" column="0"> <item row="0" column="0">
<widget class="CAlarmView" name="alarmView"> <widget class="CAlarmView" name="alarmView">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
@ -335,332 +578,6 @@
</widget> </widget>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
</item> </item>

View File

@ -17,7 +17,7 @@ CAlarmInhibitDialog::CAlarmInhibitDialog(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
QString qss = QString(); 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)); QFile qssfile1(QString::fromStdString(strFullPath));
qssfile1.open(QFile::ReadOnly); qssfile1.open(QFile::ReadOnly);
if (qssfile1.isOpen()) if (qssfile1.isOpen())
@ -25,7 +25,7 @@ CAlarmInhibitDialog::CAlarmInhibitDialog(QWidget *parent) :
qss += QLatin1String(qssfile1.readAll()); qss += QLatin1String(qssfile1.readAll());
qssfile1.close(); qssfile1.close();
} }
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("alarm.qss") ; strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("alarm.qss") ;
QFile qssfile2(QString::fromStdString(strFullPath)); QFile qssfile2(QString::fromStdString(strFullPath));
qssfile2.open(QFile::ReadOnly); qssfile2.open(QFile::ReadOnly);
if (qssfile2.isOpen()) if (qssfile2.isOpen())

View File

@ -8,19 +8,7 @@
#include "CAlarmMsgManage.h" #include "CAlarmMsgManage.h"
#include "perm_mng_api/PermMngApi.h" #include "perm_mng_api/PermMngApi.h"
#include <QDebug> #include <QDebug>
//< 屏蔽xml_parser编译告警
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
#endif
#include "boost/property_tree/xml_parser.hpp" #include "boost/property_tree/xml_parser.hpp"
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#include "boost/typeof/typeof.hpp" #include "boost/typeof/typeof.hpp"
#include "boost/filesystem.hpp" #include "boost/filesystem.hpp"
#include "Common.h" #include "Common.h"
@ -34,7 +22,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
using namespace iot_public; using namespace kbd_public;
using namespace std; using namespace std;
const int DOCK_ROW_COUNT = 3; const int DOCK_ROW_COUNT = 3;
const int MAX_ROW_COUNT = 15000; const int MAX_ROW_COUNT = 15000;
@ -363,11 +351,11 @@ void CAlarmItemModel::sortColumn(int column, Qt::SortOrder order)
{ {
if(order == Qt::AscendingOrder) if(order == Qt::AscendingOrder)
{ {
m_order = Qt::AscendingOrder; m_order = Qt::DescendingOrder;
} }
else else
{ {
m_order = Qt::DescendingOrder; m_order = Qt::AscendingOrder;
} }
m_sortKey = (E_ALARM_SORTKEY)column; m_sortKey = (E_ALARM_SORTKEY)column;
beginResetModel(); beginResetModel();

View File

@ -16,8 +16,13 @@
#include "CAlarmSetMng.h" #include "CAlarmSetMng.h"
#include "service/alarm_server_api/AlarmCommonDef.h" #include "service/alarm_server_api/AlarmCommonDef.h"
#include "CAlarmMsgManage.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::m_pInstance = NULL;
CAlarmMediaPlayer *CAlarmMediaPlayer::instance() 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_bHaveValidAudioDev(true),m_pMediaPlayer(Q_NULLPTR),m_pTextToSpeech(Q_NULLPTR),m_pTimerCheckAudioDev(Q_NULLPTR),m_voice(100)
{ {
m_readFlag = true; m_readFlag = true;
QDir dir(QString::fromStdString(iot_public::CFileUtil::getCurModuleDir())); QDir dir(QString::fromStdString(kbd_public::CFileUtil::getCurModuleDir()));
dir.cdUp(); dir.cdUp();
dir.cdUp(); dir.cdUp();
dir.cd("data"); 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) void CAlarmMediaPlayer::setVolumeEnable(bool bEnable)
{ {
if(bEnable) if(bEnable)
@ -417,6 +467,8 @@ void CAlarmMediaPlayer::updateAudioCuesSpeech()
if(!alarmContent.isEmpty()) if(!alarmContent.isEmpty())
{ {
//读取配置文件,更改读取方式
speechTextTrans(alarmContent);
m_pTextToSpeech->say(alarmContent); m_pTextToSpeech->say(alarmContent);
} }
} }

View File

@ -53,6 +53,8 @@ private:
void insertAudioCuesStop(const AlarmMsgPtr &info); void insertAudioCuesStop(const AlarmMsgPtr &info);
void speechTextTrans(QString &strContent);//读取配置文件,调整文本语音输出
private slots: private slots:
/** /**
* @brief playerStateChanged * @brief playerStateChanged
@ -90,6 +92,7 @@ private:
QString m_engine; QString m_engine;
QString m_language; QString m_language;
QString m_voiceName; QString m_voiceName;
QMap<QString,QString> m_mapSpeechTxtTrans;
bool m_readFlag; bool m_readFlag;

View File

@ -76,7 +76,7 @@ CAlarmMsgInfo::CAlarmMsgInfo(const CAlarmMsgInfo &other): m_alarmAction(0)
wave_file = other.wave_file; 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_type = alarmInfo.alm_type();
alm_status = alarmInfo.alm_status(); alm_status = alarmInfo.alm_status();

View File

@ -30,7 +30,7 @@ class CAlarmMsgInfo
public: public:
CAlarmMsgInfo(); CAlarmMsgInfo();
CAlarmMsgInfo(const CAlarmMsgInfo &other); CAlarmMsgInfo(const CAlarmMsgInfo &other);
void initialize(const iot_idl::SAlmInfoToAlmClt &alarmInfo); void initialize(const kbd_idlfile::SAlmInfoToAlmClt &alarmInfo);
int getCameraInfoByTag(const QString &tag); int getCameraInfoByTag(const QString &tag);
//< [优先级越小表示越大]-原始告警窗调用 //< [优先级越小表示越大]-原始告警窗调用

View File

@ -8,18 +8,7 @@
#include <QDebug> #include <QDebug>
#include "perm_mng_api/PermMngApi.h" #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" #include "boost/property_tree/xml_parser.hpp"
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#include "boost/typeof/typeof.hpp" #include "boost/typeof/typeof.hpp"
#include "boost/filesystem.hpp" #include "boost/filesystem.hpp"
#include "Common.h" #include "Common.h"
@ -28,7 +17,7 @@
#include "pub_logger_api/logger.h" #include "pub_logger_api/logger.h"
#include "CAlarmBaseData.h" #include "CAlarmBaseData.h"
using namespace iot_public; using namespace kbd_public;
using namespace std; using namespace std;
CAlarmMsgManage *CAlarmMsgManage::pInstance = NULL; CAlarmMsgManage *CAlarmMsgManage::pInstance = NULL;
@ -48,7 +37,7 @@ CAlarmMsgManage::CAlarmMsgManage()
m_nAlmTotal(0) m_nAlmTotal(0)
{ {
mutex = new QMutex(); mutex = new QMutex();
QDir dir(QString::fromStdString(iot_public::CFileUtil::getCurModuleDir())); QDir dir(QString::fromStdString(kbd_public::CFileUtil::getCurModuleDir()));
dir.cdUp(); dir.cdUp();
dir.cdUp(); dir.cdUp();
dir.cd("data"); dir.cd("data");
@ -71,13 +60,13 @@ CAlarmMsgManage::CAlarmMsgManage()
m_all.clear(); m_all.clear();
m_aiall.clear(); m_aiall.clear();
m_rtdbAlarmActionAccess = new iot_dbms::CRdbAccess(); m_rtdbAlarmActionAccess = new kbd_dbms::CRdbAccess();
m_rtdbAlarmActionAccess->open("base", "alarm_level_define"); 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_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"); m_rtdbAppDescriptionAccess->open("base", "sys_model_app_info");
loadPermInfo(); 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); QMutexLocker locker(mutex);
return m_alarmLNCAlm; 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) void CAlarmMsgManage::getAllInhibitAlm(QList<AlarmMsgPtr> &almList)
{ {
QMutexLocker locker(mutex); 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(locId);
QHash<int,QMap<QString,QSet<QString> > >::iterator it =m_alarmLNCAlm.find(msg->location_id);
if(it != m_alarmLNCAlm.end()) if(it != m_alarmLNCAlm.end())
{ {
QMap<QString,QSet<QString> > &devgMap = it.value(); 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()) if(pos != devgMap.end())
{ {
pos.value().insert(msg->uuid_base64); pos.value().insert(uuid);
}else }else
{ {
QSet<QString> uuidSet; QSet<QString> uuidSet;
uuidSet.insert(msg->uuid_base64); uuidSet.insert(uuid);
devgMap[msg->dev_group_tag] = uuidSet; devgMap[devg] = uuidSet;
} }
}else }else
{ {
QMap<QString,QSet<QString> > devgMap; QMap<QString,QSet<QString> > devgMap;
QSet<QString> uuidSet; QSet<QString> uuidSet;
uuidSet.insert(msg->uuid_base64); uuidSet.insert(uuid);
devgMap[msg->dev_group_tag] = uuidSet; devgMap[devg] = uuidSet;
m_alarmLNCAlm[msg->location_id] = devgMap; m_alarmLNCAlm[locId] = 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;
} }
} }
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(locId);
QHash<int,QMap<QString,QSet<QString> > >::iterator it =m_alarmLNCAlm.find(msg->location_id);
if(it != m_alarmLNCAlm.end()) if(it != m_alarmLNCAlm.end())
{ {
QMap<QString,QSet<QString> > &devgMap = it.value(); 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()) if(pos != devgMap.end())
{ {
pos.value().remove(msg->uuid_base64); pos.value().remove(uuid);
}
}
//< 按告警等级
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);
} }
} }
} }
@ -1135,7 +1080,7 @@ void CAlarmMsgManage::initAlarm()
if(E_ALS_ALARM == (*itpos)->logic_state || E_ALS_RETURN == (*itpos)->logic_state )//未确认数量(界面显示未确认) 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; ++m_nNDelComAlarmCount;
} }
updateMsgAction((*itpos)); 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 )//未确认数量(界面显示未确认) 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; ++m_nNDelComAlarmCount;
} }
updateMsgAction(*itpos); updateMsgAction(*itpos);
@ -1445,7 +1390,7 @@ void CAlarmMsgManage::confirmAlarmMsg(const QList<QString> &uuidList)
oldMsg->logic_state = E_ALS_RETURN_CFM; oldMsg->logic_state = E_ALS_RETURN_CFM;
--m_nNDelComAlarmCount; --m_nNDelComAlarmCount;
} }
delNotConfirmAlm(oldMsg); delNotConfirmAlm(oldMsg->location_id,oldMsg->dev_group_tag,oldMsg->uuid_base64);
}else }else
{ {
AlarmMsgPtr oldMsg_ = m_all.value(uuid, NULL); 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) if(E_ALS_ALARM == oldMsg->logic_state)
{ {
delNotConfirmAlm(oldMsg); delNotConfirmAlm(oldMsg->location_id,oldMsg->dev_group_tag,oldMsg->uuid_base64);
--m_nNDelComAlarmCount; --m_nNDelComAlarmCount;
oldMsg->logic_state = E_ALS_ALARM_DEL; 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) else if(E_ALS_RETURN == oldMsg->logic_state)
{ {
delNotConfirmAlm(oldMsg); delNotConfirmAlm(oldMsg->location_id,oldMsg->dev_group_tag,oldMsg->uuid_base64);
--m_nNDelComAlarmCount; --m_nNDelComAlarmCount;
oldMsg->logic_state = E_ALS_RETURN_DEL; 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) 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; --m_nNDelComAlarmCount;
} }
removeAudioCues(it.value()); 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 )//未删除未确认数量(界面显示未确认) 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; ++m_nNDelComAlarmCount;
} }
updateMsgAction(m_listMsgAddCache.at(num)); updateMsgAction(m_listMsgAddCache.at(num));
@ -1923,24 +1868,24 @@ void CAlarmMsgManage::dealDelayAi()
int CAlarmMsgManage::queryAlarmAction(const int &priority) int CAlarmMsgManage::queryAlarmAction(const int &priority)
{ {
iot_dbms::CTableLockGuard locker(*m_rtdbAlarmActionAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbAlarmActionAccess);
iot_dbms::CVarType value; kbd_dbms::CVarType value;
m_rtdbAlarmActionAccess->getColumnValueByKey((void*)&priority, "alarm_actions",value); m_rtdbAlarmActionAccess->getColumnValueByKey((void*)&priority, "alarm_actions",value);
return value.toInt(); return value.toInt();
} }
QString CAlarmMsgManage::queryLocationDescription(int id) QString CAlarmMsgManage::queryLocationDescription(int id)
{ {
iot_dbms::CTableLockGuard locker(*m_rtdbLocationDescriptionAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbLocationDescriptionAccess);
iot_dbms::CVarType value; kbd_dbms::CVarType value;
m_rtdbLocationDescriptionAccess->getColumnValueByKey((void*)&id, "description", value); m_rtdbLocationDescriptionAccess->getColumnValueByKey((void*)&id, "description", value);
return value.c_str(); return value.c_str();
} }
QString CAlarmMsgManage::queryAppDescription(int id) QString CAlarmMsgManage::queryAppDescription(int id)
{ {
iot_dbms::CTableLockGuard locker(*m_rtdbAppDescriptionAccess); kbd_dbms::CTableLockGuard locker(*m_rtdbAppDescriptionAccess);
iot_dbms::CVarType value; kbd_dbms::CVarType value;
m_rtdbAppDescriptionAccess->getColumnValueByKey((void*)&id, "description", value); m_rtdbAppDescriptionAccess->getColumnValueByKey((void*)&id, "description", value);
return value.c_str(); return value.c_str();
} }

View File

@ -79,8 +79,7 @@ public:
QHash<int,QMap<int,int> > getLocAlmInfo(); QHash<int,QMap<int,int> > getLocAlmInfo();
void updataDevGroupByDev(QString devGroup, QString device); void updataDevGroupByDev(QString devGroup, QString device);
const QHash<int,QMap<QString,QSet<QString> > > &getLocNotConfirmAlmInfo() const; QHash<int,QMap<QString,QSet<QString> > > getLocNotConfirmAlmInfo();
const QHash<int, QMap<int, QSet<QString> > > &getLocPriorityNotConfirmAlmInfo() const;
void getAllInhibitAlm(QList<AlarmMsgPtr> &almList); void getAllInhibitAlm(QList<AlarmMsgPtr> &almList);
signals: signals:
@ -268,14 +267,18 @@ private:
void locSubStats(const AlarmMsgPtr &msg); void locSubStats(const AlarmMsgPtr &msg);
/** /**
* @brief addNotConfirmAlm uuid * @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集合中删除 * @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: signals:
/** /**
* @brief sigAiMsgRemove * @brief sigAiMsgRemove
@ -369,9 +372,9 @@ private:
QMutex * mutex; QMutex * mutex;
iot_dbms::CRdbAccess * m_rtdbAlarmActionAccess; kbd_dbms::CRdbAccess * m_rtdbAlarmActionAccess;
iot_dbms::CRdbAccess * m_rtdbLocationDescriptionAccess; kbd_dbms::CRdbAccess * m_rtdbLocationDescriptionAccess;
iot_dbms::CRdbAccess * m_rtdbAppDescriptionAccess; kbd_dbms::CRdbAccess * m_rtdbAppDescriptionAccess;
int m_nNDelComAlarmCount; //< 未删除未确认数量 N--not Del--delete Com--confirm int m_nNDelComAlarmCount; //< 未删除未确认数量 N--not Del--delete Com--confirm
QHash<QString, AlarmMsgPtr> m_infos; QHash<QString, AlarmMsgPtr> m_infos;
@ -403,7 +406,6 @@ private:
QHash<int,QMap<int,int > > m_alarmLPAlm; //< <车站id,<告警等级,告警数量> > QHash<int,QMap<int,int > > m_alarmLPAlm; //< <车站id,<告警等级,告警数量> >
QHash<int,QMap<QString,QSet<QString> > > m_alarmLNCAlm;//< <车站id,<设备组,<未确认告警uuid> > > QHash<int,QMap<QString,QSet<QString> > > m_alarmLNCAlm;//< <车站id,<设备组,<未确认告警uuid> > >
QHash<int,QMap<int,QSet<QString> > > m_alarmLNCPAlm;//< <车站id,<告警等级,<未确认告警uuid> > >
QList<AiAlarmMsgPtr> m_delaydeal; //延迟处理的智能告警 QList<AiAlarmMsgPtr> m_delaydeal; //延迟处理的智能告警

View File

@ -41,7 +41,7 @@ CAlarmPlugin::CAlarmPlugin(QWidget *parent, bool editMode)
#ifdef OS_LINUX #ifdef OS_LINUX
QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() + "/plugins"); QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() + "/plugins");
#endif #endif
std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss") ; std::string strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("public.qss") ;
QFile qssfile1(QString::fromStdString(strFullPath)); QFile qssfile1(QString::fromStdString(strFullPath));
qssfile1.open(QFile::ReadOnly); qssfile1.open(QFile::ReadOnly);
if (qssfile1.isOpen()) if (qssfile1.isOpen())
@ -49,7 +49,7 @@ CAlarmPlugin::CAlarmPlugin(QWidget *parent, bool editMode)
qss += QLatin1String(qssfile1.readAll()); qss += QLatin1String(qssfile1.readAll());
qssfile1.close(); qssfile1.close();
} }
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("alarm.qss") ; strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("alarm.qss") ;
QFile qssfile2(QString::fromStdString(strFullPath)); QFile qssfile2(QString::fromStdString(strFullPath));
qssfile2.open(QFile::ReadOnly); qssfile2.open(QFile::ReadOnly);
if (qssfile2.isOpen()) if (qssfile2.isOpen())
@ -242,7 +242,7 @@ void CAlarmPlugin::initialize(int mode)
void CAlarmPlugin::loadConfig() 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)) if (!file.open(QFile::ReadWrite))
{ {
LOGERROR("打开智能告警配置文件失败,默认不启动"); LOGERROR("打开智能告警配置文件失败,默认不启动");
@ -332,7 +332,7 @@ int CAlarmPlugin::confirmAlarm(const QList<AlarmMsgPtr> &msgs)
return cofirmNum; 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++) for(int nIndex(0); nIndex < msgs.size(); nIndex++)
{ {
AlarmMsgPtr info = msgs.at(nIndex); AlarmMsgPtr info = msgs.at(nIndex);
@ -362,10 +362,10 @@ int CAlarmPlugin::confirmAlarm(const QList<AlarmMsgPtr> &msgs)
if(regionEnable && locationEnable) if(regionEnable && locationEnable)
{ {
QString key = QString("%1_%2_%3").arg(info->domain_id).arg(info->alm_type).arg(info->app_id); 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()) 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_node_name(m_currentNodeName);
pkg->set_user_id(m_currentUsrId); pkg->set_user_id(m_currentUsrId);
pkg->set_confirm_time(QDateTime::currentMSecsSinceEpoch()); 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) if(CAlarmDataCollect::instance()->requestCfmAlm(*pkg) != true)
{ {
@ -406,7 +406,7 @@ int CAlarmPlugin::removeAlarm(const QList<AlarmMsgPtr> &msgs)
return -1; return -1;
} }
//< 可能有部分告警没有删除权限 //< 可能有部分告警没有删除权限
QMap<int32, iot_idl::SAlmCltDelAlm *> pkgMap; QMap<int32, kbd_idlfile::SAlmCltDelAlm *> pkgMap;
for(int nIndex(0); nIndex < msgs.size(); nIndex++) for(int nIndex(0); nIndex < msgs.size(); nIndex++)
{ {
AlarmMsgPtr info = msgs.at(nIndex); AlarmMsgPtr info = msgs.at(nIndex);
@ -432,10 +432,10 @@ int CAlarmPlugin::removeAlarm(const QList<AlarmMsgPtr> &msgs)
} }
if(regionEnable && locationEnable) 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()) 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); pkg->set_domain_id(info->domain_id);
pkgMap[info->domain_id] = pkg; 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) if(CAlarmDataCollect::instance()->requestDelAlm(*pkg) != true)
{ {
@ -693,13 +693,13 @@ int CAlarmPlugin::getLocNotConfirmAlmCount(int loc)
{ {
return count; 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()) if(it !=locCountMap.end())
{ {
QMap<QString,QSet<QString> > devgCountMap = it.value(); 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()) { while (pos != devgCountMap.end()) {
count += pos.value().count(); count += pos.value().count();
@ -710,28 +710,6 @@ int CAlarmPlugin::getLocNotConfirmAlmCount(int loc)
return count; 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 CAlarmPlugin::getDevgNotConfirmAlmCount(const QString &devg)
{ {
int count =0; int count =0;
@ -739,13 +717,13 @@ int CAlarmPlugin::getDevgNotConfirmAlmCount(const QString &devg)
{ {
return count; 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()) while (it !=locCountMap.end())
{ {
QMap<QString,QSet<QString> > devgCountMap = it.value(); 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()) if(pos != devgCountMap.end())
{ {
count = pos.value().count(); 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) void CAlarmPlugin::setPointTag(const QString &pointList)
{ {
if(m_bIsEditMode || E_Alarm_Pop != m_mode) if(m_bIsEditMode || E_Alarm_Pop != m_mode)
@ -1389,9 +1355,9 @@ void CAlarmPlugin::updateAlarmOperatePerm()
m_vecRegionDelId.clear(); m_vecRegionDelId.clear();
m_vecLocationDelId.clear(); m_vecLocationDelId.clear();
iot_public::SNodeInfo stNodeInfo; kbd_public::SNodeInfo stNodeInfo;
iot_public::CSysInfoInterfacePtr spSysInfo; kbd_public::CSysInfoInterfacePtr spSysInfo;
if (!iot_public::createSysInfoInstance(spSysInfo)) if (!kbd_public::createSysInfoInstance(spSysInfo))
{ {
LOGERROR("创建系统信息访问库实例失败!"); LOGERROR("创建系统信息访问库实例失败!");
return; return;
@ -1399,7 +1365,7 @@ void CAlarmPlugin::updateAlarmOperatePerm()
spSysInfo->getLocalNodeInfo(stNodeInfo); spSysInfo->getLocalNodeInfo(stNodeInfo);
m_currentNodeName = stNodeInfo.strName; m_currentNodeName = stNodeInfo.strName;
iot_service::CPermMngApiPtr permMngPtr = iot_service::getPermMngInstance("base"); kbd_service::CPermMngApiPtr permMngPtr = kbd_service::getPermMngInstance("base");
if(permMngPtr != NULL) if(permMngPtr != NULL)
{ {
permMngPtr->PermDllInit(); permMngPtr->PermDllInit();

View File

@ -102,12 +102,6 @@ public slots:
* @return * @return
*/ */
int getLocNotConfirmAlmCount(int loc); int getLocNotConfirmAlmCount(int loc);
/**
* @brief getLocNotConfirmAlmInfo
* @param loc id
* @return QString _告警数量 ex:1_23 123
*/
QStringList getLocNotConfirmAlmInfo(int loc);
/** /**
* @brief getDevgNotConfirmAlmCount * @brief getDevgNotConfirmAlmCount
* @param devg * @param devg
@ -213,20 +207,11 @@ public slots:
* @param device * @param device
*/ */
void setDevice(const QString &device); void setDevice(const QString &device);
/** /**
* @brief setDeviceGroup * @brief setDeviceGroup
* @param deviceGroup * @param deviceGroup
*/ */
void setDeviceGroup(const QString &deviceGroup); void setDeviceGroup(const QString &deviceGroup);
/**
* @brief setPriorityFilter
* @param deviceGroup
*/
void setPriorityFilter(int PriorityFilter);
/** /**
* @brief setPointTag () * @brief setPointTag ()
* @param pointList * @param pointList

View File

@ -7,7 +7,7 @@
class CAlarmPluginWidget : public QObject, public CPluginWidgetInterface class CAlarmPluginWidget : public QObject, public CPluginWidgetInterface
{ {
Q_OBJECT Q_OBJECT
Q_PLUGIN_METADATA(IID HMI_WidgetPlugin_IID) Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0")
Q_INTERFACES(CPluginWidgetInterface) Q_INTERFACES(CPluginWidgetInterface)
public: public:

View File

@ -25,7 +25,7 @@ CAlarmSetDlg::CAlarmSetDlg(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
QString qss = QString(); 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)); QFile qssfile1(QString::fromStdString(strFullPath));
qssfile1.open(QFile::ReadOnly); qssfile1.open(QFile::ReadOnly);
if (qssfile1.isOpen()) if (qssfile1.isOpen())
@ -33,7 +33,7 @@ CAlarmSetDlg::CAlarmSetDlg(QWidget *parent) :
qss += QLatin1String(qssfile1.readAll()); qss += QLatin1String(qssfile1.readAll());
qssfile1.close(); qssfile1.close();
} }
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("alarm.qss") ; strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("alarm.qss") ;
QFile qssfile2(QString::fromStdString(strFullPath)); QFile qssfile2(QString::fromStdString(strFullPath));
qssfile2.open(QFile::ReadOnly); qssfile2.open(QFile::ReadOnly);
if (qssfile2.isOpen()) if (qssfile2.isOpen())

View File

@ -5,7 +5,7 @@
#include "pub_utility_api/FileUtil.h" #include "pub_utility_api/FileUtil.h"
#include "CAlarmBaseData.h" #include "CAlarmBaseData.h"
using namespace iot_public; using namespace kbd_public;
using namespace std; using namespace std;
CAlarmSetMng *CAlarmSetMng::pInstance = NULL; CAlarmSetMng *CAlarmSetMng::pInstance = NULL;
@ -41,7 +41,7 @@ CAlarmSetMng::CAlarmSetMng()
void CAlarmSetMng::loadXMLCfg() void CAlarmSetMng::loadXMLCfg()
{ {
m_colorMap.clear(); 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; QDomDocument document;
QFile file(filePath); QFile file(filePath);
if (!file.open(QIODevice::ReadOnly)) if (!file.open(QIODevice::ReadOnly))

View File

@ -66,7 +66,7 @@ private:
static CAlarmSetMng * pInstance; static CAlarmSetMng * pInstance;
iot_dbms::CRdbAccess * m_rtdbAccess; kbd_dbms::CRdbAccess * m_rtdbAccess;
QMap<int, QString> m_priorityOrderDescriptionMap; QMap<int, QString> m_priorityOrderDescriptionMap;

View File

@ -15,7 +15,7 @@ CAlarmShiledDialog::CAlarmShiledDialog(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
QString qss = QString(); 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)); QFile qssfile1(QString::fromStdString(strFullPath));
qssfile1.open(QFile::ReadOnly); qssfile1.open(QFile::ReadOnly);
if (qssfile1.isOpen()) if (qssfile1.isOpen())
@ -23,7 +23,7 @@ CAlarmShiledDialog::CAlarmShiledDialog(QWidget *parent) :
qss += QLatin1String(qssfile1.readAll()); qss += QLatin1String(qssfile1.readAll());
qssfile1.close(); qssfile1.close();
} }
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("alarm.qss") ; strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("alarm.qss") ;
QFile qssfile2(QString::fromStdString(strFullPath)); QFile qssfile2(QString::fromStdString(strFullPath));
qssfile2.open(QFile::ReadOnly); qssfile2.open(QFile::ReadOnly);
if (qssfile2.isOpen()) if (qssfile2.isOpen())
@ -80,7 +80,7 @@ QWidget *CAlarmShiledDialog::createCustomWidget(const QString &name)
} }
fileName += ".so"; fileName += ".so";
#endif #endif
std::string filePath = iot_public::CFileUtil::getPathOfBinFile(fileName.toStdString()); std::string filePath = kbd_public::CFileUtil::getPathOfBinFile(fileName.toStdString());
path = QString::fromStdString(filePath); path = QString::fromStdString(filePath);
QPluginLoader loader(path); QPluginLoader loader(path);
QObject *plugin = loader.instance(); QObject *plugin = loader.instance();

View File

@ -305,7 +305,7 @@ void CAlarmWidget::confirmAlarm(const int &row)
return; 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_node_name(m_nodeName);
pkg->set_user_id(m_userId); pkg->set_user_id(m_userId);
pkg->set_confirm_time(QDateTime::currentMSecsSinceEpoch()); pkg->set_confirm_time(QDateTime::currentMSecsSinceEpoch());
@ -355,9 +355,9 @@ void CAlarmWidget::setEnableLevel(bool isNeed)
bool CAlarmWidget::updateAlarmOperatePerm() bool CAlarmWidget::updateAlarmOperatePerm()
{ {
iot_public::SNodeInfo stNodeInfo; kbd_public::SNodeInfo stNodeInfo;
iot_public::CSysInfoInterfacePtr spSysInfo; kbd_public::CSysInfoInterfacePtr spSysInfo;
if (!iot_public::createSysInfoInstance(spSysInfo)) if (!kbd_public::createSysInfoInstance(spSysInfo))
{ {
LOGERROR("创建系统信息访问库实例失败!"); LOGERROR("创建系统信息访问库实例失败!");
return false; return false;
@ -368,7 +368,7 @@ bool CAlarmWidget::updateAlarmOperatePerm()
m_listRegionOptId.clear(); m_listRegionOptId.clear();
m_listLocationDelId.clear(); m_listLocationDelId.clear();
m_listRegionDelId.clear(); m_listRegionDelId.clear();
iot_service::CPermMngApiPtr permMngPtr = iot_service::getPermMngInstance("base"); kbd_service::CPermMngApiPtr permMngPtr = kbd_service::getPermMngInstance("base");
if(permMngPtr != NULL) if(permMngPtr != NULL)
{ {
permMngPtr->PermDllInit(); permMngPtr->PermDllInit();

View File

@ -12,7 +12,7 @@ int main(int argc, char *argv[])
//<初始化消息总线 //<初始化消息总线
QStringList arguments=QCoreApplication::arguments(); QStringList arguments=QCoreApplication::arguments();
std::string name="admin"; std::string name="admin";
std::string password ="admin"; std::string password ="kbdct";
int group =1; int group =1;
for(int index(0);index<arguments.size();index++) for(int index(0);index<arguments.size();index++)
{ {
@ -41,12 +41,12 @@ int main(int argc, char *argv[])
} }
} }
} }
iot_public::StartLogSystem("HMI", "hmi"); kbd_public::StartLogSystem("HMI", "hmi");
if (!(iot_net::initMsgBus("HMI", "HMI"))) if (!(kbd_net::initMsgBus("HMI", "HMI")))
{ {
return -1; return -1;
} }
iot_service::CPermMngApiPtr perm = iot_service::getPermMngInstance("base"); kbd_service::CPermMngApiPtr perm = kbd_service::getPermMngInstance("base");
if(!perm || PERM_NORMAL != perm->PermDllInit()) if(!perm || PERM_NORMAL != perm->PermDllInit())
{ {
return -1; return -1;
@ -67,8 +67,8 @@ int main(int argc, char *argv[])
} }
//<释放消息总线 //<释放消息总线
iot_net::releaseMsgBus(); kbd_net::releaseMsgBus();
iot_public::StopLogSystem(); kbd_public::StopLogSystem();
return 0; return 0;
} }

View File

@ -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")
}

View File

@ -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();
}
}

View File

@ -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

View File

@ -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();
}

View File

@ -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

View File

@ -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();
}

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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