|
@@ -1,6 +1,10 @@
|
|
#include "SchemePlanWidget.h"
|
|
#include "SchemePlanWidget.h"
|
|
|
|
|
|
#include "SchemeFlowWidget.h"
|
|
#include "SchemeFlowWidget.h"
|
|
|
|
+#include "ProjectManager.h"
|
|
|
|
+
|
|
|
|
+#include <dbService/ClassSet.h>
|
|
|
|
+#include <dbService/SchemeProcessService.h>
|
|
|
|
|
|
#include <CSchemeView.h>
|
|
#include <CSchemeView.h>
|
|
|
|
|
|
@@ -34,15 +38,64 @@ void SchemePlanWidget::setupUI()
|
|
connect(m_export, &PushButton::clicked, this, &SchemePlanWidget::slotExportClicked);
|
|
connect(m_export, &PushButton::clicked, this, &SchemePlanWidget::slotExportClicked);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+QList<SchemePlanManager::SchemeProcessInfo> SchemePlanWidget::templateSchemes(int projId, int indexType)
|
|
|
|
+{
|
|
|
|
+ QList<SchemePlanManager::SchemeProcessType> types;
|
|
|
|
+ switch (indexType) {
|
|
|
|
+ case ProjectManager::AbilityIndex: {
|
|
|
|
+ types = { SchemePlanManager::IndexSystem, SchemePlanManager::ImportWeightData,
|
|
|
|
+ SchemePlanManager::OptimizeIndex, SchemePlanManager::CalculateWeight,
|
|
|
|
+ SchemePlanManager::ShowEvalResult, SchemePlanManager::GenerateReport };
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ case ProjectManager::TechIndex: {
|
|
|
|
+ types = { SchemePlanManager::IndexSystem, SchemePlanManager::ImportEvalData, SchemePlanManager::RunEvaluate,
|
|
|
|
+ SchemePlanManager::ShowEvalResult, SchemePlanManager::GenerateReport };
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ case ProjectManager::OptimalIndex: {
|
|
|
|
+ types = { SchemePlanManager::IndexSystem, SchemePlanManager::ImportWeightData,
|
|
|
|
+ SchemePlanManager::OptimizeIndex, SchemePlanManager::CalculateWeight,
|
|
|
|
+ SchemePlanManager::ImportEvalData, SchemePlanManager::RunEvaluate,
|
|
|
|
+ SchemePlanManager::ShowEvalResult, SchemePlanManager::GenerateReport };
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ case ProjectManager::EfficiencyIndex: {
|
|
|
|
+ types = { SchemePlanManager::IndexSystem, SchemePlanManager::ImportWeightData,
|
|
|
|
+ SchemePlanManager::OptimizeIndex, SchemePlanManager::CalculateWeight,
|
|
|
|
+ SchemePlanManager::ImportEvalData, SchemePlanManager::RunEvaluate,
|
|
|
|
+ SchemePlanManager::ShowEvalResult, SchemePlanManager::GenerateReport };
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ QList<SchemePlanManager::SchemeProcessInfo> schemes;
|
|
|
|
+ for (int i = 0; i < types.count(); i++) {
|
|
|
|
+ SchemePlanManager::SchemeProcessInfo process;
|
|
|
|
+ process.projectId = projId;
|
|
|
|
+ process.indexType = indexType;
|
|
|
|
+ process.type = types[i];
|
|
|
|
+ process.step = i;
|
|
|
|
+ schemes.append(process);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return schemes;
|
|
|
|
+}
|
|
|
|
+
|
|
void SchemePlanWidget::setupTabWidget()
|
|
void SchemePlanWidget::setupTabWidget()
|
|
{
|
|
{
|
|
m_tab->clear();
|
|
m_tab->clear();
|
|
|
|
|
|
for (int i : indexList()) {
|
|
for (int i : indexList()) {
|
|
- SchemeFlowWidget *m = new SchemeFlowWidget(proj(), this);
|
|
|
|
- connect(m, &SchemeFlowWidget::sigSchemeProcessCreated, this, &SchemePlanWidget::slotSchemeCreated);
|
|
|
|
|
|
+ SchemeFlowWidget *m = new SchemeFlowWidget(this);
|
|
connect(m, &SchemeFlowWidget::sigSchemeProcessEdited, this, &SchemePlanWidget::slotSchemeProcessEdited);
|
|
connect(m, &SchemeFlowWidget::sigSchemeProcessEdited, this, &SchemePlanWidget::slotSchemeProcessEdited);
|
|
- m->setType(i);
|
|
|
|
|
|
+
|
|
|
|
+ QList<SchemePlanManager::SchemeProcessInfo> schemes;
|
|
|
|
+ bool ret = SchemeProcessService().QueryAllByProjectIdAndIndexType(schemes);
|
|
|
|
+ if (ret && schemes.count() <= 1) {
|
|
|
|
+ schemes = templateSchemes(m_proj->id, i);
|
|
|
|
+ }
|
|
|
|
+ m->loadSchemes(schemes);
|
|
|
|
|
|
ProjectManager::IndexType t = (ProjectManager::IndexType)i;
|
|
ProjectManager::IndexType t = (ProjectManager::IndexType)i;
|
|
QString s = ProjectManager::nameOfIndexType(t);
|
|
QString s = ProjectManager::nameOfIndexType(t);
|
|
@@ -52,18 +105,13 @@ void SchemePlanWidget::setupTabWidget()
|
|
|
|
|
|
void SchemePlanWidget::slotExportClicked()
|
|
void SchemePlanWidget::slotExportClicked()
|
|
{
|
|
{
|
|
|
|
+
|
|
for (int i = 0; i < m_tab->count(); i++) {
|
|
for (int i = 0; i < m_tab->count(); i++) {
|
|
SchemeFlowWidget *w = (SchemeFlowWidget *)m_tab->widget(i);
|
|
SchemeFlowWidget *w = (SchemeFlowWidget *)m_tab->widget(i);
|
|
QList<SchemePlanManager::SchemeProcessInfo> schemes = w->schemes();
|
|
QList<SchemePlanManager::SchemeProcessInfo> schemes = w->schemes();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void SchemePlanWidget::slotSchemeCreated()
|
|
|
|
-{
|
|
|
|
- SchemeFlowWidget *w = (SchemeFlowWidget *)sender();
|
|
|
|
- qDebug() << __FUNCTION__ << __LINE__ << w->indexType() << endl;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
void SchemePlanWidget::slotSchemeProcessEdited(const SchemePlanManager::SchemeProcessInfo &process)
|
|
void SchemePlanWidget::slotSchemeProcessEdited(const SchemePlanManager::SchemeProcessInfo &process)
|
|
{
|
|
{
|
|
qDebug() << __FUNCTION__ << __LINE__ << process.id << endl;
|
|
qDebug() << __FUNCTION__ << __LINE__ << process.id << endl;
|