[ref]同步711
This commit is contained in:
parent
15d70635cb
commit
0b91f20d68
157
product/src/tools/db_installer/CSqlOpt.cpp
Normal file
157
product/src/tools/db_installer/CSqlOpt.cpp
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
#include "CSqlOpt.h"
|
||||||
|
|
||||||
|
#include "../../dbms/db_manager_api/db_manager_api_common.h"
|
||||||
|
#include "db_manager_api/db_opt_mysql.h"
|
||||||
|
#include "db_manager_api/db_opt_kingbase.h"
|
||||||
|
#include "db_manager_api/db_opt_opengauss.h"
|
||||||
|
#include "db_manager_api/db_manager_api.h"
|
||||||
|
using namespace iot_dbms;
|
||||||
|
|
||||||
|
|
||||||
|
CSqlOpt::CSqlOpt()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int CSqlOpt::installer()
|
||||||
|
{
|
||||||
|
mysql_opt();
|
||||||
|
kingbase_opt();
|
||||||
|
opengauss_opt();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CSqlOpt::mysql_opt()
|
||||||
|
{
|
||||||
|
db_opt_mysql pDbOpt;
|
||||||
|
QString sDatabaseName = EMS_DEFAULT_DATABASE;
|
||||||
|
|
||||||
|
if (pDbOpt.openDatabase("127.0.0.1",3306,"root","kbdct@0755","mysql"))
|
||||||
|
{
|
||||||
|
QString sError = "";
|
||||||
|
QString sSql = QString("update mysql.user set password=password('%1') where user='root'; and Host ='localhost';").arg(EMS_DEFAULT_PASSWD) ;
|
||||||
|
bool result = pDbOpt.executeSql( sSql, sError );
|
||||||
|
if(!result)
|
||||||
|
{
|
||||||
|
QString sSql = QString("UPDATE mysql.user SET authentication_string=PASSWORD('%1') WHERE User='root'; and Host ='localhost';").arg(EMS_DEFAULT_PASSWD) ;
|
||||||
|
result = pDbOpt.executeSql( sSql, sError );
|
||||||
|
if(!result)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result = pDbOpt.executeSql( "flush privileges;", sError );
|
||||||
|
if(!result)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pDbOpt.openDatabase("127.0.0.1",3306,"root",EMS_DEFAULT_PASSWD,""))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString sSql;
|
||||||
|
sSql = "CREATE DATABASE " + sDatabaseName;
|
||||||
|
QString sError = "";
|
||||||
|
|
||||||
|
bool result = pDbOpt.executeSql( sSql, sError );
|
||||||
|
if(!result)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
db_manager_api api;
|
||||||
|
if(!api.updateDatabase(&pDbOpt, sDatabaseName,true))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CSqlOpt::kingbase_opt()
|
||||||
|
{
|
||||||
|
db_opt_kingbase pDbOpt;
|
||||||
|
QString sDatabaseName = EMS_DEFAULT_DATABASE;
|
||||||
|
|
||||||
|
if (pDbOpt.openDatabase("127.0.0.1",54321,"system","kbdct@0755",""))
|
||||||
|
{
|
||||||
|
//金仓数据库的处理
|
||||||
|
QString sSql;
|
||||||
|
QString sError = "";
|
||||||
|
sSql = QString("ALTER USER system WITH PASSWORD '%1';").arg(EMS_DEFAULT_PASSWD) ;
|
||||||
|
bool result = pDbOpt.executeSql( sSql, sError );
|
||||||
|
if(!result)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pDbOpt.openDatabase("127.0.0.1",54321,"system",EMS_DEFAULT_PASSWD,""))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString sSql;
|
||||||
|
sSql = "CREATE DATABASE " + sDatabaseName;
|
||||||
|
QString sError = "";
|
||||||
|
|
||||||
|
bool result = pDbOpt.executeSql( sSql, sError );
|
||||||
|
if(!result)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
db_manager_api api;
|
||||||
|
if(!api.updateDatabase(&pDbOpt, sDatabaseName,true))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CSqlOpt::opengauss_opt()
|
||||||
|
{
|
||||||
|
db_opt_opengauss pDbOpt;
|
||||||
|
QString sDatabaseName = EMS_DEFAULT_DATABASE;
|
||||||
|
|
||||||
|
if (pDbOpt.openDatabase("127.0.0.1",5432,"iscs","kbdct@0755",""))
|
||||||
|
{
|
||||||
|
//高斯数据库的处理
|
||||||
|
QString sSql;
|
||||||
|
QString sError = "";
|
||||||
|
sSql = QString("ALTER USER iscs identified by '%1' replace 'kbdct@0755';").arg(EMS_DEFAULT_PASSWD) ;
|
||||||
|
bool result = pDbOpt.executeSql( sSql, sError );
|
||||||
|
if(!result)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pDbOpt.openDatabase("127.0.0.1",5432,"iscs",EMS_DEFAULT_PASSWD,""))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString sSql;
|
||||||
|
sSql = "CREATE DATABASE " + sDatabaseName;
|
||||||
|
QString sError = "";
|
||||||
|
|
||||||
|
bool result = pDbOpt.executeSql( sSql, sError );
|
||||||
|
if(!result)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
db_manager_api api;
|
||||||
|
if(!api.updateDatabase(&pDbOpt, sDatabaseName,true))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
18
product/src/tools/db_installer/CSqlOpt.h
Normal file
18
product/src/tools/db_installer/CSqlOpt.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef CSQLOPT_H
|
||||||
|
#define CSQLOPT_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class CSqlOpt
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CSqlOpt();
|
||||||
|
public:
|
||||||
|
int installer();
|
||||||
|
private:
|
||||||
|
int mysql_opt();
|
||||||
|
int kingbase_opt();
|
||||||
|
int opengauss_opt();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CSQLOPT_H
|
||||||
40
product/src/tools/db_installer/db_installer.pro
Normal file
40
product/src/tools/db_installer/db_installer.pro
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
QT -= gui
|
||||||
|
QT += sql xml network
|
||||||
|
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
|
#CONFIG += c++11 console
|
||||||
|
|
||||||
|
TARGET = db_installer
|
||||||
|
TEMPLATE = app
|
||||||
|
|
||||||
|
# The following define makes your compiler emit warnings if you use
|
||||||
|
# any feature of Qt which as been marked deprecated (the exact warnings
|
||||||
|
# depend on your compiler). Please consult the documentation of the
|
||||||
|
# deprecated API in order to know how to port your code away from it.
|
||||||
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
|
# QMAKE_CXXFLAGS+=/execution-charset:utf-8
|
||||||
|
|
||||||
|
|
||||||
|
# You can also make your code fail to compile if you use deprecated APIs.
|
||||||
|
# In order to do so, uncomment the following line.
|
||||||
|
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||||
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
CSqlOpt.cpp \
|
||||||
|
main.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
CSqlOpt.h
|
||||||
|
|
||||||
|
LIBS += -lpub_utility_api -ldb_manager_api -ldb_base_api
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
COMMON_PRI=$$PWD/../../common.pri
|
||||||
|
exists($$COMMON_PRI) {
|
||||||
|
include($$COMMON_PRI)
|
||||||
|
}else {
|
||||||
|
error("FATAL error: can not find common.pri")
|
||||||
|
}
|
||||||
13
product/src/tools/db_installer/main.cpp
Normal file
13
product/src/tools/db_installer/main.cpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// RQEH6000mysql_update.cpp : 定义控制台应用程序的入口点。
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
|
||||||
|
#include "CSqlOpt.h"
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QCoreApplication a(argc, argv);
|
||||||
|
CSqlOpt opt;
|
||||||
|
return opt.installer();
|
||||||
|
}
|
||||||
|
|
||||||
27
product/src/tools/debug_tool_v2/CActiveWindow.cpp
Normal file
27
product/src/tools/debug_tool_v2/CActiveWindow.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include "CActiveWindow.h"
|
||||||
|
#include "pub_logger_api/logger.h"
|
||||||
|
CActiveWindow * CActiveWindow::m_pInstance = NULL;
|
||||||
|
CActiveWindow *CActiveWindow::instance()
|
||||||
|
{
|
||||||
|
if(NULL == m_pInstance)
|
||||||
|
{
|
||||||
|
m_pInstance = new CActiveWindow();
|
||||||
|
}
|
||||||
|
return m_pInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CActiveWindow::setActiveWindow(int windowId)
|
||||||
|
{
|
||||||
|
LOGINFO("setActiveWindow():设置激活窗口为%d",windowId);
|
||||||
|
m_nActive = windowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CActiveWindow::getActiveWindow()
|
||||||
|
{
|
||||||
|
return m_nActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
CActiveWindow::CActiveWindow()
|
||||||
|
{
|
||||||
|
m_nActive = (int)E_ACTIVE_WINDOW_FES;
|
||||||
|
}
|
||||||
47
product/src/tools/debug_tool_v2/CActiveWindow.h
Normal file
47
product/src/tools/debug_tool_v2/CActiveWindow.h
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#ifndef CACTIVEWINDOW_H
|
||||||
|
#define CACTIVEWINDOW_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
enum E_ACTIVE_WINDOW_ID
|
||||||
|
{
|
||||||
|
E_ACTIVE_WINDOW_FES = 0,
|
||||||
|
E_ACTIVE_WINDOW_FES_AI_DATA = 1,
|
||||||
|
E_ACTIVE_WINDOW_FES_DI_DATA,
|
||||||
|
E_ACTIVE_WINDOW_FES_PI_DATA,
|
||||||
|
E_ACTIVE_WINDOW_FES_MI_DATA ,
|
||||||
|
E_ACTIVE_WINDOW_FES_AI_CTRL,
|
||||||
|
E_ACTIVE_WINDOW_FES_DI_CTRL,
|
||||||
|
E_ACTIVE_WINDOW_FES_PI_CTRL,
|
||||||
|
E_ACTIVE_WINDOW_FES_MI_CTRL,
|
||||||
|
E_ACTIVE_WINDOW_FES_EVENT_CTRL,
|
||||||
|
E_ACTIVE_WINDOW_FES_AO_CTRL,
|
||||||
|
E_ACTIVE_WINDOW_FES_DO_CTRL,
|
||||||
|
E_ACTIVE_WINDOW_FES_MO_CTRL,
|
||||||
|
E_ACTIVE_WINDOW_FES_CUSTOM_CTRL,
|
||||||
|
E_ACTIVE_WINDOW_FES_AI_FARWARD,
|
||||||
|
E_ACTIVE_WINDOW_FES_DI_FARWARD,
|
||||||
|
E_ACTIVE_WINDOW_FES_DDI_FARWARD,
|
||||||
|
E_ACTIVE_WINDOW_FES_PI_FARWARD,
|
||||||
|
E_ACTIVE_WINDOW_FES_MI_FARWARD,
|
||||||
|
E_ACTIVE_WINDOW_FES_SOE_EVENT,
|
||||||
|
E_ACTIVE_WINDOW_FES_CHAN_EVENT,
|
||||||
|
E_ACTIVE_WINDOW_FES_SOE_MEMORY,
|
||||||
|
E_ACTIVE_WINDOW_FES_CHAN_PARAM,
|
||||||
|
E_ACTIVE_WINDOW_FES_RTU_PARAM,
|
||||||
|
E_ACTIVE_WINDOW_FES_CHAN_DATA
|
||||||
|
};
|
||||||
|
|
||||||
|
class CActiveWindow
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static CActiveWindow *instance();
|
||||||
|
|
||||||
|
void setActiveWindow(int windowId);
|
||||||
|
int getActiveWindow();
|
||||||
|
CActiveWindow();
|
||||||
|
private:
|
||||||
|
int m_nActive;
|
||||||
|
static CActiveWindow * m_pInstance;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CACTIVEWINDOW_H
|
||||||
585
product/src/tools/debug_tool_v2/CDataMng.cpp
Normal file
585
product/src/tools/debug_tool_v2/CDataMng.cpp
Normal file
@ -0,0 +1,585 @@
|
|||||||
|
#include "CDataMng.h"
|
||||||
|
#include "db_api_ex/CDbApi.h"
|
||||||
|
#include "pub_logger_api/logger.h"
|
||||||
|
#include "Common.h"
|
||||||
|
|
||||||
|
CDataMng *CDataMng::m_pInstance = Q_NULLPTR;
|
||||||
|
CDataMng *CDataMng::instance()
|
||||||
|
{
|
||||||
|
if(m_pInstance == Q_NULLPTR)
|
||||||
|
{
|
||||||
|
m_pInstance = new CDataMng();
|
||||||
|
}
|
||||||
|
return m_pInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
CDataMng::~CDataMng()
|
||||||
|
{
|
||||||
|
if(m_pReadApi != Q_NULLPTR)
|
||||||
|
{
|
||||||
|
m_pReadApi->close();
|
||||||
|
delete m_pReadApi;
|
||||||
|
}
|
||||||
|
m_pReadApi = Q_NULLPTR;
|
||||||
|
m_pInstance = Q_NULLPTR;
|
||||||
|
}
|
||||||
|
|
||||||
|
ChanInfoMap CDataMng::getChanInfo()
|
||||||
|
{
|
||||||
|
if(!m_chanHaveLoad)
|
||||||
|
{
|
||||||
|
m_chanMap.clear();
|
||||||
|
QSqlQuery sqlQueue;
|
||||||
|
m_pReadApi->execute("SELECT TAG_NAME,CHAN_NO,DESCRIPTION,RES_PARA_INT4 FROM fes_channel_para ORDER BY CHAN_NO", sqlQueue);
|
||||||
|
if(sqlQueue.isActive())
|
||||||
|
{
|
||||||
|
while(sqlQueue.next())
|
||||||
|
{
|
||||||
|
//采用下标方式,提高效率,注意与SELECT语句顺序对应
|
||||||
|
QString tagName = sqlQueue.value(0).toString();
|
||||||
|
int chanNo = sqlQueue.value(1).toInt();
|
||||||
|
QString chanDesc = sqlQueue.value(2).toString();
|
||||||
|
int res_para_int4 = sqlQueue.value(3).toInt();
|
||||||
|
|
||||||
|
SFESCHANINFO &fesChan = m_chanMap[chanNo];
|
||||||
|
fesChan.nChanNo = chanNo;
|
||||||
|
fesChan.strTagName = tagName;
|
||||||
|
fesChan.strDesc = chanDesc;
|
||||||
|
fesChan.nLocalPort = res_para_int4;
|
||||||
|
}
|
||||||
|
m_chanHaveLoad = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return m_chanMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDataMng::loadAllDevInfo(const bool bForceLoad/*= false*/)
|
||||||
|
{
|
||||||
|
if(bForceLoad)
|
||||||
|
{
|
||||||
|
m_rtuDevMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!m_rtuDevMap.empty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QSqlQuery sqlQueue;
|
||||||
|
m_pReadApi->execute("SELECT RTU_NO,TAG_NAME,DEV_NAME,DEV_DESC FROM fes_dev_info", sqlQueue);
|
||||||
|
if(sqlQueue.isActive())
|
||||||
|
{
|
||||||
|
while(sqlQueue.next())
|
||||||
|
{
|
||||||
|
//采用下标方式,提高效率,注意与SELECT语句顺序对应
|
||||||
|
int rtuNo = sqlQueue.value(0).toInt();
|
||||||
|
QString tagName = sqlQueue.value(1).toString();
|
||||||
|
QString devName = sqlQueue.value(2).toString();
|
||||||
|
QString devDesc = sqlQueue.value(3).toString();
|
||||||
|
|
||||||
|
SFESDEVINFO &devInfo = m_rtuDevMap[rtuNo][tagName];
|
||||||
|
devInfo.nRtuNo = rtuNo;
|
||||||
|
devInfo.strTagName = tagName;
|
||||||
|
devInfo.strDevName = devName;
|
||||||
|
devInfo.strDesc = devDesc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RtuDevMap CDataMng::getDevInfo()
|
||||||
|
{
|
||||||
|
return m_rtuDevMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
const RtuDevMap &CDataMng::getDevInfoRef()
|
||||||
|
{
|
||||||
|
return m_rtuDevMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDataMng::loadAiInfo(const int nRtuNo, const bool bForceLoad)
|
||||||
|
{
|
||||||
|
if(nRtuNo < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
loadAllDevInfo();
|
||||||
|
|
||||||
|
if(bForceLoad)
|
||||||
|
{
|
||||||
|
m_rtuAiPointMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_rtuAiPointMap.count(nRtuNo))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MaxAndMinPointNo mapDev2MaxMinPntNo; //记录设备的最大点号和最小点号
|
||||||
|
|
||||||
|
QSqlQuery sqlQueue;
|
||||||
|
QString strSQL = QString("SELECT DOT_NO,RTU_NO,TAG_NAME,DESCRIPTION,APP_TAG_NAME,RES_PARA_INT1,DEV_TAG FROM fes_analog WHERE RTU_NO=%1").arg(nRtuNo);
|
||||||
|
|
||||||
|
m_pReadApi->execute(strSQL, sqlQueue);
|
||||||
|
if(sqlQueue.isActive())
|
||||||
|
{
|
||||||
|
while(sqlQueue.next())
|
||||||
|
{
|
||||||
|
//采用下标方式,提高效率,注意与SELECT语句顺序对应
|
||||||
|
int pointNo = sqlQueue.value(0).toInt();
|
||||||
|
int rtuNo = sqlQueue.value(1).toInt();
|
||||||
|
QString tagName = sqlQueue.value(2).toString();
|
||||||
|
QString tagDesc = sqlQueue.value(3).toString();
|
||||||
|
QString appTagName = sqlQueue.value(4).toString();
|
||||||
|
int resPara = sqlQueue.value(5).toInt();
|
||||||
|
QString devTag =sqlQueue.value(6).toString();
|
||||||
|
|
||||||
|
SFESPOINTINFO &pointInfo = m_rtuAiPointMap[rtuNo][pointNo];
|
||||||
|
pointInfo.nDotNo = pointNo;
|
||||||
|
pointInfo.nRtuNo = rtuNo;
|
||||||
|
pointInfo.strTagName = tagName;
|
||||||
|
pointInfo.strDesc = tagDesc;
|
||||||
|
pointInfo.strAppTagName = appTagName;
|
||||||
|
pointInfo.nRespPara = resPara;
|
||||||
|
pointInfo.strDevTag = devTag;
|
||||||
|
pointInfo.strDevDesc = m_rtuDevMap.value(rtuNo).value(devTag).strDesc;
|
||||||
|
|
||||||
|
SFESDEVMAXANDMINPOINTNO & maxminNo = mapDev2MaxMinPntNo[devTag];
|
||||||
|
if(pointNo > maxminNo.maxPointNo)
|
||||||
|
{
|
||||||
|
maxminNo.maxPointNo = pointNo;
|
||||||
|
}
|
||||||
|
if(pointNo < maxminNo.minPointNo)
|
||||||
|
{
|
||||||
|
maxminNo.minPointNo = pointNo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!mapDev2MaxMinPntNo.empty())
|
||||||
|
{
|
||||||
|
m_rtuAiMaxMinNo[nRtuNo].swap(mapDev2MaxMinPntNo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const RtuPointMap &CDataMng::getAiInfoRef()
|
||||||
|
{
|
||||||
|
return m_rtuAiPointMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDataMng::loadDiInfo(const int nRtuNo, const bool bForceLoad)
|
||||||
|
{
|
||||||
|
if(nRtuNo < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
loadAllDevInfo();
|
||||||
|
|
||||||
|
if(bForceLoad)
|
||||||
|
{
|
||||||
|
m_rtuDiPointMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_rtuDiPointMap.count(nRtuNo))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MaxAndMinPointNo mapDev2MaxMinPntNo; //记录设备的最大点号和最小点号
|
||||||
|
QSqlQuery sqlQueue;
|
||||||
|
QString strSQL = QString("SELECT DOT_NO,RTU_NO,TAG_NAME,DESCRIPTION,APP_TAG_NAME,RES_PARA_INT1,DEV_TAG FROM fes_digital WHERE RTU_NO=%1").arg(nRtuNo);
|
||||||
|
|
||||||
|
m_pReadApi->execute(strSQL, sqlQueue);
|
||||||
|
if(sqlQueue.isActive())
|
||||||
|
{
|
||||||
|
while(sqlQueue.next())
|
||||||
|
{
|
||||||
|
//采用下标方式,提高效率,注意与SELECT语句顺序对应
|
||||||
|
int pointNo = sqlQueue.value(0).toInt();
|
||||||
|
int rtuNo = sqlQueue.value(1).toInt();
|
||||||
|
QString tagName = sqlQueue.value(2).toString();
|
||||||
|
QString tagDesc = sqlQueue.value(3).toString();
|
||||||
|
QString appTagName = sqlQueue.value(4).toString();
|
||||||
|
int resPara = sqlQueue.value(5).toInt();
|
||||||
|
QString devTag =sqlQueue.value(6).toString();
|
||||||
|
|
||||||
|
SFESPOINTINFO &pointInfo = m_rtuDiPointMap[rtuNo][pointNo];
|
||||||
|
pointInfo.nDotNo = pointNo;
|
||||||
|
pointInfo.nRtuNo = rtuNo;
|
||||||
|
pointInfo.strTagName = tagName;
|
||||||
|
pointInfo.strDesc = tagDesc;
|
||||||
|
pointInfo.strAppTagName = appTagName;
|
||||||
|
pointInfo.nRespPara = resPara;
|
||||||
|
pointInfo.strDevTag = devTag;
|
||||||
|
pointInfo.strDevDesc = m_rtuDevMap.value(rtuNo).value(devTag).strDesc;
|
||||||
|
|
||||||
|
SFESDEVMAXANDMINPOINTNO & maxminNo = mapDev2MaxMinPntNo[devTag];
|
||||||
|
if(pointNo > maxminNo.maxPointNo)
|
||||||
|
{
|
||||||
|
maxminNo.maxPointNo = pointNo;
|
||||||
|
}
|
||||||
|
if(pointNo < maxminNo.minPointNo)
|
||||||
|
{
|
||||||
|
maxminNo.minPointNo = pointNo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!mapDev2MaxMinPntNo.empty())
|
||||||
|
{
|
||||||
|
m_rtuDiMaxMinNo[nRtuNo].swap(mapDev2MaxMinPntNo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const RtuPointMap &CDataMng::getDiInfoRef()
|
||||||
|
{
|
||||||
|
return m_rtuDiPointMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
const RtuMaxAndMinPointNo &CDataMng::getDiMaxMinNoRef()
|
||||||
|
{
|
||||||
|
return m_rtuDiMaxMinNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDataMng::loadAccInfo(const int nRtuNo, const bool bForceLoad)
|
||||||
|
{
|
||||||
|
if(nRtuNo < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
loadAllDevInfo();
|
||||||
|
|
||||||
|
if(bForceLoad)
|
||||||
|
{
|
||||||
|
m_rtuPiPointMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_rtuPiPointMap.count(nRtuNo))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MaxAndMinPointNo mapDev2MaxMinPntNo; //记录设备的最大点号和最小点号
|
||||||
|
QSqlQuery sqlQueue;
|
||||||
|
QString strSQL = QString("SELECT DOT_NO,RTU_NO,TAG_NAME,DESCRIPTION,APP_TAG_NAME,RES_PARA_INT1,DEV_TAG FROM fes_accuml WHERE RTU_NO=%1").arg(nRtuNo);
|
||||||
|
|
||||||
|
m_pReadApi->execute(strSQL, sqlQueue);
|
||||||
|
if(sqlQueue.isActive())
|
||||||
|
{
|
||||||
|
while(sqlQueue.next())
|
||||||
|
{
|
||||||
|
//采用下标方式,提高效率,注意与SELECT语句顺序对应
|
||||||
|
int pointNo = sqlQueue.value(0).toInt();
|
||||||
|
int rtuNo = sqlQueue.value(1).toInt();
|
||||||
|
QString tagName = sqlQueue.value(2).toString();
|
||||||
|
QString tagDesc = sqlQueue.value(3).toString();
|
||||||
|
QString appTagName = sqlQueue.value(4).toString();
|
||||||
|
int resPara = sqlQueue.value(5).toInt();
|
||||||
|
QString devTag =sqlQueue.value(6).toString();
|
||||||
|
|
||||||
|
SFESPOINTINFO &pointInfo = m_rtuPiPointMap[rtuNo][pointNo];
|
||||||
|
pointInfo.nDotNo = pointNo;
|
||||||
|
pointInfo.nRtuNo = rtuNo;
|
||||||
|
pointInfo.strTagName = tagName;
|
||||||
|
pointInfo.strDesc = tagDesc;
|
||||||
|
pointInfo.strAppTagName = appTagName;
|
||||||
|
pointInfo.nRespPara = resPara;
|
||||||
|
pointInfo.strDevTag = devTag;
|
||||||
|
pointInfo.strDevDesc = m_rtuDevMap.value(rtuNo).value(devTag).strDesc;
|
||||||
|
|
||||||
|
SFESDEVMAXANDMINPOINTNO & maxminNo = mapDev2MaxMinPntNo[devTag];
|
||||||
|
if(pointNo > maxminNo.maxPointNo)
|
||||||
|
{
|
||||||
|
maxminNo.maxPointNo = pointNo;
|
||||||
|
}
|
||||||
|
if(pointNo < maxminNo.minPointNo)
|
||||||
|
{
|
||||||
|
maxminNo.minPointNo = pointNo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!mapDev2MaxMinPntNo.empty())
|
||||||
|
{
|
||||||
|
m_rtuPiMaxMinNo[nRtuNo].swap(mapDev2MaxMinPntNo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const RtuPointMap &CDataMng::getAccInfoRef()
|
||||||
|
{
|
||||||
|
return m_rtuPiPointMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
const RtuMaxAndMinPointNo &CDataMng::getAccMaxMinNoRef()
|
||||||
|
{
|
||||||
|
return m_rtuPiMaxMinNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDataMng::loadMiInfo(const int nRtuNo, const bool bForceLoad)
|
||||||
|
{
|
||||||
|
if(nRtuNo < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
loadAllDevInfo();
|
||||||
|
|
||||||
|
if(bForceLoad)
|
||||||
|
{
|
||||||
|
m_rtuMiPointMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_rtuMiPointMap.count(nRtuNo))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MaxAndMinPointNo mapDev2MaxMinPntNo; //记录设备的最大点号和最小点号
|
||||||
|
QString strSQL = QString("SELECT DOT_NO,RTU_NO,TAG_NAME,DESCRIPTION,APP_TAG_NAME,RES_PARA_INT1,DEV_TAG FROM fes_mix WHERE RTU_NO=%1").arg(nRtuNo);
|
||||||
|
QSqlQuery sqlQueue;
|
||||||
|
|
||||||
|
m_pReadApi->execute(strSQL, sqlQueue);
|
||||||
|
if(sqlQueue.isActive())
|
||||||
|
{
|
||||||
|
while(sqlQueue.next())
|
||||||
|
{
|
||||||
|
//采用下标方式,提高效率,注意与SELECT语句顺序对应
|
||||||
|
int pointNo = sqlQueue.value(0).toInt();
|
||||||
|
int rtuNo = sqlQueue.value(1).toInt();
|
||||||
|
QString tagName = sqlQueue.value(2).toString();
|
||||||
|
QString tagDesc = sqlQueue.value(3).toString();
|
||||||
|
QString appTagName = sqlQueue.value(4).toString();
|
||||||
|
int resPara = sqlQueue.value(5).toInt();
|
||||||
|
QString devTag =sqlQueue.value(6).toString();
|
||||||
|
|
||||||
|
SFESPOINTINFO &pointInfo = m_rtuMiPointMap[rtuNo][pointNo];
|
||||||
|
pointInfo.nDotNo = pointNo;
|
||||||
|
pointInfo.nRtuNo = rtuNo;
|
||||||
|
pointInfo.strTagName = tagName;
|
||||||
|
pointInfo.strDesc = tagDesc;
|
||||||
|
pointInfo.strAppTagName = appTagName;
|
||||||
|
pointInfo.nRespPara = resPara;
|
||||||
|
pointInfo.strDevTag = devTag;
|
||||||
|
pointInfo.strDevDesc = m_rtuDevMap.value(rtuNo).value(devTag).strDesc;
|
||||||
|
|
||||||
|
SFESDEVMAXANDMINPOINTNO & maxminNo = mapDev2MaxMinPntNo[devTag];
|
||||||
|
if(pointNo > maxminNo.maxPointNo)
|
||||||
|
{
|
||||||
|
maxminNo.maxPointNo = pointNo;
|
||||||
|
}
|
||||||
|
if(pointNo < maxminNo.minPointNo)
|
||||||
|
{
|
||||||
|
maxminNo.minPointNo = pointNo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!mapDev2MaxMinPntNo.empty())
|
||||||
|
{
|
||||||
|
m_rtuMiMaxMinNo[nRtuNo].swap(mapDev2MaxMinPntNo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const RtuPointMap &CDataMng::getMiInfoRef()
|
||||||
|
{
|
||||||
|
return m_rtuMiPointMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
const RtuMaxAndMinPointNo &CDataMng::getMiMaxMinNoRef()
|
||||||
|
{
|
||||||
|
return m_rtuMiMaxMinNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDataMng::loadAoInfo(const int nRtuNo, const bool bForceLoad)
|
||||||
|
{
|
||||||
|
if(nRtuNo < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
loadAllDevInfo();
|
||||||
|
|
||||||
|
if(bForceLoad)
|
||||||
|
{
|
||||||
|
m_rtuAoPointMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_rtuAoPointMap.count(nRtuNo))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString strSQL = QString("SELECT DOT_NO,RTU_NO,TAG_NAME,DESCRIPTION,RES_PARA_INT1,DEV_TAG FROM fes_analog_ctrl WHERE RTU_NO=%1").arg(nRtuNo);
|
||||||
|
QSqlQuery sqlQueue;
|
||||||
|
m_pReadApi->execute(strSQL, sqlQueue);
|
||||||
|
if(sqlQueue.isActive())
|
||||||
|
{
|
||||||
|
while(sqlQueue.next())
|
||||||
|
{
|
||||||
|
//采用下标方式,提高效率,注意与SELECT语句顺序对应
|
||||||
|
int pointNo = sqlQueue.value(0).toInt();
|
||||||
|
int rtuNo = sqlQueue.value(1).toInt();
|
||||||
|
QString tagName = sqlQueue.value(2).toString();
|
||||||
|
QString tagDesc = sqlQueue.value(3).toString();
|
||||||
|
int resPara = sqlQueue.value(4).toInt();
|
||||||
|
QString devTag =sqlQueue.value(5).toString();
|
||||||
|
|
||||||
|
SFESPOINTINFO &pointInfo = m_rtuAoPointMap[rtuNo][pointNo];
|
||||||
|
pointInfo.nDotNo = pointNo;
|
||||||
|
pointInfo.nRtuNo = rtuNo;
|
||||||
|
pointInfo.strTagName = tagName;
|
||||||
|
pointInfo.strDesc = tagDesc;
|
||||||
|
pointInfo.nRespPara = resPara;
|
||||||
|
pointInfo.strDevTag = devTag;
|
||||||
|
pointInfo.strDevDesc = m_rtuDevMap.value(rtuNo).value(devTag).strDesc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const RtuPointMap &CDataMng::getAoInfoRef()
|
||||||
|
{
|
||||||
|
return m_rtuAoPointMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDataMng::loadDoInfo(const int nRtuNo, const bool bForceLoad)
|
||||||
|
{
|
||||||
|
if(nRtuNo < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
loadAllDevInfo();
|
||||||
|
|
||||||
|
if(bForceLoad)
|
||||||
|
{
|
||||||
|
m_rtuDoPointMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_rtuDoPointMap.count(nRtuNo))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString strSQL = QString("SELECT DOT_NO,RTU_NO,TAG_NAME,DESCRIPTION,RES_PARA_INT1,DEV_TAG FROM fes_digital_ctrl WHERE RTU_NO=%1").arg(nRtuNo);
|
||||||
|
QSqlQuery sqlQueue;
|
||||||
|
m_pReadApi->execute(strSQL, sqlQueue);
|
||||||
|
if(sqlQueue.isActive())
|
||||||
|
{
|
||||||
|
while(sqlQueue.next())
|
||||||
|
{
|
||||||
|
//采用下标方式,提高效率,注意与SELECT语句顺序对应
|
||||||
|
int pointNo = sqlQueue.value(0).toInt();
|
||||||
|
int rtuNo = sqlQueue.value(1).toInt();
|
||||||
|
QString tagName = sqlQueue.value(2).toString();
|
||||||
|
QString tagDesc = sqlQueue.value(3).toString();
|
||||||
|
int resPara = sqlQueue.value(4).toInt();
|
||||||
|
QString devTag =sqlQueue.value(5).toString();
|
||||||
|
|
||||||
|
SFESPOINTINFO &pointInfo = m_rtuDoPointMap[rtuNo][pointNo];
|
||||||
|
pointInfo.nDotNo = pointNo;
|
||||||
|
pointInfo.nRtuNo = rtuNo;
|
||||||
|
pointInfo.strTagName = tagName;
|
||||||
|
pointInfo.strDesc = tagDesc;
|
||||||
|
pointInfo.nRespPara = resPara;
|
||||||
|
pointInfo.strDevTag = devTag;
|
||||||
|
pointInfo.strDevDesc = m_rtuDevMap.value(rtuNo).value(devTag).strDesc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const RtuPointMap &CDataMng::getDoInfoRef()
|
||||||
|
{
|
||||||
|
return m_rtuDoPointMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDataMng::loadMoInfo(const int nRtuNo, const bool bForceLoad)
|
||||||
|
{
|
||||||
|
if(nRtuNo < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
loadAllDevInfo();
|
||||||
|
|
||||||
|
if(bForceLoad)
|
||||||
|
{
|
||||||
|
m_rtuMoPointMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_rtuMoPointMap.count(nRtuNo))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString strSQL = QString("SELECT DOT_NO,RTU_NO,TAG_NAME,DESCRIPTION,RES_PARA_INT1,DEV_TAG FROM fes_mix_ctrl WHERE RTU_NO=%1").arg(nRtuNo);
|
||||||
|
QSqlQuery sqlQueue;
|
||||||
|
|
||||||
|
m_pReadApi->execute(strSQL, sqlQueue);
|
||||||
|
if(sqlQueue.isActive())
|
||||||
|
{
|
||||||
|
while(sqlQueue.next())
|
||||||
|
{
|
||||||
|
//采用下标方式,提高效率,注意与SELECT语句顺序对应
|
||||||
|
int pointNo = sqlQueue.value(0).toInt();
|
||||||
|
int rtuNo = sqlQueue.value(1).toInt();
|
||||||
|
QString tagName = sqlQueue.value(2).toString();
|
||||||
|
QString tagDesc = sqlQueue.value(3).toString();
|
||||||
|
int resPara = sqlQueue.value(4).toInt();
|
||||||
|
QString devTag =sqlQueue.value(5).toString();
|
||||||
|
|
||||||
|
SFESPOINTINFO &pointInfo = m_rtuMoPointMap[rtuNo][pointNo];
|
||||||
|
pointInfo.nDotNo = pointNo;
|
||||||
|
pointInfo.nRtuNo = rtuNo;
|
||||||
|
pointInfo.strTagName = tagName;
|
||||||
|
pointInfo.strDesc = tagDesc;
|
||||||
|
pointInfo.nRespPara = resPara;
|
||||||
|
pointInfo.strDevTag = devTag;
|
||||||
|
pointInfo.strDevDesc = m_rtuDevMap.value(rtuNo).value(devTag).strDesc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const RtuPointMap &CDataMng::getMoInfoRef()
|
||||||
|
{
|
||||||
|
return m_rtuMoPointMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVector<FesAppName> CDataMng::getAppInfo()
|
||||||
|
{
|
||||||
|
m_appVec.clear();
|
||||||
|
QSqlQuery ret;
|
||||||
|
QString strSql = "SELECT APP_ID,TAG_NAME,DESCRIPTION FROM sys_model_app_info ORDER BY APP_ID";
|
||||||
|
m_pReadApi->execute(strSql,ret);
|
||||||
|
if(ret.isActive())
|
||||||
|
{
|
||||||
|
while(ret.next())
|
||||||
|
{
|
||||||
|
FesAppName fesApp;
|
||||||
|
fesApp.appId = ret.value("APP_ID").toInt();
|
||||||
|
fesApp.desc = ret.value("DESCRIPTION").toString();
|
||||||
|
fesApp.appName = ret.value("TAG_NAME").toString();
|
||||||
|
|
||||||
|
if(fesApp.appId > CN_AppId_COMAPP)
|
||||||
|
{
|
||||||
|
m_appVec.append(fesApp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return m_appVec;
|
||||||
|
}
|
||||||
|
|
||||||
|
const RtuMaxAndMinPointNo &CDataMng::getAiMaxMinNoRef()
|
||||||
|
{
|
||||||
|
return m_rtuAiMaxMinNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
CDataMng::CDataMng():QObject(),
|
||||||
|
m_pReadApi(Q_NULLPTR),
|
||||||
|
m_chanHaveLoad(false)
|
||||||
|
{
|
||||||
|
m_pReadApi = new iot_dbms::CDbApi(DB_CONN_MODEL_READ);
|
||||||
|
m_pReadApi->open();
|
||||||
|
}
|
||||||
185
product/src/tools/debug_tool_v2/CDataMng.h
Normal file
185
product/src/tools/debug_tool_v2/CDataMng.h
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
#ifndef CDATAMNG_H
|
||||||
|
#define CDATAMNG_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "toolCommon.h"
|
||||||
|
#include "db_api_ex/CDbApi.h"
|
||||||
|
|
||||||
|
class QMutex;
|
||||||
|
|
||||||
|
class CDataMng : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
static CDataMng * instance();
|
||||||
|
~CDataMng();
|
||||||
|
|
||||||
|
ChanInfoMap getChanInfo();
|
||||||
|
RtuDevMap getDevInfo();
|
||||||
|
void loadAllDevInfo(const bool bForceLoad = false);
|
||||||
|
const RtuDevMap& getDevInfoRef();
|
||||||
|
|
||||||
|
void loadAiInfo(const int nRtuNo,const bool bForceLoad = false);
|
||||||
|
const RtuPointMap& getAiInfoRef();
|
||||||
|
const RtuMaxAndMinPointNo& getAiMaxMinNoRef();
|
||||||
|
|
||||||
|
void loadDiInfo(const int nRtuNo,const bool bForceLoad = false);
|
||||||
|
const RtuPointMap& getDiInfoRef();
|
||||||
|
const RtuMaxAndMinPointNo& getDiMaxMinNoRef();
|
||||||
|
|
||||||
|
void loadAccInfo(const int nRtuNo,const bool bForceLoad = false);
|
||||||
|
const RtuPointMap& getAccInfoRef();
|
||||||
|
const RtuMaxAndMinPointNo& getAccMaxMinNoRef();
|
||||||
|
|
||||||
|
void loadMiInfo(const int nRtuNo,const bool bForceLoad = false);
|
||||||
|
const RtuPointMap& getMiInfoRef();
|
||||||
|
const RtuMaxAndMinPointNo& getMiMaxMinNoRef();
|
||||||
|
|
||||||
|
void loadAoInfo(const int nRtuNo,const bool bForceLoad = false);
|
||||||
|
const RtuPointMap& getAoInfoRef();
|
||||||
|
|
||||||
|
void loadDoInfo(const int nRtuNo,const bool bForceLoad = false);
|
||||||
|
const RtuPointMap& getDoInfoRef();
|
||||||
|
|
||||||
|
void loadMoInfo(const int nRtuNo,const bool bForceLoad = false);
|
||||||
|
const RtuPointMap& getMoInfoRef();
|
||||||
|
|
||||||
|
QVector<FesAppName> getAppInfo();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void signal_sendMsgToServer(const std::string &strMsg);
|
||||||
|
|
||||||
|
//FesParam
|
||||||
|
//通道状态 - 通道参数
|
||||||
|
void signal_chanParamResp(int nMsgType, const std::string &strBody);
|
||||||
|
//通道状态 - RTU参数
|
||||||
|
void signal_rtuParamResp(int nMsgType, const std::string &strBody);
|
||||||
|
|
||||||
|
//FesData
|
||||||
|
//前置数据 - 模拟量
|
||||||
|
void signal_aiRtuInfoResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_aiParamResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_aiValueResp(int nMsgType,const std::string &strBody);
|
||||||
|
//前置数据 - 数字量
|
||||||
|
void signal_diRtuInfoResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_diParamResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_diValueResp(int nMsgType,const std::string &strBody);
|
||||||
|
//前置数据 - 累积量
|
||||||
|
void signal_accRtuInfoResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_accParamResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_accValueResp(int nMsgType,const std::string &strBody);
|
||||||
|
//前置数据 - 混合量
|
||||||
|
void signal_miRtuInfoResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_miParamResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_miValueResp(int nMsgType,const std::string &strBody);
|
||||||
|
|
||||||
|
//数据仿真 - 模拟量
|
||||||
|
void signal_simAiRtuInfoResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simAiParamResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simAiValueResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simAiStartSimResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simAiStopSimResp(int nMsgType,const std::string &strBody);
|
||||||
|
|
||||||
|
//数据仿真 - 数字量
|
||||||
|
void signal_simDiRtuInfoResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simDiParamResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simDiValueResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simDiStartSimResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simDiStopSimResp(int nMsgType,const std::string &strBody);
|
||||||
|
|
||||||
|
//数据仿真 - 混合量
|
||||||
|
void signal_simMiRtuInfoResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simMiParamResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simMiValueResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simMiStartSimResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simMiStopSimResp(int nMsgType,const std::string &strBody);
|
||||||
|
|
||||||
|
//数据仿真 - 累积量
|
||||||
|
void signal_simAccRtuInfoResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simAccParamResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simAccValueResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simAccStartSimResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simAccStopSimResp(int nMsgType,const std::string &strBody);
|
||||||
|
|
||||||
|
//数据仿真 - 事件仿真
|
||||||
|
void signal_simEventRtuInfoResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simEventDiParamResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simEventCreateResp(int nMsgType,const std::string &strBody);
|
||||||
|
|
||||||
|
//控制仿真 - 模拟量
|
||||||
|
void signal_simAoRtuInfoResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simAoParamResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simAoControlResp(int nMsgType,const std::string &strBody);
|
||||||
|
|
||||||
|
//控制仿真 - 数字量
|
||||||
|
void signal_simDoRtuInfoResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simDoParamResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simDoControlResp(int nMsgType,const std::string &strBody);
|
||||||
|
|
||||||
|
//控制仿真 - 混合量
|
||||||
|
void signal_simMoRtuInfoResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simMoParamResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simMoControlResp(int nMsgType,const std::string &strBody);
|
||||||
|
|
||||||
|
//控制仿真 - 自定义命令
|
||||||
|
void signal_simDefCmdRtuInfoResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_simDefCmdControlResp(int nMsgType,const std::string &strBody);
|
||||||
|
|
||||||
|
//转发数据 - 模拟量
|
||||||
|
void signal_fwAiRtuInfoResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_fwAiParamResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_fwAiValueResp(int nMsgType,const std::string &strBody);
|
||||||
|
//转发数据 - 数字量(单位开关)
|
||||||
|
void signal_fwDiRtuInfoResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_fwDiParamResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_fwDiValueResp(int nMsgType,const std::string &strBody);
|
||||||
|
//转发数据 - 数字量(双位开关)
|
||||||
|
void signal_fwDDiRtuInfoResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_fwDDiParamResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_fwDDiValueResp(int nMsgType,const std::string &strBody);
|
||||||
|
//转发数据 - 混合量
|
||||||
|
void signal_fwMiRtuInfoResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_fwMiParamResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_fwMiValueResp(int nMsgType,const std::string &strBody);
|
||||||
|
//转发数据 - 累积量
|
||||||
|
void signal_fwAccRtuInfoResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_fwAccParamResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_fwAccValueResp(int nMsgType,const std::string &strBody);
|
||||||
|
|
||||||
|
//事件监视
|
||||||
|
void signal_soeEventResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_chanEventResp(int nMsgType,const std::string &strBody);
|
||||||
|
void signal_soeMemEventResp(int nMsgType,const std::string &strBody);
|
||||||
|
|
||||||
|
private:
|
||||||
|
CDataMng();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static CDataMng *m_pInstance;
|
||||||
|
iot_dbms::CDbApi *m_pReadApi;
|
||||||
|
bool m_chanHaveLoad;
|
||||||
|
|
||||||
|
RtuDevMap m_rtuDevMap;
|
||||||
|
RtuPointMap m_rtuAiPointMap;
|
||||||
|
RtuPointMap m_rtuDiPointMap;
|
||||||
|
RtuPointMap m_rtuPiPointMap;
|
||||||
|
RtuPointMap m_rtuMiPointMap;
|
||||||
|
|
||||||
|
RtuPointMap m_rtuAoPointMap;
|
||||||
|
RtuPointMap m_rtuDoPointMap;
|
||||||
|
RtuPointMap m_rtuMoPointMap;
|
||||||
|
|
||||||
|
ChanInfoMap m_chanMap;
|
||||||
|
|
||||||
|
RtuMaxAndMinPointNo m_rtuAiMaxMinNo;
|
||||||
|
RtuMaxAndMinPointNo m_rtuDiMaxMinNo;
|
||||||
|
RtuMaxAndMinPointNo m_rtuPiMaxMinNo;
|
||||||
|
RtuMaxAndMinPointNo m_rtuMiMaxMinNo;
|
||||||
|
RtuMaxAndMinPointNo m_rtuAoMaxMinNo;
|
||||||
|
RtuMaxAndMinPointNo m_rtuDoMaxMinNo;
|
||||||
|
RtuMaxAndMinPointNo m_rtuMoMaxMinNo;
|
||||||
|
|
||||||
|
QVector<FesAppName> m_appVec;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CDATAMNG_H
|
||||||
268
product/src/tools/debug_tool_v2/CDebugTool.cpp
Normal file
268
product/src/tools/debug_tool_v2/CDebugTool.cpp
Normal file
@ -0,0 +1,268 @@
|
|||||||
|
#include "CDebugTool.h"
|
||||||
|
#include "ui_CDebugTool.h"
|
||||||
|
#include <QIcon>
|
||||||
|
#include "CommonSheet.h"
|
||||||
|
#include "pub_utility_api/FileUtil.h"
|
||||||
|
|
||||||
|
CDebugTool::CDebugTool(CSystemResources *pSystemResources, QWidget *parent):
|
||||||
|
m_pSystemResources(pSystemResources),
|
||||||
|
CustomUiMainWindow(parent),
|
||||||
|
m_pFessim(NULL),
|
||||||
|
m_pUpdateThread(NULL),
|
||||||
|
m_pEventFormShow(NULL),
|
||||||
|
ui(new Ui::CDebugTool)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
//setMinimumSize(1200,755);
|
||||||
|
setWindowTitle(tr("工程调试工具"));
|
||||||
|
setWindowIcon(QIcon(":/debug_tool.ico"));
|
||||||
|
CommonSheet sheetStyle;
|
||||||
|
QString sheet;
|
||||||
|
if(sheetStyle.getSheet(sheet))
|
||||||
|
{
|
||||||
|
setStyleSheet(sheet);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
LOGERROR("MainWindow::initSheet():获取样式文件失败!");
|
||||||
|
}
|
||||||
|
initDebugTool();
|
||||||
|
|
||||||
|
setTitleWidget(ui->mainmenu);
|
||||||
|
connect(ui->tabWidget,&QTabWidget::currentChanged,this,&CDebugTool::changeTab);
|
||||||
|
}
|
||||||
|
|
||||||
|
CDebugTool::~CDebugTool()
|
||||||
|
{
|
||||||
|
//releaseResouce();
|
||||||
|
if(m_pUpdateThread)
|
||||||
|
{
|
||||||
|
delete m_pUpdateThread;
|
||||||
|
m_pUpdateThread =NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDebugTool::initDebugTool()
|
||||||
|
{
|
||||||
|
initLogSystem();
|
||||||
|
initVariable();
|
||||||
|
initView();
|
||||||
|
connectSignalSlot();
|
||||||
|
|
||||||
|
m_pUpdateThread->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CDebugTool::initVariable()
|
||||||
|
{
|
||||||
|
m_pRealDataSelect = new CRealDataSelect;
|
||||||
|
m_pRealDataWatch = new CRealDataWatch;
|
||||||
|
m_pRealDatabaseSelect = new CRealDatabaseSelect;
|
||||||
|
m_pRealDatabaseShow = new CRealDatabaseShow;
|
||||||
|
m_pUpdateThread = new CUpdateThread;
|
||||||
|
m_pEventFormShow = new CEventFormShow;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDebugTool::initView()
|
||||||
|
{
|
||||||
|
addRealData();
|
||||||
|
addRealAlarm();
|
||||||
|
addRealEvent();
|
||||||
|
addHistoryEvent();
|
||||||
|
addRealDataBase();
|
||||||
|
|
||||||
|
ui->splitter_2->setSizes(QList<int>()<<200<<900);
|
||||||
|
ui->splitter->setSizes(QList<int>()<<200<<900);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDebugTool::addRealData()
|
||||||
|
{
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->groupBox_1);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(m_pRealDataSelect, 0, 0, 1, 1);
|
||||||
|
m_pRealDataSelect->setSystemResources(m_pSystemResources);
|
||||||
|
m_pRealDataSelect->initSelect();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
gridLayout = new QGridLayout(ui->groupBox_2);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(m_pRealDataWatch, 0, 0, 1, 1);
|
||||||
|
m_pRealDataWatch->setSystemResources(m_pSystemResources);
|
||||||
|
m_pRealDataWatch->initWatch();
|
||||||
|
ui->textEdit_status->setToolTip("具体状态");
|
||||||
|
|
||||||
|
m_pRealDataSelect->setRealDataWatch(m_pRealDataWatch);
|
||||||
|
|
||||||
|
}
|
||||||
|
void CDebugTool::addRealAlarm()
|
||||||
|
{
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab);
|
||||||
|
ui->textEdit_status->setHidden(true);
|
||||||
|
ui->tab->setLayout(gridLayout);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(m_pEventFormShow, 0, 0, 1, 1);
|
||||||
|
m_pEventFormShow->setSystemResources(m_pSystemResources);
|
||||||
|
m_pEventFormShow->initRealModel();
|
||||||
|
//m_pEventFormShow->setSystemResources(m_pSystemResources);
|
||||||
|
// m_pAlarmFormShow->initSelect();
|
||||||
|
|
||||||
|
}
|
||||||
|
void CDebugTool::addRealEvent()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
void CDebugTool::addHistoryEvent()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
void CDebugTool::addRealDataBase()
|
||||||
|
{
|
||||||
|
QGridLayout *gridLayout4 = new QGridLayout(ui->groupBox_4);
|
||||||
|
gridLayout4->setSpacing(6);
|
||||||
|
gridLayout4->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout4->addWidget(m_pRealDatabaseSelect, 0, 0, 1, 1);
|
||||||
|
m_pRealDatabaseSelect->initRealDb(m_pSystemResources);
|
||||||
|
|
||||||
|
QGridLayout * gridLayout5 = new QGridLayout(ui->groupBox_5);
|
||||||
|
gridLayout5->setSpacing(6);
|
||||||
|
gridLayout5->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout5->addWidget(m_pRealDatabaseShow, 0, 0, 1, 1);
|
||||||
|
m_pRealDatabaseShow->initRealDatabaseShow(m_pSystemResources);
|
||||||
|
}
|
||||||
|
void CDebugTool::addNodeStatus()
|
||||||
|
{
|
||||||
|
// QGridLayout *gridLayout = new QGridLayout(ui->tab_nodeStatus);
|
||||||
|
// gridLayout->setSpacing(6);
|
||||||
|
// gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
// gridLayout->addWidget(m_pNodeStatus, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDebugTool::addFessim()
|
||||||
|
{
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab_fes);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(m_pFessim, 0, 0, 1, 1);
|
||||||
|
m_pFessim->Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDebugTool::initLogSystem()
|
||||||
|
{
|
||||||
|
// QString app = QString::fromStdString(CN_AppName_BASE);
|
||||||
|
// iot_public::StartLogSystem(app.toStdString().c_str(),CN_ProcName_debug_tool.c_str());
|
||||||
|
// LOGINFO("initLogSystem()成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDebugTool::initMsgBus()
|
||||||
|
{
|
||||||
|
//< 初始化消息总线库
|
||||||
|
if (!(iot_net::initMsgBus("debugToolAppName", "debugToolProcessName")))
|
||||||
|
{
|
||||||
|
qDebug() << "Initialize message bus failed, exit !" << endl;
|
||||||
|
LOGERROR("Initialize message bus failed, exit !");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug() << "Initialize message bus successed !" << endl;
|
||||||
|
LOGINFO("Initialize message bus successed !");
|
||||||
|
|
||||||
|
}
|
||||||
|
iot_service::CDpcdaForApp::initGlobalThread();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDebugTool::releaseResouce()
|
||||||
|
{
|
||||||
|
iot_service::CDpcdaForApp::releaseGlobalThread();
|
||||||
|
|
||||||
|
//< 释放消息总线库
|
||||||
|
iot_net::releaseMsgBus();
|
||||||
|
|
||||||
|
//< 停止日志系统
|
||||||
|
//iot_public::StopLogSystem();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDebugTool::connectSignalSlot()
|
||||||
|
{
|
||||||
|
connect(m_pRealDataSelect,SIGNAL(signal_addPoint(QString,uint,QString,uint,QString,QString,QString,QString,QString,QString,QString,int,QString)),
|
||||||
|
m_pRealDataWatch,SLOT(slot_addPoint(QString,uint,QString,uint,QString,QString,QString,QString,QString,QString,QString,int,QString)));
|
||||||
|
connect(m_pUpdateThread,SIGNAL(signal_updateAi(QString,float,uint)),
|
||||||
|
m_pRealDataWatch,SLOT(slot_updateAi(QString,float,uint)));
|
||||||
|
connect(m_pUpdateThread,SIGNAL(signal_updateDi(QString,int,uint)),
|
||||||
|
m_pRealDataWatch,SLOT(slot_updateDi(QString,int,uint)));
|
||||||
|
connect(m_pUpdateThread,SIGNAL(signal_updatePi(QString,double,uint)),
|
||||||
|
m_pRealDataWatch,SLOT(slot_updatePi(QString,double,uint)));
|
||||||
|
connect(m_pUpdateThread,SIGNAL(signal_updateMi(QString,int,uint)),
|
||||||
|
m_pRealDataWatch,SLOT(slot_updateMi(QString,int,uint)));
|
||||||
|
connect(m_pRealDatabaseSelect,SIGNAL(signal_showTable(QString,QVector<QString>*,int,int,int,int,QMap<int,bool>,QString,QString)),
|
||||||
|
m_pRealDatabaseShow,SLOT(slot_showTable(QString,QVector<QString>*,int,int,int,int,QMap<int,bool>,QString,QString)));
|
||||||
|
connect(m_pRealDatabaseSelect,SIGNAL(signal_showOrHideColumn(int,int)),
|
||||||
|
m_pRealDatabaseShow,SLOT(slot_showOrHindColumn(int,int)));
|
||||||
|
connect(m_pRealDataWatch,SIGNAL(signal_selectTextEdit(QString ,QString , int )),
|
||||||
|
this,SLOT(slot_selectTextEdit(QString,QString, int )));
|
||||||
|
connect(m_pRealDataWatch,SIGNAL(signal_paging()),m_pRealDataSelect,SLOT(slot_paging()));
|
||||||
|
connect(m_pRealDatabaseShow,SIGNAL(signal_selectTextEdit(QString)),
|
||||||
|
this,SLOT(slot_selectTextEdit(QString)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDebugTool::changeTab(int index)
|
||||||
|
{
|
||||||
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
ui->textEdit_status->setHidden(true);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
ui->textEdit_status->setHidden(false);
|
||||||
|
break;
|
||||||
|
case 2:{
|
||||||
|
ui->textEdit_status->setHidden(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
{
|
||||||
|
ui->textEdit_status->setHidden(true);
|
||||||
|
if(m_pFessim == NULL)
|
||||||
|
{
|
||||||
|
m_pFessim = new CFessim;
|
||||||
|
addFessim();
|
||||||
|
}
|
||||||
|
//此处判断是否连接 若连接 则不做处理 若断开状态 则直接调用连接
|
||||||
|
if(!m_pFessim->isConnect())
|
||||||
|
{
|
||||||
|
if(!m_pFessim->slot_connect())
|
||||||
|
{
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
int index = m_pFessim->getCurrentIndex();
|
||||||
|
m_pFessim->setActiveWindow(index);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDebugTool::slot_selectTextEdit(QString allStatus, QString m_allName, int m_value)
|
||||||
|
{
|
||||||
|
ui->textEdit_status->setReadOnly(true);
|
||||||
|
ui->textEdit_status->setText("当前标签为"+m_allName+", 值为"
|
||||||
|
+QString::number(m_value)+", 状态为"
|
||||||
|
+allStatus);
|
||||||
|
|
||||||
|
}
|
||||||
|
void CDebugTool::slot_selectTextEdit(QString allQString)
|
||||||
|
{ ui->textEdit_status->setReadOnly(true);
|
||||||
|
ui->textEdit_status->setText(allQString);
|
||||||
|
}
|
||||||
83
product/src/tools/debug_tool_v2/CDebugTool.h
Normal file
83
product/src/tools/debug_tool_v2/CDebugTool.h
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
#ifndef CDEBUGTOOL_H
|
||||||
|
#define CDEBUGTOOL_H
|
||||||
|
|
||||||
|
#include "CFessim.h"
|
||||||
|
#include "CNodeStatus.h"
|
||||||
|
#include "CRealDatabaseSelect.h"
|
||||||
|
#include "CRealDatabaseShow.h"
|
||||||
|
#include "CRealDataControl.h"
|
||||||
|
#include "CRealDataSelect.h"
|
||||||
|
#include "CRealDataWatch.h"
|
||||||
|
#include "CSystemResources.h"
|
||||||
|
#include "CUpdateThread.h"
|
||||||
|
#include "CEventFormShow.h"
|
||||||
|
#include "pub_logger_api/logger.h"
|
||||||
|
#include "net_msg_bus_api/MsgBusApi.h"
|
||||||
|
#include "pub_widget/NcFramelessHelper.h"
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QGridLayout>
|
||||||
|
#include "pub_widget/CustomMainWindow.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CDebugTool;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CDebugTool : public CustomUiMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CDebugTool(CSystemResources *pSystemResources,QWidget *parent = 0);
|
||||||
|
~CDebugTool();
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
CSystemResources * m_pSystemResources;
|
||||||
|
|
||||||
|
CRealDataSelect * m_pRealDataSelect;
|
||||||
|
CRealDataWatch * m_pRealDataWatch;
|
||||||
|
CRealDatabaseSelect * m_pRealDatabaseSelect;
|
||||||
|
CRealDatabaseShow * m_pRealDatabaseShow;
|
||||||
|
CEventFormShow * m_pEventFormShow;
|
||||||
|
//CNodeStatus * m_pNodeStatus;
|
||||||
|
CFessim * m_pFessim;
|
||||||
|
CUpdateThread * m_pUpdateThread;
|
||||||
|
|
||||||
|
Ui::CDebugTool *ui;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// void loadStyle();
|
||||||
|
void initDebugTool();
|
||||||
|
|
||||||
|
void initVariable();
|
||||||
|
void initView();
|
||||||
|
|
||||||
|
void addRealData();
|
||||||
|
void addRealAlarm();
|
||||||
|
void addRealEvent();
|
||||||
|
void addHistoryEvent();
|
||||||
|
void addRealDataBase();
|
||||||
|
void addNodeStatus();
|
||||||
|
void addFessim();
|
||||||
|
|
||||||
|
void initMsgBus();
|
||||||
|
void initLogSystem();
|
||||||
|
|
||||||
|
void releaseResouce();
|
||||||
|
|
||||||
|
void connectSignalSlot();
|
||||||
|
private slots:
|
||||||
|
void changeTab(int index);
|
||||||
|
void slot_selectTextEdit(QString allStatus,QString m_allName, int m_value);
|
||||||
|
void slot_selectTextEdit(QString allQString);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CDEBUGTOOL_H
|
||||||
178
product/src/tools/debug_tool_v2/CDebugTool.ui
Normal file
178
product/src/tools/debug_tool_v2/CDebugTool.ui
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CDebugTool</class>
|
||||||
|
<widget class="QWidget" name="CDebugTool">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>800</width>
|
||||||
|
<height>500</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>CDebugTool</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<widget class="QLabel" name="mainmenu">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QWidget" name="memuForm" native="true"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="WorkFrame" name="work_widget" native="true">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tab">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<attribute name="title">
|
||||||
|
<string> 事件信息</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_realData">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>实时数据</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QSplitter" name="splitter_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<widget class="QGroupBox" name="groupBox_1">
|
||||||
|
<property name="title">
|
||||||
|
<string>测点选择</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>测点监控</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_rdbTable">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>实时库表</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QSplitter" name="splitter">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<widget class="QGroupBox" name="groupBox_4">
|
||||||
|
<property name="title">
|
||||||
|
<string>表选择</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QGroupBox" name="groupBox_5">
|
||||||
|
<property name="title">
|
||||||
|
<string>表内容</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_fes">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>前置数据</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2">
|
||||||
|
<widget class="QTextEdit" name="textEdit_status">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>WorkFrame</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>pub_widget/WorkFrame.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
893
product/src/tools/debug_tool_v2/CEventDataCollect.cpp
Normal file
893
product/src/tools/debug_tool_v2/CEventDataCollect.cpp
Normal file
@ -0,0 +1,893 @@
|
|||||||
|
#include "CEventDataCollect.h"
|
||||||
|
#include <QDateTime>
|
||||||
|
#include "pub_widget/MessageBox.h"
|
||||||
|
#include <QMutex>
|
||||||
|
#include <QThread>
|
||||||
|
#include "pub_logger_api/logger.h"
|
||||||
|
#include "net_msg_bus_api/MsgBusApi.h"
|
||||||
|
#include "public/pub_sysinfo_api/SysInfoApi.h"
|
||||||
|
#include "perm_mng_api/PermMngApi.h"
|
||||||
|
#include "CEventMsgManage.h"
|
||||||
|
|
||||||
|
//< 屏蔽xml_parser编译告警
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "boost/property_tree/xml_parser.hpp"
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "boost/typeof/typeof.hpp"
|
||||||
|
#include "boost/filesystem.hpp"
|
||||||
|
#include "Common.h"
|
||||||
|
#include "pub_utility_api/FileUtil.h"
|
||||||
|
#include "pub_utility_api/CharUtil.h"
|
||||||
|
#include "dbms/db_api_ex/CDbApi.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace iot_public;
|
||||||
|
using namespace iot_dbms;
|
||||||
|
|
||||||
|
CEventDataCollect * CEventDataCollect::m_pInstance = NULL;
|
||||||
|
CSystemResources *m_pSystemResources=NULL;
|
||||||
|
CEventDataCollect * CEventDataCollect::instance()
|
||||||
|
{
|
||||||
|
if(NULL == m_pInstance)
|
||||||
|
{
|
||||||
|
m_pInstance = new CEventDataCollect();
|
||||||
|
}
|
||||||
|
return m_pInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::setSystemResources(CSystemResources *pSystemResources)
|
||||||
|
{
|
||||||
|
if(m_pSystemResources==NULL){
|
||||||
|
m_pSystemResources=pSystemResources;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CEventDataCollect::CEventDataCollect()
|
||||||
|
: m_pTimer(NULL)
|
||||||
|
{
|
||||||
|
msgMutex = new QMutex();
|
||||||
|
//m_rtdbPriorityOrderAccess = new iot_dbms::CRdbAccess();
|
||||||
|
//m_rtdbPriorityOrderAccess->open("base", "alarm_level_define");
|
||||||
|
//m_rtdbAccess = new iot_dbms::CRdbAccess();
|
||||||
|
m_pTimer = new QTimer();
|
||||||
|
m_pTimer->setInterval(1000);
|
||||||
|
connect(m_pTimer, &QTimer::timeout, this, &CEventDataCollect::slotUpdateEvent);
|
||||||
|
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEventDataCollect::queryPriorityOrder(int &id)
|
||||||
|
{
|
||||||
|
int nRet = -1;
|
||||||
|
if ( m_priorityOrderMap.contains(id) )
|
||||||
|
nRet = m_priorityOrderMap[id];
|
||||||
|
return nRet;
|
||||||
|
|
||||||
|
// iot_dbms::CTableLockGuard locker(*m_rtdbPriorityOrderAccess);
|
||||||
|
// iot_dbms::CVarType value;
|
||||||
|
// m_rtdbPriorityOrderAccess->getColumnValueByKey((void*)&id, "priority_order", value);
|
||||||
|
// return value.toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
CEventDataCollect::~CEventDataCollect()
|
||||||
|
{
|
||||||
|
LOGDEBUG("CEventDataCollect::~CEventDataCollect()");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CEventDataCollect::initialize()
|
||||||
|
{
|
||||||
|
m_pTimer->start();
|
||||||
|
initVariable();;
|
||||||
|
iot_public::CSysInfoInterfacePtr spSysInfo;
|
||||||
|
if (iot_public::createSysInfoInstance(spSysInfo))
|
||||||
|
{
|
||||||
|
iot_public::SNodeInfo stNodeInfo;
|
||||||
|
spSysInfo->getLocalNodeInfo(stNodeInfo);
|
||||||
|
iot_public::SLocationInfo stLocationInfo;
|
||||||
|
spSysInfo->getLocationInfoById(stNodeInfo.nLocationId, stLocationInfo);
|
||||||
|
m_nLocationID = stNodeInfo.nLocationId;
|
||||||
|
}
|
||||||
|
loadEventConfig();
|
||||||
|
return resumeThread();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::release()
|
||||||
|
{
|
||||||
|
m_pTimer->stop();
|
||||||
|
suspendThread(true);
|
||||||
|
m_priorityOrderMap.clear();
|
||||||
|
m_priorityDescriptionMap.clear();
|
||||||
|
m_locationDescriptionMap.clear();
|
||||||
|
m_regionInfoDescriptionMap.clear();
|
||||||
|
m_alarmTypeDescriptionMap.clear();
|
||||||
|
m_deviceTypeDescriptionMap.clear();
|
||||||
|
m_subSystemDescriptionMap.clear();
|
||||||
|
m_areaInfoMap.clear();
|
||||||
|
m_areaLocMap.clear();
|
||||||
|
m_locationOrderList.clear();
|
||||||
|
|
||||||
|
CEventMsgManage::instance()->clearRTMsg();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::loadEventConfig()
|
||||||
|
{
|
||||||
|
loadPermInfo();
|
||||||
|
loadPriorityOrder();
|
||||||
|
loadPriorityDescription();
|
||||||
|
loadLocationDescription();
|
||||||
|
loadRegionInfoDescription();
|
||||||
|
loadAlarmTypeDescription();
|
||||||
|
loadDeviceTypeDescription();
|
||||||
|
loadAlarmStatusDescription();
|
||||||
|
loadEventShowStatusDescription();
|
||||||
|
loadEventOtherStatusDescription();
|
||||||
|
loadUserName();
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEventDataCollect::priorityId(const QString &description)
|
||||||
|
{
|
||||||
|
return m_priorityDescriptionMap.key(description, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEventDataCollect::locationId(const QString &description)
|
||||||
|
{
|
||||||
|
return m_locationDescriptionMap.key(description, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEventDataCollect::regionId(const QString &description)
|
||||||
|
{
|
||||||
|
return m_regionInfoDescriptionMap.key(description, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEventDataCollect::alarmTypeId(const QString &description)
|
||||||
|
{
|
||||||
|
return m_alarmTypeDescriptionMap.key(description, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEventDataCollect::eventStatusId(const QString &description)
|
||||||
|
{
|
||||||
|
return m_eventShowStatusMap.key(description, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEventDataCollect::deviceTypeId(const QString &description)
|
||||||
|
{
|
||||||
|
return m_deviceTypeDescriptionMap.key(description, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CEventDataCollect::priorityDescription(const int &id)
|
||||||
|
{
|
||||||
|
return m_priorityDescriptionMap.value(id, QString());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CEventDataCollect::locationDescription(const int &id)
|
||||||
|
{
|
||||||
|
return m_locationDescriptionMap.value(id, QString());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CEventDataCollect::regionDescription(const int &id)
|
||||||
|
{
|
||||||
|
return m_regionInfoDescriptionMap.value(id, QString());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CEventDataCollect::alarmTypeDescription(const int &id)
|
||||||
|
{
|
||||||
|
return m_alarmTypeDescriptionMap.value(id, QString());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CEventDataCollect::deviceTypeDescription(const int &id)
|
||||||
|
{
|
||||||
|
return m_deviceTypeDescriptionMap.value(id, QString());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CEventDataCollect::alarmStatusDescription(const int &id)
|
||||||
|
{
|
||||||
|
return m_alarmStatusMap.value(id, QString());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CEventDataCollect::userNameDescription(const int &id)
|
||||||
|
{
|
||||||
|
return m_userNameMap.value(id, QString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString CEventDataCollect::eventShowStatusDescription(const int &id)
|
||||||
|
{
|
||||||
|
return m_eventShowStatusMap.value(id, QString());
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<int> CEventDataCollect::priorityList()
|
||||||
|
{
|
||||||
|
return m_priorityDescriptionMap.keys();
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<int> CEventDataCollect::locationList()
|
||||||
|
{
|
||||||
|
return m_listPermLocationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<int> CEventDataCollect::regionList()
|
||||||
|
{
|
||||||
|
return m_listPermRegionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<int> CEventDataCollect::alarmTypeList()
|
||||||
|
{
|
||||||
|
return m_alarmTypeDescriptionMap.keys();
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<int> CEventDataCollect::alarmStatusList()
|
||||||
|
{
|
||||||
|
return m_eventShowStatusMap.keys();
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<int> CEventDataCollect::alarmOtherList()
|
||||||
|
{
|
||||||
|
return m_eventOtherStatusMap.keys();
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<int, SAreaInfo> CEventDataCollect::areaInfoMap()
|
||||||
|
{
|
||||||
|
return m_areaInfoMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<int, QVector<int> > CEventDataCollect::areaLocMap()
|
||||||
|
{
|
||||||
|
return m_areaLocMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<int> CEventDataCollect::locationOrderList()
|
||||||
|
{
|
||||||
|
return m_locationOrderList;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::loadPermInfo()
|
||||||
|
{
|
||||||
|
QSqlQuery locationTable;
|
||||||
|
m_pObjDbInterface->execute("SELECT LOCATION_ID FROM sys_model_location_info ORDER BY LOCATION_ID", locationTable);
|
||||||
|
if(locationTable.isActive())
|
||||||
|
{
|
||||||
|
QVariant val;
|
||||||
|
val.clear();
|
||||||
|
int locationId = -1;
|
||||||
|
while(locationTable.next())
|
||||||
|
{
|
||||||
|
val = locationTable.value("LOCATION_ID");
|
||||||
|
locationId = val.toInt();
|
||||||
|
m_listPermLocationId.append(locationId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QSqlQuery RegionTable;
|
||||||
|
m_pObjDbInterface->execute("SELECT REGION_ID FROM region_info ORDER BY REGION_ID", RegionTable);
|
||||||
|
if(RegionTable.isActive())
|
||||||
|
{
|
||||||
|
QVariant val;
|
||||||
|
val.clear();
|
||||||
|
int regionId = -1;
|
||||||
|
while(RegionTable.next())
|
||||||
|
{
|
||||||
|
val = RegionTable.value("REGION_ID");
|
||||||
|
regionId = val.toInt();
|
||||||
|
m_listPermRegionId.append(regionId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// iot_service::CPermMngApiPtr permMngPtr = iot_service::getPermMngInstance("base");
|
||||||
|
// if(permMngPtr != NULL)
|
||||||
|
// {
|
||||||
|
// permMngPtr->PermDllInit();
|
||||||
|
// std::vector <int> vecRegionId;
|
||||||
|
// std::vector <int> vecLocationId;
|
||||||
|
// m_listPermLocationId.clear();
|
||||||
|
// m_listPermRegionId.clear();
|
||||||
|
// if(PERM_NORMAL == permMngPtr->GetSpeFunc(FUNC_SPE_EVENT_VIEW, vecRegionId, vecLocationId))
|
||||||
|
// {
|
||||||
|
// std::vector <int>::iterator location = vecLocationId.begin();
|
||||||
|
// while (location != vecLocationId.end())
|
||||||
|
// {
|
||||||
|
// m_listPermLocationId.append(*location++);
|
||||||
|
// }
|
||||||
|
// std::vector <int>::iterator region = vecRegionId.begin();
|
||||||
|
// while (region != vecRegionId.end())
|
||||||
|
// {
|
||||||
|
// m_listPermRegionId.append(*region++);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::loadPriorityOrder()
|
||||||
|
{
|
||||||
|
m_priorityOrderMap.clear();
|
||||||
|
if ( !m_pObjDbInterface || !m_pObjDbInterface->isOpen() )
|
||||||
|
{
|
||||||
|
N_MessageBox::critical(qApp->activeWindow(),tr("错误"),tr("打开数据库失败"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QSqlQuery objQuery;
|
||||||
|
m_pObjDbInterface->execute("select priority_id,priority_order from alarm_level_define",objQuery);
|
||||||
|
while ( objQuery.next() )
|
||||||
|
m_priorityOrderMap[objQuery.value(0).toInt()] = objQuery.value(1).toInt();
|
||||||
|
objQuery.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::loadPriorityDescription()
|
||||||
|
{
|
||||||
|
m_priorityDescriptionMap.clear();
|
||||||
|
if ( !m_pObjDbInterface || !m_pObjDbInterface->isOpen() )
|
||||||
|
{
|
||||||
|
N_MessageBox::critical(qApp->activeWindow(),tr("错误"),tr("打开数据库失败"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QSqlQuery objQuery;
|
||||||
|
m_pObjDbInterface->execute("select priority_id,priority_name from alarm_level_define",objQuery);
|
||||||
|
while ( objQuery.next() )
|
||||||
|
m_priorityDescriptionMap[objQuery.value(0).toInt()] = objQuery.value(1).toString();
|
||||||
|
objQuery.clear();
|
||||||
|
|
||||||
|
// m_priorityDescriptionMap.clear();
|
||||||
|
// if(m_rtdbAccess->open("base", "alarm_level_define"))
|
||||||
|
// {
|
||||||
|
// iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||||
|
// iot_dbms::CRdbQueryResult result;
|
||||||
|
// std::vector<std::string> columns;
|
||||||
|
// columns.push_back("priority_id");
|
||||||
|
// columns.push_back("priority_name");
|
||||||
|
// if(m_rtdbAccess->select(result, columns))
|
||||||
|
// {
|
||||||
|
// for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||||
|
// {
|
||||||
|
// iot_dbms::CVarType key;
|
||||||
|
// iot_dbms::CVarType value;
|
||||||
|
// result.getColumnValue(nIndex, 0, key);
|
||||||
|
// result.getColumnValue(nIndex, 1, value);
|
||||||
|
// m_priorityDescriptionMap[key.toInt()] = QString::fromStdString(value.toStdString());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::loadLocationDescription()
|
||||||
|
{
|
||||||
|
m_areaInfoMap.clear();
|
||||||
|
if ( !m_pObjDbInterface || !m_pObjDbInterface->isOpen() )
|
||||||
|
{
|
||||||
|
N_MessageBox::critical(qApp->activeWindow(),tr("错误"),tr("打开数据库失败"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QSqlQuery objQuery;
|
||||||
|
m_pObjDbInterface->execute("select location_id,tag_name,description,location_type,plocation_id from sys_model_location_info order by location_no",objQuery);
|
||||||
|
while ( objQuery.next() )
|
||||||
|
{
|
||||||
|
SAreaInfo info;
|
||||||
|
info.nId = objQuery.value(0).toInt();
|
||||||
|
info.stTag = objQuery.value(1).toString();
|
||||||
|
info.stDes = objQuery.value(2).toString();
|
||||||
|
if ( objQuery.value(3).toInt() != (int)E_LOCATION_NODE )
|
||||||
|
info.eType = E_LOCATION_AREA;
|
||||||
|
else
|
||||||
|
info.eType = E_LOCATION_NODE;
|
||||||
|
info.nPareaId = objQuery.value(4).toInt();
|
||||||
|
m_areaInfoMap[info.nId] = info;
|
||||||
|
if(m_listPermLocationId.contains(info.nId))
|
||||||
|
{
|
||||||
|
m_locationOrderList.push_back(info.nId);
|
||||||
|
m_locationDescriptionMap[info.nId] = info.stDes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
objQuery.clear();
|
||||||
|
|
||||||
|
// m_areaInfoMap.clear();
|
||||||
|
// m_areaLocMap.clear();
|
||||||
|
// if(m_rtdbAccess->open("base", "sys_model_location_info"))
|
||||||
|
// {
|
||||||
|
// m_locationDescriptionMap.clear();
|
||||||
|
// m_locationOrderList.clear();
|
||||||
|
// iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||||
|
// iot_dbms::CRdbQueryResult result;
|
||||||
|
// std::vector<std::string> columns;
|
||||||
|
// columns.push_back("location_id");
|
||||||
|
// columns.push_back("tag_name");
|
||||||
|
// columns.push_back("description");
|
||||||
|
// columns.push_back("location_type");
|
||||||
|
// columns.push_back("plocation_id");
|
||||||
|
// std::string sOrderColumn = "location_no";
|
||||||
|
|
||||||
|
// if(m_rtdbAccess->select(result, columns, sOrderColumn))
|
||||||
|
// {
|
||||||
|
// for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||||
|
// {
|
||||||
|
// iot_dbms::CVarType area_id;
|
||||||
|
// iot_dbms::CVarType tag_name;
|
||||||
|
// iot_dbms::CVarType description;
|
||||||
|
// iot_dbms::CVarType area_type;
|
||||||
|
// iot_dbms::CVarType parea_id;
|
||||||
|
// result.getColumnValue(nIndex, 0, area_id);
|
||||||
|
// result.getColumnValue(nIndex, 1, tag_name);
|
||||||
|
// result.getColumnValue(nIndex, 2, description);
|
||||||
|
// result.getColumnValue(nIndex, 3, area_type);
|
||||||
|
// result.getColumnValue(nIndex, 4, parea_id);
|
||||||
|
// SAreaInfo info;
|
||||||
|
// info.nId =area_id.toInt();
|
||||||
|
// info.stTag =QString::fromStdString(tag_name.toStdString());
|
||||||
|
// info.stDes =QString::fromStdString(description.toStdString());
|
||||||
|
// if(area_type.toInt() != (int)E_LOCATION_NODE)
|
||||||
|
// {
|
||||||
|
// info.eType = E_LOCATION_AREA;
|
||||||
|
// }else
|
||||||
|
// {
|
||||||
|
// info.eType = E_LOCATION_NODE;
|
||||||
|
// }
|
||||||
|
// info.nPareaId =parea_id.toInt();
|
||||||
|
// m_areaInfoMap[info.nId] = info;
|
||||||
|
// if(m_listPermLocationId.contains(info.nId))
|
||||||
|
// {
|
||||||
|
// m_locationOrderList.push_back(info.nId);
|
||||||
|
// m_locationDescriptionMap[info.nId] = info.stDes;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
QMap<int,SAreaInfo>::iterator it= m_areaInfoMap.begin();
|
||||||
|
while (it != m_areaInfoMap.end()) {
|
||||||
|
if(m_listPermLocationId.contains(it.key()))
|
||||||
|
{
|
||||||
|
if(it.value().eType == (int)E_LOCATION_NODE)
|
||||||
|
{
|
||||||
|
QMap<int,QVector<int> >::iterator pos = m_areaLocMap.find(it.value().nPareaId);
|
||||||
|
if(pos == m_areaLocMap.end())
|
||||||
|
{
|
||||||
|
QVector<int> locVec;
|
||||||
|
locVec.append(it.value().nId);
|
||||||
|
m_areaLocMap.insert(it.value().nPareaId,locVec);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
QVector<int> &locVec = pos.value();
|
||||||
|
locVec.append(it.value().nId);
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
QMap<int,QVector<int> >::iterator pos = m_areaLocMap.find(it.key());
|
||||||
|
if(pos == m_areaLocMap.end())
|
||||||
|
{
|
||||||
|
QVector<int> locVec;
|
||||||
|
locVec.append(it.value().nId);
|
||||||
|
m_areaLocMap.insert(it.key(),locVec);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
QVector<int> &locVec = pos.value();
|
||||||
|
locVec.append(it.value().nId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::loadRegionInfoDescription()
|
||||||
|
{
|
||||||
|
m_regionInfoDescriptionMap.clear();
|
||||||
|
if ( !m_pObjDbInterface || !m_pObjDbInterface->isOpen() )
|
||||||
|
{
|
||||||
|
N_MessageBox::critical(qApp->activeWindow(),tr("错误"),tr("打开数据库失败"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QSqlQuery objQuery;
|
||||||
|
m_pObjDbInterface->execute("select region_id,description from region_info",objQuery);
|
||||||
|
while ( objQuery.next() )
|
||||||
|
{
|
||||||
|
if(m_listPermRegionId.contains(objQuery.value(0).toInt()))
|
||||||
|
m_regionInfoDescriptionMap[objQuery.value(0).toInt()] = objQuery.value(1).toString();
|
||||||
|
}
|
||||||
|
objQuery.clear();
|
||||||
|
|
||||||
|
// m_regionInfoDescriptionMap.clear();
|
||||||
|
// if(m_rtdbAccess->open("base", "region_info"))
|
||||||
|
// {
|
||||||
|
// iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||||
|
// iot_dbms::CRdbQueryResult result;
|
||||||
|
// std::vector<std::string> columns;
|
||||||
|
// columns.push_back("region_id");
|
||||||
|
// columns.push_back("description");
|
||||||
|
// if(m_rtdbAccess->select(result, columns))
|
||||||
|
// {
|
||||||
|
// for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||||
|
// {
|
||||||
|
// iot_dbms::CVarType key;
|
||||||
|
// iot_dbms::CVarType value;
|
||||||
|
// result.getColumnValue(nIndex, 0, key);
|
||||||
|
// result.getColumnValue(nIndex, 1, value);
|
||||||
|
// if(m_listPermRegionId.contains(key.toInt()))
|
||||||
|
// {
|
||||||
|
// m_regionInfoDescriptionMap[key.toInt()] = QString::fromStdString(value.toStdString());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::loadAlarmTypeDescription()
|
||||||
|
{
|
||||||
|
m_alarmTypeDescriptionMap.clear();
|
||||||
|
if ( !m_pObjDbInterface || !m_pObjDbInterface->isOpen() )
|
||||||
|
{
|
||||||
|
N_MessageBox::critical(qApp->activeWindow(),tr("错误"),tr("打开数据库失败"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QSqlQuery objQuery;
|
||||||
|
m_pObjDbInterface->execute("select type_id,type_name from alarm_type_define",objQuery);
|
||||||
|
while ( objQuery.next() )
|
||||||
|
m_alarmTypeDescriptionMap[objQuery.value(0).toInt()] = objQuery.value(1).toString();
|
||||||
|
objQuery.clear();
|
||||||
|
|
||||||
|
// m_alarmTypeDescriptionMap.clear();
|
||||||
|
// if(m_rtdbAccess->open("base", "alarm_type_define"))
|
||||||
|
// {
|
||||||
|
// iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||||
|
// iot_dbms::CRdbQueryResult result;
|
||||||
|
// std::vector<std::string> columns;
|
||||||
|
// columns.push_back("type_id");
|
||||||
|
// columns.push_back("type_name");
|
||||||
|
// if(m_rtdbAccess->select(result, columns))
|
||||||
|
// {
|
||||||
|
// for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||||
|
// {
|
||||||
|
// iot_dbms::CVarType key;
|
||||||
|
// iot_dbms::CVarType value;
|
||||||
|
// result.getColumnValue(nIndex, 0, key);
|
||||||
|
// result.getColumnValue(nIndex, 1, value);
|
||||||
|
// m_alarmTypeDescriptionMap[key.toInt()] = QString::fromStdString(value.toStdString());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::loadDeviceTypeDescription()
|
||||||
|
{
|
||||||
|
m_deviceTypeDescriptionMap.clear();
|
||||||
|
if ( !m_pObjDbInterface || !m_pObjDbInterface->isOpen() )
|
||||||
|
{
|
||||||
|
N_MessageBox::critical(qApp->activeWindow(),tr("错误"),tr("打开数据库失败"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QSqlQuery objQuery;
|
||||||
|
m_pObjDbInterface->execute("select dev_type_id,description from dev_type_def",objQuery);
|
||||||
|
while ( objQuery.next() )
|
||||||
|
m_deviceTypeDescriptionMap[objQuery.value(0).toInt()] = objQuery.value(1).toString();
|
||||||
|
objQuery.clear();
|
||||||
|
|
||||||
|
// m_deviceTypeDescriptionMap.clear();
|
||||||
|
// if(m_rtdbAccess->open("base", "dev_type_def"))
|
||||||
|
// {
|
||||||
|
// iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||||
|
// iot_dbms::CRdbQueryResult result;
|
||||||
|
// std::vector<std::string> columns;
|
||||||
|
// columns.push_back("dev_type_id");
|
||||||
|
// columns.push_back("description");
|
||||||
|
// if(m_rtdbAccess->select(result, columns))
|
||||||
|
// {
|
||||||
|
// for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||||
|
// {
|
||||||
|
// iot_dbms::CVarType key;
|
||||||
|
// iot_dbms::CVarType value;
|
||||||
|
// result.getColumnValue(nIndex, 0, key);
|
||||||
|
// result.getColumnValue(nIndex, 1, value);
|
||||||
|
// m_deviceTypeDescriptionMap[key.toInt()] = QString::fromStdString(value.toStdString());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::loadAlarmStatusDescription()
|
||||||
|
{
|
||||||
|
m_alarmStatusMap.clear();
|
||||||
|
if ( !m_pObjDbInterface || !m_pObjDbInterface->isOpen() )
|
||||||
|
{
|
||||||
|
N_MessageBox::critical(qApp->activeWindow(),tr("错误"),tr("打开数据库失败"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QSqlQuery objQuery;
|
||||||
|
m_pObjDbInterface->execute("select status_value,display_name from alarm_status_define",objQuery);
|
||||||
|
while ( objQuery.next() )
|
||||||
|
m_alarmStatusMap[objQuery.value(0).toInt()] = objQuery.value(1).toString();
|
||||||
|
objQuery.clear();
|
||||||
|
|
||||||
|
// m_alarmStatusMap.clear();
|
||||||
|
// if(m_rtdbAccess->open("base", "alarm_status_define"))
|
||||||
|
// {
|
||||||
|
// iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||||
|
// iot_dbms::CRdbQueryResult result;
|
||||||
|
// std::vector<std::string> columns;
|
||||||
|
// columns.push_back("status_value");
|
||||||
|
// columns.push_back("display_name");
|
||||||
|
|
||||||
|
// if(m_rtdbAccess->select(result, columns))
|
||||||
|
// {
|
||||||
|
// for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||||
|
// {
|
||||||
|
// iot_dbms::CVarType key;
|
||||||
|
// iot_dbms::CVarType value;
|
||||||
|
// result.getColumnValue(nIndex, 0, key);
|
||||||
|
// result.getColumnValue(nIndex, 1, value);
|
||||||
|
// m_alarmStatusMap[key.toInt()] = QString::fromStdString(value.toStdString());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::loadUserName()
|
||||||
|
{
|
||||||
|
m_userNameMap.clear();
|
||||||
|
if ( !m_pObjDbInterface || !m_pObjDbInterface->isOpen() )
|
||||||
|
{
|
||||||
|
N_MessageBox::critical(qApp->activeWindow(),tr("错误"),tr("打开数据库失败"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QSqlQuery objQuery;
|
||||||
|
m_pObjDbInterface->execute("select perm_id,perm_name from rm_user_def",objQuery);
|
||||||
|
while ( objQuery.next() )
|
||||||
|
m_userNameMap[objQuery.value(0).toInt()] = objQuery.value(1).toString();
|
||||||
|
objQuery.clear();
|
||||||
|
|
||||||
|
// m_userNameMap.clear();
|
||||||
|
// if(m_rtdbAccess->open("base", "rm_user_def"))
|
||||||
|
// {
|
||||||
|
// iot_dbms::CTableLockGuard locker(*m_rtdbAccess);
|
||||||
|
// iot_dbms::CRdbQueryResult result;
|
||||||
|
// std::vector<std::string> columns;
|
||||||
|
// columns.push_back("perm_id");
|
||||||
|
// columns.push_back("perm_name");
|
||||||
|
// if(m_rtdbAccess->select(result, columns))
|
||||||
|
// {
|
||||||
|
// for(int nIndex(0); nIndex < result.getRecordCount(); nIndex++)
|
||||||
|
// {
|
||||||
|
// iot_dbms::CVarType key;
|
||||||
|
// iot_dbms::CVarType value;
|
||||||
|
// result.getColumnValue(nIndex, 0, key);
|
||||||
|
// result.getColumnValue(nIndex, 1, value);
|
||||||
|
// m_userNameMap[key.toInt()] = QString::fromStdString(value.toStdString());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::loadEventShowStatusDescription()
|
||||||
|
{
|
||||||
|
const std::string strConfFullPath = iot_public::CFileUtil::getPathOfCfgFile("alarmStatus.xml");
|
||||||
|
boost::property_tree::ptree pt;
|
||||||
|
namespace xml = boost::property_tree::xml_parser;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
xml::read_xml(strConfFullPath, pt, xml::no_comments);
|
||||||
|
BOOST_AUTO(module, pt.get_child("root"));
|
||||||
|
for (BOOST_AUTO(pModuleIter, module.begin()); pModuleIter != module.end(); ++pModuleIter)
|
||||||
|
{
|
||||||
|
boost::property_tree::ptree ptParam = pModuleIter->second;
|
||||||
|
for (BOOST_AUTO(pParamIter, ptParam.begin()); pParamIter != ptParam.end(); ++pParamIter)
|
||||||
|
{
|
||||||
|
if (pParamIter->first == "param")
|
||||||
|
{
|
||||||
|
string strKey = pParamIter->second.get<string>("<xmlattr>.key");
|
||||||
|
//string strValue = pParamIter->second.get<string>("<xmlattr>.value");
|
||||||
|
if(StringToInt(strKey) != OTHERSTATUS)
|
||||||
|
{
|
||||||
|
m_eventShowStatusMap[StringToInt(strKey)] = m_alarmStatusMap[StringToInt(strKey)];
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
m_eventShowStatusMap[StringToInt(strKey)] = tr("其他");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (std::exception &ex)
|
||||||
|
{
|
||||||
|
LOGERROR("解析配置文件[%s]失败.Msg=[%s]", strConfFullPath.c_str(), ex.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::loadEventOtherStatusDescription()
|
||||||
|
{
|
||||||
|
m_eventOtherStatusMap.clear();
|
||||||
|
const std::string strConfFullPath = iot_public::CFileUtil::getPathOfCfgFile("alarmOther.xml");
|
||||||
|
boost::property_tree::ptree pt;
|
||||||
|
namespace xml = boost::property_tree::xml_parser;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
xml::read_xml(strConfFullPath, pt, xml::no_comments);
|
||||||
|
BOOST_AUTO(module, pt.get_child("root"));
|
||||||
|
for (BOOST_AUTO(pModuleIter, module.begin()); pModuleIter != module.end(); ++pModuleIter)
|
||||||
|
{
|
||||||
|
boost::property_tree::ptree ptParam = pModuleIter->second;
|
||||||
|
for (BOOST_AUTO(pParamIter, ptParam.begin()); pParamIter != ptParam.end(); ++pParamIter)
|
||||||
|
{
|
||||||
|
if (pParamIter->first == "param")
|
||||||
|
{
|
||||||
|
string strKey = pParamIter->second.get<string>("<xmlattr>.key");
|
||||||
|
//string strValue = pParamIter->second.get<string>("<xmlattr>.value");
|
||||||
|
m_eventOtherStatusMap[StringToInt(strKey)] = m_alarmStatusMap[StringToInt(strKey)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (std::exception &ex)
|
||||||
|
{
|
||||||
|
LOGERROR("解析配置文件[%s]失败.Msg=[%s]", strConfFullPath.c_str(), ex.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<int, QString> CEventDataCollect::priorityDescriptionMap()
|
||||||
|
{
|
||||||
|
return m_priorityDescriptionMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<int, QString> CEventDataCollect::locationDescriptionMap()
|
||||||
|
{
|
||||||
|
return m_locationDescriptionMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<int, QString> CEventDataCollect::regionInfoDescriptionMap()
|
||||||
|
{
|
||||||
|
return m_regionInfoDescriptionMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<int, QString> CEventDataCollect::alarmTypeDescriptionMap()
|
||||||
|
{
|
||||||
|
return m_alarmTypeDescriptionMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<int, QString> CEventDataCollect::deviceTypeDescriptionMap()
|
||||||
|
{
|
||||||
|
return m_deviceTypeDescriptionMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<int, QString> CEventDataCollect::alarmStatusMap()
|
||||||
|
{
|
||||||
|
return m_alarmStatusMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<int, QString> CEventDataCollect::userNameMap()
|
||||||
|
{
|
||||||
|
return m_userNameMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<int, QString> CEventDataCollect::eventShowStatusDescriptionMap()
|
||||||
|
{
|
||||||
|
return m_eventShowStatusMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<int, QString> CEventDataCollect::eventOtherStatusDescriptionMap()
|
||||||
|
{
|
||||||
|
return m_eventOtherStatusMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::slotUpdateEvent()
|
||||||
|
{
|
||||||
|
//loadEventConfig();
|
||||||
|
|
||||||
|
QMutexLocker locker(msgMutex);
|
||||||
|
|
||||||
|
if(!m_listEventCache.isEmpty())
|
||||||
|
{
|
||||||
|
emit sigMsgArrived(m_listEventCache);
|
||||||
|
m_listEventCache.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::handleAllEvtMsg(int nDomainID, iot_idl::SEvtCltAddEvt &objAllEvt)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(msgMutex);
|
||||||
|
LOGINFO("-------------------------handleAllEvtMsg-------------------------");
|
||||||
|
CEventMsgManage::instance()->removeEventMsgByDomainID(nDomainID);
|
||||||
|
removeCache(nDomainID);
|
||||||
|
for(int nAddMsgIndex(0); nAddMsgIndex < objAllEvt.evt_info_size(); nAddMsgIndex++)
|
||||||
|
{
|
||||||
|
iot_idl::SEvtInfoToEvtClt msg = objAllEvt.evt_info(nAddMsgIndex);
|
||||||
|
EventMsgPtr event(new CEventMsgInfo());
|
||||||
|
event->initialize(msg);
|
||||||
|
event->priorityOrder = queryPriorityOrder(event->priority);
|
||||||
|
if(!m_listPermLocationId.contains(event->location_id))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(!m_listPermRegionId.contains(event->region_id) && event->region_id != -1)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
CEventMsgManage::instance()->addEventMsg(event);
|
||||||
|
}
|
||||||
|
emit sigMsgRefresh();
|
||||||
|
emit sigEventStateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::handleAddEvtMsg(iot_idl::SEvtCltAddEvt &objAddEvt)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(msgMutex);
|
||||||
|
LOGINFO("-------------------------handleAddEvtMsg-------------------------");
|
||||||
|
for(int nAddMsgIndex(0); nAddMsgIndex < objAddEvt.evt_info_size(); nAddMsgIndex++)
|
||||||
|
{
|
||||||
|
iot_idl::SEvtInfoToEvtClt msg = objAddEvt.evt_info(nAddMsgIndex);
|
||||||
|
EventMsgPtr event(new CEventMsgInfo());
|
||||||
|
event->initialize(msg);
|
||||||
|
event->priorityOrder = queryPriorityOrder(event->priority);
|
||||||
|
if(!m_listPermRegionId.contains(event->region_id) && event->region_id != -1)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
CEventMsgManage::instance()->addEventMsg(event);
|
||||||
|
m_listEventCache.append(event);
|
||||||
|
}
|
||||||
|
emit sigEventStateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::handleLinkWave2EvtMsg(iot_idl::SAlmCltLinkWave2Alm &objWave2Evt)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(msgMutex);
|
||||||
|
QList<QString> uuidList;
|
||||||
|
LOGINFO("-------------------------handleAddEvtMsg-------------------------");
|
||||||
|
QString waveFile = QString::fromStdString(objWave2Evt.wave_file());
|
||||||
|
for(int nAddMsgIndex(0); nAddMsgIndex < objWave2Evt.uuid_base64_size(); nAddMsgIndex++)
|
||||||
|
{
|
||||||
|
QString uuid = QString::fromStdString(objWave2Evt.uuid_base64(nAddMsgIndex));
|
||||||
|
uuidList.append(uuid);
|
||||||
|
}
|
||||||
|
CEventMsgManage::instance()->linkWave2EvtMsg(uuidList,waveFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::handleClearRTEvent()
|
||||||
|
{
|
||||||
|
QMutexLocker locker(msgMutex);
|
||||||
|
CEventMsgManage::instance()->clearRTMsg();
|
||||||
|
emit sigMsgRefresh();
|
||||||
|
emit sigEventStateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::destory()
|
||||||
|
{
|
||||||
|
if(m_pTimer != NULL)
|
||||||
|
{
|
||||||
|
m_pTimer->stop();
|
||||||
|
delete m_pTimer;
|
||||||
|
}
|
||||||
|
m_pTimer = NULL;
|
||||||
|
|
||||||
|
suspendThread();
|
||||||
|
|
||||||
|
m_priorityOrderMap.clear();
|
||||||
|
m_priorityDescriptionMap.clear();
|
||||||
|
m_locationDescriptionMap.clear();
|
||||||
|
m_regionInfoDescriptionMap.clear();
|
||||||
|
m_alarmTypeDescriptionMap.clear();
|
||||||
|
m_deviceTypeDescriptionMap.clear();
|
||||||
|
m_subSystemDescriptionMap.clear();
|
||||||
|
m_locationOrderList.clear();
|
||||||
|
|
||||||
|
delete msgMutex;
|
||||||
|
// delete m_rtdbAccess;
|
||||||
|
m_pInstance = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDataCollect::removeCache(int nDomain)
|
||||||
|
{
|
||||||
|
QList<EventMsgPtr>::iterator it = m_listEventCache.begin();
|
||||||
|
while (it != m_listEventCache.end())
|
||||||
|
{
|
||||||
|
if(nDomain == (*it)->domain_id)
|
||||||
|
{
|
||||||
|
it = m_listEventCache.erase(it);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CEventDataCollect::initVariable()
|
||||||
|
{
|
||||||
|
m_pObjDbInterface = m_pSystemResources->getDbInterface();
|
||||||
|
}
|
||||||
150
product/src/tools/debug_tool_v2/CEventDataCollect.h
Normal file
150
product/src/tools/debug_tool_v2/CEventDataCollect.h
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
#ifndef CEventDataCollect_H
|
||||||
|
#define CEventDataCollect_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QMutex>
|
||||||
|
#include <QMap>
|
||||||
|
#include "AlarmMessage.pb.h"
|
||||||
|
#include "CEventMsgInfo.h"
|
||||||
|
#include "net_msg_bus_api/MsgBusApi.h"
|
||||||
|
//#include "dbms/rdb_api/CRdbAccess.h"
|
||||||
|
#include "CSystemResources.h"
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
|
#define FUNC_SPE_EVENT_VIEW ("FUNC_SPE_EVENT_VIEW")
|
||||||
|
|
||||||
|
const int OTHERSTATUS = 9999;
|
||||||
|
class CEventDataCollect : public QObject, public iot_service::CAlmApiForEvtClt
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
static CEventDataCollect * instance();
|
||||||
|
static void setSystemResources(CSystemResources *pSystemResources);
|
||||||
|
virtual ~CEventDataCollect();
|
||||||
|
|
||||||
|
bool initialize();
|
||||||
|
|
||||||
|
void release();
|
||||||
|
|
||||||
|
void loadEventConfig();
|
||||||
|
int priorityId(const QString &description);
|
||||||
|
int locationId(const QString &description);
|
||||||
|
int regionId(const QString &description);
|
||||||
|
int alarmTypeId(const QString &description);
|
||||||
|
int eventStatusId(const QString &description);
|
||||||
|
int deviceTypeId(const QString &description);
|
||||||
|
|
||||||
|
QString priorityDescription(const int & id);
|
||||||
|
QString locationDescription(const int & id);
|
||||||
|
QString regionDescription(const int & id);
|
||||||
|
QString alarmTypeDescription(const int & id);
|
||||||
|
QString deviceTypeDescription(const int & id);
|
||||||
|
QString alarmStatusDescription(const int & id);
|
||||||
|
QString userNameDescription(const int & id);
|
||||||
|
|
||||||
|
|
||||||
|
QString eventShowStatusDescription(const int & id);
|
||||||
|
|
||||||
|
QList<int> priorityList();
|
||||||
|
QList<int> locationList();
|
||||||
|
QList<int> regionList();
|
||||||
|
QList<int> alarmTypeList();
|
||||||
|
QList<int> alarmStatusList();
|
||||||
|
QList<int> alarmOtherList();
|
||||||
|
QMap<int,SAreaInfo> areaInfoMap();
|
||||||
|
QMap<int,QVector<int> > areaLocMap();
|
||||||
|
QList<int> locationOrderList();
|
||||||
|
|
||||||
|
QMap<int, QString> priorityDescriptionMap();
|
||||||
|
QMap<int, QString> locationDescriptionMap();
|
||||||
|
QMap<int, QString> regionInfoDescriptionMap();
|
||||||
|
QMap<int, QString> alarmTypeDescriptionMap();
|
||||||
|
QMap<int, QString> deviceTypeDescriptionMap();
|
||||||
|
QMap<int, QString> alarmStatusMap();
|
||||||
|
QMap<int, QString> userNameMap();
|
||||||
|
|
||||||
|
QMap<int, QString> eventShowStatusDescriptionMap();
|
||||||
|
QMap<int, QString> eventOtherStatusDescriptionMap();
|
||||||
|
|
||||||
|
virtual void handleAllEvtMsg(int nDomainID, iot_idl::SEvtCltAddEvt &objAllEvt);
|
||||||
|
|
||||||
|
virtual void handleAddEvtMsg(iot_idl::SEvtCltAddEvt &objAddEvt);
|
||||||
|
|
||||||
|
virtual void handleLinkWave2EvtMsg( iot_idl::SAlmCltLinkWave2Alm &objWave2Evt);
|
||||||
|
|
||||||
|
void handleClearRTEvent();
|
||||||
|
void destory();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
/**
|
||||||
|
* @brief sigMsgRefresh 在handleAllAlmMsg时触发,通知model重新拉取报警消息
|
||||||
|
*/
|
||||||
|
void sigMsgRefresh();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief sigMsgArrived 在handleAddAlmMsg时触发,通知model新报警消息到达
|
||||||
|
*/
|
||||||
|
void sigMsgArrived(QList<EventMsgPtr> listEvents);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief sigEventStateChanged 事件数量或状态改变时触发。
|
||||||
|
*/
|
||||||
|
void sigEventStateChanged();
|
||||||
|
public slots:
|
||||||
|
//void queryHistoryEvent(const QStringList &tables, QList<int> typeFilter, const QString &condition);
|
||||||
|
void slotUpdateEvent();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CEventDataCollect();
|
||||||
|
int queryPriorityOrder(int &id);
|
||||||
|
void removeCache(int nDomain);
|
||||||
|
|
||||||
|
void initVariable();
|
||||||
|
|
||||||
|
void loadPermInfo();
|
||||||
|
void loadPriorityOrder();
|
||||||
|
void loadPriorityDescription();
|
||||||
|
void loadLocationDescription();
|
||||||
|
void loadRegionInfoDescription();
|
||||||
|
void loadAlarmTypeDescription();
|
||||||
|
void loadDeviceTypeDescription();
|
||||||
|
void loadAlarmStatusDescription();
|
||||||
|
void loadUserName();
|
||||||
|
|
||||||
|
void loadEventShowStatusDescription();
|
||||||
|
void loadEventOtherStatusDescription();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QMutex * msgMutex;
|
||||||
|
QTimer * m_pTimer;
|
||||||
|
int m_nLocationID;
|
||||||
|
QList<EventMsgPtr> m_listEventCache;
|
||||||
|
//iot_dbms::CRdbAccess * m_rtdbAccess;
|
||||||
|
//iot_dbms::CRdbAccess * m_rtdbPriorityOrderAccess;
|
||||||
|
iot_dbms::CDbApi *m_pObjDbInterface;
|
||||||
|
|
||||||
|
QList<int> m_listPermLocationId;
|
||||||
|
QList<int> m_listPermRegionId;
|
||||||
|
QMap<int, int> m_priorityOrderMap;
|
||||||
|
QMap<int, QString> m_priorityDescriptionMap;
|
||||||
|
QMap<int, QString> m_locationDescriptionMap;
|
||||||
|
QMap<int, QString> m_regionInfoDescriptionMap;
|
||||||
|
QMap<int, QString> m_alarmTypeDescriptionMap;
|
||||||
|
QMap<int, QString> m_deviceTypeDescriptionMap;
|
||||||
|
QMap<int, QString> m_subSystemDescriptionMap;
|
||||||
|
QMap<int, QString> m_alarmStatusMap;
|
||||||
|
QMap<int, QString> m_userNameMap;
|
||||||
|
static CEventDataCollect * m_pInstance;
|
||||||
|
|
||||||
|
QMap<int, QString> m_eventShowStatusMap; //
|
||||||
|
QMap<int, QString> m_eventOtherStatusMap; //其他报警状态
|
||||||
|
|
||||||
|
|
||||||
|
QMap<int,SAreaInfo> m_areaInfoMap; //区域信息
|
||||||
|
QMap<int,QVector<int> > m_areaLocMap; //区域映射
|
||||||
|
|
||||||
|
QList<int> m_locationOrderList; //< location_id: 按location_no排序
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CEventDataCollect_H
|
||||||
210
product/src/tools/debug_tool_v2/CEventDelegate.cpp
Normal file
210
product/src/tools/debug_tool_v2/CEventDelegate.cpp
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
#include "CEventDelegate.h"
|
||||||
|
#include <QDomDocument>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QPainter>
|
||||||
|
#include "CEventMsgInfo.h"
|
||||||
|
#include "CEventItemModel.h"
|
||||||
|
#include "pub_utility_api/FileUtil.h"
|
||||||
|
#include "pub_utility_api/FileStyle.h"
|
||||||
|
#include "pub_logger_api/logger.h"
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include <QProcess>
|
||||||
|
CEventDelegate::CEventDelegate(QObject *parent)
|
||||||
|
: QStyledItemDelegate(parent),
|
||||||
|
m_pModel(Q_NULLPTR),
|
||||||
|
m_selectIsEmpty(false),
|
||||||
|
m_enableWave(true)
|
||||||
|
{
|
||||||
|
loadColorConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDelegate::setEnableWave(bool isNeed)
|
||||||
|
{
|
||||||
|
m_enableWave = isNeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventDelegate::setEventModel(CEventItemModel *model)
|
||||||
|
{
|
||||||
|
m_pModel = model;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CEventDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
if(!index.isValid())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QColor fillColor(255,255,255);
|
||||||
|
QColor penColor(0,0,0);
|
||||||
|
bool select = option.state & QStyle::State_Selected;
|
||||||
|
|
||||||
|
//< Common
|
||||||
|
if(m_pModel != NULL)
|
||||||
|
{
|
||||||
|
EventMsgPtr info = m_pModel->getAlarmInfo(index);
|
||||||
|
|
||||||
|
if(info != Q_NULLPTR)
|
||||||
|
{
|
||||||
|
painter->save();
|
||||||
|
if(AS_ALARM_RTN == info->alm_style)
|
||||||
|
{
|
||||||
|
if(select)
|
||||||
|
{
|
||||||
|
fillColor = m_selectBackgroundColor;
|
||||||
|
if(m_selectIsEmpty)
|
||||||
|
{
|
||||||
|
if ( m_activeTextMap.contains(info->priorityOrder) )
|
||||||
|
penColor = m_activeTextMap[info->priorityOrder];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
penColor = m_selectTextColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( m_resumeTextMap.contains(info->priorityOrder) )
|
||||||
|
penColor = m_resumeTextMap[info->priorityOrder];
|
||||||
|
if ( m_backgroundMap.contains(info->priorityOrder) )
|
||||||
|
fillColor = m_backgroundMap[info->priorityOrder];
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
if(select)
|
||||||
|
{
|
||||||
|
fillColor = m_selectBackgroundColor;
|
||||||
|
if(m_selectIsEmpty)
|
||||||
|
{
|
||||||
|
if ( m_activeTextMap.contains(info->priorityOrder) )
|
||||||
|
penColor = m_activeTextMap[info->priorityOrder];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
penColor = m_selectTextColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( m_activeTextMap.contains(info->priorityOrder) )
|
||||||
|
penColor = m_activeTextMap[info->priorityOrder];
|
||||||
|
if ( m_backgroundMap.contains(info->priorityOrder) )
|
||||||
|
fillColor = m_backgroundMap[info->priorityOrder];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
painter->setPen(penColor);
|
||||||
|
painter->fillRect(option.rect, fillColor);
|
||||||
|
if(m_enableWave && REAL_BUTTON_COLUMN == index.column() && !info->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));
|
||||||
|
std::string style = iot_public::CFileStyle::getCurStyle();
|
||||||
|
QString file = iot_public::CFileUtil::getPathOfResFile("gui/icon/alarm/wave_"+style+".png").c_str();
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
painter->drawText(option.rect, m_pModel->data(index, Qt::TextAlignmentRole).toInt(), m_pModel->data(index).toString());
|
||||||
|
painter->restore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CEventDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
|
||||||
|
{
|
||||||
|
if(!index.isValid())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(m_pModel != NULL)
|
||||||
|
{
|
||||||
|
if(index.column() != REAL_BUTTON_COLUMN)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
EventMsgPtr info = m_pModel->getAlarmInfo(index);
|
||||||
|
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
|
||||||
|
if(info && m_enableWave && !info->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 = info->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 CEventDelegate::loadColorConfig()
|
||||||
|
{
|
||||||
|
QString filePath = QString::fromStdString(iot_public::CFileUtil::getCurModuleDir()) + QString("../../data/model/alarm_color_define.xml");
|
||||||
|
QDomDocument document;
|
||||||
|
QFile file(filePath);
|
||||||
|
if (!file.open(QIODevice::ReadOnly))
|
||||||
|
{
|
||||||
|
LOGINFO("loadColorConfig Failed!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!document.setContent(&file))
|
||||||
|
{
|
||||||
|
file.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
QDomElement element = document.documentElement();
|
||||||
|
QDomNode node = element.firstChild();
|
||||||
|
while(!node.isNull())
|
||||||
|
{
|
||||||
|
QDomElement attr = node.toElement();
|
||||||
|
if(!attr.isNull())
|
||||||
|
{
|
||||||
|
if(QString("Level") == attr.tagName())
|
||||||
|
{
|
||||||
|
int priority = attr.attribute("priority").toInt();
|
||||||
|
m_backgroundMap[priority] = QColor(attr.attribute("background_color"));
|
||||||
|
m_alternatingMap[priority] = QColor(attr.attribute("alternating_color"));
|
||||||
|
m_confirmMap[priority] = QColor(attr.attribute("confirm_color"));
|
||||||
|
|
||||||
|
m_activeTextMap[priority] = QColor(attr.attribute("active_text_color"));
|
||||||
|
m_confirmTextMap[priority] = QColor(attr.attribute("confirm_text_color"));
|
||||||
|
m_resumeTextMap[priority] = QColor(attr.attribute("resume_text_color"));
|
||||||
|
}
|
||||||
|
else if(QString("Select") == attr.tagName())
|
||||||
|
{
|
||||||
|
m_selectBackgroundColor = QColor(attr.attribute("background_color"));
|
||||||
|
if(attr.attribute("text_color").isEmpty())
|
||||||
|
{
|
||||||
|
m_selectIsEmpty = true;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
m_selectTextColor = QColor(attr.attribute("text_color"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
node = node.nextSibling();
|
||||||
|
}
|
||||||
|
}
|
||||||
46
product/src/tools/debug_tool_v2/CEventDelegate.h
Normal file
46
product/src/tools/debug_tool_v2/CEventDelegate.h
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#ifndef CEVENTDELEGATE_H
|
||||||
|
#define CEVENTDELEGATE_H
|
||||||
|
|
||||||
|
#include <QStyledItemDelegate>
|
||||||
|
class CEventItemModel;
|
||||||
|
|
||||||
|
class CEventDelegate : public QStyledItemDelegate
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
CEventDelegate(QObject *parent = 0);
|
||||||
|
|
||||||
|
void setEnableWave(bool isNeed);
|
||||||
|
void setEventModel(CEventItemModel *model);
|
||||||
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
|
bool editorEvent(QEvent *event, QAbstractItemModel *model,
|
||||||
|
const QStyleOptionViewItem &option, const QModelIndex &index) Q_DECL_OVERRIDE;
|
||||||
|
private:
|
||||||
|
void loadColorConfig();
|
||||||
|
private:
|
||||||
|
CEventItemModel *m_pModel;
|
||||||
|
//< background color
|
||||||
|
QMap<int, QColor> m_backgroundMap;
|
||||||
|
QMap<int, QColor> m_alternatingMap;
|
||||||
|
QMap<int, QColor> m_confirmMap;
|
||||||
|
|
||||||
|
//< text color
|
||||||
|
QMap<int, QColor> m_activeTextMap;
|
||||||
|
QMap<int, QColor> m_confirmTextMap;
|
||||||
|
QMap<int, QColor> m_resumeTextMap;
|
||||||
|
|
||||||
|
//< select color
|
||||||
|
QColor m_selectBackgroundColor;
|
||||||
|
QColor m_selectTextColor;
|
||||||
|
|
||||||
|
//< no item
|
||||||
|
QColor m_emptyBackgroundColor;
|
||||||
|
QColor m_emptyTipColor;
|
||||||
|
QString m_emptyTip;
|
||||||
|
|
||||||
|
bool m_selectIsEmpty;
|
||||||
|
|
||||||
|
bool m_enableWave;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CEVENTDELEGATE_H
|
||||||
405
product/src/tools/debug_tool_v2/CEventFilterDialog.ui
Normal file
405
product/src/tools/debug_tool_v2/CEventFilterDialog.ui
Normal file
@ -0,0 +1,405 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CEventFilterDialog</class>
|
||||||
|
<widget class="QDialog" name="CEventFilterDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>570</width>
|
||||||
|
<height>421</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>530</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>过滤</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_12">
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QGroupBox" name="timeFilterEnable">
|
||||||
|
<property name="title">
|
||||||
|
<string>时间</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_10">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_8">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>开始时间</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QDateTimeEdit" name="startTime">
|
||||||
|
<property name="date">
|
||||||
|
<date>
|
||||||
|
<year>2018</year>
|
||||||
|
<month>1</month>
|
||||||
|
<day>1</day>
|
||||||
|
</date>
|
||||||
|
</property>
|
||||||
|
<property name="minimumDateTime">
|
||||||
|
<datetime>
|
||||||
|
<hour>0</hour>
|
||||||
|
<minute>0</minute>
|
||||||
|
<second>0</second>
|
||||||
|
<year>2000</year>
|
||||||
|
<month>1</month>
|
||||||
|
<day>1</day>
|
||||||
|
</datetime>
|
||||||
|
</property>
|
||||||
|
<property name="maximumDate">
|
||||||
|
<date>
|
||||||
|
<year>2050</year>
|
||||||
|
<month>12</month>
|
||||||
|
<day>31</day>
|
||||||
|
</date>
|
||||||
|
</property>
|
||||||
|
<property name="currentSection">
|
||||||
|
<enum>QDateTimeEdit::YearSection</enum>
|
||||||
|
</property>
|
||||||
|
<property name="displayFormat">
|
||||||
|
<string>yyyy/MM/dd hh:mm</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_9">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>结束时间</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QDateTimeEdit" name="endTime">
|
||||||
|
<property name="showGroupSeparator" stdset="0">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="date">
|
||||||
|
<date>
|
||||||
|
<year>2018</year>
|
||||||
|
<month>1</month>
|
||||||
|
<day>1</day>
|
||||||
|
</date>
|
||||||
|
</property>
|
||||||
|
<property name="minimumDateTime">
|
||||||
|
<datetime>
|
||||||
|
<hour>0</hour>
|
||||||
|
<minute>0</minute>
|
||||||
|
<second>0</second>
|
||||||
|
<year>2000</year>
|
||||||
|
<month>1</month>
|
||||||
|
<day>1</day>
|
||||||
|
</datetime>
|
||||||
|
</property>
|
||||||
|
<property name="maximumDate">
|
||||||
|
<date>
|
||||||
|
<year>2050</year>
|
||||||
|
<month>12</month>
|
||||||
|
<day>31</day>
|
||||||
|
</date>
|
||||||
|
</property>
|
||||||
|
<property name="displayFormat">
|
||||||
|
<string>yyyy/MM/dd hh:mm</string>
|
||||||
|
</property>
|
||||||
|
<property name="calendarPopup">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_15">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>281</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="ok">
|
||||||
|
<property name="text">
|
||||||
|
<string>确定</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QPushButton" name="cancle">
|
||||||
|
<property name="text">
|
||||||
|
<string>取消</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_5">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QGroupBox" name="levelFilter">
|
||||||
|
<property name="title">
|
||||||
|
<string>优先级</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QCheckBox" name="checkLevel">
|
||||||
|
<property name="text">
|
||||||
|
<string>全选</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="tristate">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QListWidget" name="level"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QGroupBox" name="locationFilter">
|
||||||
|
<property name="title">
|
||||||
|
<string>位置</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QCheckBox" name="checkLocation">
|
||||||
|
<property name="text">
|
||||||
|
<string>全选</string>
|
||||||
|
</property>
|
||||||
|
<property name="tristate">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QTreeWidget" name="area">
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::NoSelection</enum>
|
||||||
|
</property>
|
||||||
|
<attribute name="headerVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">1</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QGroupBox" name="regionFilter">
|
||||||
|
<property name="title">
|
||||||
|
<string>责任区</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QCheckBox" name="checkRegion">
|
||||||
|
<property name="text">
|
||||||
|
<string>全选</string>
|
||||||
|
</property>
|
||||||
|
<property name="tristate">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QListWidget" name="region"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QGroupBox" name="alarmTypeFilter">
|
||||||
|
<property name="title">
|
||||||
|
<string>事件状态</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QCheckBox" name="checkType">
|
||||||
|
<property name="text">
|
||||||
|
<string>全选</string>
|
||||||
|
</property>
|
||||||
|
<property name="tristate">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QListWidget" name="type"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="deviceFilterEnable">
|
||||||
|
<property name="title">
|
||||||
|
<string>设备类型</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_6">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QComboBox" name="subSystem">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="deviceType">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="keywordFilterEnable">
|
||||||
|
<property name="title">
|
||||||
|
<string>事件内容关键字</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_7">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLineEdit" name="keyWord">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="returnFilterEnable">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>复归</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_11">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QRadioButton" name="hasReturn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>已复归</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QRadioButton" name="notReturn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>未复归</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QWidget" name="widget" native="true"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
71
product/src/tools/debug_tool_v2/CEventFormShow.cpp
Normal file
71
product/src/tools/debug_tool_v2/CEventFormShow.cpp
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
#include "CEventFormShow.h"
|
||||||
|
#include "ui_CEventFormShow.h"
|
||||||
|
#include<QGridLayout>
|
||||||
|
#include "CEventDataCollect.h"
|
||||||
|
CEventFormShow::CEventFormShow(QWidget *parent) :
|
||||||
|
QWidget(parent),m_pRealDelegate(NULL),m_pRealTimeModel(NULL),
|
||||||
|
ui(new Ui::CEventFormShow)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
// m_pmodel=new CEventForm(this,0);
|
||||||
|
// QGridLayout *gridLayout = new QGridLayout(this);
|
||||||
|
// gridLayout->setSpacing(6);
|
||||||
|
// gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
// gridLayout->addWidget(m_pmodel, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
CEventFormShow::~CEventFormShow()
|
||||||
|
{
|
||||||
|
if(m_pRealTimeModel)
|
||||||
|
delete m_pRealTimeModel;
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
void CEventFormShow::initRealModel()
|
||||||
|
{
|
||||||
|
CEventDataCollect::setSystemResources(m_pSystemResources);
|
||||||
|
QSettings columFlags("IOT_HMI", "eventReal config");
|
||||||
|
if(!columFlags.contains(QString("eventReal/colum_0")))
|
||||||
|
{
|
||||||
|
columFlags.setValue(QString("eventReal/colum_0"), false); //< 时间
|
||||||
|
columFlags.setValue(QString("eventReal/colum_1"), false); //< 优先级
|
||||||
|
columFlags.setValue(QString("eventReal/colum_2"), false); //< 位置
|
||||||
|
columFlags.setValue(QString("eventReal/colum_3"), true); //< 责任区
|
||||||
|
columFlags.setValue(QString("eventReal/colum_4"), true); //< 事件类型
|
||||||
|
columFlags.setValue(QString("eventReal/colum_5"), false); //< 事件状态
|
||||||
|
columFlags.setValue(QString("eventReal/colum_6"), false); //< 复归状态
|
||||||
|
}
|
||||||
|
if(m_pRealDelegate == NULL)
|
||||||
|
{
|
||||||
|
m_pRealDelegate = new CEventDelegate(this);
|
||||||
|
ui->eventView->setItemDelegate(m_pRealDelegate);
|
||||||
|
}
|
||||||
|
ui->eventView->setSortingEnabled(true);
|
||||||
|
if(NULL == m_pRealTimeModel)
|
||||||
|
{
|
||||||
|
m_pRealTimeModel = new CEventItemModel(this);
|
||||||
|
connect(ui->eventView->horizontalHeader(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), m_pRealTimeModel, SLOT(sortColumn(int,Qt::SortOrder)));
|
||||||
|
ui->eventView->horizontalHeader()->setSortIndicator(0, Qt::AscendingOrder);
|
||||||
|
}
|
||||||
|
ui->eventView->setModel(m_pRealTimeModel);
|
||||||
|
m_pRealDelegate->setEventModel(m_pRealTimeModel);
|
||||||
|
QSettings columFlags1("IOT_HMI", "eventReal config");
|
||||||
|
for(int nColumnIndex(0); nColumnIndex < m_pRealTimeModel->columnCount() - 1; nColumnIndex++)
|
||||||
|
{
|
||||||
|
bool visible = columFlags1.value(QString("eventReal/colum_%1").arg(nColumnIndex)).toBool();
|
||||||
|
ui->eventView->setColumnHidden(nColumnIndex, visible);
|
||||||
|
}
|
||||||
|
ui->eventView->setColumnHidden(m_pRealTimeModel->columnCount() - 1, false);
|
||||||
|
ui->eventView->setColumnWidth(0, 250);
|
||||||
|
ui->eventView->setColumnWidth(1, 150);
|
||||||
|
ui->eventView->setColumnWidth(2, 150);
|
||||||
|
ui->eventView->setColumnWidth(3, 150);
|
||||||
|
ui->eventView->setColumnWidth(4, 150);
|
||||||
|
ui->eventView->setColumnWidth(5, 150);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventFormShow::setSystemResources(CSystemResources *pSystemResources)
|
||||||
|
{
|
||||||
|
m_pSystemResources = pSystemResources;
|
||||||
|
|
||||||
|
}
|
||||||
30
product/src/tools/debug_tool_v2/CEventFormShow.h
Normal file
30
product/src/tools/debug_tool_v2/CEventFormShow.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#ifndef CEVENTFORMSHOW_H
|
||||||
|
#define CEVENTFORMSHOW_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "CSystemResources.h"
|
||||||
|
#include "CEventDelegate.h"
|
||||||
|
#include"CEventItemModel.h"
|
||||||
|
namespace Ui {
|
||||||
|
class CEventFormShow;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CEventFormShow : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CEventFormShow(QWidget *parent = 0);
|
||||||
|
~CEventFormShow();
|
||||||
|
void setSystemResources(CSystemResources *pSystemResources);
|
||||||
|
void initRealModel();
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::CEventFormShow *ui;
|
||||||
|
CEventDelegate *m_pRealDelegate;
|
||||||
|
CEventItemModel * m_pRealTimeModel;
|
||||||
|
CSystemResources *m_pSystemResources;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CEVENTFORMSHOW_H
|
||||||
31
product/src/tools/debug_tool_v2/CEventFormShow.ui
Normal file
31
product/src/tools/debug_tool_v2/CEventFormShow.ui
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CEventFormShow</class>
|
||||||
|
<widget class="QWidget" name="CEventFormShow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>941</width>
|
||||||
|
<height>571</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="CEventView" name="eventView"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>CEventView</class>
|
||||||
|
<extends>QTableView</extends>
|
||||||
|
<header location="global">CEventView.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
724
product/src/tools/debug_tool_v2/CEventItemModel.cpp
Normal file
724
product/src/tools/debug_tool_v2/CEventItemModel.cpp
Normal file
@ -0,0 +1,724 @@
|
|||||||
|
#include "CEventItemModel.h"
|
||||||
|
#include "CEventMsgInfo.h"
|
||||||
|
#include <QModelIndex>
|
||||||
|
#include <QMutexLocker>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QSortFilterProxyModel>
|
||||||
|
#include "CEventDataCollect.h"
|
||||||
|
#include "service/alarm_server_api/AlarmCommonDef.h"
|
||||||
|
#include "CEventMsgManage.h"
|
||||||
|
#include "pub_logger_api/logger.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
typedef QPair<int, QList<EventMsgPtr> > PAIRLISTALARMINFO;
|
||||||
|
|
||||||
|
CEventItemModel::CEventItemModel(QObject *parent)
|
||||||
|
:QAbstractTableModel(parent),
|
||||||
|
m_sortKey(E_SORT_TIME),
|
||||||
|
m_order(Qt::AscendingOrder)
|
||||||
|
{
|
||||||
|
header << tr("时间") << tr("优先级") << tr("位置") << tr("责任区") << tr("事件类型") << tr("事件状态") << tr("复归状态") << tr("事件内容");
|
||||||
|
initialize();
|
||||||
|
connect(CEventDataCollect::instance(), SIGNAL(sigMsgRefresh()),
|
||||||
|
this, SLOT(slotMsgRefresh()), Qt::QueuedConnection);
|
||||||
|
connect(CEventDataCollect::instance(), SIGNAL(sigMsgArrived(QList<EventMsgPtr>)),
|
||||||
|
this, SLOT(slotMsgArrived(QList<EventMsgPtr>)));
|
||||||
|
}
|
||||||
|
|
||||||
|
CEventItemModel::~CEventItemModel()
|
||||||
|
{
|
||||||
|
m_listShowEventInfo.clear();
|
||||||
|
CEventDataCollect::instance()->destory();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventItemModel::initialize()
|
||||||
|
{
|
||||||
|
beginResetModel();
|
||||||
|
m_listShowEventInfo.clear();
|
||||||
|
endResetModel();
|
||||||
|
|
||||||
|
initFilterAndReloadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventItemModel::initFilter()
|
||||||
|
{
|
||||||
|
m_isLevelFilterEnable = false;
|
||||||
|
m_levelFilter.clear();
|
||||||
|
m_isLocationFilterEnable = false;
|
||||||
|
m_locationFilter.clear();
|
||||||
|
m_isRegionFilterEnable = false;
|
||||||
|
m_regionFilter.clear();
|
||||||
|
m_isStatusFilterEnable = false;
|
||||||
|
m_statusFilter.clear();
|
||||||
|
m_statusFilter2.clear();
|
||||||
|
m_isDeviceTypeFileter = false;
|
||||||
|
m_subSystem = QString();
|
||||||
|
m_deviceType = QString();
|
||||||
|
m_isKeywordEnable = false;
|
||||||
|
m_keyword = QString();
|
||||||
|
m_timeFilterEnable = false;
|
||||||
|
m_isReturnFilterEnable = false;
|
||||||
|
m_isReturn = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventItemModel::initFilterAndReloadData()
|
||||||
|
{
|
||||||
|
initFilter();
|
||||||
|
slotMsgRefresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventItemModel::setSystemResources(CSystemResources *pSystemResources)
|
||||||
|
{
|
||||||
|
m_pSystemResources=pSystemResources;
|
||||||
|
}
|
||||||
|
|
||||||
|
EventMsgPtr CEventItemModel::getAlarmInfo(const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
if(!index.isValid() || index.row() >= m_listShowEventInfo.count())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_listShowEventInfo.at(index.row());
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<EventMsgPtr> CEventItemModel::getListShowAlarmInfo() const
|
||||||
|
{
|
||||||
|
return m_listShowEventInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventItemModel::insertAlarmMsg(EventMsgPtr info)
|
||||||
|
{
|
||||||
|
int nInsertRowIndex = -1;
|
||||||
|
if (Qt::AscendingOrder == m_order)
|
||||||
|
{
|
||||||
|
for (int nIndex(0); nIndex < m_listShowEventInfo.count(); nIndex++)
|
||||||
|
{
|
||||||
|
EventMsgPtr msg(m_listShowEventInfo.at(nIndex));
|
||||||
|
if (!msg->lessThan(info, m_sortKey))
|
||||||
|
{
|
||||||
|
nInsertRowIndex = nIndex;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int nIndex(0); nIndex < m_listShowEventInfo.count(); nIndex++)
|
||||||
|
{
|
||||||
|
EventMsgPtr msg(m_listShowEventInfo.at(nIndex));
|
||||||
|
if (!msg->moreThan(info, m_sortKey))
|
||||||
|
{
|
||||||
|
nInsertRowIndex = nIndex;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (-1 == nInsertRowIndex)
|
||||||
|
{
|
||||||
|
nInsertRowIndex = m_listShowEventInfo.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
beginInsertRows(QModelIndex(), nInsertRowIndex, nInsertRowIndex);
|
||||||
|
m_listShowEventInfo.insert(nInsertRowIndex, info);
|
||||||
|
endInsertRows();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant CEventItemModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
|
{
|
||||||
|
if(Qt::DisplayRole == role && Qt::Horizontal == orientation)
|
||||||
|
{
|
||||||
|
return QVariant(header.at(section));
|
||||||
|
}
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant CEventItemModel::data(const QModelIndex &index, int role) const
|
||||||
|
{
|
||||||
|
if(!index.isValid() || index.row() >= m_listShowEventInfo.count())
|
||||||
|
{
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Qt::TextAlignmentRole == role)
|
||||||
|
{
|
||||||
|
if(index.column() == (int)E_SORT_CONTENT)
|
||||||
|
{
|
||||||
|
return QVariant(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
return QVariant(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(Qt::DisplayRole == role)
|
||||||
|
{
|
||||||
|
switch (index.column())
|
||||||
|
{
|
||||||
|
case E_SORT_TIME :
|
||||||
|
{
|
||||||
|
return QDateTime::fromMSecsSinceEpoch(m_listShowEventInfo.at(index.row())->time_stamp, Qt::LocalTime).toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||||
|
}
|
||||||
|
case E_SORT_PRIORITY :
|
||||||
|
{
|
||||||
|
return CEventDataCollect::instance()->priorityDescription(m_listShowEventInfo.at(index.row())->priority);
|
||||||
|
}
|
||||||
|
case E_SORT_LOCATION :
|
||||||
|
{
|
||||||
|
return CEventDataCollect::instance()->locationDescription(m_listShowEventInfo.at(index.row())->location_id);
|
||||||
|
}
|
||||||
|
case E_SORT_REGION :
|
||||||
|
{
|
||||||
|
return CEventDataCollect::instance()->regionDescription(m_listShowEventInfo.at(index.row())->region_id);
|
||||||
|
}
|
||||||
|
case E_SORT_TYPE :
|
||||||
|
{
|
||||||
|
return CEventDataCollect::instance()->alarmTypeDescription(m_listShowEventInfo.at(index.row())->alm_type);
|
||||||
|
}
|
||||||
|
case E_SORT_STATUS :
|
||||||
|
{
|
||||||
|
return CEventDataCollect::instance()->alarmStatusDescription(m_listShowEventInfo.at(index.row())->alm_status);
|
||||||
|
}
|
||||||
|
case E_SORT_STYLE :
|
||||||
|
{
|
||||||
|
if(AS_ALARM == m_listShowEventInfo.at(index.row())->alm_style) //未复归
|
||||||
|
{
|
||||||
|
return tr("未复归");
|
||||||
|
}
|
||||||
|
else if(AS_ALARM_RTN == m_listShowEventInfo.at(index.row())->alm_style ) //已复归
|
||||||
|
{
|
||||||
|
return tr("已复归");
|
||||||
|
}else{
|
||||||
|
return QString("-");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case E_SORT_CONTENT :
|
||||||
|
{
|
||||||
|
return m_listShowEventInfo.at(index.row())->content;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEventItemModel::columnCount(const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
if (index.isValid())
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return header.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEventItemModel::rowCount(const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
if (index.isValid())
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return m_listShowEventInfo.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
Qt::ItemFlags CEventItemModel::flags(const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
// return Qt::NoItemFlags;
|
||||||
|
if (!index.isValid())
|
||||||
|
{
|
||||||
|
return Qt::NoItemFlags;
|
||||||
|
}
|
||||||
|
return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
void CEventItemModel::sortColumn(int column, Qt::SortOrder order)
|
||||||
|
{
|
||||||
|
if(order == Qt::AscendingOrder)
|
||||||
|
{
|
||||||
|
m_order = Qt::DescendingOrder;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_order = Qt::AscendingOrder;
|
||||||
|
}
|
||||||
|
m_sortKey = (E_ALARM_SORTKEY)column;
|
||||||
|
|
||||||
|
beginResetModel();
|
||||||
|
sort();
|
||||||
|
endResetModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
//<归并排序
|
||||||
|
void CEventItemModel::sort()
|
||||||
|
{
|
||||||
|
QMap<int, PAIRLISTALARMINFO> mapAlarmInfo;
|
||||||
|
//<分
|
||||||
|
for(int nIndex(0); nIndex < m_listShowEventInfo.count(); nIndex++)
|
||||||
|
{
|
||||||
|
EventMsgPtr temp = m_listShowEventInfo.at(nIndex);
|
||||||
|
mapAlarmInfo[nIndex / 1000].second.append(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
//<快速排序
|
||||||
|
for(int nMapIndex(0); nMapIndex < mapAlarmInfo.count(); nMapIndex++)
|
||||||
|
{
|
||||||
|
qucikSort(mapAlarmInfo[nMapIndex].second, 0, mapAlarmInfo[nMapIndex].second.count() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//<治
|
||||||
|
PAIRLISTALARMINFO tempListAlarmInfo = mapAlarmInfo[0];
|
||||||
|
for(int nPairIndex(1); nPairIndex < mapAlarmInfo.count(); nPairIndex++)
|
||||||
|
{
|
||||||
|
//<归并
|
||||||
|
tempListAlarmInfo.first = 0;
|
||||||
|
mapAlarmInfo[nPairIndex].first = 0;
|
||||||
|
while(mapAlarmInfo[nPairIndex].first < mapAlarmInfo[nPairIndex].second.count())
|
||||||
|
{
|
||||||
|
if(tempListAlarmInfo.first >= tempListAlarmInfo.second.count())
|
||||||
|
{
|
||||||
|
tempListAlarmInfo.second.append(mapAlarmInfo[nPairIndex].second.at(mapAlarmInfo[nPairIndex].first));
|
||||||
|
mapAlarmInfo[nPairIndex].first += 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(Qt::AscendingOrder == m_order)
|
||||||
|
{
|
||||||
|
if(!tempListAlarmInfo.second[tempListAlarmInfo.first]->lessThan(mapAlarmInfo[nPairIndex].second.at(mapAlarmInfo[nPairIndex].first), m_sortKey))
|
||||||
|
{
|
||||||
|
tempListAlarmInfo.second.insert(tempListAlarmInfo.first, mapAlarmInfo[nPairIndex].second.at(mapAlarmInfo[nPairIndex].first));
|
||||||
|
mapAlarmInfo[nPairIndex].first += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(Qt::DescendingOrder == m_order)
|
||||||
|
{
|
||||||
|
if(!tempListAlarmInfo.second[tempListAlarmInfo.first]->moreThan(mapAlarmInfo[nPairIndex].second.at(mapAlarmInfo[nPairIndex].first), m_sortKey))
|
||||||
|
{
|
||||||
|
tempListAlarmInfo.second.insert(tempListAlarmInfo.first, mapAlarmInfo[nPairIndex].second.at(mapAlarmInfo[nPairIndex].first));
|
||||||
|
mapAlarmInfo[nPairIndex].first += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tempListAlarmInfo.first += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_listShowEventInfo = tempListAlarmInfo.second;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void CEventItemModel::qucikSort(QList<EventMsgPtr> &list, int start, int last)
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
while(start < last)
|
||||||
|
{
|
||||||
|
if(Qt::AscendingOrder == m_order)
|
||||||
|
{
|
||||||
|
index = partitionAscendingOrder(list, start, last);
|
||||||
|
}
|
||||||
|
else if(Qt::DescendingOrder == m_order)
|
||||||
|
{
|
||||||
|
index = partitionDescendingOrder(list, start, last);
|
||||||
|
}
|
||||||
|
qucikSort(list, start, index - 1);
|
||||||
|
start=index+1; //<尾优化
|
||||||
|
}
|
||||||
|
}
|
||||||
|
////
|
||||||
|
int CEventItemModel::partitionAscendingOrder(QList<EventMsgPtr> &list, int start, int last)
|
||||||
|
{
|
||||||
|
EventMsgPtr info = list[start];
|
||||||
|
int left = start;
|
||||||
|
int right = last;
|
||||||
|
while(left < right)
|
||||||
|
{
|
||||||
|
while(left < right && !list[right]->lessThan(info, m_sortKey))
|
||||||
|
{
|
||||||
|
--right;
|
||||||
|
}
|
||||||
|
list[left] = list[right];
|
||||||
|
|
||||||
|
while(left<right && list[left]->lessThan(info, m_sortKey))
|
||||||
|
{
|
||||||
|
++left;
|
||||||
|
}
|
||||||
|
list[right] = list[left];
|
||||||
|
}
|
||||||
|
list[left] = info;
|
||||||
|
return left;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEventItemModel::partitionDescendingOrder(QList<EventMsgPtr> &list, int start, int last)
|
||||||
|
{
|
||||||
|
EventMsgPtr info = list[start];
|
||||||
|
int left = start;
|
||||||
|
int right = last;
|
||||||
|
while(left < right)
|
||||||
|
{
|
||||||
|
while(left < right && !list[right]->moreThan(info, m_sortKey))
|
||||||
|
{
|
||||||
|
--right;
|
||||||
|
}
|
||||||
|
list[left] = list[right];
|
||||||
|
|
||||||
|
while(left<right && list[left]->moreThan(info, m_sortKey))
|
||||||
|
{
|
||||||
|
++left;
|
||||||
|
}
|
||||||
|
list[right] = list[left];
|
||||||
|
}
|
||||||
|
list[left] = info;
|
||||||
|
return left;
|
||||||
|
}
|
||||||
|
////
|
||||||
|
|
||||||
|
|
||||||
|
void CEventItemModel::getFilter(bool &isLevelFilterEnable, QList<int> &levelFilter,
|
||||||
|
bool &isLocationFilterEnable, QList<int> &locationFilter,
|
||||||
|
bool &isRegionFilterEnable, QList<int> ®ionFilter,
|
||||||
|
bool &isTypeFilterEnable, QList<int> &alarmTypeFilter,
|
||||||
|
bool &deviceTypeFilter, QString &subSystem, QString &deviceType,
|
||||||
|
bool &keywordFilterEnable, QString &keyword,
|
||||||
|
bool &timeFilterEnable, QDateTime &startTime, QDateTime &endTime,
|
||||||
|
bool &returnFilterEnable,bool &isReturn)
|
||||||
|
{
|
||||||
|
Q_UNUSED(isLevelFilterEnable);
|
||||||
|
Q_UNUSED(levelFilter);
|
||||||
|
Q_UNUSED(isLocationFilterEnable);
|
||||||
|
Q_UNUSED(locationFilter);
|
||||||
|
Q_UNUSED(isRegionFilterEnable);
|
||||||
|
Q_UNUSED(regionFilter);
|
||||||
|
Q_UNUSED(isTypeFilterEnable);
|
||||||
|
Q_UNUSED(alarmTypeFilter);
|
||||||
|
Q_UNUSED(deviceTypeFilter);
|
||||||
|
Q_UNUSED(subSystem);
|
||||||
|
Q_UNUSED(deviceType);
|
||||||
|
Q_UNUSED(keywordFilterEnable);
|
||||||
|
Q_UNUSED(keyword);
|
||||||
|
Q_UNUSED(timeFilterEnable);
|
||||||
|
Q_UNUSED(startTime);
|
||||||
|
Q_UNUSED(endTime);
|
||||||
|
Q_UNUSED(returnFilterEnable);
|
||||||
|
Q_UNUSED(isReturn);
|
||||||
|
}
|
||||||
|
// isLevelFilterEnable = m_isLevelFilterEnable;
|
||||||
|
// levelFilter = m_levelFilter;
|
||||||
|
// isLocationFilterEnable = m_isLocationFilterEnable;
|
||||||
|
// locationFilter = m_locationFilter;
|
||||||
|
// isRegionFilterEnable = m_isRegionFilterEnable;
|
||||||
|
// regionFilter = m_regionFilter;
|
||||||
|
// isTypeFilterEnable = m_isStatusFilterEnable;
|
||||||
|
// alarmTypeFilter = m_statusFilter2;
|
||||||
|
// subSystem = m_subSystem;
|
||||||
|
// deviceTypeFilter = m_isDeviceTypeFileter;
|
||||||
|
// deviceType = m_deviceType;
|
||||||
|
// keywordFilterEnable = m_isKeywordEnable;
|
||||||
|
// keyword = m_keyword;
|
||||||
|
// timeFilterEnable = m_timeFilterEnable;
|
||||||
|
// startTime = m_startTime;
|
||||||
|
// endTime = m_endTime;
|
||||||
|
// returnFilterEnable = m_isReturnFilterEnable;
|
||||||
|
// isReturn = m_isReturn;
|
||||||
|
//}
|
||||||
|
////
|
||||||
|
bool CEventItemModel::conditionFilter(EventMsgPtr info)
|
||||||
|
{
|
||||||
|
//< 等级
|
||||||
|
if(m_isLevelFilterEnable && !m_levelFilter.contains(info->priority))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//< 车站
|
||||||
|
if(m_isLocationFilterEnable)
|
||||||
|
{
|
||||||
|
if(!m_locationFilter.contains(info->location_id))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(!CEventDataCollect::instance()->locationList().contains(info->location_id))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//< 责任区
|
||||||
|
if(m_isRegionFilterEnable)
|
||||||
|
{
|
||||||
|
if(!m_regionFilter.contains(info->region_id))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(!CEventDataCollect::instance()->regionList().contains(info->region_id) && info->region_id != -1) //< 未配置责任区的报警同样显示
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//< 状态
|
||||||
|
if(m_isStatusFilterEnable && !m_statusFilter.contains(info->alm_status))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//< 设备类型
|
||||||
|
if(m_isDeviceTypeFileter)
|
||||||
|
{
|
||||||
|
if(CEventDataCollect::instance()->deviceTypeId(m_deviceType) != info->dev_type)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//< 关键字
|
||||||
|
if(m_isKeywordEnable)
|
||||||
|
{
|
||||||
|
if(!info->content.contains(m_keyword))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//< 时间
|
||||||
|
if(m_timeFilterEnable)
|
||||||
|
{
|
||||||
|
if((quint64)m_startTime.toMSecsSinceEpoch() >= info->time_stamp)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if((quint64)m_endTime.toMSecsSinceEpoch() <= info->time_stamp)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(m_isReturnFilterEnable)
|
||||||
|
{
|
||||||
|
if(m_isReturn)
|
||||||
|
{
|
||||||
|
if(info->alm_style != AS_ALARM_RTN)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(info->alm_style != AS_ALARM )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
////
|
||||||
|
void CEventItemModel::setPriorityFilter(bool &isCheck, QList<int> &priorityFilter)
|
||||||
|
{
|
||||||
|
Q_UNUSED(isCheck);
|
||||||
|
Q_UNUSED(priorityFilter);
|
||||||
|
}
|
||||||
|
// m_isLevelFilterEnable = isCheck;
|
||||||
|
// m_levelFilter = priorityFilter;
|
||||||
|
|
||||||
|
// slotMsgRefresh();
|
||||||
|
//}
|
||||||
|
////
|
||||||
|
void CEventItemModel::setLocationFilter(bool &isCheck, QList<int> &locationFilter)
|
||||||
|
{
|
||||||
|
Q_UNUSED(isCheck);
|
||||||
|
Q_UNUSED(locationFilter);
|
||||||
|
}
|
||||||
|
// m_isLocationFilterEnable = isCheck;
|
||||||
|
// m_locationFilter = locationFilter;
|
||||||
|
|
||||||
|
// slotMsgRefresh();
|
||||||
|
//}
|
||||||
|
////
|
||||||
|
void CEventItemModel::setEventTypeFilter(bool &isCheck, QList<int> &eventTypeFilter, bool &other)
|
||||||
|
{
|
||||||
|
Q_UNUSED(isCheck);
|
||||||
|
Q_UNUSED(eventTypeFilter);
|
||||||
|
Q_UNUSED(other);
|
||||||
|
}
|
||||||
|
// m_isStatusFilterEnable = isCheck;
|
||||||
|
// m_statusFilter = eventTypeFilter;
|
||||||
|
// m_statusFilter2 = eventTypeFilter;
|
||||||
|
// if(other == true)
|
||||||
|
// {
|
||||||
|
// QMap<int,QString> otherEventStatus = CEventDataCollect::instance()->eventOtherStatusDescriptionMap();
|
||||||
|
// QMap<int, QString>::iterator it = otherEventStatus.begin();
|
||||||
|
// for(;it != otherEventStatus.end(); ++it)
|
||||||
|
// {
|
||||||
|
// m_statusFilter.append(it.key());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// slotMsgRefresh();
|
||||||
|
//}
|
||||||
|
////
|
||||||
|
void CEventItemModel::setEventTimeFilter(bool &isCheck, QDate &startTime, QDate &endTime)
|
||||||
|
{
|
||||||
|
Q_UNUSED(isCheck);
|
||||||
|
Q_UNUSED(startTime);
|
||||||
|
Q_UNUSED(endTime);
|
||||||
|
}
|
||||||
|
// m_timeFilterEnable = isCheck;
|
||||||
|
// if(isCheck)
|
||||||
|
// {
|
||||||
|
// QTime time_1(0,0,0);
|
||||||
|
// QTime time_2(23,59,59);
|
||||||
|
// m_startTime.setDate(startTime);
|
||||||
|
// m_startTime.setTime(time_1);
|
||||||
|
// m_endTime.setDate(endTime);
|
||||||
|
// m_endTime.setTime(time_2);
|
||||||
|
// }
|
||||||
|
// slotMsgRefresh();
|
||||||
|
//}
|
||||||
|
////
|
||||||
|
void CEventItemModel::setEventTimeFilter(bool &isCheck)
|
||||||
|
{
|
||||||
|
Q_UNUSED(isCheck);
|
||||||
|
}
|
||||||
|
// m_timeFilterEnable = isCheck;
|
||||||
|
// slotMsgRefresh();
|
||||||
|
//}
|
||||||
|
////
|
||||||
|
void CEventItemModel::getPriorityFilter(bool &isCheck, QList<int> &priorityFilter)
|
||||||
|
{
|
||||||
|
Q_UNUSED(isCheck);
|
||||||
|
Q_UNUSED(priorityFilter);
|
||||||
|
}
|
||||||
|
// isCheck = m_isLevelFilterEnable;
|
||||||
|
// priorityFilter = m_levelFilter;
|
||||||
|
//}
|
||||||
|
////
|
||||||
|
void CEventItemModel::getLocationFilter(bool &isCheck, QList<int> &locationFilter)
|
||||||
|
{
|
||||||
|
Q_UNUSED(isCheck);
|
||||||
|
Q_UNUSED(locationFilter);
|
||||||
|
}
|
||||||
|
// isCheck = m_isLocationFilterEnable;
|
||||||
|
// locationFilter = m_locationFilter;
|
||||||
|
//}
|
||||||
|
////
|
||||||
|
void CEventItemModel::getEventStatusFilter(bool &isCheck, QList<int> &eventStatusFilter)
|
||||||
|
{
|
||||||
|
Q_UNUSED(isCheck);
|
||||||
|
Q_UNUSED(eventStatusFilter);
|
||||||
|
}
|
||||||
|
// isCheck = m_isStatusFilterEnable;
|
||||||
|
// eventStatusFilter = m_statusFilter2;
|
||||||
|
//}
|
||||||
|
////
|
||||||
|
void CEventItemModel::getEventTimeFilter(bool &isCheck, QDateTime &startTime, QDateTime &endTime)
|
||||||
|
{
|
||||||
|
Q_UNUSED(isCheck);
|
||||||
|
Q_UNUSED(startTime);
|
||||||
|
Q_UNUSED(endTime);
|
||||||
|
}
|
||||||
|
// isCheck = m_timeFilterEnable;
|
||||||
|
// startTime = m_startTime;
|
||||||
|
// endTime = m_endTime;
|
||||||
|
//}
|
||||||
|
////
|
||||||
|
QList<EventMsgPtr> CEventItemModel::getListEventInfo()
|
||||||
|
{return m_listShowEventInfo;}
|
||||||
|
// return m_listShowEventInfo;
|
||||||
|
//}
|
||||||
|
|
||||||
|
void CEventItemModel::slotMsgRefresh()
|
||||||
|
{
|
||||||
|
//需要先过滤
|
||||||
|
m_listAllEventInfo = CEventMsgManage::instance()->getListEventInfo();
|
||||||
|
//根据复归过滤
|
||||||
|
QList<EventMsgPtr> listFilterInfo;
|
||||||
|
firstFilterByReturn(listFilterInfo);
|
||||||
|
m_listAllEventInfo.clear();
|
||||||
|
beginResetModel();
|
||||||
|
m_listShowEventInfo.clear();
|
||||||
|
QList<EventMsgPtr>::iterator it = listFilterInfo.begin();
|
||||||
|
while (it != listFilterInfo.end()) {
|
||||||
|
if(conditionFilter(*it))
|
||||||
|
{
|
||||||
|
m_listShowEventInfo.append(*it);
|
||||||
|
}
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
sort();
|
||||||
|
endResetModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventItemModel::slotMsgArrived(QList<EventMsgPtr> listEvents)
|
||||||
|
{
|
||||||
|
if(m_isReturnFilterEnable)
|
||||||
|
{
|
||||||
|
slotMsgRefresh();
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
QList<EventMsgPtr>::iterator itPos = listEvents.begin();
|
||||||
|
while(itPos != listEvents.end())
|
||||||
|
{
|
||||||
|
if(conditionFilter(*itPos))
|
||||||
|
{
|
||||||
|
insertAlarmMsg(*itPos);
|
||||||
|
}
|
||||||
|
itPos++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int nIndex = m_listShowEventInfo.size() - 1; nIndex >= 0; --nIndex)
|
||||||
|
{
|
||||||
|
if(m_listShowEventInfo.at(nIndex)->deleted)
|
||||||
|
{
|
||||||
|
beginRemoveRows(QModelIndex(), nIndex, nIndex);
|
||||||
|
m_listShowEventInfo.removeAt(nIndex);
|
||||||
|
endRemoveRows();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventItemModel::firstFilterByReturn(QList<EventMsgPtr> &filterList)
|
||||||
|
{
|
||||||
|
if(!m_isReturnFilterEnable)
|
||||||
|
{
|
||||||
|
filterList = m_listAllEventInfo;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QHash<QString,EventMsgPtr> filerHash;
|
||||||
|
|
||||||
|
QList<EventMsgPtr>::iterator it = m_listAllEventInfo.begin();
|
||||||
|
while (it != m_listAllEventInfo.end()) {
|
||||||
|
if((*it)->key_id_tag.isEmpty())
|
||||||
|
{
|
||||||
|
it++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//< 动作和复归
|
||||||
|
if((*it)->alm_style == AS_ALARM || (*it)->alm_style == AS_ALARM_RTN)
|
||||||
|
{
|
||||||
|
EventMsgPtr ptr = filerHash.value((*it)->key_id_tag,NULL);
|
||||||
|
if(ptr != NULL)
|
||||||
|
{
|
||||||
|
if((*it)->time_stamp >ptr->time_stamp)
|
||||||
|
{
|
||||||
|
filerHash[(*it)->key_id_tag] = (*it);
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
filerHash[(*it)->key_id_tag] = (*it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
QHash<QString,EventMsgPtr>::iterator pos = filerHash.begin();
|
||||||
|
while (pos != filerHash.end()) {
|
||||||
|
filterList.append(pos.value());
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
}
|
||||||
145
product/src/tools/debug_tool_v2/CEventItemModel.h
Normal file
145
product/src/tools/debug_tool_v2/CEventItemModel.h
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
#ifndef CEVENTITEMMODEL_H
|
||||||
|
#define CEVENTITEMMODEL_H
|
||||||
|
|
||||||
|
#include <QAbstractTableModel>
|
||||||
|
#include <QDateTime>
|
||||||
|
#include "CEventMsgInfo.h"
|
||||||
|
#include "CEventDataCollect.h"
|
||||||
|
#include <QMutex>
|
||||||
|
|
||||||
|
#define Row_Full (15000)
|
||||||
|
|
||||||
|
class CEventMsgInfo;
|
||||||
|
class QTimer;
|
||||||
|
|
||||||
|
class CEventItemModel : public QAbstractTableModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
CEventItemModel(QObject *parent = Q_NULLPTR);
|
||||||
|
~CEventItemModel();
|
||||||
|
|
||||||
|
void initialize();
|
||||||
|
void initFilter();
|
||||||
|
|
||||||
|
void initFilterAndReloadData();
|
||||||
|
void setSystemResources(CSystemResources *pSystemResources);
|
||||||
|
|
||||||
|
EventMsgPtr getAlarmInfo(const QModelIndex &index) const;
|
||||||
|
|
||||||
|
const QList<EventMsgPtr> getListShowAlarmInfo() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief insertAlarmMsg 数采通知模型报警到达
|
||||||
|
* @param info
|
||||||
|
*/
|
||||||
|
void insertAlarmMsg(EventMsgPtr info);
|
||||||
|
|
||||||
|
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||||
|
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||||
|
virtual int columnCount(const QModelIndex &index = QModelIndex()) const;
|
||||||
|
virtual int rowCount(const QModelIndex &index = QModelIndex()) const;
|
||||||
|
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||||
|
void sort();
|
||||||
|
void qucikSort(QList<EventMsgPtr> &listAlarmInfo, int left, int right);
|
||||||
|
int partitionAscendingOrder(QList<EventMsgPtr> &list, int start, int last);
|
||||||
|
int partitionDescendingOrder(QList<EventMsgPtr> &list, int start, int last);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置模型数据过滤条件,过滤显示数据
|
||||||
|
*/
|
||||||
|
void setFilter(const bool &isLevelFilterEnable, const QList<int> &levelFilter,
|
||||||
|
const bool &isStationFilterEnable, const QList<int> &stationFilter,
|
||||||
|
const bool &isRegionFilterEnable, const QList<int> ®ionFilter,
|
||||||
|
const bool &isTypeFilterEnable, const QList<int> &typeFilter,
|
||||||
|
const bool &isDeviceTypeFilter = false, const QString &subSystem = QString(), const QString &deviceType = QString(),
|
||||||
|
const bool &isKeywordFilterEnable = false, const QString &keyword = QString(),
|
||||||
|
const bool &timeFilterEnable = false, const QDateTime &startTime = QDateTime(),
|
||||||
|
const QDateTime &endTime = QDateTime(),const bool &isReturnFilterEnable = false,const bool &isReturn = false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取模型数据过滤条件,用于初始化过滤对话框
|
||||||
|
*/
|
||||||
|
void getFilter(bool &isLevelFilterEnable, QList<int> &levelFilter,
|
||||||
|
bool &isLocationFilterEnable, QList<int> &locationFilter,
|
||||||
|
bool &isRegionFilterEnable, QList<int> ®ionFilter,
|
||||||
|
bool &isTypeFilterEnable, QList<int> &alarmTypeFilter,
|
||||||
|
bool &deviceTypeFilter, QString &subSystem, QString &deviceType,
|
||||||
|
bool &keywordFilterEnable, QString &keyword,
|
||||||
|
bool &timeFilterEnable, QDateTime &startTime, QDateTime &endTime,
|
||||||
|
bool &returnFilterEnable,bool &isReturn);
|
||||||
|
|
||||||
|
bool conditionFilter(EventMsgPtr info);
|
||||||
|
|
||||||
|
void setPriorityFilter(bool &isCheck, QList<int> &priorityFilter);
|
||||||
|
void setLocationFilter(bool &isCheck, QList<int> &locationFilter);
|
||||||
|
void setEventTypeFilter(bool &isCheck, QList<int> &eventTypeFilter, bool &other);
|
||||||
|
void setEventTimeFilter(bool &isCheck,QDate &startTime,QDate &endTime);
|
||||||
|
void setEventTimeFilter(bool &isCheck);
|
||||||
|
|
||||||
|
void getPriorityFilter(bool &isCheck,QList<int> &priorityFilter);
|
||||||
|
|
||||||
|
void getLocationFilter(bool &isCheck,QList<int> &locationFilter);
|
||||||
|
|
||||||
|
void getEventStatusFilter(bool &isCheck, QList<int> &eventStatusFilter);
|
||||||
|
|
||||||
|
void getEventTimeFilter(bool &isCheck,QDateTime &startTime, QDateTime &endTime);
|
||||||
|
|
||||||
|
QList<EventMsgPtr> getListEventInfo();
|
||||||
|
signals:
|
||||||
|
void sigRowChanged();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void sortColumn(int column, Qt::SortOrder order = Qt::AscendingOrder);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
/**
|
||||||
|
* @brief slotMsgRefresh 更新model,重新拉取数据
|
||||||
|
*/
|
||||||
|
void slotMsgRefresh();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief slotMsgArrived 报警消息到达
|
||||||
|
* @param info
|
||||||
|
*/
|
||||||
|
void slotMsgArrived(QList<EventMsgPtr> listEvents);
|
||||||
|
private:
|
||||||
|
void firstFilterByReturn(QList<EventMsgPtr> &filterSet);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QStringList header;
|
||||||
|
QList<EventMsgPtr> m_listShowEventInfo;
|
||||||
|
QList<EventMsgPtr> m_listAllEventInfo;
|
||||||
|
CSystemResources *m_pSystemResources;
|
||||||
|
|
||||||
|
E_ALARM_SORTKEY m_sortKey; //排序规则
|
||||||
|
Qt::SortOrder m_order;
|
||||||
|
|
||||||
|
//Filter
|
||||||
|
bool m_isLevelFilterEnable; //是否按报警级别过滤
|
||||||
|
QList<int> m_levelFilter; //报警级别过滤
|
||||||
|
bool m_isLocationFilterEnable; //是否按车站过滤
|
||||||
|
QList<int> m_locationFilter; //车站过滤
|
||||||
|
bool m_isRegionFilterEnable; //是否按责任区过滤
|
||||||
|
QList<int> m_regionFilter; //责任区过滤
|
||||||
|
bool m_isStatusFilterEnable; //是否按事件状态过滤
|
||||||
|
QList<int> m_statusFilter; //事件状态过滤(所有的要过滤事件状态--如果其他状态没有被勾选,则与下面的内容相同)
|
||||||
|
QList<int> m_statusFilter2; //事件状态过滤(显示在过滤窗中的事件状态)
|
||||||
|
bool m_isDeviceTypeFileter; //设备类型过滤
|
||||||
|
QString m_subSystem; //子系统
|
||||||
|
QString m_deviceType; //设备类型
|
||||||
|
bool m_isKeywordEnable; //关键字过滤
|
||||||
|
QString m_keyword; //关键字
|
||||||
|
bool m_timeFilterEnable; //是否根据时间过滤
|
||||||
|
QDateTime m_startTime; //起始时间
|
||||||
|
QDateTime m_endTime; //终止时间
|
||||||
|
|
||||||
|
bool m_isReturnFilterEnable; //是否根据复归状态过滤
|
||||||
|
bool m_isReturn;
|
||||||
|
|
||||||
|
QMap<int,SAreaInfo> m_areaInfoMap; //区域信息
|
||||||
|
|
||||||
|
QMap<int,QVector<int> > m_areaLocMap; //区域映射
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CEVENTITEMMODEL_H
|
||||||
448
product/src/tools/debug_tool_v2/CEventMsgInfo.cpp
Normal file
448
product/src/tools/debug_tool_v2/CEventMsgInfo.cpp
Normal file
@ -0,0 +1,448 @@
|
|||||||
|
#include "CEventMsgInfo.h"
|
||||||
|
#include <QDateTime>
|
||||||
|
#include "CEventDataCollect.h"
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
CEventMsgInfo::CEventMsgInfo()
|
||||||
|
{
|
||||||
|
alm_type = -1;
|
||||||
|
alm_style = AS_EVENT_ONLY;
|
||||||
|
time_stamp = 1000;
|
||||||
|
domain_id = -1;
|
||||||
|
location_id = -1;
|
||||||
|
app_id = -1;
|
||||||
|
content = QString("");
|
||||||
|
priority = -1;
|
||||||
|
dev_type = -1;
|
||||||
|
region_id = -1;
|
||||||
|
key_id_tag = QString();
|
||||||
|
uuid_base64 = QString();
|
||||||
|
priorityOrder = -1;
|
||||||
|
deleted = false;
|
||||||
|
filterDelete = false;
|
||||||
|
wave_file = QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
CEventMsgInfo::CEventMsgInfo(const CEventMsgInfo &other)
|
||||||
|
{
|
||||||
|
alm_type = other.alm_type;
|
||||||
|
alm_style = other.alm_style;
|
||||||
|
time_stamp = other.time_stamp;
|
||||||
|
domain_id = other.domain_id;
|
||||||
|
location_id = other.location_id;
|
||||||
|
app_id = other.app_id;
|
||||||
|
content = other.content;
|
||||||
|
priority = other.priority;
|
||||||
|
dev_type = other.dev_type;
|
||||||
|
key_id_tag = other.key_id_tag;
|
||||||
|
uuid_base64 = other.uuid_base64;
|
||||||
|
region_id = other.region_id;
|
||||||
|
deleted = other.deleted;
|
||||||
|
filterDelete = other.filterDelete;
|
||||||
|
wave_file = other.wave_file;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventMsgInfo::initialize(const iot_idl::SEvtInfoToEvtClt &eventInfo)
|
||||||
|
{
|
||||||
|
alm_type = eventInfo.alm_type();
|
||||||
|
E_ALARM_LOGICSTATE logic = (E_ALARM_LOGICSTATE)eventInfo.logic_state();
|
||||||
|
if(logic == E_ALS_ALARM || logic == E_ALS_ALARM_CFM ||
|
||||||
|
logic == E_ALS_ALARM_DEL || logic == E_ALS_ALARM_CFM_DEL)
|
||||||
|
{
|
||||||
|
alm_style = AS_ALARM;
|
||||||
|
}else if(logic == E_ALS_RETURN || logic == E_ALS_RETURN_CFM ||
|
||||||
|
logic == E_ALS_RETURN_DEL || logic == E_ALS_RETURN_CFM_DEL)
|
||||||
|
{
|
||||||
|
alm_style = AS_ALARM_RTN;
|
||||||
|
}else{
|
||||||
|
alm_style = AS_EVENT_ONLY;
|
||||||
|
}
|
||||||
|
time_stamp = eventInfo.time_stamp();
|
||||||
|
alm_status = eventInfo.alm_status();
|
||||||
|
domain_id = eventInfo.domain_id();
|
||||||
|
location_id = eventInfo.location_id();
|
||||||
|
app_id = eventInfo.app_id();
|
||||||
|
content = QString::fromStdString(eventInfo.content());
|
||||||
|
priority = eventInfo.priority();
|
||||||
|
dev_type = eventInfo.dev_type();
|
||||||
|
key_id_tag = QString::fromStdString(eventInfo.key_id_tag());
|
||||||
|
uuid_base64 = QString::fromStdString(eventInfo.uuid_base64());
|
||||||
|
if(eventInfo.has_region_id() && eventInfo.region_id() > 0)
|
||||||
|
{
|
||||||
|
region_id = eventInfo.region_id();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
region_id = -1;
|
||||||
|
}
|
||||||
|
wave_file = QString::fromStdString(eventInfo.wave_file());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CEventMsgInfo::lessThan(EventMsgPtr 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(priorityOrder == info->priorityOrder)
|
||||||
|
{
|
||||||
|
if(time_stamp <= info->time_stamp)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_SORT_TIME:
|
||||||
|
{
|
||||||
|
if(time_stamp < info->time_stamp)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(time_stamp > info->time_stamp)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if(time_stamp == info->time_stamp)
|
||||||
|
{
|
||||||
|
if(priorityOrder <= info->priorityOrder)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_SORT_LOCATION:
|
||||||
|
{
|
||||||
|
if(location_id < info->location_id)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(location_id > info->location_id)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if(location_id == info->location_id)
|
||||||
|
{
|
||||||
|
if(time_stamp <= info->time_stamp)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_SORT_REGION:
|
||||||
|
{
|
||||||
|
if(region_id < info->region_id)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(region_id > info->region_id)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if(region_id == info->region_id)
|
||||||
|
{
|
||||||
|
if(time_stamp <= info->time_stamp)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_SORT_TYPE:
|
||||||
|
{
|
||||||
|
if(alm_type < info->alm_type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(alm_type > info->alm_type)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if(alm_type == info->alm_type)
|
||||||
|
{
|
||||||
|
if(time_stamp <= info->time_stamp)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_SORT_STATUS:
|
||||||
|
{
|
||||||
|
if(alm_status < info->alm_status)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(alm_status > info->alm_status)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if(alm_status == info->alm_status)
|
||||||
|
{
|
||||||
|
if(time_stamp <= info->time_stamp)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_SORT_STYLE:
|
||||||
|
{
|
||||||
|
if(alm_style <info->alm_style)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(alm_style >info->alm_style)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(time_stamp < info->time_stamp)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_SORT_CONTENT:
|
||||||
|
{
|
||||||
|
if(content.isEmpty() && info->content.isEmpty())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
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(content == info->content)
|
||||||
|
{
|
||||||
|
if(time_stamp < info->time_stamp)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CEventMsgInfo::moreThan(EventMsgPtr 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(priorityOrder == info->priorityOrder)
|
||||||
|
{
|
||||||
|
if(time_stamp >= info->time_stamp)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_SORT_TIME:
|
||||||
|
{
|
||||||
|
if(time_stamp > info->time_stamp)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(time_stamp < info->time_stamp)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if(time_stamp == info->time_stamp)
|
||||||
|
{
|
||||||
|
if(priorityOrder < info->priorityOrder)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_SORT_LOCATION:
|
||||||
|
{
|
||||||
|
if(location_id > info->location_id)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(location_id < info->location_id)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if(location_id == info->location_id)
|
||||||
|
{
|
||||||
|
if(time_stamp <= info->time_stamp)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_SORT_REGION:
|
||||||
|
{
|
||||||
|
if(region_id > info->region_id)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(region_id < info->region_id)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if(region_id == info->region_id)
|
||||||
|
{
|
||||||
|
if(time_stamp <= info->time_stamp)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_SORT_TYPE:
|
||||||
|
{
|
||||||
|
if(alm_type > info->alm_type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(alm_type < info->alm_type)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if(alm_type == info->alm_type)
|
||||||
|
{
|
||||||
|
if(time_stamp <= info->time_stamp)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_SORT_STATUS:
|
||||||
|
{
|
||||||
|
if(alm_status > info->alm_status)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(alm_status < info->alm_status)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if(alm_status == info->alm_status)
|
||||||
|
{
|
||||||
|
if(time_stamp <= info->time_stamp)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_SORT_STYLE:
|
||||||
|
{
|
||||||
|
if(alm_style <info->alm_style)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if(alm_style >info->alm_style)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(time_stamp < info->time_stamp)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_SORT_CONTENT:
|
||||||
|
{
|
||||||
|
if(content.isEmpty() && info->content.isEmpty())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(content.isEmpty() && (!info->content.isEmpty()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if((!content.isEmpty()) && info->content.isEmpty())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(content > info->content)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(content < info->content)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if(content == info->content)
|
||||||
|
{
|
||||||
|
if(time_stamp < info->time_stamp)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CEventMsgInfo::operator==(const EventMsgPtr &target)
|
||||||
|
{
|
||||||
|
return uuid_base64 == target->uuid_base64;
|
||||||
|
}
|
||||||
168
product/src/tools/debug_tool_v2/CEventMsgInfo.h
Normal file
168
product/src/tools/debug_tool_v2/CEventMsgInfo.h
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
#ifndef ALARMMSGINFO_H
|
||||||
|
#define ALARMMSGINFO_H
|
||||||
|
|
||||||
|
#include <QMetaType>
|
||||||
|
#include <QStringList>
|
||||||
|
#include <QSharedPointer>
|
||||||
|
#include "alarm_server_api/CAlmApiForEvtClt.h"
|
||||||
|
#include "common/DataType.h"
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
|
#define LIMIT_HIS_RECORD 10000
|
||||||
|
#define REAL_BUTTON_COLUMN 7 //按钮所在列
|
||||||
|
#define HIS_BUTTON_COLUMN 9 //按钮所在列
|
||||||
|
//排序
|
||||||
|
enum E_ALARM_VIEW
|
||||||
|
{
|
||||||
|
E_ALARM_REAL_EVENT = 0,
|
||||||
|
E_ALARM_HIS_EVENT =1
|
||||||
|
};
|
||||||
|
enum E_ALARM_SORTKEY
|
||||||
|
{
|
||||||
|
E_SORT_TIME = 0, //时间戳
|
||||||
|
E_SORT_PRIORITY, //优先级
|
||||||
|
E_SORT_LOCATION, //车站
|
||||||
|
E_SORT_REGION, //责任区
|
||||||
|
E_SORT_TYPE, //事件类型
|
||||||
|
E_SORT_STATUS, //事件状态
|
||||||
|
E_SORT_STYLE, //复归状态
|
||||||
|
E_SORT_CONTENT //告警内容
|
||||||
|
};
|
||||||
|
|
||||||
|
enum E_ALARM_STYLE
|
||||||
|
{
|
||||||
|
AS_ALARM = 0, // 告警动作
|
||||||
|
AS_ALARM_RTN = 1, // 告警恢复
|
||||||
|
AS_EVENT_ONLY = 2, // 仅产生事件
|
||||||
|
AS_DO_NOTHING = 3, // 无
|
||||||
|
};
|
||||||
|
// 报警状态
|
||||||
|
enum E_ALARM_LOGICSTATE
|
||||||
|
{
|
||||||
|
E_ALS_ALARM = 0, // 报警状态
|
||||||
|
E_ALS_ALARM_CFM=1, // 报警确认状态
|
||||||
|
E_ALS_RETURN=2, // 报警返回状态
|
||||||
|
E_ALS_RETURN_CFM=3, // 报警返回确认状态
|
||||||
|
ALS_EVT_ONLY = 4, // 仅事件
|
||||||
|
|
||||||
|
//在原始告警窗删除后,可能还需要在智能告警窗展示
|
||||||
|
E_ALS_ALARM_DEL = 20, // 告警状态,且在原始告警窗已删除,可能是达到数量上限而删除
|
||||||
|
E_ALS_ALARM_CFM_DEL =21, // 告警确认状态,且在原始告警窗已删除
|
||||||
|
E_ALS_RETURN_DEL=22, // 告警返回状态,且在原始告警窗已删除,可能是达到数量上限而删除
|
||||||
|
E_ALS_RETURN_CFM_DEL=23, // 告警返回确认状态,且在原始告警窗已删除
|
||||||
|
E_ALS_BAD = 100
|
||||||
|
};
|
||||||
|
|
||||||
|
enum E_LOCATION_TYPE
|
||||||
|
{
|
||||||
|
E_LOCATION_NODE = 0,
|
||||||
|
E_LOCATION_AREA
|
||||||
|
};
|
||||||
|
|
||||||
|
struct STimeKeyIdTag
|
||||||
|
{
|
||||||
|
quint64 time_stamp;
|
||||||
|
QString key_id_tag;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SAreaInfo
|
||||||
|
{
|
||||||
|
int nId;
|
||||||
|
QString stTag;
|
||||||
|
QString stDes;
|
||||||
|
E_LOCATION_TYPE eType;
|
||||||
|
int nPareaId;
|
||||||
|
SAreaInfo() {
|
||||||
|
nId = -1;
|
||||||
|
stTag = QString();
|
||||||
|
stDes = QString();
|
||||||
|
eType = E_LOCATION_NODE;
|
||||||
|
nPareaId = -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
struct ST_FILTER
|
||||||
|
{
|
||||||
|
|
||||||
|
bool isLevelFilterEnable;
|
||||||
|
QList<int> levelFilter; //报警级别过滤
|
||||||
|
bool isLocationFilterEnable; //是否按车站过滤
|
||||||
|
QList<int> locationFilter; //车站过滤
|
||||||
|
bool isRegionFilterEnable; //是否按责任区过滤
|
||||||
|
QList<int> regionFilter; //责任区过滤
|
||||||
|
bool isStatusFilterEnable; //是否按报警类型过滤
|
||||||
|
QList<int> statusFilter; //事件状态过滤(所有的要过滤事件状态--如果其他状态没有被勾选,则与下面的内容相同)
|
||||||
|
QList<int> statusFilter2; //事件状态过滤(显示在过滤窗中的事件状态)
|
||||||
|
bool isDeviceTypeFileter; //设备类型过滤
|
||||||
|
QString subSystem; //子系统
|
||||||
|
QString deviceType; //设备类型
|
||||||
|
bool isKeywordEnable; //关键字过滤
|
||||||
|
QString keyword; //关键字
|
||||||
|
bool timeFilterEnable; //是否根据时间过滤
|
||||||
|
QDateTime startTime; //起始时间
|
||||||
|
QDateTime endTime; //终止时间
|
||||||
|
|
||||||
|
bool isReturnFilterEnable; //是否根据复归状态过滤
|
||||||
|
bool isReturn;
|
||||||
|
ST_FILTER() {
|
||||||
|
isLevelFilterEnable = false;
|
||||||
|
isLocationFilterEnable = false;
|
||||||
|
isRegionFilterEnable = false;
|
||||||
|
|
||||||
|
isStatusFilterEnable = false;
|
||||||
|
|
||||||
|
isDeviceTypeFileter = false;
|
||||||
|
subSystem = QString();
|
||||||
|
deviceType = QString();
|
||||||
|
isKeywordEnable = false;
|
||||||
|
keyword = QString();
|
||||||
|
timeFilterEnable = false;
|
||||||
|
QDateTime dataTime(QDateTime::currentDateTime());
|
||||||
|
dataTime.setTime(QTime(dataTime.time().hour(),dataTime.time().second(),0,0));
|
||||||
|
startTime = dataTime;
|
||||||
|
dataTime.setTime(QTime(dataTime.time().hour(),dataTime.time().second(),59,999));
|
||||||
|
endTime = dataTime;
|
||||||
|
|
||||||
|
isReturnFilterEnable =false;
|
||||||
|
isReturn = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
class CEventMsgInfo;
|
||||||
|
typedef QSharedPointer<CEventMsgInfo> EventMsgPtr;
|
||||||
|
|
||||||
|
class CEventMsgInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CEventMsgInfo();
|
||||||
|
CEventMsgInfo(const CEventMsgInfo &other);
|
||||||
|
void initialize(const iot_idl::SEvtInfoToEvtClt &eventInfo);
|
||||||
|
bool lessThan(EventMsgPtr info, E_ALARM_SORTKEY sortkey = E_SORT_PRIORITY);
|
||||||
|
bool moreThan(EventMsgPtr info, E_ALARM_SORTKEY sortkey = E_SORT_PRIORITY);
|
||||||
|
bool operator==(const EventMsgPtr &target);
|
||||||
|
qint32 alm_type; //报警类型
|
||||||
|
E_ALARM_STYLE alm_style; //< 告警类型
|
||||||
|
quint64 time_stamp; //时标(RFC1305、POSIX时标标准)
|
||||||
|
qint32 domain_id; //域ID
|
||||||
|
qint32 location_id; //位置ID
|
||||||
|
qint32 app_id; //应用号
|
||||||
|
QString content; //报警内容
|
||||||
|
qint32 priority; //报警优先级id
|
||||||
|
qint32 dev_type; //设备类型ID
|
||||||
|
qint32 region_id; //责任区ID
|
||||||
|
bool deleted; //实时事件删除标志
|
||||||
|
bool filterDelete; //过滤删除
|
||||||
|
QString uuid_base64; //< uuid 主键
|
||||||
|
QString key_id_tag; //< 测点ID
|
||||||
|
int32 alm_status; //事件状态
|
||||||
|
uint cfm_user; //确认人
|
||||||
|
uint64 cfm_time; //确认时间
|
||||||
|
//Extend
|
||||||
|
qint32 priorityOrder;
|
||||||
|
|
||||||
|
QString wave_file;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(CEventMsgInfo)
|
||||||
|
Q_DECLARE_METATYPE(EventMsgPtr)
|
||||||
|
|
||||||
|
#endif // ALARMMSGINFO_H
|
||||||
115
product/src/tools/debug_tool_v2/CEventMsgManage.cpp
Normal file
115
product/src/tools/debug_tool_v2/CEventMsgManage.cpp
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
#include "CEventMsgManage.h"
|
||||||
|
#include <QMutex>
|
||||||
|
#include <QMutexLocker>
|
||||||
|
CEventMsgManage * CEventMsgManage::m_pInstance = Q_NULLPTR;
|
||||||
|
|
||||||
|
CEventMsgManage *CEventMsgManage::instance()
|
||||||
|
{
|
||||||
|
if(m_pInstance == Q_NULLPTR)
|
||||||
|
{
|
||||||
|
m_pInstance = new CEventMsgManage();
|
||||||
|
}
|
||||||
|
return m_pInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CEventMsgManage::CEventMsgManage()
|
||||||
|
: QObject()
|
||||||
|
{
|
||||||
|
mutex = new QMutex();
|
||||||
|
}
|
||||||
|
|
||||||
|
CEventMsgManage::~CEventMsgManage()
|
||||||
|
{
|
||||||
|
m_listEventInfo.clear();
|
||||||
|
delete mutex;
|
||||||
|
m_pInstance = Q_NULLPTR;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<EventMsgPtr> CEventMsgManage::getListEventInfo()
|
||||||
|
{
|
||||||
|
QMutexLocker locker(mutex);
|
||||||
|
return m_listEventInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEventMsgManage::getListEventCount()
|
||||||
|
{
|
||||||
|
if(m_listEventInfo.isEmpty())
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_listEventInfo.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventMsgManage::addEventMsg(const EventMsgPtr msg)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(mutex);
|
||||||
|
if(!m_listEventInfo.isEmpty())
|
||||||
|
{
|
||||||
|
bool inserted = false;
|
||||||
|
QList<EventMsgPtr>::iterator iter = m_listEventInfo.begin();
|
||||||
|
while (iter != m_listEventInfo.end())
|
||||||
|
{
|
||||||
|
if(msg->time_stamp >= (*iter)->time_stamp)
|
||||||
|
{
|
||||||
|
m_listEventInfo.insert(iter, msg);
|
||||||
|
inserted = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
iter++;
|
||||||
|
}
|
||||||
|
if (!inserted)
|
||||||
|
{
|
||||||
|
m_listEventInfo.append(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_listEventInfo.append(msg);
|
||||||
|
}
|
||||||
|
if(m_listEventInfo.size() > 10000)
|
||||||
|
{
|
||||||
|
EventMsgPtr info = m_listEventInfo.takeLast();
|
||||||
|
info->deleted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventMsgManage::linkWave2EvtMsg(const QList<QString> &uuidList, const QString &waveFile)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(mutex);
|
||||||
|
for(int index(0);index<uuidList.size();index++)
|
||||||
|
{
|
||||||
|
QList<EventMsgPtr>::iterator it = m_listEventInfo.begin();
|
||||||
|
while (it != m_listEventInfo.end()) {
|
||||||
|
if((*it)->uuid_base64 == uuidList.at(index))
|
||||||
|
{
|
||||||
|
(*it)->wave_file = waveFile;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventMsgManage::removeEventMsgByDomainID(const int domainId)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(mutex);
|
||||||
|
QList<EventMsgPtr>::iterator it = m_listEventInfo.begin();
|
||||||
|
while (it != m_listEventInfo.end())
|
||||||
|
{
|
||||||
|
if(domainId == (*it)->domain_id)
|
||||||
|
{
|
||||||
|
it = m_listEventInfo.erase(it);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventMsgManage::clearRTMsg()
|
||||||
|
{
|
||||||
|
QMutexLocker locker(mutex);
|
||||||
|
m_listEventInfo.clear();
|
||||||
|
}
|
||||||
|
|
||||||
39
product/src/tools/debug_tool_v2/CEventMsgManage.h
Normal file
39
product/src/tools/debug_tool_v2/CEventMsgManage.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#ifndef CEventMsgManage_H
|
||||||
|
#define CEventMsgManage_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "CEventMsgInfo.h"
|
||||||
|
|
||||||
|
class QMutex;
|
||||||
|
|
||||||
|
class CEventMsgManage : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
static CEventMsgManage * instance();
|
||||||
|
|
||||||
|
~CEventMsgManage();
|
||||||
|
|
||||||
|
QList<EventMsgPtr> getListEventInfo();
|
||||||
|
|
||||||
|
int getListEventCount();
|
||||||
|
|
||||||
|
void addEventMsg(const EventMsgPtr msg);
|
||||||
|
|
||||||
|
void linkWave2EvtMsg(const QList<QString> &uuidList,const QString &waveFile);
|
||||||
|
|
||||||
|
void removeEventMsgByDomainID(const int domainId);
|
||||||
|
|
||||||
|
void clearRTMsg();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CEventMsgManage();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QMutex * mutex;
|
||||||
|
QList<EventMsgPtr> m_listEventInfo;
|
||||||
|
QList<EventMsgPtr> m_historyEventInfo;
|
||||||
|
static CEventMsgManage * m_pInstance;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CEventMsgManage_H
|
||||||
36
product/src/tools/debug_tool_v2/CEventView.cpp
Normal file
36
product/src/tools/debug_tool_v2/CEventView.cpp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#include <QHeaderView>
|
||||||
|
#include "CEventView.h"
|
||||||
|
|
||||||
|
CEventView::CEventView(QWidget *parent)
|
||||||
|
:QTableView(parent)
|
||||||
|
{
|
||||||
|
setSortingEnabled(true);
|
||||||
|
//setAlternatingRowColors(true);
|
||||||
|
horizontalHeader()->setStretchLastSection(true);
|
||||||
|
setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
|
//setSelectionMode(QAbstractItemView::MultiSelection);
|
||||||
|
}
|
||||||
|
|
||||||
|
QModelIndexList CEventView::selectedItems() const
|
||||||
|
{
|
||||||
|
QModelIndexList indexList;
|
||||||
|
foreach(QModelIndex index, selectedIndexes())
|
||||||
|
{
|
||||||
|
if(index.column() == 0)
|
||||||
|
{
|
||||||
|
indexList.append(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return indexList;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventView::setDefaultRowHeight(int height)
|
||||||
|
{
|
||||||
|
verticalHeader()->setDefaultSectionSize(height);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEventView::selectionChanged(const QItemSelection &selected, const QItemSelection &deSelected)
|
||||||
|
{
|
||||||
|
QTableView::selectionChanged(selected, deSelected);
|
||||||
|
emit sig_selectionChanged(selectedIndexes());
|
||||||
|
}
|
||||||
22
product/src/tools/debug_tool_v2/CEventView.h
Normal file
22
product/src/tools/debug_tool_v2/CEventView.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#ifndef CEventView_H
|
||||||
|
#define CEventView_H
|
||||||
|
|
||||||
|
#include <QTableView>
|
||||||
|
|
||||||
|
class CEventView : public QTableView
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
CEventView(QWidget *parent = Q_NULLPTR);
|
||||||
|
|
||||||
|
QModelIndexList selectedItems() const;
|
||||||
|
|
||||||
|
void setDefaultRowHeight(int height);
|
||||||
|
signals:
|
||||||
|
void sig_selectionChanged(const QModelIndexList &list);
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deSelected);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ALARMVIEW_H
|
||||||
77
product/src/tools/debug_tool_v2/CFesChanData.cpp
Normal file
77
product/src/tools/debug_tool_v2/CFesChanData.cpp
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
#include "CFesChanData.h"
|
||||||
|
#include "ui_CFesChanData.h"
|
||||||
|
#include "CActiveWindow.h"
|
||||||
|
CFesChanData::CFesChanData(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::CFesChanData)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
CFesChanData::~CFesChanData()
|
||||||
|
{
|
||||||
|
if(ptrChanMonDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrChanMonDlg;
|
||||||
|
}
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesChanData::Init(bool isConnected)
|
||||||
|
{
|
||||||
|
if(isConnected)
|
||||||
|
{
|
||||||
|
m_ConnectFlag = CN_CommConnect;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
m_ConnectFlag = CN_CommDisconnect;
|
||||||
|
}
|
||||||
|
initVariable();
|
||||||
|
initSignalAndSlot();
|
||||||
|
initView();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesChanData::slotActiveWindow()
|
||||||
|
{
|
||||||
|
setActiveWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesChanData::initVariable()
|
||||||
|
{
|
||||||
|
ptrChanMonDlg = new ChanMonDlg((int)E_ACTIVE_WINDOW_FES_CHAN_DATA,this);
|
||||||
|
ptrChanMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesChanData::initSignalAndSlot()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesChanData::initView()
|
||||||
|
{
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->widget);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrChanMonDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesChanData::setActiveWindow()
|
||||||
|
{
|
||||||
|
//CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_CHAN_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesChanData::OnNetConnect()
|
||||||
|
{
|
||||||
|
m_ConnectFlag =CN_CommConnect;
|
||||||
|
|
||||||
|
if(ptrChanMonDlg!=NULL)
|
||||||
|
ptrChanMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesChanData::OnNetDisConnect()
|
||||||
|
{
|
||||||
|
m_ConnectFlag =CN_CommDisconnect;
|
||||||
|
|
||||||
|
if(ptrChanMonDlg!=NULL)
|
||||||
|
ptrChanMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
}
|
||||||
42
product/src/tools/debug_tool_v2/CFesChanData.h
Normal file
42
product/src/tools/debug_tool_v2/CFesChanData.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#ifndef CFESCHANDATA_H
|
||||||
|
#define CFESCHANDATA_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "chanmondlg.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CFesChanData;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CFesChanData : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CFesChanData(QWidget *parent = 0);
|
||||||
|
~CFesChanData();
|
||||||
|
void Init(bool isConnected);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void slotActiveWindow();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void initVariable();
|
||||||
|
void initSignalAndSlot();
|
||||||
|
void initView();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void setActiveWindow();
|
||||||
|
|
||||||
|
void OnNetConnect();
|
||||||
|
void OnNetDisConnect();
|
||||||
|
|
||||||
|
public:
|
||||||
|
ChanMonDlg *ptrChanMonDlg;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::CFesChanData *ui;
|
||||||
|
int m_ConnectFlag; //连接成功标志
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CFESCHANDATA_H
|
||||||
36
product/src/tools/debug_tool_v2/CFesChanData.ui
Normal file
36
product/src/tools/debug_tool_v2/CFesChanData.ui
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CFesChanData</class>
|
||||||
|
<widget class="QWidget" name="CFesChanData">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>558</width>
|
||||||
|
<height>343</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QWidget" name="widget" native="true"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
170
product/src/tools/debug_tool_v2/CFesCtrlSim.cpp
Normal file
170
product/src/tools/debug_tool_v2/CFesCtrlSim.cpp
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
#include "CFesCtrlSim.h"
|
||||||
|
#include "ui_CFesCtrlSim.h"
|
||||||
|
#include "CActiveWindow.h"
|
||||||
|
|
||||||
|
CFesCtrlSim::CFesCtrlSim(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::CFesCtrlSim),
|
||||||
|
ptrSimAoDlg(Q_NULLPTR),
|
||||||
|
ptrSimDoDlg(Q_NULLPTR),
|
||||||
|
ptrSimMoDlg(Q_NULLPTR),
|
||||||
|
ptrDefCmdDlg(Q_NULLPTR)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
CFesCtrlSim::~CFesCtrlSim()
|
||||||
|
{
|
||||||
|
if(ptrSimAoDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrSimAoDlg;
|
||||||
|
}
|
||||||
|
if(ptrSimDoDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrSimDoDlg;
|
||||||
|
}
|
||||||
|
if(ptrSimMoDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrSimMoDlg;
|
||||||
|
}
|
||||||
|
if(ptrDefCmdDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrDefCmdDlg;
|
||||||
|
}
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesCtrlSim::Init(bool isConnected)
|
||||||
|
{
|
||||||
|
if(isConnected)
|
||||||
|
{
|
||||||
|
m_ConnectFlag = CN_CommConnect;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
m_ConnectFlag = CN_CommDisconnect;
|
||||||
|
}
|
||||||
|
initVariable();
|
||||||
|
initSignalAndSlot();
|
||||||
|
initView();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesCtrlSim::slotActiveWindow()
|
||||||
|
{
|
||||||
|
setActiveWindow(ui->tabWidget->currentIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesCtrlSim::initVariable()
|
||||||
|
{
|
||||||
|
ptrSimAoDlg = new SimAoDlg((int)E_ACTIVE_WINDOW_FES_AO_CTRL,this);
|
||||||
|
ptrSimAoDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesCtrlSim::initSignalAndSlot()
|
||||||
|
{
|
||||||
|
connect(ui->tabWidget,&QTabWidget::currentChanged,this,&CFesCtrlSim::setActiveWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesCtrlSim::initView()
|
||||||
|
{
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrSimAoDlg, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
ui->tabWidget->removeTab(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesCtrlSim::setActiveWindow(int current)
|
||||||
|
{
|
||||||
|
switch (current) {
|
||||||
|
case 0:
|
||||||
|
if(ptrSimAoDlg == NULL)
|
||||||
|
{
|
||||||
|
ptrSimAoDlg = new SimAoDlg((int)E_ACTIVE_WINDOW_FES_AO_CTRL,this);
|
||||||
|
ptrSimAoDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrSimAoDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_AO_CTRL);
|
||||||
|
ptrSimAoDlg->OnRTURefresh();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if(ptrSimDoDlg == NULL)
|
||||||
|
{
|
||||||
|
ptrSimDoDlg = new SimDoDlg((int)E_ACTIVE_WINDOW_FES_DO_CTRL,this);
|
||||||
|
ptrSimDoDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab_2);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrSimDoDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_DO_CTRL);
|
||||||
|
ptrSimDoDlg->OnRTURefresh();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(ptrSimMoDlg == NULL)
|
||||||
|
{
|
||||||
|
ptrSimMoDlg = new SimMoDlg((int)E_ACTIVE_WINDOW_FES_MO_CTRL,this);
|
||||||
|
ptrSimMoDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab_3);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrSimMoDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_MO_CTRL);
|
||||||
|
ptrSimMoDlg->OnRTURefresh();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if(ptrDefCmdDlg == NULL)
|
||||||
|
{
|
||||||
|
ptrDefCmdDlg = new DefCmdDlg((int)E_ACTIVE_WINDOW_FES_CUSTOM_CTRL,this);
|
||||||
|
ptrDefCmdDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab_4);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrDefCmdDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_CUSTOM_CTRL);
|
||||||
|
ptrDefCmdDlg->OnRTURefresh();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesCtrlSim::OnNetConnect()
|
||||||
|
{
|
||||||
|
m_ConnectFlag =CN_CommConnect;
|
||||||
|
|
||||||
|
if(ptrSimAoDlg!=NULL)
|
||||||
|
ptrSimAoDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrSimDoDlg!=NULL)
|
||||||
|
ptrSimDoDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrSimMoDlg!=NULL)
|
||||||
|
ptrSimMoDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrDefCmdDlg!=NULL)
|
||||||
|
ptrDefCmdDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesCtrlSim::OnNetDisConnect()
|
||||||
|
{
|
||||||
|
m_ConnectFlag =CN_CommDisconnect;
|
||||||
|
|
||||||
|
if(ptrSimAoDlg!=NULL)
|
||||||
|
ptrSimAoDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrSimDoDlg!=NULL)
|
||||||
|
ptrSimDoDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrSimMoDlg!=NULL)
|
||||||
|
ptrSimMoDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrDefCmdDlg!=NULL)
|
||||||
|
ptrDefCmdDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
}
|
||||||
48
product/src/tools/debug_tool_v2/CFesCtrlSim.h
Normal file
48
product/src/tools/debug_tool_v2/CFesCtrlSim.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#ifndef CFESCTRLSIM_H
|
||||||
|
#define CFESCTRLSIM_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "defcmddlg.h"
|
||||||
|
#include "simaodlg.h"
|
||||||
|
#include "simdodlg.h"
|
||||||
|
#include "simmodlg.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CFesCtrlSim;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CFesCtrlSim : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CFesCtrlSim(QWidget *parent = 0);
|
||||||
|
~CFesCtrlSim();
|
||||||
|
void Init(bool isConnected);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void slotActiveWindow();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void initVariable();
|
||||||
|
void initSignalAndSlot();
|
||||||
|
void initView();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void setActiveWindow(int current);
|
||||||
|
|
||||||
|
void OnNetConnect();
|
||||||
|
void OnNetDisConnect();
|
||||||
|
|
||||||
|
public:
|
||||||
|
SimAoDlg *ptrSimAoDlg;
|
||||||
|
SimDoDlg *ptrSimDoDlg;
|
||||||
|
SimMoDlg *ptrSimMoDlg;
|
||||||
|
DefCmdDlg *ptrDefCmdDlg;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::CFesCtrlSim *ui;
|
||||||
|
int m_ConnectFlag; //连接成功标志
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CFESCTRLSIM_H
|
||||||
66
product/src/tools/debug_tool_v2/CFesCtrlSim.ui
Normal file
66
product/src/tools/debug_tool_v2/CFesCtrlSim.ui
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CFesCtrlSim</class>
|
||||||
|
<widget class="QWidget" name="CFesCtrlSim">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>653</width>
|
||||||
|
<height>343</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tab">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>模拟量控制</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_2">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>数字量控制</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_3">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>混合量控制</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_4">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="title">
|
||||||
|
<string>自定义控制</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
178
product/src/tools/debug_tool_v2/CFesData.cpp
Normal file
178
product/src/tools/debug_tool_v2/CFesData.cpp
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
#include "CFesData.h"
|
||||||
|
#include "ui_CFesData.h"
|
||||||
|
#include "pub_widget/MessageBox.h"
|
||||||
|
#include <QFile>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QXmlStreamReader>
|
||||||
|
#include "CActiveWindow.h"
|
||||||
|
CFesData::CFesData(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::CFesData),
|
||||||
|
ptrAiMonDlg(Q_NULLPTR),
|
||||||
|
ptrDiMonDlg(Q_NULLPTR),
|
||||||
|
ptrPiMonDlg(Q_NULLPTR),
|
||||||
|
ptrMiMonDlg(Q_NULLPTR)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
CFesData::~CFesData()
|
||||||
|
{
|
||||||
|
if(ptrAiMonDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrAiMonDlg;
|
||||||
|
}
|
||||||
|
if(ptrDiMonDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrDiMonDlg;
|
||||||
|
}
|
||||||
|
if(ptrMiMonDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrMiMonDlg;
|
||||||
|
}
|
||||||
|
if(ptrPiMonDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrPiMonDlg;
|
||||||
|
}
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesData::Init(bool isConnected)
|
||||||
|
{
|
||||||
|
if(isConnected)
|
||||||
|
{
|
||||||
|
m_ConnectFlag = CN_CommConnect;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
m_ConnectFlag = CN_CommDisconnect;
|
||||||
|
}
|
||||||
|
initVariable();
|
||||||
|
initSignalAndSlot();
|
||||||
|
initView();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesData::slotActiveWindow()
|
||||||
|
{
|
||||||
|
setActiveWindow(ui->tabWidget->currentIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesData::initVariable()
|
||||||
|
{
|
||||||
|
ptrAiMonDlg = new AiMonDlg((int)E_ACTIVE_WINDOW_FES_AI_DATA,this);
|
||||||
|
ptrAiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesData::initSignalAndSlot()
|
||||||
|
{
|
||||||
|
connect(ui->tabWidget,&QTabWidget::currentChanged,this,&CFesData::setActiveWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesData::initView()
|
||||||
|
{
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab_1);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrAiMonDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesData::setActiveWindow(int current)
|
||||||
|
{
|
||||||
|
switch (current) {
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
if(ptrAiMonDlg == NULL)
|
||||||
|
{
|
||||||
|
ptrAiMonDlg = new AiMonDlg((int)E_ACTIVE_WINDOW_FES_AI_DATA,this);
|
||||||
|
ptrAiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab_1);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrAiMonDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_AI_DATA);
|
||||||
|
ptrAiMonDlg->OnRTURefresh();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
if(ptrDiMonDlg == NULL)
|
||||||
|
{
|
||||||
|
ptrDiMonDlg = new DiMonDlg((int)E_ACTIVE_WINDOW_FES_DI_DATA,this);
|
||||||
|
ptrDiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab_2);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrDiMonDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_DI_DATA);
|
||||||
|
ptrDiMonDlg->OnRTURefresh();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(ptrPiMonDlg == NULL)
|
||||||
|
{
|
||||||
|
ptrPiMonDlg = new PiMonDlg((int)E_ACTIVE_WINDOW_FES_PI_DATA,this);
|
||||||
|
ptrPiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab_3);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrPiMonDlg, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_PI_DATA);
|
||||||
|
ptrPiMonDlg->OnRTURefresh();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if(ptrMiMonDlg == NULL)
|
||||||
|
{
|
||||||
|
ptrMiMonDlg = new MiMonDlg((int)E_ACTIVE_WINDOW_FES_MI_DATA,this);
|
||||||
|
ptrMiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab_4);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrMiMonDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_MI_DATA);
|
||||||
|
ptrMiMonDlg->OnRTURefresh();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesData::OnNetConnect()
|
||||||
|
{
|
||||||
|
m_ConnectFlag =CN_CommConnect;
|
||||||
|
|
||||||
|
if(ptrAiMonDlg!=NULL)
|
||||||
|
ptrAiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrDiMonDlg!=NULL)
|
||||||
|
ptrDiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrPiMonDlg!=NULL)
|
||||||
|
ptrPiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrMiMonDlg!=NULL)
|
||||||
|
ptrMiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesData::OnNetDisConnect()
|
||||||
|
{
|
||||||
|
m_ConnectFlag =CN_CommDisconnect;
|
||||||
|
|
||||||
|
if(ptrAiMonDlg!=NULL)
|
||||||
|
ptrAiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrDiMonDlg!=NULL)
|
||||||
|
ptrDiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrPiMonDlg!=NULL)
|
||||||
|
ptrPiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrMiMonDlg!=NULL)
|
||||||
|
ptrMiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
}
|
||||||
48
product/src/tools/debug_tool_v2/CFesData.h
Normal file
48
product/src/tools/debug_tool_v2/CFesData.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#ifndef CFESDATA_H
|
||||||
|
#define CFESDATA_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "aimondlg.h"
|
||||||
|
#include "dimondlg.h"
|
||||||
|
#include "pimondlg.h"
|
||||||
|
#include "mimondlg.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CFesData;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CFesData : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CFesData(QWidget *parent = 0);
|
||||||
|
~CFesData();
|
||||||
|
void Init(bool isConnected);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void slotActiveWindow();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void initVariable();
|
||||||
|
void initSignalAndSlot();
|
||||||
|
void initView();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void setActiveWindow(int current);
|
||||||
|
|
||||||
|
void OnNetConnect();
|
||||||
|
void OnNetDisConnect();
|
||||||
|
|
||||||
|
public:
|
||||||
|
AiMonDlg *ptrAiMonDlg;
|
||||||
|
DiMonDlg *ptrDiMonDlg;
|
||||||
|
PiMonDlg *ptrPiMonDlg;
|
||||||
|
MiMonDlg *ptrMiMonDlg;
|
||||||
|
private:
|
||||||
|
Ui::CFesData *ui;
|
||||||
|
|
||||||
|
int m_ConnectFlag; //连接成功标志
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CFESDATA_H
|
||||||
64
product/src/tools/debug_tool_v2/CFesData.ui
Normal file
64
product/src/tools/debug_tool_v2/CFesData.ui
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CFesData</class>
|
||||||
|
<widget class="QWidget" name="CFesData">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>660</width>
|
||||||
|
<height>401</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tab_1">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>模拟量</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_2">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>数字量</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_3">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>累积量</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_4">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>混合量</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
193
product/src/tools/debug_tool_v2/CFesDataSim.cpp
Normal file
193
product/src/tools/debug_tool_v2/CFesDataSim.cpp
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
#include "CFesDataSim.h"
|
||||||
|
#include "ui_CFesDataSim.h"
|
||||||
|
#include "CActiveWindow.h"
|
||||||
|
|
||||||
|
CFesDataSim::CFesDataSim(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::CFesDataSim),
|
||||||
|
ptrSimAiDlg(Q_NULLPTR),
|
||||||
|
ptrSimDiDlg(Q_NULLPTR),
|
||||||
|
ptrSimPiDlg(Q_NULLPTR),
|
||||||
|
ptrSimMiDlg(Q_NULLPTR),
|
||||||
|
ptrSimEventDlg(Q_NULLPTR)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
CFesDataSim::~CFesDataSim()
|
||||||
|
{
|
||||||
|
|
||||||
|
if(ptrSimAiDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrSimAiDlg;
|
||||||
|
}
|
||||||
|
if(ptrSimDiDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrSimDiDlg;
|
||||||
|
}
|
||||||
|
if(ptrSimPiDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrSimPiDlg;
|
||||||
|
}
|
||||||
|
if(ptrSimMiDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrSimMiDlg;
|
||||||
|
}
|
||||||
|
if(ptrSimEventDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrSimEventDlg;
|
||||||
|
}
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesDataSim::Init(bool isConnected)
|
||||||
|
{
|
||||||
|
if(isConnected)
|
||||||
|
{
|
||||||
|
m_ConnectFlag = CN_CommConnect;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
m_ConnectFlag = CN_CommDisconnect;
|
||||||
|
}
|
||||||
|
initVariable();
|
||||||
|
initSignalAndSlot();
|
||||||
|
initView();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesDataSim::slotActiveWindow()
|
||||||
|
{
|
||||||
|
setActiveWindow(ui->tabWidget->currentIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesDataSim::initVariable()
|
||||||
|
{
|
||||||
|
ptrSimAiDlg = new SimAiDlg((int)E_ACTIVE_WINDOW_FES_AI_CTRL,this);
|
||||||
|
ptrSimAiDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesDataSim::initSignalAndSlot()
|
||||||
|
{
|
||||||
|
connect(ui->tabWidget,&QTabWidget::currentChanged,this,&CFesDataSim::setActiveWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesDataSim::initView()
|
||||||
|
{
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrSimAiDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesDataSim::setActiveWindow(int current)
|
||||||
|
{
|
||||||
|
switch (current) {
|
||||||
|
case 0:
|
||||||
|
if(ptrSimAiDlg == NULL)
|
||||||
|
{
|
||||||
|
ptrSimAiDlg = new SimAiDlg((int)E_ACTIVE_WINDOW_FES_AI_CTRL,this);
|
||||||
|
ptrSimAiDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrSimAiDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_AI_CTRL);
|
||||||
|
ptrSimAiDlg->OnRTURefresh();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if(ptrSimDiDlg == NULL)
|
||||||
|
{
|
||||||
|
ptrSimDiDlg = new SimDiDlg((int)E_ACTIVE_WINDOW_FES_DI_CTRL,this);
|
||||||
|
ptrSimDiDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab_2);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrSimDiDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_DI_CTRL);
|
||||||
|
ptrSimDiDlg->OnRTURefresh();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(ptrSimPiDlg == NULL)
|
||||||
|
{
|
||||||
|
ptrSimPiDlg = new SimPiDlg((int)E_ACTIVE_WINDOW_FES_PI_CTRL,this);
|
||||||
|
ptrSimPiDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab_3);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrSimPiDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_PI_CTRL);
|
||||||
|
ptrSimPiDlg->OnRTURefresh();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if(ptrSimMiDlg == NULL)
|
||||||
|
{
|
||||||
|
ptrSimMiDlg = new SimMiDlg((int)E_ACTIVE_WINDOW_FES_MI_CTRL,this);
|
||||||
|
ptrSimMiDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab_4);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrSimMiDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_MI_CTRL);
|
||||||
|
ptrSimMiDlg->OnRTURefresh();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if(ptrSimEventDlg == NULL)
|
||||||
|
{
|
||||||
|
ptrSimEventDlg = new SimEventDlg((int)E_ACTIVE_WINDOW_FES_EVENT_CTRL,this);
|
||||||
|
ptrSimEventDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab_5);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrSimEventDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_EVENT_CTRL);
|
||||||
|
ptrSimEventDlg->OnRTURefresh();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesDataSim::OnNetConnect()
|
||||||
|
{
|
||||||
|
m_ConnectFlag =CN_CommConnect;
|
||||||
|
|
||||||
|
if(ptrSimAiDlg!=NULL)
|
||||||
|
ptrSimAiDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrSimDiDlg!=NULL)
|
||||||
|
ptrSimDiDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrSimPiDlg!=NULL)
|
||||||
|
ptrSimPiDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrSimMiDlg!=NULL)
|
||||||
|
ptrSimMiDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrSimEventDlg!=NULL)
|
||||||
|
ptrSimEventDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesDataSim::OnNetDisConnect()
|
||||||
|
{
|
||||||
|
m_ConnectFlag =CN_CommDisconnect;
|
||||||
|
|
||||||
|
if(ptrSimAiDlg!=NULL)
|
||||||
|
ptrSimAiDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrSimDiDlg!=NULL)
|
||||||
|
ptrSimDiDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrSimPiDlg!=NULL)
|
||||||
|
ptrSimPiDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrSimMiDlg!=NULL)
|
||||||
|
ptrSimMiDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrSimEventDlg!=NULL)
|
||||||
|
ptrSimEventDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
}
|
||||||
54
product/src/tools/debug_tool_v2/CFesDataSim.h
Normal file
54
product/src/tools/debug_tool_v2/CFesDataSim.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#ifndef CFESDATASIM_H
|
||||||
|
#define CFESDATASIM_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "simaidlg.h"
|
||||||
|
#include "simdidlg.h"
|
||||||
|
#include "simpidlg.h"
|
||||||
|
#include "simmidlg.h"
|
||||||
|
#include "simeventdlg.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CFesDataSim;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CFesDataSim : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CFesDataSim(QWidget *parent = 0);
|
||||||
|
~CFesDataSim();
|
||||||
|
void Init(bool isConnected);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void slotActiveWindow();
|
||||||
|
private:
|
||||||
|
void initVariable();
|
||||||
|
void initSignalAndSlot();
|
||||||
|
void initView();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void setActiveWindow(int current);
|
||||||
|
void OnNetConnect();
|
||||||
|
void OnNetDisConnect();
|
||||||
|
public:
|
||||||
|
SimAiDlg *ptrSimAiDlg;
|
||||||
|
SimDiDlg *ptrSimDiDlg;
|
||||||
|
SimPiDlg *ptrSimPiDlg;
|
||||||
|
SimMiDlg *ptrSimMiDlg;
|
||||||
|
SimEventDlg *ptrSimEventDlg;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::CFesDataSim *ui;
|
||||||
|
int m_ConnectFlag; //连接成功标志
|
||||||
|
|
||||||
|
RtuDevMap m_rtuDevMap;
|
||||||
|
|
||||||
|
RtuPointMap m_rtuAiPointMap;
|
||||||
|
RtuPointMap m_rtuDiPointMap;
|
||||||
|
RtuPointMap m_rtuPiPointMap;
|
||||||
|
RtuPointMap m_rtuMiPointMap;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CFESDATASIM_H
|
||||||
65
product/src/tools/debug_tool_v2/CFesDataSim.ui
Normal file
65
product/src/tools/debug_tool_v2/CFesDataSim.ui
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CFesDataSim</class>
|
||||||
|
<widget class="QWidget" name="CFesDataSim">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>675</width>
|
||||||
|
<height>269</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tab">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>模拟量仿真</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_2">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>数字量仿真</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_3">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>累积量仿真</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_4">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>混合量仿真</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_5">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>事件仿真</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
133
product/src/tools/debug_tool_v2/CFesEvent.cpp
Normal file
133
product/src/tools/debug_tool_v2/CFesEvent.cpp
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
#include "CFesEvent.h"
|
||||||
|
#include "ui_CFesEvent.h"
|
||||||
|
#include "CActiveWindow.h"
|
||||||
|
CFesEvent::CFesEvent(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::CFesEvent)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
ui->tabWidget->setCurrentIndex(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
CFesEvent::~CFesEvent()
|
||||||
|
{
|
||||||
|
if(ptrChanEventDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrChanEventDlg;
|
||||||
|
}
|
||||||
|
if(ptrSoeEventDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrSoeEventDlg;
|
||||||
|
}
|
||||||
|
if(ptrSoeMemoryDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrSoeMemoryDlg;
|
||||||
|
}
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesEvent::Init(bool isConnected)
|
||||||
|
{
|
||||||
|
if(isConnected)
|
||||||
|
{
|
||||||
|
m_ConnectFlag = CN_CommConnect;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
m_ConnectFlag = CN_CommDisconnect;
|
||||||
|
}
|
||||||
|
initVariable();
|
||||||
|
initSignalAndSlot();
|
||||||
|
initView();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesEvent::slotActiveWindow()
|
||||||
|
{
|
||||||
|
setActiveWindow(ui->tabWidget->currentIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesEvent::initVariable()
|
||||||
|
{
|
||||||
|
ptrChanEventDlg = new ChanEventDlg((int)E_ACTIVE_WINDOW_FES_CHAN_EVENT,this);
|
||||||
|
ptrChanEventDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
ptrSoeEventDlg = new SoeEventDlg((int)E_ACTIVE_WINDOW_FES_SOE_EVENT,this);
|
||||||
|
ptrSoeEventDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
ptrSoeMemoryDlg = new SoeMemorydlg((int)E_ACTIVE_WINDOW_FES_SOE_MEMORY,this);
|
||||||
|
ptrSoeMemoryDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesEvent::initSignalAndSlot()
|
||||||
|
{
|
||||||
|
connect(ui->tabWidget,&QTabWidget::currentChanged,this,&CFesEvent::setActiveWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesEvent::initView()
|
||||||
|
{
|
||||||
|
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab);
|
||||||
|
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrSoeEventDlg, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
gridLayout = new QGridLayout(ui->tab_2);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrChanEventDlg, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
gridLayout = new QGridLayout(ui->tab_3);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrSoeMemoryDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesEvent::setActiveWindow(int current)
|
||||||
|
{
|
||||||
|
switch (current) {
|
||||||
|
case 0:
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_SOE_EVENT);
|
||||||
|
ptrSoeEventDlg->OnStartRefreshData();
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_CHAN_EVENT);
|
||||||
|
ptrChanEventDlg->OnStartRefreshData();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_SOE_MEMORY);
|
||||||
|
ptrSoeMemoryDlg->OnRefreshData();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesEvent::OnNetConnect()
|
||||||
|
{
|
||||||
|
m_ConnectFlag =CN_CommConnect;
|
||||||
|
|
||||||
|
if(ptrChanEventDlg!=NULL)
|
||||||
|
ptrChanEventDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrSoeEventDlg!=NULL)
|
||||||
|
ptrSoeEventDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrSoeMemoryDlg!=NULL)
|
||||||
|
ptrSoeMemoryDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesEvent::OnNetDisConnect()
|
||||||
|
{
|
||||||
|
m_ConnectFlag =CN_CommDisconnect;
|
||||||
|
|
||||||
|
if(ptrChanEventDlg!=NULL)
|
||||||
|
ptrChanEventDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrSoeEventDlg!=NULL)
|
||||||
|
ptrSoeEventDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrSoeMemoryDlg!=NULL)
|
||||||
|
ptrSoeMemoryDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
}
|
||||||
42
product/src/tools/debug_tool_v2/CFesEvent.h
Normal file
42
product/src/tools/debug_tool_v2/CFesEvent.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#ifndef CFESEVENT_H
|
||||||
|
#define CFESEVENT_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "chaneventdlg.h"
|
||||||
|
#include "soeeventdlg.h"
|
||||||
|
#include "soememorydlg.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CFesEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CFesEvent : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CFesEvent(QWidget *parent = 0);
|
||||||
|
~CFesEvent();
|
||||||
|
void Init(bool isConnected);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void slotActiveWindow();
|
||||||
|
private:
|
||||||
|
void initVariable();
|
||||||
|
void initSignalAndSlot();
|
||||||
|
void initView();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void setActiveWindow(int current);
|
||||||
|
void OnNetConnect();
|
||||||
|
void OnNetDisConnect();
|
||||||
|
public:
|
||||||
|
ChanEventDlg * ptrChanEventDlg;
|
||||||
|
SoeEventDlg * ptrSoeEventDlg;
|
||||||
|
SoeMemorydlg * ptrSoeMemoryDlg;
|
||||||
|
private:
|
||||||
|
Ui::CFesEvent *ui;
|
||||||
|
int m_ConnectFlag; //连接成功标志
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CFESEVENT_H
|
||||||
55
product/src/tools/debug_tool_v2/CFesEvent.ui
Normal file
55
product/src/tools/debug_tool_v2/CFesEvent.ui
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CFesEvent</class>
|
||||||
|
<widget class="QWidget" name="CFesEvent">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>684</width>
|
||||||
|
<height>298</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tab">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>SOE事件</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_2">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>通道事件</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_3">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>SOE内存</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
224
product/src/tools/debug_tool_v2/CFesForwardData.cpp
Normal file
224
product/src/tools/debug_tool_v2/CFesForwardData.cpp
Normal file
@ -0,0 +1,224 @@
|
|||||||
|
#include "CFesForwardData.h"
|
||||||
|
#include "ui_CFesForwardData.h"
|
||||||
|
#include "CActiveWindow.h"
|
||||||
|
|
||||||
|
CFesForwardData::CFesForwardData(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::CFesForwardData),
|
||||||
|
ptrFwAiMonDlg(Q_NULLPTR),
|
||||||
|
ptrFwDiMonDlg(Q_NULLPTR),
|
||||||
|
ptrFwDDiMonDlg(Q_NULLPTR),
|
||||||
|
ptrFwAccMonDlg(Q_NULLPTR),
|
||||||
|
ptrFwMiMonDlg(Q_NULLPTR)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
CFesForwardData::~CFesForwardData()
|
||||||
|
{
|
||||||
|
if(ptrFwAiMonDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrFwAiMonDlg;
|
||||||
|
}
|
||||||
|
if(ptrFwDiMonDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrFwDiMonDlg;
|
||||||
|
}
|
||||||
|
if(ptrFwDDiMonDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrFwDDiMonDlg;
|
||||||
|
}
|
||||||
|
if(ptrFwAccMonDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrFwAccMonDlg;
|
||||||
|
}
|
||||||
|
if(ptrFwMiMonDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrFwMiMonDlg;
|
||||||
|
}
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesForwardData::Init(bool isConnected)
|
||||||
|
{
|
||||||
|
if(isConnected)
|
||||||
|
{
|
||||||
|
m_ConnectFlag = CN_CommConnect;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
m_ConnectFlag = CN_CommDisconnect;
|
||||||
|
}
|
||||||
|
initVariable();
|
||||||
|
initSignalAndSlot();
|
||||||
|
initView();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesForwardData::slotActiveWindow()
|
||||||
|
{
|
||||||
|
setActiveWindow(ui->tabWidget->currentIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesForwardData::initVariable()
|
||||||
|
{
|
||||||
|
ptrFwAiMonDlg = new FwAiMonDlg((int)E_ACTIVE_WINDOW_FES_AI_FARWARD,this);
|
||||||
|
ptrFwAiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
ptrFwDiMonDlg = new FwDiMonDlg((int)E_ACTIVE_WINDOW_FES_DI_FARWARD,this);
|
||||||
|
ptrFwDiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
ptrFwDDiMonDlg = new FwDDiMonDlg((int)E_ACTIVE_WINDOW_FES_DDI_FARWARD,this);
|
||||||
|
ptrFwDDiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
ptrFwAccMonDlg = new FwAccMonDlg((int)E_ACTIVE_WINDOW_FES_PI_FARWARD,this);
|
||||||
|
ptrFwAccMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
ptrFwMiMonDlg = new FwMiMonDlg((int)E_ACTIVE_WINDOW_FES_MI_FARWARD,this);
|
||||||
|
ptrFwMiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesForwardData::initSignalAndSlot()
|
||||||
|
{
|
||||||
|
connect(ui->tabWidget,&QTabWidget::currentChanged,this,&CFesForwardData::setActiveWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesForwardData::initView()
|
||||||
|
{
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrFwAiMonDlg, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
gridLayout = new QGridLayout(ui->tab_2);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrFwDiMonDlg, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
gridLayout = new QGridLayout(ui->tab_3);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrFwDDiMonDlg, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
gridLayout = new QGridLayout(ui->tab_4);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrFwAccMonDlg, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
gridLayout = new QGridLayout(ui->tab_5);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrFwMiMonDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesForwardData::setActiveWindow(int current)
|
||||||
|
{
|
||||||
|
switch (current) {
|
||||||
|
case 0:
|
||||||
|
if(ptrFwAiMonDlg == Q_NULLPTR)
|
||||||
|
{
|
||||||
|
ptrFwAiMonDlg = new FwAiMonDlg((int)E_ACTIVE_WINDOW_FES_AI_FARWARD,this);
|
||||||
|
ptrFwAiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrFwAiMonDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_AI_FARWARD);
|
||||||
|
ptrFwAiMonDlg->OnRTURefresh();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if(ptrFwDiMonDlg == Q_NULLPTR)
|
||||||
|
{
|
||||||
|
ptrFwDiMonDlg = new FwDiMonDlg((int)E_ACTIVE_WINDOW_FES_DI_FARWARD,this);
|
||||||
|
ptrFwDiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab_2);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrFwDiMonDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_DI_FARWARD);
|
||||||
|
ptrFwDiMonDlg->OnRTURefresh();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(ptrFwDDiMonDlg == Q_NULLPTR)
|
||||||
|
{
|
||||||
|
ptrFwDDiMonDlg = new FwDDiMonDlg((int)E_ACTIVE_WINDOW_FES_DDI_FARWARD,this);
|
||||||
|
ptrFwDDiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab_3);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrFwDDiMonDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_DDI_FARWARD);
|
||||||
|
ptrFwDDiMonDlg->OnRTURefresh();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if(ptrFwAccMonDlg == Q_NULLPTR)
|
||||||
|
{
|
||||||
|
ptrFwAccMonDlg = new FwAccMonDlg((int)E_ACTIVE_WINDOW_FES_PI_FARWARD,this);
|
||||||
|
ptrFwAccMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab_4);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrFwAccMonDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_PI_FARWARD);
|
||||||
|
ptrFwAccMonDlg->OnRTURefresh();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if(ptrFwMiMonDlg == Q_NULLPTR)
|
||||||
|
{
|
||||||
|
ptrFwMiMonDlg = new FwMiMonDlg((int)E_ACTIVE_WINDOW_FES_MI_FARWARD,this);
|
||||||
|
ptrFwMiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab_5);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrFwMiMonDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_MI_FARWARD);
|
||||||
|
ptrFwMiMonDlg->OnRTURefresh();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesForwardData::OnNetConnect()
|
||||||
|
{
|
||||||
|
m_ConnectFlag =CN_CommConnect;
|
||||||
|
|
||||||
|
if(ptrFwAiMonDlg!=NULL)
|
||||||
|
ptrFwAiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrFwDiMonDlg!=NULL)
|
||||||
|
ptrFwDiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrFwDDiMonDlg!=NULL)
|
||||||
|
ptrFwDDiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrFwAccMonDlg!=NULL)
|
||||||
|
ptrFwAccMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrFwMiMonDlg!=NULL)
|
||||||
|
ptrFwMiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesForwardData::OnNetDisConnect()
|
||||||
|
{
|
||||||
|
m_ConnectFlag =CN_CommDisconnect;
|
||||||
|
|
||||||
|
if(ptrFwAiMonDlg!=NULL)
|
||||||
|
ptrFwAiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrFwDiMonDlg!=NULL)
|
||||||
|
ptrFwDiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrFwDDiMonDlg!=NULL)
|
||||||
|
ptrFwDDiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrFwAccMonDlg!=NULL)
|
||||||
|
ptrFwAccMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrFwMiMonDlg!=NULL)
|
||||||
|
ptrFwMiMonDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
}
|
||||||
51
product/src/tools/debug_tool_v2/CFesForwardData.h
Normal file
51
product/src/tools/debug_tool_v2/CFesForwardData.h
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#ifndef CFESFORWARDDATA_H
|
||||||
|
#define CFESFORWARDDATA_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "fwaimondlg.h"
|
||||||
|
#include "fwddimondlg.h"
|
||||||
|
#include "fwdimondlg.h"
|
||||||
|
#include "fwaccmondlg.h"
|
||||||
|
#include "fwmimondlg.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CFesForwardData;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CFesForwardData : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CFesForwardData(QWidget *parent = 0);
|
||||||
|
~CFesForwardData();
|
||||||
|
void Init(bool isConnected);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void slotActiveWindow();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void initVariable();
|
||||||
|
void initSignalAndSlot();
|
||||||
|
void initView();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void setActiveWindow(int current);
|
||||||
|
|
||||||
|
void OnNetConnect();
|
||||||
|
void OnNetDisConnect();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::CFesForwardData *ui;
|
||||||
|
|
||||||
|
int m_ConnectFlag; //连接成功标志
|
||||||
|
|
||||||
|
public:
|
||||||
|
FwAiMonDlg *ptrFwAiMonDlg;
|
||||||
|
FwDiMonDlg *ptrFwDiMonDlg;
|
||||||
|
FwDDiMonDlg *ptrFwDDiMonDlg;
|
||||||
|
FwAccMonDlg *ptrFwAccMonDlg;
|
||||||
|
FwMiMonDlg *ptrFwMiMonDlg;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CFESFORWARDDATA_H
|
||||||
65
product/src/tools/debug_tool_v2/CFesForwardData.ui
Normal file
65
product/src/tools/debug_tool_v2/CFesForwardData.ui
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CFesForwardData</class>
|
||||||
|
<widget class="QWidget" name="CFesForwardData">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>633</width>
|
||||||
|
<height>279</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tab">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>模拟量</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_2">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>单点数字量</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_3">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>双点数字量</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_4">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>累积量</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_5">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>混合量</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
108
product/src/tools/debug_tool_v2/CFesParamShow.cpp
Normal file
108
product/src/tools/debug_tool_v2/CFesParamShow.cpp
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
#include "CFesParamShow.h"
|
||||||
|
#include "ui_CFesParamShow.h"
|
||||||
|
#include "CActiveWindow.h"
|
||||||
|
CFesParamShow::CFesParamShow(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::CFesParamShow)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
CFesParamShow::~CFesParamShow()
|
||||||
|
{
|
||||||
|
if(ptrChanParamDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrChanParamDlg;
|
||||||
|
}
|
||||||
|
if(ptrRtuParamDlg != NULL)
|
||||||
|
{
|
||||||
|
delete ptrRtuParamDlg;
|
||||||
|
}
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesParamShow::Init(bool isConnected)
|
||||||
|
{
|
||||||
|
if(isConnected)
|
||||||
|
{
|
||||||
|
m_ConnectFlag = CN_CommConnect;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
m_ConnectFlag = CN_CommDisconnect;
|
||||||
|
}
|
||||||
|
initVariable();
|
||||||
|
initSignalAndSlot();
|
||||||
|
initView();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesParamShow::slotActiveWindow()
|
||||||
|
{
|
||||||
|
setActiveWindow(ui->tabWidget->currentIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesParamShow::initVariable()
|
||||||
|
{
|
||||||
|
ptrChanParamDlg = new ChanParamDlg((int)E_ACTIVE_WINDOW_FES_CHAN_PARAM,this);
|
||||||
|
ptrChanParamDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
ptrRtuParamDlg = new RtuParamDlg((int)E_ACTIVE_WINDOW_FES_RTU_PARAM,this);
|
||||||
|
ptrRtuParamDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesParamShow::initSignalAndSlot()
|
||||||
|
{
|
||||||
|
connect(ui->tabWidget,&QTabWidget::currentChanged,this,&CFesParamShow::setActiveWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesParamShow::initView()
|
||||||
|
{
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->tab);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrChanParamDlg, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
gridLayout = new QGridLayout(ui->tab_2);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(ptrRtuParamDlg, 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesParamShow::setActiveWindow(int current)
|
||||||
|
{
|
||||||
|
qDebug()<<"setActiveWindow:"<<current;
|
||||||
|
switch (current) {
|
||||||
|
case 0:
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_CHAN_PARAM);
|
||||||
|
ptrChanParamDlg->OnRefresh();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES_RTU_PARAM);
|
||||||
|
ptrRtuParamDlg->OnRefresh();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
CActiveWindow::instance()->setActiveWindow((int)E_ACTIVE_WINDOW_FES);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesParamShow::OnNetConnect()
|
||||||
|
{
|
||||||
|
m_ConnectFlag =CN_CommConnect;
|
||||||
|
|
||||||
|
if(ptrChanParamDlg!=NULL)
|
||||||
|
ptrChanParamDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrRtuParamDlg!=NULL)
|
||||||
|
ptrRtuParamDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesParamShow::OnNetDisConnect()
|
||||||
|
{
|
||||||
|
m_ConnectFlag =CN_CommDisconnect;
|
||||||
|
|
||||||
|
if(ptrChanParamDlg!=NULL)
|
||||||
|
ptrChanParamDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
|
||||||
|
if(ptrRtuParamDlg!=NULL)
|
||||||
|
ptrRtuParamDlg->SetConnectFlags(m_ConnectFlag);
|
||||||
|
}
|
||||||
42
product/src/tools/debug_tool_v2/CFesParamShow.h
Normal file
42
product/src/tools/debug_tool_v2/CFesParamShow.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#ifndef CFESPARAMSHOW_H
|
||||||
|
#define CFESPARAMSHOW_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "chanparamdlg.h"
|
||||||
|
#include "rtuparamdlg.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CFesParamShow;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CFesParamShow : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CFesParamShow(QWidget *parent = 0);
|
||||||
|
~CFesParamShow();
|
||||||
|
void Init(bool isConnected);
|
||||||
|
public slots:
|
||||||
|
void slotActiveWindow();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void initVariable();
|
||||||
|
void initSignalAndSlot();
|
||||||
|
void initView();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void setActiveWindow(int current);
|
||||||
|
void OnNetConnect();
|
||||||
|
void OnNetDisConnect();
|
||||||
|
|
||||||
|
public:
|
||||||
|
ChanParamDlg *ptrChanParamDlg;
|
||||||
|
RtuParamDlg *ptrRtuParamDlg;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::CFesParamShow *ui;
|
||||||
|
int m_ConnectFlag; //连接成功标志
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CFESPARAMSHOW_H
|
||||||
53
product/src/tools/debug_tool_v2/CFesParamShow.ui
Normal file
53
product/src/tools/debug_tool_v2/CFesParamShow.ui
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CFesParamShow</class>
|
||||||
|
<widget class="QWidget" name="CFesParamShow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>686</width>
|
||||||
|
<height>288</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tab">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>通道参数</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_2">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>RTU参数</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
581
product/src/tools/debug_tool_v2/CFessim.cpp
Normal file
581
product/src/tools/debug_tool_v2/CFessim.cpp
Normal file
@ -0,0 +1,581 @@
|
|||||||
|
#include "CFessim.h"
|
||||||
|
#include "ui_CFessim.h"
|
||||||
|
#include "pub_widget/MessageBox.h"
|
||||||
|
#include "CActiveWindow.h"
|
||||||
|
#include "chanmondlg.h"
|
||||||
|
#include "CDataMng.h"
|
||||||
|
|
||||||
|
#define CN_CFG_SIMIP "FesSimIP.conf"
|
||||||
|
|
||||||
|
CFessim::CFessim(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::CFessim)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
m_pFesParamShow =NULL;
|
||||||
|
m_pFesData =NULL;
|
||||||
|
m_pFesEvent =NULL;
|
||||||
|
m_pFesDataSim =NULL;
|
||||||
|
m_pFesCtrlSim =NULL;
|
||||||
|
m_pFesForwardData =NULL;
|
||||||
|
//m_pFesChanData =NULL;
|
||||||
|
m_pChanMonDlg = NULL;
|
||||||
|
m_isConnect = false;
|
||||||
|
ui->pushButton_connect->setText(tr("连接"));
|
||||||
|
ui->label_netStatus->setText(tr("通讯断开"));
|
||||||
|
ui->label_netStatus->setStyleSheet("QLabel{color:red}");
|
||||||
|
ui->comboBox_app->setView(new QListView());
|
||||||
|
ui->listWidget->setCurrentRow(0);
|
||||||
|
qRegisterMetaType<std::string>("std::string&");
|
||||||
|
qRegisterMetaType<std::string>("std::string");
|
||||||
|
|
||||||
|
ui->iec61850_tool->hide();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CFessim::~CFessim()
|
||||||
|
{
|
||||||
|
stopThread();
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::Init()
|
||||||
|
{
|
||||||
|
initVariable();
|
||||||
|
initView();
|
||||||
|
initSignalAndSlot();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CFessim::isConnect()
|
||||||
|
{
|
||||||
|
return m_isConnect;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::brushSomeData()
|
||||||
|
{
|
||||||
|
slot_listClick(ui->listWidget->currentIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
int CFessim::getCurrentIndex()
|
||||||
|
{
|
||||||
|
return ui->listWidget->currentIndex().row();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::initVariable()
|
||||||
|
{
|
||||||
|
m_appVec = CDataMng::instance()->getAppInfo();
|
||||||
|
m_pFesParamShow = new CFesParamShow;
|
||||||
|
startThread();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::initSignalAndSlot()
|
||||||
|
{
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_connected,this,&CFessim::ConnectOk);
|
||||||
|
connect(&m_objMbCliMngThread,SIGNAL(signal_disconnected()),this,SLOT(DisConnectOk()));
|
||||||
|
|
||||||
|
connect(ui->comboBox_app,SIGNAL(currentIndexChanged(const QString &)),this,SLOT(slot_modifyPort(const QString &)));
|
||||||
|
connect(ui->pushButton_connect,&QPushButton::clicked,this,&CFessim::slot_connect);
|
||||||
|
connect(ui->stackedWidget,&QStackedWidget::currentChanged,this,&CFessim::setActiveWindow);
|
||||||
|
connect(ui->listWidget,&QListWidget::clicked,this,&CFessim::slot_listClick);
|
||||||
|
connect(ui->fes_chan_data,&QPushButton::clicked,this,&CFessim::slotChanData);
|
||||||
|
// connect(ui->iec61850_tool,&QPushButton::clicked,this,&CFessim::slotOpen61850Tool);
|
||||||
|
connect(CDataMng::instance(),&CDataMng::signal_sendMsgToServer,&m_objMbCliMngThread,&CMbClientMngThread::slot_sendMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::initFesParamSS()
|
||||||
|
{
|
||||||
|
connect(&m_objMbCliMngThread,SIGNAL(signal_connected()),m_pFesParamShow,SLOT(OnNetConnect()));
|
||||||
|
connect(&m_objMbCliMngThread,SIGNAL(signal_disconnected()),m_pFesParamShow,SLOT(OnNetDisConnect()));
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_chanParamResp,CDataMng::instance(),&CDataMng::signal_chanParamResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_rtuParamResp,CDataMng::instance(),&CDataMng::signal_rtuParamResp);
|
||||||
|
|
||||||
|
connect(this,&CFessim::sigFesParamShowActiveWindow,m_pFesParamShow,&CFesParamShow::slotActiveWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::initFesDataSS()
|
||||||
|
{
|
||||||
|
connect(&m_objMbCliMngThread,SIGNAL(signal_connected()),m_pFesData,SLOT(OnNetConnect()));
|
||||||
|
connect(&m_objMbCliMngThread,SIGNAL(signal_disconnected()),m_pFesData,SLOT(OnNetDisConnect()));
|
||||||
|
|
||||||
|
//模拟量
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_aiRtuInfoResp,CDataMng::instance(),&CDataMng::signal_aiRtuInfoResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_aiParamResp,CDataMng::instance(),&CDataMng::signal_aiParamResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_aiValueResp,CDataMng::instance(),&CDataMng::signal_aiValueResp);
|
||||||
|
|
||||||
|
//数字量
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_diRtuInfoResp,CDataMng::instance(),&CDataMng::signal_diRtuInfoResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_diParamResp,CDataMng::instance(),&CDataMng::signal_diParamResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_diValueResp,CDataMng::instance(),&CDataMng::signal_diValueResp);
|
||||||
|
|
||||||
|
//累积量
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_accRtuInfoResp,CDataMng::instance(),&CDataMng::signal_accRtuInfoResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_accParamResp,CDataMng::instance(),&CDataMng::signal_accParamResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_accValueResp,CDataMng::instance(),&CDataMng::signal_accValueResp);
|
||||||
|
|
||||||
|
//混合量
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_miRtuInfoResp,CDataMng::instance(),&CDataMng::signal_miRtuInfoResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_miParamResp,CDataMng::instance(),&CDataMng::signal_miParamResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_miValueResp,CDataMng::instance(),&CDataMng::signal_miValueResp);
|
||||||
|
|
||||||
|
connect(this,&CFessim::sigFesDataActiveWindow,m_pFesData,&CFesData::slotActiveWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::initFesEventSS()
|
||||||
|
{
|
||||||
|
connect(&m_objMbCliMngThread,SIGNAL(signal_connected()),m_pFesEvent,SLOT(OnNetConnect()));
|
||||||
|
connect(&m_objMbCliMngThread,SIGNAL(signal_disconnected()),m_pFesEvent,SLOT(OnNetDisConnect()));
|
||||||
|
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_soeEventResp,CDataMng::instance(),&CDataMng::signal_soeEventResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_chanEventResp,CDataMng::instance(),&CDataMng::signal_chanEventResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_soeMemEventResp,CDataMng::instance(),&CDataMng::signal_soeMemEventResp);
|
||||||
|
|
||||||
|
connect(this,&CFessim::sigFesEventActiveWindow,m_pFesEvent,&CFesEvent::slotActiveWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::initFesDataSimSS()
|
||||||
|
{
|
||||||
|
connect(&m_objMbCliMngThread,SIGNAL(signal_connected()),m_pFesDataSim,SLOT(OnNetConnect()));
|
||||||
|
connect(&m_objMbCliMngThread,SIGNAL(signal_disconnected()),m_pFesDataSim,SLOT(OnNetDisConnect()));
|
||||||
|
|
||||||
|
//模拟量
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simAiRtuInfoResp,CDataMng::instance(),&CDataMng::signal_simAiRtuInfoResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simAiParamResp,CDataMng::instance(),&CDataMng::signal_simAiParamResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simAiValueResp,CDataMng::instance(),&CDataMng::signal_simAiValueResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simAiStartSimResp,CDataMng::instance(),&CDataMng::signal_simAiStartSimResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simAiStopSimResp,CDataMng::instance(),&CDataMng::signal_simAiStopSimResp);
|
||||||
|
|
||||||
|
//数字量
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simDiRtuInfoResp,CDataMng::instance(),&CDataMng::signal_simDiRtuInfoResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simDiParamResp,CDataMng::instance(),&CDataMng::signal_simDiParamResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simDiValueResp,CDataMng::instance(),&CDataMng::signal_simDiValueResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simDiStartSimResp,CDataMng::instance(),&CDataMng::signal_simDiStartSimResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simDiStopSimResp,CDataMng::instance(),&CDataMng::signal_simDiStopSimResp);
|
||||||
|
|
||||||
|
//混合量
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simMiRtuInfoResp,CDataMng::instance(),&CDataMng::signal_simMiRtuInfoResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simMiParamResp,CDataMng::instance(),&CDataMng::signal_simMiParamResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simMiValueResp,CDataMng::instance(),&CDataMng::signal_simMiValueResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simMiStartSimResp,CDataMng::instance(),&CDataMng::signal_simMiStartSimResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simMiStopSimResp,CDataMng::instance(),&CDataMng::signal_simMiStopSimResp);
|
||||||
|
|
||||||
|
//累计量
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simAccRtuInfoResp,CDataMng::instance(),&CDataMng::signal_simAccRtuInfoResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simAccParamResp,CDataMng::instance(),&CDataMng::signal_simAccParamResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simAccValueResp,CDataMng::instance(),&CDataMng::signal_simAccValueResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simAccStartSimResp,CDataMng::instance(),&CDataMng::signal_simAccStartSimResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simAccStopSimResp,CDataMng::instance(),&CDataMng::signal_simAccStopSimResp);
|
||||||
|
|
||||||
|
//事件
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simEventRtuInfoResp,CDataMng::instance(),&CDataMng::signal_simEventRtuInfoResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simEventDiParamResp,CDataMng::instance(),&CDataMng::signal_simEventDiParamResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simEventCreateResp,CDataMng::instance(),&CDataMng::signal_simEventCreateResp);
|
||||||
|
|
||||||
|
connect(this,&CFessim::sigFesDataSimActiveWindow,m_pFesDataSim,&CFesDataSim::slotActiveWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::initFesCtrlSimSS()
|
||||||
|
{
|
||||||
|
connect(&m_objMbCliMngThread,SIGNAL(signal_connected()),m_pFesCtrlSim,SLOT(OnNetConnect()));
|
||||||
|
connect(&m_objMbCliMngThread,SIGNAL(signal_disconnected()),m_pFesCtrlSim,SLOT(OnNetDisConnect()));
|
||||||
|
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simAoRtuInfoResp,CDataMng::instance(),&CDataMng::signal_simAoRtuInfoResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simAoParamResp,CDataMng::instance(),&CDataMng::signal_simAoParamResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simAoControlResp,CDataMng::instance(),&CDataMng::signal_simAoControlResp);
|
||||||
|
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simDoRtuInfoResp,CDataMng::instance(),&CDataMng::signal_simDoRtuInfoResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simDoParamResp,CDataMng::instance(),&CDataMng::signal_simDoParamResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simDoControlResp,CDataMng::instance(),&CDataMng::signal_simDoControlResp);
|
||||||
|
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simMoRtuInfoResp,CDataMng::instance(),&CDataMng::signal_simMoRtuInfoResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simMoParamResp,CDataMng::instance(),&CDataMng::signal_simMoParamResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simMoControlResp,CDataMng::instance(),&CDataMng::signal_simMoControlResp);
|
||||||
|
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simDefCmdRtuInfoResp,CDataMng::instance(),&CDataMng::signal_simDefCmdRtuInfoResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_simDefCmdControlResp,CDataMng::instance(),&CDataMng::signal_simDefCmdControlResp);
|
||||||
|
|
||||||
|
connect(this,&CFessim::sigFesCtrlSimActiveWindow,m_pFesCtrlSim,&CFesCtrlSim::slotActiveWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::initFesForwDataSS()
|
||||||
|
{
|
||||||
|
connect(&m_objMbCliMngThread,SIGNAL(signal_connected()),m_pFesForwardData,SLOT(OnNetConnect()));
|
||||||
|
connect(&m_objMbCliMngThread,SIGNAL(signal_disconnected()),m_pFesForwardData,SLOT(OnNetDisConnect()));
|
||||||
|
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_fwAiRtuInfoResp,CDataMng::instance(),&CDataMng::signal_fwAiRtuInfoResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_fwAiParamResp,CDataMng::instance(),&CDataMng::signal_fwAiParamResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_fwAiValueResp,CDataMng::instance(),&CDataMng::signal_fwAiValueResp);
|
||||||
|
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_fwDiRtuInfoResp,CDataMng::instance(),&CDataMng::signal_fwDiRtuInfoResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_fwDiParamResp,CDataMng::instance(),&CDataMng::signal_fwDiParamResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_fwDiValueResp,CDataMng::instance(),&CDataMng::signal_fwDiValueResp);
|
||||||
|
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_fwDDiRtuInfoResp,CDataMng::instance(),&CDataMng::signal_fwDDiRtuInfoResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_fwDDiParamResp,CDataMng::instance(),&CDataMng::signal_fwDDiParamResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_fwDDiValueResp,CDataMng::instance(),&CDataMng::signal_fwDDiValueResp);
|
||||||
|
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_fwMiRtuInfoResp,CDataMng::instance(),&CDataMng::signal_fwMiRtuInfoResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_fwMiParamResp,CDataMng::instance(),&CDataMng::signal_fwMiParamResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_fwMiValueResp,CDataMng::instance(),&CDataMng::signal_fwMiValueResp);
|
||||||
|
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_fwAccRtuInfoResp,CDataMng::instance(),&CDataMng::signal_fwAccRtuInfoResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_fwAccParamResp,CDataMng::instance(),&CDataMng::signal_fwAccParamResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_fwAccValueResp,CDataMng::instance(),&CDataMng::signal_fwAccValueResp);
|
||||||
|
|
||||||
|
connect(this,&CFessim::sigFesForwardActiveWindow,m_pFesForwardData,&CFesForwardData::slotActiveWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::initFesChanDataSS()
|
||||||
|
{
|
||||||
|
// connect(&m_TcpClient,SIGNAL(NetConnected()),m_pFesChanData,SLOT(OnNetConnect()));
|
||||||
|
// connect(&m_TcpClient,SIGNAL(NetDisConnected()),m_pFesChanData,SLOT(OnNetDisConnect()));
|
||||||
|
// connect(m_pFesChanData->ptrChanMonDlg,SIGNAL(SendCmdSig(int,QByteArray,int )),ptrProtocolThread,SLOT(OnRecvCmd(int,QByteArray,int )));
|
||||||
|
// connect(ptrProtocolThread,SIGNAL(ChanMonStartSig(int,QByteArray,int )),m_pFesChanData->ptrChanMonDlg,SLOT(OnRecvChanMonStartResp(int,QByteArray,int )));
|
||||||
|
// connect(ptrProtocolThread,SIGNAL(ChanMonStopSig(int,QByteArray,int )),m_pFesChanData->ptrChanMonDlg,SLOT(OnRecvChanMonStopResp(int,QByteArray,int )));
|
||||||
|
// connect(ptrProtocolThread,SIGNAL(ChanClearSig(int,QByteArray,int )),m_pFesChanData->ptrChanMonDlg,SLOT(OnRecvChanClearResp(int,QByteArray,int )));
|
||||||
|
// connect(this,&CFessim::sigFesChanDataActiveWindow,m_pFesChanData,&CFesChanData::slotActiveWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::initView()
|
||||||
|
{
|
||||||
|
initLocalView();
|
||||||
|
addFesParam();
|
||||||
|
initFesParamSS();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::initLocalView()
|
||||||
|
{
|
||||||
|
if(ui->comboBox_app->count()==0)
|
||||||
|
{
|
||||||
|
if(m_appVec.size()<=0)
|
||||||
|
{
|
||||||
|
ui->comboBox_app->addItem("AppName");
|
||||||
|
ui->lineEdit_port->setText(QString::number(CN_FesSimServerBasePortNo + 4));
|
||||||
|
ui->lineEdit_ip->setText("127.0.0.1");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->lineEdit_port->setText(QString::number(CN_FesSimServerBasePortNo + m_appVec[0].appId));
|
||||||
|
int i;
|
||||||
|
for(i=0;i<m_appVec.size();i++)
|
||||||
|
{
|
||||||
|
ui->comboBox_app->addItem(m_appVec[i].appName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QFile file(CN_CFG_SIMIP);
|
||||||
|
if(file.exists())
|
||||||
|
{
|
||||||
|
if(file.open(QFile::ReadOnly | QFile::Text))
|
||||||
|
{
|
||||||
|
m_IpStr = file.readAll();
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(m_IpStr.isEmpty())
|
||||||
|
m_IpStr = "127.0.0.1";
|
||||||
|
std::string tempStr = m_IpStr.toStdString();
|
||||||
|
if(file.open(QFile::WriteOnly | QFile::Append))
|
||||||
|
{
|
||||||
|
file.write(tempStr.c_str(),tempStr.length());
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ui->lineEdit_ip->setText(m_IpStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::addFesParam()
|
||||||
|
{
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->frame_fesParam);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(m_pFesParamShow, 0, 0, 1, 1);
|
||||||
|
m_pFesParamShow->Init(m_isConnect);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::addFesData()
|
||||||
|
{
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->frame_fesData);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(m_pFesData, 0, 0, 1, 1);
|
||||||
|
m_pFesData->Init(m_isConnect);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::addFesEvent()
|
||||||
|
{
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->frame_fesEvent);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(m_pFesEvent, 0, 0, 1, 1);
|
||||||
|
m_pFesEvent->Init(m_isConnect);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::addFesDataSim()
|
||||||
|
{
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->frame_fesDataSim);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(m_pFesDataSim, 0, 0, 1, 1);
|
||||||
|
m_pFesDataSim->Init(m_isConnect);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::addFesCtrlSim()
|
||||||
|
{
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->frame_fesCtrlSim);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(m_pFesCtrlSim, 0, 0, 1, 1);
|
||||||
|
m_pFesCtrlSim->Init(m_isConnect);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::addFesForwardData()
|
||||||
|
{
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(ui->frame_fesForwardData);
|
||||||
|
gridLayout->setSpacing(6);
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(m_pFesForwardData, 0, 0, 1, 1);
|
||||||
|
m_pFesForwardData->Init(m_isConnect);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::addFesChanData()
|
||||||
|
{
|
||||||
|
// QGridLayout *gridLayout = new QGridLayout(ui->frame_fesChanData);
|
||||||
|
// gridLayout->setSpacing(6);
|
||||||
|
// gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
// gridLayout->addWidget(m_pFesChanData, 0, 0, 1, 1);
|
||||||
|
// m_pFesChanData->Init(m_isConnect);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::setEnableView(bool enable)
|
||||||
|
{
|
||||||
|
ui->comboBox_app->setEnabled(enable);
|
||||||
|
ui->lineEdit_port->setEnabled(enable);
|
||||||
|
ui->lineEdit_ip->setEnabled(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::startThread()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::stopThread()
|
||||||
|
{
|
||||||
|
m_objMbCliMngThread.disconnectToServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::slot_modifyPort(const QString &text)
|
||||||
|
{
|
||||||
|
for(int i=0;i<m_appVec.size();i++)
|
||||||
|
{
|
||||||
|
if(text == m_appVec[i].appName)
|
||||||
|
{
|
||||||
|
ui->lineEdit_port->setText(QString::number(CN_FesSimServerBasePortNo + m_appVec[i].appId));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CFessim::slot_connect()
|
||||||
|
{
|
||||||
|
if(m_isConnect)
|
||||||
|
{
|
||||||
|
m_objMbCliMngThread.disconnectToServer();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//上面是断开连接操作,下面是连接操作
|
||||||
|
bool ok;
|
||||||
|
int nPort = ui->lineEdit_port->text().toInt(&ok);
|
||||||
|
if(!ok)
|
||||||
|
{
|
||||||
|
N_MessageBox::warning(this,tr("警告"),tr("网络端口错误,无法连接网络"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_IpStr = ui->lineEdit_ip->text();
|
||||||
|
|
||||||
|
if(!m_objMbCliMngThread.connectToServer(m_IpStr,nPort))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QFile file(CN_CFG_SIMIP);
|
||||||
|
if(file.exists())
|
||||||
|
{
|
||||||
|
std::string tempStr = m_IpStr.toStdString();
|
||||||
|
if(file.open(QFile::WriteOnly | QFile::Truncate))
|
||||||
|
{
|
||||||
|
file.write(tempStr.c_str(),tempStr.length());
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::ConnectOk()
|
||||||
|
{
|
||||||
|
ui->stackedWidget->currentIndex();
|
||||||
|
m_isConnect = true;
|
||||||
|
ui->pushButton_connect->setText(tr("断开"));
|
||||||
|
ui->label_netStatus->setText(tr("通讯连接"));
|
||||||
|
ui->label_netStatus->setStyleSheet("QLabel{color:green}");
|
||||||
|
setEnableView(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::DisConnectOk()
|
||||||
|
{
|
||||||
|
if(m_objMbCliMngThread.isRunning())
|
||||||
|
{
|
||||||
|
m_objMbCliMngThread.requestInterruption();
|
||||||
|
m_objMbCliMngThread.quit();
|
||||||
|
m_objMbCliMngThread.wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_isConnect = false;
|
||||||
|
ui->pushButton_connect->setText(tr("连接"));
|
||||||
|
ui->label_netStatus->setText(tr("通讯断开"));
|
||||||
|
ui->label_netStatus->setStyleSheet("QLabel{color:red}");
|
||||||
|
setEnableView(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::setActiveWindow(int current)
|
||||||
|
{
|
||||||
|
switch (current) {
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
if(m_pFesParamShow == NULL)
|
||||||
|
{
|
||||||
|
m_pFesParamShow = new CFesParamShow;
|
||||||
|
addFesParam();
|
||||||
|
initFesParamSS();
|
||||||
|
}
|
||||||
|
emit sigFesParamShowActiveWindow();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
if(m_pFesData == NULL)
|
||||||
|
{
|
||||||
|
m_pFesData = new CFesData;
|
||||||
|
addFesData();
|
||||||
|
initFesDataSS();
|
||||||
|
}
|
||||||
|
emit sigFesDataActiveWindow();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
if(m_pFesDataSim == NULL)
|
||||||
|
{
|
||||||
|
m_pFesDataSim = new CFesDataSim;
|
||||||
|
addFesDataSim();
|
||||||
|
initFesDataSimSS();
|
||||||
|
}
|
||||||
|
emit sigFesDataSimActiveWindow();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
{
|
||||||
|
if(m_pFesCtrlSim == NULL)
|
||||||
|
{
|
||||||
|
m_pFesCtrlSim = new CFesCtrlSim;
|
||||||
|
addFesCtrlSim();
|
||||||
|
initFesCtrlSimSS();
|
||||||
|
}
|
||||||
|
emit sigFesCtrlSimActiveWindow();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 4:
|
||||||
|
{
|
||||||
|
if(m_pFesEvent == NULL)
|
||||||
|
{
|
||||||
|
m_pFesEvent = new CFesEvent;
|
||||||
|
addFesEvent();
|
||||||
|
initFesEventSS();
|
||||||
|
}
|
||||||
|
emit sigFesEventActiveWindow();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 5:
|
||||||
|
{
|
||||||
|
if(m_pFesForwardData == NULL)
|
||||||
|
{
|
||||||
|
m_pFesForwardData = new CFesForwardData;
|
||||||
|
addFesForwardData();
|
||||||
|
initFesForwDataSS();
|
||||||
|
}
|
||||||
|
emit sigFesForwardActiveWindow();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// case 6:
|
||||||
|
// {
|
||||||
|
// if(m_pFesChanData == NULL)
|
||||||
|
// {
|
||||||
|
// m_pFesChanData = new CFesChanData;
|
||||||
|
// addFesChanData();
|
||||||
|
// initFesChanDataSS();
|
||||||
|
// }
|
||||||
|
// emit sigFesChanDataActiveWindow();
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::slot_listClick(const QModelIndex &index)
|
||||||
|
{
|
||||||
|
if(!index.isValid())
|
||||||
|
{
|
||||||
|
return ;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
ui->stackedWidget->setCurrentIndex(index.row());
|
||||||
|
//setActiveWindow(5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::slotChanData()
|
||||||
|
{
|
||||||
|
if(m_pChanMonDlg != NULL)
|
||||||
|
{
|
||||||
|
m_pChanMonDlg->show();
|
||||||
|
}
|
||||||
|
else if(m_pChanMonDlg == NULL)
|
||||||
|
{
|
||||||
|
m_pChanMonDlg = new ChanMonDlg((int)E_ACTIVE_WINDOW_FES_CHAN_DATA,this);
|
||||||
|
if(m_pChanMonDlg==NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(m_pChanMonDlg,&ChanMonDlg::signal_sendMsg,&m_objMbCliMngThread,&CMbClientMngThread::slot_sendMsg);
|
||||||
|
m_pChanMonDlg->SetConnectFlags(m_isConnect); //放在关联signal_sendMsg信号后
|
||||||
|
connect(&m_objMbCliMngThread,SIGNAL(signal_connected()),m_pChanMonDlg,SLOT(OnNetConnect()));
|
||||||
|
connect(&m_objMbCliMngThread,SIGNAL(signal_disconnected()),m_pChanMonDlg,SLOT(OnNetDisConnect()));
|
||||||
|
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_chanParamResp,m_pChanMonDlg,&ChanMonDlg::slot_OnRecvResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_chanMonStartResp,m_pChanMonDlg,&ChanMonDlg::slot_OnRecvResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_chanMonStopResp,m_pChanMonDlg,&ChanMonDlg::slot_OnRecvResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_chanMonClearResp,m_pChanMonDlg,&ChanMonDlg::slot_OnRecvResp);
|
||||||
|
connect(&m_objMbCliMngThread,&CMbClientMngThread::signal_chanMonInfo,m_pChanMonDlg,&ChanMonDlg::slot_OnRecvResp);
|
||||||
|
connect(m_pChanMonDlg, &ChanMonDlg::closed, [=](){ m_pChanMonDlg = Q_NULLPTR;});
|
||||||
|
|
||||||
|
m_pChanMonDlg->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFessim::slotOpen61850Tool()
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
QProcess p;
|
||||||
|
p.startDetached("clientScout.exe");
|
||||||
|
#else
|
||||||
|
QProcess p;
|
||||||
|
p.startDetached("clientScout");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
110
product/src/tools/debug_tool_v2/CFessim.h
Normal file
110
product/src/tools/debug_tool_v2/CFessim.h
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
#ifndef CFESSIM_H
|
||||||
|
#define CFESSIM_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "CSystemResources.h"
|
||||||
|
#include "ComProtocolThread.h"
|
||||||
|
#include "CFesData.h"
|
||||||
|
#include "CFesParamShow.h"
|
||||||
|
#include "CFesEvent.h"
|
||||||
|
#include "CFesDataSim.h"
|
||||||
|
#include "CFesCtrlSim.h"
|
||||||
|
#include "CFesForwardData.h"
|
||||||
|
#include "CFesChanData.h"
|
||||||
|
#include "MbClientMngThread.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CFessim;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CFessim : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CFessim(QWidget *parent = 0);
|
||||||
|
~CFessim();
|
||||||
|
void Init();
|
||||||
|
void loadChan();
|
||||||
|
void loadDev();
|
||||||
|
void loadAiDesc();
|
||||||
|
void loadDiDesc();
|
||||||
|
void loadPiDesc();
|
||||||
|
void loadMiDesc();
|
||||||
|
void loadAoDesc();
|
||||||
|
void loadDoDesc();
|
||||||
|
void loadMoDesc();
|
||||||
|
|
||||||
|
bool isConnect();
|
||||||
|
|
||||||
|
void brushSomeData();
|
||||||
|
|
||||||
|
int getCurrentIndex();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void sigFesParamShowActiveWindow();
|
||||||
|
void sigFesDataActiveWindow();
|
||||||
|
void sigFesEventActiveWindow();
|
||||||
|
void sigFesDataSimActiveWindow();
|
||||||
|
void sigFesCtrlSimActiveWindow();
|
||||||
|
void sigFesForwardActiveWindow();
|
||||||
|
void sigFesChanDataActiveWindow();
|
||||||
|
private:
|
||||||
|
void initVariable();
|
||||||
|
void initSignalAndSlot();
|
||||||
|
void initFesParamSS();//SS-----信号槽
|
||||||
|
void initFesDataSS();//SS-----信号槽
|
||||||
|
void initFesEventSS();//SS-----信号槽
|
||||||
|
void initFesDataSimSS();//SS-----信号槽
|
||||||
|
void initFesCtrlSimSS();//SS-----信号槽
|
||||||
|
void initFesForwDataSS();//SS-----信号槽
|
||||||
|
void initFesChanDataSS();//SS-----信号槽
|
||||||
|
|
||||||
|
void initView();
|
||||||
|
void initLocalView();
|
||||||
|
|
||||||
|
void addFesParam();
|
||||||
|
void addFesData();
|
||||||
|
void addFesEvent();
|
||||||
|
void addFesDataSim();
|
||||||
|
void addFesCtrlSim();
|
||||||
|
void addFesForwardData();
|
||||||
|
void addFesChanData();
|
||||||
|
|
||||||
|
void setEnableView(bool enable);
|
||||||
|
|
||||||
|
void startThread();
|
||||||
|
void stopThread();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void slot_modifyPort(const QString &text);
|
||||||
|
void ConnectOk();
|
||||||
|
void DisConnectOk();
|
||||||
|
void setActiveWindow(int current);
|
||||||
|
void slot_listClick(const QModelIndex &index);
|
||||||
|
|
||||||
|
void slotChanData();
|
||||||
|
void slotOpen61850Tool();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
bool slot_connect();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::CFessim *ui;
|
||||||
|
|
||||||
|
QVector<FesAppName> m_appVec;
|
||||||
|
QString m_IpStr;
|
||||||
|
bool m_isConnect;
|
||||||
|
CFesParamShow * m_pFesParamShow;
|
||||||
|
CFesData * m_pFesData;
|
||||||
|
CFesEvent * m_pFesEvent;
|
||||||
|
CFesDataSim * m_pFesDataSim;
|
||||||
|
CFesCtrlSim * m_pFesCtrlSim;
|
||||||
|
CFesForwardData * m_pFesForwardData;
|
||||||
|
//CFesChanData * m_pFesChanData;
|
||||||
|
|
||||||
|
ChanMonDlg *m_pChanMonDlg;
|
||||||
|
CMbClientMngThread m_objMbCliMngThread;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CFESSIM_H
|
||||||
609
product/src/tools/debug_tool_v2/CFessim.ui
Normal file
609
product/src/tools/debug_tool_v2/CFessim.ui
Normal file
@ -0,0 +1,609 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CFessim</class>
|
||||||
|
<widget class="QWidget" name="CFessim">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>855</width>
|
||||||
|
<height>373</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_8">
|
||||||
|
<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>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalSpacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="verticalSpacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QFrame" name="frame_6">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>102</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_7">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QListWidget" name="listWidget">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="currentRow">
|
||||||
|
<number>-1</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>通讯状态</string>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="textAlignment">
|
||||||
|
<set>AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>前置数据</string>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="textAlignment">
|
||||||
|
<set>AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>数据仿真</string>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="textAlignment">
|
||||||
|
<set>AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>控制仿真</string>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="textAlignment">
|
||||||
|
<set>AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>事件监视</string>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="textAlignment">
|
||||||
|
<set>AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>转发数据</string>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="textAlignment">
|
||||||
|
<set>AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QPushButton" name="fes_chan_data">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>通道报文</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QPushButton" name="iec61850_tool">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>61850工具</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QStackedWidget" name="stackedWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="page_1">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QFrame" name="frame_fesParam">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_2">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QFrame" name="frame_fesData">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_3">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QFrame" name="frame_fesDataSim">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_4">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_5">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QFrame" name="frame_fesCtrlSim">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_5">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_6">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QFrame" name="frame_fesEvent">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_6">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_9">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QFrame" name="frame_fesForwardData">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_7">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_10">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QFrame" name="frame_fesChanData">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<widget class="QFrame" name="frame_fessimLocal">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="verticalSpacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>专业名称</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_app">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="sizeAdjustPolicy">
|
||||||
|
<enum>QComboBox::AdjustToContents</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>IP地址</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_ip">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>网络端口</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_port">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_connect">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>连接/断开</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<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="QLabel" name="netStatus">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>通讯状态:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_netStatus">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
100
product/src/tools/debug_tool_v2/CHistoryEvent.ui
Normal file
100
product/src/tools/debug_tool_v2/CHistoryEvent.ui
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CHistoryEvent</class>
|
||||||
|
<widget class="QWidget" name="CHistoryEvent">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>401</width>
|
||||||
|
<height>239</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="verticalSpacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QTableView" name="tableView"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>查询</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>打印</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<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="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>事件条数</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
93
product/src/tools/debug_tool_v2/CMyCalendar.cpp
Normal file
93
product/src/tools/debug_tool_v2/CMyCalendar.cpp
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
#include "CMyCalendar.h"
|
||||||
|
#include "ui_CMyCalendar.h"
|
||||||
|
#include <pub_logger_api/logger.h>
|
||||||
|
#include "pub_widget/MessageBox.h"
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
|
CMyCalendar::CMyCalendar(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::CMyCalendar)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
connect(ui->calendarWidget,SIGNAL(clicked(QDate)),this,SLOT(slot_startTime(QDate)));
|
||||||
|
connect(ui->calendarWidget_2,SIGNAL(clicked(QDate)),this,SLOT(slot_endTime(QDate)));
|
||||||
|
connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(slot_cancle()));
|
||||||
|
m_startTime = QDate::currentDate();
|
||||||
|
m_endTime = QDate::currentDate();
|
||||||
|
ui->lineEdit->setText(m_startTime.toString("yyyy-MM-dd"));
|
||||||
|
ui->lineEdit_2->setText(m_endTime.toString("yyyy-MM-dd"));
|
||||||
|
ui->lineEdit->setReadOnly(true);
|
||||||
|
ui->lineEdit_2->setReadOnly(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
CMyCalendar::~CMyCalendar()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMyCalendar::setView(E_ALARM_VIEW view)
|
||||||
|
{
|
||||||
|
m_view = view;
|
||||||
|
if(m_view == E_ALARM_HIS_EVENT)
|
||||||
|
{
|
||||||
|
ui->pushButton->setEnabled(false);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
ui->pushButton->setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMyCalendar::keyPressEvent(QKeyEvent *event)
|
||||||
|
{
|
||||||
|
if(event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
|
||||||
|
{
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
QWidget::keyPressEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMyCalendar::slot_endTime(QDate date)
|
||||||
|
{
|
||||||
|
ui->lineEdit_2->setText(date.toString("yyyy-MM-dd"));
|
||||||
|
m_endTime = date;
|
||||||
|
if(m_startTime.isNull() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(m_endTime < m_startTime)
|
||||||
|
{
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
if(m_view == E_ALARM_HIS_EVENT)
|
||||||
|
{
|
||||||
|
QTime time_1(0,0,0);
|
||||||
|
QTime time_2(23,59,59);
|
||||||
|
QDateTime startTime;
|
||||||
|
QDateTime endTime;
|
||||||
|
startTime.setDate(m_startTime);
|
||||||
|
startTime.setTime(time_1);
|
||||||
|
|
||||||
|
endTime.setDate(m_endTime);
|
||||||
|
endTime.setTime(time_2);
|
||||||
|
if((endTime.toMSecsSinceEpoch()-startTime.toMSecsSinceEpoch())/1000/3600/24 >= 90 )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
emit sig_endTimeClick(m_startTime,m_endTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMyCalendar::slot_startTime(QDate date)
|
||||||
|
{
|
||||||
|
m_startTime = date;
|
||||||
|
ui->lineEdit->setText(date.toString("yyyy-MM-dd"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMyCalendar::slot_cancle()
|
||||||
|
{
|
||||||
|
if(m_view == E_ALARM_HIS_EVENT)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
emit sig_cancle();
|
||||||
|
}
|
||||||
38
product/src/tools/debug_tool_v2/CMyCalendar.h
Normal file
38
product/src/tools/debug_tool_v2/CMyCalendar.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#ifndef CMYCALENDAR_H
|
||||||
|
#define CMYCALENDAR_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QDate>
|
||||||
|
#include <QKeyEvent>
|
||||||
|
#include "CEventMsgInfo.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CMyCalendar;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CMyCalendar : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
signals:
|
||||||
|
void sig_endTimeClick(QDate startDate,QDate endDate);
|
||||||
|
void sig_startTimeClick(QDate date);
|
||||||
|
void sig_cancle();
|
||||||
|
public:
|
||||||
|
explicit CMyCalendar(QWidget *parent = 0);
|
||||||
|
~CMyCalendar();
|
||||||
|
void setView(E_ALARM_VIEW view);
|
||||||
|
protected:
|
||||||
|
void keyPressEvent(QKeyEvent *event);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void slot_endTime(QDate date);
|
||||||
|
void slot_startTime(QDate date);
|
||||||
|
void slot_cancle();
|
||||||
|
private:
|
||||||
|
Ui::CMyCalendar *ui;
|
||||||
|
QDate m_startTime;
|
||||||
|
QDate m_endTime;
|
||||||
|
E_ALARM_VIEW m_view;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CMYCALENDAR_H
|
||||||
119
product/src/tools/debug_tool_v2/CMyCalendar.ui
Normal file
119
product/src/tools/debug_tool_v2/CMyCalendar.ui
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CMyCalendar</class>
|
||||||
|
<widget class="QWidget" name="CMyCalendar">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>538</width>
|
||||||
|
<height>264</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QFrame" name="frame_event">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>至</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_2"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>取消</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QCalendarWidget" name="calendarWidget"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCalendarWidget" name="calendarWidget_2"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
22
product/src/tools/debug_tool_v2/CMyCheckBox.cpp
Normal file
22
product/src/tools/debug_tool_v2/CMyCheckBox.cpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#include "CMyCheckBox.h"
|
||||||
|
#include <QMouseEvent>
|
||||||
|
|
||||||
|
CMyCheckBox::CMyCheckBox(QString text, QWidget *parent)
|
||||||
|
:QCheckBox(text,parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CMyCheckBox::CMyCheckBox(QWidget *parent)
|
||||||
|
:QCheckBox(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMyCheckBox::mouseReleaseEvent(QMouseEvent *e)
|
||||||
|
{
|
||||||
|
Q_UNUSED(e);
|
||||||
|
setChecked(!isChecked());
|
||||||
|
emit clicked(isChecked());
|
||||||
|
|
||||||
|
}
|
||||||
16
product/src/tools/debug_tool_v2/CMyCheckBox.h
Normal file
16
product/src/tools/debug_tool_v2/CMyCheckBox.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#ifndef MYCHECKBOX_H
|
||||||
|
#define MYCHECKBOX_H
|
||||||
|
|
||||||
|
#include <QCheckBox>
|
||||||
|
|
||||||
|
class CMyCheckBox : public QCheckBox
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CMyCheckBox(QString text,QWidget *parent = Q_NULLPTR);
|
||||||
|
CMyCheckBox(QWidget *parent = Q_NULLPTR);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void mouseReleaseEvent(QMouseEvent *e);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MYCHECKBOX_H
|
||||||
12
product/src/tools/debug_tool_v2/CMyListWidget.cpp
Normal file
12
product/src/tools/debug_tool_v2/CMyListWidget.cpp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include "CMyListWidget.h"
|
||||||
|
|
||||||
|
CMyListWidget::CMyListWidget(QWidget *parent):QListWidget(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMyListWidget::showEvent(QShowEvent *event)
|
||||||
|
{
|
||||||
|
this->updateGeometries();
|
||||||
|
QListWidget::showEvent(event);
|
||||||
|
}
|
||||||
15
product/src/tools/debug_tool_v2/CMyListWidget.h
Normal file
15
product/src/tools/debug_tool_v2/CMyListWidget.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef CMYLISTWIDGET_H
|
||||||
|
#define CMYLISTWIDGET_H
|
||||||
|
|
||||||
|
#include <QListWidget>
|
||||||
|
|
||||||
|
class CMyListWidget : public QListWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit CMyListWidget(QWidget *parent = 0);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void showEvent(QShowEvent *event);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CMYLISTWIDGET_H
|
||||||
14
product/src/tools/debug_tool_v2/CNodeStatus.cpp
Normal file
14
product/src/tools/debug_tool_v2/CNodeStatus.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include "CNodeStatus.h"
|
||||||
|
#include "ui_CNodeStatus.h"
|
||||||
|
|
||||||
|
CNodeStatus::CNodeStatus(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::CNodeStatus)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
CNodeStatus::~CNodeStatus()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
22
product/src/tools/debug_tool_v2/CNodeStatus.h
Normal file
22
product/src/tools/debug_tool_v2/CNodeStatus.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#ifndef CNODESTATUS_H
|
||||||
|
#define CNODESTATUS_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CNodeStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CNodeStatus : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CNodeStatus(QWidget *parent = 0);
|
||||||
|
~CNodeStatus();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::CNodeStatus *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CNODESTATUS_H
|
||||||
134
product/src/tools/debug_tool_v2/CNodeStatus.ui
Normal file
134
product/src/tools/debug_tool_v2/CNodeStatus.ui
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CNodeStatus</class>
|
||||||
|
<widget class="QWidget" name="CNodeStatus">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>关键字</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>查找</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>刷新</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<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>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QTableView" name="tableView">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTableView" name="tableView_2"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTableView" name="tableView_3"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>全部选中</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_4">
|
||||||
|
<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>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
40
product/src/tools/debug_tool_v2/CRdbWorker.cpp
Normal file
40
product/src/tools/debug_tool_v2/CRdbWorker.cpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#include "CRdbWorker.h"
|
||||||
|
#include "pub_logger_api/logger.h"
|
||||||
|
#include<QDebug>
|
||||||
|
CRdbWorker::CRdbWorker()
|
||||||
|
{
|
||||||
|
m_pNetRdbApi = new iot_dbms::CRdbNetApi();
|
||||||
|
}
|
||||||
|
|
||||||
|
CRdbWorker::~CRdbWorker()
|
||||||
|
{
|
||||||
|
if(m_pNetRdbApi)
|
||||||
|
{
|
||||||
|
delete m_pNetRdbApi;
|
||||||
|
|
||||||
|
}
|
||||||
|
m_pNetRdbApi = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRdbWorker::search(int domainId, int appid, iot_idl::RdbQuery msgQuery, QString tableName, int searchWays)
|
||||||
|
{
|
||||||
|
iot_idl::RdbRet retMsg;
|
||||||
|
bool isSuccess = false;
|
||||||
|
if(m_pNetRdbApi)
|
||||||
|
{
|
||||||
|
m_pNetRdbApi->connect(domainId,appid);
|
||||||
|
if(m_pNetRdbApi->query(msgQuery,retMsg))
|
||||||
|
{
|
||||||
|
isSuccess = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(searchWays == 0)
|
||||||
|
{
|
||||||
|
emit sigAutoSearch(isSuccess,retMsg,tableName);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
emit sigNotAutoSearch(isSuccess,retMsg,tableName);
|
||||||
|
}
|
||||||
|
}
|
||||||
22
product/src/tools/debug_tool_v2/CRdbWorker.h
Normal file
22
product/src/tools/debug_tool_v2/CRdbWorker.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#ifndef CRDBWORKER_H
|
||||||
|
#define CRDBWORKER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "rdb_net_api/CRdbNetApi.h"
|
||||||
|
#include "rdb_api/CRdbAccessEx.h"
|
||||||
|
class CRdbWorker : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
CRdbWorker();
|
||||||
|
~CRdbWorker();
|
||||||
|
signals:
|
||||||
|
void sigAutoSearch(bool isSuccess,iot_idl::RdbRet rdbRet,QString tableName);
|
||||||
|
void sigNotAutoSearch(bool isSuccess,iot_idl::RdbRet rdbRet,QString tableName);
|
||||||
|
public slots:
|
||||||
|
void search(int domainId, int appid, iot_idl::RdbQuery msgQuery,QString tableName,int searchWays);
|
||||||
|
private:
|
||||||
|
iot_dbms::CRdbNetApi *m_pNetRdbApi; //网络实时数据库接口指针
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CRDBWORKER_H
|
||||||
249
product/src/tools/debug_tool_v2/CRealAlarm.ui
Normal file
249
product/src/tools/debug_tool_v2/CRealAlarm.ui
Normal file
@ -0,0 +1,249 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CRealAlarm</class>
|
||||||
|
<widget class="QWidget" name="CRealAlarm">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>829</width>
|
||||||
|
<height>350</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>全部确认</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>当前页确认</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>所选确认</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_4">
|
||||||
|
<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>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>刷新</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>停止刷新</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>75</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>选中条数</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>90</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>总报警条数</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_2">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>75</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>未确认条数</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_3">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTableWidget" name="tableWidget"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>级别排序</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>滚动刷新</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>状态筛选</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<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="QLabel" name="label_4">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>当前报警条数</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_4">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>60</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>选中条数</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_5">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
1221
product/src/tools/debug_tool_v2/CRealDataControl.cpp
Normal file
1221
product/src/tools/debug_tool_v2/CRealDataControl.cpp
Normal file
File diff suppressed because it is too large
Load Diff
127
product/src/tools/debug_tool_v2/CRealDataControl.h
Normal file
127
product/src/tools/debug_tool_v2/CRealDataControl.h
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
#ifndef CREALDATACONTROL_H
|
||||||
|
#define CREALDATACONTROL_H
|
||||||
|
|
||||||
|
#include "pub_widget/CustomDialog.h"
|
||||||
|
#include <QMap>
|
||||||
|
#include <QVector>
|
||||||
|
#include <QDateTime>
|
||||||
|
#include "pub_widget/MessageBox.h"
|
||||||
|
#include <sstream>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
|
||||||
|
#include "CSystemResources.h"
|
||||||
|
#include "MessageChannel.h"
|
||||||
|
#include "operate_server_api/JsonMessageStruct.h"
|
||||||
|
#include "operate_server_api/JsonOptCommand.h"
|
||||||
|
#include "rdb_net_api/CRdbNetApi.h"
|
||||||
|
#include "net_msg_bus_api/MsgBusApi.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define APP_ID 4
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CRealDataControl;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CRealDataControl : public CustomUiDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CRealDataControl(int locationId,
|
||||||
|
int subSystemId,
|
||||||
|
QString pointName,
|
||||||
|
QString tagName,
|
||||||
|
QString tableName,
|
||||||
|
CSystemResources *,
|
||||||
|
bool isCtrl,
|
||||||
|
QWidget *parent);
|
||||||
|
~CRealDataControl();
|
||||||
|
void initControl(int locationId,int subSystemId,QString pointName,QString tagName,QString tableName,CSystemResources *pSystemResources);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void slot_updateOtherArgs(int );
|
||||||
|
void slot_exeCmd();
|
||||||
|
void slot_timeOutReciceMsg();
|
||||||
|
void slot_exeStatus();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
Ui::CRealDataControl * ui;
|
||||||
|
|
||||||
|
iot_net::CMbCommunicator * m_pSendComm;
|
||||||
|
iot_net::CMbCommunicator * m_pReceiveComm;
|
||||||
|
|
||||||
|
CSystemResources * m_pSystemResources;
|
||||||
|
|
||||||
|
iot_dbms::CDbApi * m_pDbInterface;
|
||||||
|
|
||||||
|
iot_public::SAppInfo m_stAppInfo;
|
||||||
|
int m_nDestSubSystemId;
|
||||||
|
int m_nDestLocationId;
|
||||||
|
QString m_strPointName;
|
||||||
|
QString m_strPointTagName;
|
||||||
|
QString m_strTableName;
|
||||||
|
|
||||||
|
QString m_strSrcTag;
|
||||||
|
int m_nSrcDomainId;
|
||||||
|
int m_nAppId;
|
||||||
|
QString m_strHostName;
|
||||||
|
QString m_strInstName;
|
||||||
|
QString m_strCommName;
|
||||||
|
int m_nPermUserId;
|
||||||
|
int m_nPermUserGroupId;
|
||||||
|
|
||||||
|
QTimer * m_pTimer;
|
||||||
|
int m_timeOutTimes;
|
||||||
|
|
||||||
|
QVector<QString> m_aiLimitOtherArgs;
|
||||||
|
|
||||||
|
bool m_isCtrl;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void initVariable(int locationId,int subSystemId,QString pointName,QString tagName,QString tableName,CSystemResources *pSystemResources);
|
||||||
|
void initView();
|
||||||
|
void initCmdTypeComBox();
|
||||||
|
void initCMbCommunicator();
|
||||||
|
void initSingalSlot();
|
||||||
|
|
||||||
|
void addAiCmd();
|
||||||
|
void addDiCmd();
|
||||||
|
void addMiCmd();
|
||||||
|
void addPiCmd();
|
||||||
|
void addConstCmd();
|
||||||
|
|
||||||
|
void getHead(SOptReqHead &);
|
||||||
|
|
||||||
|
void exeSetAiLimit();
|
||||||
|
void exeInhibitRef();
|
||||||
|
void exeInhibitAlarm();
|
||||||
|
void exeInhibitCtrl();
|
||||||
|
void exeSetValue();
|
||||||
|
void exeCtrlRequest();
|
||||||
|
void exeCtrlSelect();
|
||||||
|
void exeCtrlExecute();
|
||||||
|
void exeCtrlCancel();
|
||||||
|
void exeCtrlClose();
|
||||||
|
void exeCommon();
|
||||||
|
|
||||||
|
void aiLimitQuery();
|
||||||
|
void OptPointQuery();
|
||||||
|
|
||||||
|
void ctrlRequestReply(const std::string &);
|
||||||
|
//只有在 遥控选择、遥控执行、才需要设置targetValue
|
||||||
|
void setTargetValue(bool &isExist);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CREALDATACONTROL_H
|
||||||
290
product/src/tools/debug_tool_v2/CRealDataControl.ui
Normal file
290
product/src/tools/debug_tool_v2/CRealDataControl.ui
Normal file
@ -0,0 +1,290 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CRealDataControl</class>
|
||||||
|
<widget class="QWidget" name="CRealDataControl">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>301</width>
|
||||||
|
<height>445</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>85</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>85</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>控制测点:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>85</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>85</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>命令类型:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_cmdType">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>85</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>85</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>其他参数:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_otherArgs">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>85</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>85</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>控制数值:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_ctrlValue">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_ctrlValue">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_exe">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>执行命令</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_exeStatus">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>状态查询</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>执行状态</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTextBrowser" name="textBrowser_exeStatus"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>反馈结果</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTextBrowser" name="textBrowser_exeResult"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
905
product/src/tools/debug_tool_v2/CRealDataSelect.cpp
Normal file
905
product/src/tools/debug_tool_v2/CRealDataSelect.cpp
Normal file
@ -0,0 +1,905 @@
|
|||||||
|
#include "CRealDataSelect.h"
|
||||||
|
#include "ui_CRealDataSelect.h"
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QScrollBar>
|
||||||
|
#include <QAbstractItemView>
|
||||||
|
CRealDataSelect::CRealDataSelect(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::CRealDataSelect)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
m_nAddModel = -1;
|
||||||
|
//ui->lineEdit->setHidden(true);
|
||||||
|
//ui->pushButton->setHidden(true);
|
||||||
|
|
||||||
|
//ui->comboBox_devGroup->setView(new QListView());
|
||||||
|
ui->comboBox_location->setView(new QListView());
|
||||||
|
ui->comboBox_subSystem->setView(new QListView());
|
||||||
|
//ui->comboBox_devGroup->setHidden(true);
|
||||||
|
//ui->devGroup->setHidden(true);
|
||||||
|
//ui->listWidget_device->setHidden(true);
|
||||||
|
//ui->device->setHidden(true);
|
||||||
|
ui->treeWidget_devGroup->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
ui->tableWidget_MesurePoint->setHidden(true);
|
||||||
|
ui->pushButton->setHidden(true);
|
||||||
|
|
||||||
|
initPntTableInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void CRealDataSelect::setSystemResources(CSystemResources *pSystemResources)
|
||||||
|
{
|
||||||
|
m_pSystemResources = pSystemResources;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataSelect::setRealDataWatch(CRealDataWatch *pWatch)
|
||||||
|
{
|
||||||
|
m_pRealDataWatch = pWatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CRealDataSelect::~CRealDataSelect()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CRealDataSelect::initSelect()
|
||||||
|
{
|
||||||
|
initVariable();
|
||||||
|
initSignalsSlots();
|
||||||
|
initLocationComBox();
|
||||||
|
initSubSystemComBox();
|
||||||
|
//initDevGroupComBox();
|
||||||
|
|
||||||
|
// initDeviceListWidget();
|
||||||
|
initPointTableWidget();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataSelect::initVariable()
|
||||||
|
{
|
||||||
|
m_pObjDbInterface = m_pSystemResources->getDbInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataSelect::initLocationComBox()
|
||||||
|
{
|
||||||
|
QSqlQuery locationTable;
|
||||||
|
m_pObjDbInterface->execute("SELECT DESCRIPTION,LOCATION_ID FROM sys_model_location_info ORDER BY LOCATION_ID", locationTable);
|
||||||
|
if(locationTable.isActive())
|
||||||
|
{
|
||||||
|
QVariant val;
|
||||||
|
val.clear();
|
||||||
|
QString locationName = "";
|
||||||
|
uint locationId = -1;
|
||||||
|
while(locationTable.next())
|
||||||
|
{
|
||||||
|
val = locationTable.value("DESCRIPTION");
|
||||||
|
locationName = val.toString();
|
||||||
|
val = locationTable.value("LOCATION_ID");
|
||||||
|
locationId = val.toUInt();
|
||||||
|
ui->comboBox_location->addItem(locationName,locationId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ui->lineEdit->setPlaceholderText(tr("请输入描述信息"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataSelect::initSubSystemComBox()
|
||||||
|
{
|
||||||
|
QSqlQuery subSystemTable;
|
||||||
|
m_pObjDbInterface->execute("SELECT DESCRIPTION,SUB_SYSTEM_ID FROM sys_model_sub_system_info ORDER BY SUB_SYSTEM_ID", subSystemTable);
|
||||||
|
if(subSystemTable.isActive())
|
||||||
|
{
|
||||||
|
QVariant val;
|
||||||
|
val.clear();
|
||||||
|
QString subSystemName = "";
|
||||||
|
uint subSystemId = -1;
|
||||||
|
while(subSystemTable.next())
|
||||||
|
{
|
||||||
|
val = subSystemTable.value("DESCRIPTION");
|
||||||
|
subSystemName = val.toString();
|
||||||
|
val = subSystemTable.value("SUB_SYSTEM_ID");
|
||||||
|
subSystemId = val.toUInt();
|
||||||
|
if(subSystemId > CN_AppId_COMAPP)
|
||||||
|
{
|
||||||
|
ui->comboBox_subSystem->addItem(subSystemName,subSystemId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//void CRealDataSelect::initDevGroupComBox()
|
||||||
|
//{
|
||||||
|
// QSqlQuery devGroupTable;
|
||||||
|
// ui->comboBox_devGroup->clear();
|
||||||
|
|
||||||
|
// m_pObjDbInterface->execute("SELECT DESCRIPTION,TAG_NAME,LOCATION_ID,SUB_SYSTEM FROM dev_group ORDER BY TAG_NAME", devGroupTable);
|
||||||
|
// if(devGroupTable.isActive())
|
||||||
|
// {
|
||||||
|
// QVariant val;
|
||||||
|
// val.clear();
|
||||||
|
// QString devGroupName = "";
|
||||||
|
// QString devGroupTag = "";
|
||||||
|
// while(devGroupTable.next())
|
||||||
|
// {
|
||||||
|
// val = devGroupTable.value("DESCRIPTION");
|
||||||
|
// devGroupName = val.toString();
|
||||||
|
// val = devGroupTable.value("TAG_NAME");
|
||||||
|
// devGroupTag = val.toString();
|
||||||
|
// ui->comboBox_devGroup->addItem(devGroupName,devGroupTag);
|
||||||
|
|
||||||
|
// //ui->treeWidget_devGroup->addTopLevelItem(nodeItem);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//void CRealDataSelect::initDeviceListWidget()
|
||||||
|
//{
|
||||||
|
// //已废弃
|
||||||
|
// QString sqlStr= "SELECT DESCRIPTION,TAG_NAME,LOCATION_ID,SUB_SYSTEM FROM dev_info ORDER BY TAG_NAME";
|
||||||
|
// QSqlQuery deviceTable;
|
||||||
|
// m_pObjDbInterface->execute(sqlStr,deviceTable);
|
||||||
|
// if(deviceTable.isActive())
|
||||||
|
// {
|
||||||
|
// QVariant val;
|
||||||
|
// val.clear();
|
||||||
|
// QString devName;
|
||||||
|
// QString devTag;
|
||||||
|
// uint locationId;
|
||||||
|
// uint subSystemId;
|
||||||
|
// QListWidgetItem *item;
|
||||||
|
// while(deviceTable.next())
|
||||||
|
// {
|
||||||
|
// val = deviceTable.value("DESCRIPTION");
|
||||||
|
// devName = val.toString();
|
||||||
|
// val = deviceTable.value("TAG_NAME");
|
||||||
|
// devTag = val.toString();
|
||||||
|
// locationId = deviceTable.value("LOCATION_ID").toUInt();
|
||||||
|
// subSystemId = deviceTable.value("SUB_SYSTEM").toUInt();
|
||||||
|
// item = new QListWidgetItem();
|
||||||
|
// item->setText(devName);
|
||||||
|
// item->setData(Qt::UserRole+1,devTag);
|
||||||
|
// item->setData(Qt::UserRole+2,locationId);
|
||||||
|
// item->setData(Qt::UserRole+3,subSystemId);
|
||||||
|
// ui->listWidget_device->addItem(item);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
void CRealDataSelect::initPointTableWidget()
|
||||||
|
{
|
||||||
|
ui->tableWidget_MesurePoint->setColumnCount(2);
|
||||||
|
QStringList header;
|
||||||
|
header.append(tr("类型"));
|
||||||
|
header.append(tr("测点"));
|
||||||
|
ui->tableWidget_MesurePoint->setHorizontalHeaderLabels(header);
|
||||||
|
ui->tableWidget_MesurePoint->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
|
ui->tableWidget_MesurePoint->setColumnWidth(0,50);
|
||||||
|
ui->tableWidget_MesurePoint->setColumnWidth(1,100);
|
||||||
|
//ui->tableWidget_MesurePoint->setMaximumWidth(200);
|
||||||
|
ui->tableWidget_MesurePoint->horizontalHeader()->setStretchLastSection(true);
|
||||||
|
ui->tableWidget_MesurePoint->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
|
||||||
|
//设置table的水平滚动条
|
||||||
|
|
||||||
|
ui->tableWidget_MesurePoint->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||||
|
ui->tableWidget_MesurePoint->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void CRealDataSelect::initSignalsSlots()
|
||||||
|
{
|
||||||
|
connect(ui->comboBox_location,SIGNAL(currentIndexChanged(int)),
|
||||||
|
this,SLOT(slot_selectTreeDevGroup(int)));
|
||||||
|
|
||||||
|
//connect(ui->comboBox_subSystem,SIGNAL(currentIndexChanged(int)),
|
||||||
|
//this,SLOT(slot_selectDevGroup(int)));
|
||||||
|
connect(ui->comboBox_subSystem,SIGNAL(currentIndexChanged(int)),
|
||||||
|
this,SLOT(slot_selectTreeDevGroup(int)));
|
||||||
|
connect(ui->lineEdit,SIGNAL(textEdited(QString)),this,SLOT(slot_queryDev(QString)));
|
||||||
|
//connect(ui->comboBox_location,SIGNAL(currentIndexChanged(int)),
|
||||||
|
// this,SLOT(slot_selectDevice(int)));
|
||||||
|
//connect(ui->comboBox_subSystem,SIGNAL(currentIndexChanged(int)),
|
||||||
|
//this,SLOT(slot_selectDevice(int)));
|
||||||
|
|
||||||
|
//connect(ui->comboBox_devGroup,SIGNAL(currentIndexChanged(int)),
|
||||||
|
// this,SLOT(slot_selectDevice(int)));
|
||||||
|
|
||||||
|
//connect(ui->listWidget_device,SIGNAL(itemClicked(QListWidgetItem*)),
|
||||||
|
//this,SLOT(slot_showPoint(QListWidgetItem*)));
|
||||||
|
connect(ui->treeWidget_devGroup,SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int))
|
||||||
|
,this,SLOT(solt_showPoint(QTreeWidgetItem*,int)));
|
||||||
|
// connect(ui->tableWidget_MesurePoint,SIGNAL(cellDoubleClicked(int,int)),
|
||||||
|
// this,SLOT(slot_addPoint(int,int)));
|
||||||
|
connect(ui->pushButton,SIGNAL(clicked()),
|
||||||
|
this,SLOT(slot_queryDev()));
|
||||||
|
// connect(ui->listWidget_device,SIGNAL(itemDoubleClicked(QListWidgetItem*)),
|
||||||
|
//this,SLOT(slot_addAllCurrentPoint(QListWidgetItem*)));
|
||||||
|
|
||||||
|
// connect(ui->treeWidget_devGroup,SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
|
||||||
|
// this,SLOT(slot_addAllCurrentPoint(QTreeWidgetItem*,int)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//void CRealDataSelect::slot_selectDevice(int)
|
||||||
|
//{
|
||||||
|
// ui->listWidget_device->clear();
|
||||||
|
// ui->tableWidget_MesurePoint->clearContents();
|
||||||
|
// ui->tableWidget_MesurePoint->setRowCount(0);
|
||||||
|
// uint locationId = ui->comboBox_location->currentData(Qt::UserRole).toUInt();
|
||||||
|
// uint subSystemId = ui->comboBox_subSystem->currentData(Qt::UserRole).toUInt();
|
||||||
|
// QString devGroup = ui->comboBox_devGroup->currentData(Qt::UserRole).toString();
|
||||||
|
// QString sqlStr = QString("SELECT DESCRIPTION,TAG_NAME,LOCATION_ID,SUB_SYSTEM FROM dev_info where LOCATION_ID = %1 "
|
||||||
|
// " AND SUB_SYSTEM = %2 "
|
||||||
|
// " and group_tag_name ='%3' ORDER BY TAG_NAME").arg(locationId).arg(subSystemId).arg(devGroup);
|
||||||
|
|
||||||
|
// QSqlQuery deviceTable;
|
||||||
|
// m_pObjDbInterface->execute(sqlStr,deviceTable);
|
||||||
|
// if(deviceTable.isActive())
|
||||||
|
// {
|
||||||
|
// QString devName;
|
||||||
|
// QString devTag;
|
||||||
|
// uint locationId_2;
|
||||||
|
// uint subSystemId_2;
|
||||||
|
// QListWidgetItem *item;
|
||||||
|
// while(deviceTable.next())
|
||||||
|
// {
|
||||||
|
// devName = deviceTable.value("DESCRIPTION").toString();
|
||||||
|
// devTag = deviceTable.value("TAG_NAME").toString();
|
||||||
|
// locationId_2 = deviceTable.value("LOCATION_ID").toUInt();
|
||||||
|
// subSystemId_2 = deviceTable.value("SUB_SYSTEM").toUInt();
|
||||||
|
// item = new QListWidgetItem();
|
||||||
|
// item->setText(devName);
|
||||||
|
// item->setData(Qt::UserRole+1,devTag);
|
||||||
|
// item->setData(Qt::UserRole+2,locationId_2);
|
||||||
|
// item->setData(Qt::UserRole+3,subSystemId_2);
|
||||||
|
// ui->listWidget_device->addItem(item);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//void CRealDataSelect::slot_selectDevGroup(int)
|
||||||
|
//{
|
||||||
|
// uint locationId = ui->comboBox_location->currentData(Qt::UserRole).toUInt();
|
||||||
|
// uint subSystemId = ui->comboBox_subSystem->currentData(Qt::UserRole).toUInt();
|
||||||
|
// ui->comboBox_devGroup->clear();
|
||||||
|
|
||||||
|
// QSqlQuery devGroupTable;
|
||||||
|
// devGroupTable.clear();
|
||||||
|
// QString sqlStr = QString("SELECT DESCRIPTION,TAG_NAME,LOCATION_ID,SUB_SYSTEM FROM dev_group where SUB_SYSTEM =%1 "
|
||||||
|
// "and LOCATION_ID = %2 ORDER BY TAG_NAME").arg(subSystemId).arg(locationId);
|
||||||
|
// m_pObjDbInterface->execute(sqlStr, devGroupTable);
|
||||||
|
|
||||||
|
// if(devGroupTable.isActive())
|
||||||
|
// {
|
||||||
|
// QVariant val;
|
||||||
|
// val.clear();
|
||||||
|
// QString devGroupName ="";
|
||||||
|
// QString devGroupTag = "";
|
||||||
|
// while(devGroupTable.next())
|
||||||
|
// {
|
||||||
|
// val = devGroupTable.value("DESCRIPTION");
|
||||||
|
// devGroupName = val.toString();
|
||||||
|
// val = devGroupTable.value("TAG_NAME");
|
||||||
|
// devGroupTag = val.toString();
|
||||||
|
// ui->comboBox_devGroup->addItem(devGroupName,devGroupTag);
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//void CRealDataSelect::slot_showPoint(QListWidgetItem* _item)
|
||||||
|
//{
|
||||||
|
|
||||||
|
// ui->tableWidget_MesurePoint->clearContents();
|
||||||
|
// QString devTage = _item->data(Qt::UserRole+1).toString();
|
||||||
|
|
||||||
|
// QString analogTableName = "ANALOG";
|
||||||
|
// QString digitalTableName = "DIGITAL";
|
||||||
|
// QString accumlTableName = "ACCUML";
|
||||||
|
// QString mixTableName = "MIX";
|
||||||
|
// QString constTableName = "CONST";
|
||||||
|
|
||||||
|
// QStringList tableNameList;
|
||||||
|
// QStringList pointType;
|
||||||
|
// tableNameList.append(analogTableName);
|
||||||
|
// pointType.append(tr("模拟量"));
|
||||||
|
// tableNameList.append(digitalTableName);
|
||||||
|
// pointType.append(tr("数字量"));
|
||||||
|
// tableNameList.append(accumlTableName);
|
||||||
|
// pointType.append(tr("累积量"));
|
||||||
|
// tableNameList.append(mixTableName);
|
||||||
|
// pointType.append(tr("混合量"));
|
||||||
|
// tableNameList.append(constTableName);
|
||||||
|
// pointType.append(tr("常量"));
|
||||||
|
// QString strSql1 = "SELECT DESCRIPTION,TAG_NAME FROM ";
|
||||||
|
|
||||||
|
// QString strSql2 = QString(" WHERE DEVICE = ")+QString("'")+ devTage+"'";
|
||||||
|
// uint rowCount = 0;
|
||||||
|
// int j = 0;
|
||||||
|
// QTableWidgetItem *item;
|
||||||
|
// QSqlQuery pointTable;
|
||||||
|
// for(int i = 0 ; i < 4; i++)
|
||||||
|
// {
|
||||||
|
// pointTable.clear();
|
||||||
|
// m_pObjDbInterface->execute(strSql1+tableNameList[i]+strSql2,pointTable);
|
||||||
|
// qDebug()<<"sql语句"<<strSql1+tableNameList[i]+strSql2;
|
||||||
|
// if(pointTable.isActive())
|
||||||
|
// {
|
||||||
|
// rowCount += pointTable.size();
|
||||||
|
// ui->tableWidget_MesurePoint->setRowCount(rowCount);
|
||||||
|
// while(pointTable.next())
|
||||||
|
// {
|
||||||
|
// item = new QTableWidgetItem;
|
||||||
|
// item->setData(Qt::UserRole+1,tableNameList[i]);
|
||||||
|
// item->setText(pointType[i]);
|
||||||
|
// ui->tableWidget_MesurePoint->setItem(j,0,item);
|
||||||
|
// item = new QTableWidgetItem;
|
||||||
|
// item->setData(Qt::UserRole+1,pointTable.value("TAG_NAME").toString());
|
||||||
|
// item->setText(pointTable.value("DESCRIPTION").toString());
|
||||||
|
// item->setToolTip(pointTable.value("DESCRIPTION").toString());
|
||||||
|
// ui->tableWidget_MesurePoint->setItem(j++,1,item);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
void CRealDataSelect::solt_showPoint(QTreeWidgetItem* _item, int treeIndex)
|
||||||
|
{
|
||||||
|
Q_UNUSED(treeIndex);
|
||||||
|
|
||||||
|
if(_item == NULL || ui->treeWidget_devGroup->currentItem() == NULL ||
|
||||||
|
ui->treeWidget_devGroup->currentItem()->parent() == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint locationId = ui->treeWidget_devGroup->currentItem()->data(0,Qt::UserRole+2).toUInt();
|
||||||
|
uint subSystemId = ui->treeWidget_devGroup->currentItem()->data(0,Qt::UserRole+3).toUInt();
|
||||||
|
QString locationDesc = ui->comboBox_location->currentText();
|
||||||
|
QString subSystemDesc = ui->comboBox_subSystem->currentText();
|
||||||
|
QString devDescription = ui->treeWidget_devGroup->currentItem()->text(0);
|
||||||
|
QString devTagName = ui->treeWidget_devGroup->currentItem()->data(0,Qt::UserRole+1).toString();
|
||||||
|
QString descDevG = ui->treeWidget_devGroup->currentItem()->parent()->text(0);
|
||||||
|
QStringList devTagSplit = devTagName.split(".");
|
||||||
|
QString devGTag ="";
|
||||||
|
if(devTagSplit.size() == 2)
|
||||||
|
{
|
||||||
|
QString devg = devTagSplit.at(1);
|
||||||
|
QStringList devg_ = devg.split("_");
|
||||||
|
devGTag = devTagSplit.at(0)+"."+devg_.at(0);
|
||||||
|
}
|
||||||
|
QVector<SAddPointInfoPtr> vecPntPtr;
|
||||||
|
vecPntPtr.reserve(20000); //<一般一个设备不会超过2万点
|
||||||
|
|
||||||
|
ui->tableWidget_MesurePoint->clearContents();
|
||||||
|
QString devTage = _item->data(0,Qt::UserRole+1).toString();
|
||||||
|
|
||||||
|
//分页信息
|
||||||
|
QString keyword;
|
||||||
|
int nCurPage = 0;
|
||||||
|
int nPageSize = 0;
|
||||||
|
m_pRealDataWatch->getFilterAndPageInfo(keyword,nCurPage,nPageSize);
|
||||||
|
|
||||||
|
QString strSql1 = "SELECT DESCRIPTION,TAG_NAME,RTU_TAG,SEQ_NO,%1 FROM %2 %3";
|
||||||
|
QString strSql2 = QString(" WHERE DEVICE = ")+QString("'")+ devTage+"'";
|
||||||
|
|
||||||
|
if(nCurPage != 0 && nPageSize != 0)
|
||||||
|
{
|
||||||
|
if(!keyword.isEmpty())
|
||||||
|
{
|
||||||
|
strSql2 += QString(" and DESCRIPTION LIKE '%%1%'").arg(keyword);
|
||||||
|
}
|
||||||
|
|
||||||
|
strSql2 += QString(" LIMIT %1,%2").arg((nCurPage -1)*nPageSize).arg(nPageSize);
|
||||||
|
}
|
||||||
|
strSql2 += " ORDER BY SEQ_NO ASC";
|
||||||
|
|
||||||
|
uint rowCount = 0;
|
||||||
|
int nRow = 0;
|
||||||
|
int nAddModel = 1;
|
||||||
|
QTableWidgetItem *item;
|
||||||
|
QSqlQuery pointTable;
|
||||||
|
for(int nTabIdx = 0 ; nTabIdx < 4; nTabIdx++)
|
||||||
|
{
|
||||||
|
pointTable.clear();
|
||||||
|
QString strSQL = strSql1.arg(m_listPntIsCtrlCol[nTabIdx]).arg(m_listTableName[nTabIdx]).arg(strSql2);
|
||||||
|
m_pObjDbInterface->execute(strSQL,pointTable);
|
||||||
|
if(!pointTable.isActive())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
rowCount += pointTable.size();
|
||||||
|
ui->tableWidget_MesurePoint->setRowCount(rowCount);
|
||||||
|
while(pointTable.next())
|
||||||
|
{
|
||||||
|
item = new QTableWidgetItem;
|
||||||
|
item->setData(Qt::UserRole+1,m_listTableName[nTabIdx]);
|
||||||
|
item->setText(m_listPointType[nTabIdx]);
|
||||||
|
ui->tableWidget_MesurePoint->setItem(nRow,0,item);
|
||||||
|
item = new QTableWidgetItem;
|
||||||
|
//用下标访问效率高,注意与select字段顺序对应
|
||||||
|
QString strPntTagName = pointTable.value(1).toString();
|
||||||
|
item->setData(Qt::UserRole+1,strPntTagName); //<tag_name
|
||||||
|
QString strDesc = pointTable.value(0).toString();
|
||||||
|
item->setText(strDesc);
|
||||||
|
item->setToolTip(strDesc);
|
||||||
|
ui->tableWidget_MesurePoint->setItem(nRow++,1,item);
|
||||||
|
|
||||||
|
SAddPointInfoPtr ptrPntInfo = SAddPointInfoPtr::create();
|
||||||
|
ptrPntInfo->nLocationId = locationId;
|
||||||
|
ptrPntInfo->nSubsystemId = subSystemId;
|
||||||
|
ptrPntInfo->nAddModel = nAddModel++;
|
||||||
|
ptrPntInfo->strLocationDesc = locationDesc;
|
||||||
|
ptrPntInfo->strSubsystemDesc = subSystemDesc;
|
||||||
|
ptrPntInfo->strPntType = m_listPointType[nTabIdx];
|
||||||
|
ptrPntInfo->strTableName = m_listTableName[nTabIdx];
|
||||||
|
ptrPntInfo->strPntDesc = strDesc;
|
||||||
|
ptrPntInfo->strPntTagName = strPntTagName;
|
||||||
|
ptrPntInfo->strDevDesc = devDescription;
|
||||||
|
ptrPntInfo->strDevTagName = devTagName;
|
||||||
|
ptrPntInfo->strDevGroupDesc = descDevG;
|
||||||
|
ptrPntInfo->strRtuTag = pointTable.value(2).toString(); //<rtu_name
|
||||||
|
ptrPntInfo->nSeqNo = pointTable.value(3).toInt(); //<seq_no
|
||||||
|
ptrPntInfo->nIsControl = pointTable.value(4).toInt(); //<is_control
|
||||||
|
|
||||||
|
vecPntPtr.push_back(ptrPntInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
emit signal_batchAddPoint(vecPntPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataSelect::initPntTableInfo()
|
||||||
|
{
|
||||||
|
m_listTableName.append("ANALOG");
|
||||||
|
m_listPntIsCtrlCol.append("IS_CONTROL");
|
||||||
|
m_listPointType.append(tr("模拟量"));
|
||||||
|
|
||||||
|
m_listTableName.append("DIGITAL");
|
||||||
|
m_listPntIsCtrlCol.append("IS_CONTROL");
|
||||||
|
m_listPointType.append(tr("数字量"));
|
||||||
|
|
||||||
|
m_listTableName.append("ACCUML");
|
||||||
|
m_listPntIsCtrlCol.append("0 as IS_CONTROL");
|
||||||
|
m_listPointType.append(tr("累积量"));
|
||||||
|
|
||||||
|
m_listTableName.append("MIX");
|
||||||
|
m_listPntIsCtrlCol.append("IS_CONTROL");
|
||||||
|
m_listPointType.append(tr("混合量"));
|
||||||
|
|
||||||
|
m_listTableName.append("CONST");
|
||||||
|
m_listPntIsCtrlCol.append("0 as IS_CONTROL");
|
||||||
|
m_listPointType.append(tr("常量"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataSelect::slot_addPoint(int row,int)
|
||||||
|
{
|
||||||
|
uint locationId = ui->treeWidget_devGroup->currentItem()->data(0,Qt::UserRole+2).toUInt();
|
||||||
|
uint subSystemId = ui->treeWidget_devGroup->currentItem()->data(0,Qt::UserRole+3).toUInt();
|
||||||
|
QString pointType = ui->tableWidget_MesurePoint->item(row,0)->text();
|
||||||
|
QString tableName = ui->tableWidget_MesurePoint->item(row,0)->data(Qt::UserRole+1).toString();
|
||||||
|
QString pointDescription = ui->tableWidget_MesurePoint->item(row,1)->text();
|
||||||
|
QString pointTagName = ui->tableWidget_MesurePoint->item(row,1)->data(Qt::UserRole+1).toString();
|
||||||
|
QString devDescription = ui->treeWidget_devGroup->currentItem()->text(0);
|
||||||
|
QString devTagName = ui->treeWidget_devGroup->currentItem()->data(0,Qt::UserRole+1).toString();
|
||||||
|
QStringList devTagSplit = devTagName.split(".");
|
||||||
|
QString devGTag ="";
|
||||||
|
|
||||||
|
if(devTagSplit.size() == 2)
|
||||||
|
{
|
||||||
|
QString devg = devTagSplit.at(1);
|
||||||
|
QStringList devg_ = devg.split("_");
|
||||||
|
devGTag = devTagSplit.at(0)+"."+devg_.at(0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QString descDevG =ui->treeWidget_devGroup->currentItem()->parent()->text(0);
|
||||||
|
|
||||||
|
emit signal_addPoint(ui->comboBox_location->currentText(),locationId,
|
||||||
|
ui->comboBox_subSystem->currentText(),subSystemId,
|
||||||
|
pointType,tableName,
|
||||||
|
pointDescription,pointTagName,
|
||||||
|
devDescription,devTagName,descDevG,m_nAddModel,devTagName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataSelect::slot_queryDev()
|
||||||
|
{
|
||||||
|
|
||||||
|
QString keyWord = ui->lineEdit->text().trimmed();
|
||||||
|
QTreeWidgetItemIterator it(ui->treeWidget_devGroup);
|
||||||
|
while(*it){
|
||||||
|
ui->treeWidget_devGroup->setItemHidden(*it,false);
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
if(keyWord.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
QTreeWidgetItemIterator itor(ui->treeWidget_devGroup);
|
||||||
|
while(*itor){
|
||||||
|
if((*itor)->text(0).contains(keyWord,Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
|
for(int i=0;i<(*itor)->childCount();i++)
|
||||||
|
{
|
||||||
|
itor++;
|
||||||
|
}
|
||||||
|
itor++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//确认子节点是否匹配
|
||||||
|
bool childBool=0;
|
||||||
|
for(int i=0;i<(*itor)->childCount();i++)
|
||||||
|
{
|
||||||
|
if((*itor)->child(i)->text(0).contains(keyWord,Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
|
childBool=1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->treeWidget_devGroup->setItemHidden((*itor)->child(i),true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(childBool==false)
|
||||||
|
{
|
||||||
|
ui->treeWidget_devGroup->setItemHidden(*itor,true);
|
||||||
|
}
|
||||||
|
for(int i=0;i<(*itor)->childCount();i++){
|
||||||
|
itor++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
itor++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataSelect::slot_queryDev(QString)
|
||||||
|
{
|
||||||
|
slot_selectTreeDevGroup(0);
|
||||||
|
QString keyWord = ui->lineEdit->text().trimmed();
|
||||||
|
QString tag_name = ui->lineEdit->text();
|
||||||
|
|
||||||
|
/* caodingfa: 从代码逻辑来看,已经无法适配现有功能,注释掉
|
||||||
|
if((allSelect(tag_name))||(preciseSelect()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
QTreeWidgetItemIterator it(ui->treeWidget_devGroup);
|
||||||
|
while(*it){
|
||||||
|
ui->treeWidget_devGroup->setItemHidden(*it,false);
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
if(keyWord.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QTreeWidgetItemIterator itor(ui->treeWidget_devGroup);
|
||||||
|
while(*itor)
|
||||||
|
{
|
||||||
|
if((*itor)->text(0).contains(keyWord,Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
|
int k=(*itor)->childCount();
|
||||||
|
for(int i=0;i<k;i++)
|
||||||
|
{
|
||||||
|
itor++;
|
||||||
|
}
|
||||||
|
itor++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//确认子节点是否匹配
|
||||||
|
bool childBool=0;
|
||||||
|
for(int i=0;i<(*itor)->childCount();i++)
|
||||||
|
{
|
||||||
|
if((*itor)->child(i)->text(0).contains(keyWord,Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
|
childBool=1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->treeWidget_devGroup->setItemHidden((*itor)->child(i),true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(childBool==false)
|
||||||
|
{
|
||||||
|
ui->treeWidget_devGroup->setItemHidden(*itor,true);
|
||||||
|
}
|
||||||
|
for(int i=0;i<(*itor)->childCount();i++){
|
||||||
|
itor++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
itor++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataSelect::slot_addAllCurrentPoint(QListWidgetItem *)
|
||||||
|
{
|
||||||
|
int rowCount = ui->tableWidget_MesurePoint->rowCount();
|
||||||
|
m_nAddModel = 1;
|
||||||
|
for(int i = 0; i < rowCount; ++i)
|
||||||
|
{
|
||||||
|
slot_addPoint(i,0);
|
||||||
|
m_nAddModel++;
|
||||||
|
}
|
||||||
|
m_nAddModel = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataSelect::slot_selectTreeDevGroup(int)
|
||||||
|
{
|
||||||
|
uint locationId = ui->comboBox_location->currentData(Qt::UserRole).toUInt();
|
||||||
|
uint subSystemId = ui->comboBox_subSystem->currentData(Qt::UserRole).toUInt();
|
||||||
|
ui->treeWidget_devGroup->clear();
|
||||||
|
// QTreeWidgetItem *firstItem=new QTreeWidgetItem();
|
||||||
|
// firstItem->setText(0,ui->comboBox_location->currentText());
|
||||||
|
// ui->treeWidget_devGroup->addTopLevelItem(firstItem);
|
||||||
|
QSqlQuery devGroupTable;
|
||||||
|
devGroupTable.clear();
|
||||||
|
QString sqlStr = QString("SELECT a.DESCRIPTION dev_group_name,b.DESCRIPTION device_name,"
|
||||||
|
" b.TAG_NAME tag_name,a.LOCATION_ID location_id,a.SUB_SYSTEM sub_system FROM dev_group a,dev_info b"
|
||||||
|
" where a.LOCATION_ID= %1 and a.SUB_SYSTEM= %2 and "
|
||||||
|
"a.TAG_NAME =b.GROUP_TAG_NAME order by a.DESCRIPTION ").arg(locationId).arg(subSystemId);
|
||||||
|
|
||||||
|
m_pObjDbInterface->execute(sqlStr, devGroupTable);
|
||||||
|
if(devGroupTable.isActive())
|
||||||
|
{
|
||||||
|
|
||||||
|
QVariant val;
|
||||||
|
val.clear();
|
||||||
|
QString dev_group_name ="";
|
||||||
|
QString device_name = "";
|
||||||
|
QString lastDevGroupName="";
|
||||||
|
QString tag_name="";
|
||||||
|
QString location_id="";
|
||||||
|
QString sub_system="";
|
||||||
|
QTreeWidgetItem *lastItem=new QTreeWidgetItem();
|
||||||
|
|
||||||
|
while(devGroupTable.next())
|
||||||
|
{
|
||||||
|
dev_group_name = devGroupTable.value(0).toString();
|
||||||
|
device_name = devGroupTable.value(1).toString();
|
||||||
|
tag_name = devGroupTable.value(2).toString();
|
||||||
|
location_id = devGroupTable.value(3).toString();
|
||||||
|
sub_system = devGroupTable.value(4).toString();
|
||||||
|
|
||||||
|
if(lastDevGroupName!=dev_group_name){
|
||||||
|
QTreeWidgetItem *nodeItem = new QTreeWidgetItem(ui->treeWidget_devGroup);
|
||||||
|
nodeItem->setText(0,dev_group_name);
|
||||||
|
nodeItem->setSelected(false);
|
||||||
|
QTreeWidgetItem *childItem = new QTreeWidgetItem(nodeItem);
|
||||||
|
childItem->setText(0,device_name);
|
||||||
|
childItem->setData(0,Qt::UserRole+1,tag_name);
|
||||||
|
childItem->setData(0,Qt::UserRole+2,location_id);
|
||||||
|
childItem->setData(0,Qt::UserRole+3,sub_system);
|
||||||
|
lastDevGroupName=dev_group_name;
|
||||||
|
lastItem=nodeItem;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
QTreeWidgetItem *childItem = new QTreeWidgetItem(lastItem);
|
||||||
|
childItem->setText(0,device_name);
|
||||||
|
childItem->setData(0,Qt::UserRole+1,tag_name);
|
||||||
|
childItem->setData(0,Qt::UserRole+2,location_id);
|
||||||
|
childItem->setData(0,Qt::UserRole+3,sub_system);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// uint locationId = ui->comboBox_location->currentData(Qt::UserRole).toUInt();
|
||||||
|
// uint subSystemId = ui->comboBox_subSystem->currentData(Qt::UserRole).toUInt();
|
||||||
|
// QString devGroup = ui->comboBox_devGroup->currentData(Qt::UserRole).toString();
|
||||||
|
// QString sqlStr = QString("SELECT DESCRIPTION,TAG_NAME,LOCATION_ID,SUB_SYSTEM FROM dev_info where LOCATION_ID = %1 "
|
||||||
|
// " AND SUB_SYSTEM = %2 "
|
||||||
|
// " and group_tag_name ='%3' ORDER BY TAG_NAME").arg(locationId).arg(subSystemId).arg(devGroup);
|
||||||
|
|
||||||
|
// QSqlQuery deviceTable;
|
||||||
|
// m_pObjDbInterface->execute(sqlStr,deviceTable);
|
||||||
|
// if(deviceTable.isActive())
|
||||||
|
// {
|
||||||
|
// QString devName;
|
||||||
|
// QString devTag;
|
||||||
|
// uint locationId_2;
|
||||||
|
// uint subSystemId_2;
|
||||||
|
// QListWidgetItem *item;
|
||||||
|
// while(deviceTable.next())
|
||||||
|
// {
|
||||||
|
// devName = deviceTable.value("DESCRIPTION").toString();
|
||||||
|
// devTag = deviceTable.value("TAG_NAME").toString();
|
||||||
|
// locationId_2 = deviceTable.value("LOCATION_ID").toUInt();
|
||||||
|
// subSystemId_2 = deviceTable.value("SUB_SYSTEM").toUInt();
|
||||||
|
// item = new QListWidgetItem();
|
||||||
|
// item->setText(devName);
|
||||||
|
// item->setData(Qt::UserRole+1,devTag);
|
||||||
|
// item->setData(Qt::UserRole+2,locationId_2);
|
||||||
|
// item->setData(Qt::UserRole+3,subSystemId_2);
|
||||||
|
// ui->listWidget_device->addItem(item);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataSelect::slot_paging()
|
||||||
|
{
|
||||||
|
solt_showPoint(ui->treeWidget_devGroup->currentItem(),ui->treeWidget_devGroup->currentColumn());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataSelect::slot_addAllCurrentPoint(QTreeWidgetItem *, int)
|
||||||
|
{
|
||||||
|
int rowCount = ui->tableWidget_MesurePoint->rowCount();
|
||||||
|
m_nAddModel = 1;
|
||||||
|
for(int i = 0; i < rowCount; ++i)
|
||||||
|
{
|
||||||
|
slot_addPoint(i,0);
|
||||||
|
m_nAddModel++;
|
||||||
|
}
|
||||||
|
m_nAddModel = -1;
|
||||||
|
}
|
||||||
|
bool CRealDataSelect::allSelect(QString tag_name)
|
||||||
|
{
|
||||||
|
bool pointBool=false;
|
||||||
|
|
||||||
|
QString analogTableName = "ANALOG";
|
||||||
|
QString digitalTableName = "DIGITAL";
|
||||||
|
QString accumlTableName = "ACCUML";
|
||||||
|
QString mixTableName = "MIX";
|
||||||
|
QStringList tableNameList;
|
||||||
|
QStringList pointType;
|
||||||
|
tableNameList.append(analogTableName);
|
||||||
|
pointType.append(tr("模拟量"));
|
||||||
|
tableNameList.append(digitalTableName);
|
||||||
|
pointType.append(tr("数字量"));
|
||||||
|
tableNameList.append(accumlTableName);
|
||||||
|
pointType.append(tr("累积量"));
|
||||||
|
tableNameList.append(mixTableName);
|
||||||
|
pointType.append(tr("混合量"));
|
||||||
|
uint locationId ;
|
||||||
|
uint subSystemId ;
|
||||||
|
QString tableName ;
|
||||||
|
QString pointDescription ;
|
||||||
|
QString pointTagName ;
|
||||||
|
QString point_type;
|
||||||
|
//QString devDescription = ui->listWidget_device->currentItem()->text();
|
||||||
|
//QString devTagName = ui->listWidget_device->currentItem()->data(Qt::UserRole+1).toString();
|
||||||
|
QString devDescription;
|
||||||
|
QString devTagName ;
|
||||||
|
QString descDevG ;
|
||||||
|
QString allName;
|
||||||
|
QString strSql1 = "select a.TAG_NAME allName,a.DESCRIPTION pointDescription,a.SEQ_NO,a.LOCATION_ID locationId,"
|
||||||
|
"a.SUB_SYSTEM subSystemId ,a.RTU_TAG,a.device devTagName,di.DESCRIPTION devDescription,dg.DESCRIPTION descDevG "
|
||||||
|
"from ";
|
||||||
|
|
||||||
|
QString strSql2 = QString(" a ,dev_info di ,dev_group dg where "
|
||||||
|
" a.TAG_NAME = ")+QString("'")+ tag_name+"' and"
|
||||||
|
" a.DEVICE =di.TAG_NAME and di.GROUP_TAG_NAME =dg.TAG_NAME ";
|
||||||
|
uint rowCount = 0;
|
||||||
|
int j = 0;
|
||||||
|
QTableWidgetItem *item;
|
||||||
|
QSqlQuery pointTable;
|
||||||
|
for(int i = 0 ; i < 4; i++)
|
||||||
|
{
|
||||||
|
pointTable.clear();
|
||||||
|
tableName = tableNameList[i];
|
||||||
|
point_type = pointType[i];
|
||||||
|
|
||||||
|
m_pObjDbInterface->execute(strSql1 + tableName + strSql2,pointTable);
|
||||||
|
if(pointTable.isActive())
|
||||||
|
{
|
||||||
|
rowCount += pointTable.size();
|
||||||
|
ui->tableWidget_MesurePoint->setRowCount(rowCount);
|
||||||
|
while(pointTable.next())
|
||||||
|
{
|
||||||
|
pointBool=true;
|
||||||
|
item = new QTableWidgetItem;
|
||||||
|
item->setData(Qt::UserRole+1,tableName);
|
||||||
|
item->setText(point_type);
|
||||||
|
ui->tableWidget_MesurePoint->setItem(j,0,item);
|
||||||
|
item = new QTableWidgetItem;
|
||||||
|
allName=pointTable.value(0).toString();
|
||||||
|
pointDescription=pointTable.value(1).toString();
|
||||||
|
locationId=pointTable.value(3).toInt();
|
||||||
|
subSystemId=pointTable.value(4).toInt();
|
||||||
|
devTagName=pointTable.value(6).toString();
|
||||||
|
devDescription=pointTable.value(7).toString();
|
||||||
|
descDevG=pointTable.value(8).toString();
|
||||||
|
|
||||||
|
pointTagName=allName;
|
||||||
|
m_nAddModel=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(pointBool==false){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for(int k=0;k<ui->comboBox_location->count();k++)
|
||||||
|
{
|
||||||
|
if(ui->comboBox_location->itemData(k,Qt::UserRole).toUInt()==locationId)
|
||||||
|
{
|
||||||
|
ui->comboBox_location->setCurrentIndex(k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(int k=0;k<ui->comboBox_subSystem->count();k++)
|
||||||
|
{
|
||||||
|
if(ui->comboBox_subSystem->itemData(k,Qt::UserRole).toUInt()==subSystemId)
|
||||||
|
{
|
||||||
|
ui->comboBox_subSystem->setCurrentIndex(k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ui->treeWidget_devGroup->clear();
|
||||||
|
slot_selectTreeDevGroup(0);
|
||||||
|
QTreeWidgetItemIterator itor(ui->treeWidget_devGroup);
|
||||||
|
while(*itor){
|
||||||
|
bool childNumber=false;
|
||||||
|
if((*itor)->text(0).contains(descDevG,Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
|
int itorCount=(*itor)->childCount();
|
||||||
|
(*itor)->setHidden(false);
|
||||||
|
for(int i=0;i<itorCount;i++)
|
||||||
|
{
|
||||||
|
if((*itor)->child(i)->text(0).contains(devDescription,Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
|
childNumber=true;
|
||||||
|
(*itor)->child(i)->setHidden(false);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
(*itor)->child(i)->setHidden(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if(childNumber==false){
|
||||||
|
(*itor)->setHidden(true);
|
||||||
|
}
|
||||||
|
for(int i=0;i<=itorCount;i++){
|
||||||
|
itor++;
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
(*itor)->setHidden(true);
|
||||||
|
itor++;
|
||||||
|
}
|
||||||
|
emit signal_addPoint(ui->comboBox_location->currentText(),locationId,
|
||||||
|
ui->comboBox_subSystem->currentText(),subSystemId,
|
||||||
|
point_type,tableName,
|
||||||
|
pointDescription,pointTagName,
|
||||||
|
devDescription,devTagName,descDevG,m_nAddModel,allName);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRealDataSelect::preciseSelect()
|
||||||
|
{
|
||||||
|
QStringList devTagSplit;
|
||||||
|
QString analogTableName = "ANALOG";
|
||||||
|
QString digitalTableName = "DIGITAL";
|
||||||
|
QString accumlTableName = "ACCUML";
|
||||||
|
QString mixTableName = "MIX";
|
||||||
|
QString currTextEdit=ui->lineEdit->text();
|
||||||
|
|
||||||
|
devTagSplit=currTextEdit.split(".");
|
||||||
|
for(int i=0;i<devTagSplit.size();i++){
|
||||||
|
if(devTagSplit.at(i).contains(analogTableName,Qt::CaseInsensitive)
|
||||||
|
||devTagSplit.at(i).contains(digitalTableName,Qt::CaseInsensitive)
|
||||||
|
||devTagSplit.at(i).contains(accumlTableName,Qt::CaseInsensitive)
|
||||||
|
||devTagSplit.at(i).contains(mixTableName,Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
|
return(allSelect(devTagSplit.at(i+1)+"."+devTagSplit.at(i+2)+"."+devTagSplit.at(i+3)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
80
product/src/tools/debug_tool_v2/CRealDataSelect.h
Normal file
80
product/src/tools/debug_tool_v2/CRealDataSelect.h
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
#ifndef CREALDATASELECT_H
|
||||||
|
#define CREALDATASELECT_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QSqlQuery>
|
||||||
|
#include <QListWidgetItem>
|
||||||
|
#include <QTableWidgetItem>
|
||||||
|
#include <QModelIndex>
|
||||||
|
#include "pub_widget/MessageBox.h"
|
||||||
|
#include "db_api_ex/CDbApi.h"
|
||||||
|
#include "CSystemResources.h"
|
||||||
|
#include<QTreeWidget>
|
||||||
|
#include "CRealDataWatch.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CRealDataSelect;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CRealDataSelect : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CRealDataSelect(QWidget *parent = 0);
|
||||||
|
void setSystemResources(CSystemResources *);
|
||||||
|
void setRealDataWatch(CRealDataWatch *pWatch);
|
||||||
|
void initSelect();
|
||||||
|
|
||||||
|
~CRealDataSelect();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void signal_addPoint(QString,uint,QString,uint,QString,QString,QString,QString,QString,QString,QString,int,QString);
|
||||||
|
void signal_batchAddPoint(QVector<SAddPointInfoPtr> &listPntInfo);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
//void slot_selectDevice(int);
|
||||||
|
//void slot_selectDevGroup(int);
|
||||||
|
//void slot_showPoint(QListWidgetItem*);
|
||||||
|
void solt_showPoint(QTreeWidgetItem*,int);
|
||||||
|
void slot_addPoint(int,int);
|
||||||
|
void slot_queryDev();
|
||||||
|
void slot_queryDev(QString);
|
||||||
|
void slot_addAllCurrentPoint(QListWidgetItem* pItem);
|
||||||
|
//void slot_selectTreeDevGroup(int);
|
||||||
|
void slot_addAllCurrentPoint(QTreeWidgetItem*,int);
|
||||||
|
void slot_selectTreeDevGroup(int);
|
||||||
|
void slot_paging();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void initPntTableInfo();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::CRealDataSelect *ui;
|
||||||
|
iot_dbms::CDbApi *m_pObjDbInterface;
|
||||||
|
CSystemResources *m_pSystemResources;
|
||||||
|
// bool m_isFristQuery;
|
||||||
|
CRealDataWatch *m_pRealDataWatch;
|
||||||
|
|
||||||
|
QStringList m_listTableName;
|
||||||
|
QStringList m_listPointType;
|
||||||
|
QStringList m_listPntIsCtrlCol; //< 用来存储每个表is_control的SQL的,因为acc表没有此字段,为了兼容加入此逻辑
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void initView();
|
||||||
|
void initVariable();
|
||||||
|
void initLocationComBox();
|
||||||
|
void initSubSystemComBox();
|
||||||
|
void initDevGroupComBox();
|
||||||
|
void initDeviceListWidget();
|
||||||
|
void initPointTableWidget();
|
||||||
|
|
||||||
|
bool allSelect(QString tag_name);
|
||||||
|
bool preciseSelect();
|
||||||
|
void initSignalsSlots();
|
||||||
|
int m_nAddModel; //添加模式
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CREALDATASELECT_H
|
||||||
200
product/src/tools/debug_tool_v2/CRealDataSelect.ui
Normal file
200
product/src/tools/debug_tool_v2/CRealDataSelect.ui
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CRealDataSelect</class>
|
||||||
|
<widget class="QWidget" name="CRealDataSelect">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>414</width>
|
||||||
|
<height>707</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="location">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>45</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>45</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>位置</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_location">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="sub">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>45</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>45</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>专业</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_subSystem">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="4,1">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>查询</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_10" stretch="9">
|
||||||
|
<item>
|
||||||
|
<widget class="QTreeWidget" name="treeWidget_devGroup">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>设备组</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||||
|
<item>
|
||||||
|
<widget class="QTableWidget" name="tableWidget_MesurePoint">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
722
product/src/tools/debug_tool_v2/CRealDataWatch.cpp
Normal file
722
product/src/tools/debug_tool_v2/CRealDataWatch.cpp
Normal file
@ -0,0 +1,722 @@
|
|||||||
|
#include "CRealDataWatch.h"
|
||||||
|
#include "ui_CRealDataWatch.h"
|
||||||
|
#include <QDebug>
|
||||||
|
#include "perm_mng_api/PermMngApi.h"
|
||||||
|
#include <QContextMenuEvent>
|
||||||
|
#include <QAction>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QHeaderView>
|
||||||
|
#include <QRegExp>
|
||||||
|
#include "toolCommon.h"
|
||||||
|
#include "CStatusDialog.h"
|
||||||
|
|
||||||
|
CRealDataWatch::CRealDataWatch(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::CRealDataWatch)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
m_searchDialog = NULL;
|
||||||
|
m_bIsLgoin = false;
|
||||||
|
m_pSearchButton = new QPushButton(this);
|
||||||
|
m_pSearchButton->setObjectName("searchButton");
|
||||||
|
m_pSearchButton->setText("");
|
||||||
|
m_pSearchButton->setMaximumSize(28, 29);
|
||||||
|
m_pSearchButton->setCursor(QCursor(Qt::ArrowCursor));
|
||||||
|
m_pSearchButton->setShortcut(Qt::Key_Return);
|
||||||
|
QHBoxLayout * pSearchLayout = new QHBoxLayout();
|
||||||
|
pSearchLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
pSearchLayout->addStretch();
|
||||||
|
pSearchLayout->addWidget(m_pSearchButton);
|
||||||
|
ui->lineEdit->setLayout(pSearchLayout);
|
||||||
|
ui->checkBox_append->setChecked(false);
|
||||||
|
|
||||||
|
ui->checkBox_paging->setChecked(false); //todo:分页实现不完善,临时实现
|
||||||
|
ui->lineEdit_pageNum->setAlignment(Qt::AlignHCenter);
|
||||||
|
m_nCurPageNum = 0;
|
||||||
|
m_nPageSize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CRealDataWatch::~CRealDataWatch()
|
||||||
|
{
|
||||||
|
m_pDpcdaForApp->unsubscribeAll();
|
||||||
|
|
||||||
|
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::setSystemResources(CSystemResources *pSystemResources)
|
||||||
|
{
|
||||||
|
m_pSystemResources = pSystemResources;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::deletePoint(int row)
|
||||||
|
{
|
||||||
|
QString tableName = ui->tableWidget_point->item(row,3)->data(Qt::UserRole+1).toString();
|
||||||
|
QString tagName = ui->tableWidget_point->item(row,4)->data(Qt::UserRole+1).toString();
|
||||||
|
m_pDpcdaForApp->unsubscribe(tableName.toStdString(),
|
||||||
|
tagName.toStdString(),
|
||||||
|
QString("value").toStdString());
|
||||||
|
m_pDpcdaForApp->unsubscribe(tableName.toStdString(),
|
||||||
|
tagName.toStdString(),
|
||||||
|
QString("status").toStdString());
|
||||||
|
ui->tableWidget_point->removeRow(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::contextMenuEvent(QContextMenuEvent *event)
|
||||||
|
{
|
||||||
|
QWidget::contextMenuEvent(event);
|
||||||
|
|
||||||
|
if(event->pos().x() < ui->tableWidget_point->pos().x())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QRect headerRect = ui->tableWidget_point->horizontalHeader()->rect();
|
||||||
|
headerRect.moveTopLeft(ui->tableWidget_point->mapTo(this, QPoint()));
|
||||||
|
if(!headerRect.contains(event->pos()))
|
||||||
|
{
|
||||||
|
QMenu menu(this);
|
||||||
|
|
||||||
|
QAction *allSelectAction = menu.addAction(tr("全选"));
|
||||||
|
connect(allSelectAction,&QAction::triggered,[=](){ui->tableWidget_point->selectAll();});
|
||||||
|
QAction *deleteSelectAction = menu.addAction(tr("删除"));
|
||||||
|
connect(deleteSelectAction,&QAction::triggered,[=](){
|
||||||
|
slot_deleteMaxPoint();
|
||||||
|
});
|
||||||
|
QAction *cancleSelectAction = menu.addAction(tr("取消选择"));
|
||||||
|
connect(cancleSelectAction,&QAction::triggered,[=](){
|
||||||
|
ui->tableWidget_point->clearSelection();
|
||||||
|
});
|
||||||
|
menu.exec(QCursor::pos());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::keyPressEvent(QKeyEvent *event)
|
||||||
|
{
|
||||||
|
if(event->key() == Qt::Key_Enter)
|
||||||
|
{
|
||||||
|
filter();
|
||||||
|
}
|
||||||
|
else if(event->key() == Qt::Key_Delete)
|
||||||
|
{
|
||||||
|
slot_deleteMaxPoint();
|
||||||
|
}
|
||||||
|
QWidget::keyPressEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRealDataWatch::eventFilter(QObject *watched, QEvent *event)
|
||||||
|
{
|
||||||
|
if(event->type() == QEvent::KeyPress)
|
||||||
|
{
|
||||||
|
QKeyEvent * theKey = static_cast<QKeyEvent*>(event);
|
||||||
|
if(theKey->key() == Qt::Key_Enter || theKey->key() == Qt::Key_Return)
|
||||||
|
{
|
||||||
|
filter();
|
||||||
|
return true;
|
||||||
|
}else if(theKey->key() == Qt::Key_Delete)
|
||||||
|
{
|
||||||
|
slot_deleteMaxPoint();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QObject::eventFilter(watched,event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::initWatch()
|
||||||
|
{
|
||||||
|
initVariable();
|
||||||
|
initView();
|
||||||
|
initSignalSlot();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::initVariable()
|
||||||
|
{
|
||||||
|
m_pObjDbInterface = m_pSystemResources->getDbInterface();
|
||||||
|
m_pDpcdaForApp = new iot_service::CDpcdaForApp;
|
||||||
|
m_searchDialog = new CStatusDialog(m_pSystemResources,this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::initView()
|
||||||
|
{
|
||||||
|
initCheckBox();
|
||||||
|
initTableWidgetPoint();
|
||||||
|
ui->lineEdit->setPlaceholderText(tr("请输入描述信息"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::initCheckBox()
|
||||||
|
{
|
||||||
|
ui->checkBox_all->setChecked(true);
|
||||||
|
ui->checkBox_analog->setChecked(true);
|
||||||
|
ui->checkBox_digital->setChecked(true);
|
||||||
|
ui->checkBox_accuml->setChecked(true);
|
||||||
|
ui->checkBox_mix->setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::initTableWidgetPoint()
|
||||||
|
{
|
||||||
|
ui->tableWidget_point->setColumnCount(12);
|
||||||
|
ui->tableWidget_point->setColumnWidth(0,200);
|
||||||
|
ui->tableWidget_point->setColumnWidth(1,40);
|
||||||
|
ui->tableWidget_point->setColumnWidth(2,40);
|
||||||
|
ui->tableWidget_point->setColumnWidth(3,50);
|
||||||
|
ui->tableWidget_point->setColumnWidth(4,60);
|
||||||
|
ui->tableWidget_point->setColumnWidth(5,20);
|
||||||
|
ui->tableWidget_point->setColumnWidth(6,20);
|
||||||
|
ui->tableWidget_point->setColumnWidth(7,210);
|
||||||
|
ui->tableWidget_point->setColumnWidth(8,120);
|
||||||
|
ui->tableWidget_point->setColumnWidth(9,180);
|
||||||
|
ui->tableWidget_point->setColumnWidth(10,40);
|
||||||
|
|
||||||
|
QStringList header;
|
||||||
|
header.append(tr("标签")); //0 //0
|
||||||
|
header.append(tr("值"));//6 //1
|
||||||
|
header.append(tr("状态"));//7 //2
|
||||||
|
header.append(tr("类型")); //0 //3
|
||||||
|
header.append(tr("测点")); //1 //4
|
||||||
|
header.append(tr("位置")); //2
|
||||||
|
header.append(tr("专业")); //3 //6
|
||||||
|
header.append(tr("设备组"));//4
|
||||||
|
header.append(tr("设备"));//5 //8
|
||||||
|
header.append(tr("RTU"));//8
|
||||||
|
header.append(tr("SEQ_NO"));//9 //10
|
||||||
|
header.append(tr("是否可控"));//10 /11
|
||||||
|
|
||||||
|
ui->tableWidget_point->hideColumn(5);
|
||||||
|
ui->tableWidget_point->hideColumn(6);
|
||||||
|
|
||||||
|
ui->tableWidget_point->setHorizontalHeaderLabels(header);
|
||||||
|
ui->tableWidget_point->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
|
ui->tableWidget_point->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
|
ui->tableWidget_point->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||||
|
ui->tableWidget_point->horizontalHeader()->setStretchLastSection(true);
|
||||||
|
ui->tableWidget_point->setAlternatingRowColors(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::initSignalSlot()
|
||||||
|
{
|
||||||
|
connect(ui->checkBox_all,SIGNAL(clicked(bool)),
|
||||||
|
this,SLOT(slot_checkBox(bool)));
|
||||||
|
connect(ui->checkBox_accuml,SIGNAL(clicked(bool)),
|
||||||
|
this,SLOT(slot_checkBox(bool)));
|
||||||
|
connect(ui->checkBox_analog,SIGNAL(clicked(bool)),
|
||||||
|
this,SLOT(slot_checkBox(bool)));
|
||||||
|
connect(ui->checkBox_digital,SIGNAL(clicked(bool)),
|
||||||
|
this,SLOT(slot_checkBox(bool)));
|
||||||
|
connect(ui->checkBox_mix,SIGNAL(clicked(bool)),
|
||||||
|
this,SLOT(slot_checkBox(bool)));
|
||||||
|
connect(m_pSearchButton,SIGNAL(clicked()),
|
||||||
|
this,SLOT(slot_pointFilter()));
|
||||||
|
connect(ui->tableWidget_point,SIGNAL(cellDoubleClicked(int,int)),
|
||||||
|
this,SLOT(slot_ctrlRealData(int,int)));
|
||||||
|
connect(ui->tableWidget_point,SIGNAL(itemClicked(QTableWidgetItem *)),
|
||||||
|
this,SLOT(slot_pointsitemClicked(QTableWidgetItem *)));
|
||||||
|
// connect(ui->tableWidget_point,SIGNAL(currentItemChanged(QTableWidgetItem*,QTableWidgetItem*)),
|
||||||
|
// this,SLOT(slot_textChanged(QTableWidgetItem*,QTableWidgetItem*)));
|
||||||
|
connect(m_searchDialog,SIGNAL(signal_selectTextEdit(QString ,QString , int )),
|
||||||
|
this,SLOT(slot_selectTextEdit(QString ,QString , int )));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::slot_checkBox(bool)
|
||||||
|
{
|
||||||
|
QObject * pObjCheckBox = sender();
|
||||||
|
QString checkBoxName = pObjCheckBox->objectName();
|
||||||
|
QStringList nameList = checkBoxName.split('_');
|
||||||
|
if(QString("all") == nameList[1])
|
||||||
|
{
|
||||||
|
if(ui->checkBox_all->isChecked())
|
||||||
|
{
|
||||||
|
ui->checkBox_analog->setChecked(true);
|
||||||
|
ui->checkBox_digital->setChecked(true);
|
||||||
|
ui->checkBox_accuml->setChecked(true);
|
||||||
|
ui->checkBox_mix->setChecked(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->checkBox_analog->setChecked(false);
|
||||||
|
ui->checkBox_digital->setChecked(false);
|
||||||
|
ui->checkBox_accuml->setChecked(false);
|
||||||
|
ui->checkBox_mix->setChecked(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(ui->checkBox_accuml->isChecked()&&
|
||||||
|
ui->checkBox_analog->isChecked()&&
|
||||||
|
ui->checkBox_digital->isChecked()&&
|
||||||
|
ui->checkBox_mix->isChecked())
|
||||||
|
{
|
||||||
|
ui->checkBox_all->setChecked(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->checkBox_all->setChecked(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filter();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::addPointToTable(const SAddPointInfo &stPntInfo)
|
||||||
|
{
|
||||||
|
if((stPntInfo.nAddModel == 1 || stPntInfo.nAddModel == -1) && !ui->checkBox_append->isChecked())
|
||||||
|
{
|
||||||
|
m_mapPnt2Row.clear(); //< 清理掉测点与行号的缓存,在slot_deleteMaxPoint前删除,提高效率
|
||||||
|
ui->tableWidget_point->setSelectionMode(QAbstractItemView::MultiSelection);
|
||||||
|
ui->tableWidget_point->selectAll();
|
||||||
|
slot_deleteMaxPoint();
|
||||||
|
ui->tableWidget_point->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stPntInfo.strTableName == QString("CONST"))
|
||||||
|
{
|
||||||
|
N_MessageBox::about(this,tr("提示"),tr("const类型测点未配置"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString strFullTagName = stPntInfo.strTableName + "." + stPntInfo.strPntTagName;
|
||||||
|
if(m_mapPnt2Row.find(strFullTagName) != m_mapPnt2Row.end())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pDpcdaForApp->subscribe(stPntInfo.strTableName.toLower().toStdString(),
|
||||||
|
stPntInfo.strPntTagName.toStdString(),
|
||||||
|
QString("value").toStdString());
|
||||||
|
m_pDpcdaForApp->subscribe(stPntInfo.strTableName.toLower().toStdString(),
|
||||||
|
stPntInfo.strPntTagName.toStdString(),
|
||||||
|
QString("status").toStdString());
|
||||||
|
|
||||||
|
uint rowCount = ui->tableWidget_point->rowCount();
|
||||||
|
ui->tableWidget_point->setRowCount(rowCount+1);
|
||||||
|
QTableWidgetItem * item = NULL;
|
||||||
|
m_mapPnt2Row[strFullTagName] = rowCount;
|
||||||
|
|
||||||
|
item = new QTableWidgetItem; //< 值,占位
|
||||||
|
item->setTextAlignment(Qt::AlignCenter);
|
||||||
|
ui->tableWidget_point->setItem(rowCount,1,item);
|
||||||
|
|
||||||
|
item = new QTableWidgetItem; //< 状态,占位
|
||||||
|
item->setTextAlignment(Qt::AlignCenter);
|
||||||
|
ui->tableWidget_point->setItem(rowCount,2,item);
|
||||||
|
|
||||||
|
item = new QTableWidgetItem;
|
||||||
|
item->setText(stPntInfo.strPntType);
|
||||||
|
item->setData(Qt::UserRole+1,stPntInfo.strTableName);
|
||||||
|
ui->tableWidget_point->setItem(rowCount,3,item);
|
||||||
|
|
||||||
|
item = new QTableWidgetItem;
|
||||||
|
item->setText(stPntInfo.strPntDesc);
|
||||||
|
item->setData(Qt::UserRole+1,stPntInfo.strPntTagName);
|
||||||
|
ui->tableWidget_point->setItem(rowCount,4,item);
|
||||||
|
|
||||||
|
item = new QTableWidgetItem;
|
||||||
|
item->setText(stPntInfo.strLocationDesc);
|
||||||
|
item->setData(Qt::UserRole+1,stPntInfo.nLocationId);
|
||||||
|
ui->tableWidget_point->setItem(rowCount,5,item);
|
||||||
|
|
||||||
|
item = new QTableWidgetItem;
|
||||||
|
item->setText(stPntInfo.strSubsystemDesc);
|
||||||
|
item->setData(Qt::UserRole+1,stPntInfo.nSubsystemId);
|
||||||
|
ui->tableWidget_point->setItem(rowCount,6,item);
|
||||||
|
|
||||||
|
item = new QTableWidgetItem;
|
||||||
|
item->setText(stPntInfo.strDevDesc);
|
||||||
|
item->setData(Qt::UserRole+1,stPntInfo.strDevTagName);
|
||||||
|
ui->tableWidget_point->setItem(rowCount,8,item);
|
||||||
|
|
||||||
|
item = new QTableWidgetItem;
|
||||||
|
item->setData(Qt::UserRole+1,0);
|
||||||
|
item->setText(stPntInfo.strDevGroupDesc);
|
||||||
|
ui->tableWidget_point->setItem(rowCount,7,item);
|
||||||
|
|
||||||
|
item = new QTableWidgetItem;
|
||||||
|
item->setData(Qt::UserRole+1,0);
|
||||||
|
item->setText(stPntInfo.strPntTagName);
|
||||||
|
ui->tableWidget_point->setItem(rowCount,0,item);
|
||||||
|
|
||||||
|
item = new QTableWidgetItem;
|
||||||
|
item->setText(stPntInfo.strRtuTag);
|
||||||
|
ui->tableWidget_point->setItem(rowCount,9,item);
|
||||||
|
|
||||||
|
item = new QTableWidgetItem;
|
||||||
|
item->setText(QString::number(stPntInfo.nSeqNo,10));
|
||||||
|
ui->tableWidget_point->setItem(rowCount,10,item);
|
||||||
|
|
||||||
|
item = new QTableWidgetItem;
|
||||||
|
item->setData(Qt::UserRole+1,stPntInfo.nIsControl);
|
||||||
|
QString strIsCtrlDesc = (stPntInfo.nIsControl == 0) ? tr("否") : tr("是");
|
||||||
|
item->setText(strIsCtrlDesc);
|
||||||
|
ui->tableWidget_point->setItem(rowCount,11,item);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::slot_batchAddPoint(QVector<SAddPointInfoPtr> &vecPntInfo)
|
||||||
|
{
|
||||||
|
for(int nRow = 0;nRow < vecPntInfo.size();nRow++)
|
||||||
|
{
|
||||||
|
addPointToTable(*vecPntInfo[nRow]);
|
||||||
|
}
|
||||||
|
|
||||||
|
filter(); //< 统一执行一遍过滤
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::updateValueAndStatus(const int &nRow, const QString &strValue, const uint &nStatus)
|
||||||
|
{
|
||||||
|
QTableWidgetItem * itemValue = ui->tableWidget_point->item(nRow,1);
|
||||||
|
if(itemValue != NULL)
|
||||||
|
{
|
||||||
|
itemValue->setText(strValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
QTableWidgetItem *itemStatus = ui->tableWidget_point->item(nRow,2);
|
||||||
|
if(itemStatus != NULL)
|
||||||
|
{
|
||||||
|
itemStatus->setText(getPointStatus(nStatus));
|
||||||
|
itemStatus->setData(Qt::UserRole+1,nStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::slot_updatePntRealData(iot_idl::SRealTimeDataPkg stRealData)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < stRealData.stairtd_size();++i)
|
||||||
|
{
|
||||||
|
const ::iot_idl::SAiRealTimeData &aiStru = stRealData.stairtd(i);
|
||||||
|
auto pIter = m_mapPnt2Row.find("ANALOG." + QString::fromStdString(aiStru.strtagname()));
|
||||||
|
if(pIter == m_mapPnt2Row.end())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateValueAndStatus(pIter.value(),dfToString(aiStru.fvalue()),aiStru.ustatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < stRealData.stdirtd_size();++i)
|
||||||
|
{
|
||||||
|
const ::iot_idl::SDiRealTimeData &diStu = stRealData.stdirtd(i);
|
||||||
|
auto pIter = m_mapPnt2Row.find("DIGITAL." + QString::fromStdString(diStu.strtagname()));
|
||||||
|
if(pIter == m_mapPnt2Row.end())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateValueAndStatus(pIter.value(),QString::number(diStu.nvalue(),10),diStu.ustatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < stRealData.stpirtd_size();++i)
|
||||||
|
{
|
||||||
|
const ::iot_idl::SPiRealTimeData &piStu = stRealData.stpirtd(i);
|
||||||
|
auto pIter = m_mapPnt2Row.find("ACCUML." + QString::fromStdString(piStu.strtagname()));
|
||||||
|
if(pIter == m_mapPnt2Row.end())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateValueAndStatus(pIter.value(),dfToString(piStu.dvalue()),piStu.ustatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < stRealData.stmirtd_size();++i)
|
||||||
|
{
|
||||||
|
const ::iot_idl::SMiRealTimeData &miStu = stRealData.stmirtd(i);
|
||||||
|
auto pIter = m_mapPnt2Row.find("MIX." + QString::fromStdString(miStu.strtagname()));
|
||||||
|
if(pIter == m_mapPnt2Row.end())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateValueAndStatus(pIter.value(),QString::number(miStu.nvalue(),10),miStu.ustatus());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::filter()
|
||||||
|
{
|
||||||
|
QString tableNameList;
|
||||||
|
if(ui->checkBox_analog->isChecked())
|
||||||
|
{
|
||||||
|
tableNameList.append("ANALOG");
|
||||||
|
}
|
||||||
|
if(ui->checkBox_digital->isChecked())
|
||||||
|
{
|
||||||
|
tableNameList.append("DIGITAL");
|
||||||
|
}
|
||||||
|
if(ui->checkBox_accuml->isChecked())
|
||||||
|
{
|
||||||
|
tableNameList.append("ACCUML");
|
||||||
|
}
|
||||||
|
if(ui->checkBox_mix->isChecked())
|
||||||
|
{
|
||||||
|
tableNameList.append("MIX");
|
||||||
|
}
|
||||||
|
|
||||||
|
int rowCount = ui->tableWidget_point->rowCount();
|
||||||
|
|
||||||
|
for(int i = 0 ; i < rowCount ; ++i)
|
||||||
|
{
|
||||||
|
if(!ui->checkBox_all->isChecked()&& //如果全选框勾上了,就不用作类型过滤
|
||||||
|
!tableNameList.contains(ui->tableWidget_point->item(i,3)->data(Qt::UserRole+1).toString()))
|
||||||
|
{
|
||||||
|
ui->tableWidget_point->hideRow(i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(!filterByKeyWord(i))
|
||||||
|
{
|
||||||
|
ui->tableWidget_point->hideRow(i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->tableWidget_point->showRow(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::slot_pointFilter()
|
||||||
|
{
|
||||||
|
emit signal_paging();
|
||||||
|
|
||||||
|
filter();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRealDataWatch::isBelongThisLocation(int &locationId, int &row)
|
||||||
|
{
|
||||||
|
if(row < 0 || row >= ui->tableWidget_point->rowCount())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(ui->tableWidget_point->item(row,5)->data(Qt::UserRole+1).toInt() == locationId)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRealDataWatch::isBelongThisSubSystem(int &subSystemId, int &row)
|
||||||
|
{
|
||||||
|
if(row < 0 || row >= ui->tableWidget_point->rowCount())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(ui->tableWidget_point->item(row,6)->data(Qt::UserRole+1).toInt() == subSystemId)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRealDataWatch::devNameIsContainKeyWord(QString &kv, int &row)
|
||||||
|
{
|
||||||
|
if(row < 0 || row >= ui->tableWidget_point->rowCount())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(ui->tableWidget_point->item(row,8)->text().contains(kv))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRealDataWatch::pointNameIsContainKeyWord(QString &kv, int row)
|
||||||
|
{
|
||||||
|
if(row < 0 || row >= ui->tableWidget_point->rowCount())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(ui->tableWidget_point->item(row,4)->text().contains(kv))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//某一行,通过位置、或者专业、或者设备关键、或者测点关键字过滤某一行
|
||||||
|
bool CRealDataWatch::filterByKeyWord(int row)
|
||||||
|
{
|
||||||
|
QString kv = ui->lineEdit->text().trimmed();
|
||||||
|
if(0 == kv.compare(""))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ( devNameIsContainKeyWord(kv,row) || pointNameIsContainKeyWord(kv,row));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CRealDataWatch::dfToString(float value)
|
||||||
|
{
|
||||||
|
QString text = QString::number(value,10,6);
|
||||||
|
return changeFomart(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CRealDataWatch::dfToString(double value)
|
||||||
|
{
|
||||||
|
QString text = QString::number(value,10,6);
|
||||||
|
return changeFomart(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CRealDataWatch::changeFomart(QString &text)
|
||||||
|
{
|
||||||
|
if(text.isEmpty())
|
||||||
|
{
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
QStringList list =text.split(".");
|
||||||
|
if(list.count() != 2)
|
||||||
|
{
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
QString dd = list[1];
|
||||||
|
dd.remove(QRegExp("0*$"));
|
||||||
|
|
||||||
|
if(dd.isEmpty())
|
||||||
|
{
|
||||||
|
return list[0];
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
return QString("%1.%2").arg(list[0]).arg(dd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::slot_ctrlRealData(int _row, int)
|
||||||
|
{
|
||||||
|
int row = _row;
|
||||||
|
|
||||||
|
bool isCtl = ui->tableWidget_point->item(row,11)->data(Qt::UserRole+1).toBool();
|
||||||
|
|
||||||
|
int locationId = ui->tableWidget_point->item(row,5)->data(Qt::UserRole+1).toInt();
|
||||||
|
|
||||||
|
int subSystemId = ui->tableWidget_point->item(row,6)->data(Qt::UserRole+1).toInt();
|
||||||
|
|
||||||
|
QString tagName = ui->tableWidget_point->item(row,4)->data(Qt::UserRole+1).toString();
|
||||||
|
|
||||||
|
QString pointName = ui->tableWidget_point->item(row,4)->text();
|
||||||
|
|
||||||
|
QString tableName = ui->tableWidget_point->item(row,3)->data(Qt::UserRole+1).toString();
|
||||||
|
|
||||||
|
CRealDataControl *ctrlDialog = new CRealDataControl(locationId,
|
||||||
|
subSystemId,
|
||||||
|
pointName,
|
||||||
|
tagName,
|
||||||
|
tableName,
|
||||||
|
m_pSystemResources,
|
||||||
|
isCtl,
|
||||||
|
this);
|
||||||
|
|
||||||
|
ctrlDialog->setWindowTitle(pointName + tr(" 操作"));
|
||||||
|
|
||||||
|
ctrlDialog->exec();
|
||||||
|
delete ctrlDialog;
|
||||||
|
ctrlDialog = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CRealDataWatch::slot_deleteMaxPoint()
|
||||||
|
{
|
||||||
|
if(ui->tableWidget_point->rowCount()<= 0)
|
||||||
|
return ;
|
||||||
|
QModelIndexList modelIndexList = ui->tableWidget_point->selectionModel()->selectedRows(0);
|
||||||
|
if(modelIndexList.isEmpty())
|
||||||
|
{
|
||||||
|
N_MessageBox::warning(this, tr("提示"), tr("当前未选中任何项!"), N_MessageBox::Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
std::sort(modelIndexList.begin(), modelIndexList.end());
|
||||||
|
for(int i = modelIndexList.size()-1;i>=0;i--)
|
||||||
|
{
|
||||||
|
deletePoint(modelIndexList.at(i).row());
|
||||||
|
}
|
||||||
|
|
||||||
|
//< 重新构建测点与行号的映射关系
|
||||||
|
m_mapPnt2Row.clear();
|
||||||
|
for(int nRow = 0; nRow < ui->tableWidget_point->rowCount(); nRow++)
|
||||||
|
{
|
||||||
|
QString tableName = ui->tableWidget_point->item(nRow,3)->data(Qt::UserRole+1).toString();
|
||||||
|
QString tagName = ui->tableWidget_point->item(nRow,4)->data(Qt::UserRole+1).toString();
|
||||||
|
m_mapPnt2Row[tableName + "." + tagName] = nRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::slot_pointsitemClicked(QTableWidgetItem *item)
|
||||||
|
{
|
||||||
|
if(m_searchDialog != NULL)
|
||||||
|
{
|
||||||
|
//m_searchDialog->show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_searchDialog = new CStatusDialog(m_pSystemResources,this);
|
||||||
|
//m_searchDialog->show();
|
||||||
|
}
|
||||||
|
bool isDigital = QString("DIGITAL")
|
||||||
|
== ui->tableWidget_point->item(item->row(),3)
|
||||||
|
->data(Qt::UserRole+1).toString();
|
||||||
|
if(ui->tableWidget_point->item(item->row(),2)==0){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int status =int(ui->tableWidget_point->item(item->row(),2)->data(Qt::UserRole+1).toDouble());
|
||||||
|
QString allName=ui->tableWidget_point->item(item->row(),0)->text();
|
||||||
|
int value=int(ui->tableWidget_point->item(item->row(),1) ->text().toDouble());
|
||||||
|
m_searchDialog->initData(isDigital ? 0:1,status,allName,value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::slot_selectTextEdit(QString allStatus,QString m_allName, int m_value)
|
||||||
|
{
|
||||||
|
emit signal_selectTextEdit(allStatus,m_allName,m_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CRealDataWatch::getFilterAndPageInfo(QString &keyword,int &nCurPage, int &nPageSize)
|
||||||
|
{
|
||||||
|
keyword = ui->lineEdit->text().trimmed();
|
||||||
|
nCurPage = m_nCurPageNum;
|
||||||
|
nPageSize = m_nPageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::on_checkBox_paging_stateChanged(int arg1)
|
||||||
|
{
|
||||||
|
if(arg1 == 2) //选中
|
||||||
|
{
|
||||||
|
m_nCurPageNum = 1;
|
||||||
|
m_nPageSize = 100;
|
||||||
|
ui->lineEdit_pageNum->setText(QString::number(m_nCurPageNum));
|
||||||
|
}
|
||||||
|
else if(arg1 == 0)
|
||||||
|
{
|
||||||
|
m_nCurPageNum = 0;
|
||||||
|
m_nPageSize = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::on_btn_pre_clicked()
|
||||||
|
{
|
||||||
|
m_nCurPageNum = m_nCurPageNum > 1 ? (m_nCurPageNum-1) : 1;
|
||||||
|
ui->lineEdit_pageNum->setText(QString::number(m_nCurPageNum));
|
||||||
|
|
||||||
|
emit signal_paging();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::on_btn_next_clicked()
|
||||||
|
{
|
||||||
|
++m_nCurPageNum;
|
||||||
|
ui->lineEdit_pageNum->setText(QString::number(m_nCurPageNum));
|
||||||
|
|
||||||
|
emit signal_paging();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDataWatch::on_btn_status_search_clicked()
|
||||||
|
{
|
||||||
|
if(m_searchDialog != NULL)
|
||||||
|
m_searchDialog->show();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_searchDialog = new CStatusDialog(m_pSystemResources,this);
|
||||||
|
m_searchDialog->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
123
product/src/tools/debug_tool_v2/CRealDataWatch.h
Normal file
123
product/src/tools/debug_tool_v2/CRealDataWatch.h
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
#ifndef CREALDATAWATCH_H
|
||||||
|
#define CREALDATAWATCH_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include "pub_widget/MessageBox.h"
|
||||||
|
#include <QTableWidgetItem>
|
||||||
|
#include "CRealDataControl.h"
|
||||||
|
#include <QPushButton>
|
||||||
|
#include "CSystemResources.h"
|
||||||
|
#include "db_api_ex/CDbApi.h"
|
||||||
|
#include "dp_chg_data_api/CDpcdaForApp.h"
|
||||||
|
#include "pub_logger_api/logger.h"
|
||||||
|
#include "net_msg_bus_api/MsgBusApi.h"
|
||||||
|
#include "perm_mng_api/PermMngApi.h"
|
||||||
|
#include "DataProcMessage.pb.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CRealDataWatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SAddPointInfo
|
||||||
|
{
|
||||||
|
int nLocationId; //< 位置ID
|
||||||
|
int nSubsystemId; //< 子系统ID
|
||||||
|
int nAddModel; //< 正常应该是添加模式,实际作用待确认
|
||||||
|
QString strLocationDesc; //< 位置描述
|
||||||
|
QString strSubsystemDesc; //< 子系统描述
|
||||||
|
QString strPntType; //< 测点类型
|
||||||
|
QString strTableName; //< 表名
|
||||||
|
QString strPntDesc; //< 测点描述
|
||||||
|
QString strPntTagName; //< 测点tag
|
||||||
|
QString strDevDesc; //< 设备描述
|
||||||
|
QString strDevTagName; //< 设备tag
|
||||||
|
QString strDevGroupDesc; //< 设备组描述
|
||||||
|
QString strRtuTag; //< RTU TAG
|
||||||
|
int nSeqNo; //< 测点表中的seq_no
|
||||||
|
int nIsControl; //< 测点表中的is_control
|
||||||
|
};
|
||||||
|
typedef QSharedPointer<SAddPointInfo> SAddPointInfoPtr;
|
||||||
|
|
||||||
|
|
||||||
|
class CStatusDialog;
|
||||||
|
class CRealDataWatch : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void slot_batchAddPoint(QVector<SAddPointInfoPtr> &vecPntInfo);
|
||||||
|
void slot_updatePntRealData(iot_idl::SRealTimeDataPkg stRealData);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void slot_checkBox(bool);
|
||||||
|
void slot_pointFilter();
|
||||||
|
void slot_ctrlRealData(int _row,int _col);
|
||||||
|
// void slot_textChanged(QTableWidgetItem*,QTableWidgetItem*);
|
||||||
|
void slot_deleteMaxPoint();
|
||||||
|
void slot_pointsitemClicked(QTableWidgetItem *item);
|
||||||
|
void slot_selectTextEdit(QString allStatus,QString m_allName, int m_value);
|
||||||
|
|
||||||
|
void on_checkBox_paging_stateChanged(int arg1);
|
||||||
|
|
||||||
|
void on_btn_pre_clicked();
|
||||||
|
|
||||||
|
void on_btn_next_clicked();
|
||||||
|
|
||||||
|
void on_btn_status_search_clicked();
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CRealDataWatch(QWidget *parent = 0);
|
||||||
|
~CRealDataWatch();
|
||||||
|
void initWatch();
|
||||||
|
void setSystemResources(CSystemResources *);
|
||||||
|
void deletePoint(int row);
|
||||||
|
void getFilterAndPageInfo(QString &keyword,int &nCurPage,int &nPageSize);
|
||||||
|
signals:
|
||||||
|
void signal_selectTextEdit(QString allStatus,QString m_allName, int m_value);
|
||||||
|
void signal_paging();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void contextMenuEvent(QContextMenuEvent *event);
|
||||||
|
void keyPressEvent(QKeyEvent *event);
|
||||||
|
bool eventFilter(QObject *watched, QEvent *event);
|
||||||
|
private:
|
||||||
|
Ui::CRealDataWatch *ui;
|
||||||
|
iot_dbms::CDbApi *m_pObjDbInterface;
|
||||||
|
CSystemResources *m_pSystemResources;
|
||||||
|
iot_service::CDpcdaForApp *m_pDpcdaForApp;
|
||||||
|
|
||||||
|
bool m_bIsLgoin;
|
||||||
|
QPushButton *m_pSearchButton;
|
||||||
|
|
||||||
|
CStatusDialog* m_searchDialog;
|
||||||
|
int m_nCurPageNum;//2个值同时为0时不启用分页
|
||||||
|
int m_nPageSize;
|
||||||
|
|
||||||
|
QHash<QString,int> m_mapPnt2Row; //< 表名.测点tag -> 表中行号
|
||||||
|
|
||||||
|
private:
|
||||||
|
void initVariable();
|
||||||
|
void initView();
|
||||||
|
void initCheckBox();
|
||||||
|
void initTableWidgetPoint();
|
||||||
|
void initSignalSlot();
|
||||||
|
void filter();
|
||||||
|
|
||||||
|
bool isBelongThisLocation(int &locationId,int &row);
|
||||||
|
bool isBelongThisSubSystem(int &subSystemId,int &row);
|
||||||
|
bool devNameIsContainKeyWord(QString &kv,int &row);
|
||||||
|
bool pointNameIsContainKeyWord(QString &kv,int row);
|
||||||
|
bool filterByKeyWord(int row);
|
||||||
|
|
||||||
|
QString dfToString(float value);
|
||||||
|
|
||||||
|
QString dfToString(double value);
|
||||||
|
|
||||||
|
QString changeFomart(QString &text);
|
||||||
|
|
||||||
|
void addPointToTable(const SAddPointInfo &stPntInfo);
|
||||||
|
void updateValueAndStatus(const int &nRow,const QString &strValue,const uint &nStatus);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CREALDATAWATCH_H
|
||||||
237
product/src/tools/debug_tool_v2/CRealDataWatch.ui
Normal file
237
product/src/tools/debug_tool_v2/CRealDataWatch.ui
Normal file
@ -0,0 +1,237 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CRealDataWatch</class>
|
||||||
|
<widget class="QWidget" name="CRealDataWatch">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>858</width>
|
||||||
|
<height>452</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalSpacing">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="verticalSpacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>测点描述:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>300</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_10">
|
||||||
|
<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="btn_status_search">
|
||||||
|
<property name="text">
|
||||||
|
<string>状态查询</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_all">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>80</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>全选</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_analog">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>80</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>模拟量</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_digital">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>80</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>数字量</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_accuml">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>80</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>累积量</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_mix">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>80</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>混合量</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<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="QCheckBox" name="checkBox_paging">
|
||||||
|
<property name="text">
|
||||||
|
<string>启用分页</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btn_pre">
|
||||||
|
<property name="text">
|
||||||
|
<string>上一页</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_pageNum">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>30</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btn_next">
|
||||||
|
<property name="text">
|
||||||
|
<string>下一页</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_6">
|
||||||
|
<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="QCheckBox" name="checkBox_append">
|
||||||
|
<property name="text">
|
||||||
|
<string>累加式</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTableWidget" name="tableWidget_point"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
63
product/src/tools/debug_tool_v2/CRealDatabaseItemInfo.cpp
Normal file
63
product/src/tools/debug_tool_v2/CRealDatabaseItemInfo.cpp
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#include "CRealDatabaseItemInfo.h"
|
||||||
|
#include <QDebug>
|
||||||
|
CRealDatabaseItemInfo::CRealDatabaseItemInfo()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDatabaseItemInfo::initialize(const iot_idl::RdbRecord &msgRecord)
|
||||||
|
{
|
||||||
|
init(msgRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDatabaseItemInfo::init(const iot_idl::RdbRecord &msgRecord)
|
||||||
|
{
|
||||||
|
m_data.clear();
|
||||||
|
for(int index(0);index<msgRecord.msgvaluearray_size();index++)
|
||||||
|
{
|
||||||
|
switch(msgRecord.msgvaluearray(index).edatatype())
|
||||||
|
{
|
||||||
|
case iot_idl::DataType::CN_DATATYPE_BOOL:
|
||||||
|
m_data.append(QString::number(msgRecord.msgvaluearray(index).bvalue()));
|
||||||
|
break;
|
||||||
|
case iot_idl::DataType::CN_DATATYPE_FLOAT:
|
||||||
|
m_data.append(QString::number(msgRecord.msgvaluearray(index).fvalue()));
|
||||||
|
break;
|
||||||
|
case iot_idl::DataType::CN_DATATYPE_INT32:
|
||||||
|
m_data.append(QString::number(msgRecord.msgvaluearray(index).nvalue()));
|
||||||
|
break;
|
||||||
|
case iot_idl::DataType::CN_DATATYPE_STRING:
|
||||||
|
{
|
||||||
|
m_data.append(QString::fromStdString(msgRecord.msgvaluearray(index).strvalue()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case iot_idl::DataType::CN_DATATYPE_UINT32:
|
||||||
|
m_data.append(QString::number(msgRecord.msgvaluearray(index).uvalue()));
|
||||||
|
break;
|
||||||
|
case iot_idl::DataType::CN_DATATYPE_INT64:
|
||||||
|
m_data.append(QString::number(msgRecord.msgvaluearray(index).lvalue()));
|
||||||
|
break;
|
||||||
|
case iot_idl::DataType::CN_DATATYPE_UINT64:
|
||||||
|
m_data.append(QString::number(msgRecord.msgvaluearray(index).ulvalue()));
|
||||||
|
break;
|
||||||
|
case iot_idl::DataType::CN_DATATYPE_DOUBLE:
|
||||||
|
m_data.append(QString::number(msgRecord.msgvaluearray(index).dvalue()));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CRealDatabaseItemInfo::getDataByColumn(int column)
|
||||||
|
{
|
||||||
|
if(m_data.size()>column)
|
||||||
|
{
|
||||||
|
return m_data.at(column);
|
||||||
|
}
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDatabaseItemInfo::setData(int index, QString stValue)
|
||||||
|
{
|
||||||
|
m_data[index] = stValue;
|
||||||
|
}
|
||||||
24
product/src/tools/debug_tool_v2/CRealDatabaseItemInfo.h
Normal file
24
product/src/tools/debug_tool_v2/CRealDatabaseItemInfo.h
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#ifndef CREALDATABASEITEMINFO_H
|
||||||
|
#define CREALDATABASEITEMINFO_H
|
||||||
|
#include <QMetaType>
|
||||||
|
#include <QStringList>
|
||||||
|
#include <QSharedPointer>
|
||||||
|
#include "rdb_net_api/CRdbNetApi.h"
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
|
class CRealDatabaseItemInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CRealDatabaseItemInfo();
|
||||||
|
void initialize(const iot_idl::RdbRecord &msgRecord);
|
||||||
|
void init(const iot_idl::RdbRecord &msgRecord);
|
||||||
|
|
||||||
|
QString getDataByColumn(int column);
|
||||||
|
void setData(int index,QString stValue);
|
||||||
|
public:
|
||||||
|
//公共
|
||||||
|
QVector<QString> m_data;
|
||||||
|
};
|
||||||
|
typedef QSharedPointer<CRealDatabaseItemInfo> RealDatabasePtr;
|
||||||
|
|
||||||
|
#endif // CREALDATABASEITEMINFO_H
|
||||||
82
product/src/tools/debug_tool_v2/CRealDatabaseItemModel.cpp
Normal file
82
product/src/tools/debug_tool_v2/CRealDatabaseItemModel.cpp
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
#include "CRealDatabaseItemModel.h"
|
||||||
|
|
||||||
|
CRealDatabaseItemModel::CRealDatabaseItemModel(const QStringList &tableHeader, QObject *parent)
|
||||||
|
: QAbstractTableModel(parent),
|
||||||
|
m_header(tableHeader)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant CRealDatabaseItemModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
|
{
|
||||||
|
if(Qt::DisplayRole == role && Qt::Horizontal == orientation)
|
||||||
|
{
|
||||||
|
return QVariant(m_header.at(section));
|
||||||
|
}
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
int CRealDatabaseItemModel::rowCount(const QModelIndex &parent) const
|
||||||
|
{
|
||||||
|
if (parent.isValid())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return m_data.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
int CRealDatabaseItemModel::columnCount(const QModelIndex &parent) const
|
||||||
|
{
|
||||||
|
if (parent.isValid())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return m_header.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant CRealDatabaseItemModel::data(const QModelIndex &index, int role) const
|
||||||
|
{
|
||||||
|
if (!index.isValid() || index.row() >= m_data.count())
|
||||||
|
return QVariant();
|
||||||
|
|
||||||
|
int column1 = index.column();
|
||||||
|
int row1 = index.row();
|
||||||
|
|
||||||
|
if(Qt::TextAlignmentRole == role)
|
||||||
|
{
|
||||||
|
return QVariant(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
|
}
|
||||||
|
else if(Qt::DisplayRole == role)
|
||||||
|
{
|
||||||
|
return queryData(column1,row1);
|
||||||
|
}
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant CRealDatabaseItemModel::queryData(int column, int row) const
|
||||||
|
{
|
||||||
|
RealDatabasePtr ptr =m_data.at(row);
|
||||||
|
return ptr->getDataByColumn(column);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDatabaseItemModel::clear()
|
||||||
|
{
|
||||||
|
beginResetModel();
|
||||||
|
m_data.clear();
|
||||||
|
endResetModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDatabaseItemModel::setHead(QStringList listHead)
|
||||||
|
{
|
||||||
|
m_header = listHead;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDatabaseItemModel::setTable(QString tableName)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDatabaseItemModel::slotDataRefresh(QList<RealDatabasePtr> data)
|
||||||
|
{
|
||||||
|
beginResetModel();
|
||||||
|
m_data = data;
|
||||||
|
endResetModel();
|
||||||
|
}
|
||||||
34
product/src/tools/debug_tool_v2/CRealDatabaseItemModel.h
Normal file
34
product/src/tools/debug_tool_v2/CRealDatabaseItemModel.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef CREALDATABASEITEMMODEL_H
|
||||||
|
#define CREALDATABASEITEMMODEL_H
|
||||||
|
|
||||||
|
#include <QAbstractTableModel>
|
||||||
|
#include "CRealDatabaseItemInfo.h"
|
||||||
|
class CRealDatabaseItemModel : public QAbstractTableModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CRealDatabaseItemModel(const QStringList &tableHeader, QObject *parent = nullptr);
|
||||||
|
|
||||||
|
// Header:
|
||||||
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||||
|
|
||||||
|
// Basic functionality:
|
||||||
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
|
|
||||||
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||||
|
|
||||||
|
QVariant queryData(int column,int row) const;
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
void setHead(QStringList listHead);
|
||||||
|
void setTable(QString tableName);
|
||||||
|
public slots:
|
||||||
|
void slotDataRefresh(QList<RealDatabasePtr> data);
|
||||||
|
private:
|
||||||
|
QStringList m_header;
|
||||||
|
QList<RealDatabasePtr> m_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CREALDATABASEITEMMODEL_H
|
||||||
966
product/src/tools/debug_tool_v2/CRealDatabaseSelect.cpp
Normal file
966
product/src/tools/debug_tool_v2/CRealDatabaseSelect.cpp
Normal file
@ -0,0 +1,966 @@
|
|||||||
|
#include "CRealDatabaseSelect.h"
|
||||||
|
#include "ui_CRealDatabaseSelect.h"
|
||||||
|
#include <QListWidgetItem>
|
||||||
|
#include <QDebug>
|
||||||
|
#include "db_sysinfo_api/CDbSysInfo.h"
|
||||||
|
|
||||||
|
|
||||||
|
CRealDatabaseSelect::CRealDatabaseSelect(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::CRealDatabaseSelect),
|
||||||
|
m_pSystemResources(NULL),
|
||||||
|
m_pObjDbInterface(NULL)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
ui->comboBox_location->setView(new QListView());
|
||||||
|
ui->comboBox_sub->setView(new QListView());
|
||||||
|
// ui->listWidget_column->setHidden(true);
|
||||||
|
// ui->listWidget_tableName->setHidden(true);
|
||||||
|
// ui->label_2->setHidden(true);
|
||||||
|
// ui->label_3->setHidden(true);
|
||||||
|
// ui->checkBox_allColmn->setHidden(true);
|
||||||
|
ui->listWidget_column->setHidden(true);
|
||||||
|
ui->listWidget_tableName->setHidden(true);
|
||||||
|
ui->label_2->setHidden(true);
|
||||||
|
ui->label_3->setHidden(true);
|
||||||
|
ui->checkBox_allColmn->setHidden(true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CRealDatabaseSelect::~CRealDatabaseSelect()
|
||||||
|
{
|
||||||
|
releaseRsouces();
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
//初始化整个的实时数据库现实页面
|
||||||
|
bool CRealDatabaseSelect::initRealDb(CSystemResources *_p)
|
||||||
|
{
|
||||||
|
if(!initVariable(_p))
|
||||||
|
{
|
||||||
|
qDebug() << QString(tr("实时数据库选择初始化变量失败"))<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
initLocationInfo();
|
||||||
|
initSignalAndSlot();
|
||||||
|
initView();
|
||||||
|
slot_selectTreeGevice(0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 选择应用时对用的槽函数
|
||||||
|
void CRealDatabaseSelect::slot_selectSub(int )
|
||||||
|
{
|
||||||
|
ui->comboBox_tableName->clear();
|
||||||
|
int subId = ui->comboBox_sub->currentData().toInt();
|
||||||
|
QStringList *pTableNameList = m_subIdToTableNameMap.value(subId);
|
||||||
|
QListWidgetItem *pItem;
|
||||||
|
if(NULL != pTableNameList)
|
||||||
|
{
|
||||||
|
for(int i = 0 ; i < pTableNameList->size(); ++i)
|
||||||
|
{
|
||||||
|
pItem = new QListWidgetItem();
|
||||||
|
pItem->setText(m_tableNameDescMap[pTableNameList->at(i)]);
|
||||||
|
pItem->setData(Qt::UserRole+1,subId);
|
||||||
|
ui->listWidget_tableName->addItem(pItem);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ui->comboBox_tableName->addItem("accuml",subId);
|
||||||
|
ui->comboBox_tableName->addItem("analog",subId);
|
||||||
|
ui->comboBox_tableName->addItem("digital",subId);
|
||||||
|
ui->comboBox_tableName->addItem("mix",subId);
|
||||||
|
ui->comboBox_tableName->addItem("fes_rtu_para",subId);
|
||||||
|
ui->comboBox_tableName->addItem("fes_channel_para",subId);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
//选择表时对应的槽函数
|
||||||
|
void CRealDatabaseSelect::slot_selectTable(QListWidgetItem * _item)
|
||||||
|
{
|
||||||
|
//slot_checkBoxAllStateChanged(1);
|
||||||
|
QMap<int,bool> isShowOrHideMap;
|
||||||
|
isShowOrHideMap.clear();
|
||||||
|
showColumns(_item,isShowOrHideMap);
|
||||||
|
showTable(_item,isShowOrHideMap);
|
||||||
|
QMap<int,bool>::iterator it = isShowOrHideMap.begin();
|
||||||
|
while (it != isShowOrHideMap.end()) {
|
||||||
|
int state = 0;
|
||||||
|
if(it.value())
|
||||||
|
{
|
||||||
|
state = 1;
|
||||||
|
}
|
||||||
|
emit signal_showOrHideColumn(it.key(),state);
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDatabaseSelect::slot_checkBoxAllStateChanged(int state)
|
||||||
|
{
|
||||||
|
qDebug() << "state:"<<state<<endl;
|
||||||
|
QListWidgetItem *item;
|
||||||
|
QCheckBox *box;
|
||||||
|
bool flag = false;
|
||||||
|
if(0 == state)
|
||||||
|
{
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
int columnCount = ui->listWidget_column->count();
|
||||||
|
for(int i = 0; i < columnCount; ++i)
|
||||||
|
{
|
||||||
|
item = ui->listWidget_column->item(i);
|
||||||
|
box = (QCheckBox*)ui->listWidget_column->itemWidget(item);
|
||||||
|
box->setChecked(flag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDatabaseSelect::slot_columnCheckBoxStateChanged(int state)
|
||||||
|
{
|
||||||
|
Q_UNUSED(state);
|
||||||
|
int nColumn = ((QCheckBox *)QObject::sender())->objectName().toInt();
|
||||||
|
// emit signal_showOrHideColumn(nColumn,state);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDatabaseSelect::slot_selectTable(int)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(ui->comboBox_location->currentData().toInt() < 0)
|
||||||
|
{
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
if(ui->listWidget_tableName->currentItem())
|
||||||
|
{
|
||||||
|
QMap<int,bool> isShowOrHideMap;
|
||||||
|
isShowOrHideMap.clear();
|
||||||
|
showColumns(ui->listWidget_tableName->currentItem(),isShowOrHideMap);
|
||||||
|
showTable(ui->listWidget_tableName->currentItem(),isShowOrHideMap);
|
||||||
|
QMap<int,bool>::iterator it = isShowOrHideMap.begin();
|
||||||
|
while (it != isShowOrHideMap.end()) {
|
||||||
|
int state = 0;
|
||||||
|
if(it.value())
|
||||||
|
{
|
||||||
|
state = 1;
|
||||||
|
}
|
||||||
|
emit signal_showOrHideColumn(it.key(),state);
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//showTable(ui->comboBox_tableName->currentText().toStdString());
|
||||||
|
if(ui->comboBox_tableName->currentText()=="fes_rtu_para"||ui->comboBox_tableName->currentText()=="fes_channel_para")
|
||||||
|
{
|
||||||
|
QTreeWidgetItemIterator it(ui->treeWidget_device);
|
||||||
|
while(*it){
|
||||||
|
(*it)->setHidden(true);
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QTreeWidgetItemIterator it(ui->treeWidget_device);
|
||||||
|
while(*it){
|
||||||
|
(*it)->setHidden(false);
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//初始化成员变量
|
||||||
|
bool CRealDatabaseSelect::initVariable(CSystemResources *_p)
|
||||||
|
{
|
||||||
|
if(!initSystemResources(_p))
|
||||||
|
{
|
||||||
|
qDebug() << "系统资源指针失败"<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!initDbInterface())
|
||||||
|
{
|
||||||
|
qDebug() << "初始化数据库接口失败"<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!initMapLocation())
|
||||||
|
{
|
||||||
|
qDebug() << "初始化车站信息失败"<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!initSubToApp())
|
||||||
|
{
|
||||||
|
qDebug() << "初始化专业和应用映射失败" <<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!initMapSubSystemIdToDesc())
|
||||||
|
{
|
||||||
|
qDebug() << "初始化专业信息失败" <<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!initMapSubIdToTableName())
|
||||||
|
{
|
||||||
|
qDebug() << "初始化专业ID到对应的表名列表失败" <<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!initMapTableInfo())
|
||||||
|
{
|
||||||
|
qDebug() << "初始化表信息(列名,列数据类型)失败" <<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//初始化系统资源的指针
|
||||||
|
bool CRealDatabaseSelect::initSystemResources(CSystemResources *_p)
|
||||||
|
{
|
||||||
|
m_pSystemResources = _p;
|
||||||
|
if(NULL == m_pSystemResources)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//初始化数据库的接口
|
||||||
|
bool CRealDatabaseSelect::initDbInterface()
|
||||||
|
{
|
||||||
|
if(NULL == m_pSystemResources)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_pObjDbInterface = m_pSystemResources->getDbInterface();
|
||||||
|
if(NULL == m_pObjDbInterface )
|
||||||
|
{
|
||||||
|
qDebug() << "初始化系统资源失败" <<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRealDatabaseSelect::initMapLocation()
|
||||||
|
{
|
||||||
|
m_mapLocationToDomain.clear();
|
||||||
|
m_mapLocationIdToDesc.clear();
|
||||||
|
if(NULL == m_pObjDbInterface)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
QSqlQuery ret;
|
||||||
|
QString strSql = "SELECT LOCATION_ID,DOMAIN_ID,DESCRIPTION FROM sys_model_location_info ORDER BY LOCATION_ID";
|
||||||
|
m_pObjDbInterface->execute(strSql,ret);
|
||||||
|
if(ret.isActive())
|
||||||
|
{
|
||||||
|
int locationId = -1;
|
||||||
|
int domainId =-1;
|
||||||
|
QString locationDesc;
|
||||||
|
while(ret.next())
|
||||||
|
{
|
||||||
|
locationId = ret.value("LOCATION_ID").toInt();
|
||||||
|
locationDesc = ret.value("DESCRIPTION").toString();
|
||||||
|
domainId = ret.value("DOMAIN_ID").toInt();
|
||||||
|
m_mapLocationToDomain[locationId] = domainId;
|
||||||
|
m_mapLocationIdToDesc[locationId] = locationDesc;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRealDatabaseSelect::initSubToApp()
|
||||||
|
{
|
||||||
|
m_mapSubToApp.clear();
|
||||||
|
if(NULL == m_pObjDbInterface)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
QSqlQuery ret;
|
||||||
|
QString strSql = "SELECT APP_ID,SUB_SYSTEM FROM sys_model_app_info ORDER BY APP_ID";
|
||||||
|
m_pObjDbInterface->execute(strSql,ret);
|
||||||
|
if(ret.isActive())
|
||||||
|
{
|
||||||
|
int appId = -1;
|
||||||
|
|
||||||
|
while(ret.next())
|
||||||
|
{
|
||||||
|
|
||||||
|
appId = ret.value("APP_ID").toInt();
|
||||||
|
QString subArray = ret.value("SUB_SYSTEM").toString();
|
||||||
|
QStringList subList = subArray.split(",");
|
||||||
|
for(int index(0);index<subList.size();index++)
|
||||||
|
{
|
||||||
|
QString sub =subList.at(index);
|
||||||
|
int subId = sub.toInt();
|
||||||
|
if(subId > CN_AppId_COMAPP)
|
||||||
|
{
|
||||||
|
m_mapSubToApp[subId] = appId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//初始化一个专业ID(subSystemId)对应描述
|
||||||
|
bool CRealDatabaseSelect::initMapSubSystemIdToDesc()
|
||||||
|
{
|
||||||
|
m_mapSubSystemIdToDesc.clear();
|
||||||
|
if(NULL == m_pObjDbInterface)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
QSqlQuery ret;
|
||||||
|
QString strSql = "SELECT SUB_SYSTEM_ID,DESCRIPTION FROM sys_model_sub_system_info ORDER BY SUB_SYSTEM_ID";
|
||||||
|
m_pObjDbInterface->execute(strSql,ret);
|
||||||
|
if(ret.isActive())
|
||||||
|
{
|
||||||
|
int subId = -1;
|
||||||
|
QString subDesc;
|
||||||
|
while(ret.next())
|
||||||
|
{
|
||||||
|
subId = ret.value("SUB_SYSTEM_ID").toInt();
|
||||||
|
subDesc = ret.value("DESCRIPTION").toString();
|
||||||
|
|
||||||
|
if(subId >CN_AppId_COMAPP)
|
||||||
|
{
|
||||||
|
m_mapSubSystemIdToDesc.insert(subId,subDesc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//初始化应用包含哪些表的map
|
||||||
|
bool CRealDatabaseSelect::initMapSubIdToTableName()
|
||||||
|
{
|
||||||
|
//由于关系库删除rt_开头的表,所以此处需要改动(jxd,2020-4-1)
|
||||||
|
foreach (int subId, m_mapSubSystemIdToDesc.keys()) {
|
||||||
|
std::vector<std::string> tableVec;
|
||||||
|
if(!CDbSysInfo::getAllRdbTableNameBySubsystemId(subId,tableVec))
|
||||||
|
{
|
||||||
|
LOGERROR("获取应用[%d]下的表失败!",subId);
|
||||||
|
return false;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
QMap<int,QStringList *>::iterator it = m_subIdToTableNameMap.find(subId);
|
||||||
|
if(it == m_subIdToTableNameMap.end())
|
||||||
|
{
|
||||||
|
m_subIdToTableNameMap.insert(subId,new QStringList);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int index(0);index<tableVec.size();index++)
|
||||||
|
{
|
||||||
|
QString tabName = QString::fromStdString(tableVec.at(index));
|
||||||
|
m_tableNameDescMap.insert(tabName,tabName);
|
||||||
|
m_subIdToTableNameMap.value(subId)->append(tabName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//初始化MapTableInfo
|
||||||
|
bool CRealDatabaseSelect::initMapTableInfo()
|
||||||
|
{
|
||||||
|
//由于关系库删除rt_开头的表,所以此处需要改动(jxd,2020-4-1)
|
||||||
|
foreach (QString tableName, m_tableNameDescMap.keys()) {
|
||||||
|
std::vector<SColumnModeInfo> verColumnName;
|
||||||
|
std::string tabName = tableName.toStdString();
|
||||||
|
if(!CDbSysInfo::getAllRdbColumnNameByTableName(tabName,verColumnName))
|
||||||
|
{
|
||||||
|
LOGERROR("获取表[%s]字段信息失败!",tableName.toStdString().c_str());
|
||||||
|
return false;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
m_mapTableInfo.insert(tableName,new QVector<QString>);
|
||||||
|
|
||||||
|
for(int index(0);index<verColumnName.size();index++)
|
||||||
|
{
|
||||||
|
QString name = QString::fromStdString(verColumnName.at(index).strName);
|
||||||
|
QString desc = QString::fromStdString(verColumnName.at(index).strDesc);
|
||||||
|
if((tableName=="accuml"||tableName=="analog"||tableName=="digital"||tableName=="mix")&&name=="VALUE")
|
||||||
|
{
|
||||||
|
m_mapTableInfo.value(tableName)->insert(2,name.toLower());
|
||||||
|
}
|
||||||
|
else if((tableName=="accuml"||tableName=="analog"||tableName=="digital"||tableName=="mix")&&name=="STATUS")
|
||||||
|
{
|
||||||
|
|
||||||
|
m_mapTableInfo.value(tableName)->insert(3,name.toLower());
|
||||||
|
}
|
||||||
|
else if((tableName=="fes_rtu_para"||tableName=="fes_channel_para")&&name=="STATUS")
|
||||||
|
{
|
||||||
|
m_mapTableInfo.value(tableName)->insert(3,name.toLower());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_mapTableInfo.value(tableName)->append(name.toLower());
|
||||||
|
}
|
||||||
|
QHash<QString,QMap<QString,QString> >::iterator it =m_mapTableColumnDesc.find(tableName);
|
||||||
|
if(it ==m_mapTableColumnDesc.end())
|
||||||
|
{
|
||||||
|
QMap<QString,QString> map;
|
||||||
|
map.insert(name.toLower(),desc);
|
||||||
|
m_mapTableColumnDesc.insert(tableName,map);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
it.value().insert(name.toLower(),desc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//连接信号和槽函数
|
||||||
|
void CRealDatabaseSelect::initSignalAndSlot()
|
||||||
|
{
|
||||||
|
connect(ui->comboBox_sub,SIGNAL(currentIndexChanged(int)),
|
||||||
|
this,SLOT(slot_selectSub(int)));
|
||||||
|
|
||||||
|
connect(ui->listWidget_tableName,SIGNAL(itemClicked(QListWidgetItem*)),
|
||||||
|
this,SLOT(slot_selectTable(QListWidgetItem*)));
|
||||||
|
// connect(ui->comboBox_tableName,SIGNAL(currentIndexChanged(int),this,SLOT(slot_selectTable(int)));
|
||||||
|
// connect(ui->checkBox_allColmn,SIGNAL(stateChanged(int)),
|
||||||
|
//this,SLOT(slot_checkBoxAllStateChanged(int)));
|
||||||
|
connect(ui->comboBox_location,SIGNAL(currentIndexChanged(int)),this,SLOT(slot_selectTable(int)));
|
||||||
|
connect(ui->comboBox_location,SIGNAL(currentIndexChanged(int)),this,SLOT(slot_selectTreeGevice(int)));
|
||||||
|
connect(ui->comboBox_sub,SIGNAL(currentIndexChanged(int)),this,SLOT(slot_selectTreeGevice(int)));
|
||||||
|
connect(ui->comboBox_tableName,SIGNAL(currentIndexChanged(int)),this,SLOT(slot_selectListWidget(int)));
|
||||||
|
connect(ui->treeWidget_device,SIGNAL(itemClicked(QTreeWidgetItem*,int)),this,SLOT(solt_showPoint(QTreeWidgetItem*,int)));
|
||||||
|
connect(ui->lineEdit_devgroup,SIGNAL(textChanged(QString)),this,SLOT(solt_showTreeWidget(QString)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CRealDatabaseSelect::initView()
|
||||||
|
{
|
||||||
|
initSubInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDatabaseSelect::initLocationInfo()
|
||||||
|
{
|
||||||
|
QMap<int,QString>::iterator it;
|
||||||
|
int locationId;
|
||||||
|
QString locationDesc;
|
||||||
|
for(it = m_mapLocationIdToDesc.begin(); it != m_mapLocationIdToDesc.end() ; ++it)
|
||||||
|
{
|
||||||
|
locationId = it.key();
|
||||||
|
locationDesc = it.value();
|
||||||
|
ui->comboBox_location->addItem(locationDesc,locationId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDatabaseSelect::initSubInfo()
|
||||||
|
{
|
||||||
|
QMap<int,QString>::iterator it;
|
||||||
|
int subId;
|
||||||
|
QString subDesc;
|
||||||
|
for(it = m_mapSubSystemIdToDesc.begin(); it != m_mapSubSystemIdToDesc.end() ; ++it)
|
||||||
|
{
|
||||||
|
subId = it.key();
|
||||||
|
subDesc = it.value();
|
||||||
|
ui->comboBox_sub->addItem(subDesc,subId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//初始化列信息
|
||||||
|
void CRealDatabaseSelect::initColumnInfo()
|
||||||
|
{
|
||||||
|
ui->checkBox_allColmn->setChecked(false);
|
||||||
|
}
|
||||||
|
//释放一些资源,NEW 出来的内存
|
||||||
|
void CRealDatabaseSelect::releaseRsouces()
|
||||||
|
{
|
||||||
|
QMap<int,QStringList*>::iterator it;
|
||||||
|
for(it = m_subIdToTableNameMap.begin(); it != m_subIdToTableNameMap.end(); ++it)
|
||||||
|
{
|
||||||
|
delete it.value();
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<QString,QVector<QString> *>::iterator tableInfoIt;
|
||||||
|
for(tableInfoIt = m_mapTableInfo.begin(); tableInfoIt != m_mapTableInfo.end() ; ++tableInfoIt)
|
||||||
|
{
|
||||||
|
delete tableInfoIt.value();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//展示一个表的列
|
||||||
|
void CRealDatabaseSelect::showColumns(QListWidgetItem *_item,QMap<int,bool> &isShowOrHideMap)
|
||||||
|
{
|
||||||
|
|
||||||
|
ui->checkBox_allColmn->setChecked(true);
|
||||||
|
QListWidgetItem *tableItem = _item;
|
||||||
|
ui->listWidget_column->clear();
|
||||||
|
QString tableName = m_tableNameDescMap.key(tableItem->text());
|
||||||
|
bool isPointTable = false;
|
||||||
|
if(tableName == "analog" || tableName == "digital" ||
|
||||||
|
tableName == "mix" || tableName == "accuml")
|
||||||
|
{
|
||||||
|
isPointTable =true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_mapTableInfo.end() != m_mapTableInfo.find(tableName))
|
||||||
|
{
|
||||||
|
QVector<QString> *p = m_mapTableInfo.value(tableName);
|
||||||
|
QVector<QString>::iterator it;
|
||||||
|
int i = 0;
|
||||||
|
for(it = p->begin(); it != p->end();++it,++i)
|
||||||
|
{
|
||||||
|
QListWidgetItem *columnItem = new QListWidgetItem();
|
||||||
|
QCheckBox *box = new QCheckBox(*it,ui->listWidget_column);
|
||||||
|
box->setToolTip(m_mapTableColumnDesc.value(tableName).value(*it));
|
||||||
|
box->setObjectName(QString::number(i));
|
||||||
|
box->setCheckable(true);
|
||||||
|
|
||||||
|
if(isPointTable)
|
||||||
|
{
|
||||||
|
if((*it)== "tag_name" || (*it)== "description" ||
|
||||||
|
(*it)== "device" || (*it)== "value" || (*it)=="seq_no" || (*it)=="rtu_tag" || (*it)== "status")
|
||||||
|
{
|
||||||
|
isShowOrHideMap[i] = true;
|
||||||
|
box->setChecked(true);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
isShowOrHideMap[i] = true;
|
||||||
|
box->setChecked(false);
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
isShowOrHideMap[i] = true;
|
||||||
|
box->setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->listWidget_column->addItem(columnItem);
|
||||||
|
ui->listWidget_column->setItemWidget(columnItem,box);
|
||||||
|
//connect(box,SIGNAL(stateChanged(int)),
|
||||||
|
//this,SLOT(slot_columnCheckBoxStateChanged(int)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDatabaseSelect::showTable(QListWidgetItem *_item, QMap<int, bool> &isShowOrHideMap)
|
||||||
|
{
|
||||||
|
QListWidgetItem *tableItem = _item;
|
||||||
|
int subId = ui->comboBox_sub->currentData().toInt();
|
||||||
|
int locationId = ui->comboBox_location->currentData().toInt();
|
||||||
|
int domainId = m_mapLocationToDomain.value(locationId);
|
||||||
|
int appId = m_mapSubToApp.value(subId);
|
||||||
|
QString tableName = m_tableNameDescMap.key(tableItem->text());
|
||||||
|
if(m_mapTableInfo.end() != m_mapTableInfo.find(tableName))
|
||||||
|
{
|
||||||
|
QVector<QString> *p = m_mapTableInfo.value(tableName);
|
||||||
|
emit signal_showTable(tableName,p,domainId,locationId,appId,subId,isShowOrHideMap); //哪张表,有哪些列(指针),应用ID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDatabaseSelect::showTable(QString tableName)
|
||||||
|
{
|
||||||
|
Q_UNUSED(tableName);
|
||||||
|
/*
|
||||||
|
int subId = ui->comboBox_sub->currentData().toInt();
|
||||||
|
int locationId = ui->comboBox_location->currentData().toInt();
|
||||||
|
int domainId = m_mapLocationToDomain.value(locationId);
|
||||||
|
int appId = m_mapSubToApp.value(subId);
|
||||||
|
if(m_mapTableInfo.end() != m_mapTableInfo.find(tableName))
|
||||||
|
{
|
||||||
|
QVector<QString> *p = m_mapTableInfo.value(tableName);
|
||||||
|
//emit signal_showTable();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
void CRealDatabaseSelect::slot_selectTreeGevice(int)
|
||||||
|
{
|
||||||
|
uint locationId = ui->comboBox_location->currentData().toUInt();
|
||||||
|
uint subSystemId = ui->comboBox_sub->currentData().toUInt();
|
||||||
|
ui->treeWidget_device->clear();
|
||||||
|
// QTreeWidgetItem *firstItem=new QTreeWidgetItem();
|
||||||
|
// firstItem->setText(0,ui->comboBox_location->currentText());
|
||||||
|
// ui->treeWidget_devGroup->addTopLevelItem(firstItem);
|
||||||
|
QSqlQuery devGroupTable;
|
||||||
|
devGroupTable.clear();
|
||||||
|
QString sqlStr = QString("SELECT a.DESCRIPTION dev_group_name,b.DESCRIPTION device_name, b.tag_name allName,b.GROUP_TAG_NAME GROUP_TAG_NAME,"
|
||||||
|
" b.TAG_NAME tga_name,a.LOCATION_ID location_id,a.SUB_SYSTEM sub_system FROM dev_group a,dev_info b"
|
||||||
|
" where a.LOCATION_ID= %1 and a.SUB_SYSTEM= %2 and "
|
||||||
|
"a.TAG_NAME =b.GROUP_TAG_NAME order by a.DESCRIPTION ").arg(locationId).arg(subSystemId);
|
||||||
|
m_pObjDbInterface->execute(sqlStr, devGroupTable);
|
||||||
|
if(devGroupTable.isActive())
|
||||||
|
{
|
||||||
|
|
||||||
|
QVariant val;
|
||||||
|
val.clear();
|
||||||
|
QString dev_group_name ="";
|
||||||
|
QString device_name = "";
|
||||||
|
QString lastDevGroupName="";
|
||||||
|
QString tag_name="";
|
||||||
|
QString location_id="";
|
||||||
|
QString sub_system="";
|
||||||
|
QString allName="";
|
||||||
|
QString group_tag_name="";
|
||||||
|
QTreeWidgetItem *lastItem=new QTreeWidgetItem();
|
||||||
|
|
||||||
|
while(devGroupTable.next())
|
||||||
|
{
|
||||||
|
val = devGroupTable.value("dev_group_name");
|
||||||
|
dev_group_name = val.toString();
|
||||||
|
val = devGroupTable.value("GROUP_TAG_NAME");
|
||||||
|
group_tag_name = val.toString();
|
||||||
|
val = devGroupTable.value("device_name");
|
||||||
|
device_name = val.toString();
|
||||||
|
val = devGroupTable.value("tga_name");
|
||||||
|
tag_name = val.toString();
|
||||||
|
val = devGroupTable.value("location_id");
|
||||||
|
location_id = val.toString();
|
||||||
|
val = devGroupTable.value("sub_system");
|
||||||
|
sub_system = val.toString();
|
||||||
|
val = devGroupTable.value("allName");
|
||||||
|
allName = val.toString();
|
||||||
|
if(lastDevGroupName!=dev_group_name){
|
||||||
|
QTreeWidgetItem *nodeItem = new QTreeWidgetItem(ui->treeWidget_device);
|
||||||
|
nodeItem->setText(0,dev_group_name);
|
||||||
|
nodeItem->setData(0,Qt::UserRole+1,group_tag_name);
|
||||||
|
nodeItem->setSelected(false);
|
||||||
|
QTreeWidgetItem *childItem = new QTreeWidgetItem(nodeItem);
|
||||||
|
childItem->setText(0,device_name);
|
||||||
|
childItem->setData(0,Qt::UserRole+1,tag_name);
|
||||||
|
childItem->setData(0,Qt::UserRole+2,location_id);
|
||||||
|
childItem->setData(0,Qt::UserRole+3,sub_system);
|
||||||
|
childItem->setData(0,Qt::UserRole+4,allName);
|
||||||
|
lastDevGroupName=dev_group_name;
|
||||||
|
lastItem=nodeItem;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
QTreeWidgetItem *childItem = new QTreeWidgetItem(lastItem);
|
||||||
|
childItem->setText(0,device_name);
|
||||||
|
childItem->setData(0,Qt::UserRole+1,tag_name);
|
||||||
|
childItem->setData(0,Qt::UserRole+2,location_id);
|
||||||
|
childItem->setData(0,Qt::UserRole+3,sub_system);
|
||||||
|
childItem->setData(0,Qt::UserRole+4,allName);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ui->treeWidget_device->setCurrentItem(ui->treeWidget_device->topLevelItem(0));
|
||||||
|
if(ui->comboBox_tableName->currentText()=="fes_rtu_para"||ui->comboBox_tableName->currentText()=="fes_channel_para")
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *a=new QTreeWidgetItem;
|
||||||
|
solt_showPoint(a,0);
|
||||||
|
QTreeWidgetItemIterator it(ui->treeWidget_device);
|
||||||
|
while(*it){
|
||||||
|
(*it)->setHidden(true);
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QTreeWidgetItemIterator it(ui->treeWidget_device);
|
||||||
|
while(*it){
|
||||||
|
(*it)->setHidden(false);
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDatabaseSelect::slot_selectListWidget(int)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(ui->comboBox_tableName->currentText()=="fes_rtu_para"||ui->comboBox_tableName->currentText()=="fes_channel_para")
|
||||||
|
{
|
||||||
|
QTreeWidgetItemIterator it(ui->treeWidget_device);
|
||||||
|
while(*it){
|
||||||
|
(*it)->setHidden(true);
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QTreeWidgetItemIterator it(ui->treeWidget_device);
|
||||||
|
while(*it){
|
||||||
|
(*it)->setHidden(false);
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QMap<int,bool> isShowOrHideMap;
|
||||||
|
int subId = ui->comboBox_sub->currentData().toInt();
|
||||||
|
int locationId = ui->comboBox_location->currentData().toInt();
|
||||||
|
int domainId = m_mapLocationToDomain.value(locationId);
|
||||||
|
int appId = m_mapSubToApp.value(subId);
|
||||||
|
QString tableName = m_tableNameDescMap.key(ui->comboBox_tableName->currentText());
|
||||||
|
if(m_mapTableInfo.end() != m_mapTableInfo.find(tableName))
|
||||||
|
{
|
||||||
|
QVector<QString> *p = m_mapTableInfo.value(tableName);
|
||||||
|
if(ui->treeWidget_device->topLevelItemCount()>1)
|
||||||
|
{
|
||||||
|
if(ui->treeWidget_device->currentItem()->childCount()>0)
|
||||||
|
{
|
||||||
|
QString devGroupName=ui->treeWidget_device->currentItem()->data(0,Qt::UserRole+1).toString();
|
||||||
|
QString deviceName="all";
|
||||||
|
emit signal_showTable(tableName,p,domainId,locationId,appId,subId,isShowOrHideMap,devGroupName,deviceName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QString devGroupName=ui->treeWidget_device->currentItem()->parent()->data(0,Qt::UserRole+1).toString();
|
||||||
|
QString deviceName=ui->treeWidget_device->currentItem()->data(0,Qt::UserRole+4).toString();
|
||||||
|
|
||||||
|
emit signal_showTable(tableName,p,domainId,locationId,appId,subId,isShowOrHideMap,devGroupName,deviceName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
emit signal_showTable(tableName,p,domainId,locationId,appId,subId,isShowOrHideMap); //哪张表,有哪些列(指针),应用ID
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDatabaseSelect::solt_showPoint(QTreeWidgetItem *, int)
|
||||||
|
{
|
||||||
|
QMap<int,bool> isShowOrHideMap;
|
||||||
|
int subId = ui->comboBox_sub->currentData().toInt();
|
||||||
|
int locationId = ui->comboBox_location->currentData().toInt();
|
||||||
|
int domainId = m_mapLocationToDomain.value(locationId);
|
||||||
|
int appId = m_mapSubToApp.value(subId);
|
||||||
|
QString tableName = m_tableNameDescMap.key(ui->comboBox_tableName->currentText());
|
||||||
|
if(m_mapTableInfo.end() != m_mapTableInfo.find(tableName))
|
||||||
|
{
|
||||||
|
QVector<QString> *p = m_mapTableInfo.value(tableName);
|
||||||
|
if(ui->treeWidget_device->topLevelItemCount()>1)
|
||||||
|
{
|
||||||
|
if(ui->treeWidget_device->currentItem()->childCount()>0)
|
||||||
|
{
|
||||||
|
QString devGroupName=ui->treeWidget_device->currentItem()->data(0,Qt::UserRole+1).toString();
|
||||||
|
QString deviceName="all";
|
||||||
|
emit signal_showTable(tableName,p,domainId,locationId,appId,subId,isShowOrHideMap,devGroupName,deviceName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QString devGroupName=ui->treeWidget_device->currentItem()->parent()->data(0,Qt::UserRole+1).toString();
|
||||||
|
QString deviceName=ui->treeWidget_device->currentItem()->data(0,Qt::UserRole+4).toString();
|
||||||
|
emit signal_showTable(tableName,p,domainId,locationId,appId,subId,isShowOrHideMap,devGroupName,deviceName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
emit signal_showTable(tableName,p,domainId,locationId,appId,subId,isShowOrHideMap); //哪张表,有哪些列(指针),应用ID
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRealDatabaseSelect::solt_showTreeWidget(QString)
|
||||||
|
{
|
||||||
|
slot_selectTreeGevice(0);
|
||||||
|
QString keyWord = ui->lineEdit_devgroup->text().trimmed();
|
||||||
|
QString tag_name = ui->lineEdit_devgroup->text();
|
||||||
|
if(allSelect(tag_name)||preciseSelect())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QTreeWidgetItemIterator it(ui->treeWidget_device);
|
||||||
|
while(*it){
|
||||||
|
(*it)->setHidden(false);
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
if(keyWord.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QTreeWidgetItemIterator itor(ui->treeWidget_device);
|
||||||
|
while(*itor){
|
||||||
|
if((*itor)->text(0).contains(keyWord,Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
|
int k=(*itor)->childCount();
|
||||||
|
for(int i=0;i<k;i++)
|
||||||
|
{
|
||||||
|
itor++;
|
||||||
|
}
|
||||||
|
itor++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//确认子节点是否匹配
|
||||||
|
bool childBool=0;
|
||||||
|
int k=(*itor)->childCount();
|
||||||
|
for(int i=0;i<k;i++)
|
||||||
|
{
|
||||||
|
if((*itor)->child(i)->text(0).contains(keyWord,Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
|
childBool=1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
(*itor)->child(i)->setHidden(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(childBool==false)
|
||||||
|
{
|
||||||
|
(*itor)->setHidden(true);
|
||||||
|
}
|
||||||
|
k=(*itor)->childCount();
|
||||||
|
for(int i=0;i<k;i++)
|
||||||
|
{
|
||||||
|
itor++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
itor++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRealDatabaseSelect::allSelect(QString tag_name)
|
||||||
|
{
|
||||||
|
bool pointBool=false;
|
||||||
|
QString analogTableName = "analog";
|
||||||
|
QString digitalTableName = "digital";
|
||||||
|
QString accumlTableName = "accuml";
|
||||||
|
QString mixTableName = "mix";
|
||||||
|
QStringList tableNameList;
|
||||||
|
QStringList pointType;
|
||||||
|
tableNameList.append(analogTableName);
|
||||||
|
pointType.append(tr("模拟量"));
|
||||||
|
tableNameList.append(digitalTableName);
|
||||||
|
pointType.append(tr("数字量"));
|
||||||
|
tableNameList.append(accumlTableName);
|
||||||
|
pointType.append(tr("累积量"));
|
||||||
|
tableNameList.append(mixTableName);
|
||||||
|
pointType.append(tr("混合量"));
|
||||||
|
uint locationId ;
|
||||||
|
uint subSystemId ;
|
||||||
|
QString tableName ;
|
||||||
|
QString pointDescription ;
|
||||||
|
QString pointTagName ;
|
||||||
|
QString point_type;
|
||||||
|
//QString devDescription = ui->listWidget_device->currentItem()->text();
|
||||||
|
//QString devTagName = ui->listWidget_device->currentItem()->data(Qt::UserRole+1).toString();
|
||||||
|
QString devDescription;
|
||||||
|
QString devTagName ;
|
||||||
|
QString descDevG ;
|
||||||
|
QString allName;
|
||||||
|
QString strSql1 = "select a.TAG_NAME allName,a.DESCRIPTION pointDescription,a.SEQ_NO,a.LOCATION_ID locationId,"
|
||||||
|
"a.SUB_SYSTEM subSystemId ,a.RTU_TAG,a.device devTagName,di.DESCRIPTION devDescription,dg.DESCRIPTION descDevG "
|
||||||
|
"from ";
|
||||||
|
|
||||||
|
QString strSql2 = QString(" a ,dev_info di ,dev_group dg where "
|
||||||
|
" a.TAG_NAME = ")+QString("'")+ tag_name+"' and"
|
||||||
|
" a.DEVICE =di.TAG_NAME and di.GROUP_TAG_NAME =dg.TAG_NAME ";
|
||||||
|
|
||||||
|
uint rowCount = 0;
|
||||||
|
QSqlQuery pointTable;
|
||||||
|
for(int i = 0 ; i < 4; i++)
|
||||||
|
{
|
||||||
|
pointTable.clear();
|
||||||
|
m_pObjDbInterface->execute(strSql1+tableNameList[i]+strSql2,pointTable);
|
||||||
|
if(pointTable.isActive())
|
||||||
|
{
|
||||||
|
rowCount += pointTable.size();
|
||||||
|
while(pointTable.next())
|
||||||
|
{
|
||||||
|
pointBool=true;
|
||||||
|
locationId=pointTable.value("locationId").toInt();
|
||||||
|
subSystemId=pointTable.value("subSystemId").toInt();
|
||||||
|
allName=pointTable.value("allName").toString();
|
||||||
|
pointDescription=pointTable.value("pointDescription").toString();
|
||||||
|
descDevG=pointTable.value("descDevG").toString();
|
||||||
|
devDescription=pointTable.value("devDescription").toString();
|
||||||
|
pointTagName=allName;
|
||||||
|
tableName=tableNameList[i];
|
||||||
|
point_type=pointType[i];
|
||||||
|
devTagName=pointTable.value("devTagName").toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(pointBool==false){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for(int k=0;k<ui->comboBox_location->count();k++)
|
||||||
|
{
|
||||||
|
if(ui->comboBox_location->itemData(k).toInt()==locationId)
|
||||||
|
{
|
||||||
|
ui->comboBox_location->setCurrentIndex(k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(int k=0;k<ui->comboBox_sub->count();k++)
|
||||||
|
{
|
||||||
|
if(ui->comboBox_sub->itemData(k).toInt()==subSystemId)
|
||||||
|
{
|
||||||
|
ui->comboBox_sub->setCurrentIndex(k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(int k=0;k<ui->comboBox_tableName->count();k++)
|
||||||
|
{
|
||||||
|
if(ui->comboBox_tableName->itemText(k)==tableName)
|
||||||
|
{
|
||||||
|
ui->comboBox_tableName->setCurrentIndex(k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ui->treeWidget_device->clear();
|
||||||
|
slot_selectTreeGevice(0);
|
||||||
|
QString devGroupName="";
|
||||||
|
QString deviceName="";
|
||||||
|
QTreeWidgetItemIterator itor(ui->treeWidget_device);
|
||||||
|
|
||||||
|
while(*itor){
|
||||||
|
bool childNumber=false;
|
||||||
|
if((*itor)->text(0).contains(descDevG,Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
|
int itorCount=(*itor)->childCount();
|
||||||
|
(*itor)->setHidden(false);
|
||||||
|
for(int i=0;i<itorCount;i++)
|
||||||
|
{
|
||||||
|
if((*itor)->child(i)->text(0).contains(devDescription,Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
|
devGroupName =(*itor)->child(i)->parent()->data(0,Qt::UserRole+1).toString();
|
||||||
|
deviceName=(*itor)->child(i)->data(0,Qt::UserRole+4).toString();
|
||||||
|
childNumber=true;
|
||||||
|
(*itor)->child(i)->setHidden(false);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
(*itor)->child(i)->setHidden(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if(childNumber==false){
|
||||||
|
(*itor)->setHidden(true);
|
||||||
|
}
|
||||||
|
for(int i=0;i<=itorCount;i++){
|
||||||
|
itor++;
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
(*itor)->setHidden(true);
|
||||||
|
itor++;
|
||||||
|
}
|
||||||
|
QVector<QString> *p = m_mapTableInfo.value(tableName);
|
||||||
|
int subId = ui->comboBox_sub->currentData().toInt();
|
||||||
|
int domainId = m_mapLocationToDomain.value(locationId);
|
||||||
|
int appId = m_mapSubToApp.value(subId);
|
||||||
|
QMap<int,bool> isShowOrHideMap;
|
||||||
|
emit signal_showTable(tableName,p,domainId,locationId,appId,subId,isShowOrHideMap,devGroupName,deviceName);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRealDatabaseSelect::preciseSelect()
|
||||||
|
{
|
||||||
|
QStringList devTagSplit;
|
||||||
|
QString analogTableName = "ANALOG";
|
||||||
|
QString digitalTableName = "DIGITAL";
|
||||||
|
QString accumlTableName = "ACCUML";
|
||||||
|
QString mixTableName = "MIX";
|
||||||
|
QString currTextEdit=ui->lineEdit_devgroup->text();
|
||||||
|
devTagSplit=currTextEdit.split(".");
|
||||||
|
for(int i=0;i<devTagSplit.size();i++){
|
||||||
|
if(devTagSplit.at(i).contains(analogTableName,Qt::CaseInsensitive)
|
||||||
|
||devTagSplit.at(i).contains(digitalTableName,Qt::CaseInsensitive)
|
||||||
|
||devTagSplit.at(i).contains(accumlTableName,Qt::CaseInsensitive)
|
||||||
|
||devTagSplit.at(i).contains(mixTableName,Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
|
return(allSelect(devTagSplit.at(i+1)+"."+devTagSplit.at(i+2)+"."+devTagSplit.at(i+3)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
86
product/src/tools/debug_tool_v2/CRealDatabaseSelect.h
Normal file
86
product/src/tools/debug_tool_v2/CRealDatabaseSelect.h
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
#ifndef CREALDATABASESELECT_H
|
||||||
|
#define CREALDATABASESELECT_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QListWidgetItem>
|
||||||
|
#include <QMap>
|
||||||
|
#include "CSystemResources.h"
|
||||||
|
#include "toolCommon.h"
|
||||||
|
#include<QTreeWidget>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CRealDatabaseSelect;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CRealDatabaseSelect : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CRealDatabaseSelect(QWidget *parent = 0);
|
||||||
|
~CRealDatabaseSelect();
|
||||||
|
bool initRealDb(CSystemResources *_p);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void slot_selectSub(int _index);
|
||||||
|
void slot_selectTable(QListWidgetItem *);
|
||||||
|
void slot_checkBoxAllStateChanged(int state);
|
||||||
|
void slot_columnCheckBoxStateChanged(int state);
|
||||||
|
void slot_selectTable(int);
|
||||||
|
void slot_selectTreeGevice(int);
|
||||||
|
void slot_selectListWidget(int);
|
||||||
|
void solt_showPoint(QTreeWidgetItem*,int);
|
||||||
|
void solt_showTreeWidget(QString);
|
||||||
|
signals:
|
||||||
|
void signal_showTable(QString, QVector<QString> *,int,int,int,int,QMap<int,bool>,QString,QString);
|
||||||
|
void signal_showTable(QString, QVector<QString> *,int,int,int,int,QMap<int,bool>);
|
||||||
|
void signal_showOrHideColumn(int nColumn,int state);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool initVariable(CSystemResources *_p);
|
||||||
|
bool initSystemResources(CSystemResources *_p);
|
||||||
|
bool initDbInterface();
|
||||||
|
//bool initMapAppIdToAppTag();
|
||||||
|
|
||||||
|
bool initMapLocation();
|
||||||
|
bool initSubToApp();
|
||||||
|
bool initMapSubSystemIdToDesc();
|
||||||
|
bool initMapSubIdToTableName();
|
||||||
|
bool initMapTableInfo();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool preciseSelect();
|
||||||
|
bool allSelect(QString tag_name);
|
||||||
|
void initSignalAndSlot();
|
||||||
|
void initView();
|
||||||
|
void initLocationInfo();
|
||||||
|
void initSubInfo();
|
||||||
|
void initColumnInfo();
|
||||||
|
|
||||||
|
void releaseRsouces();
|
||||||
|
|
||||||
|
void showColumns(QListWidgetItem *, QMap<int, bool> &isShowOrHideMap);
|
||||||
|
void showTable(QListWidgetItem *,QMap<int, bool> &isShowOrHideMap);
|
||||||
|
void showTable(QString);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
CSystemResources *m_pSystemResources;
|
||||||
|
iot_dbms::CDbApi *m_pObjDbInterface;
|
||||||
|
|
||||||
|
QMap<int,QString> m_mapAppIdToAppTag; //<- 应用ID和应用名
|
||||||
|
QMap<QString,QString> m_mapAppTagToAppDesc; //<- 应用名和应用描述
|
||||||
|
QMap<int,int> m_mapLocationToDomain; //车站id和域id
|
||||||
|
QMap<int,int> m_mapSubToApp; //专业id和应用id
|
||||||
|
QMap<int,QString> m_mapLocationIdToDesc; //<- 车站
|
||||||
|
QMap<int,QString> m_mapSubSystemIdToDesc; //<- 子系统ID和描述
|
||||||
|
QMap<int,QStringList *> m_subIdToTableNameMap; //<- 这个专业ID下有哪些表
|
||||||
|
QMap<QString,QVector<QString> *> m_mapTableInfo; //<- 每一张表的信息,包括这张表的所有列名和其数据类型
|
||||||
|
QHash<QString,QMap<QString,QString> > m_mapTableColumnDesc; //
|
||||||
|
QMap<QString,QString> m_tableNameDescMap; //表名和表描述
|
||||||
|
Ui::CRealDatabaseSelect *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CREALDATABASESELECT_H
|
||||||
247
product/src/tools/debug_tool_v2/CRealDatabaseSelect.ui
Normal file
247
product/src/tools/debug_tool_v2/CRealDatabaseSelect.ui
Normal file
@ -0,0 +1,247 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CRealDatabaseSelect</class>
|
||||||
|
<widget class="QWidget" name="CRealDatabaseSelect">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>524</width>
|
||||||
|
<height>706</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>45</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>45</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>位置</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_location">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>45</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>45</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>专业</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_sub">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>45</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>45</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>表</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_tableName"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_devgroup"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTreeWidget" name="treeWidget_device">
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>设备组</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>45</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>45</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>表</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="listWidget_tableName"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>45</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>45</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>列</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_allColmn">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>所有列</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="listWidget_column"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
1195
product/src/tools/debug_tool_v2/CRealDatabaseShow.cpp
Normal file
1195
product/src/tools/debug_tool_v2/CRealDatabaseShow.cpp
Normal file
File diff suppressed because it is too large
Load Diff
148
product/src/tools/debug_tool_v2/CRealDatabaseShow.h
Normal file
148
product/src/tools/debug_tool_v2/CRealDatabaseShow.h
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
#ifndef CREALDATABASESHOW_H
|
||||||
|
#define CREALDATABASESHOW_H
|
||||||
|
|
||||||
|
#include "toolCommon.h"
|
||||||
|
#include "CSystemResources.h"
|
||||||
|
#include "rdb_net_api/CRdbNetApi.h"
|
||||||
|
#include "net_msg_bus_api/MsgBusApi.h"
|
||||||
|
#include "rdb_api/CRdbAccessEx.h"
|
||||||
|
#include "CRealDatabaseItemInfo.h"
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QVector>
|
||||||
|
#include <QThread>
|
||||||
|
#include "CRdbWorker.h"
|
||||||
|
#include "CStatusDialog.h"
|
||||||
|
class CRealDatabaseItemModel;
|
||||||
|
namespace Ui {
|
||||||
|
class CRealDatabaseShow;
|
||||||
|
}
|
||||||
|
class CStatusDialog;
|
||||||
|
class CRealDatabaseShow : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CRealDatabaseShow(QWidget *parent = 0);
|
||||||
|
~CRealDatabaseShow();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void releaseRsouces();
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool initRealDatabaseShow(CSystemResources *_p);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool initVariable(CSystemResources *_p);
|
||||||
|
bool initSystemResources(CSystemResources *_p);
|
||||||
|
bool initNetRdbApi();
|
||||||
|
bool initMapLocationIdDesc();
|
||||||
|
bool initMapLocSubDevGInfo();
|
||||||
|
bool initMapLocSubRtuInfo();
|
||||||
|
bool initMapDevGDevInfo();
|
||||||
|
bool initMapRtuFesDevInfo();
|
||||||
|
void initSignalAndSlot();
|
||||||
|
void initView();
|
||||||
|
void initFilter();
|
||||||
|
void initComboxDevG();
|
||||||
|
void initComboxDevice();
|
||||||
|
void initComboxRtu();
|
||||||
|
void initComboxFesDev();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void sigTimerShot(const bool bStop);
|
||||||
|
void sigDataRefresh(QList<RealDatabasePtr>);
|
||||||
|
void sigSearch(int domainId,int appid,iot_idl::RdbQuery rdbQuery,QString tableName,int searchWays);
|
||||||
|
void signal_selectTextEdit(QString allQString);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void slotTimerShot(const bool start);
|
||||||
|
|
||||||
|
void slot_showTable(QString, QVector<QString> *,int _domainId,int _locationId,int _appId, int _subId,QMap<int,bool> isLineShow,QString devGroupName,QString deviceName);
|
||||||
|
void slot_showOrHindColumn(int nColumn, int state);
|
||||||
|
|
||||||
|
|
||||||
|
void slot_filterDevg(int _index);
|
||||||
|
void slot_filterRtu(int _index);
|
||||||
|
void slot_filterDev(int _index);
|
||||||
|
void slot_filterFesDev(int _index);
|
||||||
|
|
||||||
|
void auto_brush();
|
||||||
|
void not_auto_brush();
|
||||||
|
void slotAutoResult(const bool & isSuccess,const iot_idl::RdbRet & retMsg,const QString& tableName);
|
||||||
|
void slotNotAutoResult(const bool &isSuccess, const iot_idl::RdbRet &retMsg, const QString &tableName);
|
||||||
|
void statusSearch();
|
||||||
|
|
||||||
|
void showStatus(const QModelIndex &index);
|
||||||
|
private:
|
||||||
|
bool makeData(const iot_idl::RdbRet &retMsg);
|
||||||
|
void setItemData(int &row,int &column,const iot_idl::SVariable &);
|
||||||
|
|
||||||
|
QStringList getTableHead();
|
||||||
|
void setTableHead();
|
||||||
|
QString dataTypeToQString(const iot_idl::SVariable &sVariable);
|
||||||
|
|
||||||
|
void hideDevGroup();
|
||||||
|
void showDevGroup();
|
||||||
|
void hideDev();
|
||||||
|
void showDev();
|
||||||
|
void hideRtu();
|
||||||
|
void showRtu();
|
||||||
|
void hideFesDev();
|
||||||
|
void showFesDev();
|
||||||
|
void search();
|
||||||
|
|
||||||
|
bool makeQuery(iot_idl::RdbQuery &msgQuery);
|
||||||
|
bool makeUpdateQuery(iot_idl::RdbQuery &msgQuery);
|
||||||
|
bool makeCondition(iot_idl::RdbQuery &msgQuery);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::CRealDatabaseShow *ui;
|
||||||
|
CRealDatabaseItemModel *m_model; //< 模型
|
||||||
|
QMap<QString,RealDatabasePtr> m_showdata; //< 模型数据
|
||||||
|
CSystemResources *m_pSystemResources; //< 系统资源类指针
|
||||||
|
QVector<QString> * m_pVecTableInfo; //< 表的列名数组指针
|
||||||
|
iot_dbms::CDbApi *m_pObjDbInterface; //< mysql数据库的接口指针
|
||||||
|
|
||||||
|
int m_nsubId; //< 专业ID
|
||||||
|
int m_nDomainId; //< 域ID
|
||||||
|
int m_nlocationId; //< 车站id
|
||||||
|
int m_nappId; //< 应用id
|
||||||
|
QString m_strTableName; //< 表的名
|
||||||
|
QString m_devGroupName; //< 设备组名
|
||||||
|
QString m_deviceName; //< 设备名
|
||||||
|
|
||||||
|
QMap<int,QString> m_locationIdDescMap; //< <车站id,描述>
|
||||||
|
QMap<QString,QVector<QString> > m_locSubDevGMap; //< <车站id.专业id,DevVec>
|
||||||
|
QMap<QString,QVector<QString> > m_locSubRtuMap; //< <车站id.专业id,RtuVec>
|
||||||
|
QMap<QString,QString> m_devGDescMap; //< <设备组标签,描述>
|
||||||
|
QMap<QString,QString> m_devDescMap; //< <设备标签,描述>
|
||||||
|
QMap<QString,QString> m_rtuDescMap; //< <Rtu标签,描述>
|
||||||
|
QMap<QString,QString> m_fesDevDescMap; //< <前置设备标签,描述>
|
||||||
|
QMap<QString,QVector<QString> > m_devGDevMap; //< <设备组标签,DevVec>
|
||||||
|
QMap<QString,QVector<QString> > m_rtuFesDevMap; //< <rtu标签,FesDevVec>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 此处多处过滤只为缓解网络查询负担(还包括大数据量的自动查询和界面刷新压力)
|
||||||
|
* @brief 一般来说 所有设备组 设备 RTU 前置设备 总会属于某一个车站的某一个专业
|
||||||
|
* @brief 若当前查询的表中包含 location_id 则 m_bLocationFilter生效 ,包含 sub_system 则 m_bSubFilter生效
|
||||||
|
* @brief 若包含 device 则 m_bDevFilter生效,m_bRtuFilter和 m_bFesDevFilter 则无需判断,可直接认为无效(m_bDevFilter生效则足以缓解网络查询负担,后续条件则不判断)
|
||||||
|
* @brief 若不包含device(后台设备) ,但包含 dev_tag(前置设备) ,则m_bFesDevFilter生效,m_bRtuFilter不生效(但是dev_tag是由rtu_tag得到,有关联关系,只不过不作为查询条件)
|
||||||
|
* @brief 若既不包含device,也不包含dev_tag,只包含rtu_tag,则m_bRtuFilter生效,可以作为查询条件
|
||||||
|
* @brief 若均不包含则认为此表数据量不大,可以不用缓解网络查询负担
|
||||||
|
*/
|
||||||
|
bool m_bLocationFilter; //< 是否车站过滤 (m_strTableName 中包含location_id字段时可用)
|
||||||
|
bool m_bSubFilter; //< 是否专业过滤 (m_strTableName 中包含sub_system字段时可用)
|
||||||
|
bool m_bDevFilter; //< 是否设备过滤 (m_strTableName 中包含device字段时可用)
|
||||||
|
bool m_bRtuFilter; //< 是否RTU过滤 (m_strTableName 中包含rtu_tag字段时可用)
|
||||||
|
bool m_bFesDevFilter; //< 是否前置设备过滤 (m_strTableName 中包含dev_tag字段时可用)
|
||||||
|
bool m_canSearch; //< 主线程是否可以通知查询线程查询(自动刷新需要判断)
|
||||||
|
|
||||||
|
QTimer *m_timer; //< 定时器 默认1秒 定时查询Ai Di Mi Pi
|
||||||
|
QThread *m_rdbThread; //< 查询线程
|
||||||
|
CRdbWorker *m_worker; //< 工作线程
|
||||||
|
|
||||||
|
CStatusDialog *m_searchDialog;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CREALDATABASESHOW_H
|
||||||
228
product/src/tools/debug_tool_v2/CRealDatabaseShow.ui
Normal file
228
product/src/tools/debug_tool_v2/CRealDatabaseShow.ui
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CRealDatabaseShow</class>
|
||||||
|
<widget class="QWidget" name="CRealDatabaseShow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>783</width>
|
||||||
|
<height>626</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="widget" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_devG">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>45</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>设备组</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_devGroup">
|
||||||
|
<property name="sizeAdjustPolicy">
|
||||||
|
<enum>QComboBox::AdjustToContents</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_dev">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>30</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>设备</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_device">
|
||||||
|
<property name="sizeAdjustPolicy">
|
||||||
|
<enum>QComboBox::AdjustToContents</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_rtu">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>30</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>30</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>RTU</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_rtu">
|
||||||
|
<property name="sizeAdjustPolicy">
|
||||||
|
<enum>QComboBox::AdjustToContents</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_fesDev">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>60</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>60</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>前置设备</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_fesDev">
|
||||||
|
<property name="sizeAdjustPolicy">
|
||||||
|
<enum>QComboBox::AdjustToContents</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="statusSearch">
|
||||||
|
<property name="text">
|
||||||
|
<string>状态查询</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QStackedWidget" name="stackedWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="page">
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QTableWidget" name="tableWidget_showTable"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_2">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QTableView" name="tableView"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
96
product/src/tools/debug_tool_v2/CRealEvent.ui
Normal file
96
product/src/tools/debug_tool_v2/CRealEvent.ui
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CRealEvent</class>
|
||||||
|
<widget class="QWidget" name="CRealEvent">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>437</width>
|
||||||
|
<height>243</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QTableView" name="tableView"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>滚动刷新</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>筛选状态</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>筛选</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>打印</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<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="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>事件条数</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
162
product/src/tools/debug_tool_v2/CSelectAppDlg.cpp
Normal file
162
product/src/tools/debug_tool_v2/CSelectAppDlg.cpp
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
#include <QFile>
|
||||||
|
#include "CSelectAppDlg.h"
|
||||||
|
#include "ui_CSelectAppDlg.h"
|
||||||
|
#include <QListView>
|
||||||
|
#include <QAbstractItemView>
|
||||||
|
#include "common/Common.h"
|
||||||
|
CSelectAppDlg::CSelectAppDlg(QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::CSelectAppDlg)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
this->setWindowTitle(tr("专业选择"));
|
||||||
|
ui->AppcomboBox->setView(new QListView());
|
||||||
|
Qt::WindowFlags flags=Qt::Window;
|
||||||
|
// flags |=Qt::WindowMinMaxButtonsHint|Qt::WindowCloseButtonHint;
|
||||||
|
flags |=Qt::WindowCloseButtonHint;
|
||||||
|
setWindowFlags(flags);
|
||||||
|
setFixedSize(this->width(),this->height());//固定窗口大小
|
||||||
|
setStyleSheet("QComboBox QAbstractItemView::item{height: 30px;}");
|
||||||
|
memset(m_IpAddr,0,sizeof(m_IpAddr));
|
||||||
|
|
||||||
|
connect(ui->ConnectButton,SIGNAL(clicked()),this,SLOT(OnConnect()));
|
||||||
|
connect(ui->DisConnectButton,SIGNAL(clicked()),this,SLOT(OnDisConnect()));
|
||||||
|
connect(&m_TcpClient,SIGNAL(NetConnected()),this,SLOT(ConnectOk()));
|
||||||
|
connect(&m_TcpClient,SIGNAL(NetDisConnected()),this,SLOT(DisConnectOk()));
|
||||||
|
connect(ui->AppcomboBox,&QComboBox::currentTextChanged,this,&CSelectAppDlg::OnAppId);
|
||||||
|
ui->ConnectButton->setEnabled(true);
|
||||||
|
ui->DisConnectButton->setEnabled(false);
|
||||||
|
|
||||||
|
m_IpStr.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
CSelectAppDlg::~CSelectAppDlg()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSelectAppDlg::SelectApp(const std::vector<FesAppName> &vecAppName)
|
||||||
|
{
|
||||||
|
m_vecName = vecAppName;
|
||||||
|
|
||||||
|
if(ui->AppcomboBox->count()==0)
|
||||||
|
{
|
||||||
|
if(m_vecName.size()<=0)
|
||||||
|
{
|
||||||
|
ui->AppcomboBox->addItem("AppName");
|
||||||
|
ui->NetPortNo->setText("18001");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for(i=0;i<m_vecName.size();i++)
|
||||||
|
{
|
||||||
|
if(m_vecName[i].appName.toStdString() != CN_AppName_BASE
|
||||||
|
&& m_vecName[i].appName.toStdString() != CN_AppName_PUBLIC
|
||||||
|
&& m_vecName[i].appName.toStdString() != CN_AppName_COMAPP)
|
||||||
|
ui->AppcomboBox->addItem(m_vecName[i].appName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QFile file("FesSimIP.txt");
|
||||||
|
if(file.exists())
|
||||||
|
{
|
||||||
|
if(file.open(QFile::ReadOnly | QFile::Text))
|
||||||
|
{
|
||||||
|
m_IpStr = file.readAll();
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(m_IpStr.isEmpty())
|
||||||
|
m_IpStr = "192.168.77.18";
|
||||||
|
std::string tempStr = m_IpStr.toStdString();
|
||||||
|
if(file.open(QFile::WriteOnly | QFile::Append))
|
||||||
|
{
|
||||||
|
file.write(tempStr.c_str(),tempStr.length());
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ui->IPAddr->setText(m_IpStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSelectAppDlg::OnConnect()
|
||||||
|
{
|
||||||
|
QString tempStr ;
|
||||||
|
|
||||||
|
tempStr = ui->NetPortNo->text();
|
||||||
|
bool ok;
|
||||||
|
m_NetPortNo = tempStr.toInt(&ok,10);
|
||||||
|
if(ok == false)
|
||||||
|
{
|
||||||
|
QPalette pe;
|
||||||
|
pe.setColor(QPalette::WindowText,Qt::red);
|
||||||
|
ui->ConnectStatusStr->setPalette(pe);
|
||||||
|
ui->ConnectStatusStr->setText(tr("网络端口错误,无法连接网络。"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_IpStr = ui->IPAddr->text();
|
||||||
|
QByteArray ba=m_IpStr.toLocal8Bit();
|
||||||
|
strcpy(m_IpAddr,ba.data());
|
||||||
|
m_TcpClient.Init(m_IpAddr,m_NetPortNo);
|
||||||
|
|
||||||
|
if(m_TcpClient.TcpConnect()==iotSuccess)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//save FesSimIp.txt
|
||||||
|
QFile file("FesSimIP.txt");
|
||||||
|
if(file.exists())
|
||||||
|
{
|
||||||
|
std::string tempStr = m_IpStr.toStdString();
|
||||||
|
if(file.open(QFile::WriteOnly | QFile::Truncate))
|
||||||
|
{
|
||||||
|
file.write(tempStr.c_str(),tempStr.length());
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSelectAppDlg::OnDisConnect()
|
||||||
|
{
|
||||||
|
m_TcpClient.TcpClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSelectAppDlg::ConnectOk()
|
||||||
|
{
|
||||||
|
QPalette pe;
|
||||||
|
pe.setColor(QPalette::WindowText,Qt::green);
|
||||||
|
ui->ConnectStatusStr->setPalette(pe);
|
||||||
|
ui->ConnectStatusStr->setText(tr("网络连接"));
|
||||||
|
ui->ConnectButton->setEnabled(false);
|
||||||
|
ui->DisConnectButton->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSelectAppDlg::DisConnectOk()
|
||||||
|
{
|
||||||
|
QPalette pe;
|
||||||
|
pe.setColor(QPalette::WindowText,Qt::red);
|
||||||
|
ui->ConnectStatusStr->setPalette(pe);
|
||||||
|
ui->ConnectStatusStr->setText(tr("网络断开"));
|
||||||
|
ui->ConnectButton->setEnabled(true);
|
||||||
|
ui->DisConnectButton->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSelectAppDlg::OnAppId(const QString &text)
|
||||||
|
{
|
||||||
|
|
||||||
|
for(size_t i=0;i<m_vecName.size();i++)
|
||||||
|
{
|
||||||
|
if(text == m_vecName[i].appName)
|
||||||
|
{
|
||||||
|
ui->NetPortNo->setText(QString::number(18000+m_vecName[i].appId));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
41
product/src/tools/debug_tool_v2/CSelectAppDlg.h
Normal file
41
product/src/tools/debug_tool_v2/CSelectAppDlg.h
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#ifndef CSELECTAPPDLG_H
|
||||||
|
#define CSELECTAPPDLG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include "FesSimProtocol.h"
|
||||||
|
#include "CTcpClient.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CSelectAppDlg;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CSelectAppDlg : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CSelectAppDlg(QWidget *parent = 0);
|
||||||
|
~CSelectAppDlg();
|
||||||
|
|
||||||
|
int m_AppType;
|
||||||
|
CTcpClient m_TcpClient;
|
||||||
|
int m_NetPortNo;
|
||||||
|
char m_IpAddr[64];
|
||||||
|
|
||||||
|
void SelectApp(const std::vector<FesAppName> &vecAppName);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void OnConnect();
|
||||||
|
void OnDisConnect();
|
||||||
|
void ConnectOk();
|
||||||
|
void DisConnectOk();
|
||||||
|
|
||||||
|
void OnAppId(const QString &);
|
||||||
|
private:
|
||||||
|
Ui::CSelectAppDlg *ui;
|
||||||
|
|
||||||
|
std::vector<FesAppName> m_vecName;
|
||||||
|
QString m_IpStr;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CSELECTAPPDLG_H
|
||||||
263
product/src/tools/debug_tool_v2/CSelectAppDlg.ui
Normal file
263
product/src/tools/debug_tool_v2/CSelectAppDlg.ui
Normal file
@ -0,0 +1,263 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CSelectAppDlg</class>
|
||||||
|
<widget class="QDialog" name="CSelectAppDlg">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>356</width>
|
||||||
|
<height>303</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="layoutWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>50</x>
|
||||||
|
<y>50</y>
|
||||||
|
<width>245</width>
|
||||||
|
<height>188</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>专业名称:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="AppcomboBox">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>FES IP地址:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="IPAddr">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>FES网络端口:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="NetPortNo">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>连接状态:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="ConnectStatusStr">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
|
<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>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="ConnectButton">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>连接</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<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="DisConnectButton">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>断开连接</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
154
product/src/tools/debug_tool_v2/CStatusDialog.cpp
Normal file
154
product/src/tools/debug_tool_v2/CStatusDialog.cpp
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
#include "CStatusDialog.h"
|
||||||
|
#include "ui_CStatusDialog.h"
|
||||||
|
#include "pub_widget/MessageBox.h"
|
||||||
|
CStatusDialog::CStatusDialog(CSystemResources *_p,QWidget *parent) :
|
||||||
|
CustomUiDialog(parent),
|
||||||
|
ui(new Ui::CStatusDialog)
|
||||||
|
{
|
||||||
|
m_pSystemResources = _p;
|
||||||
|
ui->setupUi(this);
|
||||||
|
setWindowTitle( "状态查询" );
|
||||||
|
if(initDbInterface())
|
||||||
|
{
|
||||||
|
loadData();
|
||||||
|
}
|
||||||
|
ui->comboBox->setView(new QListView());
|
||||||
|
connect(ui->pushButton,&QPushButton::clicked,this,&CStatusDialog::search);
|
||||||
|
connect(ui->comboBox,&QComboBox::currentTextChanged,this,&CStatusDialog::switchWidget);
|
||||||
|
|
||||||
|
initCombox();
|
||||||
|
|
||||||
|
CustomUiDialog::setAutoLayout(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
CStatusDialog::~CStatusDialog()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CStatusDialog::initDbInterface()
|
||||||
|
{
|
||||||
|
m_pObjDbInterface = m_pSystemResources->getDbInterface();
|
||||||
|
if(m_pObjDbInterface != NULL)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CStatusDialog::initData(int type, int status,QString allName,int value)
|
||||||
|
{
|
||||||
|
ui->comboBox->setCurrentIndex(type);
|
||||||
|
ui->lineEdit->setText(QString::number((uint)status));
|
||||||
|
m_allName=allName;
|
||||||
|
m_value=value;
|
||||||
|
search();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CStatusDialog::all_textEditQstring()
|
||||||
|
{
|
||||||
|
return all_textEditQst;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CStatusDialog::initCombox()
|
||||||
|
{
|
||||||
|
ui->comboBox->clear();
|
||||||
|
// ui->comboBox->addItem("menu1");
|
||||||
|
// ui->comboBox->addItem("menu2");
|
||||||
|
// ui->comboBox->addItem("menu3");
|
||||||
|
// ui->comboBox->addItem(QString::number(m_dict_menu.size()));
|
||||||
|
foreach (QString menu, m_dict_menu.keys()) {
|
||||||
|
if(menu == "数字量状态" || menu == "模拟量状态")
|
||||||
|
ui->comboBox->addItem(menu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CStatusDialog::loadData()
|
||||||
|
{
|
||||||
|
m_dict_menu.clear();
|
||||||
|
QSqlQuery sqlQueue;
|
||||||
|
m_pObjDbInterface->execute("SELECT MENU_NAME,ACTUAL_VALUE,DISPLAY_VALUE FROM dict_menu_info", sqlQueue);
|
||||||
|
if(sqlQueue.isActive())
|
||||||
|
{
|
||||||
|
while(sqlQueue.next())
|
||||||
|
{
|
||||||
|
QString menu = sqlQueue.value("MENU_NAME").toString();
|
||||||
|
int value = sqlQueue.value("ACTUAL_VALUE").toInt();
|
||||||
|
QString desc = sqlQueue.value("DISPLAY_VALUE").toString();
|
||||||
|
|
||||||
|
QMap<QString,QMap<int,QString > >::iterator it =m_dict_menu.find(menu);
|
||||||
|
if(it != m_dict_menu.end())
|
||||||
|
{
|
||||||
|
QMap<int,QString >& valueDesc = it.value();
|
||||||
|
valueDesc[value] = desc;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
QMap<int,QString > valueDesc;
|
||||||
|
valueDesc[value] = desc;
|
||||||
|
m_dict_menu[menu] = valueDesc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CStatusDialog::setCheck(quint64 status)
|
||||||
|
{
|
||||||
|
QString allStatus = QString("%1,").arg(status);
|
||||||
|
for ( int i=0; i<m_listItem.count(); i++ )
|
||||||
|
{
|
||||||
|
QListWidgetItem *item = m_listItem.at(i);
|
||||||
|
if ( status & quint64(1)<<(item->data(Qt::UserRole).toInt()) )
|
||||||
|
{
|
||||||
|
item->setCheckState(Qt::Checked);
|
||||||
|
item->setTextColor(Qt::red);
|
||||||
|
allStatus=allStatus+item->text()+",";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item->setCheckState(Qt::Unchecked);
|
||||||
|
item->setTextColor(Qt::black);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
allStatus.chop(1);
|
||||||
|
allStatus=allStatus+"。";
|
||||||
|
emit signal_selectTextEdit(allStatus,m_allName,m_value);
|
||||||
|
all_textEditQst="当前标签为"+m_allName+", 值为"
|
||||||
|
+QString::number(m_value)+", 状态为"
|
||||||
|
+allStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CStatusDialog::resetView()
|
||||||
|
{
|
||||||
|
ui->listWidget->clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CStatusDialog::search()
|
||||||
|
{
|
||||||
|
QString lineText = ui->lineEdit->text();
|
||||||
|
if(lineText.isEmpty())
|
||||||
|
{
|
||||||
|
N_MessageBox::warning(this,tr("提示"),tr("请输入状态值!"));
|
||||||
|
}
|
||||||
|
quint64 status = lineText.toULongLong();
|
||||||
|
setCheck(status);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CStatusDialog::switchWidget(const QString &text)
|
||||||
|
{
|
||||||
|
resetView();
|
||||||
|
m_listItem.clear();
|
||||||
|
QMap<int,QString> valueDesc = m_dict_menu.value(text);
|
||||||
|
QMap<int,QString>::iterator it =valueDesc.begin();
|
||||||
|
while (it != valueDesc.end()) {
|
||||||
|
QListWidgetItem *item;
|
||||||
|
item = new QListWidgetItem();
|
||||||
|
item->setFlags(item->flags() & ~Qt::ItemIsEnabled & ~Qt::ItemIsSelectable);
|
||||||
|
// item->setText(QString::number(it.key())+":"+ it.value());
|
||||||
|
item->setText(it.value());
|
||||||
|
item->setData(Qt::UserRole,it.key());
|
||||||
|
item->setCheckState(Qt::Unchecked);
|
||||||
|
ui->listWidget->addItem(item);
|
||||||
|
m_listItem.append(item);
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
45
product/src/tools/debug_tool_v2/CStatusDialog.h
Normal file
45
product/src/tools/debug_tool_v2/CStatusDialog.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#ifndef CSTATUSDIALOG_H
|
||||||
|
#define CSTATUSDIALOG_H
|
||||||
|
|
||||||
|
#include "pub_widget/CustomDialog.h"
|
||||||
|
#include "CSystemResources.h"
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QListWidgetItem>
|
||||||
|
namespace Ui {
|
||||||
|
class CStatusDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CStatusDialog : public CustomUiDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CStatusDialog(CSystemResources *_p,QWidget *parent);
|
||||||
|
~CStatusDialog();
|
||||||
|
bool initDbInterface();
|
||||||
|
void initData(int type,int status,QString allName,int value);
|
||||||
|
QString all_textEditQstring();
|
||||||
|
private:
|
||||||
|
void initCombox();
|
||||||
|
void loadData();
|
||||||
|
void setCheck(quint64 status);
|
||||||
|
void resetView();
|
||||||
|
private slots:
|
||||||
|
void search();
|
||||||
|
void switchWidget(const QString& text);
|
||||||
|
signals:
|
||||||
|
void signal_selectTextEdit(QString allStatus,QString m_allName,int m_value);
|
||||||
|
private:
|
||||||
|
Ui::CStatusDialog *ui;
|
||||||
|
iot_dbms::CDbApi *m_pObjDbInterface;
|
||||||
|
CSystemResources *m_pSystemResources;
|
||||||
|
QMap<QString,QMap<int,QString > > m_dict_menu;
|
||||||
|
QList<QListWidgetItem *> m_listItem;
|
||||||
|
QString all_textEditQst;
|
||||||
|
QVector<QString> m_allNameVec;
|
||||||
|
QString m_allName;
|
||||||
|
int m_value;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CSTATUSDIALOG_H
|
||||||
83
product/src/tools/debug_tool_v2/CStatusDialog.ui
Normal file
83
product/src/tools/debug_tool_v2/CStatusDialog.ui
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CStatusDialog</class>
|
||||||
|
<widget class="QDialog" name="CStatusDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>328</width>
|
||||||
|
<height>481</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QListWidget" name="listWidget"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QWidget" name="widget" native="true">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>80</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>类型:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBox"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>值:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>46</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>查询</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
209
product/src/tools/debug_tool_v2/CSystemResources.cpp
Normal file
209
product/src/tools/debug_tool_v2/CSystemResources.cpp
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
#include "CSystemResources.h"
|
||||||
|
#include <QString>
|
||||||
|
CSystemResources::CSystemResources()
|
||||||
|
{
|
||||||
|
m_pObjDbInterface = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
CSystemResources::~CSystemResources()
|
||||||
|
{
|
||||||
|
releaseResources();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//设置权限用户Id
|
||||||
|
void CSystemResources::setPermUserId(int &_userID)
|
||||||
|
{
|
||||||
|
m_nPermUserID = _userID;
|
||||||
|
}
|
||||||
|
//设置权限用户组ID
|
||||||
|
void CSystemResources::setPermUserGroupId(int &_userGroupId)
|
||||||
|
{
|
||||||
|
m_nPermUserGroupID = _userGroupId;
|
||||||
|
}
|
||||||
|
//初始化一些系统资源
|
||||||
|
int CSystemResources::initSystemResources()
|
||||||
|
{
|
||||||
|
initLogSystem();
|
||||||
|
if(!initMsgBus())
|
||||||
|
{
|
||||||
|
|
||||||
|
qDebug() << QObject::tr("初始化消息总线失败") <<endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if(!initDbInterface())
|
||||||
|
{
|
||||||
|
|
||||||
|
qDebug() << QObject::tr("初始化数据库接口失败") <<endl;
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
if(!initLcId2DomainId())
|
||||||
|
{
|
||||||
|
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
if(!initSysVariable())
|
||||||
|
{
|
||||||
|
|
||||||
|
return -4;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
//得到数据库的接口
|
||||||
|
iot_dbms::CDbApi *CSystemResources::getDbInterface()
|
||||||
|
{
|
||||||
|
return m_pObjDbInterface;
|
||||||
|
}
|
||||||
|
//locationId到DomainID的映射
|
||||||
|
int CSystemResources::getDomainIdByLocationId(int locationId)
|
||||||
|
{
|
||||||
|
return m_mapLocationId2DomainId[locationId];
|
||||||
|
}
|
||||||
|
//通过子系统得到应用信息
|
||||||
|
int CSystemResources::getAppInfoBySubSystemId(int SubSystemId, iot_public::SAppInfo &appInfo)
|
||||||
|
{
|
||||||
|
m_pSysInfoInterfacePtr->getAppInfoBySubsystemId(SubSystemId,appInfo);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//得到进程名
|
||||||
|
QString CSystemResources::getStrSrcTag()
|
||||||
|
{
|
||||||
|
return m_strSrcTag;
|
||||||
|
}
|
||||||
|
//得到当前域ID
|
||||||
|
int CSystemResources::getSrcDomainId()
|
||||||
|
{
|
||||||
|
return m_nSrcDomainID;
|
||||||
|
}
|
||||||
|
//得到当前应用ID
|
||||||
|
int CSystemResources::getAppId()
|
||||||
|
{
|
||||||
|
return m_nAppID;
|
||||||
|
}
|
||||||
|
//得到当前主机名
|
||||||
|
QString CSystemResources::getHostName()
|
||||||
|
{
|
||||||
|
return m_strHostName;
|
||||||
|
}
|
||||||
|
//得到当前实例名
|
||||||
|
QString CSystemResources::getInstName()
|
||||||
|
{
|
||||||
|
return m_strInstName;
|
||||||
|
}
|
||||||
|
//得到通讯器名
|
||||||
|
QString CSystemResources::getCommName()
|
||||||
|
{
|
||||||
|
return m_strCommName;
|
||||||
|
}
|
||||||
|
//得到权限用户ID
|
||||||
|
int CSystemResources::getPermUserId()
|
||||||
|
{
|
||||||
|
return m_nPermUserID;
|
||||||
|
}
|
||||||
|
//得到权限用户组ID
|
||||||
|
int CSystemResources::getPermUserGroupId()
|
||||||
|
{
|
||||||
|
return m_nPermUserGroupID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void CSystemResources::initLogSystem()
|
||||||
|
{
|
||||||
|
//iot_public::StartLogSystem("PUBLIC", "debugTool");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSystemResources::initMsgBus()
|
||||||
|
{
|
||||||
|
//< 初始化消息总线库
|
||||||
|
if (!(iot_net::initMsgBus("debugToolAppName", "debugToolProcessName")))
|
||||||
|
{
|
||||||
|
qDebug() << "初始化消息总线失败" <<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!iot_service::CDpcdaForApp::initGlobalThread())
|
||||||
|
{
|
||||||
|
qDebug() << "初始化消息总线全局处理线程失败" <<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSystemResources::initDbInterface()
|
||||||
|
{
|
||||||
|
m_pObjDbInterface = new iot_dbms::CDbApi(DB_CONN_MODEL_READ);
|
||||||
|
if(!m_pObjDbInterface->open())
|
||||||
|
{
|
||||||
|
qDebug() << "数据库接口打开失败" <<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSystemResources::initLcId2DomainId()
|
||||||
|
{
|
||||||
|
QSqlQuery locIdAndDomId;
|
||||||
|
QString strSql = "SELECT LOCATION_ID,DOMAIN_ID FROM sys_model_location_info ORDER BY LOCATION_ID";
|
||||||
|
|
||||||
|
m_pObjDbInterface->execute(strSql,locIdAndDomId);
|
||||||
|
if(locIdAndDomId.isActive())
|
||||||
|
{
|
||||||
|
int locationId;
|
||||||
|
int domainId;
|
||||||
|
while(locIdAndDomId.next())
|
||||||
|
{
|
||||||
|
locationId = locIdAndDomId.value("LOCATION_ID").toInt();
|
||||||
|
domainId = locIdAndDomId.value("DOMAIN_ID").toInt();
|
||||||
|
m_mapLocationId2DomainId[locationId] = domainId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug() << "查询表sys_model_location_info失败" <<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSystemResources::initSysVariable()
|
||||||
|
{
|
||||||
|
iot_public::SNodeInfo stNodeInfo;
|
||||||
|
iot_public::createSysInfoInstance(m_pSysInfoInterfacePtr);
|
||||||
|
if(NULL == m_pSysInfoInterfacePtr)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_pSysInfoInterfacePtr->getLocalNodeInfo(stNodeInfo);
|
||||||
|
m_strSrcTag = SRC_PROCESS_NAME;
|
||||||
|
m_nSrcDomainID = stNodeInfo.nDomainId;
|
||||||
|
m_nAppID = APP_ID;
|
||||||
|
m_strHostName = QString::fromStdString(stNodeInfo.strName);
|
||||||
|
m_strInstName = SRC_INST_NMAE;
|
||||||
|
m_strCommName = SRC_COMM_NAME;
|
||||||
|
m_nPermUserID = -1;
|
||||||
|
m_nPermUserGroupID = -1;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSystemResources::releaseResources()
|
||||||
|
{
|
||||||
|
m_pSysInfoInterfacePtr.reset();
|
||||||
|
|
||||||
|
if(NULL != m_pObjDbInterface)
|
||||||
|
{
|
||||||
|
m_pObjDbInterface->close();
|
||||||
|
m_pObjDbInterface = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
iot_service::CDpcdaForApp::releaseGlobalThread();
|
||||||
|
|
||||||
|
//< 释放消息总线库
|
||||||
|
iot_net::releaseMsgBus();
|
||||||
|
|
||||||
|
//< 停止日志系统
|
||||||
|
//iot_public::StopLogSystem();
|
||||||
|
}
|
||||||
78
product/src/tools/debug_tool_v2/CSystemResources.h
Normal file
78
product/src/tools/debug_tool_v2/CSystemResources.h
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
#ifndef CSYSTEMRESOURCES_H
|
||||||
|
#define CSYSTEMRESOURCES_H
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QMap>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "db_api_ex/CDbApi.h"
|
||||||
|
#include "pub_sysinfo_api/SysInfoApi.h"
|
||||||
|
#include "pub_logger_api/logger.h"
|
||||||
|
#include "net_msg_bus_api/MsgBusApi.h"
|
||||||
|
#include "dp_chg_data_api/CDpcdaForApp.h"
|
||||||
|
#include "Common.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define SRC_PROCESS_NAME "debug_tool"
|
||||||
|
#define APP_ID 4
|
||||||
|
#define SRC_INST_NMAE "debugToolInst"
|
||||||
|
#define SRC_COMM_NAME "debugToolCtlComm"
|
||||||
|
//#define USER_ID 1
|
||||||
|
//#define USER_GROUP_ID 1
|
||||||
|
|
||||||
|
|
||||||
|
class CSystemResources
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CSystemResources();
|
||||||
|
~CSystemResources();
|
||||||
|
|
||||||
|
|
||||||
|
void setPermUserId(int &_userID);
|
||||||
|
void setPermUserGroupId(int &_userGroupId);
|
||||||
|
|
||||||
|
int initSystemResources();
|
||||||
|
|
||||||
|
iot_dbms::CDbApi *getDbInterface();
|
||||||
|
|
||||||
|
int getDomainIdByLocationId(int locationId);
|
||||||
|
int getAppInfoBySubSystemId(int SubSystemId,iot_public::SAppInfo &appInfo);
|
||||||
|
|
||||||
|
QString getStrSrcTag();
|
||||||
|
int getSrcDomainId();
|
||||||
|
int getAppId();
|
||||||
|
QString getHostName();
|
||||||
|
QString getInstName();
|
||||||
|
QString getCommName();
|
||||||
|
int getPermUserId();
|
||||||
|
int getPermUserGroupId();
|
||||||
|
void releaseResources();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void initLogSystem();
|
||||||
|
bool initMsgBus();
|
||||||
|
bool initDbInterface();
|
||||||
|
bool initLcId2DomainId();
|
||||||
|
bool initSysVariable();
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
iot_dbms::CDbApi *m_pObjDbInterface;
|
||||||
|
QMap<int,int> m_mapLocationId2DomainId;
|
||||||
|
QString m_strSrcTag ; //源标签(即发送端进程名)
|
||||||
|
int m_nSrcDomainID ; //消息发送源域名
|
||||||
|
int m_nAppID ; //所属应用ID
|
||||||
|
QString m_strHostName ; //发送端主机名
|
||||||
|
QString m_strInstName ; //发送端实例名
|
||||||
|
QString m_strCommName ;
|
||||||
|
int m_nPermUserID ; //发送端用户ID
|
||||||
|
int m_nPermUserGroupID ; //发送端用户组ID
|
||||||
|
iot_public::CSysInfoInterfacePtr m_pSysInfoInterfacePtr;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // CSYSTEMRESOURCES_H
|
||||||
73
product/src/tools/debug_tool_v2/CUpdateThread.cpp
Normal file
73
product/src/tools/debug_tool_v2/CUpdateThread.cpp
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
#include "CUpdateThread.h"
|
||||||
|
#include "pub_logger_api/logger.h"
|
||||||
|
|
||||||
|
CUpdateThread::CUpdateThread(QObject *parent) : QThread(parent)
|
||||||
|
{
|
||||||
|
bIsRun = true;
|
||||||
|
m_pMbComm = new iot_net::CMbCommunicator("updatePoint");
|
||||||
|
//< 获取通讯器名称(可选)
|
||||||
|
qDebug() << "My communicator name is " << m_pMbComm->getName().c_str() << endl;
|
||||||
|
|
||||||
|
if (m_pMbComm->addSub(0, CH_SCADA_TO_HMI_DATA_CHANGE))
|
||||||
|
qDebug() << "addSub() successed !" << endl;
|
||||||
|
else
|
||||||
|
qDebug() << "addSub() failed !" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
CUpdateThread::~CUpdateThread()
|
||||||
|
{
|
||||||
|
stopThread();
|
||||||
|
quit();
|
||||||
|
wait();
|
||||||
|
m_pMbComm->delSub(0, CH_SCADA_TO_HMI_DATA_CHANGE);
|
||||||
|
delete m_pMbComm;
|
||||||
|
m_pMbComm = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUpdateThread::run()
|
||||||
|
{
|
||||||
|
while (bIsRun)
|
||||||
|
{
|
||||||
|
if(m_pMbComm->recvMsg(objMsg,1000))
|
||||||
|
{
|
||||||
|
if(!objMsg.isValid())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (objMsg.getChannelID())
|
||||||
|
{
|
||||||
|
case CH_SCADA_TO_HMI_DATA_CHANGE:
|
||||||
|
if(iot_idl::MT_DP_CHANGE_DATA == objMsg.getMsgType())
|
||||||
|
{
|
||||||
|
parserMsg(objMsg);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUpdateThread::stopThread()
|
||||||
|
{
|
||||||
|
bIsRun = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CUpdateThread::parserMsg(const iot_net::CMbMessage &msg)
|
||||||
|
{
|
||||||
|
::iot_idl::SRealTimeDataPkg changeDataPackage;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(changeDataPackage.ParseFromArray(msg.getDataPtr(),(int)msg.getDataSize()))
|
||||||
|
{
|
||||||
|
signal_updatePntRealData(changeDataPackage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
34
product/src/tools/debug_tool_v2/CUpdateThread.h
Normal file
34
product/src/tools/debug_tool_v2/CUpdateThread.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef CUPDATETHREAD_H
|
||||||
|
#define CUPDATETHREAD_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <QThread>
|
||||||
|
#include <QDebug>
|
||||||
|
#include "net_msg_bus_api/MsgBusApi.h"
|
||||||
|
#include "MessageChannel.h"
|
||||||
|
#include "DataProcMessage.pb.h"
|
||||||
|
|
||||||
|
|
||||||
|
class CUpdateThread : public QThread
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit CUpdateThread(QObject *parent = 0 );
|
||||||
|
~CUpdateThread();
|
||||||
|
|
||||||
|
virtual void run() Q_DECL_OVERRIDE;
|
||||||
|
void stopThread();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void signal_updatePntRealData(iot_idl::SRealTimeDataPkg stRealData);
|
||||||
|
|
||||||
|
private:
|
||||||
|
iot_net::CMbCommunicator *m_pMbComm;
|
||||||
|
iot_net::CMbMessage objMsg;
|
||||||
|
bool bIsRun;
|
||||||
|
|
||||||
|
private:
|
||||||
|
int parserMsg(const iot_net::CMbMessage &);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CUPDATETHREAD_H
|
||||||
180
product/src/tools/debug_tool_v2/ComProtocolThread.h
Normal file
180
product/src/tools/debug_tool_v2/ComProtocolThread.h
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
#ifndef HEARTBEATTHREAD_H
|
||||||
|
#define HEARTBEATTHREAD_H
|
||||||
|
|
||||||
|
#include <QThread>
|
||||||
|
#include <QMutexLocker>
|
||||||
|
#include <QByteArray>
|
||||||
|
#include "FesSimProtocol.h"
|
||||||
|
|
||||||
|
const int EN_HeartBeatCount =500;
|
||||||
|
const int EN_MaxRespBufSize = 4096;
|
||||||
|
const int EN_MaxCmdBufSize = 1024;
|
||||||
|
const int EN_MaxReportBufSize = 51200; //1024*50;sio monitor buffer
|
||||||
|
|
||||||
|
//通道连接状态
|
||||||
|
const int CN_CommDisconnect =0; //链接关闭
|
||||||
|
const int CN_CommConnect =1; //链接成功
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
SFesSimAiParam param;
|
||||||
|
SFesSimAiData value;
|
||||||
|
}SFesSimAi;
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
SFesSimFwAiParam param;
|
||||||
|
SFesSimAiData value;
|
||||||
|
}SFesSimFwAi;
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
int RtuNo; //RTU号
|
||||||
|
int Used; //使用标志
|
||||||
|
int MaxPoints;
|
||||||
|
char RtuName[CN_FesMaxNameSize]; //RTU
|
||||||
|
int AiNum;
|
||||||
|
SFesSimAi *pAi;
|
||||||
|
}SAiMonRtu;
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
int RtuNo; //RTU号
|
||||||
|
int Used; //使用标志
|
||||||
|
int MaxPoints;
|
||||||
|
char RtuName[CN_FesMaxNameSize]; //RTU
|
||||||
|
int AiNum;
|
||||||
|
SFesSimFwAi *pAi;
|
||||||
|
}SFwAiMonRtu;
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
SFesSimDiParam param;
|
||||||
|
SFesSimDiData value;
|
||||||
|
}SFesSimDi;
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
int RtuNo; //RTU号
|
||||||
|
int Used; //使用标志
|
||||||
|
int MaxPoints;
|
||||||
|
char RtuName[CN_FesMaxNameSize]; //RTU
|
||||||
|
int DiNum;
|
||||||
|
SFesSimDi *pDi;
|
||||||
|
}SDiMonRtu;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
SFesSimFwDiParam param;
|
||||||
|
SFesSimDiData value;
|
||||||
|
}SFesSimFwDi;
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
int RtuNo; //RTU号
|
||||||
|
int Used; //使用标志
|
||||||
|
int MaxPoints;
|
||||||
|
char RtuName[CN_FesMaxNameSize]; //RTU
|
||||||
|
int DiNum;
|
||||||
|
SFesSimFwDi *pDi;
|
||||||
|
}SFwDiMonRtu;
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
SFesSimAccParam param;
|
||||||
|
SFesSimAccData value;
|
||||||
|
}SFesSimAcc;
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
int RtuNo; //RTU号
|
||||||
|
int Used; //使用标志
|
||||||
|
int MaxPoints;
|
||||||
|
char RtuName[CN_FesMaxNameSize]; //RTU
|
||||||
|
int AccNum;
|
||||||
|
SFesSimAcc *pAcc;
|
||||||
|
}SAccMonRtu;
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
SFesSimFwAccParam param;
|
||||||
|
SFesSimAccData value;
|
||||||
|
}SFesSimFwAcc;
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
int RtuNo; //RTU号
|
||||||
|
int Used; //使用标志
|
||||||
|
int MaxPoints;
|
||||||
|
char RtuName[CN_FesMaxNameSize]; //RTU
|
||||||
|
int AccNum;
|
||||||
|
SFesSimFwAcc *pAcc;
|
||||||
|
}SFwAccMonRtu;
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
SFesSimMiParam param;
|
||||||
|
SFesSimMiData value;
|
||||||
|
}SFesSimMi;
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
int RtuNo; //RTU号
|
||||||
|
int Used; //使用标志
|
||||||
|
int MaxPoints;
|
||||||
|
char RtuName[CN_FesMaxNameSize]; //RTU
|
||||||
|
int DiNum;
|
||||||
|
SFesSimMi *pMi;
|
||||||
|
}SMiMonRtu;
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
SFesSimFwMiParam param;
|
||||||
|
SFesSimMiData value;
|
||||||
|
}SFesSimFwMi;
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
int RtuNo; //RTU号
|
||||||
|
int Used; //使用标志
|
||||||
|
int MaxPoints;
|
||||||
|
char RtuName[CN_FesMaxNameSize]; //RTU
|
||||||
|
int DiNum;
|
||||||
|
SFesSimFwMi *pMi;
|
||||||
|
}SFwMiMonRtu;
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
int RtuNo; //RTU号
|
||||||
|
int Used; //使用标志
|
||||||
|
int MaxPoints;
|
||||||
|
char RtuName[CN_FesMaxNameSize]; //RTU
|
||||||
|
int DiNum;
|
||||||
|
SFesSimAoParam *pAo;
|
||||||
|
}SAoMonRtu;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
int RtuNo; //RTU号
|
||||||
|
int Used; //使用标志
|
||||||
|
int MaxPoints;
|
||||||
|
char RtuName[CN_FesMaxNameSize]; //RTU
|
||||||
|
int DiNum;
|
||||||
|
SFesSimDoParam *pDo;
|
||||||
|
}SDoMonRtu;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
int RtuNo; //RTU号
|
||||||
|
int Used; //使用标志
|
||||||
|
int MaxPoints;
|
||||||
|
char RtuName[CN_FesMaxNameSize]; //RTU
|
||||||
|
int DiNum;
|
||||||
|
SFesSimMoParam *pMo;
|
||||||
|
}SMoMonRtu;
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
int RtuNo; //RTU号
|
||||||
|
int Used; //使用标志
|
||||||
|
int MaxPoints;
|
||||||
|
char RtuName[CN_FesMaxNameSize]; //RTU
|
||||||
|
}SSettingMonRtu;
|
||||||
|
|
||||||
|
//本结构是通道管理的内部结构,备用通道收发的统计数据(RxNum、TxNum、ErrCnt)在自己通道结构中,
|
||||||
|
//其他数据都在主通道结构中
|
||||||
|
typedef struct {
|
||||||
|
uint32 Writex;//写指针
|
||||||
|
uint32 Readx; //读指针
|
||||||
|
unsigned char Data[EN_MaxReportBufSize]; //数据内容
|
||||||
|
}SChanRxBuf;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class PiMonDlg;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
43
product/src/tools/debug_tool_v2/CommonSheet.cpp
Normal file
43
product/src/tools/debug_tool_v2/CommonSheet.cpp
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#include "CommonSheet.h"
|
||||||
|
#include <QApplication>
|
||||||
|
#include "pub_utility_api/FileStyle.h"
|
||||||
|
|
||||||
|
CommonSheet::CommonSheet()
|
||||||
|
{
|
||||||
|
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("debug_tool.qss","zh","light");
|
||||||
|
QFile qssfile2(QString::fromStdString(strFullPath));
|
||||||
|
qssfile2.open(QFile::ReadOnly);
|
||||||
|
if (qssfile2.isOpen())
|
||||||
|
{
|
||||||
|
qss += QLatin1String(qssfile2.readAll());
|
||||||
|
qssfile2.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!qss.isEmpty())
|
||||||
|
{
|
||||||
|
m_stSheet = qss;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CommonSheet::getSheet(QString &sheet)
|
||||||
|
{
|
||||||
|
if(m_stSheet.isEmpty())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
sheet = m_stSheet;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
15
product/src/tools/debug_tool_v2/CommonSheet.h
Normal file
15
product/src/tools/debug_tool_v2/CommonSheet.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef COMMONSHEET_H
|
||||||
|
#define COMMONSHEET_H
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
|
#include <QString>
|
||||||
|
class CommonSheet
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CommonSheet();
|
||||||
|
bool getSheet(QString &sheet);
|
||||||
|
private:
|
||||||
|
QString m_stSheet;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COMMONSHEET_H
|
||||||
2195
product/src/tools/debug_tool_v2/FesDef.h
Normal file
2195
product/src/tools/debug_tool_v2/FesDef.h
Normal file
File diff suppressed because it is too large
Load Diff
321
product/src/tools/debug_tool_v2/FesRdbStruct.h
Normal file
321
product/src/tools/debug_tool_v2/FesRdbStruct.h
Normal file
@ -0,0 +1,321 @@
|
|||||||
|
/*
|
||||||
|
@file fesrdbstruct.cpp
|
||||||
|
@brief fes 实时库数据结构
|
||||||
|
|
||||||
|
@author thxiao
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
const int CN_FesMaxTableNameSize =32; //TagName最大长度
|
||||||
|
const int CN_FesMaxColumnNameSize =16; //TagName最大长度
|
||||||
|
const int CN_FesMaxTagSize =64; //TagName最大长度
|
||||||
|
const int CN_FesMaxDescSize =128; //TagName最大长度
|
||||||
|
const int CN_FesMaxNameSize =64; //Name最大长度
|
||||||
|
const int CN_FesMaxNetDescSize =32; //"127.0.0.1"
|
||||||
|
const int CN_FesMaxChangeChanNum =4; //RTU允许切换的最大通道数
|
||||||
|
const int CN_FesMaxNetRouteNum =4; //每个通道最大路由数
|
||||||
|
|
||||||
|
#define RT_DICT_TEXT_TBL "dict_text_define"
|
||||||
|
#define RT_FES_RTU_TBL "fes_rtu_para"
|
||||||
|
#define RT_FES_CHAN_TBL "fes_channel_para"
|
||||||
|
#define RT_FES_PROTOCOL_TBL "fes_protocol"
|
||||||
|
#define RT_FES_AI_TBL "fes_analog"
|
||||||
|
#define RT_FES_AO_TBL "fes_analog_ctrl"
|
||||||
|
#define RT_FES_DI_TBL "fes_digital"
|
||||||
|
#define RT_FES_DO_TBL "fes_digital_ctrl"
|
||||||
|
#define RT_FES_ACC_TBL "fes_accuml"
|
||||||
|
#define RT_FES_MI_TBL "fes_mix"
|
||||||
|
#define RT_FES_MO_TBL "fes_mix_ctrl"
|
||||||
|
#define RT_FES_DATA_BLOCK_TBL "fes_data_block"
|
||||||
|
#define RT_FES_DEV_INFO_TBL "fes_dev_info"
|
||||||
|
//转发点表
|
||||||
|
#define RT_FES_FW_AI_TBL "fes_forwarding_anaolg"
|
||||||
|
#define RT_FES_FW_AO_TBL "fes_forwarding_anaolg_ctrl"
|
||||||
|
#define RT_FES_FW_DI_TBL "fes_forwarding_digital"
|
||||||
|
#define RT_FES_FW_DO_TBL "fes_forwarding_digital_ctrl"
|
||||||
|
#define RT_FES_FW_ACC_TBL "fes_forwarding_accuml"
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
int RtuNo; //RTU号
|
||||||
|
char TagName[CN_FesMaxTagSize]; //RTU
|
||||||
|
char RtuName[CN_FesMaxNameSize]; //RTU
|
||||||
|
char RtuDesc[CN_FesMaxDescSize];//rtu描述
|
||||||
|
int nLocationId;//位置
|
||||||
|
int nSubSystem; //专业
|
||||||
|
int Used; //使用标志
|
||||||
|
int RtuAddr; //RTU地址
|
||||||
|
int ChanNo; //通道号
|
||||||
|
int RecvFailLimit; //连续接收数据失败计数(>5代表停运)
|
||||||
|
}SFesRdbRtuParam;
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
int ChanNo; //通道号
|
||||||
|
char TagName[CN_FesMaxTagSize]; //RTU
|
||||||
|
char ChanName[CN_FesMaxNameSize];//通道名
|
||||||
|
char ChanDesc[CN_FesMaxDescSize];//通道描述
|
||||||
|
int nLocationId; //位置
|
||||||
|
int nSubSystem; //专业
|
||||||
|
int nRegionId; //责任区ID
|
||||||
|
int Used; //通道使用标志
|
||||||
|
double ErrRateLimit; //帧错误标准
|
||||||
|
char NetDesc1[CN_FesMaxNetDescSize]; //通道IP
|
||||||
|
int PortNo1; //通道网络端口
|
||||||
|
char NetDesc2[CN_FesMaxNetDescSize]; //通道IP
|
||||||
|
int PortNo2; //通道网络端口
|
||||||
|
char NetDesc3[CN_FesMaxNetDescSize]; //通道IP
|
||||||
|
int PortNo3; //通道网络端口
|
||||||
|
char NetDesc4[CN_FesMaxNetDescSize]; //通道IP
|
||||||
|
int PortNo4; //通道网络端口
|
||||||
|
int CommProperty; //通道性质 0:接收通道 1:转发通道
|
||||||
|
int CommType; //通信方式
|
||||||
|
int ChanMode; //通道方式0:双通道通信方式 1:单通道方式
|
||||||
|
int ProtocolId; //规约类型
|
||||||
|
int ConnectWaitSec; //连接等待重连时间,单位秒
|
||||||
|
int ConnectTimeout; //链接超时,单位秒
|
||||||
|
int RetryTimes; //最大重连次数
|
||||||
|
int RespTimeout; //响应超时,单位毫秒
|
||||||
|
int RecvTimeout; //接收超时,单位秒,判断是否需要端开连接重新连接
|
||||||
|
int MaxRxSize; //接收缓存区长度
|
||||||
|
int MaxTxSize; //发送缓存区长度
|
||||||
|
int BackupChanNo1;//实际配置的备用通道号
|
||||||
|
int BackupChanNo2;//实际配置的备用通道号
|
||||||
|
int BackupChanNo3;//实际配置的备用通道号
|
||||||
|
int ResParam1;
|
||||||
|
int ResParam2;
|
||||||
|
int ResParam3;
|
||||||
|
int ResParam4;
|
||||||
|
}SFesRdbChanParam;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int ProtocolId;
|
||||||
|
char Name[CN_FesMaxNameSize];
|
||||||
|
}SFesRdbProtocolParam;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int RtuNo;
|
||||||
|
int Index; //序号
|
||||||
|
int FunCode; //功能码(即MODBUS中的命令码)
|
||||||
|
int StartAddr; //数据起始地址
|
||||||
|
int DataLen; //数据长度
|
||||||
|
int PollTime; //命令下发周期(相对时间,一个周期=50ms)
|
||||||
|
int FrameType; //帧类别
|
||||||
|
int IsCreateSoe; //对遥信帧有效,0:不产生SOE,1:产生SOE
|
||||||
|
int Param1; //保留参数1
|
||||||
|
int Param2; //保留参数2
|
||||||
|
}SFesRdbDataBlock;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int RtuNo;
|
||||||
|
int PointNo;
|
||||||
|
char TableName[CN_FesMaxTableNameSize];
|
||||||
|
char ColumnName[CN_FesMaxColumnNameSize];
|
||||||
|
char TagName[CN_FesMaxTagSize];
|
||||||
|
char PointTagName[CN_FesMaxTagSize];
|
||||||
|
int IsFilter; //是否过滤AI突变
|
||||||
|
int Percent; //突变百分比
|
||||||
|
int DeadBandType;//死区类型
|
||||||
|
double DeadBand; //死区值
|
||||||
|
double ZeroBand; //归零死区
|
||||||
|
double Base; //基值
|
||||||
|
double Coeff; //系数;
|
||||||
|
double MaxRange; //度上限
|
||||||
|
double MinRange; //度下限
|
||||||
|
int Param1; //规约参数,每种协议含义相同。 如modbus FunNo
|
||||||
|
int Param2; //规约参数,每种协议含义相同。 如modbus DataAddress
|
||||||
|
int Param3; //规约参数,每种协议含义相同。 如modbus InfoNo
|
||||||
|
int Param4; //规约参数,每种协议含义相同。
|
||||||
|
}SFesRdbAiParam;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int RtuNo;
|
||||||
|
int PointNo;
|
||||||
|
char TableName[CN_FesMaxTableNameSize];
|
||||||
|
char ColumnName[CN_FesMaxColumnNameSize];
|
||||||
|
char TagName[CN_FesMaxTagSize];
|
||||||
|
char PointTagName[CN_FesMaxTagSize];
|
||||||
|
int IsFilterErr; //是否过滤错误DI
|
||||||
|
int IsFilterDisturb;//是否过滤DI抖动
|
||||||
|
int DisturbTime; //抖动时限
|
||||||
|
int Revers; //取反
|
||||||
|
int Param1; //规约参数,每种协议含义相同。 如modbus FunNo
|
||||||
|
int Param2; //规约参数,每种协议含义相同。 如modbus DataAddress
|
||||||
|
int Param3; //规约参数,每种协议含义相同。 如modbus InfoNo
|
||||||
|
int Param4; //规约参数,每种协议各不相同。
|
||||||
|
}SFesRdbDiParam;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int RtuNo;
|
||||||
|
int PointNo;
|
||||||
|
char TableName[CN_FesMaxTableNameSize];
|
||||||
|
char ColumnName[CN_FesMaxColumnNameSize];
|
||||||
|
char TagName[CN_FesMaxTagSize];
|
||||||
|
char PointTagName[CN_FesMaxTagSize];
|
||||||
|
double Base; //基值
|
||||||
|
double Coeff; //系数;
|
||||||
|
int Param1; //规约参数,每种协议各不相同。 如modbus FunNo
|
||||||
|
int Param2; //规约参数,每种协议各不相同。 如modbus DataAddress
|
||||||
|
int Param3; //规约参数,每种协议各不相同。 如modbus InfoNo
|
||||||
|
int Param4; //规约参数,每种协议各不相同。 如modbus ValueType
|
||||||
|
}SFesRdbAccParam;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int RtuNo;
|
||||||
|
int PointNo;
|
||||||
|
char TableName[CN_FesMaxTableNameSize];
|
||||||
|
char ColumnName[CN_FesMaxColumnNameSize];
|
||||||
|
char TagName[CN_FesMaxTagSize];
|
||||||
|
char PointTagName[CN_FesMaxTagSize];
|
||||||
|
int Base; //基值
|
||||||
|
int Coeff; //系数;
|
||||||
|
int MaxRange; //度上限
|
||||||
|
int MinRange; //度下限
|
||||||
|
int Param1; //规约参数,每种协议各不相同。 如modbus FunNo
|
||||||
|
int Param2; //规约参数,每种协议各不相同。 如modbus DataAddress
|
||||||
|
int Param3; //规约参数,每种协议各不相同。 如modbus InfoNo
|
||||||
|
int Param4; //规约参数,每种协议各不相同。 如modbus ValueType
|
||||||
|
}SFesRdbMiParam;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int RtuNo;
|
||||||
|
int PointNo;
|
||||||
|
char PointTagName[CN_FesMaxTagSize];
|
||||||
|
int Revers; //取反
|
||||||
|
int Param1; //规约参数,每种协议含义相同。 如modbus FunNo
|
||||||
|
int Param2; //规约参数,每种协议含义相同。 如modbus DataAddress
|
||||||
|
int Param3; //规约参数,每种协议含义相同。 如modbus InfoNo
|
||||||
|
int Param4; //规约参数,每种协议各不相同。
|
||||||
|
}SFesRdbDoParam;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int RtuNo;
|
||||||
|
int PointNo;
|
||||||
|
char PointTagName[CN_FesMaxTagSize];
|
||||||
|
double Base; //基值
|
||||||
|
double Coeff; //系数;
|
||||||
|
double MaxRange; //度上限
|
||||||
|
double MinRange; //度下限
|
||||||
|
int Param1; //规约参数,每种协议含义相同。 如modbus FunNo
|
||||||
|
int Param2; //规约参数,每种协议含义相同。 如modbus DataAddress
|
||||||
|
int Param3; //规约参数,每种协议含义相同。 如modbus InfoNo
|
||||||
|
int Param4; //规约参数,每种协议含义相同。
|
||||||
|
}SFesRdbAoParam;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int RtuNo;
|
||||||
|
int PointNo;
|
||||||
|
char PointTagName[CN_FesMaxTagSize];
|
||||||
|
int Base; //基值
|
||||||
|
int Coeff; //系数;
|
||||||
|
int MaxRange; //度上限
|
||||||
|
int MinRange; //度下限
|
||||||
|
int Param1; //规约参数,每种协议各不相同。 如modbus FunNo
|
||||||
|
int Param2; //规约参数,每种协议各不相同。 如modbus DataAddress
|
||||||
|
int Param3; //规约参数,每种协议各不相同。 如modbus InfoNo
|
||||||
|
int Param4; //规约参数,每种协议各不相同。 如modbus ValueType
|
||||||
|
}SFesRdbMoParam;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int RtuNo;
|
||||||
|
int DevID; //FEP 的设备ID号
|
||||||
|
char DevDesc[CN_FesMaxNameSize]; //设备描述
|
||||||
|
}SFesRdbDevInfo;
|
||||||
|
//转发表Rdb结构参数
|
||||||
|
typedef struct {
|
||||||
|
char FwRtuTagName[CN_FesMaxNameSize]; //所属转发rtu
|
||||||
|
int PointId; //点ID 从0开始递增
|
||||||
|
int RemoteNo; //远动序号
|
||||||
|
char TagName[CN_FesMaxTagSize]; //采集标签名
|
||||||
|
char PointDesc[CN_FesMaxDescSize]; //点描述
|
||||||
|
char PointShortName[CN_FesMaxNameSize]; //点名缩写
|
||||||
|
char FesRtuTagName[CN_FesMaxNameSize]; //采集rtu标签
|
||||||
|
int FesRtuNo; //采集rtu号
|
||||||
|
int FesPointNo; //采集点号
|
||||||
|
int GroupNo; //组号
|
||||||
|
double Coeff; //系数;
|
||||||
|
double Base; //修正值
|
||||||
|
double DeadBand; //死区值
|
||||||
|
double ZeroDeadBand; //归零死区值
|
||||||
|
int Property; //属性
|
||||||
|
long paralong1; //备用参数1
|
||||||
|
long paralong2; //备用参数2
|
||||||
|
char parastring[CN_FesMaxNameSize]; //备用字符串
|
||||||
|
}SFesRdbFwAiParam;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char FwRtuTagName[CN_FesMaxNameSize]; //所属转发rtu
|
||||||
|
int PointId; //点ID 从0开始递增
|
||||||
|
int RemoteNo; //远动序号
|
||||||
|
char TagName[CN_FesMaxTagSize]; //采集标签名
|
||||||
|
char PointDesc[CN_FesMaxDescSize]; //点描述
|
||||||
|
char PointShortName[CN_FesMaxNameSize]; //点名缩写
|
||||||
|
char FesRtuTagName[CN_FesMaxNameSize]; //采集rtu标签
|
||||||
|
int FesRtuNo; //采集rtu号
|
||||||
|
int FesPointNo; //采集点号
|
||||||
|
int GroupNo; //组号
|
||||||
|
int Revert; //取反;
|
||||||
|
int Property; //属性
|
||||||
|
long paralong1; //备用参数1
|
||||||
|
long paralong2; //备用参数2
|
||||||
|
char parastring[CN_FesMaxNameSize]; //备用字符串
|
||||||
|
}SFesRdbFwDiParam;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char FwRtuTagName[CN_FesMaxNameSize]; //所属转发rtu
|
||||||
|
int PointId; //点ID 从0开始递增
|
||||||
|
int RemoteNo; //远动序号
|
||||||
|
char TagName[CN_FesMaxTagSize]; //采集标签名
|
||||||
|
char PointDesc[CN_FesMaxDescSize]; //点描述
|
||||||
|
char PointShortName[CN_FesMaxNameSize]; //点名缩写
|
||||||
|
char FesRtuTagName[CN_FesMaxNameSize]; //采集rtu标签
|
||||||
|
int FesRtuNo; //采集rtu号
|
||||||
|
int FesPointNo; //采集点号
|
||||||
|
int GroupNo; //组号
|
||||||
|
double Coeff; //系数;
|
||||||
|
double Base; //修正值
|
||||||
|
int Property; //属性
|
||||||
|
long paralong1; //备用参数1
|
||||||
|
long paralong2; //备用参数2
|
||||||
|
char parastring[CN_FesMaxNameSize]; //备用字符串
|
||||||
|
}SFesRdbFwAccParam;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char FwRtuTagName[CN_FesMaxNameSize]; //所属转发rtu
|
||||||
|
int PointId; //点ID 从0开始递增
|
||||||
|
int RemoteNo; //远动序号
|
||||||
|
char TagName[CN_FesMaxTagSize]; //采集标签名
|
||||||
|
char PointDesc[CN_FesMaxDescSize]; //点描述
|
||||||
|
char PointShortName[CN_FesMaxNameSize]; //点名缩写
|
||||||
|
char FesRtuTagName[CN_FesMaxNameSize]; //采集rtu标签
|
||||||
|
int FesRtuNo; //采集rtu号
|
||||||
|
int FesPointNo; //采集点号
|
||||||
|
int GroupNo; //组号
|
||||||
|
int Property; //属性
|
||||||
|
long paralong1; //备用参数1
|
||||||
|
long paralong2; //备用参数2
|
||||||
|
char parastring[CN_FesMaxNameSize]; //备用字符串
|
||||||
|
}SFesRdbFwAoParam;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char FwRtuTagName[CN_FesMaxNameSize]; //所属转发rtu
|
||||||
|
int PointId; //点ID 从0开始递增
|
||||||
|
int RemoteNo; //远动序号
|
||||||
|
char TagName[CN_FesMaxTagSize]; //采集标签名
|
||||||
|
char PointDesc[CN_FesMaxDescSize]; //点描述
|
||||||
|
char PointShortName[CN_FesMaxNameSize]; //点名缩写
|
||||||
|
char FesRtuTagName[CN_FesMaxNameSize]; //采集rtu标签
|
||||||
|
int FesRtuNo; //采集rtu号
|
||||||
|
int FesPointNo; //采集点号
|
||||||
|
int GroupNo; //组号
|
||||||
|
int Property; //属性
|
||||||
|
long paralong1; //备用参数1
|
||||||
|
long paralong2; //备用参数2
|
||||||
|
char parastring[CN_FesMaxNameSize]; //备用字符串
|
||||||
|
}SFesRdbFwDoParam;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int nFaultCode;
|
||||||
|
char FaultName[CN_FesMaxNameSize]; //Fault Name
|
||||||
|
}SFesRdbFaultCode;
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user