chengxr пре 1 година
родитељ
комит
9185537a4b

+ 5 - 5
QFD/common/MindEvaluation.cpp

@@ -72,7 +72,7 @@ void MindEvaluation::init()
 void MindEvaluation::computeSingleWeights()
 {
     QList<NodeMatrixInfo *> nmInfos;
-    if (NodeMatrixService().QueryNodeMatrixListByExpertIdAndEngineerId2(&nmInfos, m_expertId, m_mind->root().projectId,
+    if (!NodeMatrixService().QueryNodeMatrixListByExpertIdAndEngineerId(&nmInfos, m_expertId, m_mind->root().projectId,
                                                                         m_tableType)) {
         QMessageBox::warning(nullptr, "警告", "数据库访问失败");
         return;
@@ -215,7 +215,7 @@ void MindEvaluation::computeNoMergeWeights()
     int enjId = m_mind->root().projectId;
     QList<UserConfig *> users;
 
-    if (UserConfigService().QueryUserConfigListInfoByEngineerId(&users, enjId)) {
+    if (!UserConfigService().QueryUserConfigListInfoByEngineerId(&users, enjId)) {
         QMessageBox::warning(nullptr, "警告", "数据库访问失败");
         return;
     }
@@ -226,7 +226,7 @@ void MindEvaluation::computeNoMergeWeights()
 
     for (const auto &user : users) {
         QList<NodeMatrixInfo *> nmInfos;
-        if (NodeMatrixService().QueryNodeMatrixListByExpertIdAndEngineerId2(&nmInfos, user->id, enjId, m_tableType)) {
+        if (!NodeMatrixService().QueryNodeMatrixListByExpertIdAndEngineerId(&nmInfos, user->id, enjId, m_tableType)) {
             qDeleteAll(users);
             QMessageBox::warning(nullptr, "警告", "数据库访问失败");
             return;
@@ -264,7 +264,7 @@ void MindEvaluation::computeMergeWeights()
     int enjId = m_mind->root().projectId;
     QList<UserConfig *> users;
 
-    if (UserConfigService().QueryUserConfigListInfoByEngineerId(&users, enjId)) {
+    if (!UserConfigService().QueryUserConfigListInfoByEngineerId(&users, enjId)) {
         QMessageBox::warning(nullptr, "警告", "数据库访问失败");
         return;
     }
@@ -276,7 +276,7 @@ void MindEvaluation::computeMergeWeights()
 
     for (const auto &user : users) {
         QList<NodeMatrixInfo *> nmInfos;
-        if (NodeMatrixService().QueryNodeMatrixListByExpertIdAndEngineerId2(&nmInfos, user->id, enjId, m_tableType)) {
+        if (!NodeMatrixService().QueryNodeMatrixListByExpertIdAndEngineerId(&nmInfos, user->id, enjId, m_tableType)) {
             qDeleteAll(users);
             QMessageBox::warning(nullptr, "警告", "数据库访问失败");
             return;

+ 2 - 2
QFD/dbService/NodeMatrixService.cpp

@@ -347,7 +347,7 @@ bool NodeMatrixService::QueryNodeMatrixListByExpertIdAndEngineerId(QList<NodeMat
                                 .arg(QString::number(expertId))
                                 .arg(QString::number(engineerId))
                                 .arg(tableMsg);
-    // qDebug() << "selectSql=" << selectSql;
+    //    qDebug() << "selectSql=" << selectSql;
     if (query.exec(selectSql)) {
         while (query.next()) {
             if (query.isNull(0) == false) {
@@ -366,8 +366,8 @@ bool NodeMatrixService::QueryNodeMatrixListByExpertIdAndEngineerId(QList<NodeMat
                 nodeMatrixInfo->strUuid        = query.value(11).toString();
                 nodeMatrixInfoList->append(nodeMatrixInfo);
             }
-            ret = true;
         }
+        ret = true;
     } else {
         qDebug() << query.lastError();
     }

+ 6 - 9
QFD/widgets/DataCollectionWidget.cpp

@@ -289,26 +289,24 @@ void DataCollectionWidget::slotImportData(UserConfig *config)
     // 更新数据库
     if (NodeMatrixService().QueryNodeMatrixListByExpertIdAndEngineerId(QString::number(config->userId),
                                                                        config->engineerId, indexName)) {
-        NodeMatrixService().UpdateNodeMatrixNodeValueList(nodeMatrxInfoList);
-        qDebug() << __FUNCTION__ << __LINE__ << "import data update" << endl;
+        bool ret = NodeMatrixService().UpdateNodeMatrixNodeValueList(nodeMatrxInfoList);
+        qDebug() << __FUNCTION__ << __LINE__ << "import data update" << ret << endl;
     } else {
-        NodeMatrixService().AddNodeMatrixInfoList(nodeMatrxInfoList);
-        qDebug() << __FUNCTION__ << __LINE__ << "import data add" << endl;
+        bool ret = NodeMatrixService().AddNodeMatrixInfoList(nodeMatrxInfoList);
+        qDebug() << __FUNCTION__ << __LINE__ << "import data add" << ret << endl;
     }
 
     // 如果有专家信息更新用户
     if (userinfo) {
         xlsxR.selectSheet(str[size]);
         QFUser user;
-
         if (UserService().QueryUserInfoById(&user, xlsxR.cellAt(2, 1)->readValue().toInt())) {
             user.workPosition = xlsxR.cellAt(2, 3)->readValue().toString();
             user.post         = xlsxR.cellAt(2, 4)->readValue().toString();
             user.major        = xlsxR.cellAt(2, 5)->readValue().toString();
             user.phone        = xlsxR.cellAt(2, 6)->readValue().toString();
             user.writeTime    = xlsxR.cellAt(2, 7)->readValue().toString();
-            user.remark       = xlsxR.cellAt(2, 8)->readValue().toString();
-
+            user.remark = xlsxR.cellAt(2, 8)->readValue().isNull() ? "" : xlsxR.cellAt(2, 8)->readValue().toString();
             UserService().UpdateUserInfo(user);
         }
     }
@@ -318,11 +316,10 @@ void DataCollectionWidget::slotImportData(UserConfig *config)
 
 void DataCollectionWidget::slotConfigSelected(UserConfig *config)
 {
-
     DataTableWidget *table = (DataTableWidget *)m_tab->currentWidget();
     QString indexName      = ProjectManager::nameOfIndexType((ProjectManager::IndexType)table->process().indexType);
 
-    MindEvaluation *eval = new MindEvaluation(table->mind1(), MindEvaluation::Merge, indexName,
+    MindEvaluation *eval = new MindEvaluation(table->mind1(), MindEvaluation::NoMerge, indexName,
                                               table->process().dSource == SchemePlanManager::FromExpert);
     eval->updateSeqNodes();
     eval->computeWeights();