|
@@ -16,7 +16,7 @@
|
|
|
const int ColIndexBlastStatus = 6;
|
|
|
const int ColIndexProgressBar = 7;
|
|
|
const int ColIndexOpBtn = 8;
|
|
|
-const int ColIndexUuid = 9;
|
|
|
+const int ColIndexBlasterDev = 1;
|
|
|
|
|
|
BlastOpePage::BlastOpePage(QWidget *parent)
|
|
|
: QWidget(parent), ui(new Ui::BlastOpePage), dao(DatabaseManager::getInstance().getDatabase()) {
|
|
@@ -33,9 +33,8 @@ BlastOpePage::BlastOpePage(QWidget *parent)
|
|
|
}
|
|
|
}
|
|
|
if (!isAllSafetyInspectorConfirmed) {
|
|
|
- bool isContinue = CustomMessageBox::showConfirmDialog("安全检查未完成", "安全检查没有全部确认,是否继续?",
|
|
|
- "继续", "取消", this);
|
|
|
-
|
|
|
+ bool isContinue =
|
|
|
+ CustomMessageBox::showConfirmDialog("警告", "安全检查没有全部确认,是否继续?", "继续", "取消", this);
|
|
|
if (!isContinue) {
|
|
|
return;
|
|
|
}
|
|
@@ -270,7 +269,7 @@ void BlastOpePage::RefreshData() { loadDataAndDrawTable(m_currentPage, m_pageSiz
|
|
|
|
|
|
void BlastOpePage::loadDataAndDrawTable(int currentPage, int pageSize) {
|
|
|
LoadingWidget::showLoading(this, "正在加载数据...");
|
|
|
- QJsonObject extParams{{"blast_status", QJsonArray({"2"})}};
|
|
|
+ QJsonObject extParams{{"blastStatus", QJsonArray({"2"})}};
|
|
|
QJsonObject result = backendAPIManager::getHProjects(currentPage, pageSize, extParams);
|
|
|
|
|
|
QList<QSharedPointer<HProject>> projectList =
|
|
@@ -280,17 +279,14 @@ void BlastOpePage::loadDataAndDrawTable(int currentPage, int pageSize) {
|
|
|
pageWidget->setMaxPage(ceil(static_cast<double>(totalCount) / pageSize));
|
|
|
|
|
|
model = new QStandardItemModel(this);
|
|
|
- qDebug() << "项目列表大小: " << projectList;
|
|
|
|
|
|
headers = {
|
|
|
{"选择", ""},
|
|
|
+ {"井下起爆器", "pcSn"},
|
|
|
{"工程名称", "name"},
|
|
|
- //{"井上爆破员", "operatorName"},
|
|
|
- // {"井下爆破员", "blasterName"},
|
|
|
{"井下地址", "addressPath"},
|
|
|
{"雷管数量", "detSum"},
|
|
|
{"炸药量(kg)", "blastCount"},
|
|
|
- {"井下起爆器", "pcSn"},
|
|
|
{"起爆状态", "blastStatus"},
|
|
|
{"进度", ""},
|
|
|
{"操作", ""},
|
|
@@ -322,7 +318,6 @@ void BlastOpePage::loadDataAndDrawTable(int currentPage, int pageSize) {
|
|
|
QMetaProperty metaProp =
|
|
|
HProject.metaObject()->property(HProject.metaObject()->indexOfProperty(prop.toUtf8()));
|
|
|
QVariant value = metaProp.read(&HProject);
|
|
|
- qDebug() << "prop: " << prop << ", value: " << value;
|
|
|
|
|
|
if (prop == "blastStatus") {
|
|
|
QString statusText;
|
|
@@ -371,43 +366,22 @@ void BlastOpePage::loadDataAndDrawTable(int currentPage, int pageSize) {
|
|
|
// 初始化progressBars
|
|
|
int progressCol = headers.size() - 2; //
|
|
|
QProgressBar *progressBar1 = new QProgressBar(ui->tableView);
|
|
|
- progressBar1->setRange(0, 100); // 设置范围为0到100
|
|
|
- progressBar1->setValue(0);
|
|
|
- progressBar1->setAlignment(Qt::AlignCenter);
|
|
|
- progressBar1->setStyleSheet(
|
|
|
- "QProgressBar { border: 1px solid grey; border-radius: 5px; background-color: #EEEEEE; "
|
|
|
- "height: 10px; }"
|
|
|
- "QProgressBar::chunk { background-color: #05B8CC; width: 2px; margin: 0.5px; border - "
|
|
|
- "radius: 10px; }");
|
|
|
- progressBar1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
|
-
|
|
|
QProgressBar *progressBar2 = new QProgressBar(ui->tableView);
|
|
|
- progressBar2->setRange(0, 100); // 设置范围为0到100
|
|
|
- progressBar2->setValue(0);
|
|
|
- progressBar2->setAlignment(Qt::AlignCenter);
|
|
|
- progressBar2->setStyleSheet(
|
|
|
- "QProgressBar { border: 1px solid grey; border-radius: 5px; background-color: #EEEEEE; "
|
|
|
- "height: 10px; }"
|
|
|
- "QProgressBar::chunk { background-color: #05B8CC; width: 2px; margin: 0.5px; border - "
|
|
|
- "radius: 10px; }");
|
|
|
- progressBar2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
|
-
|
|
|
QProgressBar *progressBar3 = new QProgressBar(ui->tableView);
|
|
|
- progressBar3->setRange(0, 100); // 设置范围为0到100
|
|
|
- progressBar3->setValue(0);
|
|
|
- progressBar3->setAlignment(Qt::AlignCenter);
|
|
|
- progressBar3->setStyleSheet(
|
|
|
- "QProgressBar { border: 1px solid grey; border-radius: 5px; background-color: #EEEEEE; "
|
|
|
- "height: 10px; }"
|
|
|
- "QProgressBar::chunk { background-color: #05B8CC; width: 2px; margin: 0.5px; border - "
|
|
|
- "radius: 10px; }");
|
|
|
- progressBar3->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
|
-
|
|
|
- progressBars.append(ProgressBarTriple(progressBar1, progressBar2, progressBar3));
|
|
|
QHBoxLayout *progressBarLayout = new QHBoxLayout;
|
|
|
- progressBarLayout->addWidget(progressBar1);
|
|
|
- progressBarLayout->addWidget(progressBar2);
|
|
|
- progressBarLayout->addWidget(progressBar3);
|
|
|
+ progressBars.append(ProgressBarTriple(progressBar1, progressBar2, progressBar3));
|
|
|
+ for (QProgressBar *pb : {progressBar1, progressBar2, progressBar3}) {
|
|
|
+ pb->setRange(0, 100); // 设置范围为0到100
|
|
|
+ pb->setValue(0);
|
|
|
+ pb->setAlignment(Qt::AlignCenter);
|
|
|
+ pb->setStyleSheet(
|
|
|
+ "QProgressBar { border: 1px solid grey; border-radius: 5px; background-color: #EEEEEE; "
|
|
|
+ "height: 10px; }"
|
|
|
+ "QProgressBar::chunk { background-color: #05B8CC; width: 2px; margin: 0.5px; border - "
|
|
|
+ "radius: 10px; }");
|
|
|
+ pb->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
|
+ progressBarLayout->addWidget(pb);
|
|
|
+ }
|
|
|
progressBarLayout->setAlignment(Qt::AlignCenter);
|
|
|
progressBarLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
progressBarLayout->setSpacing(0); // 设置进度条之间的间距为0
|
|
@@ -423,7 +397,6 @@ void BlastOpePage::loadDataAndDrawTable(int currentPage, int pageSize) {
|
|
|
QWidget *widget = new QWidget(ui->tableView);
|
|
|
QPushButton *button = new QPushButton(widget);
|
|
|
button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
|
- // 添加button disable时样式为灰色
|
|
|
button->setStyleSheet("QPushButton:disabled { background-color: #d3d3d3; color: gray; }");
|
|
|
|
|
|
QModelIndex statusIndex = model->index(row, ColIndexBlastStatus);
|
|
@@ -470,12 +443,14 @@ void BlastOpePage::updateProgressBar(int firingStage, int row) {
|
|
|
QProgressBar *progressBar1 = progressBars[row].bar1;
|
|
|
QProgressBar *progressBar2 = progressBars[row].bar2;
|
|
|
QProgressBar *progressBar3 = progressBars[row].bar3;
|
|
|
+
|
|
|
+ progressBar1->setRange(0, 100); // 设置范围为0到100
|
|
|
+ progressBar1->setValue(0);
|
|
|
+ progressBar2->setRange(0, 100); // 设置范围为0到100
|
|
|
+ progressBar2->setValue(0);
|
|
|
+ progressBar3->setRange(0, 100); // 设置范围为0到100
|
|
|
+ progressBar3->setValue(0);
|
|
|
switch (firingStage) {
|
|
|
- case FiringStages::Starting:
|
|
|
- progressBar1->setValue(0);
|
|
|
- progressBar2->setValue(0);
|
|
|
- progressBar3->setValue(0);
|
|
|
- break;
|
|
|
case FiringStages::QuickTesting:
|
|
|
// 起爆检测状态
|
|
|
progressBar1->setRange(0, 0); // 设置范围为0到100
|
|
@@ -483,37 +458,31 @@ void BlastOpePage::updateProgressBar(int firingStage, int row) {
|
|
|
break;
|
|
|
case FiringStages::QuickTestFinished:
|
|
|
// 起爆检测完成
|
|
|
- progressBar1->setRange(0, 100); // 设置范围为0到100
|
|
|
progressBar1->setValue(100);
|
|
|
break;
|
|
|
case FiringStages::NetCharging:
|
|
|
// 充电开始
|
|
|
+ progressBar1->setValue(100);
|
|
|
progressBar2->setRange(0, 0); // 设置范围为0到100
|
|
|
progressBar2->setValue(0);
|
|
|
break;
|
|
|
case FiringStages::NetChargingFinished:
|
|
|
// 充电完成
|
|
|
- progressBar2->setRange(0, 100); // 设置范围为0到100
|
|
|
+ progressBar1->setValue(100);
|
|
|
progressBar2->setValue(100);
|
|
|
break;
|
|
|
case FiringStages::Blasting:
|
|
|
- // 起爆中
|
|
|
+ progressBar1->setValue(100);
|
|
|
+ progressBar2->setValue(100);
|
|
|
progressBar3->setRange(0, 0); // 设置范围为0到100
|
|
|
progressBar3->setValue(0);
|
|
|
break;
|
|
|
case FiringStages::BlastFinished:
|
|
|
// 充电完成
|
|
|
- progressBar3->setRange(0, 100); // 设置范围为0到100
|
|
|
+ progressBar1->setValue(100);
|
|
|
+ progressBar2->setValue(100);
|
|
|
progressBar3->setValue(100);
|
|
|
break;
|
|
|
- case FiringStages::CancelConfirmed:
|
|
|
- progressBar1->setRange(0, 100); // 设置范围为0到100
|
|
|
- progressBar1->setValue(0);
|
|
|
- progressBar2->setRange(0, 100); // 设置范围为0到100
|
|
|
- progressBar2->setValue(0);
|
|
|
- progressBar3->setRange(0, 100); // 设置范围为0到100
|
|
|
- progressBar3->setValue(0);
|
|
|
- break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -592,14 +561,12 @@ void BlastOpePage::onFiringStageUpdated(int stage, int row) {
|
|
|
}
|
|
|
|
|
|
void BlastOpePage::handleSingleBlastButtonClicked(int row, QPushButton *button) {
|
|
|
- QStandardItem *uuidItem = model->item(row, ColIndexUuid);
|
|
|
- QString uuid;
|
|
|
- if (uuidItem) {
|
|
|
- QVariant uuidVariant = uuidItem->data(Qt::UserRole);
|
|
|
- if (uuidVariant.isValid()) {
|
|
|
- uuid = uuidVariant.toString();
|
|
|
- }
|
|
|
+ QStandardItem *devItem = model->item(row, ColIndexBlasterDev);
|
|
|
+ QString blasterDevUuid;
|
|
|
+ if (devItem) {
|
|
|
+ blasterDevUuid = devItem->text();
|
|
|
}
|
|
|
+ qDebug() << "handleSingleBlastButtonClicked: row = " << row << ", uuid = " << blasterDevUuid;
|
|
|
|
|
|
if (button->text() == startBlastButtonTxt) {
|
|
|
button->setDisabled(true);
|
|
@@ -611,9 +578,9 @@ void BlastOpePage::handleSingleBlastButtonClicked(int row, QPushButton *button)
|
|
|
});
|
|
|
button->setMinimumWidth(80);
|
|
|
button->setText(stopBlastButtonTxt);
|
|
|
- firingWidget *widget = new firingWidget(row, false, uuid);
|
|
|
+ firingWidget *widget = new firingWidget(row, false, blasterDevUuid);
|
|
|
connect(widget, &firingWidget::updatefiringStage, this, &BlastOpePage::onFiringStageUpdated);
|
|
|
- connect(widget, &firingWidget::countdown, this, &BlastOpePage::showCountDownWidget);
|
|
|
+ connect(widget, &firingWidget::startCountdown, this, &BlastOpePage::showCountDownWidget);
|
|
|
connect(widget, &firingWidget::updateProjectStatus, this, &BlastOpePage::handlerUpdateProjectStatus);
|
|
|
connect(widget, &firingWidget::closeFiring, this, &BlastOpePage::destroyFiringWidget);
|
|
|
if (isShowTriggeringWidget) {
|
|
@@ -621,28 +588,16 @@ void BlastOpePage::handleSingleBlastButtonClicked(int row, QPushButton *button)
|
|
|
}
|
|
|
|
|
|
widget->setAttribute(Qt::WA_DeleteOnClose);
|
|
|
- firingWidgetByUuid.insert(uuid, widget);
|
|
|
+ firingWidgetByUuid.insert(blasterDevUuid, widget);
|
|
|
widget->startBlasting();
|
|
|
|
|
|
} else if (button->text() == stopBlastButtonTxt) {
|
|
|
- // TODO: wrap into class
|
|
|
- QMessageBox msgBox;
|
|
|
- msgBox.setWindowTitle("提示");
|
|
|
- msgBox.setText("是否取消爆破?");
|
|
|
- QPushButton *yesButton = msgBox.addButton("是", QMessageBox::YesRole);
|
|
|
- QPushButton *noButton = msgBox.addButton("否", QMessageBox::NoRole);
|
|
|
- yesButton->setStyleSheet(
|
|
|
- "QPushButton { background-color:rgb(5, 58, 156); color: white; padding: 5px 15px; "
|
|
|
- "border-radius: 4px; }");
|
|
|
- noButton->setStyleSheet(
|
|
|
- "QPushButton { background-color: #f44336; color: white; padding: 5px 15px; "
|
|
|
- "border-radius: 4px; }");
|
|
|
- msgBox.exec();
|
|
|
- if (msgBox.clickedButton() == noButton) {
|
|
|
+ bool isContinue = CustomMessageBox::showConfirmDialog("提示", "是否取消爆破?", "继续", "取消", this);
|
|
|
+ if (!isContinue) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- firingWidget *widget = firingWidgetByUuid.value(uuid);
|
|
|
+ firingWidget *widget = firingWidgetByUuid.value(blasterDevUuid);
|
|
|
if (widget) {
|
|
|
widget->sendCancelFiringMsg();
|
|
|
}
|
|
@@ -779,7 +734,7 @@ void BlastOpePage::on_btnSelect_clicked() {
|
|
|
int row = it.key();
|
|
|
QString uuid = it.value();
|
|
|
firingWidget *widgetSelect = new firingWidget(row, true, uuid);
|
|
|
- QModelIndex index = model->index(row, ColIndexUuid);
|
|
|
+ QModelIndex index = model->index(row, ColIndexBlasterDev);
|
|
|
if (index.isValid()) {
|
|
|
QWidget *widgetButton = ui->tableView->indexWidget(index);
|
|
|
if (widgetButton) {
|
|
@@ -811,21 +766,21 @@ void BlastOpePage::setBatchBlastTrigger(QString uuid) {
|
|
|
if (isSame) {
|
|
|
bool successSelect;
|
|
|
serialTool = SerialTool::getInstance(nullptr, &successSelect);
|
|
|
- connect(serialTool, &SerialTool::buttonPressedReceived, this, &BlastOpePage::showCountDownForBatchBlast,
|
|
|
+ connect(serialTool, &SerialTool::triggerButtonPressed, this, &BlastOpePage::showCountDownForBatchBlast,
|
|
|
Qt::SingleShotConnection);
|
|
|
if (serialTool) {
|
|
|
QByteArray data = "\r\nENABLE_BUTTON\r\n";
|
|
|
bool success = serialTool->sendData(data);
|
|
|
if (success) {
|
|
|
- Logger::getInstance().info("blast triggered.");
|
|
|
+ Logger::getInstance().info("enable batch trigger button message send.");
|
|
|
} else {
|
|
|
- Logger::getInstance().warn("blast trigger failed.");
|
|
|
+ Logger::getInstance().warn("enable batch trigger button message send failed.");
|
|
|
}
|
|
|
connect(
|
|
|
- serialTool, &SerialTool::enableButtonReceived, this,
|
|
|
+ serialTool, &SerialTool::triggerButtonEnabled, this,
|
|
|
[this]() {
|
|
|
for (const auto &row : uuidMap.keys()) {
|
|
|
- onFiringStageUpdated(10, row);
|
|
|
+ onFiringStageUpdated(FiringStages::PendingTriggerButtonClick, row);
|
|
|
}
|
|
|
},
|
|
|
Qt::SingleShotConnection);
|