diff --git a/BoardSetting.cpp b/BoardSetting.cpp index 2dddfe3..95637d7 100644 --- a/BoardSetting.cpp +++ b/BoardSetting.cpp @@ -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(); } diff --git a/ChannelList.cpp b/ChannelList.cpp index 2098303..164326a 100644 --- a/ChannelList.cpp +++ b/ChannelList.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #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,7 +59,7 @@ 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); @@ -70,12 +72,17 @@ CChannelList::CChannelList(QWidget *parent) : SlowSpeeddialog = new CSlowSpeedChannelSetting(); connect(SlowSpeeddialog, SIGNAL(sgSetChannelData(ChannelSetting)), this, SLOT(slotSetChannelData(ChannelSetting))); + + ui->comboBox_operate->addItem("带通滤波"); + ui->comboBox_operate->addItem("通道"); //--2 创建表格项 // QStringList workingConditionName; // workingConditionName<tableView->setColumnWidth(i, 200); }else{ - ui->tableView->setColumnWidth(i, 150); + ui->tableView->setColumnWidth(i, 130); } } @@ -164,6 +176,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) @@ -583,47 +609,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 +695,18 @@ void CChannelList::on_pushButton_refresh_clicked() { model->removeRows(0, model->rowCount()); g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting"); - initReadConfig(); + 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); } void CChannelList::slotNetMgr(QString sAddr, const QVariant &msg) @@ -641,14 +716,28 @@ void CChannelList::slotNetMgr(QString sAddr, const QVariant &msg) { QJsonValue arrays_value = objec.take("cmd"); //qDebug()<<"cmd ="<PostJson(req,sendData); +} diff --git a/ChannelList.h b/ChannelList.h index c8fd449..39dec03 100644 --- a/ChannelList.h +++ b/ChannelList.h @@ -55,6 +55,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); diff --git a/ChannelSetting.cpp b/ChannelSetting.cpp index 1eb0a05..1b02df1 100644 --- a/ChannelSetting.cpp +++ b/ChannelSetting.cpp @@ -5,7 +5,8 @@ #include #include "CopyChannelSetting.h" #include "NetMgr.h" - +#include "CustomFilter.h" +#include 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); @@ -237,9 +240,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 +461,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 +573,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 +598,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 +625,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 +653,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 +682,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 +708,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 +835,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()=="径向振动位移" && ui->comboBox_sensorType->currentText() =="低频位移") + pCustomFilter->vibrate_channel = 1; + else + pCustomFilter->vibrate_channel = 0; + pCustomFilter->setWindowModality(Qt::ApplicationModal); + pCustomFilter->show(); + pCustomFilter->getfilterInfo(); +} + diff --git a/ChannelSetting.h b/ChannelSetting.h index 8bb6473..a689ffc 100644 --- a/ChannelSetting.h +++ b/ChannelSetting.h @@ -40,6 +40,8 @@ private slots: void on_lineEdit_engineeringUnit_editingFinished(); + void on_pushButton_CustomFilter_clicked(); + public slots: void slotSetChannelData(QStringList&); private: diff --git a/Configuration.cpp b/Configuration.cpp index 4f7dc6a..d991632 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -246,6 +246,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")){ diff --git a/CustomFilter.cpp b/CustomFilter.cpp new file mode 100644 index 0000000..79b7bd2 --- /dev/null +++ b/CustomFilter.cpp @@ -0,0 +1,195 @@ +#include "CustomFilter.h" +#include "ui_CustomFilter.h" +#include +#include "QMyTableViewBtnDelegate.h" +#include "NetMgr.h" +#include + +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->spinBox_start->text().toInt() >= ui->spinBox_stop->text().toInt()){ + QMessageBox::warning(this, QStringLiteral("提示"), QStringLiteral("频率下限设置错误!")); + return; + } + QJsonObject sendData2; + sendData2["cmd"] = "95"; + sendData2["chan_id"] = channel_ID; + sendData2["open"] = type; + sendData2["start"] = ui->spinBox_start->text().toInt(); + sendData2["stop"] = ui->spinBox_stop->text().toInt(); + req.setUrl(sUrl); + g_NetMgr->PostJson(req,sendData2); +} + +void CustomFilter::slotNetMgr(QString sAddr, const QVariant &msg) +{ + QJsonObject objec = msg.value(); + 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->spinBox_start->setValue(objec.take("start").toInt()); + ui->spinBox_stop->setValue(objec.take("stop").toInt()); + + if(Statusfilter){ + ui->comboBox_open->setCurrentText("是"); + }else if(!Statusfilter){ + ui->comboBox_open->setCurrentText("否"); + } + 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->spinBox_start->setValue(objec.take("start").toInt()); + ui->spinBox_stop->setValue(objec.take("stop").toInt()); + + if(Statusfilter){ + ui->comboBox_open->setCurrentText("是"); + }else if(!Statusfilter){ + ui->comboBox_open->setCurrentText("否"); + } + 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->spinBox_start->setEnabled(false); + ui->spinBox_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 &) +{ + qDebug() << "" << endl; +} diff --git a/CustomFilter.h b/CustomFilter.h new file mode 100644 index 0000000..0c8dc2a --- /dev/null +++ b/CustomFilter.h @@ -0,0 +1,39 @@ +#ifndef CUSTOMFILTER_H +#define CUSTOMFILTER_H + +#include +#include //数据模型类 +#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 &); +private: + Ui::CustomFilter *ui; + TableHeaderView *myHeader; + QStandardItemModel *model; + QString headerStr ; +}; + +#endif // CUSTOMFILTER_H diff --git a/CustomFilter.ui b/CustomFilter.ui new file mode 100644 index 0000000..4ce3dff --- /dev/null +++ b/CustomFilter.ui @@ -0,0 +1,333 @@ + + + CustomFilter + + + + 0 + 0 + 716 + 480 + + + + 滤波配置 + + + font: 10pt "黑体"; +color: rgb(27, 30, 35); + + + + + + + 0 + 100 + + + + + 16777215 + 100 + + + + + + + 带通滤波 + + + + + + + + Qt::Horizontal + + + + 32 + 33 + + + + + + + + 是否开启 + + + + + + + + 50 + 0 + + + + + + + + Qt::Horizontal + + + + 32 + 33 + + + + + + + + + + 频率下限 + + + + + + + + 80 + 0 + + + + 9999 + + + + + + + + + Hz + + + + + + + Qt::Horizontal + + + + 32 + 33 + + + + + + + + + + 频率上限 + + + + + + + + 80 + 0 + + + + 9999 + + + 200 + + + + + + + + + Hz + + + + + + + Qt::Horizontal + + + + 32 + 33 + + + + + + + + + + + + + + + + + + + 自定义滤波设置 + + + + + + + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 136 + 20 + + + + + + + + + 96 + 28 + + + + + 96 + 28 + + + + #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} + + + 新增 + + + + + + + + 96 + 28 + + + + + 96 + 28 + + + + #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} + + + 删除 + + + + + + + + 96 + 28 + + + + + 96 + 28 + + + + #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} + + + 提交 + + + + + + + Qt::Horizontal + + + + 136 + 20 + + + + + + + + + + + + diff --git a/DataWatch3500_GUI.pro b/DataWatch3500_GUI.pro index 26c89ed..a5efdcf 100644 --- a/DataWatch3500_GUI.pro +++ b/DataWatch3500_GUI.pro @@ -33,6 +33,7 @@ SOURCES += \ Configuration.cpp \ CopyChannelSetting.cpp \ CopyDatFile.cpp \ + CustomFilter.cpp \ DIO_Board.cpp \ DataGraphView.cpp \ FileServerConfig.cpp \ @@ -83,6 +84,7 @@ HEADERS += \ Configuration.h \ CopyChannelSetting.h \ CopyDatFile.h \ + CustomFilter.h \ DIO_Board.h \ DataGraphView.h \ FileServerConfig.h \ @@ -133,6 +135,7 @@ FORMS += \ Configuration.ui \ CopyChannelSetting.ui \ CopyDatFile.ui \ + CustomFilter.ui \ DIO_Board.ui \ DataGraphView.ui \ FileServerConfig.ui \ diff --git a/UnitSetting.ui b/UnitSetting.ui index f9d8fdf..04f9172 100644 --- a/UnitSetting.ui +++ b/UnitSetting.ui @@ -130,6 +130,9 @@ color: rgb(27, 30, 35); 电厂名称 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -157,6 +160,9 @@ color: rgb(27, 30, 35); 机组名称 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -184,6 +190,9 @@ color: rgb(27, 30, 35); 电厂编号 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -211,6 +220,9 @@ color: rgb(27, 30, 35); 机组编号 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -238,6 +250,9 @@ color: rgb(27, 30, 35); 水轮机制造厂家 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -265,6 +280,9 @@ color: rgb(27, 30, 35); 发电机制造厂家 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -292,6 +310,9 @@ color: rgb(27, 30, 35); 机组类型 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -319,6 +340,9 @@ color: rgb(27, 30, 35); 流量系数 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -346,6 +370,9 @@ color: rgb(27, 30, 35); 额定励磁电流(A) + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -380,6 +407,9 @@ color: rgb(27, 30, 35); 压力脉冲显示 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -407,6 +437,9 @@ color: rgb(27, 30, 35); 额定转速(r/min) + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -471,6 +504,9 @@ color: rgb(27, 30, 35); 额定功率(MW) + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -498,6 +534,9 @@ color: rgb(27, 30, 35); 最大水头(m) + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -525,6 +564,9 @@ color: rgb(27, 30, 35); 最小水头(m) + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -552,6 +594,9 @@ color: rgb(27, 30, 35); 设计水头(m) + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -579,6 +624,9 @@ color: rgb(27, 30, 35); 叶片数 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -606,6 +654,9 @@ color: rgb(27, 30, 35); 导叶数 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -633,6 +684,9 @@ color: rgb(27, 30, 35); 上导瓦数 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -660,6 +714,9 @@ color: rgb(27, 30, 35); 下导瓦数 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -687,6 +744,9 @@ color: rgb(27, 30, 35); 水导瓦数 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -714,6 +774,9 @@ color: rgb(27, 30, 35); 推力瓦数 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -744,6 +807,9 @@ color: rgb(27, 30, 35); 发电机转子磁极个数 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + diff --git a/WaveDisplay.cpp b/WaveDisplay.cpp index c610b5b..ff89659 100644 --- a/WaveDisplay.cpp +++ b/WaveDisplay.cpp @@ -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倍频频率 %1Hz,1倍频幅值 %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); @@ -287,7 +287,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 x,y; QCPGraph* graph = ui->widget_wave->addGraph(ui->widget_wave->xAxis, ui->widget_wave->yAxis); @@ -320,8 +320,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倍频频率 %1Hz,1倍频幅值 %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 +519,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()) { diff --git a/WaveDisplay.h b/WaveDisplay.h index b85998e..f4817d8 100644 --- a/WaveDisplay.h +++ b/WaveDisplay.h @@ -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; diff --git a/WokingConditionConfig - 副本.ui b/WokingConditionConfig - 副本.ui new file mode 100644 index 0000000..e5a83e1 --- /dev/null +++ b/WokingConditionConfig - 副本.ui @@ -0,0 +1,535 @@ + + + CWokingConditionConfig + + + + 0 + 0 + 845 + 678 + + + + Form + + + font: 10pt "黑体"; +color: rgb(27, 30, 35); + + + + + + + 0 + 50 + + + + + 16777215 + 30 + + + + + + + Qt::Horizontal + + + + 393 + 9 + + + + + + + + 工况逻辑配置 + + + + + + + Qt::Horizontal + + + + 393 + 9 + + + + + + + + + + + + + + + 0 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 80 + + + + + 16777215 + 30 + + + + + + + + + 工况名称: + + + + + + + + + + + + Qt::Horizontal + + + + 1 + 20 + + + + + + + + + + 工况参数选择: + + + + + + + + 150 + 0 + + + + + + + + + + + + + + + + QAbstractItemView::DragDrop + + + false + + + + + + + + 0 + 200 + + + + + + 300 + 130 + 120 + 35 + + + + + 120 + 35 + + + + + 120 + 35 + + + + #pushButton_save { border-image: url(:/image/Btn/normal_Btn.png); + color:#1f5188 } +#pushButton_save:hover { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_save:pressed { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_save:checked { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} + + + 保存 + + + + + + 40 + 130 + 120 + 35 + + + + + 120 + 35 + + + + + 120 + 35 + + + + #pushButton_addUnit { border-image: url(:/image/Btn/normal_Btn.png); + color:#1f5188 } +#pushButton_addUnit:hover { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_addUnit:pressed { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_addUnit:checked { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} + + + 添加 + + + + + + 170 + 130 + 120 + 35 + + + + + 120 + 35 + + + + + 120 + 35 + + + + #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} + + + 删除 + + + + + + 21 + 51 + 364 + 52 + + + + + + + + 100 + 0 + + + + 描述: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 100 + 50 + + + + + 16777215 + 50 + + + + + + + + + + 21 + 10 + 284 + 22 + + + + + + + + 100 + 0 + + + + 工况判定间隔时间: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + + + + + + + + + 300 + 0 + + + + + + + + 0 + 0 + + + + + 20 + + + + + Relay Logic Editor + + + + + + + QAbstractItemView::DragDrop + + + + + + + + + + + 0 + 125 + + + + + + + Qt::Horizontal + + + + 27 + 20 + + + + + + + + + + + 120 + 35 + + + + + 120 + 35 + + + + #pushButton_and { border-image: url(:/image/Btn/normal_Btn.png); + color:#1f5188 } +#pushButton_and:hover { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_and:pressed { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_and:checked { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} + + + 添加AND + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 120 + 35 + + + + + 120 + 35 + + + + #pushButton_or { border-image: url(:/image/Btn/normal_Btn.png); + color:#1f5188 } +#pushButton_or:hover { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_or:pressed { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} +#pushButton_or:checked { border-image: url(:/image/Btn/normal_Btn_p.png); + color:#ffffff} + + + 添加OR + + + + + + + + + Qt::Horizontal + + + + 27 + 20 + + + + + + + + + + + + + + + + + + diff --git a/WorkingCondition.ui b/WorkingCondition.ui index 3c58786..a7babd2 100644 --- a/WorkingCondition.ui +++ b/WorkingCondition.ui @@ -178,7 +178,7 @@ color: rgb(27, 30, 35); - 240 + 150 16777215 @@ -208,7 +208,7 @@ color: rgb(27, 30, 35); - 240 + 150 16777215 @@ -238,7 +238,7 @@ color: rgb(27, 30, 35); - 240 + 150 16777215 @@ -268,7 +268,7 @@ color: rgb(27, 30, 35); - 240 + 150 16777215 @@ -298,7 +298,7 @@ color: rgb(27, 30, 35); - 240 + 150 16777215 @@ -328,7 +328,7 @@ color: rgb(27, 30, 35); - 240 + 150 16777215 @@ -358,7 +358,7 @@ color: rgb(27, 30, 35); - 240 + 150 16777215 @@ -371,7 +371,7 @@ color: rgb(27, 30, 35); - 蜗壳差压通道: + 蜗壳差压: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -388,7 +388,7 @@ color: rgb(27, 30, 35); - 240 + 150 16777215 @@ -401,7 +401,7 @@ color: rgb(27, 30, 35); - 机组效率通道: + 机组效率: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -418,7 +418,7 @@ color: rgb(27, 30, 35); - 240 + 150 16777215 @@ -431,7 +431,7 @@ color: rgb(27, 30, 35); - 发电机出口开关通道: + 发电机出口开关: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -448,7 +448,7 @@ color: rgb(27, 30, 35); - 240 + 150 16777215 @@ -461,7 +461,7 @@ color: rgb(27, 30, 35); - 励磁开关通道: + 励磁开关: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -478,7 +478,7 @@ color: rgb(27, 30, 35); - 240 + 150 16777215 @@ -491,7 +491,7 @@ color: rgb(27, 30, 35); - 发电/抽水工况通道: + 发电/抽水工况: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -508,7 +508,7 @@ color: rgb(27, 30, 35); - 240 + 150 16777215 @@ -521,7 +521,7 @@ color: rgb(27, 30, 35); - 蜗壳进口压力通道: + 蜗壳进口压力: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -538,7 +538,7 @@ color: rgb(27, 30, 35); - 240 + 150 16777215 @@ -551,7 +551,7 @@ color: rgb(27, 30, 35); - 尾水出口压力通道: + 尾水出口压力: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -568,7 +568,7 @@ color: rgb(27, 30, 35); - 280 + 150 16777215 @@ -598,7 +598,7 @@ color: rgb(27, 30, 35); - 240 + 150 16777215 diff --git a/channellist.ui b/channellist.ui index 72da1eb..08a5158 100644 --- a/channellist.ui +++ b/channellist.ui @@ -73,6 +73,16 @@ QTableView::item { + + + + + 100 + 0 + + + + diff --git a/channelsetting.ui b/channelsetting.ui index ffbed75..755fe55 100644 --- a/channelsetting.ui +++ b/channelsetting.ui @@ -7,7 +7,7 @@ 0 0 812 - 718 + 754 @@ -15,8 +15,7 @@ font: 10pt "黑体"; -color: rgb(27, 30, 35); - +color: rgb(27, 30, 35); @@ -251,7 +250,7 @@ color: rgb(27, 30, 35); 通道信息 - + @@ -462,12 +461,9 @@ color: rgb(27, 30, 35); - + - - 1 - @@ -494,7 +490,7 @@ color: rgb(27, 30, 35); - 150 + 0 0 @@ -514,7 +510,7 @@ color: rgb(27, 30, 35); - 110 + 100 16777215 @@ -530,7 +526,7 @@ color: rgb(27, 30, 35); - 120 + 0 0 @@ -543,7 +539,7 @@ color: rgb(27, 30, 35); - 3 + 0 0 @@ -555,7 +551,7 @@ color: rgb(27, 30, 35); - + @@ -566,7 +562,7 @@ color: rgb(27, 30, 35); - 110 + 100 16777215 @@ -582,7 +578,7 @@ color: rgb(27, 30, 35); - 150 + 0 0 @@ -635,7 +631,7 @@ color: rgb(27, 30, 35); - 1 + 0 @@ -662,7 +658,7 @@ color: rgb(27, 30, 35); 0 - 120 + 135 @@ -676,7 +672,7 @@ color: rgb(27, 30, 35); 0 - 0 + 10 0 @@ -1258,7 +1254,7 @@ color: rgb(27, 30, 35); 采样设置 - + @@ -1393,24 +1389,8 @@ color: rgb(27, 30, 35); - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - 1 - @@ -1495,96 +1475,13 @@ color: rgb(27, 30, 35); - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 95 - 0 - - - - 低通频率: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - 10 - - - - - - - - - - - - 95 - 0 - - - - 高通频率: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - 3500 - - - - - - 95 + 100 0 @@ -1619,6 +1516,48 @@ color: rgb(27, 30, 35); + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 96 + 28 + + + + + 96 + 28 + + + + #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} + + + 滤波设置 + + + @@ -2627,6 +2566,19 @@ color: rgb(27, 30, 35); + + + + Qt::Vertical + + + + 20 + 40 + + + + @@ -2696,6 +2648,9 @@ color: rgb(27, 30, 35); 备注 + + 10 + @@ -2706,13 +2661,13 @@ color: rgb(27, 30, 35); - 80 + 85 0 - 80 + 85 16777215 diff --git a/global.h b/global.h index e1e1915..e91aeb8 100644 --- a/global.h +++ b/global.h @@ -123,6 +123,7 @@ typedef struct ChannelSetting{ int sectionNum; QString EngineeringUnit; QString firstPoleNum; + int filterStatus; ChannelSetting(){ speedRefChannelId = ""; xZeroScalePosition = ""; diff --git a/mainwindow.cpp b/mainwindow.cpp index 6ef89d9..077f668 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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(); diff --git a/qss/blacksoft.css b/qss/blacksoft.css index c8cf672..6731921 100644 --- a/qss/blacksoft.css +++ b/qss/blacksoft.css @@ -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{ diff --git a/sqlitedb.cpp b/sqlitedb.cpp index 23ce1a9..02728a9 100644 --- a/sqlitedb.cpp +++ b/sqlitedb.cpp @@ -69,7 +69,15 @@ 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); } @@ -261,6 +269,7 @@ QVector 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); } }