新增滤波功能

This commit is contained in:
CHINAMI-TV221UM\Administrator 2024-07-04 15:23:26 +08:00
parent 8765f74530
commit a630c5a85b
35 changed files with 1992 additions and 270 deletions

130
Backup.cpp Normal file
View File

@ -0,0 +1,130 @@
#include "Backup.h"
#include "ui_BackUp.h"
#include <QFileDialog>
#include <QProcess>
CBackup::CBackup(QWidget *parent) :
QWidget(parent),
ui(new Ui::CBackup)
{
ui->setupUi(this);
backup_path = "";
}
CBackup::~CBackup()
{
delete ui;
}
void CBackup::on_pushButton_path_clicked()
{
QString dirpath = QFileDialog::getExistingDirectory(this, QStringLiteral("选择目录"), "./", QFileDialog::ShowDirsOnly);
if(dirpath.isEmpty()) dirpath = QDir::currentPath();
ui->lineEdit_filepath->setText(dirpath + "/");
backup_path = dirpath;
}
void CBackup::on_pushButton_confirm_clicked()
{
if(ui->lineEdit_filepath->text() == ""){
QMessageBox::information(this,tr("提示"),tr("请选择导出文件路径!"));
return;
}
backup_path = backup_path + "\\config\\";
copyDirectory(QCoreApplication::applicationDirPath() + "\\config\\", backup_path);
QFile file(backup_path+"macbackup");
if (!file.open(QIODevice::ReadWrite)) {
qWarning("Couldn't open file for writing.");
return;
}
QTextStream out(&file);
out << MAC << endl;
file.close();
QMessageBox::information(this,tr("导出"),tr("导出成功!"));
}
int CBackup::ExeSqlData(QString& strSql)
{
QSqlQuery sql_query;
int iRet = -1;
qDebug() << "strSql" << strSql << endl;
if(!sql_query.exec(strSql))
{
qDebug() << sql_query.lastError();
}
else
{
while(sql_query.next())
{
iRet = sql_query.value(0).toInt();
}
}
return iRet;
}
bool CBackup::copyFile(const QString &sourceFile, const QString &destinationFile)
{
QFile srcFile(sourceFile);
QFile dstFile(destinationFile);
if (!srcFile.exists()) {
qDebug() << "Source file does not exist:" << sourceFile;
return false;
}
if (!srcFile.open(QIODevice::ReadOnly)) {
qDebug() << "Unable to open source file for reading:" << sourceFile;
return false;
}
if (!dstFile.open(QIODevice::WriteOnly)) {
srcFile.close();
qDebug() << "Unable to open destination file for writing:" << destinationFile;
return false;
}
dstFile.write(srcFile.readAll());
srcFile.close();
dstFile.close();
return true;
}
bool CBackup::copyDirectory(const QString &sourceDir, const QString &destinationDir) {
QDir srcDir(sourceDir);
QDir destDir(destinationDir);
// 如果目标文件夹已存在,则删除它
if (destDir.exists()) {
destDir.removeRecursively();
}
// 创建目标文件夹
if (!destDir.mkpath(".")) {
qDebug() << "无法创建目标文件夹";
return false;
}
// 复制文件
foreach (const QFileInfo &fileInfo, srcDir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot)) {
QString fileName = fileInfo.fileName();
QString srcFilePath = srcDir.absoluteFilePath(fileName);
QString destFilePath = destDir.absoluteFilePath(fileName);
if (fileInfo.isDir()) {
// 递归复制子文件夹
if (!copyDirectory(srcFilePath, destFilePath)) {
return false;
}
} else {
// 复制文件
if (!QFile::copy(srcFilePath, destFilePath)) {
qDebug() << "无法复制文件" << srcFilePath << "" << destFilePath;
return false;
}
}
}
return true;
}

36
Backup.h Normal file
View File

@ -0,0 +1,36 @@
#ifndef BACKUP_H
#define BACKUP_H
#include <QWidget>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include "global.h"
namespace Ui {
class CBackup;
}
class CBackup : public QWidget
{
Q_OBJECT
public:
explicit CBackup(QWidget *parent = nullptr);
~CBackup();
private slots:
void on_pushButton_path_clicked();
void on_pushButton_confirm_clicked();
private:
Ui::CBackup *ui;
QString backup_path;
QSqlDatabase database;
int CreateDataBase();
int ExeSqlData(QString& strSql);
bool copyFile(const QString &sourceFile, const QString &destinationFile);
bool copyDirectory(const QString &sourceDir, const QString &destinationDir);
};
#endif // BACKUP_H

150
Backup.ui Normal file
View File

@ -0,0 +1,150 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CBackup</class>
<widget class="QWidget" name="CBackup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>711</width>
<height>169</height>
</rect>
</property>
<property name="windowTitle">
<string>配置导出</string>
</property>
<property name="styleSheet">
<string notr="true">font: 10pt &quot;黑体&quot;;
color: rgb(27, 30, 35);</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>请填写导出信息</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_2" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="lineEdit_filepath">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_path">
<property name="minimumSize">
<size>
<width>96</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>96</width>
<height>28</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">#pushButton_path { border-image: url(:/image/Btn/normal_Btn.png);
color:#1f5188 }
#pushButton_path:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_path:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_path:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}</string>
</property>
<property name="text">
<string>导出路径</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<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="pushButton_confirm">
<property name="minimumSize">
<size>
<width>96</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>96</width>
<height>28</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">#pushButton_confirm { border-image: url(:/image/Btn/normal_Btn.png);
color:#1f5188 }
#pushButton_confirm:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_confirm:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_confirm:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}</string>
</property>
<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>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -327,7 +327,7 @@ void CBoardSetting::PushData()
QString str = QString(" values('%1','%2','%3','%4',%5,'%6','%7',%8,'%9',%10,'%11',%12,'%13',%14,'%15',%16,'%17',%18,%19,%20,'%21',%22,'%23',%24,\
'%25',%26,'%27','%28','%29','%30',%31,'%32',%33,'%34','%35',%36,'%37',%38,'%39','%40',%41,'%42',%43,'%44',\
'%45','%46',%47,%48,%49,'%50','%51','%52',%53,'%54','%55',%56,%57,'%58','%59',%60,'%61','%62','%63',%64,'%65','%66','%67',\
'%68','%69','%70',%71,%72,%73,'%74','%75','%76','%77','%78','%79','%80','%81','%82','%83','%84',%85,'%86','%87','%88','%89','%90','%91','%92','%93','%94','%95','',98,1,'','');").\
'%68','%69','%70',%71,%72,%73,'%74','%75','%76','%77','%78','%79','%80','%81','%82','%83','%84',%85,'%86','%87','%88','%89','%90','%91','%92','%93','%94','%95','',98,1,'','',0);").\
arg("NULL").arg(0).arg("true").arg("ACCELEROMETER").arg("0").arg("Bottom").arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg(0).arg(0).arg("false").
arg(0).arg("false").arg(0).arg("false").arg(0).arg(strChannelID).arg("NONE").arg(strChannelName).arg("false").arg(0).arg("false").arg(0).arg("RMSValue").arg("").arg(0).arg("false").arg(0).arg("CTC-AC102").arg("false").arg(0).arg("false").arg(0).arg("").\
arg("true").arg(strMAC).arg(0).arg(1000).arg(0).arg("Hamming").arg("15000").arg("0.5").arg(30).arg("5000").arg("").arg(0).arg(0).arg("0").arg("60000").arg(0).arg("NONE").arg("").arg("0").arg(1024).arg("").arg("").arg(timeStamp).\
@ -347,7 +347,7 @@ void CBoardSetting::PushData()
QString str = QString(" values('%1','%2','%3','%4',%5,'%6','%7',%8,'%9',%10,'%11',%12,'%13',%14,'%15',%16,'%17',%18,%19,%20,'%21',%22,'%23',%24,\
'%25',%26,'%27','%28','%29','%30',%31,'%32',%33,'%34','%35',%36,'%37',%38,'%39','%40',%41,'%42',%43,'%44',\
'%45','%46',%47,%48,%49,'%50','%51','%52',%53,'%54','%55',%56,%57,'%58','%59',%60,'%61','%62','%63',%64,'%65','%66','%67',\
'%68','%69','%70',%71,%72,%73,'%74','%75','%76','%77','%78','%79','%80','%81','%82','%83','%84',%85,'%86','%87','%88','%89','%90','%91','%92','%93','%94','%95','',98,1,'','');").\
'%68','%69','%70',%71,%72,%73,'%74','%75','%76','%77','%78','%79','%80','%81','%82','%83','%84',%85,'%86','%87','%88','%89','%90','%91','%92','%93','%94','%95','',98,1,'','',0);").\
arg("NULL").arg(0).arg("true").arg("ACCELEROMETER").arg("0").arg("Bottom").arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg(0).arg(0).arg("false").
arg(0).arg("false").arg(0).arg("false").arg(0).arg(strChannelID).arg("NONE").arg(strChannelName).arg("false").arg(0).arg("false").arg(0).arg("RMSValue").arg("").arg(0).arg("false").arg(0).arg("CTC-AC102").arg("false").arg(0).arg("false").arg(0).arg("").\
arg("true").arg(strMAC).arg(0).arg(1000).arg(0).arg("Hamming").arg("15000").arg("0.5").arg(12).arg("5000").arg("").arg(0).arg(0).arg("0").arg("60000").arg(0).arg("NONE").arg("").arg("0").arg(1024).arg("").arg("").arg(timeStamp).\
@ -366,7 +366,7 @@ void CBoardSetting::PushData()
QString str = QString(" values('%1','%2','%3','%4',%5,'%6','%7',%8,'%9',%10,'%11',%12,'%13',%14,'%15',%16,'%17',%18,%19,%20,'%21',%22,'%23',%24,\
'%25',%26,'%27','%28','%29','%30',%31,'%32',%33,'%34','%35',%36,'%37',%38,'%39','%40',%41,'%42',%43,'%44',\
'%45','%46',%47,%48,%49,'%50','%51','%52',%53,'%54','%55',%56,%57,'%58','%59',%60,'%61','%62','%63',%64,'%65','%66','%67',\
'%68','%69','%70',%71,%72,%73,'%74','%75','%76','%77','%78','%79','%80','%81','%82','%83','%84',%85,'%86','%87','%88','%89','%90','%91','%92','%93','%94','%95','',98,1,'','');").\
'%68','%69','%70',%71,%72,%73,'%74','%75','%76','%77','%78','%79','%80','%81','%82','%83','%84',%85,'%86','%87','%88','%89','%90','%91','%92','%93','%94','%95','',98,1,'','',0);").\
arg("NULL").arg(0).arg("true").arg("PULSE_CURRENT").arg("0").arg("Bottom").arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg(0).arg(0).arg("false").
arg(0).arg("false").arg(0).arg("false").arg(0).arg(strChannelID).arg("NONE").arg(strChannelName).arg("false").arg(0).arg("false").arg(0).arg("RMSValue").arg("").arg(0).arg("false").arg(0).arg("电流变送器").arg("false").arg(0).arg("false").arg(0).arg("").\
arg("true").arg(MAC).arg(0).arg(1000).arg(0).arg("Hamming").arg("").arg("").arg(20).arg("5000").arg("").arg(0).arg(0).arg("0").arg("60000").arg(0).arg("NONE").arg("").arg("0").arg(1024).arg("").arg("").arg(timeStamp).\
@ -386,7 +386,7 @@ void CBoardSetting::PushData()
QString str = QString(" values('%1','%2','%3','%4',%5,'%6','%7',%8,'%9',%10,'%11',%12,'%13',%14,'%15',%16,'%17',%18,%19,%20,'%21',%22,'%23',%24,\
'%25',%26,'%27','%28','%29','%30',%31,'%32',%33,'%34','%35',%36,'%37',%38,'%39','%40',%41,'%42',%43,'%44',\
'%45','%46',%47,%48,%49,'%50','%51','%52',%53,'%54','%55',%56,%57,'%58','%59',%60,'%61','%62','%63',%64,'%65','%66','%67',\
'%68','%69','%70',%71,%72,%73,'%74','%75','%76','%77','%78','%79','%80','%81','%82','%83','%84',%85,'%86','%87','%88','%89','%90','%91','%92','%93','%94','%95','',98,1,'','');").\
'%68','%69','%70',%71,%72,%73,'%74','%75','%76','%77','%78','%79','%80','%81','%82','%83','%84',%85,'%86','%87','%88','%89','%90','%91','%92','%93','%94','%95','',98,1,'','',0);").\
arg("NULL").arg(0).arg("true").arg("SLOW_CURRENT").arg("0").arg("Bottom").arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg(0).arg(0).arg("false").
arg(0).arg("false").arg(0).arg("false").arg(0).arg(strChannelID).arg("NONE").arg(strChannelName).arg("false").arg(0).arg("false").arg(0).arg("RMSValue").arg("").arg(0).arg("false").arg(0).arg("电流变送器").arg("false").arg(0).arg("false").arg(0).arg("").\
arg("true").arg(MAC).arg(0).arg(1000).arg(0).arg("Hamming").arg("").arg("").arg(20).arg("5000").arg("").arg(0).arg(0).arg("0").arg("60000").arg(0).arg("NONE").arg("").arg("0").arg(64).arg("").arg("").arg(timeStamp).\
@ -415,7 +415,7 @@ void CBoardSetting::PushData()
QString str = QString(" values('%1','%2','%3','%4',%5,'%6','%7',%8,'%9',%10,'%11',%12,'%13',%14,'%15',%16,'%17',%18,%19,%20,'%21',%22,'%23',%24,\
'%25',%26,'%27','%28','%29','%30',%31,'%32',%33,'%34','%35',%36,'%37',%38,'%39','%40',%41,'%42',%43,'%44',\
'%45','%46',%47,%48,%49,'%50','%51','%52',%53,'%54','%55',%56,%57,'%58','%59',%60,'%61','%62','%63',%64,'%65','%66','%67',\
'%68','%69','%70',%71,%72,%73,'%74','%75','%76','%77','%78','%79','%80','%81','%82','%83','%84',%85,'%86','%87','%88','%89','%90','%91','%92','%93','%94','%95','',0,0,'','');").\
'%68','%69','%70',%71,%72,%73,'%74','%75','%76','%77','%78','%79','%80','%81','%82','%83','%84',%85,'%86','%87','%88','%89','%90','%91','%92','%93','%94','%95','',0,0,'','',0);").\
arg("NULL").arg(0).arg("false").arg(strchannelType).arg("0").arg("").arg("").arg(0).arg("").arg(0).arg("").arg(0).arg("").arg(0).arg("").arg(0).arg("").arg(0).arg(0).arg(0).arg("").
arg(0).arg("").arg(0).arg("").arg(0).arg(strChannelID).arg("").arg(strChannelName).arg("").arg(0).arg("").arg(0).arg("").arg("").arg(0).arg("").arg(0).arg("").arg("").arg(0).arg("").arg(0).arg("").\
arg("true").arg(MAC).arg(0).arg(1000).arg(0).arg("").arg("").arg("").arg(10).arg("").arg("").arg(0).arg(0).arg("0").arg("").arg(0).arg("").arg("").arg("0").arg(0).arg("").arg("").arg(timeStamp).\
@ -757,7 +757,7 @@ void CBoardSetting::on_pushButton_Init_clicked()
QString str = QString(" values('%1','%2','%3','%4',%5,'%6','%7',%8,'%9',%10,'%11',%12,'%13',%14,'%15',%16,'%17',%18,%19,%20,'%21',%22,'%23',%24,\
'%25',%26,'%27','%28','%29','%30',%31,'%32',%33,'%34','%35',%36,'%37',%38,'%39','%40',%41,'%42',%43,'%44',\
'%45','%46',%47,%48,%49,'%50','%51','%52',%53,'%54','%55',%56,%57,'%58','%59',%60,'%61','%62','%63',%64,'%65','%66','%67',\
'%68','%69','%70',%71,%72,%73,'%74','%75','%76','%77','%78','%79','%80','%81','%82','%83','%84',%85,'%86','%87','%88','%89','%90','%91','%92','%93','%94','%95','',98,1,'','');").\
'%68','%69','%70',%71,%72,%73,'%74','%75','%76','%77','%78','%79','%80','%81','%82','%83','%84',%85,'%86','%87','%88','%89','%90','%91','%92','%93','%94','%95','',98,1,'','',0);").\
arg("NULL").arg(0).arg("true").arg("ACCELEROMETER").arg("0").arg("Bottom").arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg(0).arg(0).arg("false").
arg(0).arg("false").arg(0).arg("false").arg(0).arg(strChannelID).arg("NONE").arg(strChannelName).arg("false").arg(0).arg("false").arg(0).arg("RMSValue").arg("").arg(0).arg("false").arg(0).arg("CTC-AC102").arg("false").arg(0).arg("false").arg(0).arg("").\
arg("true").arg(strMAC).arg(0).arg(1000).arg(0).arg("Hamming").arg("15000").arg("0.5").arg(10).arg("5000").arg("").arg(1).arg(1).arg("0").arg("60000").arg(0).arg("NONE").arg("").arg("0").arg(1024).arg("").arg("").arg(timeStamp).\
@ -776,7 +776,7 @@ void CBoardSetting::on_pushButton_Init_clicked()
QString str = QString(" values('%1','%2','%3','%4',%5,'%6','%7',%8,'%9',%10,'%11',%12,'%13',%14,'%15',%16,'%17',%18,%19,%20,'%21',%22,'%23',%24,\
'%25',%26,'%27','%28','%29','%30',%31,'%32',%33,'%34','%35',%36,'%37',%38,'%39','%40',%41,'%42',%43,'%44',\
'%45','%46',%47,%48,%49,'%50','%51','%52',%53,'%54','%55',%56,%57,'%58','%59',%60,'%61','%62','%63',%64,'%65','%66','%67',\
'%68','%69','%70',%71,%72,%73,'%74','%75','%76','%77','%78','%79','%80','%81','%82','%83','%84',%85,'%86','%87','%88','%89','%90','%91','%92','%93','%94','%95','',98,1,'','');").\
'%68','%69','%70',%71,%72,%73,'%74','%75','%76','%77','%78','%79','%80','%81','%82','%83','%84',%85,'%86','%87','%88','%89','%90','%91','%92','%93','%94','%95','',98,1,'','',0);").\
arg("NULL").arg(0).arg("true").arg("PULSE_CURRENT").arg("0").arg("Bottom").arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg(0).arg(0).arg("false").
arg(0).arg("false").arg(0).arg("false").arg(0).arg(strChannelID).arg("NONE").arg(strChannelName).arg("false").arg(0).arg("false").arg(0).arg("RMSValue").arg("").arg(0).arg("false").arg(0).arg("电流变送器").arg("false").arg(0).arg("false").arg(0).arg("").\
arg("true").arg(MAC).arg(0).arg(1000).arg(0).arg("Hamming").arg("").arg("").arg(20).arg("5000").arg("").arg(1).arg(1).arg("0").arg("60000").arg(0).arg("NONE").arg("").arg("0").arg(1024).arg("").arg("").arg(timeStamp).\
@ -796,7 +796,7 @@ void CBoardSetting::on_pushButton_Init_clicked()
QString str = QString(" values('%1','%2','%3','%4',%5,'%6','%7',%8,'%9',%10,'%11',%12,'%13',%14,'%15',%16,'%17',%18,%19,%20,'%21',%22,'%23',%24,\
'%25',%26,'%27','%28','%29','%30',%31,'%32',%33,'%34','%35',%36,'%37',%38,'%39','%40',%41,'%42',%43,'%44',\
'%45','%46',%47,%48,%49,'%50','%51','%52',%53,'%54','%55',%56,%57,'%58','%59',%60,'%61','%62','%63',%64,'%65','%66','%67',\
'%68','%69','%70',%71,%72,%73,'%74','%75','%76','%77','%78','%79','%80','%81','%82','%83','%84',%85,'%86','%87','%88','%89','%90','%91','%92','%93','%94','%95','',98,1,'','');").\
'%68','%69','%70',%71,%72,%73,'%74','%75','%76','%77','%78','%79','%80','%81','%82','%83','%84',%85,'%86','%87','%88','%89','%90','%91','%92','%93','%94','%95','',98,1,'','',0);").\
arg("NULL").arg(0).arg("true").arg("SLOW_CURRENT").arg("0").arg("Bottom").arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg("false").arg(0).arg(0).arg(0).arg("false").
arg(0).arg("false").arg(0).arg("false").arg(0).arg(strChannelID).arg("NONE").arg(strChannelName).arg("false").arg(0).arg("false").arg(0).arg("RMSValue").arg("").arg(0).arg("false").arg(0).arg("电流变送器").arg("false").arg(0).arg("false").arg(0).arg("").\
arg("true").arg(MAC).arg(0).arg(1000).arg(0).arg("Hamming").arg("").arg("").arg(20).arg("5000").arg("").arg(0).arg(0).arg("0").arg("60000").arg(0).arg("NONE").arg("").arg("0").arg(64).arg("").arg("").arg(timeStamp).\
@ -825,7 +825,7 @@ void CBoardSetting::on_pushButton_Init_clicked()
QString str = QString(" values('%1','%2','%3','%4',%5,'%6','%7',%8,'%9',%10,'%11',%12,'%13',%14,'%15',%16,'%17',%18,%19,%20,'%21',%22,'%23',%24,\
'%25',%26,'%27','%28','%29','%30',%31,'%32',%33,'%34','%35',%36,'%37',%38,'%39','%40',%41,'%42',%43,'%44',\
'%45','%46',%47,%48,%49,'%50','%51','%52',%53,'%54','%55',%56,%57,'%58','%59',%60,'%61','%62','%63',%64,'%65','%66','%67',\
'%68','%69','%70',%71,%72,%73,'%74','%75','%76','%77','%78','%79','%80','%81','%82','%83','%84',%85,'%86','%87','%88','%89','%90','%91','%92','%93','%94','%95','',0,0,'','');").\
'%68','%69','%70',%71,%72,%73,'%74','%75','%76','%77','%78','%79','%80','%81','%82','%83','%84',%85,'%86','%87','%88','%89','%90','%91','%92','%93','%94','%95','',0,0,'','',0);").\
arg("NULL").arg(0).arg("false").arg(strchannelType).arg("0").arg("").arg("").arg(0).arg("").arg(0).arg("").arg(0).arg("").arg(0).arg("").arg(0).arg("").arg(0).arg(0).arg(0).arg("").
arg(0).arg("").arg(0).arg("").arg(0).arg(strChannelID).arg("").arg(strChannelName).arg("").arg(0).arg("").arg(0).arg("").arg("").arg(0).arg("").arg(0).arg("").arg("").arg(0).arg("").arg(0).arg("").\
arg("true").arg(MAC).arg(0).arg(1000).arg(0).arg("").arg("").arg("").arg(10).arg("").arg("").arg(0).arg(0).arg("0").arg("").arg(0).arg("").arg("").arg("0").arg(0).arg("").arg("").arg(timeStamp).\
@ -947,6 +947,14 @@ void CBoardSetting::on_pushButton_Init_clicked()
// g_FtpClient->SetUserInfo("root","@#cidw!@123456");
// g_FtpClient->UpLoadFile(name,"UnitBoardsInfo.json");
customLogMessageHandler(QtDebugMsg,"初始化机组板卡配置信息推送完成!");
QJsonObject sendData;
sendData["cmd"] = "111";
QNetworkRequest req;
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
req.setUrl(sUrl);
g_NetMgr->PostJson(req,sendData);
putJson();
}

View File

@ -7,6 +7,7 @@
#include <QDate>
#include <QTime>
#include <QInputDialog>
#include <QListView>
#include "NetMgr.h"
CChannelList::CChannelList(QWidget *parent) :
@ -14,6 +15,7 @@ CChannelList::CChannelList(QWidget *parent) :
ui(new Ui::CChannelList)
{
ui->setupUi(this);
ui->comboBox_operate->setView(new QListView());
// this->setWindowTitle("QTableView简单使用");
// //建立模型对象空间并指定父对象
@ -48,7 +50,7 @@ CChannelList::CChannelList(QWidget *parent) :
// this->setColumnCheckable(0, true);
// //this->setColumnCheckable(2, true);
//--1 初始化
headerStr = QObject::tr(" ,通道名称,模块编号,通道序号,通道状态,通道类型,采样频率(Hz),灵敏度,工程单位,范围检查,最小值,\
headerStr = QObject::tr(" ,通道名称,模块编号,通道滤波状态,通道状态,通道类型,采样频率(Hz),灵敏度,工程单位,范围检查,最小值,\
,1x幅值补偿,1x相位补偿,,,,,,,,\
,,IEPE,,0,,,沿,,Hysteresis(V),\
,,,,,,");
@ -57,25 +59,26 @@ CChannelList::CChannelList(QWidget *parent) :
iniVar();
iniUi();
iniConnect();
initReadConfig();
connect(ui->tableView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotRowDoubleClicked(const QModelIndex &)));
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->tableView->setColumnWidth(33, 256);
m_nCurRow = -1;
SlowSpeeddialog = new CSlowSpeedChannelSetting();
connect(SlowSpeeddialog, SIGNAL(sgSetChannelData(ChannelSetting)), this, SLOT(slotSetChannelData(ChannelSetting)));
ChannelSettingdialog = new CChannelSetting();
connect(ChannelSettingdialog, SIGNAL(sgSetChannelData(ChannelSetting)), this, SLOT(slotSetChannelData(ChannelSetting)));
SlowSpeeddialog = new CSlowSpeedChannelSetting();
connect(SlowSpeeddialog, SIGNAL(sgSetChannelData(ChannelSetting)), this, SLOT(slotSetChannelData(ChannelSetting)));
ui->comboBox_operate->addItem("通道");
ui->comboBox_operate->addItem("带通滤波");
//--2 创建表格项
// QStringList workingConditionName;
// workingConditionName<<tr("工况1")<<tr("工况2")<<tr("工况3");
// createItem(workingConditionName);
#ifdef QT_DEBUG
initReadConfig();
#endif
#ifdef NO_FILTER
initReadConfig();
#endif
}
@ -100,20 +103,25 @@ void CChannelList::initReadConfig()
QVariantList strRowItem ;
QString strChannelStatus;
QString strChannelStatus,strChannelFilterStatus,strChannelNo;
if(g_channelSetting[i].isEnable)
strChannelStatus = "启用";
else
strChannelStatus = "关闭";
if(g_channelSetting[i].filterStatus)
strChannelFilterStatus = "启用";
else
strChannelFilterStatus = "关闭";
QString strcouplingACDC;
if(g_channelSetting[i].couplingACDC)
strcouplingACDC = "AC";
else
strcouplingACDC = "DC";
strChannelNo = QString("%1-%2").arg(g_channelSetting[i].sensorModuleNo).arg(g_channelSetting[i].sensorNo);
QString TStr = QDateTime::fromSecsSinceEpoch(g_channelSetting[i].sensorConfigureDate.toInt()).toString("yyyy-MM-dd hh:mm:ss");
strRowItem << g_channelSetting[i].channelName << g_channelSetting[i].sensorModuleNo << g_channelSetting[i].sensorNo\
strRowItem << g_channelSetting[i].channelName << strChannelNo << strChannelFilterStatus\
<< strChannelStatus << strChannelType << g_channelSetting[i].samplingRate\
<< g_channelSetting[i].sensorSensitivity <<g_channelSetting[i].sensorEngineeringUnit <<g_channelSetting[i].sensorRangeCheck \
<< g_channelSetting[i].sensorRangeMin <<g_channelSetting[i].sensorRangeMax <<g_channelSetting[i].sensor1xAmplitudeRunout\
@ -154,7 +162,7 @@ void CChannelList::iniUi()
if(i == 1){
ui->tableView->setColumnWidth(i, 200);
}else{
ui->tableView->setColumnWidth(i, 150);
ui->tableView->setColumnWidth(i, 130);
}
}
@ -164,6 +172,20 @@ void CChannelList::iniConnect()
{
connect(myHeader, &TableHeaderView::stateChanged, this, &CChannelList::headerStateChangedSlot);
connect(model, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(itemChangedSlot(QStandardItem*)));
connect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
QJsonObject sendData;
sendData["cmd"] = "97";
QJsonArray chan_list;
for (int i = 0; i < g_channelSetting.size(); i++) {
if(g_channelSetting[i].boardType != "5" && g_channelSetting[i].boardType != "6" )
chan_list.append(g_channelSetting[i].channelId);
}
sendData["chan_list"] = chan_list;
QNetworkRequest req;
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
req.setUrl(sUrl);
g_NetMgr->PostJson(req,sendData);
}
void CChannelList::createItem(QStringList filename)
@ -241,9 +263,13 @@ void CChannelList::itemChangedSlot(QStandardItem *item)
myHeader->onStateChanged(state);
}
}
void CChannelList::slotChannelSettingClose()
{
on_pushButton_refresh_clicked();
}
void CChannelList::slotSetChannelData(ChannelSetting channelSetting)
{
qDebug() << "slotSetChannelData" << endl;
int i;
for (i = 0;i <g_channelSetting.size() ; i++) {
if(g_channelSetting[i].channelId == channelSetting.channelId){
@ -339,6 +365,7 @@ void CChannelList::slotSetChannelData(ChannelSetting channelSetting)
g_SqliteDB->UpdateDataSql(tableName,strUpdateSql);
g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting");
putJson();
//disconnect(ChannelSettingdialog, SIGNAL(sgSetChannelData(ChannelSetting)), this, SLOT(slotSetChannelData(ChannelSetting)));
@ -514,20 +541,26 @@ void CChannelList::slotRowDoubleClicked(const QModelIndex &index)
if(g_channelSetting[m_nCurRow].boardType.toInt() == 1 && g_channelSetting[i].channelId == g_channelSetting[m_nCurRow].channelId){//开入开出板卡
SlowSpeeddialog->channelSetting = g_channelSetting[i];
SlowSpeeddialog->setWindowModality(Qt::ApplicationModal);
SlowSpeeddialog->displayChannelSetting();
SlowSpeeddialog->show();
SlowSpeeddialog = new CSlowSpeedChannelSetting();
connect(SlowSpeeddialog, SIGNAL(sgSetChannelData(ChannelSetting)), this, SLOT(slotSetChannelData(ChannelSetting)));
SlowSpeeddialog->channelSetting = g_channelSetting[i];
SlowSpeeddialog->setWindowModality(Qt::ApplicationModal);
SlowSpeeddialog->displayChannelSetting();
SlowSpeeddialog->show();
}
else if(g_channelSetting[m_nCurRow].boardType.toInt() > 1 && g_channelSetting[m_nCurRow].boardType.toInt() < 5 && g_channelSetting[i].channelId == g_channelSetting[m_nCurRow].channelId){//高速板卡
qDebug() << g_channelSetting[m_nCurRow].boardType << g_channelSetting[i].channelId << g_channelSetting[m_nCurRow].channelId<< endl;
ChannelSettingdialog = new CChannelSetting();
connect(ChannelSettingdialog, SIGNAL(sgSetChannelData(ChannelSetting)), this, SLOT(slotSetChannelData(ChannelSetting)));
connect(ChannelSettingdialog, SIGNAL(ChannelSettingClose_sg()), this, SLOT(slotChannelSettingClose()));
ChannelSettingdialog->channelSetting = g_channelSetting[i];
ChannelSettingdialog->setWindowModality(Qt::ApplicationModal);
ChannelSettingdialog->displayChannelSetting();
ChannelSettingdialog->show();
}else if((g_channelSetting[m_nCurRow].boardType.toInt() == 5) && g_channelSetting[i].channelId == g_channelSetting[m_nCurRow].channelId){//低速板卡
SlowSpeeddialog = new CSlowSpeedChannelSetting();
connect(SlowSpeeddialog, SIGNAL(sgSetChannelData(ChannelSetting)), this, SLOT(slotSetChannelData(ChannelSetting)));
SlowSpeeddialog->channelSetting = g_channelSetting[i];
SlowSpeeddialog->setWindowModality(Qt::ApplicationModal);
SlowSpeeddialog->displayChannelSetting();
@ -583,47 +616,85 @@ void CChannelList::on_columnSectionClicked(int column, bool checked)
void CChannelList::on_pushButton_open_clicked()
{
for (int i = 0; i < model->rowCount(); i++) {
QModelIndex indexCheck = model->index(i,0);
bool check = model->data(indexCheck, Qt::UserRole).toBool();
if(check){
// QLabel *pLabel = new QLabel(this);
// pLabel->setText("启用");
// QPalette palette;
// palette.setColor(QPalette::Background, QColor(Qt::green));
// //palette.setColor(QPalette::WindowText,Qt::white);
// //pLabel->setAutoFillBackground(true);
// pLabel->setPalette(palette);
// ui->tableView->setIndexWidget(model->index(i,4),pLabel);
//model->setData(model->index(i,4),QBrush(Qt::red), Qt::BackgroundRole);
model->setItem(i,4,new QStandardItem("启用"));
QString strChannelID = model->data(model->index(i,38)).toString();
QString strUpdateSql = QString(" set isEnable = %1 , isWork = %2 where channelId = '%3' ").arg(1).arg(1).arg(g_channelSetting[i].channelId);
QString tableName = "t_ChannelSetting ";
g_SqliteDB->UpdateDataSql(tableName,strUpdateSql);
g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting");
if(ui->comboBox_operate->currentText() == "通道"){
for (int i = 0; i < model->rowCount(); i++) {
QModelIndex indexCheck = model->index(i,0);
bool check = model->data(indexCheck, Qt::UserRole).toBool();
if(check){
// QLabel *pLabel = new QLabel(this);
// pLabel->setText("启用");
// QPalette palette;
// palette.setColor(QPalette::Background, QColor(Qt::green));
// //palette.setColor(QPalette::WindowText,Qt::white);
// //pLabel->setAutoFillBackground(true);
// pLabel->setPalette(palette);
// ui->tableView->setIndexWidget(model->index(i,4),pLabel);
//model->setData(model->index(i,4),QBrush(Qt::red), Qt::BackgroundRole);
model->setItem(i,4,new QStandardItem("启用"));
QString strChannelID = model->data(model->index(i,38)).toString();
QString strUpdateSql = QString(" set isEnable = %1 , isWork = %2 where channelId = '%3' ").arg(1).arg(1).arg(g_channelSetting[i].channelId);
QString tableName = "t_ChannelSetting ";
g_SqliteDB->UpdateDataSql(tableName,strUpdateSql);
g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting");
}
}
}
putJson();
putJson();
}else if(ui->comboBox_operate->currentText() == "带通滤波"){
QJsonArray channleList;
for (int i = 0; i < model->rowCount(); i++) {
QModelIndex indexCheck = model->index(i,0);
bool check = model->data(indexCheck, Qt::UserRole).toBool();
if(check){
model->setItem(i,3,new QStandardItem("启用"));
QString strChannelID = model->data(model->index(i,38)).toString();
QString strUpdateSql = QString(" set filterStatus = %1 where channelId = '%2' ").arg(1).arg(g_channelSetting[i].channelId);
QString tableName = "t_ChannelSetting ";
g_SqliteDB->UpdateDataSql(tableName,strUpdateSql);
g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting");
channleList.append(g_channelSetting[i].channelId);
}
}
operateChannelFilter(true,channleList);
}
}
void CChannelList::on_pushButton_close_clicked()
{
for (int i = 0; i < model->rowCount(); i++) {
QModelIndex indexCheck = model->index(i,0);
bool check = model->data(indexCheck, Qt::UserRole).toBool();
if(check){
model->setItem(i,4,new QStandardItem("关闭"));
QString strChannelID = model->data(model->index(i,39)).toString();
QString strUpdateSql = QString(" set isEnable = %1, isWork = %2 where channelId = '%3' ").arg(0).arg(0).arg(g_channelSetting[i].channelId);
QString tableName = "t_ChannelSetting ";
g_SqliteDB->UpdateDataSql(tableName,strUpdateSql);
g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting");
if(ui->comboBox_operate->currentText() == "通道"){
for (int i = 0; i < model->rowCount(); i++) {
QModelIndex indexCheck = model->index(i,0);
bool check = model->data(indexCheck, Qt::UserRole).toBool();
if(check){
model->setItem(i,4,new QStandardItem("关闭"));
QString strChannelID = model->data(model->index(i,39)).toString();
QString strUpdateSql = QString(" set isEnable = %1, isWork = %2 where channelId = '%3' ").arg(0).arg(0).arg(g_channelSetting[i].channelId);
QString tableName = "t_ChannelSetting ";
g_SqliteDB->UpdateDataSql(tableName,strUpdateSql);
g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting");
}
}
putJson();
}else if(ui->comboBox_operate->currentText() == "带通滤波"){
QJsonArray channleList;
for (int i = 0; i < model->rowCount(); i++) {
QModelIndex indexCheck = model->index(i,0);
bool check = model->data(indexCheck, Qt::UserRole).toBool();
if(check){
model->setItem(i,3,new QStandardItem("关闭"));
QString strChannelID = model->data(model->index(i,38)).toString();
QString strUpdateSql = QString(" set filterStatus = %1 where channelId = '%2' ").arg(0).arg(g_channelSetting[i].channelId);
QString tableName = "t_ChannelSetting ";
g_SqliteDB->UpdateDataSql(tableName,strUpdateSql);
g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting");
channleList.append(g_channelSetting[i].channelId);
}
}
operateChannelFilter(false,channleList);
}
putJson();
}
@ -631,7 +702,21 @@ void CChannelList::on_pushButton_refresh_clicked()
{
model->removeRows(0, model->rowCount());
g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting");
connect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
QJsonObject sendData;
sendData["cmd"] = "97";
QJsonArray chan_list;
for (int i = 0; i < g_channelSetting.size(); i++) {
chan_list.append(g_channelSetting[i].channelId);
}
sendData["chan_list"] = chan_list;
QNetworkRequest req;
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
req.setUrl(sUrl);
g_NetMgr->PostJson(req,sendData);
#ifdef QT_DEBUG
initReadConfig();
#endif
}
void CChannelList::slotNetMgr(QString sAddr, const QVariant &msg)
@ -641,14 +726,30 @@ void CChannelList::slotNetMgr(QString sAddr, const QVariant &msg)
{
QJsonValue arrays_value = objec.take("cmd");
//qDebug()<<"cmd ="<<arrays_value.toString();
if(arrays_value.toString() == "08"){
if(arrays_value.toString() == "08" || arrays_value.toString() == "96"){
bool Status = objec.take("success").toBool();
QString strMessage = objec.take("message").toString();
if(Status){
QMessageBox::information(NULL, QStringLiteral("提示"), "保存成功!");
}else{
QMessageBox::information(NULL, QStringLiteral("提示"), strMessage);
}
}else if(arrays_value.toString() == "97"){
QJsonArray chan_list = objec["chan_list"].toArray();
QJsonArray status = objec["status"].toArray();
for (int i = 0; i < g_channelSetting.size(); i++) {
for (int j = 0; j < chan_list.size(); j++) {
if(g_channelSetting[i].channelId == chan_list[j].toString()){
g_channelSetting[i].filterStatus = status[j].toInt();
}
}
}
#ifndef NO_FILTER
initReadConfig();
#endif
}
}
disconnect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
}
void CChannelList::on_pushButton_restart_clicked()
{
@ -669,3 +770,15 @@ void CChannelList::on_pushButton_restart_clicked()
}
void CChannelList::operateChannelFilter(bool type,QJsonArray& channleList)
{
connect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
QJsonObject sendData;
sendData["cmd"] = "96";
sendData["open"] = type;
sendData["chan_list"] = channleList;
QNetworkRequest req;
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
req.setUrl(sUrl);
g_NetMgr->PostJson(req,sendData);
}

View File

@ -29,6 +29,7 @@ public slots:
void on_columnSectionClicked(int column, bool checked);
void slotSetChannelData(ChannelSetting channelSetting);
void slotChannelSettingClose();
private:
Ui::CChannelList *ui;
QStandardItemModel *m_pModel; //数据模型对象指针
@ -55,6 +56,8 @@ private:
int m_nCurRow;
CSlowSpeedChannelSetting *SlowSpeeddialog;
CChannelSetting *ChannelSettingdialog;
void operateChannelFilter(bool type,QJsonArray& channleList);
private slots:
void headerStateChangedSlot(int state);
void itemChangedSlot(QStandardItem* item);

View File

@ -5,7 +5,8 @@
#include <QTime>
#include "CopyChannelSetting.h"
#include "NetMgr.h"
#include "CustomFilter.h"
#include <QNetworkRequest>
CChannelSetting::CChannelSetting(QWidget *parent) :
QWidget(parent),
@ -18,6 +19,8 @@ CChannelSetting::CChannelSetting(QWidget *parent) :
ui->RPMComBox->setView(new QListView());
ui->pairChannelComBox->setView(new QListView());
ui->channelTypeCombox->setView(new QListView());
ui->comboBox_sensorICP_2->setView(new QListView());
ui->comboBox_sensorType->setView(new QListView());
ui->tabWidget->tabBar()->hide();
QRegExp exp("[0-9\\.-]+$");
@ -34,8 +37,8 @@ CChannelSetting::CChannelSetting(QWidget *parent) :
ui->lineEdit_analyseRate->setValidator(Validator);
ui->lineEdit_RateRatio->setValidator(Validator);
ui->lineEdit_envelopeLowpassband->setValidator(Validator);
ui->lineEdit_envelopeHighpassband->setValidator(Validator);
//ui->lineEdit_envelopeLowpassband->setValidator(Validator);
//ui->lineEdit_envelopeHighpassband->setValidator(Validator);
ui->lineEdit_sensorLocationInDegree->setValidator(Validator);
ui->lineEdit_sensor1xPhaseRunout->setValidator(Validator);
ui->lineEdit_sensor1xAmplitudeRunout->setValidator(Validator);
@ -82,10 +85,14 @@ CChannelSetting::CChannelSetting(QWidget *parent) :
ui->comboBox_tachAutoTach->addItems(m_itemList);
ui->comboBox_samplingRate_2->addItems(strListFs);
ui->comboBox_sensorRangeCheck_2->addItems(m_itemList);
setAttribute(Qt::WA_DeleteOnClose);//使能析构函数调用
}
CChannelSetting::~CChannelSetting()
{
qDebug() << "~CChannelSetting" << endl;
emit ChannelSettingClose_sg();
delete ui;
}
@ -237,9 +244,9 @@ void CChannelSetting::displayChannelSetting()
// ui->comboBox_samplingRate->setCurrentText("16kHz");
QString envelopeLowpassband = QString("%1").arg(channelSetting.envelopeLowpassband);
ui->lineEdit_envelopeLowpassband->setText(envelopeLowpassband);
//ui->lineEdit_envelopeLowpassband->setText(envelopeLowpassband);
QString envelopeHighpassband = QString("%1").arg(channelSetting.envelopeHighpassband);
ui->lineEdit_envelopeHighpassband->setText(envelopeHighpassband);
//ui->lineEdit_envelopeHighpassband->setText(envelopeHighpassband);
QString sensorLocationInDegree = QString("%1").arg(channelSetting.sensorLocationInDegree);
ui->lineEdit_sensorLocationInDegree->setText(sensorLocationInDegree);
@ -458,8 +465,8 @@ void CChannelSetting::PushData()
channelSetting.sensor1xPhaseRunout = ui->lineEdit_sensor1xPhaseRunout->text();
channelSetting.sensor1xAmplitudeRunout = ui->lineEdit_sensor1xAmplitudeRunout->text();
channelSetting.envelopeHighpassband = ui->lineEdit_envelopeHighpassband->text().toDouble();
channelSetting.envelopeLowpassband = ui->lineEdit_envelopeLowpassband->text().toDouble();
//channelSetting.envelopeHighpassband = ui->lineEdit_envelopeHighpassband->text().toDouble();
//channelSetting.envelopeLowpassband = ui->lineEdit_envelopeLowpassband->text().toDouble();
channelSetting.sensorTypes = ui->comboBox_sensorType->currentText();
if(ui->comboBox_bearingStartPosition->currentText() == ""){
@ -570,8 +577,8 @@ void CChannelSetting::on_channelTypeCombox_currentTextChanged(const QString &arg
// ui->comboBox_coupling->clear();
// ui->comboBox_coupling->addItem("AC");
// ui->comboBox_coupling->addItem("DC");
ui->lineEdit_envelopeLowpassband->setText("10");
ui->lineEdit_envelopeHighpassband->setText("3500");
//ui->lineEdit_envelopeLowpassband->setText("10");
//ui->lineEdit_envelopeHighpassband->setText("3500");
ui->lineEdit_sensorRange->setText("2032");
}else if(arg1 == "速度"){
@ -595,8 +602,8 @@ void CChannelSetting::on_channelTypeCombox_currentTextChanged(const QString &arg
ui->comboBox_coupling->clear();
ui->comboBox_coupling->addItem("AC");
ui->comboBox_coupling->addItem("DC");
ui->lineEdit_envelopeLowpassband->setText("4.5");
ui->lineEdit_envelopeHighpassband->setText("5000");
//ui->lineEdit_envelopeLowpassband->setText("4.5");
//ui->lineEdit_envelopeHighpassband->setText("5000");
ui->pairChannelComBox->setCurrentText("- -");
ui->RPMComBox->setCurrentText("- -");
ui->lineEdit_sensorRange->setText("2054");
@ -622,8 +629,8 @@ void CChannelSetting::on_channelTypeCombox_currentTextChanged(const QString &arg
ui->comboBox_coupling->clear();
ui->comboBox_coupling->addItem("AC");
ui->comboBox_coupling->addItem("DC");
ui->lineEdit_envelopeLowpassband->setText("350");
ui->lineEdit_envelopeHighpassband->setText("12000");
//ui->lineEdit_envelopeLowpassband->setText("350");
//ui->lineEdit_envelopeHighpassband->setText("12000");
ui->pairChannelComBox->setCurrentText("- -");
ui->RPMComBox->setCurrentText("- -");
ui->lineEdit_sensorRange->setText("2000");
@ -650,8 +657,8 @@ void CChannelSetting::on_channelTypeCombox_currentTextChanged(const QString &arg
ui->comboBox_coupling->clear();
ui->comboBox_coupling->addItem("DC");
ui->comboBox_coupling->addItem("AC");
ui->lineEdit_envelopeLowpassband->setText("1");
ui->lineEdit_envelopeHighpassband->setText("4000");
//ui->lineEdit_envelopeLowpassband->setText("1");
//ui->lineEdit_envelopeHighpassband->setText("4000");
ui->pairChannelComBox->setCurrentText("- -");
ui->RPMComBox->setCurrentText("- -");
ui->lineEdit_sensorRange->setText("2000");
@ -679,8 +686,8 @@ void CChannelSetting::on_channelTypeCombox_currentTextChanged(const QString &arg
ui->comboBox_coupling->clear();
ui->comboBox_coupling->addItem("DC");
ui->comboBox_coupling->addItem("AC");
ui->lineEdit_envelopeLowpassband->setText("1");
ui->lineEdit_envelopeHighpassband->setText("4000");
//ui->lineEdit_envelopeLowpassband->setText("1");
//ui->lineEdit_envelopeHighpassband->setText("4000");
ui->pairChannelComBox->setCurrentText("- -");
ui->RPMComBox->setCurrentText("- -");
ui->lineEdit_sensorRange->setText("2");
@ -705,8 +712,8 @@ void CChannelSetting::on_channelTypeCombox_currentTextChanged(const QString &arg
ui->comboBox_coupling->clear();
ui->comboBox_coupling->addItem("DC");
ui->comboBox_coupling->addItem("AC");
ui->lineEdit_envelopeLowpassband->setText("0");
ui->lineEdit_envelopeHighpassband->setText("5000");
//ui->lineEdit_envelopeLowpassband->setText("0");
//ui->lineEdit_envelopeHighpassband->setText("5000");
ui->pairChannelComBox->setCurrentText("- -");
ui->RPMComBox->setCurrentText("- -");
ui->lineEdit_sensorRange->setText("2000");
@ -832,3 +839,18 @@ void CChannelSetting::on_lineEdit_engineeringUnit_editingFinished()
ui->label_unit2->setText(str);
}
void CChannelSetting::on_pushButton_CustomFilter_clicked()
{
CustomFilter *pCustomFilter = new CustomFilter();
pCustomFilter->channel_ID = channelSetting.channelId;
if(ui->channelTypeCombox->currentText()=="径向振动位移")
pCustomFilter->vibrate_channel = 1;
else
pCustomFilter->vibrate_channel = 0;
pCustomFilter->setWindowModality(Qt::ApplicationModal);
pCustomFilter->show();
pCustomFilter->getfilterInfo();
}

View File

@ -40,6 +40,8 @@ private slots:
void on_lineEdit_engineeringUnit_editingFinished();
void on_pushButton_CustomFilter_clicked();
public slots:
void slotSetChannelData(QStringList&);
private:
@ -50,7 +52,7 @@ private:
signals:
void sgSetChannelData(ChannelSetting);
void ChannelSettingClose_sg();
};
#endif // CHANNELSETTING_H

View File

@ -30,7 +30,7 @@ void CCharacteristicList::timerEvent(QTimerEvent *ev)
}
void CCharacteristicList::InitTable()
{
headerStr = QObject::tr("通道名称,单位,通频值,峰峰值,平均工作位置,间隙,安装角度,状态");
headerStr = QObject::tr("通道名称,单位,通频值,峰峰值,反时限危险值,反时限报警值,平均工作位置,间隙,安装角度,状态");
ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
model = new QStandardItemModel(ui->tableView);
ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); //选中行
@ -41,7 +41,9 @@ void CCharacteristicList::InitTable()
ui->tableView->setAlternatingRowColors(true);
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->tableView->setColumnWidth(0, 300);
ui->tableView->setColumnWidth(4, 200);
ui->tableView->setColumnWidth(4, 160);
ui->tableView->setColumnWidth(5, 160);
ui->tableView->setColumnWidth(6, 200);
// for (int i = 0;i < g_ChannelView.size(); i++)
// {
@ -83,10 +85,12 @@ void CCharacteristicList::DisPlayCharacteristic()
model->setData(model->index(j,2,QModelIndex()),QString::number(g_Charateristic[j].DCValues,'f',g_Charateristic[j].ChUnitDot));
}
model->setData(model->index(j,3,QModelIndex()),QString::number(g_Charateristic[j].DiagnosisPk2Pk,'f',g_Charateristic[j].ChUnitDot));
model->setData(model->index(j,4,QModelIndex()),g_Charateristic[j].xFullScalePosition);
model->setData(model->index(j,5,QModelIndex()),QString::number(g_Charateristic[j].Gap,'f',g_Charateristic[j].ChUnitDot));
model->setData(model->index(j,6,QModelIndex()),g_Charateristic[j].ZeroScalePosition);
model->setData(model->index(j,7,QModelIndex()),g_Charateristic[j].SensorStatus);
model->setData(model->index(j,4,QModelIndex()),g_Charateristic[j].InvertDanger);
model->setData(model->index(j,5,QModelIndex()),g_Charateristic[j].InvertAlarm);
model->setData(model->index(j,6,QModelIndex()),g_Charateristic[j].xFullScalePosition);
model->setData(model->index(j,7,QModelIndex()),QString::number(g_Charateristic[j].Gap,'f',g_Charateristic[j].ChUnitDot));
model->setData(model->index(j,8,QModelIndex()),g_Charateristic[j].ZeroScalePosition);
model->setData(model->index(j,9,QModelIndex()),g_Charateristic[j].SensorStatus);
}
}
}

View File

@ -153,6 +153,10 @@ void CConfiguration::Init()
strStaticData = "峰值";
else if(strList[0] == "MonitorPk2Pk")
strStaticData = "监测保护峰峰值";
else if(strList[0] == "InvertDanger")
strStaticData = "反时限危险值";
else if(strList[0] == "InvertAlarm")
strStaticData = "反时限警报值";
if(xAlertOverEnabled == 1){
item = new QStandardItem(QString(channelName + "-" + strStaticData + "-" + "高于警报值"));
@ -246,6 +250,10 @@ void CConfiguration::slotDeleteItem()
}else{
QStandardItem* parantitem = item->parent();
if(parantitem == NULL){
model_Relay->removeRow(curIndex.row(),curIndex.parent());
return;
}
QString paranNodeText = parantitem->text();
if(paranNodeText.contains("logicAND")){
@ -455,6 +463,7 @@ QJsonObject CConfiguration::SelectChannel(int channelNo)
ConfiguraitonsObj["ChannelId"] = g_ChannelBaseInfo[i].channelID;
ConfiguraitonsObj["ChannelName"] = g_ChannelBaseInfo[i].channelName;
ConfiguraitonsObj["ChannelNoInBoard"] = g_ChannelBaseInfo[i].channelNoInBoard;
ConfiguraitonsObj["DelaySeconds"] = ui->lineEdit_delay->text();
ConfiguraitonsObj["ChannelOperate"] = -1;
}
}
@ -888,6 +897,7 @@ void CConfiguration::ViewRelay(int ChannelNoInBoard)
ui->lineEdit_2->setText(strSecondDelaySeconds);
for (int j = 0;j < tempArray.size() ;j++ ) {
if(tempArray.at(j)["ChannelNoInBoard"] == ChannelNoInBoard){
ui->lineEdit_delay->setText(tempArray.at(j)["DelaySeconds"].toString());
QJsonArray tempArray2 = tempArray.at(j)["logicExpress"].toArray();
for (int k = 0; k < tempArray2.size(); k++) {
QJsonObject tempObj2 = tempArray2[k].toObject();
@ -1091,6 +1101,7 @@ void CConfiguration::on_radioButton_1_clicked()
{
m_curentRLY = 3;
ui->label_3->setText(ui->radioButton_1->text()+"");
ViewRelay(3);
}
@ -1098,6 +1109,7 @@ void CConfiguration::on_radioButton_1_clicked()
void CConfiguration::on_radioButton_2_clicked()
{
m_curentRLY = 4;
ui->label_3->setText(ui->radioButton_2->text()+"");
ViewRelay(4);
}
@ -1105,6 +1117,7 @@ void CConfiguration::on_radioButton_2_clicked()
void CConfiguration::on_radioButton_3_clicked()
{
m_curentRLY = 5;
ui->label_3->setText(ui->radioButton_3->text()+"");
ViewRelay(5);
}
@ -1112,6 +1125,7 @@ void CConfiguration::on_radioButton_3_clicked()
void CConfiguration::on_radioButton_4_clicked()
{
m_curentRLY = 6;
ui->label_3->setText(ui->radioButton_4->text()+"");
ViewRelay(6);
}
@ -1119,6 +1133,7 @@ void CConfiguration::on_radioButton_4_clicked()
void CConfiguration::on_radioButton_5_clicked()
{
m_curentRLY = 7;
ui->label_3->setText(ui->radioButton_5->text()+"");
ViewRelay(7);
}
@ -1126,6 +1141,7 @@ void CConfiguration::on_radioButton_5_clicked()
void CConfiguration::on_radioButton_6_clicked()
{
m_curentRLY = 8;
ui->label_3->setText(ui->radioButton_6->text()+"");
ViewRelay(8);
}
@ -1133,6 +1149,7 @@ void CConfiguration::on_radioButton_6_clicked()
void CConfiguration::on_radioButton_8_clicked()
{
m_curentRLY = 10;
ui->label_3->setText(ui->radioButton_8->text()+"");
ViewRelay(10);
}
@ -1140,6 +1157,7 @@ void CConfiguration::on_radioButton_8_clicked()
void CConfiguration::on_radioButton_7_clicked()
{
m_curentRLY = 9;
ui->label_3->setText(ui->radioButton_7->text()+"");
ViewRelay(9);
}
@ -1147,6 +1165,7 @@ void CConfiguration::on_radioButton_7_clicked()
void CConfiguration::on_radioButton_9_clicked()
{
m_curentRLY = 11;
ui->label_3->setText(ui->radioButton_9->text()+"");
ViewRelay(11);
}
@ -1154,6 +1173,7 @@ void CConfiguration::on_radioButton_9_clicked()
void CConfiguration::on_radioButton_10_clicked()
{
m_curentRLY = 12;
ui->label_3->setText(ui->radioButton_10->text()+"");
ViewRelay(12);
}

View File

@ -392,7 +392,7 @@ color: rgb(27, 30, 35);</string>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>第二层延时:</string>
<string>工况延时:</string>
</property>
</widget>
</item>
@ -437,6 +437,45 @@ color: rgb(27, 30, 35);</string>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>- -</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_delay">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>S</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5"/>
</item>

206
CustomFilter.cpp Normal file
View File

@ -0,0 +1,206 @@
#include "CustomFilter.h"
#include "ui_CustomFilter.h"
#include <QNetworkRequest>
#include "QMyTableViewBtnDelegate.h"
#include "NetMgr.h"
#include <QListView>
CustomFilter::CustomFilter(QWidget *parent) :
QWidget(parent),
ui(new Ui::CustomFilter)
{
ui->setupUi(this);
headerStr = QObject::tr("频率(Hz),衰减位移量(um)");
model = new QStandardItemModel(ui->tableView);
ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); //选中行
QStringList headerList = headerStr.split(",");
model->setHorizontalHeaderLabels(headerList);
model->setColumnCount(headerList.size());
ui->tableView->setModel(model);
ui->tableView->setAlternatingRowColors(true);
ui->tableView->setColumnWidth(1, 150);
ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
ui->comboBox_open->setView(new QListView());
ui->comboBox_open->addItem("");
ui->comboBox_open->addItem("");
connect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
connect(ui->comboBox_open,SIGNAL(currentIndexChanged(const QString &)),this,SLOT(comboBox_open_currentTextChanged(const QString&)));
setAttribute(Qt::WA_DeleteOnClose);
}
CustomFilter::~CustomFilter()
{
qDebug() << "~CustomFilter()" << endl;
disconnect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
delete ui;
}
void CustomFilter::on_pushButton_Add_clicked()
{
int rowCount = model->rowCount();
model->setRowCount(rowCount+1);
model->setData(model->index(rowCount,0,QModelIndex()),"");
model->setData(model->index(rowCount,1,QModelIndex()),"");
}
void CustomFilter::on_pushButton_Del_clicked()
{
int rowCount = model->rowCount();
int row = ui->tableView->currentIndex().row();//获得当前行索引
if(rowCount < 1 || row == -1){
QMessageBox::warning(this, QStringLiteral("提示"), QStringLiteral("请先选择一条记录!"));
return;
}
model->removeRow(row);
}
void CustomFilter::on_pushButton_Submit_clicked()
{
int rowCount = model->rowCount();
QJsonObject sendData;
sendData["cmd"] = "99";
sendData["chan_id"] = channel_ID;
sendData["num"] = rowCount;
QJsonArray range;
for(int i = 0; i < rowCount;i++){
QModelIndex index = model->index(i,0);
QString strData = model->data(index).toString();
range.append(strData.toInt());
index = model->index(i,1);
strData = model->data(index).toString();
range.append(strData.toInt());
}
sendData["range"] = range;
QNetworkRequest req;
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
req.setUrl(sUrl);
g_NetMgr->PostJson(req,sendData);
bool type ;
if(ui->comboBox_open->currentText() == ""){
type = true;
}
if(ui->comboBox_open->currentText() == ""){
type = false;
}
if(ui->doubleSpinBox_start->text().toDouble() >= ui->doubleSpinBox_stop->text().toDouble()){
QMessageBox::warning(this, QStringLiteral("提示"), QStringLiteral("频率下限设置错误!"));
return;
}
QJsonObject sendData2;
sendData2["cmd"] = "95";
sendData2["chan_id"] = channel_ID;
sendData2["open"] = type;
sendData2["start"] = ui->doubleSpinBox_start->text().toDouble();
sendData2["stop"] = ui->doubleSpinBox_stop->text().toDouble();
req.setUrl(sUrl);
g_NetMgr->PostJson(req,sendData2);
this->close();
}
void CustomFilter::slotNetMgr(QString sAddr, const QVariant &msg)
{
QJsonObject objec = msg.value<QJsonObject>();
if(objec.contains("cmd"))
{
QJsonValue arrays_value = objec.take("cmd");
qDebug() << "arrays_value" << arrays_value << endl;
bool Status = objec.take("success").toBool();
QString strMessage = objec.take("message").toString();
if(!Status){
QMessageBox::information(NULL, QStringLiteral("提示"), strMessage);
return;
}
if(arrays_value.toString() == "94"){
int Statusfilter = objec.take("status").toInt();
ui->doubleSpinBox_start->setValue(objec.take("start").toDouble());
ui->doubleSpinBox_stop->setValue(objec.take("stop").toDouble());
if(Statusfilter){
ui->comboBox_open->setCurrentText("");
}else if(!Statusfilter){
ui->comboBox_open->setCurrentText("");
ui->doubleSpinBox_start->setEnabled(false);
ui->doubleSpinBox_stop->setEnabled(false);
}
QMessageBox::information(this, QStringLiteral("提示"), QStringLiteral("获取成功!"));
}else if(arrays_value.toString() == "98"){
int num = objec["num"].toInt();
int j = 0;
model->setRowCount(num);
QJsonArray range = objec["range"].toArray();
for (int i = 0; i < num; i++) {
model->setData(model->index(i,0,QModelIndex()),range[j].toInt());
j++;
model->setData(model->index(i,1,QModelIndex()),range[j].toInt());
j++;
}
QMessageBox::information(this, QStringLiteral("提示"), QStringLiteral("获取成功!"));
}else if(arrays_value.toString() == "112"){
int Statusfilter = objec.take("status").toInt();
ui->doubleSpinBox_start->setValue(objec.take("start").toDouble());
ui->doubleSpinBox_stop->setValue(objec.take("stop").toDouble());
if(Statusfilter){
ui->comboBox_open->setCurrentText("");
}else if(!Statusfilter){
ui->comboBox_open->setCurrentText("");
ui->doubleSpinBox_start->setEnabled(false);
ui->doubleSpinBox_stop->setEnabled(false);
}
int num = objec["num"].toInt();
int j = 0;
model->setRowCount(num);
QJsonArray range = objec["range"].toArray();
for (int i = 0; i < num; i++) {
model->setData(model->index(i,0,QModelIndex()),range[j].toInt());
j++;
model->setData(model->index(i,1,QModelIndex()),range[j].toInt());
j++;
}
QMessageBox::information(this, QStringLiteral("提示"), QStringLiteral("获取成功!"));
}else if(arrays_value.toString() == "95" || arrays_value.toString() == "99"){
QMessageBox::information(this, QStringLiteral("提示"), QStringLiteral("设置成功!"));
}
}
if(!vibrate_channel){
ui->comboBox_open->setEnabled(false);
ui->doubleSpinBox_start->setEnabled(false);
ui->doubleSpinBox_stop->setEnabled(false);
}
}
void CustomFilter::getfilterInfo()
{
QJsonObject sendData;
sendData["cmd"] = "112";
sendData["chan_id"] = channel_ID;
QNetworkRequest req;
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
req.setUrl(sUrl);
g_NetMgr->PostJson(req,sendData);
}
void CustomFilter::comboBox_open_currentTextChanged(const QString &str)
{
if(str == ""){
ui->doubleSpinBox_start->setEnabled(false);
ui->doubleSpinBox_stop->setEnabled(false);
}else if(str == ""){
ui->doubleSpinBox_start->setEnabled(true);
ui->doubleSpinBox_stop->setEnabled(true);
}
}

39
CustomFilter.h Normal file
View File

@ -0,0 +1,39 @@
#ifndef CUSTOMFILTER_H
#define CUSTOMFILTER_H
#include <QWidget>
#include <QStandardItemModel> //数据模型类
#include "TableHeaderView.h"
#include "global.h"
namespace Ui {
class CustomFilter;
}
class CustomFilter : public QWidget
{
Q_OBJECT
public:
explicit CustomFilter(QWidget *parent = nullptr);
~CustomFilter();
QString channel_ID;
int vibrate_channel;
void getfilterInfo();
private slots:
void on_pushButton_Add_clicked();
void on_pushButton_Del_clicked();
void on_pushButton_Submit_clicked();
void slotNetMgr(QString sAddr,const QVariant& msg);
void comboBox_open_currentTextChanged(const QString &str);
private:
Ui::CustomFilter *ui;
TableHeaderView *myHeader;
QStandardItemModel *model;
QString headerStr ;
};
#endif // CUSTOMFILTER_H

328
CustomFilter.ui Normal file
View File

@ -0,0 +1,328 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CustomFilter</class>
<widget class="QWidget" name="CustomFilter">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>716</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>滤波配置</string>
</property>
<property name="styleSheet">
<string notr="true">font: 10pt &quot;黑体&quot;;
color: rgb(27, 30, 35);</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QWidget" name="widget" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>100</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>带通滤波</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>32</width>
<height>33</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>是否开启</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_open">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>32</width>
<height>33</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>频率下限</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBox_start">
<property name="maximum">
<double>999999.989999999990687</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Hz</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>32</width>
<height>33</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>频率上限</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBox_stop">
<property name="decimals">
<number>2</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>999999.989999999990687</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Hz</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>32</width>
<height>33</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_2" native="true">
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>自定义滤波设置</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QWidget" name="widget_3" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QTableView" name="tableView">
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_4" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>136</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_Add">
<property name="minimumSize">
<size>
<width>96</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>96</width>
<height>28</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">#pushButton_Add { border-image: url(:/image/Btn/normal_Btn.png);
color:#1f5188 }
#pushButton_Add:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_Add:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_Add:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}</string>
</property>
<property name="text">
<string>新增</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_Del">
<property name="minimumSize">
<size>
<width>96</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>96</width>
<height>28</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">#pushButton_Del { border-image: url(:/image/Btn/normal_Btn.png);
color:#1f5188 }
#pushButton_Del:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_Del:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_Del:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}</string>
</property>
<property name="text">
<string>删除</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_Submit">
<property name="minimumSize">
<size>
<width>96</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>96</width>
<height>28</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">#pushButton_Submit { border-image: url(:/image/Btn/normal_Btn.png);
color:#1f5188 }
#pushButton_Submit:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_Submit:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_Submit:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}</string>
</property>
<property name="text">
<string>提交</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>136</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -29,14 +29,17 @@ CONFIG += c++11
SOURCES += \
AddChannel.cpp \
AlarmDetails.cpp \
Backup.cpp \
CharacteristicList.cpp \
Configuration.cpp \
CopyChannelSetting.cpp \
CopyDatFile.cpp \
CustomFilter.cpp \
DIO_Board.cpp \
DataGraphView.cpp \
FileServerConfig.cpp \
HistoryAlarm.cpp \
ImportConfig.cpp \
Mqttclient.cpp \
MyTreeView.cpp \
NTPServerConfig.cpp \
@ -79,14 +82,17 @@ SOURCES += \
HEADERS += \
AddChannel.h \
AlarmDetails.h \
Backup.h \
CharacteristicList.h \
Configuration.h \
CopyChannelSetting.h \
CopyDatFile.h \
CustomFilter.h \
DIO_Board.h \
DataGraphView.h \
FileServerConfig.h \
HistoryAlarm.h \
ImportConfig.h \
Mqttclient.h \
MyTreeView.h \
NTPServerConfig.h \
@ -129,14 +135,18 @@ HEADERS += \
FORMS += \
AddChannel.ui \
AlarmDetails.ui \
BackUp.ui \
Backup.ui \
CharacteristicList.ui \
Configuration.ui \
CopyChannelSetting.ui \
CopyDatFile.ui \
CustomFilter.ui \
DIO_Board.ui \
DataGraphView.ui \
FileServerConfig.ui \
HistoryAlarm.ui \
ImportConfig.ui \
NTPServerConfig.ui \
OtherConfig.ui \
PSConfig.ui \

246
ImportConfig.cpp Normal file
View File

@ -0,0 +1,246 @@
#include "ImportConfig.h"
#include "ui_ImportConfig.h"
#include <QFileDialog>
#include <QProcess>
#include "sqlitedb.h"
CImportConfig::CImportConfig(QWidget *parent) :
QWidget(parent),
ui(new Ui::CImportConfig)
{
ui->setupUi(this);
}
CImportConfig::~CImportConfig()
{
delete ui;
}
void CImportConfig::on_pushButton_importpath_clicked()
{
QString dirpath = QFileDialog::getExistingDirectory(this, QStringLiteral("选择目录"), "./", QFileDialog::ShowDirsOnly);
if(dirpath.isEmpty()) dirpath = QDir::currentPath();
ui->lineEdit_filepath->setText(dirpath + "/");
import_path = dirpath;
}
void CImportConfig::on_pushButton_confirm_clicked()
{
if(ui->lineEdit_filepath->text() == ""){
QMessageBox::warning(this,tr("提示"),tr("请选择导入文件路径!"));
return;
}
QString copy_path = QCoreApplication::applicationDirPath() + "\\config\\copy\\";
QDir copyDir(copy_path);
// 创建目标文件夹
if (!copyDir.mkpath(".")) {
qDebug() << "无法创建目标文件夹";
return;
}
copyDirectory(import_path, copy_path);
QFile fileMAC(copy_path+"macbackup");
if (!fileMAC.open(QIODevice::ReadOnly | QIODevice::Text)) {
qDebug() << "无法打开文件";
return;
}
QTextStream in(&fileMAC);
QString oldMAC= "";
while (!in.atEnd()) {
oldMAC = in.readLine();
qDebug() << oldMAC;
}
fileMAC.close();
QFile sourceFile(copy_path + "config.db");
// if (!sourceFile.copy(copy_path + "\\config.db")) {
// QMessageBox::question(NULL, "提示", "导入数据库失败!");
// return;
// }
qDebug() << QSqlDatabase::drivers() << "\r\n";
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(copy_path + "config.db");
if (!db.open())
{
qDebug() << "Error: Failed to connect database." << database.lastError();
return ;
}
QString strSql = QString("update t_ChannelSetting SET channelId = '%1' || SUBSTR(channelId, 13),dataWatchNo='%2';").arg(MAC).arg(MAC);
ExeSqlData(strSql);
strSql = QString("update t_ChannelSetting SET pairChannelId = '%1' || SUBSTR(channelId, 13) where pairChannelId <> '' AND pairChannelId <> 'NONE' ;").arg(MAC);
ExeSqlData(strSql);
strSql = QString("update t_ChannelSetting SET speedRefChannelId = '%1' || SUBSTR(channelId, 13) where speedRefChannelId <> '' AND pairChannelId <> 'NONE';").arg(MAC);
ExeSqlData(strSql);
strSql = QString("update t_DeviceInfo SET MAC = '%1' ;").arg(MAC);
ExeSqlData(strSql);
strSql = QString("update t_TriggerConfig SET ChannelID = '%1' || SUBSTR(ChannelID, 13) ;").arg(MAC);
ExeSqlData(strSql);
strSql = QString("update t_WorkConditionChannels SET ChannelId = '%1' || SUBSTR(ChannelId, 13) where ChannelId <> '';").arg(MAC);
ExeSqlData(strSql);
strSql = QString("update t_WorkConditionRules SET ChannelId = '%1' || SUBSTR(ChannelId, 13) ;").arg(MAC);
ExeSqlData(strSql);
strSql = QString("update t_UnitConfiguration SET ChannelId = '%1' || SUBSTR(ChannelId, 13) ;").arg(MAC);
ExeSqlData(strSql);
db.close();
QString fileName = copy_path + "Graph1.json";
QString value;
QFile file(fileName);
file.open(QIODevice::ReadWrite | QIODevice::Text);
value = file.readAll();
file.resize(0);
file.write(value.toUtf8());
value.replace(oldMAC,MAC);
value = file.readAll();
file.close();
QString fileName2 = copy_path + "Graph2.json";
QFile file2(fileName2);
file2.open(QIODevice::ReadWrite | QIODevice::Text);
value = file2.readAll();
file2.resize(0);
value.replace(oldMAC,MAC);
file2.write(value.toUtf8());
file2.close();
QString ChannelSettings = copy_path + "ChannelSettings.json";
QFile fileChannelSettings(ChannelSettings);
fileChannelSettings.open(QIODevice::ReadWrite | QIODevice::Text);
value = fileChannelSettings.readAll();
fileChannelSettings.resize(0);
value.replace(oldMAC,MAC);
fileChannelSettings.write(value.toUtf8());
fileChannelSettings.close();
QString UnitConfigurations = copy_path + "UnitConfigurations.json";
QFile fileUnitConfigurations(UnitConfigurations);
fileUnitConfigurations.open(QIODevice::ReadWrite | QIODevice::Text);
value = fileUnitConfigurations.readAll();
fileUnitConfigurations.resize(0);
value.replace(oldMAC,MAC);
fileUnitConfigurations.write(value.toUtf8());
fileUnitConfigurations.close();
QString TriggerSettings = copy_path + "TriggerSettings.json";
QFile fileTriggerSettings(TriggerSettings);
fileTriggerSettings.open(QIODevice::ReadWrite | QIODevice::Text);
value = fileTriggerSettings.readAll();
fileTriggerSettings.resize(0);
value.replace(oldMAC,MAC);
fileTriggerSettings.write(value.toUtf8());
fileTriggerSettings.close();
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "UnitWorkConditionsInfo.json", copy_path + "UnitWorkConditionsInfo.json");
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "UnitParameters.json", copy_path + "UnitParameters.json");
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "ServerConfig.json", copy_path + "ServerConfig.json");
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "NetWorkConfig.json", copy_path + "NetWorkConfig.json");
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "ModbusConfig.json", copy_path + "ModbusConfig.json");
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "TcpConfig.json", copy_path + "TcpConfig.json");
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "UnitBoardsInfo.json", copy_path + "UnitBoardsInfo.json");
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "ZeroDrift.json", copy_path + "ZeroDrift.json");
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "UnitBoardsInfo.json", copy_path + "UnitBoardsInfo.json");
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "ConfidenceDegree.json", copy_path + "ConfidenceDegree.json");
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "TriggerConfig.json", copy_path + "TriggerConfig.json");
copyFile(QCoreApplication::applicationDirPath() + "\\config\\" + "config.ini", copy_path + "config.ini");
qApp->exit(0);
g_SqliteDB->CloseDataBase();
copyDirectory(copy_path, QCoreApplication::applicationDirPath() + "\\config\\");
QMessageBox::information(this,tr("导入"),tr("导入成功"));
// 如果目标文件夹已存在,则删除它
QDir copyDir2(copy_path);
if (copyDir2.exists()) {
copyDir2.removeRecursively();
}
QProcess::startDetached(qApp->applicationFilePath(), QStringList());
}
int CImportConfig::ExeSqlData(QString& strSql)
{
QSqlQuery sql_query;
int iRet = -1;
qDebug() << "strSql" << strSql << endl;
if(!sql_query.exec(strSql))
{
qDebug() << sql_query.lastError();
}
else
{
while(sql_query.next())
{
iRet = sql_query.value(0).toInt();
}
}
return iRet;
}
bool CImportConfig::copyFile(const QString &sourceFile, const QString &destinationFile)
{
QFile srcFile(sourceFile);
QFile dstFile(destinationFile);
if (!srcFile.exists()) {
qDebug() << "Source file does not exist:" << sourceFile;
return false;
}
if (!srcFile.open(QIODevice::ReadOnly)) {
qDebug() << "Unable to open source file for reading:" << sourceFile;
return false;
}
if (!dstFile.open(QIODevice::WriteOnly)) {
srcFile.close();
qDebug() << "Unable to open destination file for writing:" << destinationFile;
return false;
}
dstFile.write(srcFile.readAll());
srcFile.close();
dstFile.close();
return true;
}
bool CImportConfig::copyDirectory(const QString &sourceDir, const QString &destinationDir) {
QDir srcDir(sourceDir);
QDir destDir(destinationDir);
// 复制文件
foreach (const QFileInfo &fileInfo, srcDir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot)) {
QString fileName = fileInfo.fileName();
QString srcFilePath = srcDir.absoluteFilePath(fileName);
QString destFilePath = destDir.absoluteFilePath(fileName);
if (fileInfo.isDir()) {
// 递归复制子文件夹
if (!copyDirectory(srcFilePath, destFilePath)) {
return false;
}
} else {
// 复制文件
QFile dest(destFilePath);
if (dest.exists()) {
bool re = dest.remove(); // 如果目标文件存在,先删除它
if(!re){
qDebug() << "删除失败 "<<dest;
}
}
if (!QFile::copy(srcFilePath, destFilePath)) {
qDebug() << "无法复制文件" << srcFilePath << "" << destFilePath;
return false;
}
}
}
return true;
}

35
ImportConfig.h Normal file
View File

@ -0,0 +1,35 @@
#ifndef IMPORTCONFIG_H
#define IMPORTCONFIG_H
#include <QWidget>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include "global.h"
namespace Ui {
class CImportConfig;
}
class CImportConfig : public QWidget
{
Q_OBJECT
public:
explicit CImportConfig(QWidget *parent = nullptr);
~CImportConfig();
private slots:
void on_pushButton_importpath_clicked();
void on_pushButton_confirm_clicked();
private:
Ui::CImportConfig *ui;
QString import_path;
QSqlDatabase database;
int ExeSqlData(QString& strSql);
bool copyFile(const QString &sourceFile, const QString &destinationFile);
bool copyDirectory(const QString &sourceDir, const QString &destinationDir);
};
#endif // IMPORTCONFIG_H

150
ImportConfig.ui Normal file
View File

@ -0,0 +1,150 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CImportConfig</class>
<widget class="QWidget" name="CImportConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>713</width>
<height>168</height>
</rect>
</property>
<property name="windowTitle">
<string>配置导入</string>
</property>
<property name="styleSheet">
<string notr="true">font: 10pt &quot;黑体&quot;;
color: rgb(27, 30, 35);</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>请填写导入信息</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_2" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="lineEdit_filepath">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_importpath">
<property name="minimumSize">
<size>
<width>96</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>96</width>
<height>28</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">#pushButton_importpath { border-image: url(:/image/Btn/normal_Btn.png);
color:#1f5188 }
#pushButton_importpath:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_importpath:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_importpath:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}</string>
</property>
<property name="text">
<string>导入路径</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<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="pushButton_confirm">
<property name="minimumSize">
<size>
<width>96</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>96</width>
<height>28</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">#pushButton_confirm { border-image: url(:/image/Btn/normal_Btn.png);
color:#1f5188 }
#pushButton_confirm:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_confirm:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_confirm:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}</string>
</property>
<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>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -4,6 +4,8 @@
#include <QNetworkRequest>
#include "ftpclient.h"
#include "CopyDatFile.h"
#include "Backup.h"
#include "ImportConfig.h"
CTerminalInfo::CTerminalInfo(QWidget *parent) :
QWidget(parent),
@ -209,7 +211,7 @@ void CTerminalInfo::slotNetMgr(QString sAddr, const QVariant &msg)
ui->label_Version->setText(sysObj["softVersion"].toString());
ui->label_Type->setText(sysObj["deviceType"].toString());
ui->label_SerialNo->setText(sysObj["serialNumber"].toString());
ui->label_Address->setText(sysObj["dataWatchIpAddress"].toString());
//ui->label_Address->setText(sysObj["dataWatchIpAddress"].toString());
}
}
}
@ -305,3 +307,22 @@ void CTerminalInfo::on_pushButtonCopy_clicked()
copyDatDialog->show();
}
void CTerminalInfo::on_pushButton_export_clicked()
{
CBackup *BackupDialog = new CBackup();
BackupDialog->setWindowModality(Qt::ApplicationModal);
BackupDialog->setAttribute(Qt::WA_DeleteOnClose);
BackupDialog->setWindowFlags(BackupDialog->windowFlags() &~ Qt::WindowMaximizeButtonHint);
BackupDialog->show();
}
void CTerminalInfo::on_pushButton_import_clicked()
{
CImportConfig *ImportConfigDialog = new CImportConfig();
ImportConfigDialog->setWindowModality(Qt::ApplicationModal);
ImportConfigDialog->setAttribute(Qt::WA_DeleteOnClose);
ImportConfigDialog->setWindowFlags(ImportConfigDialog->windowFlags() &~ Qt::WindowMaximizeButtonHint);
ImportConfigDialog->show();
}

View File

@ -34,6 +34,10 @@ private slots:
void on_pushButtonCopy_clicked();
void on_pushButton_export_clicked();
void on_pushButton_import_clicked();
private:
Ui::CTerminalInfo *ui;

View File

@ -524,7 +524,7 @@
</size>
</property>
<property name="text">
<string>终端地址</string>
<string>数据配置</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -532,12 +532,76 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_Address">
<widget class="QPushButton" name="pushButton_import">
<property name="minimumSize">
<size>
<width>96</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>96</width>
<height>28</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">#pushButton_import { border-image: url(:/image/Btn/normal_Btn.png);
color:#1f5188 }
#pushButton_import:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_import:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_import:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}</string>
</property>
<property name="text">
<string>- -</string>
<string>导入</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_export">
<property name="minimumSize">
<size>
<width>96</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>96</width>
<height>28</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">#pushButton_export { border-image: url(:/image/Btn/normal_Btn.png);
color:#1f5188 }
#pushButton_export:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_export:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_export:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}</string>
</property>
<property name="text">
<string>导出</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<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>

View File

@ -260,8 +260,8 @@ void CTriggerConfig::on_comboBox_channelConfig_currentTextChanged(const QString
}else if(g_ChannelBaseInfo[ii].channelType == "ACCELEROMETER"){
LoadTriggerConfig(g_ChannelBaseInfo[ii].channelID);
if(m_vecTriggerConfig.size() < 1){
model->setRowCount(4);
for (int i = 0; i < 4; i++) {
model->setRowCount(6);
for (int i = 0; i < 6; i++) {
model->setItem(i, 2, add_checkBox_model(0));
model->setItem(i, 3, add_checkBox_model(0));
model->setItem(i, 4, add_checkBox_model(0));
@ -275,6 +275,8 @@ void CTriggerConfig::on_comboBox_channelConfig_currentTextChanged(const QString
model->setData(model->index(1,1,QModelIndex()),"峰值");
model->setData(model->index(2,1,QModelIndex()),"速度峰值");
model->setData(model->index(3,1,QModelIndex()),"速度有效值");
model->setData(model->index(4,1,QModelIndex()),"反时限报警值");
model->setData(model->index(5,1,QModelIndex()),"反时限危险值");
}
@ -283,8 +285,8 @@ void CTriggerConfig::on_comboBox_channelConfig_currentTextChanged(const QString
{
LoadTriggerConfig(g_ChannelBaseInfo[ii].channelID);
if(m_vecTriggerConfig.size() < 1){
model->setRowCount(4);
for (int i = 0; i < 4; i++) {
model->setRowCount(6);
for (int i = 0; i < 6; i++) {
model->setItem(i, 2, add_checkBox_model());
model->setItem(i, 3, add_checkBox_model());
model->setItem(i, 4, add_checkBox_model());
@ -298,6 +300,8 @@ void CTriggerConfig::on_comboBox_channelConfig_currentTextChanged(const QString
model->setData(model->index(1,1,QModelIndex()),"偏置电压/Gap");
model->setData(model->index(2,1,QModelIndex()),"监测保护峰峰值");
model->setData(model->index(3,1,QModelIndex()),"有效值");
model->setData(model->index(4,1,QModelIndex()),"反时限报警值");
model->setData(model->index(5,1,QModelIndex()),"反时限危险值");
}
@ -320,8 +324,8 @@ void CTriggerConfig::on_comboBox_channelConfig_currentTextChanged(const QString
{
LoadTriggerConfig(g_ChannelBaseInfo[ii].channelID);
if(m_vecTriggerConfig.size() < 1){
model->setRowCount(4);
for (int i = 0; i < 4; i++) {
model->setRowCount(6);
for (int i = 0; i < 6; i++) {
model->setItem(i, 2, add_checkBox_model());
model->setItem(i, 3, add_checkBox_model());
model->setItem(i, 4, add_checkBox_model());
@ -335,6 +339,8 @@ void CTriggerConfig::on_comboBox_channelConfig_currentTextChanged(const QString
model->setData(model->index(1,1,QModelIndex()),"峰值");
model->setData(model->index(2,1,QModelIndex()),"位移峰值");
model->setData(model->index(3,1,QModelIndex()),"位移有效值");
model->setData(model->index(4,1,QModelIndex()),"反时限报警值");
model->setData(model->index(5,1,QModelIndex()),"反时限危险值");
}
@ -357,8 +363,8 @@ void CTriggerConfig::on_comboBox_channelConfig_currentTextChanged(const QString
LoadTriggerConfig(g_ChannelBaseInfo[ii].channelID);
if(m_vecTriggerConfig.size() < 1){
model->setRowCount(3);
for (int i = 0; i < 3; i++){
model->setRowCount(5);
for (int i = 0; i < 5; i++){
model->setItem(i, 2, add_checkBox_model());
model->setItem(i, 3, add_checkBox_model());
model->setItem(i, 4, add_checkBox_model());
@ -371,6 +377,8 @@ void CTriggerConfig::on_comboBox_channelConfig_currentTextChanged(const QString
model->setData(model->index(0,1,QModelIndex()),"平均值");
model->setData(model->index(1,1,QModelIndex()),"最小值");
model->setData(model->index(2,1,QModelIndex()),"最大值");
model->setData(model->index(3,1,QModelIndex()),"反时限报警值");
model->setData(model->index(4,1,QModelIndex()),"反时限危险值");
}
}
@ -480,7 +488,8 @@ void CTriggerConfig::on_pushButton_submit_clicked()
QString strCol = "count(*)";
int count = g_SqliteDB->QueryData(strTableName,strCol,strWhere);
if(count < 1){
if(rowList[2] == "1" || rowList[4] == "1" || rowList[6] == "1"||rowList[8] == "1"){
if(rowList[2] == "1" || rowList[4] == "1" || rowList[6] == "1"||rowList[8] == "1")
{
QString strSql = QString(" values('%1','%2',%3,'%4','%5',%6,'%7',%8,'%9',%10,'%11',%12,'%13','%14','%15','%16','%17','%18',0) ;").\
arg(ChannelID).arg(ChannelName).arg(WorkConditonSN).arg("").arg(rowList[1]).arg(rowList[2]).arg(rowList[3]).arg(rowList[4]).arg(rowList[5]).arg(rowList[6]).\
arg(rowList[7]).arg(rowList[8]).arg(rowList[9]).arg(rowList[10]).arg(rowList[11]).arg(rowList[12]).arg(rowList[13]).arg(rowList[14]);
@ -496,7 +505,8 @@ void CTriggerConfig::on_pushButton_submit_clicked()
int count = g_SqliteDB->QueryData(strTableName,strCol,strWhere);
qDebug() << "count " << count << endl;
if(count == 0){
if(rowList[2] == "1" || rowList[4] == "1" || rowList[6] == "1"||rowList[8] == "1"){
if(rowList[2] == "1" || rowList[4] == "1" || rowList[6] == "1"||rowList[8] == "1")
{
QString strSql = QString(" set AlertOver = %1,AlertOverSetpoint = '%2',DangerOver = %3,DangerOverSetpoint = '%4',AlertUnder = %5,AlertUnderSetpoint = '%6',DangerUnder = %7,\
DangerUnderSetpoint = '%8',AlertTriggerStatus = '%9',DangerTriggerStatus = '%10',AlertTriggerDelay = '%11',DangerTriggerDelay = '%12',TriggerType = '%13', operate = 2 where ChannelID = '%14' and WorkConditionID = %15 and Characteristic = '%16' and operate <> 3; ").arg(rowList[2]).arg(rowList[3]).arg(rowList[4]).arg(rowList[5]).arg(rowList[6]).\
arg(rowList[7]).arg(rowList[8]).arg(rowList[9]).arg(rowList[10]).arg(rowList[11]).arg(rowList[12]).arg(rowList[13]).arg(rowList[14]).arg(ChannelID).arg(WorkConditonSN.toInt()).arg(rowList[1]);
@ -663,6 +673,10 @@ void CTriggerConfig::PushData()
rowObj["triggerFeatureName"] = "DiagnosisPeak";
else if(triggerConfig[j].Characteristic == "监测保护峰峰值")
rowObj["triggerFeatureName"] = "MonitorPk2Pk";
else if(triggerConfig[j].Characteristic == "反时限危险值")
rowObj["triggerFeatureName"] = "InvertDanger";
else if(triggerConfig[j].Characteristic == "反时限报警值")
rowObj["triggerFeatureName"] = "InvertAlarm";
QString triggerEventName = QString("%1-%2-%3").arg(rowObj["triggerFeatureName"].toString()).arg(triggerConfig[j].TriggerType).arg(triggerConfig[j].ChannelID);
@ -743,6 +757,10 @@ void CTriggerConfig::PushData()
rowObj["triggerFeatureName"] = "DiagnosisPeak";
else if(triggerConfig[j].Characteristic == "监测保护峰峰值")
rowObj["triggerFeatureName"] = "MonitorPk2Pk";
else if(triggerConfig[j].Characteristic == "反时限危险值")
rowObj["triggerFeatureName"] = "InvertDanger";
else if(triggerConfig[j].Characteristic == "反时限报警值")
rowObj["triggerFeatureName"] = "InvertAlarm";
QString triggerEventName = QString("%1-%2-%3").arg(rowObj["triggerFeatureName"].toString()).arg(triggerConfig[j].TriggerType).arg(triggerConfig[j].ChannelID);

View File

@ -130,6 +130,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>电厂名称</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -157,6 +160,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>机组名称</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -184,6 +190,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>电厂编号</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -211,6 +220,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>机组编号</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -238,6 +250,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>水轮机制造厂家</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -265,6 +280,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>发电机制造厂家</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -292,6 +310,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>机组类型</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -319,6 +340,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>流量系数</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -346,6 +370,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>额定励磁电流(A)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -380,6 +407,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>压力脉冲显示</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -407,6 +437,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>额定转速(r/min)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -471,6 +504,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>额定功率(MW)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -498,6 +534,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>最大水头(m)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -525,6 +564,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>最小水头(m)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -552,6 +594,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>设计水头(m)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -579,6 +624,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>叶片数</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -606,6 +654,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>导叶数</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -633,6 +684,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>上导瓦数</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -660,6 +714,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>下导瓦数</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -687,6 +744,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>水导瓦数</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -714,6 +774,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>推力瓦数</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
@ -744,6 +807,9 @@ color: rgb(27, 30, 35);</string>
<property name="text">
<string>发电机转子磁极个数</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>

View File

@ -19,7 +19,7 @@ CWaveDisPlay::CWaveDisPlay(QWidget *parent) :
ui->widget->setProperty("flag", "Title");
ui->widget_4->setProperty("flag", "normal");
ui->widget_wave->plotLayout()->insertRow(0);
QString strTitle = QString("1倍频频率 %1Hz1倍频幅值 %2相位角 %3").arg(0).arg(0).arg(0);
QString strTitle = QString("主频频率 %1 Hz频幅值 %2相位角 %3").arg(0).arg(0).arg(0);
customLogMessageHandler(QtDebugMsg,strTitle);
m_title = new QCPTextElement(ui->widget_wave, strTitle);
ui->widget_wave->plotLayout()->addElement(0, 0, m_title);
@ -208,6 +208,7 @@ void CWaveDisPlay::ParseDataTimeWave(QJsonObject & objContent)
bFlag = true;
m_ListWaveData = m_WaveData.split(",");
ui->widget_wave->xAxis->setLabel("Time(s)");
ui->widget_wave->yAxis->setLabel(m_ChannelUnit);
QString str = QString("wave size = %1").arg(m_ListWaveData.size());
customLogMessageHandler(QtDebugMsg,str);
double gap = 0.0;
@ -287,7 +288,7 @@ void CWaveDisPlay::ParseDataFsWave(QJsonObject & objContent)
//qDebug() << m_ListWaveData << endl;
ui->widget_wave->xAxis->setRange(0, 1);
ui->widget_wave->xAxis->setLabel("Fs(Hz)");
//ui->widget_wave->yAxis->setLabel("um");
ui->widget_wave->yAxis->setLabel(m_ChannelUnit);
QVector<double> x,y;
QCPGraph* graph = ui->widget_wave->addGraph(ui->widget_wave->xAxis, ui->widget_wave->yAxis);
@ -320,8 +321,9 @@ void CWaveDisPlay::ParseDataKeyPhase(QJsonObject& objContent)
double freq1x = objContent["1xfreq"].toDouble();
m_ListKeyPhaseData = data.split(",");
qDebug() << "m_ListKeyPhaseData" << m_ListKeyPhaseData << endl;
QString strTitle = QString("1倍频频率 %1Hz1倍频幅值 %2相位角 %3").arg(freq1x).arg(amp1x).arg(PhaseAngle);
QString strAmp1x = QString::number(amp1x, 'f', 2); // 保留两位小数
QString strPhaseAngle = QString::number(PhaseAngle, 'f', 1);
QString strTitle = QString("主频频率 %1 Hz主频幅值 %2相位角 %3").arg(freq1x).arg(strAmp1x).arg(strPhaseAngle);
customLogMessageHandler(QtDebugMsg,strTitle);
m_title = new QCPTextElement(ui->widget_wave, strTitle);
ui->widget_wave->plotLayout()->addElement(0, 0, m_title);
@ -518,7 +520,7 @@ void CWaveDisPlay::on_comboBox_channel_2_currentTextChanged(const QString &arg1)
m_ChannelID = g_ChannelBaseInfo[i].channelID;
m_ChannelType = g_ChannelBaseInfo[i].channelType;
m_speedRefChannelId = g_ChannelBaseInfo[i].speedRefChannelId;
m_ChannelUnit = g_ChannelBaseInfo[i].sensorEngineeringUnit;
if(ui->Btn_Timewave->isChecked())
{

View File

@ -49,6 +49,7 @@ private:
Ui::CWaveDisPlay *ui;
NetMgr *m_pNetMgr; //HTTP消息类对象
QString m_ChannelID;
QString m_ChannelUnit;
QString m_ChannelType;
QString m_speedRefChannelId;
QString m_WaveData;

View File

@ -178,7 +178,7 @@ color: rgb(27, 30, 35);</string>
</property>
<property name="maximumSize">
<size>
<width>240</width>
<width>150</width>
<height>16777215</height>
</size>
</property>
@ -208,7 +208,7 @@ color: rgb(27, 30, 35);</string>
</property>
<property name="maximumSize">
<size>
<width>240</width>
<width>150</width>
<height>16777215</height>
</size>
</property>
@ -238,7 +238,7 @@ color: rgb(27, 30, 35);</string>
</property>
<property name="maximumSize">
<size>
<width>240</width>
<width>150</width>
<height>16777215</height>
</size>
</property>
@ -268,7 +268,7 @@ color: rgb(27, 30, 35);</string>
</property>
<property name="maximumSize">
<size>
<width>240</width>
<width>150</width>
<height>16777215</height>
</size>
</property>
@ -298,7 +298,7 @@ color: rgb(27, 30, 35);</string>
</property>
<property name="maximumSize">
<size>
<width>240</width>
<width>150</width>
<height>16777215</height>
</size>
</property>
@ -328,7 +328,7 @@ color: rgb(27, 30, 35);</string>
</property>
<property name="maximumSize">
<size>
<width>240</width>
<width>150</width>
<height>16777215</height>
</size>
</property>
@ -358,7 +358,7 @@ color: rgb(27, 30, 35);</string>
</property>
<property name="maximumSize">
<size>
<width>240</width>
<width>150</width>
<height>16777215</height>
</size>
</property>
@ -371,7 +371,7 @@ color: rgb(27, 30, 35);</string>
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>蜗壳差压通道</string>
<string>蜗壳差压:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -388,7 +388,7 @@ color: rgb(27, 30, 35);</string>
</property>
<property name="maximumSize">
<size>
<width>240</width>
<width>150</width>
<height>16777215</height>
</size>
</property>
@ -401,7 +401,7 @@ color: rgb(27, 30, 35);</string>
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string>机组效率通道</string>
<string>机组效率:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -418,7 +418,7 @@ color: rgb(27, 30, 35);</string>
</property>
<property name="maximumSize">
<size>
<width>240</width>
<width>150</width>
<height>16777215</height>
</size>
</property>
@ -431,7 +431,7 @@ color: rgb(27, 30, 35);</string>
<item>
<widget class="QLabel" name="label_11">
<property name="text">
<string>发电机出口开关通道</string>
<string>发电机出口开关:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -448,7 +448,7 @@ color: rgb(27, 30, 35);</string>
</property>
<property name="maximumSize">
<size>
<width>240</width>
<width>150</width>
<height>16777215</height>
</size>
</property>
@ -461,7 +461,7 @@ color: rgb(27, 30, 35);</string>
<item>
<widget class="QLabel" name="label_12">
<property name="text">
<string>励磁开关通道</string>
<string>励磁开关:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -478,7 +478,7 @@ color: rgb(27, 30, 35);</string>
</property>
<property name="maximumSize">
<size>
<width>240</width>
<width>150</width>
<height>16777215</height>
</size>
</property>
@ -491,7 +491,7 @@ color: rgb(27, 30, 35);</string>
<item>
<widget class="QLabel" name="label_13">
<property name="text">
<string>发电/抽水工况通道</string>
<string>发电/抽水工况:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -508,7 +508,7 @@ color: rgb(27, 30, 35);</string>
</property>
<property name="maximumSize">
<size>
<width>240</width>
<width>150</width>
<height>16777215</height>
</size>
</property>
@ -521,7 +521,7 @@ color: rgb(27, 30, 35);</string>
<item>
<widget class="QLabel" name="label_14">
<property name="text">
<string>蜗壳进口压力通道</string>
<string>蜗壳进口压力:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -538,7 +538,7 @@ color: rgb(27, 30, 35);</string>
</property>
<property name="maximumSize">
<size>
<width>240</width>
<width>150</width>
<height>16777215</height>
</size>
</property>
@ -551,7 +551,7 @@ color: rgb(27, 30, 35);</string>
<item>
<widget class="QLabel" name="label_15">
<property name="text">
<string>尾水出口压力通道</string>
<string>尾水出口压力:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -568,7 +568,7 @@ color: rgb(27, 30, 35);</string>
</property>
<property name="maximumSize">
<size>
<width>280</width>
<width>150</width>
<height>16777215</height>
</size>
</property>
@ -598,7 +598,7 @@ color: rgb(27, 30, 35);</string>
</property>
<property name="maximumSize">
<size>
<width>240</width>
<width>150</width>
<height>16777215</height>
</size>
</property>

View File

@ -73,6 +73,16 @@ QTableView::item {
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QComboBox" name="comboBox_operate">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_open">
<property name="minimumSize">

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>812</width>
<height>718</height>
<height>754</height>
</rect>
</property>
<property name="windowTitle">
@ -15,8 +15,7 @@
</property>
<property name="styleSheet">
<string notr="true">font: 10pt &quot;黑体&quot;;
color: rgb(27, 30, 35);
</string>
color: rgb(27, 30, 35);</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
@ -251,7 +250,7 @@ color: rgb(27, 30, 35);
<property name="title">
<string> 通道信息</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_58">
<layout class="QHBoxLayout" name="horizontalLayout_33">
<item>
<spacer name="horizontalSpacer_11">
<property name="orientation">
@ -462,12 +461,9 @@ color: rgb(27, 30, 35);
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_17">
<layout class="QVBoxLayout" name="verticalLayout_13">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<property name="spacing">
<number>1</number>
</property>
<item>
<widget class="QLabel" name="label_12">
<property name="minimumSize">
@ -494,7 +490,7 @@ color: rgb(27, 30, 35);
<widget class="QComboBox" name="pairChannelComBox">
<property name="minimumSize">
<size>
<width>150</width>
<width>0</width>
<height>0</height>
</size>
</property>
@ -514,7 +510,7 @@ color: rgb(27, 30, 35);
</property>
<property name="maximumSize">
<size>
<width>110</width>
<width>100</width>
<height>16777215</height>
</size>
</property>
@ -530,7 +526,7 @@ color: rgb(27, 30, 35);
<widget class="QLineEdit" name="lineEdit_confidenceDegree">
<property name="minimumSize">
<size>
<width>120</width>
<width>0</width>
<height>0</height>
</size>
</property>
@ -543,7 +539,7 @@ color: rgb(27, 30, 35);
<widget class="QLabel" name="label_50">
<property name="minimumSize">
<size>
<width>3</width>
<width>0</width>
<height>0</height>
</size>
</property>
@ -555,7 +551,7 @@ color: rgb(27, 30, 35);
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_55">
<layout class="QHBoxLayout" name="horizontalLayout_30">
<item>
<widget class="QLabel" name="label_49">
<property name="minimumSize">
@ -566,7 +562,7 @@ color: rgb(27, 30, 35);
</property>
<property name="maximumSize">
<size>
<width>110</width>
<width>100</width>
<height>16777215</height>
</size>
</property>
@ -582,7 +578,7 @@ color: rgb(27, 30, 35);
<widget class="QLineEdit" name="lineEdit_sectionNum">
<property name="minimumSize">
<size>
<width>150</width>
<width>0</width>
<height>0</height>
</size>
</property>
@ -635,7 +631,7 @@ color: rgb(27, 30, 35);
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
@ -662,7 +658,7 @@ color: rgb(27, 30, 35);
<property name="minimumSize">
<size>
<width>0</width>
<height>120</height>
<height>135</height>
</size>
</property>
<property name="title">
@ -676,7 +672,7 @@ color: rgb(27, 30, 35);
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
<number>10</number>
</property>
<property name="rightMargin">
<number>0</number>
@ -1258,7 +1254,7 @@ color: rgb(27, 30, 35);
<property name="title">
<string> 采样设置</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_33">
<layout class="QHBoxLayout" name="horizontalLayout_29">
<item>
<layout class="QVBoxLayout" name="verticalLayout_11">
<property name="spacing">
@ -1393,24 +1389,8 @@ color: rgb(27, 30, 35);
</property>
</spacer>
</item>
<item>
<spacer name="horizontalSpacer_7">
<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>
<layout class="QVBoxLayout" name="verticalLayout_12">
<property name="spacing">
<number>1</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_27">
<item>
@ -1495,96 +1475,13 @@ color: rgb(27, 30, 35);
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_8">
<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>
<layout class="QVBoxLayout" name="verticalLayout_13">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_29">
<item>
<widget class="QLabel" name="label_29">
<property name="minimumSize">
<size>
<width>95</width>
<height>0</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="QLineEdit" name="lineEdit_envelopeLowpassband">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>10</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_30">
<item>
<widget class="QLabel" name="label_28">
<property name="minimumSize">
<size>
<width>95</width>
<height>0</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="QLineEdit" name="lineEdit_envelopeHighpassband">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>3500</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_31">
<item>
<widget class="QLabel" name="label_47">
<property name="minimumSize">
<size>
<width>95</width>
<width>100</width>
<height>0</height>
</size>
</property>
@ -1619,6 +1516,48 @@ color: rgb(27, 30, 35);
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_7">
<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_CustomFilter">
<property name="minimumSize">
<size>
<width>96</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>96</width>
<height>28</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">#pushButton_CustomFilter { border-image: url(:/image/Btn/normal_Btn.png);
color:#1f5188 }
#pushButton_CustomFilter:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_CustomFilter:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}
#pushButton_CustomFilter:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
color:#ffffff}</string>
</property>
<property name="text">
<string>滤波设置</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_17">
<property name="orientation">
@ -2627,6 +2566,19 @@ color: rgb(27, 30, 35);
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
@ -2696,6 +2648,9 @@ color: rgb(27, 30, 35);
<string> 备注</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_18">
<property name="topMargin">
<number>10</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_67">
<item>
@ -2706,13 +2661,13 @@ color: rgb(27, 30, 35);
<widget class="QLabel" name="label_51">
<property name="minimumSize">
<size>
<width>80</width>
<width>85</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<width>85</width>
<height>16777215</height>
</size>
</property>

View File

@ -16,6 +16,7 @@ extern QString g_LocalFile ;
extern QString g_strVersion ;
extern QString g_strProject ;
extern QString g_strFre ;
typedef struct ChannelSetting{
double ChUnitCoeff;
int ChUnitDot;
@ -123,6 +124,7 @@ typedef struct ChannelSetting{
int sectionNum;
QString EngineeringUnit;
QString firstPoleNum;
int filterStatus;
ChannelSetting(){
speedRefChannelId = "";
xZeroScalePosition = "";
@ -308,6 +310,9 @@ typedef struct _Charateristic{
double speedRPM;
int ChUnitDot;
QString channelType;
double InvertAlarm;
double InvertDanger;
} Charateristic_t;
typedef struct tag_WAVE_DATA{
QString channelId;

View File

@ -1,9 +1,11 @@
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();

View File

@ -21,7 +21,7 @@ MainWindow::MainWindow(QWidget *parent) :
//读取ini
QSettings settingsread(QCoreApplication::applicationDirPath() + "\\config\\config.ini",QSettings::IniFormat);
g_strVersion = settingsread.value("main/Version").toString();
g_strVersion = "SJ90C V1.1";
g_strProject = settingsread.value("main/Project").toString();
g_strFre = settingsread.value("main/Fre").toString();
@ -375,15 +375,6 @@ void MainWindow::leftConfigClick3()
delete pTriggerConfig;
pTriggerConfig = NULL;
}
// if(pUnitConfiguration){
// delete pUnitConfiguration;
// pUnitConfiguration = NULL;
// }
// if(pTestForm){
// delete pTestForm;
// pTestForm = NULL;
// }
}else if(name == "工况配置"){
if(pWorkCondition == NULL)

View File

@ -6,7 +6,7 @@ qproperty-backgroundBrush:#f2f4f7;
}
QWidget[form="true"],QLabel[frameShape="1"]{
border:1px solid #242424;
border:1px solid #f2f4f7;
border-radius:0px;
}
@ -20,7 +20,7 @@ border:1px solid #f2f4f7;
QWidget[form="bottom"] QLabel,QWidget[form="title"] QLabel{
border-radius:0px;
color:#f2f4f7;
color:#484848;
background:none;
border-style:none;
}
@ -108,9 +108,25 @@ background:none;
selection-background-color:#AAAAAA;
selection-color:#ffffff;
}
QComboBox,QTextEdit,QLineEdit,QTimeEdit{
color:#666666;
font-size:14px;
padding: 1px 15px 1px 3px;
border:1px solid rgba(228,228,228,1);
border-radius:5px 5px 0px 0px;
height:20px;
}
QComboBox:disabled,QTextEdit:disabled,QLineEdit:disabled,QTimeEdit:disabled{
color:#666666;
font-size:14px;
padding: 1px 15px 1px 3px;
border:1px solid rgba(228,228,228,1);
border-radius:5px 5px 0px 0px;
height:20px;
}
QLineEdit:focus,QTextEdit:focus,QPlainTextEdit:focus,QSpinBox:focus,QDoubleSpinBox:focus,QComboBox:focus,QDateEdit:focus,QTimeEdit:focus,QDateTimeEdit:focus,QLineEdit:hover,QTextEdit:hover,QPlainTextEdit:hover,QSpinBox:hover,QDoubleSpinBox:hover,QComboBox:hover,QDateEdit:hover,QTimeEdit:hover,QDateTimeEdit:hover{
border:1px solid #242424;
border:1px solid #245d9b;
}
QLineEdit[echoMode="2"]{
@ -123,9 +139,15 @@ border-radius:3px;
}
.QGroupBox{
border:1px solid #242424;
/*border:1px solid #242424;
border-radius:5px;
margin-top:9px;
margin-top:9px;*/
color:#666666;
font-size:14px;
padding: 1px 15px 1px 3px;
border:1px solid rgba(228,228,228,1);
border-radius:5px 5px 0px 0px;
height:20px;
}
.QGroupBox::title{
@ -297,7 +319,7 @@ border-left-width:0px;
border-left-style:solid;
border-top-right-radius:3px;
border-bottom-right-radius:3px;
border-left-color:#242424;
border-left-color:#409CE1;
}
QComboBox::drop-down:on{

View File

@ -87,13 +87,13 @@ CRealTimeForm::CRealTimeForm(QWidget *parent) :
connect(m_pSocket, &QTcpSocket::readyRead, this, &CRealTimeForm::slotRecieve);
connect(m_pSocket, &QTcpSocket::disconnected, this, &CRealTimeForm::disConnect);
#ifdef QT_NO_DEBUG
//#ifdef QT_NO_DEBUG
id1 = startTimer(2000); //参数1 间隔 单位 毫秒
//定时器第二种方式
QTimer * timer = new QTimer(this);
//启动定时器
timer->start(500);
#endif
//#endif
}
CRealTimeForm::~CRealTimeForm()
@ -1279,6 +1279,10 @@ void CRealTimeForm::ParseCharacteristic(QJsonArray& arrayValue)
tempCharateristic.speedRPM = arrayValue.at(i)["SpeedProfileSpeed"].toDouble();
tempCharateristic.ChUnitDot = arrayValue.at(i)["ChUnitDot"].toInt();
tempCharateristic.channelType = arrayValue.at(i)["ChannelType"].toString();
tempCharateristic.ChUnitDot = arrayValue.at(i)["ChUnitDot"].toInt();
tempCharateristic.channelType = arrayValue.at(i)["ChannelType"].toString();
tempCharateristic.InvertAlarm = arrayValue.at(i)["InvertAlarm"].toDouble();
tempCharateristic.InvertDanger = arrayValue.at(i)["InvertDanger"].toDouble();
m_vecCharateristic.push_back(tempCharateristic);
g_Charateristic.push_back(tempCharateristic);

View File

@ -1,6 +1,7 @@
#include "sqlitedb.h"
SqliteDB* g_SqliteDB = NULL;
QSqlDatabase db;
SqliteDB::SqliteDB()
{
@ -20,7 +21,7 @@ int SqliteDB::OpenDataBase()
qDebug() << QSqlDatabase::drivers() << "\r\n";
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(QCoreApplication::applicationDirPath() + "\\config\\config.db");
if (!db.open())
@ -69,12 +70,24 @@ int SqliteDB::initTable()
.arg("sqlite_master").arg("t_TriggerConfig").arg("operate");
iRet = ExeSqlData(strSql);
if(iRet == 0){
strSql = "ALTER TABLE t_TriggerConfig ADD COLUMN 'operate' integer";
strSql = "ALTER TABLE t_TriggerConfig ADD COLUMN 'operate' integer DEFAULT 1";
ExeSqlData(strSql);
}
strSql = QString("select count(*) from %1 where name = '%2' and sql LIKE '%%3%' ")\
.arg("sqlite_master").arg("t_ChannelSetting").arg("filterStatus");
iRet = ExeSqlData(strSql);
if(iRet == 0){
strSql = "ALTER TABLE t_ChannelSetting ADD COLUMN 'filterStatus' integer";
ExeSqlData(strSql);
}
CreateDataBase();
}
int SqliteDB::CloseDataBase()
{
db.close();
}
int SqliteDB::CreateDataBase()
{
QString strCreateSQL = QString("create table if not exists t_UnitConfiguration(WorkConditionID,ChannelID,BoardNo,ChannelNoInBoard,Input,Operate);");
@ -261,6 +274,7 @@ QVector<ChannelSetting> SqliteDB::GetDataMultiLine(QString tablename, QString co
tempchannel.sectionNum = sql_query.value(97).toInt();
tempchannel.EngineeringUnit = sql_query.value(98).toString();
tempchannel.firstPoleNum = sql_query.value(99).toString();
tempchannel.filterStatus = sql_query.value(100).toInt();
vecResult.append(tempchannel);
}
}
@ -546,9 +560,10 @@ int SqliteDB::InsertData(QString& tablename,QString& sql)
QSqlQuery sql_query;
QString strSql = "INSERT INTO ";
strSql = strSql + tablename + sql;
qDebug() << "strSql" <<strSql << endl;
qDebug() << "strSql" << strSql << endl;
if(!sql_query.exec(strSql))
{
customLogMessageHandler(QtDebugMsg,sql_query.lastError().text());
qDebug() << sql_query.lastError();
}
else

View File

@ -19,6 +19,7 @@ public:
SqliteDB();
QSqlDatabase database;
int OpenDataBase();
int CloseDataBase();
int CreateDataBase();
int InsertData(QString& tablename,QString& sql);
int UpdataData(QString& tablename, QString& columnName, QString& columnValue, QString whereColName = "", QString whereColValue = "");