修改设置新建测量时,状态改变,新增数据实时更新。
This commit is contained in:
parent
d40e7c7ae6
commit
7cda2890ce
|
|
@ -32,6 +32,7 @@
|
|||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include "MeasureClient.h"
|
||||
#include "MeasureAnalysisDataTableView.h"
|
||||
#include "GvfToCsv/GvfToCsv.h"
|
||||
using namespace ads;
|
||||
|
||||
|
|
@ -465,6 +466,17 @@ void MainWindow::on_action_start_measure_triggered()
|
|||
QMap<QString, QStandardItem *> node = project_node_items[models->GetProjectName()];
|
||||
QStandardItem *nodeItem = node[models->GetProjectName()];
|
||||
ProjectList::Instance()->SetNodeStatus(nodeItem,"测量中",true);
|
||||
|
||||
QString dir = ProjectList::Instance()->GetCurrentProjectModel()->GetProjectDir();
|
||||
QString csvPath = QStringLiteral(u"%1/%2").arg(dir).arg("粒子数据.csv");
|
||||
models->SetAllChannelParticleDataFilename(csvPath);
|
||||
bool status_ok = !models->GetAllChannelParticleDataFilename().isEmpty();
|
||||
QString status = status_ok ? QStringLiteral(u"有效") : QStringLiteral(u"无效");
|
||||
QVariant analys_type = QVariant::fromValue(AnalysisType::ParticleData);
|
||||
QString item_name = QStringLiteral(u"测量粒子数据");
|
||||
QStandardItem * particleData = node[item_name];
|
||||
ProjectList::Instance()->SetNodeStatus(particleData,status,true);
|
||||
|
||||
QString projectName;
|
||||
QString deviceCfg;
|
||||
if(models)
|
||||
|
|
@ -474,6 +486,7 @@ void MainWindow::on_action_start_measure_triggered()
|
|||
if(deviceCfg == "")
|
||||
{
|
||||
QMessageBox::information(this,"提示","设备参数配置未配置","确认","取消");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -507,6 +520,19 @@ void MainWindow::onStartMeasureResult(bool success, const QString &info)
|
|||
{
|
||||
LOG_INFO(QStringLiteral(u"启动测量成功"));
|
||||
LOG_INFO(QStringLiteral(u"测量数据GVF文件: %1").arg(info));
|
||||
MeasureAnalysisProjectModel* models = ProjectList::Instance()->GetCurrentProjectModel();
|
||||
QMap<QString, QMap<QString, QStandardItem *> > project_node_items = ProjectList::Instance()->getProjectNodeItems();
|
||||
QMap<QString, QStandardItem *> node = project_node_items[models->GetProjectName()];
|
||||
QString dir = ProjectList::Instance()->GetCurrentProjectModel()->GetProjectDir();
|
||||
QString csvPath = QStringLiteral(u"%1/%2").arg(dir).arg("粒子数据.csv");
|
||||
models->SetAllChannelParticleDataFilename(csvPath);
|
||||
bool status_ok = !models->GetAllChannelParticleDataFilename().isEmpty();
|
||||
QString status = status_ok ? QStringLiteral(u"有效") : QStringLiteral(u"无效");
|
||||
QVariant analys_type = QVariant::fromValue(AnalysisType::ParticleData);
|
||||
QString item_name = QStringLiteral(u"测量粒子数据");
|
||||
QStandardItem * particleData = node[item_name];
|
||||
ProjectList::Instance()->SetNodeStatus(particleData,status,true);
|
||||
|
||||
}
|
||||
else
|
||||
LOG_INFO(QStringLiteral(u"启动测量失败: %1").arg(info));
|
||||
|
|
@ -560,7 +586,7 @@ void MainWindow::onRunningInfo(const QString &run_info)
|
|||
|
||||
void MainWindow::onGvfData(const QByteArray &data)
|
||||
{
|
||||
LOG_INFO(QStringLiteral(u"GVFDATA: %1").arg(QString::fromUtf8(data.toHex().toUpper())));
|
||||
// LOG_INFO(QStringLiteral(u"GVFDATA: %1").arg(QString::fromUtf8(data.toHex().toUpper())));
|
||||
QList<ParticleData> particles = _gvfToCsv->parseParticleFrames(data);
|
||||
if (particles.isEmpty()) {
|
||||
LOG_INFO(QStringLiteral(u"本次GVF数据未解析到有效粒子,跳过写入CSV"));
|
||||
|
|
@ -600,10 +626,34 @@ void MainWindow::onGvfData(const QByteArray &data)
|
|||
out.flush(); // 确保数据立即写入磁盘,避免程序崩溃丢失数据
|
||||
outFile.close();
|
||||
|
||||
LOG_INFO(QStringLiteral(u"已成功追加写入%1条粒子数据到CSV文件: %2")
|
||||
.arg(particles.size())
|
||||
.arg(csvPath));
|
||||
|
||||
auto dockList = _dock_manager->dockWidgetsMap().values();
|
||||
for(auto dock : dockList)
|
||||
{
|
||||
MeasureAnalysisView* view = dynamic_cast<MeasureAnalysisView*>(dock->widget());
|
||||
if(!view) continue;
|
||||
if(view->GetAnalyzeType() == AnalysisType::ParticleData
|
||||
&& view->GetViewType() == MeasureAnalysisView::DataTable)
|
||||
{
|
||||
MeasureAnalysisDataTableView* table = dynamic_cast<MeasureAnalysisDataTableView*>(view);
|
||||
table->RefreshTableData(csvPath);
|
||||
|
||||
ProjectList* project_list_model = ProjectList::Instance();
|
||||
auto project_model = project_list_model->GetCurrentProjectModel();
|
||||
const QString& all_channel_particle_data_filename = project_model->GetAllChannelParticleDataFilename();
|
||||
if (!all_channel_particle_data_filename.isEmpty()) {
|
||||
const QString& all_ch_count_dir = project_model->GetProjectDir();
|
||||
const QString& every_ch_count_dir = QDir(project_model->GetProjectDir()).filePath(QStringLiteral(u"通道道址计数"));
|
||||
auto count_task = new DataProcessWorkPool::EveryChannelParticleCountDataTask;
|
||||
count_task->SetAllChannelParticleDataFilename(all_channel_particle_data_filename);
|
||||
count_task->SetAllChannelCountResultDir(all_ch_count_dir);
|
||||
count_task->SetEveryChannelCountResultDir(every_ch_count_dir);
|
||||
count_task->SetFinishedNotifier(project_list_model, "onChannelAddressCountProcessFinished", project_model->GetProjectName());
|
||||
count_task->StartTask();
|
||||
}
|
||||
// initAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -48,3 +48,16 @@ void MeasureAnalysisDataTableView::SetAnalyzeDataFilename(const QMap<QString, QV
|
|||
_tableView->setVirtualModel(table_model);
|
||||
_tableView->setBufferSize(_buffer_size);
|
||||
}
|
||||
|
||||
void MeasureAnalysisDataTableView::RefreshTableData(const QString &csvFilePath)
|
||||
{
|
||||
auto csv_source = std::make_shared<CsvDataSource>(csvFilePath);
|
||||
if(!csv_source->isValid()) return;
|
||||
|
||||
VirtualTableModel* newModel = new VirtualTableModel;
|
||||
newModel->setDataSource(csv_source);
|
||||
newModel->setPreloadPolicy(_preload_policy);
|
||||
newModel->setBlockSize(_block_size);
|
||||
_tableView->setVirtualModel(newModel);
|
||||
_tableView->setBufferSize(_buffer_size);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ public:
|
|||
|
||||
virtual void InitViewWorkspace(const QString& project_name) override final;
|
||||
virtual void SetAnalyzeDataFilename(const QMap<QString, QVariant>& data_files_set);
|
||||
void RefreshTableData(const QString& csvFilePath);
|
||||
|
||||
private:
|
||||
// 私有成员变量
|
||||
|
|
|
|||
|
|
@ -192,8 +192,10 @@ void NewMeasureAnalysisDlg::newProject(const QString& particle_data_filename)
|
|||
model->SetMeasurePresetTime(measure_preset_time);
|
||||
model->SetConformTimeWin(conform_time_win);
|
||||
model->SetDescriptionInfo(description_info);
|
||||
model->SetMeasureDeviceParamsCfgFilename(project_measure_param_filename);
|
||||
model->SetEnergyScaleFilename(project_energy_scale_filename);
|
||||
if(measure_param_file_info.exists(project_measure_param_filename))
|
||||
model->SetMeasureDeviceParamsCfgFilename(project_measure_param_filename);
|
||||
if(measure_param_file_info.exists(project_energy_scale_filename))
|
||||
model->SetEnergyScaleFilename(project_energy_scale_filename);
|
||||
model->SetAllChannelParticleDataFilename(particle_data_filename);
|
||||
model->SetIsMeasureComplete(is_measure_complete);
|
||||
ProjectList::Instance()->AddProjectModel(model);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user