From 4fb38c3022f81d974a78eaf8be149b8d59ff8fc8 Mon Sep 17 00:00:00 2001 From: lvjunjie Date: Wed, 14 Oct 2026 10:08:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(nmNum):=20=E9=87=8D=E6=96=B0=E7=94=9F?= =?UTF-8?q?=E6=88=90=E6=A8=A1=E5=9E=8B=E5=90=8E=E6=B8=85=E9=99=A4=E6=97=A7?= =?UTF-8?q?=E5=88=86=E6=9E=90=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新模型成功提交后丢弃旧敏感性分析批次,覆盖手工求解与自动拟合流程。 - 清除旧曲线及撤销记录,关闭结果图和结果列表,禁用 Results 按钮。 - 保留采样配置,修改参数但未求解、求解失败或取消时保留原结果。 --- Src/nmNum/nmData/nmDataAnalyzeManager.cpp | 5 +++++ Src/nmNum/nmSubWnd/nmSubWndMain.cpp | 19 ++++++++++++++++++- Src/nmNum/nmSubWxs/nmWxSensitive.cpp | 5 +++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Src/nmNum/nmData/nmDataAnalyzeManager.cpp b/Src/nmNum/nmData/nmDataAnalyzeManager.cpp index abc30303..13da0406 100644 --- a/Src/nmNum/nmData/nmDataAnalyzeManager.cpp +++ b/Src/nmNum/nmData/nmDataAnalyzeManager.cpp @@ -4937,6 +4937,11 @@ bool nmDataAnalyzeManager::commitPebiResultSnapshot( m_sCurrentResultWellInstanceId = sNextWellInstanceId; pCandidate.clear(); rebindPebiResultSnapshotToWells(); + // 新模型成功发布后丢弃旧敏感性结果,采样设置仍由窗口按新快照刷新。 + if(m_pSensitiveData != nullptr && !m_pSensitiveData->getResults().isNull()) { + m_pSensitiveData->setResults(QSharedPointer()); + emit sigSensitiveResultsChanged(); + } emit sigPebiResultSnapshotChanged(); notifyPebiResultStateChangedIfNeeded(oPreviousResultState); return true; diff --git a/Src/nmNum/nmSubWnd/nmSubWndMain.cpp b/Src/nmNum/nmSubWnd/nmSubWndMain.cpp index 8d420447..cafd5f3a 100644 --- a/Src/nmNum/nmSubWnd/nmSubWndMain.cpp +++ b/Src/nmNum/nmSubWnd/nmSubWndMain.cpp @@ -1874,8 +1874,25 @@ void nmSubWndMain::onShowSensitiveResults() iSubWndFitting* fitting = m_pResultRefreshFitting.data(); if(!manager || !fitting || !manager->getSensitiveData()) return; QSharedPointer result = manager->getSensitiveData()->getResults(); - if(result.isNull()) return; iGuiPlot* plot = fitting->getPlotByTag(s_Tag_ChartSensitivity); + if(result.isNull()) { + // 新模型已丢弃旧批次,同时清除图元与撤销记录,避免窗口恢复或保存后残留旧曲线。 + if(plot) { + for(int i = plot->m_pPlot->getObjCount() - 1; i >= 0; --i) { + if(qobject_cast(plot->m_pPlot->getObjByIndex(i))) + plot->m_pPlot->removeObjByIndex(i); + } + plot->clearUndoStack(); + plot->runUpdate(); + QMdiSubWindow* subWindow = nullptr; + for(QWidget* parent = plot->parentWidget(); parent && !subWindow; parent = parent->parentWidget()) + subWindow = qobject_cast(parent); + if(subWindow) subWindow->close(); + else plot->hide(); + } + if(sender() == manager) fitting->setModified(true); + return; + } const bool created = plot == nullptr; // 通用取窗接口未实现敏感性类型,直接复用框架已有的内部 MDI 创建函数。 if(created) plot = fitting->initSensitivityPlot(); diff --git a/Src/nmNum/nmSubWxs/nmWxSensitive.cpp b/Src/nmNum/nmSubWxs/nmWxSensitive.cpp index 938c92bb..352f6f42 100644 --- a/Src/nmNum/nmSubWxs/nmWxSensitive.cpp +++ b/Src/nmNum/nmSubWxs/nmWxSensitive.cpp @@ -1778,6 +1778,11 @@ void nmWxSensitive::onResultsChanged() resultsButton->setEnabled(!results.isNull()); m_sensitiveData.setResults(results); if(!m_resultsModel.isNull()) m_resultsModel->setResults(results); + // 新模型清除旧批次后关闭结果列表,不能继续操作上一模型的运行记录。 + if(results.isNull()) { + if(!m_resultsDialog.isNull()) m_resultsDialog->close(); + return; + } if(!m_resultsDialog.isNull()) { const QString status = results.isNull() ? QString() : results->m_bStopped ? tr("Stopped") : results->m_bCompleted ? tr("Completed") : tr("Failed");