From 110685ef563a9fca0d5099a89ddb3c2d2f0e3aaf Mon Sep 17 00:00:00 2001 From: "DESKTOP-7I8SUIC\\zhang" Date: Wed, 26 Nov 2025 10:13:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BB=A7=E7=94=B5=E5=99=A8?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config_mgr.cpp | 54 ++++++++- dc_output_channel.ui | 180 +++++++++++++--------------- mainwindow.cpp | 8 ++ mainwindow.ui | 33 +++--- singlerelay.cpp | 18 +-- singlerelay.ui | 106 ++++++++++------- singlerelay_nok.cpp | 30 ----- singlerelay_nok.ui | 274 +++++++++++++++++++++++-------------------- 8 files changed, 382 insertions(+), 321 deletions(-) diff --git a/config_mgr.cpp b/config_mgr.cpp index 1a80488..c304f92 100644 --- a/config_mgr.cpp +++ b/config_mgr.cpp @@ -591,12 +591,37 @@ void ConfigMgr::Save(QString & file_path) { if(ptr->single_relay[ch].logic_expression != ""){ qDebug() << "ch" << ch << ptr->single_relay[ch].logic_expression; channel_item.insert("logic_expression", ptr->single_relay[ch].logic_expression); - + channel_item.insert("vote",ptr->single_relay[ch].vote); + channel_item.insert("active", ptr->single_relay[ch].active); + channel_item.insert("group",ptr->single_relay[ch].group); } } - channel_item.insert("vote",ptr->single_relay[ch].vote); - channel_item.insert("active", ptr->single_relay[ch].active); - channel_item.insert("group",ptr->single_relay[ch].group); + + }else if(card_type_[i] == kCardRelaySingleNOK){ + std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot); + if (base_ptr == nullptr) { + continue; + } + std::shared_ptr ptr = std::dynamic_pointer_cast(base_ptr); + if(ptr->single_relay[ch].vote){ + channel_item.insert("count_vote",ptr->single_relay[ch].count_vote); + QJsonArray array_logic; + for(int var = 0 ; var < 10;++var){ + if(ptr->single_relay[ch].logic[var] != ""){ + array_logic.append(ptr->single_relay[ch].logic[var]); + } + } + channel_item.insert("logic_vote", array_logic); + }else{ + if(ptr->single_relay[ch].logic_expression != ""){ + qDebug() << "ch" << ch << ptr->single_relay[ch].logic_expression; + channel_item.insert("logic_expression", ptr->single_relay[ch].logic_expression); + channel_item.insert("vote",ptr->single_relay[ch].vote); + channel_item.insert("active", ptr->single_relay[ch].active); + channel_item.insert("group",ptr->single_relay[ch].group); + } + } + }else if(card_type_[i] == kCardRelayTMRPrimary){ std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot); if (base_ptr == nullptr) { @@ -1126,6 +1151,27 @@ void ConfigMgr::Load(QString filename) { singlerelay_data->single_relay[j].group = channel["group"].toInt(); } cards_.push_back(singlerelay_data); + }else if(card_type_[i] == kCardRelaySingleNOK){ + std::shared_ptr singlerelay_data = std::make_shared(); + singlerelay_data->slot_ = slot; + singlerelay_data->card_type_ = static_cast(card_type_[i]); + singlerelay_data->version_ = temp_obj["version"].toInt(); + for (int j = 0; j < RELAY_COUNT; ++j) { + channel = temp_obj[QString::number(j + 1)].toObject(); + if(channel["vote"].toBool()){ + singlerelay_data->single_relay[j].count_vote = channel["count_vote"].toInt(); + singlerelay_data->single_relay[j].vote = channel["vote"].toBool(); + QJsonArray array_logic = channel["logic_vote"].toArray(); + for(int var = 0;var < array_logic.size();++var){ + singlerelay_data->single_relay[j].logic[var] = array_logic[var].toString(); + } + }else{ + singlerelay_data->single_relay[j].logic_expression = channel["logic_expression"].toString(); + } + singlerelay_data->single_relay[j].active = channel["active"].toBool(); + singlerelay_data->single_relay[j].group = channel["group"].toInt(); + } + cards_.push_back(singlerelay_data); }else if(card_type_[i] == kCardRelayTMRPrimary){ std::shared_ptr relay_data = std::make_shared(); relay_data->slot_ = slot; diff --git a/dc_output_channel.ui b/dc_output_channel.ui index f544b25..2356a66 100644 --- a/dc_output_channel.ui +++ b/dc_output_channel.ui @@ -106,102 +106,6 @@ - - - - 50 - 260 - 113 - 25 - - - - - 0 - 25 - - - - - - - 50 - 300 - 113 - 25 - - - - - 0 - 25 - - - - - - - 190 - 270 - 54 - 12 - - - - - - - - - - - - 190 - 310 - 54 - 12 - - - - - - - - - - - - 280 - 270 - 54 - 25 - - - - - 0 - 25 - - - - 最小值 - - - - - - 280 - 310 - 54 - 25 - - - - - 0 - 25 - - - - 最大值 - - @@ -228,6 +132,90 @@ 取消 + + + + 50 + 260 + 250 + 27 + + + + + + + + 0 + 25 + + + + + + + + - - + + + + + + + + 0 + 25 + + + + 最小值 + + + + + + + + + 50 + 300 + 250 + 27 + + + + + + + + 0 + 25 + + + + + + + + - - + + + + + + + + 0 + 25 + + + + 最大值 + + + + + diff --git a/mainwindow.cpp b/mainwindow.cpp index 2d13d76..5129efc 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -114,6 +114,9 @@ MainWindow::MainWindow(QWidget *parent) #ifndef QT_DEBUG //qInstallMessageHandler(messageHandler); #endif + QDate buildDate = QLocale( QLocale::English ).toDate( QString(__DATE__).replace(" ", " 0"), "MMM dd yyyy"); + QString Version = "V1.0_" + buildDate.toString("yyyyMMdd"); + ui->label_version->setText(Version); } MainWindow::~MainWindow() { @@ -497,6 +500,11 @@ void MainWindow::OnButtonGroup(QAbstractButton *slot_btn) { single_tmr_relay->setWindowModality(Qt::ApplicationModal); single_tmr_relay->show(); }break; + case kCardRelaySingleNOK:{ + SingleRelay_NOK *single_relay_nok = new SingleRelay_NOK(button_id,card_type); + single_relay_nok->setWindowModality(Qt::ApplicationModal); + single_relay_nok->show(); + }break; } } if (slot_btn != NULL && ui->pushButton_alarm->isChecked()) { diff --git a/mainwindow.ui b/mainwindow.ui index 397220e..1373f93 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -7,7 +7,7 @@ 0 0 1129 - 529 + 537 @@ -15,21 +15,6 @@ - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - @@ -1050,6 +1035,22 @@ + + + + + + + TextLabel + + + Qt::AlignCenter + + + + + + diff --git a/singlerelay.cpp b/singlerelay.cpp index bf145e4..9c98580 100644 --- a/singlerelay.cpp +++ b/singlerelay.cpp @@ -137,10 +137,10 @@ void SingleRelay::Init(){ if(var == 3){ qDebug() << "alert" << variable_base->danger_high.enable<danger_high.enable; } - channelNameMap[item_data] = item_str; - item_str = QString("%1 (槽位 %2 通道 %3 非OK)").arg(ptr->base_config_[var].point_name).arg(ptr->base_config_[var].chan_id.mid(1,2)).arg(ptr->base_config_[var].chan_id.mid(4,2)); - item_data = QString("%1P##NO").arg(ptr->base_config_[var].chan_id); - channelNameMap[item_data] = item_str; +// channelNameMap[item_data] = item_str; +// item_str = QString("%1 (槽位 %2 通道 %3 非OK)").arg(ptr->base_config_[var].point_name).arg(ptr->base_config_[var].chan_id.mid(1,2)).arg(ptr->base_config_[var].chan_id.mid(4,2)); +// item_data = QString("%1P##NO").arg(ptr->base_config_[var].chan_id); +// channelNameMap[item_data] = item_str; } }else if(cardbase_ptr != nullptr && cardbase_ptr->card_type_ == kCardSpeedSingle){ @@ -210,11 +210,11 @@ void SingleRelay::OnButtonGroup(QAbstractButton *slot_btn) { item->setData(Qt::UserRole, item_data); list_widget_available->addItem(item); } - QString item_str = QString("%1 (槽位 %2 通道 %3 非OK)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); - QListWidgetItem *item = new QListWidgetItem(item_str); - QString item_data_nok = QString("S%1C%2P##NO").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); - item->setData(Qt::UserRole, item_data_nok); - list_widget_available->addItem(item); +// QString item_str = QString("%1 (槽位 %2 通道 %3 非OK)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); +// QListWidgetItem *item = new QListWidgetItem(item_str); +// QString item_data_nok = QString("S%1C%2P##NO").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); +// item->setData(Qt::UserRole, item_data_nok); +// list_widget_available->addItem(item); } } } diff --git a/singlerelay.ui b/singlerelay.ui index a01b999..17ca5f5 100644 --- a/singlerelay.ui +++ b/singlerelay.ui @@ -1003,7 +1003,7 @@ 640 30 - 71 + 91 16 @@ -1014,15 +1014,74 @@ - 630 - 70 - 100 - 32 + 632 + 110 + 141 + 31 + + + + + 50 + 0 + + + + + 50 + 16777215 + + + + 选择: + + + + + + + + 50 + 30 + + + + + 50 + 30 + + + + + + + + + + 632 + 72 + 141 + 32 + + + + + + 50 + 0 + + + + + 50 + 16777215 + + 逻辑: @@ -1041,7 +1100,7 @@ - 16777215 + 50 30 @@ -1099,41 +1158,6 @@ - - - - 631 - 131 - 100 - 27 - - - - - - - 选择: - - - - - - - - 50 - 25 - - - - - 50 - 25 - - - - - - diff --git a/singlerelay_nok.cpp b/singlerelay_nok.cpp index 3b46291..487a1fe 100644 --- a/singlerelay_nok.cpp +++ b/singlerelay_nok.cpp @@ -210,36 +210,6 @@ void SingleRelay_NOK::OnButtonGroup(QAbstractButton *slot_btn) { if(variable_base == nullptr) continue; if(base_ptr->card_type_ == kCardVibSingle){ - QString item_data; - if(variable_base->alert_high.enable){ - QString item_str = QString("%1 (槽位 %3 通道 %4 警报高)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); - QListWidgetItem *item = new QListWidgetItem(item_str); - item_data = QString("S%1C%2A2").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); - item->setData(Qt::UserRole, item_data); - list_widget_available->addItem(item); - } - - if(variable_base->danger_high.enable){ - QString item_str = QString("%1 (槽位 %3 通道 %4 危险高)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); - QListWidgetItem *item = new QListWidgetItem(item_str); - item_data = QString("S%1C%2A1").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); - item->setData(Qt::UserRole, item_data); - list_widget_available->addItem(item); - } - if(variable_base->danger_low.enable){ - QString item_str = QString("%1 (槽位 %3 通道 %4 危险低)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); - QListWidgetItem *item = new QListWidgetItem(item_str); - item_data = QString("S%1C%2A4").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); - item->setData(Qt::UserRole, item_data); - list_widget_available->addItem(item); - } - if(variable_base->alert_low.enable){ - QString item_str = QString("%1 (槽位 %3 通道 %4 警报低)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); - QListWidgetItem *item = new QListWidgetItem(item_str); - item_data = QString("S%1C%2A3").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); - item->setData(Qt::UserRole, item_data); - list_widget_available->addItem(item); - } QString item_str = QString("%1 (槽位 %2 通道 %3 非OK)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); QListWidgetItem *item = new QListWidgetItem(item_str); QString item_data_nok = QString("S%1C%2P##NO").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); diff --git a/singlerelay_nok.ui b/singlerelay_nok.ui index 17eeb78..7336989 100644 --- a/singlerelay_nok.ui +++ b/singlerelay_nok.ui @@ -6,101 +6,13 @@ 0 0 - 903 + 975 606 - Form + 非OK继电器 - - - - 630 - 70 - 111 - 32 - - - - - - - 逻辑: - - - - - - - false - - - - 50 - 30 - - - - - 16777215 - 30 - - - - - 1 - - - - - 2 - - - - - 3 - - - - - 4 - - - - - 5 - - - - - 6 - - - - - 7 - - - - - 8 - - - - - 9 - - - - - 10 - - - - - - @@ -826,41 +738,6 @@ - - - - 631 - 131 - 111 - 27 - - - - - - - 选择: - - - - - - - - 50 - 25 - - - - - 50 - 25 - - - - - - @@ -1134,6 +1011,153 @@ 可用的告警: + + + + 630 + 108 + 141 + 32 + + + + + + + + 50 + 0 + + + + + 50 + 16777215 + + + + 选择: + + + + + + + + 50 + 30 + + + + + 50 + 30 + + + + + + + + + + 630 + 70 + 141 + 32 + + + + + + + + 50 + 0 + + + + + 50 + 16777215 + + + + 逻辑: + + + + + + + false + + + + 50 + 30 + + + + + 50 + 30 + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + +