优化了界面功能

This commit is contained in:
zhangsheng 2024-10-24 13:49:00 +08:00
parent 4ceee47797
commit 783efb76fd
9 changed files with 49 additions and 15 deletions

View File

@ -31,6 +31,8 @@ CConfiguration::CConfiguration(QWidget *parent) :
pHeader2->setSectionResizeMode(QHeaderView::ResizeToContents); pHeader2->setSectionResizeMode(QHeaderView::ResizeToContents);
pHeader2->setStretchLastSection(false); pHeader2->setStretchLastSection(false);
ui->treeView_Available->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->treeView_Relay->setEditTriggers(QAbstractItemView::NoEditTriggers);
connect(ui->comboBox_WC,SIGNAL(currentTextChanged(const QString &)),this,SLOT(on_comboBox_WC_currentTextChanged2(const QString&))); connect(ui->comboBox_WC,SIGNAL(currentTextChanged(const QString &)),this,SLOT(on_comboBox_WC_currentTextChanged2(const QString&)));
} }

View File

@ -119,8 +119,8 @@ void CCopyDatFile::on_pushButton_refresh_clicked()
ui -> treeWidget_dist ->clear(); ui -> treeWidget_dist ->clear();
ftp -> cd("/run/media/"); ftp -> cd("/run/media/");
ui->label_path->setText("/run/media/"); ui->label_path->setText("/run/media/");
m_strDistPwd = ""; m_strDistPath = "";
m_strDistPwd = "/run/media/"; m_strDistPath = "/run/media/";
ftp->list(); ftp->list();
} }
@ -133,10 +133,10 @@ void CCopyDatFile::processItem(QTreeWidgetItem *item, int /*column*/)
currentPath += '/'; currentPath += '/';
currentPath += name; currentPath += name;
ftp->cd(name); ftp->cd(name);
m_strDistPwd = ""; m_strDistPath = "";
m_strDistPwd = "/run/media" + currentPath; m_strDistPath = "/run/media" + currentPath;
ui->label_path->setText(m_strDistPwd); ui->label_path->setText(m_strDistPath);
currentPath = ""; currentPath = "";
ftp->list(); ftp->list();
return; return;
@ -153,7 +153,7 @@ void CCopyDatFile::slotCopyItem()
allObj.insert("cmd", "100"); allObj.insert("cmd", "100");
cmdBody.insert("subcmd",1); cmdBody.insert("subcmd",1);
cmdBody.insert("srcfile",str); cmdBody.insert("srcfile",str);
cmdBody.insert("dstdirectory",m_strDistPwd); cmdBody.insert("dstdirectory",m_strDistPath);
allObj["cmdBody"] = cmdBody; allObj["cmdBody"] = cmdBody;
QNetworkRequest req; QNetworkRequest req;
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP); QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
@ -179,7 +179,7 @@ void CCopyDatFile::on_pushButton_exit_clicked()
QJsonObject allObj,cmdBody; QJsonObject allObj,cmdBody;
allObj.insert("cmd", "100"); allObj.insert("cmd", "100");
cmdBody.insert("subcmd",3); cmdBody.insert("subcmd",3);
cmdBody.insert("dstdirectory",m_strDistPwd); cmdBody.insert("dstdirectory",m_strDistPath);
allObj["cmdBody"] = cmdBody; allObj["cmdBody"] = cmdBody;
QNetworkRequest req; QNetworkRequest req;
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP); QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);

View File

@ -42,7 +42,7 @@ private:
QFtp *ftp = nullptr; QFtp *ftp = nullptr;
QStandardItemModel *model; QStandardItemModel *model;
QString currentPath; QString currentPath;
QString m_strDistPwd; QString m_strDistPath;
QAction *copyAction; QAction *copyAction;
}; };

View File

@ -6,7 +6,7 @@
#include "AlarmDetails.h" #include "AlarmDetails.h"
#include "ftpclient.h" #include "ftpclient.h"
#include "global.h" #include "global.h"
#include "NetMgr.h"
CHistoryAlarm::CHistoryAlarm(QWidget *parent) : CHistoryAlarm::CHistoryAlarm(QWidget *parent) :
QWidget(parent), QWidget(parent),
@ -618,12 +618,15 @@ void CHistoryAlarm::on_pushButton_delete_clicked()
default: default:
break; break;
} }
QStringList strListFileName;
QString strChannelName;
QVector<TriggerEvent_t> vecTriggerEvent;
for (int i = 0; i < model->rowCount(); i++) { for (int i = 0; i < model->rowCount(); i++) {
QModelIndex indexCheck = model->index(i,0); QModelIndex indexCheck = model->index(i,0);
bool check = model->data(indexCheck, Qt::UserRole).toBool(); bool check = model->data(indexCheck, Qt::UserRole).toBool();
if(check){ if(check){
QString strDate = model->data(model->index(i,4)).toString(); QString strDate = model->data(model->index(i,4)).toString();
QString strChannelName = model->data(model->index(i,3)).toString(); strChannelName = model->data(model->index(i,3)).toString();
QStringList channellist = strChannelName.split("-"); QStringList channellist = strChannelName.split("-");
QDateTime dateTime = QDateTime::fromString(strDate, "yyyy-MM-dd hh:mm:ss"); QDateTime dateTime = QDateTime::fromString(strDate, "yyyy-MM-dd hh:mm:ss");
@ -632,10 +635,33 @@ void CHistoryAlarm::on_pushButton_delete_clicked()
qint64 timestamp = dateTime.toSecsSinceEpoch(); qint64 timestamp = dateTime.toSecsSinceEpoch();
QString strWhere1 = QString("timestamp = '%1' and channelName = '%2'").arg(timestamp).arg(channellist[0]); QString strWhere1 = QString("timestamp = '%1' and channelName = '%2'").arg(timestamp).arg(channellist[0]);
QString strWhere2 = QString("triggeredTime = %1 and triggeredChannelName = '%2'").arg(timestamp).arg(channellist[0]); QString strWhere2 = QString("triggeredTime = %1 and triggeredChannelName = '%2'").arg(timestamp).arg(channellist[0]);
QString strCol = "triggeredFileName";
QString strTableName = QString("t_TriggerEvent ORDER BY ABS(triggeredTime - %1) LIMIT 1").arg(timestamp);
QString strFileName = g_SqliteDB->GetSingelLine(strTableName,strCol);
strFileName = strFileName.left(strFileName.size()-1);
strListFileName = strFileName.split("/");
g_SqliteDB->DeleteDataW(strTableNameAlarm,strWhere1); g_SqliteDB->DeleteDataW(strTableNameAlarm,strWhere1);
g_SqliteDB->DeleteDataW(strTableNameTriger,strWhere2); g_SqliteDB->DeleteDataW(strTableNameTriger,strWhere2);
} }
} }
QJsonObject allObj,cmdBody;
QJsonArray arrayFileName;
allObj.insert("cmd", "40");
cmdBody.insert("type","ARRAY");
arrayFileName.append(strChannelName);
cmdBody.insert("fileName",strListFileName[5]);
allObj["cmdBody"] = cmdBody;
QNetworkRequest req;
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
req.setUrl(sUrl);
g_NetMgr->PostJson(req,allObj);
QString dat_path = QCoreApplication::applicationDirPath() + "\\dat\\" + strListFileName[5];
QDir datDir(dat_path);
if (datDir.exists()) {
datDir.removeRecursively();
}
on_pushButton_search_clicked(); on_pushButton_search_clicked();
} }

View File

@ -294,8 +294,6 @@ void CTerminalInfo::on_pushButton_Update_clicked()
curIndex = 0; curIndex = 0;
else if(text == "后端主程序") else if(text == "后端主程序")
curIndex = 1; curIndex = 1;
else if(text == "后端辅助程序")
curIndex = 2;
g_FtpClient->UpLoadFile(filepath,FileName,curIndex); g_FtpClient->UpLoadFile(filepath,FileName,curIndex);
} }

View File

@ -28,6 +28,7 @@ CWokingConditionConfig::CWokingConditionConfig(QWidget *parent) :
ui->treeView->setContextMenuPolicy(Qt::CustomContextMenu); ui->treeView->setContextMenuPolicy(Qt::CustomContextMenu);
ui->treeView->setStyle(QStyleFactory::create("windows")); ui->treeView->setStyle(QStyleFactory::create("windows"));
treeModel = new QStandardItemModel(ui->treeView); //创建模型指定父类 treeModel = new QStandardItemModel(ui->treeView); //创建模型指定父类
ui->treeView->setModel(treeModel); ui->treeView->setModel(treeModel);
ui->treeView->setHeaderHidden(true); ui->treeView->setHeaderHidden(true);
@ -38,7 +39,7 @@ CWokingConditionConfig::CWokingConditionConfig(QWidget *parent) :
QRegExp exp("[0-9\\.-]+$"); QRegExp exp("[0-9\\.-]+$");
QValidator *Validator = new QRegExpValidator(exp); QValidator *Validator = new QRegExpValidator(exp);
ui->lineEdit_Interval->setValidator(Validator); ui->lineEdit_Interval->setValidator(Validator);
ui->treeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
} }
CWokingConditionConfig::~CWokingConditionConfig() CWokingConditionConfig::~CWokingConditionConfig()

View File

@ -247,6 +247,8 @@ typedef struct _TriggerEvent{
int triggeredEquipmentID; int triggeredEquipmentID;
QString triggeredEventName; QString triggeredEventName;
QString triggeredFeatureName; QString triggeredFeatureName;
QString triggeredFileName;
QString triggereValue;
}TriggerEvent_t ; }TriggerEvent_t ;
typedef struct _TriggerAlarmStatusInfo{ typedef struct _TriggerAlarmStatusInfo{

View File

@ -27,7 +27,11 @@ MainWindow::MainWindow(QWidget *parent) :
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
QSettings settingsread(QCoreApplication::applicationDirPath() + "/config/config.ini",QSettings::IniFormat); QSettings settingsread(QCoreApplication::applicationDirPath() + "/config/config.ini",QSettings::IniFormat);
#endif #endif
g_strVersion = "SJ90C V1.1_20241009"; QDate buildDate = QLocale( QLocale::English ).toDate( QString(__DATE__).replace(" ", " 0"), "MMM dd yyyy");
QTime buildTime = QTime::fromString(__TIME__, "hh:mm:ss");
g_strVersion = "SJ90C V1.1_" + buildDate.toString("yyyyMMdd");
customLogMessageHandler(QtDebugMsg,g_strVersion + " " + buildTime.toString());
g_strProject = settingsread.value("main/Project").toString(); g_strProject = settingsread.value("main/Project").toString();
g_strFre = settingsread.value("main/Fre").toString(); g_strFre = settingsread.value("main/Fre").toString();

View File

@ -488,7 +488,8 @@ SqliteDB::GetTriggerEvent(QString tablename,QString whereCon)
tempTriggerEvent.triggeredEquipmentID = sql_query.value(8).toInt(); tempTriggerEvent.triggeredEquipmentID = sql_query.value(8).toInt();
tempTriggerEvent.triggeredEventName = sql_query.value(9).toString(); tempTriggerEvent.triggeredEventName = sql_query.value(9).toString();
tempTriggerEvent.triggeredFeatureName = sql_query.value(10).toString(); tempTriggerEvent.triggeredFeatureName = sql_query.value(10).toString();
tempTriggerEvent.triggeredFileName = sql_query.value(11).toString();
tempTriggerEvent.triggereValue = sql_query.value(12).toString();
vecResult.append(tempTriggerEvent); vecResult.append(tempTriggerEvent);
} }
} }