diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 3bb55c3..76c04be 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -574,6 +574,6 @@ Version - 22 + 22 diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 3bb55c3..76c04be 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -574,6 +574,6 @@ Version - 22 + 22 diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 deleted file mode 100644 index f11db66..0000000 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - EnvironmentId - {c08df58c-84a7-4965-bca6-e98789474efa} - - - ProjectExplorer.Project.ActiveTarget - 1 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - -fno-delayed-template-parsing - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.14.2 MinGW 32-bit - Desktop Qt 5.14.2 MinGW 32-bit - qt.qt5.5142.win32_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop Qt 5.14.2 MinGW 64-bit - Desktop Qt 5.14.2 MinGW 64-bit - qt.qt5.5142.win64_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 2 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 3bb55c3..76c04be 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -574,6 +574,6 @@ Version - 22 + 22 diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 deleted file mode 100644 index f11db66..0000000 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - EnvironmentId - {c08df58c-84a7-4965-bca6-e98789474efa} - - - ProjectExplorer.Project.ActiveTarget - 1 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - -fno-delayed-template-parsing - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.14.2 MinGW 32-bit - Desktop Qt 5.14.2 MinGW 32-bit - qt.qt5.5142.win32_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop Qt 5.14.2 MinGW 64-bit - Desktop Qt 5.14.2 MinGW 64-bit - qt.qt5.5142.win64_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 2 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/softwareDirectory/AutoVerScheme/InfoBase.h b/softwareDirectory/AutoVerScheme/InfoBase.h index 82db20e..6dd59f3 100644 --- a/softwareDirectory/AutoVerScheme/InfoBase.h +++ b/softwareDirectory/AutoVerScheme/InfoBase.h @@ -15,6 +15,8 @@ virtual void Load()=0; //QStandardItemModel 的实例。这个模型将用于存储和管理数据。 QStandardItemModel *model; + //信息管理页面 基类定义Conn对象 + DatabaseConnection *Conn=DatabaseConnection::getInstance(); }; #endif // INFOBASE_H diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 3bb55c3..76c04be 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -574,6 +574,6 @@ Version - 22 + 22 diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 deleted file mode 100644 index f11db66..0000000 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - EnvironmentId - {c08df58c-84a7-4965-bca6-e98789474efa} - - - ProjectExplorer.Project.ActiveTarget - 1 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - -fno-delayed-template-parsing - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.14.2 MinGW 32-bit - Desktop Qt 5.14.2 MinGW 32-bit - qt.qt5.5142.win32_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop Qt 5.14.2 MinGW 64-bit - Desktop Qt 5.14.2 MinGW 64-bit - qt.qt5.5142.win64_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 2 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/softwareDirectory/AutoVerScheme/InfoBase.h b/softwareDirectory/AutoVerScheme/InfoBase.h index 82db20e..6dd59f3 100644 --- a/softwareDirectory/AutoVerScheme/InfoBase.h +++ b/softwareDirectory/AutoVerScheme/InfoBase.h @@ -15,6 +15,8 @@ virtual void Load()=0; //QStandardItemModel 的实例。这个模型将用于存储和管理数据。 QStandardItemModel *model; + //信息管理页面 基类定义Conn对象 + DatabaseConnection *Conn=DatabaseConnection::getInstance(); }; #endif // INFOBASE_H diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp index ffb2bbc..d491a6c 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp @@ -1,7 +1,9 @@ #include "beexamined_deviceitem.h" #include "ui_beexamined_deviceitem.h" #include "QMessageBox.h" +#include "tested_device_manage_serve.h" +//被检设备 BeExamined_DeviceItem::BeExamined_DeviceItem(QWidget *parent) : InfoBase(parent), ui(new Ui::BeExamined_DeviceItem) @@ -27,13 +29,13 @@ "background-color:white;" "}"); - ui->tableWidget->setRowCount(10); // 设置10行 + // ui->tableWidget->setRowCount(10); // 设置10行 ui->tableWidget->setColumnCount(12); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + // item->setTextAlignment(Qt::AlignCenter); + //ui->tableWidget->setItem(0, 0, item); //设置数据 //初始化TableWidget 设置列 QStringList headers; @@ -60,5 +62,59 @@ } void BeExamined_DeviceItem::Load() { - //ShowMessageBox("被检设备","被检设备初始化完成"); + //获取主页面内容 + //进入主页面 + /* + ui->stackedWidget->setCurrentIndex(0); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + + // 创建数据库管理器对象 + //BizDeviceManage包含虚方法 指针实例化 + BeExamined_DeviceItem dbManager; + // 调用数据库管理器的函数获取数据 + int rowCount=0; + int row=0; + QList data = dbManager.getBizDeviceManage(); + + + for (const BizDevice& bizDevice : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(bizDevice.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(QString::number(row+1))); + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(bizDevice.equipment_name)); + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(bizDevice.model)); + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(bizDevice.manufacture_no)); + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(bizDevice.manufacturer)); + //添加操作按钮 + QPushButton *button = new QPushButton("查看"); + ui->tableWidget->setCellWidget(row, 6, button); + //设置按钮简单样式 + button->setStyleSheet("QPushButton {" + " border: none; /* 无边框 "*/ + // " color: green; /* 文本颜色 */" + // " text-decoration: underline; /* 文本下划线 */" + // "}"); + + // 设置鼠标悬停时的光标样式为小手图标 + // button->setCursor(Qt::PointingHandCursor); + // 连接按钮的 clicked 信号到自定义槽函数 + // connect(button, &QPushButton::clicked, this, [this, button, row]() { + // 获取当前行第一列的 ID + // QTableWidgetItem *idItem = this->ui->tableWidget->item(row, 0); + // if (idItem) { + // QString id = idItem->text(); +// + // OnButtonSelectClicked(id); + // } + + // }); + + // row++; + + // } + } diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 3bb55c3..76c04be 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -574,6 +574,6 @@ Version - 22 + 22 diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 deleted file mode 100644 index f11db66..0000000 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - EnvironmentId - {c08df58c-84a7-4965-bca6-e98789474efa} - - - ProjectExplorer.Project.ActiveTarget - 1 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - -fno-delayed-template-parsing - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.14.2 MinGW 32-bit - Desktop Qt 5.14.2 MinGW 32-bit - qt.qt5.5142.win32_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop Qt 5.14.2 MinGW 64-bit - Desktop Qt 5.14.2 MinGW 64-bit - qt.qt5.5142.win64_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 2 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/softwareDirectory/AutoVerScheme/InfoBase.h b/softwareDirectory/AutoVerScheme/InfoBase.h index 82db20e..6dd59f3 100644 --- a/softwareDirectory/AutoVerScheme/InfoBase.h +++ b/softwareDirectory/AutoVerScheme/InfoBase.h @@ -15,6 +15,8 @@ virtual void Load()=0; //QStandardItemModel 的实例。这个模型将用于存储和管理数据。 QStandardItemModel *model; + //信息管理页面 基类定义Conn对象 + DatabaseConnection *Conn=DatabaseConnection::getInstance(); }; #endif // INFOBASE_H diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp index ffb2bbc..d491a6c 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp @@ -1,7 +1,9 @@ #include "beexamined_deviceitem.h" #include "ui_beexamined_deviceitem.h" #include "QMessageBox.h" +#include "tested_device_manage_serve.h" +//被检设备 BeExamined_DeviceItem::BeExamined_DeviceItem(QWidget *parent) : InfoBase(parent), ui(new Ui::BeExamined_DeviceItem) @@ -27,13 +29,13 @@ "background-color:white;" "}"); - ui->tableWidget->setRowCount(10); // 设置10行 + // ui->tableWidget->setRowCount(10); // 设置10行 ui->tableWidget->setColumnCount(12); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + // item->setTextAlignment(Qt::AlignCenter); + //ui->tableWidget->setItem(0, 0, item); //设置数据 //初始化TableWidget 设置列 QStringList headers; @@ -60,5 +62,59 @@ } void BeExamined_DeviceItem::Load() { - //ShowMessageBox("被检设备","被检设备初始化完成"); + //获取主页面内容 + //进入主页面 + /* + ui->stackedWidget->setCurrentIndex(0); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + + // 创建数据库管理器对象 + //BizDeviceManage包含虚方法 指针实例化 + BeExamined_DeviceItem dbManager; + // 调用数据库管理器的函数获取数据 + int rowCount=0; + int row=0; + QList data = dbManager.getBizDeviceManage(); + + + for (const BizDevice& bizDevice : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(bizDevice.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(QString::number(row+1))); + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(bizDevice.equipment_name)); + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(bizDevice.model)); + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(bizDevice.manufacture_no)); + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(bizDevice.manufacturer)); + //添加操作按钮 + QPushButton *button = new QPushButton("查看"); + ui->tableWidget->setCellWidget(row, 6, button); + //设置按钮简单样式 + button->setStyleSheet("QPushButton {" + " border: none; /* 无边框 "*/ + // " color: green; /* 文本颜色 */" + // " text-decoration: underline; /* 文本下划线 */" + // "}"); + + // 设置鼠标悬停时的光标样式为小手图标 + // button->setCursor(Qt::PointingHandCursor); + // 连接按钮的 clicked 信号到自定义槽函数 + // connect(button, &QPushButton::clicked, this, [this, button, row]() { + // 获取当前行第一列的 ID + // QTableWidgetItem *idItem = this->ui->tableWidget->item(row, 0); + // if (idItem) { + // QString id = idItem->text(); +// + // OnButtonSelectClicked(id); + // } + + // }); + + // row++; + + // } + } diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h index ae46979..ffdc22a 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h @@ -7,7 +7,7 @@ namespace Ui { class BeExamined_DeviceItem; } - +//被检设备管理界面 class BeExamined_DeviceItem : public InfoBase { Q_OBJECT @@ -21,6 +21,7 @@ void ShowMessageBox(QString title,QString value); //继承父类的Load方法 void Load() override; + private: Ui::BeExamined_DeviceItem *ui; }; diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 3bb55c3..76c04be 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -574,6 +574,6 @@ Version - 22 + 22 diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 deleted file mode 100644 index f11db66..0000000 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - EnvironmentId - {c08df58c-84a7-4965-bca6-e98789474efa} - - - ProjectExplorer.Project.ActiveTarget - 1 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - -fno-delayed-template-parsing - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.14.2 MinGW 32-bit - Desktop Qt 5.14.2 MinGW 32-bit - qt.qt5.5142.win32_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop Qt 5.14.2 MinGW 64-bit - Desktop Qt 5.14.2 MinGW 64-bit - qt.qt5.5142.win64_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 2 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/softwareDirectory/AutoVerScheme/InfoBase.h b/softwareDirectory/AutoVerScheme/InfoBase.h index 82db20e..6dd59f3 100644 --- a/softwareDirectory/AutoVerScheme/InfoBase.h +++ b/softwareDirectory/AutoVerScheme/InfoBase.h @@ -15,6 +15,8 @@ virtual void Load()=0; //QStandardItemModel 的实例。这个模型将用于存储和管理数据。 QStandardItemModel *model; + //信息管理页面 基类定义Conn对象 + DatabaseConnection *Conn=DatabaseConnection::getInstance(); }; #endif // INFOBASE_H diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp index ffb2bbc..d491a6c 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp @@ -1,7 +1,9 @@ #include "beexamined_deviceitem.h" #include "ui_beexamined_deviceitem.h" #include "QMessageBox.h" +#include "tested_device_manage_serve.h" +//被检设备 BeExamined_DeviceItem::BeExamined_DeviceItem(QWidget *parent) : InfoBase(parent), ui(new Ui::BeExamined_DeviceItem) @@ -27,13 +29,13 @@ "background-color:white;" "}"); - ui->tableWidget->setRowCount(10); // 设置10行 + // ui->tableWidget->setRowCount(10); // 设置10行 ui->tableWidget->setColumnCount(12); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + // item->setTextAlignment(Qt::AlignCenter); + //ui->tableWidget->setItem(0, 0, item); //设置数据 //初始化TableWidget 设置列 QStringList headers; @@ -60,5 +62,59 @@ } void BeExamined_DeviceItem::Load() { - //ShowMessageBox("被检设备","被检设备初始化完成"); + //获取主页面内容 + //进入主页面 + /* + ui->stackedWidget->setCurrentIndex(0); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + + // 创建数据库管理器对象 + //BizDeviceManage包含虚方法 指针实例化 + BeExamined_DeviceItem dbManager; + // 调用数据库管理器的函数获取数据 + int rowCount=0; + int row=0; + QList data = dbManager.getBizDeviceManage(); + + + for (const BizDevice& bizDevice : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(bizDevice.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(QString::number(row+1))); + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(bizDevice.equipment_name)); + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(bizDevice.model)); + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(bizDevice.manufacture_no)); + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(bizDevice.manufacturer)); + //添加操作按钮 + QPushButton *button = new QPushButton("查看"); + ui->tableWidget->setCellWidget(row, 6, button); + //设置按钮简单样式 + button->setStyleSheet("QPushButton {" + " border: none; /* 无边框 "*/ + // " color: green; /* 文本颜色 */" + // " text-decoration: underline; /* 文本下划线 */" + // "}"); + + // 设置鼠标悬停时的光标样式为小手图标 + // button->setCursor(Qt::PointingHandCursor); + // 连接按钮的 clicked 信号到自定义槽函数 + // connect(button, &QPushButton::clicked, this, [this, button, row]() { + // 获取当前行第一列的 ID + // QTableWidgetItem *idItem = this->ui->tableWidget->item(row, 0); + // if (idItem) { + // QString id = idItem->text(); +// + // OnButtonSelectClicked(id); + // } + + // }); + + // row++; + + // } + } diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h index ae46979..ffdc22a 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h @@ -7,7 +7,7 @@ namespace Ui { class BeExamined_DeviceItem; } - +//被检设备管理界面 class BeExamined_DeviceItem : public InfoBase { Q_OBJECT @@ -21,6 +21,7 @@ void ShowMessageBox(QString title,QString value); //继承父类的Load方法 void Load() override; + private: Ui::BeExamined_DeviceItem *ui; }; diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui index 5a0a3c9..ce63879 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui @@ -6,233 +6,959 @@ 0 0 - 1291 - 575 + 1432 + 571 Form - + + + 0 + + + 0 + + + 0 + + + 0 + - - - - 0 - 0 - - + - background-color:white; + - - + + 0 - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 设备名称: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 型号规则: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 出厂编号: - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 生产厂家: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用部门: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用单位: - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - Qt::RightToLeft - - - 查询 - - - - - - - Qt::RightToLeft - - - 重置 - - - - - - - - - - background-color:white; - - - - - - - - - - - - - - - - + + + + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 设备名称: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 型号规则: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 出厂编号: + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 生产厂家: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 使用单位: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::RightToLeft + + + 查询 + + + + + + + Qt::RightToLeft + + + 重置 + + + + + + + + + + background-color:white; + + + + + + + + + + + + + + + + + + + + + + + color:black; + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 20 + + + + + + + + Qt::Horizontal + + + + 60 + 20 + + + + + + + + Font-size:25px; + + + 查看设备信息 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 30 + 30 + + + + Qt::RightToLeft + + + background-color:grey; +color:white; + + + 返回 + + + + + + + + + + background-color:white; + + + + + + + + + background-color:white; + + + + + + + + + 设备基本信息: + + + + + + + 设备名称: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 型号规格: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 出厂编号: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定有效期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产国家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产厂家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 购进日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用年限: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备单价: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用状态: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 质量状况: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 所属部门: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 负责人: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备供方: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 位置信息: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 标准类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备分类: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 重要等级: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定周期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 对应开箱记录: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 备注: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + 2 + + + false + + + Qt::LogicalMoveStyle + + + + + + + + + + + + + + + + 核查项目及核查点: + + + + + + + + + + + + + + 0 + 0 + + + + + 30 + 0 + + + + + + + + + + false + + + + 6 + + + 0 + + + 0 + + + 0 + + + 6 + + + + + 检定项备注: + + + + + + + background-color: #f0f0f0; +color: grey; + + + + + + + + + + + diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 3bb55c3..76c04be 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -574,6 +574,6 @@ Version - 22 + 22 diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 deleted file mode 100644 index f11db66..0000000 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - EnvironmentId - {c08df58c-84a7-4965-bca6-e98789474efa} - - - ProjectExplorer.Project.ActiveTarget - 1 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - -fno-delayed-template-parsing - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.14.2 MinGW 32-bit - Desktop Qt 5.14.2 MinGW 32-bit - qt.qt5.5142.win32_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop Qt 5.14.2 MinGW 64-bit - Desktop Qt 5.14.2 MinGW 64-bit - qt.qt5.5142.win64_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 2 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/softwareDirectory/AutoVerScheme/InfoBase.h b/softwareDirectory/AutoVerScheme/InfoBase.h index 82db20e..6dd59f3 100644 --- a/softwareDirectory/AutoVerScheme/InfoBase.h +++ b/softwareDirectory/AutoVerScheme/InfoBase.h @@ -15,6 +15,8 @@ virtual void Load()=0; //QStandardItemModel 的实例。这个模型将用于存储和管理数据。 QStandardItemModel *model; + //信息管理页面 基类定义Conn对象 + DatabaseConnection *Conn=DatabaseConnection::getInstance(); }; #endif // INFOBASE_H diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp index ffb2bbc..d491a6c 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp @@ -1,7 +1,9 @@ #include "beexamined_deviceitem.h" #include "ui_beexamined_deviceitem.h" #include "QMessageBox.h" +#include "tested_device_manage_serve.h" +//被检设备 BeExamined_DeviceItem::BeExamined_DeviceItem(QWidget *parent) : InfoBase(parent), ui(new Ui::BeExamined_DeviceItem) @@ -27,13 +29,13 @@ "background-color:white;" "}"); - ui->tableWidget->setRowCount(10); // 设置10行 + // ui->tableWidget->setRowCount(10); // 设置10行 ui->tableWidget->setColumnCount(12); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + // item->setTextAlignment(Qt::AlignCenter); + //ui->tableWidget->setItem(0, 0, item); //设置数据 //初始化TableWidget 设置列 QStringList headers; @@ -60,5 +62,59 @@ } void BeExamined_DeviceItem::Load() { - //ShowMessageBox("被检设备","被检设备初始化完成"); + //获取主页面内容 + //进入主页面 + /* + ui->stackedWidget->setCurrentIndex(0); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + + // 创建数据库管理器对象 + //BizDeviceManage包含虚方法 指针实例化 + BeExamined_DeviceItem dbManager; + // 调用数据库管理器的函数获取数据 + int rowCount=0; + int row=0; + QList data = dbManager.getBizDeviceManage(); + + + for (const BizDevice& bizDevice : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(bizDevice.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(QString::number(row+1))); + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(bizDevice.equipment_name)); + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(bizDevice.model)); + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(bizDevice.manufacture_no)); + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(bizDevice.manufacturer)); + //添加操作按钮 + QPushButton *button = new QPushButton("查看"); + ui->tableWidget->setCellWidget(row, 6, button); + //设置按钮简单样式 + button->setStyleSheet("QPushButton {" + " border: none; /* 无边框 "*/ + // " color: green; /* 文本颜色 */" + // " text-decoration: underline; /* 文本下划线 */" + // "}"); + + // 设置鼠标悬停时的光标样式为小手图标 + // button->setCursor(Qt::PointingHandCursor); + // 连接按钮的 clicked 信号到自定义槽函数 + // connect(button, &QPushButton::clicked, this, [this, button, row]() { + // 获取当前行第一列的 ID + // QTableWidgetItem *idItem = this->ui->tableWidget->item(row, 0); + // if (idItem) { + // QString id = idItem->text(); +// + // OnButtonSelectClicked(id); + // } + + // }); + + // row++; + + // } + } diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h index ae46979..ffdc22a 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h @@ -7,7 +7,7 @@ namespace Ui { class BeExamined_DeviceItem; } - +//被检设备管理界面 class BeExamined_DeviceItem : public InfoBase { Q_OBJECT @@ -21,6 +21,7 @@ void ShowMessageBox(QString title,QString value); //继承父类的Load方法 void Load() override; + private: Ui::BeExamined_DeviceItem *ui; }; diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui index 5a0a3c9..ce63879 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui @@ -6,233 +6,959 @@ 0 0 - 1291 - 575 + 1432 + 571 Form - + + + 0 + + + 0 + + + 0 + + + 0 + - - - - 0 - 0 - - + - background-color:white; + - - + + 0 - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 设备名称: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 型号规则: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 出厂编号: - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 生产厂家: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用部门: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用单位: - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - Qt::RightToLeft - - - 查询 - - - - - - - Qt::RightToLeft - - - 重置 - - - - - - - - - - background-color:white; - - - - - - - - - - - - - - - - + + + + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 设备名称: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 型号规则: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 出厂编号: + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 生产厂家: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 使用单位: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::RightToLeft + + + 查询 + + + + + + + Qt::RightToLeft + + + 重置 + + + + + + + + + + background-color:white; + + + + + + + + + + + + + + + + + + + + + + + color:black; + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 20 + + + + + + + + Qt::Horizontal + + + + 60 + 20 + + + + + + + + Font-size:25px; + + + 查看设备信息 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 30 + 30 + + + + Qt::RightToLeft + + + background-color:grey; +color:white; + + + 返回 + + + + + + + + + + background-color:white; + + + + + + + + + background-color:white; + + + + + + + + + 设备基本信息: + + + + + + + 设备名称: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 型号规格: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 出厂编号: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定有效期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产国家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产厂家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 购进日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用年限: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备单价: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用状态: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 质量状况: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 所属部门: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 负责人: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备供方: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 位置信息: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 标准类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备分类: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 重要等级: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定周期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 对应开箱记录: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 备注: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + 2 + + + false + + + Qt::LogicalMoveStyle + + + + + + + + + + + + + + + + 核查项目及核查点: + + + + + + + + + + + + + + 0 + 0 + + + + + 30 + 0 + + + + + + + + + + false + + + + 6 + + + 0 + + + 0 + + + 0 + + + 6 + + + + + 检定项备注: + + + + + + + background-color: #f0f0f0; +color: grey; + + + + + + + + + + + diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp index 60486b4..f3b11e5 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp @@ -4,12 +4,17 @@ { } +BizDeviceManage::~BizDeviceManage() +{ + +} QListBizDeviceManage::getBizDeviceManage() { QList result; QSqlQuery query; - query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer FROM biz_equipment_info bei"); - if (query.exec()) { + bool IsSucc= query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer" + " FROM biz_equipment_info bei"); + if (IsSucc) { while (query.next()) { BizDevice device; device.id = query.value("id").toString(); @@ -28,18 +33,21 @@ QListBizDeviceManage::getCatDeviceInfor(QString id) { QList result; + + QSqlQuery query; - query.exec("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," + + query.prepare("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," "bei.product_country , bei.manufacturer , bei.produce_date, bei.purchase_date ,bei.unit_price , bei.usage_status , bei.quality_status , " "bei.dept_name , bei.director_name , bei.supplier_name , bei.location , bei.type , bei.standard_type , bei.category , bei.level , " "bei.measure_cycle , bei.unpack_record_name , bei.remark FROM biz_equipment_info bei WHERE bei.id = :id"); - // 将参数绑定到占位符 + //将参数绑定到占位符 query.bindValue(":id", id); if (query.exec()) { while (query.next()) { CatDeviceInfor device; - device.equipment_name = query.value("equipment_name").toString(); - device.model = query.value("model").toString(); + device.equipment_name = query.value("equipment_name").toString(); + device.model = query.value("model").toString(); device.manufacture_no = query.value("manufacture_no").toString(); device.measure_valid_date = query.value("measure_valid_date").toString(); device.product_country = query.value("product_country").toString(); @@ -73,13 +81,15 @@ - //直流稳压电源检定装置 -QListBizDeviceManage::getCheckDCPower(QString item_category_id) +//直流稳压电源检定装置 +QListBizDeviceManage::getCheckDCPower(QString item_category_id,QStringList *headList) { + item_category_id="直流稳压电源检定装置";//为获得测试数据 QList result; QSqlQuery query; - query.exec("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" - ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id))"); + query.prepare("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" + ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp " + "WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id)"); // 将参数绑定到占位符 query.bindValue(":item_category_id", item_category_id); if (query.exec()) { @@ -99,19 +109,24 @@ checkDCPower.remark = query.value("remark").toString(); result.append(checkDCPower); + } + } else { qDebug() << "Query execution failed: " << query.lastError().text(); } + *headList << "序号" << "核查类型" << "参数"<< "单位" + << "基准点" << "分辨率" << "循环次数" << "Urel" + << "电阻值" << "电阻值单位"; return result; } //根据id获取装置名称 -QString BizDeviceManage::getApparatus(QString id) const +QString BizDeviceManage::getApparatus(QString id) { QString result; QSqlQuery query; - query.exec("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " + query.prepare("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " "SELECT bei.meter_standard_id FROM biz_equipment_info bei WHERE bei.id = :id )"); // 将参数绑定到占位符 query.bindValue(":id", id); @@ -124,4 +139,5 @@ result = "Not Found"; } return result; + //if(result=="直流稳压电源检定装置")//根据判断进入不同的函数 } diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 3bb55c3..76c04be 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -574,6 +574,6 @@ Version - 22 + 22 diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 deleted file mode 100644 index f11db66..0000000 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - EnvironmentId - {c08df58c-84a7-4965-bca6-e98789474efa} - - - ProjectExplorer.Project.ActiveTarget - 1 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - -fno-delayed-template-parsing - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.14.2 MinGW 32-bit - Desktop Qt 5.14.2 MinGW 32-bit - qt.qt5.5142.win32_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop Qt 5.14.2 MinGW 64-bit - Desktop Qt 5.14.2 MinGW 64-bit - qt.qt5.5142.win64_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 2 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/softwareDirectory/AutoVerScheme/InfoBase.h b/softwareDirectory/AutoVerScheme/InfoBase.h index 82db20e..6dd59f3 100644 --- a/softwareDirectory/AutoVerScheme/InfoBase.h +++ b/softwareDirectory/AutoVerScheme/InfoBase.h @@ -15,6 +15,8 @@ virtual void Load()=0; //QStandardItemModel 的实例。这个模型将用于存储和管理数据。 QStandardItemModel *model; + //信息管理页面 基类定义Conn对象 + DatabaseConnection *Conn=DatabaseConnection::getInstance(); }; #endif // INFOBASE_H diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp index ffb2bbc..d491a6c 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp @@ -1,7 +1,9 @@ #include "beexamined_deviceitem.h" #include "ui_beexamined_deviceitem.h" #include "QMessageBox.h" +#include "tested_device_manage_serve.h" +//被检设备 BeExamined_DeviceItem::BeExamined_DeviceItem(QWidget *parent) : InfoBase(parent), ui(new Ui::BeExamined_DeviceItem) @@ -27,13 +29,13 @@ "background-color:white;" "}"); - ui->tableWidget->setRowCount(10); // 设置10行 + // ui->tableWidget->setRowCount(10); // 设置10行 ui->tableWidget->setColumnCount(12); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + // item->setTextAlignment(Qt::AlignCenter); + //ui->tableWidget->setItem(0, 0, item); //设置数据 //初始化TableWidget 设置列 QStringList headers; @@ -60,5 +62,59 @@ } void BeExamined_DeviceItem::Load() { - //ShowMessageBox("被检设备","被检设备初始化完成"); + //获取主页面内容 + //进入主页面 + /* + ui->stackedWidget->setCurrentIndex(0); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + + // 创建数据库管理器对象 + //BizDeviceManage包含虚方法 指针实例化 + BeExamined_DeviceItem dbManager; + // 调用数据库管理器的函数获取数据 + int rowCount=0; + int row=0; + QList data = dbManager.getBizDeviceManage(); + + + for (const BizDevice& bizDevice : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(bizDevice.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(QString::number(row+1))); + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(bizDevice.equipment_name)); + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(bizDevice.model)); + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(bizDevice.manufacture_no)); + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(bizDevice.manufacturer)); + //添加操作按钮 + QPushButton *button = new QPushButton("查看"); + ui->tableWidget->setCellWidget(row, 6, button); + //设置按钮简单样式 + button->setStyleSheet("QPushButton {" + " border: none; /* 无边框 "*/ + // " color: green; /* 文本颜色 */" + // " text-decoration: underline; /* 文本下划线 */" + // "}"); + + // 设置鼠标悬停时的光标样式为小手图标 + // button->setCursor(Qt::PointingHandCursor); + // 连接按钮的 clicked 信号到自定义槽函数 + // connect(button, &QPushButton::clicked, this, [this, button, row]() { + // 获取当前行第一列的 ID + // QTableWidgetItem *idItem = this->ui->tableWidget->item(row, 0); + // if (idItem) { + // QString id = idItem->text(); +// + // OnButtonSelectClicked(id); + // } + + // }); + + // row++; + + // } + } diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h index ae46979..ffdc22a 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h @@ -7,7 +7,7 @@ namespace Ui { class BeExamined_DeviceItem; } - +//被检设备管理界面 class BeExamined_DeviceItem : public InfoBase { Q_OBJECT @@ -21,6 +21,7 @@ void ShowMessageBox(QString title,QString value); //继承父类的Load方法 void Load() override; + private: Ui::BeExamined_DeviceItem *ui; }; diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui index 5a0a3c9..ce63879 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui @@ -6,233 +6,959 @@ 0 0 - 1291 - 575 + 1432 + 571 Form - + + + 0 + + + 0 + + + 0 + + + 0 + - - - - 0 - 0 - - + - background-color:white; + - - + + 0 - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 设备名称: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 型号规则: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 出厂编号: - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 生产厂家: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用部门: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用单位: - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - Qt::RightToLeft - - - 查询 - - - - - - - Qt::RightToLeft - - - 重置 - - - - - - - - - - background-color:white; - - - - - - - - - - - - - - - - + + + + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 设备名称: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 型号规则: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 出厂编号: + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 生产厂家: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 使用单位: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::RightToLeft + + + 查询 + + + + + + + Qt::RightToLeft + + + 重置 + + + + + + + + + + background-color:white; + + + + + + + + + + + + + + + + + + + + + + + color:black; + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 20 + + + + + + + + Qt::Horizontal + + + + 60 + 20 + + + + + + + + Font-size:25px; + + + 查看设备信息 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 30 + 30 + + + + Qt::RightToLeft + + + background-color:grey; +color:white; + + + 返回 + + + + + + + + + + background-color:white; + + + + + + + + + background-color:white; + + + + + + + + + 设备基本信息: + + + + + + + 设备名称: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 型号规格: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 出厂编号: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定有效期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产国家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产厂家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 购进日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用年限: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备单价: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用状态: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 质量状况: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 所属部门: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 负责人: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备供方: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 位置信息: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 标准类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备分类: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 重要等级: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定周期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 对应开箱记录: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 备注: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + 2 + + + false + + + Qt::LogicalMoveStyle + + + + + + + + + + + + + + + + 核查项目及核查点: + + + + + + + + + + + + + + 0 + 0 + + + + + 30 + 0 + + + + + + + + + + false + + + + 6 + + + 0 + + + 0 + + + 0 + + + 6 + + + + + 检定项备注: + + + + + + + background-color: #f0f0f0; +color: grey; + + + + + + + + + + + diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp index 60486b4..f3b11e5 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp @@ -4,12 +4,17 @@ { } +BizDeviceManage::~BizDeviceManage() +{ + +} QListBizDeviceManage::getBizDeviceManage() { QList result; QSqlQuery query; - query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer FROM biz_equipment_info bei"); - if (query.exec()) { + bool IsSucc= query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer" + " FROM biz_equipment_info bei"); + if (IsSucc) { while (query.next()) { BizDevice device; device.id = query.value("id").toString(); @@ -28,18 +33,21 @@ QListBizDeviceManage::getCatDeviceInfor(QString id) { QList result; + + QSqlQuery query; - query.exec("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," + + query.prepare("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," "bei.product_country , bei.manufacturer , bei.produce_date, bei.purchase_date ,bei.unit_price , bei.usage_status , bei.quality_status , " "bei.dept_name , bei.director_name , bei.supplier_name , bei.location , bei.type , bei.standard_type , bei.category , bei.level , " "bei.measure_cycle , bei.unpack_record_name , bei.remark FROM biz_equipment_info bei WHERE bei.id = :id"); - // 将参数绑定到占位符 + //将参数绑定到占位符 query.bindValue(":id", id); if (query.exec()) { while (query.next()) { CatDeviceInfor device; - device.equipment_name = query.value("equipment_name").toString(); - device.model = query.value("model").toString(); + device.equipment_name = query.value("equipment_name").toString(); + device.model = query.value("model").toString(); device.manufacture_no = query.value("manufacture_no").toString(); device.measure_valid_date = query.value("measure_valid_date").toString(); device.product_country = query.value("product_country").toString(); @@ -73,13 +81,15 @@ - //直流稳压电源检定装置 -QListBizDeviceManage::getCheckDCPower(QString item_category_id) +//直流稳压电源检定装置 +QListBizDeviceManage::getCheckDCPower(QString item_category_id,QStringList *headList) { + item_category_id="直流稳压电源检定装置";//为获得测试数据 QList result; QSqlQuery query; - query.exec("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" - ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id))"); + query.prepare("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" + ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp " + "WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id)"); // 将参数绑定到占位符 query.bindValue(":item_category_id", item_category_id); if (query.exec()) { @@ -99,19 +109,24 @@ checkDCPower.remark = query.value("remark").toString(); result.append(checkDCPower); + } + } else { qDebug() << "Query execution failed: " << query.lastError().text(); } + *headList << "序号" << "核查类型" << "参数"<< "单位" + << "基准点" << "分辨率" << "循环次数" << "Urel" + << "电阻值" << "电阻值单位"; return result; } //根据id获取装置名称 -QString BizDeviceManage::getApparatus(QString id) const +QString BizDeviceManage::getApparatus(QString id) { QString result; QSqlQuery query; - query.exec("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " + query.prepare("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " "SELECT bei.meter_standard_id FROM biz_equipment_info bei WHERE bei.id = :id )"); // 将参数绑定到占位符 query.bindValue(":id", id); @@ -124,4 +139,5 @@ result = "Not Found"; } return result; + //if(result=="直流稳压电源检定装置")//根据判断进入不同的函数 } diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h index 6c95bed..71d7437 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h @@ -5,6 +5,8 @@ #include #include #include "QList" + +//OStringList //标准设备管理 class BizDevice { @@ -65,10 +67,11 @@ { public: BizDeviceManage(); + ~BizDeviceManage(); QListgetBizDeviceManage(); QListgetCatDeviceInfor(QString id); - virtual QString getApparatus(QString id) const = 0; - QListgetCheckDCPower(QString item_category_id); + QString getApparatus(QString id); + QListgetCheckDCPower(QString item_category_id,QStringList *headList); }; #endif // BIZDEVICEMANAGE_H diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 3bb55c3..76c04be 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -574,6 +574,6 @@ Version - 22 + 22 diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 deleted file mode 100644 index f11db66..0000000 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - EnvironmentId - {c08df58c-84a7-4965-bca6-e98789474efa} - - - ProjectExplorer.Project.ActiveTarget - 1 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - -fno-delayed-template-parsing - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.14.2 MinGW 32-bit - Desktop Qt 5.14.2 MinGW 32-bit - qt.qt5.5142.win32_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop Qt 5.14.2 MinGW 64-bit - Desktop Qt 5.14.2 MinGW 64-bit - qt.qt5.5142.win64_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 2 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/softwareDirectory/AutoVerScheme/InfoBase.h b/softwareDirectory/AutoVerScheme/InfoBase.h index 82db20e..6dd59f3 100644 --- a/softwareDirectory/AutoVerScheme/InfoBase.h +++ b/softwareDirectory/AutoVerScheme/InfoBase.h @@ -15,6 +15,8 @@ virtual void Load()=0; //QStandardItemModel 的实例。这个模型将用于存储和管理数据。 QStandardItemModel *model; + //信息管理页面 基类定义Conn对象 + DatabaseConnection *Conn=DatabaseConnection::getInstance(); }; #endif // INFOBASE_H diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp index ffb2bbc..d491a6c 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp @@ -1,7 +1,9 @@ #include "beexamined_deviceitem.h" #include "ui_beexamined_deviceitem.h" #include "QMessageBox.h" +#include "tested_device_manage_serve.h" +//被检设备 BeExamined_DeviceItem::BeExamined_DeviceItem(QWidget *parent) : InfoBase(parent), ui(new Ui::BeExamined_DeviceItem) @@ -27,13 +29,13 @@ "background-color:white;" "}"); - ui->tableWidget->setRowCount(10); // 设置10行 + // ui->tableWidget->setRowCount(10); // 设置10行 ui->tableWidget->setColumnCount(12); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + // item->setTextAlignment(Qt::AlignCenter); + //ui->tableWidget->setItem(0, 0, item); //设置数据 //初始化TableWidget 设置列 QStringList headers; @@ -60,5 +62,59 @@ } void BeExamined_DeviceItem::Load() { - //ShowMessageBox("被检设备","被检设备初始化完成"); + //获取主页面内容 + //进入主页面 + /* + ui->stackedWidget->setCurrentIndex(0); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + + // 创建数据库管理器对象 + //BizDeviceManage包含虚方法 指针实例化 + BeExamined_DeviceItem dbManager; + // 调用数据库管理器的函数获取数据 + int rowCount=0; + int row=0; + QList data = dbManager.getBizDeviceManage(); + + + for (const BizDevice& bizDevice : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(bizDevice.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(QString::number(row+1))); + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(bizDevice.equipment_name)); + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(bizDevice.model)); + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(bizDevice.manufacture_no)); + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(bizDevice.manufacturer)); + //添加操作按钮 + QPushButton *button = new QPushButton("查看"); + ui->tableWidget->setCellWidget(row, 6, button); + //设置按钮简单样式 + button->setStyleSheet("QPushButton {" + " border: none; /* 无边框 "*/ + // " color: green; /* 文本颜色 */" + // " text-decoration: underline; /* 文本下划线 */" + // "}"); + + // 设置鼠标悬停时的光标样式为小手图标 + // button->setCursor(Qt::PointingHandCursor); + // 连接按钮的 clicked 信号到自定义槽函数 + // connect(button, &QPushButton::clicked, this, [this, button, row]() { + // 获取当前行第一列的 ID + // QTableWidgetItem *idItem = this->ui->tableWidget->item(row, 0); + // if (idItem) { + // QString id = idItem->text(); +// + // OnButtonSelectClicked(id); + // } + + // }); + + // row++; + + // } + } diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h index ae46979..ffdc22a 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h @@ -7,7 +7,7 @@ namespace Ui { class BeExamined_DeviceItem; } - +//被检设备管理界面 class BeExamined_DeviceItem : public InfoBase { Q_OBJECT @@ -21,6 +21,7 @@ void ShowMessageBox(QString title,QString value); //继承父类的Load方法 void Load() override; + private: Ui::BeExamined_DeviceItem *ui; }; diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui index 5a0a3c9..ce63879 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui @@ -6,233 +6,959 @@ 0 0 - 1291 - 575 + 1432 + 571 Form - + + + 0 + + + 0 + + + 0 + + + 0 + - - - - 0 - 0 - - + - background-color:white; + - - + + 0 - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 设备名称: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 型号规则: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 出厂编号: - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 生产厂家: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用部门: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用单位: - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - Qt::RightToLeft - - - 查询 - - - - - - - Qt::RightToLeft - - - 重置 - - - - - - - - - - background-color:white; - - - - - - - - - - - - - - - - + + + + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 设备名称: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 型号规则: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 出厂编号: + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 生产厂家: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 使用单位: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::RightToLeft + + + 查询 + + + + + + + Qt::RightToLeft + + + 重置 + + + + + + + + + + background-color:white; + + + + + + + + + + + + + + + + + + + + + + + color:black; + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 20 + + + + + + + + Qt::Horizontal + + + + 60 + 20 + + + + + + + + Font-size:25px; + + + 查看设备信息 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 30 + 30 + + + + Qt::RightToLeft + + + background-color:grey; +color:white; + + + 返回 + + + + + + + + + + background-color:white; + + + + + + + + + background-color:white; + + + + + + + + + 设备基本信息: + + + + + + + 设备名称: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 型号规格: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 出厂编号: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定有效期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产国家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产厂家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 购进日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用年限: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备单价: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用状态: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 质量状况: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 所属部门: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 负责人: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备供方: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 位置信息: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 标准类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备分类: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 重要等级: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定周期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 对应开箱记录: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 备注: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + 2 + + + false + + + Qt::LogicalMoveStyle + + + + + + + + + + + + + + + + 核查项目及核查点: + + + + + + + + + + + + + + 0 + 0 + + + + + 30 + 0 + + + + + + + + + + false + + + + 6 + + + 0 + + + 0 + + + 0 + + + 6 + + + + + 检定项备注: + + + + + + + background-color: #f0f0f0; +color: grey; + + + + + + + + + + + diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp index 60486b4..f3b11e5 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp @@ -4,12 +4,17 @@ { } +BizDeviceManage::~BizDeviceManage() +{ + +} QListBizDeviceManage::getBizDeviceManage() { QList result; QSqlQuery query; - query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer FROM biz_equipment_info bei"); - if (query.exec()) { + bool IsSucc= query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer" + " FROM biz_equipment_info bei"); + if (IsSucc) { while (query.next()) { BizDevice device; device.id = query.value("id").toString(); @@ -28,18 +33,21 @@ QListBizDeviceManage::getCatDeviceInfor(QString id) { QList result; + + QSqlQuery query; - query.exec("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," + + query.prepare("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," "bei.product_country , bei.manufacturer , bei.produce_date, bei.purchase_date ,bei.unit_price , bei.usage_status , bei.quality_status , " "bei.dept_name , bei.director_name , bei.supplier_name , bei.location , bei.type , bei.standard_type , bei.category , bei.level , " "bei.measure_cycle , bei.unpack_record_name , bei.remark FROM biz_equipment_info bei WHERE bei.id = :id"); - // 将参数绑定到占位符 + //将参数绑定到占位符 query.bindValue(":id", id); if (query.exec()) { while (query.next()) { CatDeviceInfor device; - device.equipment_name = query.value("equipment_name").toString(); - device.model = query.value("model").toString(); + device.equipment_name = query.value("equipment_name").toString(); + device.model = query.value("model").toString(); device.manufacture_no = query.value("manufacture_no").toString(); device.measure_valid_date = query.value("measure_valid_date").toString(); device.product_country = query.value("product_country").toString(); @@ -73,13 +81,15 @@ - //直流稳压电源检定装置 -QListBizDeviceManage::getCheckDCPower(QString item_category_id) +//直流稳压电源检定装置 +QListBizDeviceManage::getCheckDCPower(QString item_category_id,QStringList *headList) { + item_category_id="直流稳压电源检定装置";//为获得测试数据 QList result; QSqlQuery query; - query.exec("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" - ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id))"); + query.prepare("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" + ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp " + "WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id)"); // 将参数绑定到占位符 query.bindValue(":item_category_id", item_category_id); if (query.exec()) { @@ -99,19 +109,24 @@ checkDCPower.remark = query.value("remark").toString(); result.append(checkDCPower); + } + } else { qDebug() << "Query execution failed: " << query.lastError().text(); } + *headList << "序号" << "核查类型" << "参数"<< "单位" + << "基准点" << "分辨率" << "循环次数" << "Urel" + << "电阻值" << "电阻值单位"; return result; } //根据id获取装置名称 -QString BizDeviceManage::getApparatus(QString id) const +QString BizDeviceManage::getApparatus(QString id) { QString result; QSqlQuery query; - query.exec("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " + query.prepare("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " "SELECT bei.meter_standard_id FROM biz_equipment_info bei WHERE bei.id = :id )"); // 将参数绑定到占位符 query.bindValue(":id", id); @@ -124,4 +139,5 @@ result = "Not Found"; } return result; + //if(result=="直流稳压电源检定装置")//根据判断进入不同的函数 } diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h index 6c95bed..71d7437 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h @@ -5,6 +5,8 @@ #include #include #include "QList" + +//OStringList //标准设备管理 class BizDevice { @@ -65,10 +67,11 @@ { public: BizDeviceManage(); + ~BizDeviceManage(); QListgetBizDeviceManage(); QListgetCatDeviceInfor(QString id); - virtual QString getApparatus(QString id) const = 0; - QListgetCheckDCPower(QString item_category_id); + QString getApparatus(QString id); + QListgetCheckDCPower(QString item_category_id,QStringList *headList); }; #endif // BIZDEVICEMANAGE_H diff --git a/softwareDirectory/AutoVerScheme/databaseconnection.cpp b/softwareDirectory/AutoVerScheme/databaseconnection.cpp index 64ed567..e74cf5e 100644 --- a/softwareDirectory/AutoVerScheme/databaseconnection.cpp +++ b/softwareDirectory/AutoVerScheme/databaseconnection.cpp @@ -24,6 +24,9 @@ bool DatabaseConnection::open() { return db.open(); } +bool DatabaseConnection::isopen() { + return db.isOpen(); +} void DatabaseConnection::close() { db.close(); diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 3bb55c3..76c04be 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -574,6 +574,6 @@ Version - 22 + 22 diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 deleted file mode 100644 index f11db66..0000000 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - EnvironmentId - {c08df58c-84a7-4965-bca6-e98789474efa} - - - ProjectExplorer.Project.ActiveTarget - 1 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - -fno-delayed-template-parsing - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.14.2 MinGW 32-bit - Desktop Qt 5.14.2 MinGW 32-bit - qt.qt5.5142.win32_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop Qt 5.14.2 MinGW 64-bit - Desktop Qt 5.14.2 MinGW 64-bit - qt.qt5.5142.win64_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 2 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/softwareDirectory/AutoVerScheme/InfoBase.h b/softwareDirectory/AutoVerScheme/InfoBase.h index 82db20e..6dd59f3 100644 --- a/softwareDirectory/AutoVerScheme/InfoBase.h +++ b/softwareDirectory/AutoVerScheme/InfoBase.h @@ -15,6 +15,8 @@ virtual void Load()=0; //QStandardItemModel 的实例。这个模型将用于存储和管理数据。 QStandardItemModel *model; + //信息管理页面 基类定义Conn对象 + DatabaseConnection *Conn=DatabaseConnection::getInstance(); }; #endif // INFOBASE_H diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp index ffb2bbc..d491a6c 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp @@ -1,7 +1,9 @@ #include "beexamined_deviceitem.h" #include "ui_beexamined_deviceitem.h" #include "QMessageBox.h" +#include "tested_device_manage_serve.h" +//被检设备 BeExamined_DeviceItem::BeExamined_DeviceItem(QWidget *parent) : InfoBase(parent), ui(new Ui::BeExamined_DeviceItem) @@ -27,13 +29,13 @@ "background-color:white;" "}"); - ui->tableWidget->setRowCount(10); // 设置10行 + // ui->tableWidget->setRowCount(10); // 设置10行 ui->tableWidget->setColumnCount(12); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + // item->setTextAlignment(Qt::AlignCenter); + //ui->tableWidget->setItem(0, 0, item); //设置数据 //初始化TableWidget 设置列 QStringList headers; @@ -60,5 +62,59 @@ } void BeExamined_DeviceItem::Load() { - //ShowMessageBox("被检设备","被检设备初始化完成"); + //获取主页面内容 + //进入主页面 + /* + ui->stackedWidget->setCurrentIndex(0); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + + // 创建数据库管理器对象 + //BizDeviceManage包含虚方法 指针实例化 + BeExamined_DeviceItem dbManager; + // 调用数据库管理器的函数获取数据 + int rowCount=0; + int row=0; + QList data = dbManager.getBizDeviceManage(); + + + for (const BizDevice& bizDevice : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(bizDevice.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(QString::number(row+1))); + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(bizDevice.equipment_name)); + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(bizDevice.model)); + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(bizDevice.manufacture_no)); + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(bizDevice.manufacturer)); + //添加操作按钮 + QPushButton *button = new QPushButton("查看"); + ui->tableWidget->setCellWidget(row, 6, button); + //设置按钮简单样式 + button->setStyleSheet("QPushButton {" + " border: none; /* 无边框 "*/ + // " color: green; /* 文本颜色 */" + // " text-decoration: underline; /* 文本下划线 */" + // "}"); + + // 设置鼠标悬停时的光标样式为小手图标 + // button->setCursor(Qt::PointingHandCursor); + // 连接按钮的 clicked 信号到自定义槽函数 + // connect(button, &QPushButton::clicked, this, [this, button, row]() { + // 获取当前行第一列的 ID + // QTableWidgetItem *idItem = this->ui->tableWidget->item(row, 0); + // if (idItem) { + // QString id = idItem->text(); +// + // OnButtonSelectClicked(id); + // } + + // }); + + // row++; + + // } + } diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h index ae46979..ffdc22a 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h @@ -7,7 +7,7 @@ namespace Ui { class BeExamined_DeviceItem; } - +//被检设备管理界面 class BeExamined_DeviceItem : public InfoBase { Q_OBJECT @@ -21,6 +21,7 @@ void ShowMessageBox(QString title,QString value); //继承父类的Load方法 void Load() override; + private: Ui::BeExamined_DeviceItem *ui; }; diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui index 5a0a3c9..ce63879 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui @@ -6,233 +6,959 @@ 0 0 - 1291 - 575 + 1432 + 571 Form - + + + 0 + + + 0 + + + 0 + + + 0 + - - - - 0 - 0 - - + - background-color:white; + - - + + 0 - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 设备名称: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 型号规则: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 出厂编号: - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 生产厂家: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用部门: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用单位: - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - Qt::RightToLeft - - - 查询 - - - - - - - Qt::RightToLeft - - - 重置 - - - - - - - - - - background-color:white; - - - - - - - - - - - - - - - - + + + + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 设备名称: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 型号规则: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 出厂编号: + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 生产厂家: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 使用单位: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::RightToLeft + + + 查询 + + + + + + + Qt::RightToLeft + + + 重置 + + + + + + + + + + background-color:white; + + + + + + + + + + + + + + + + + + + + + + + color:black; + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 20 + + + + + + + + Qt::Horizontal + + + + 60 + 20 + + + + + + + + Font-size:25px; + + + 查看设备信息 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 30 + 30 + + + + Qt::RightToLeft + + + background-color:grey; +color:white; + + + 返回 + + + + + + + + + + background-color:white; + + + + + + + + + background-color:white; + + + + + + + + + 设备基本信息: + + + + + + + 设备名称: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 型号规格: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 出厂编号: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定有效期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产国家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产厂家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 购进日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用年限: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备单价: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用状态: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 质量状况: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 所属部门: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 负责人: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备供方: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 位置信息: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 标准类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备分类: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 重要等级: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定周期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 对应开箱记录: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 备注: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + 2 + + + false + + + Qt::LogicalMoveStyle + + + + + + + + + + + + + + + + 核查项目及核查点: + + + + + + + + + + + + + + 0 + 0 + + + + + 30 + 0 + + + + + + + + + + false + + + + 6 + + + 0 + + + 0 + + + 0 + + + 6 + + + + + 检定项备注: + + + + + + + background-color: #f0f0f0; +color: grey; + + + + + + + + + + + diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp index 60486b4..f3b11e5 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp @@ -4,12 +4,17 @@ { } +BizDeviceManage::~BizDeviceManage() +{ + +} QListBizDeviceManage::getBizDeviceManage() { QList result; QSqlQuery query; - query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer FROM biz_equipment_info bei"); - if (query.exec()) { + bool IsSucc= query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer" + " FROM biz_equipment_info bei"); + if (IsSucc) { while (query.next()) { BizDevice device; device.id = query.value("id").toString(); @@ -28,18 +33,21 @@ QListBizDeviceManage::getCatDeviceInfor(QString id) { QList result; + + QSqlQuery query; - query.exec("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," + + query.prepare("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," "bei.product_country , bei.manufacturer , bei.produce_date, bei.purchase_date ,bei.unit_price , bei.usage_status , bei.quality_status , " "bei.dept_name , bei.director_name , bei.supplier_name , bei.location , bei.type , bei.standard_type , bei.category , bei.level , " "bei.measure_cycle , bei.unpack_record_name , bei.remark FROM biz_equipment_info bei WHERE bei.id = :id"); - // 将参数绑定到占位符 + //将参数绑定到占位符 query.bindValue(":id", id); if (query.exec()) { while (query.next()) { CatDeviceInfor device; - device.equipment_name = query.value("equipment_name").toString(); - device.model = query.value("model").toString(); + device.equipment_name = query.value("equipment_name").toString(); + device.model = query.value("model").toString(); device.manufacture_no = query.value("manufacture_no").toString(); device.measure_valid_date = query.value("measure_valid_date").toString(); device.product_country = query.value("product_country").toString(); @@ -73,13 +81,15 @@ - //直流稳压电源检定装置 -QListBizDeviceManage::getCheckDCPower(QString item_category_id) +//直流稳压电源检定装置 +QListBizDeviceManage::getCheckDCPower(QString item_category_id,QStringList *headList) { + item_category_id="直流稳压电源检定装置";//为获得测试数据 QList result; QSqlQuery query; - query.exec("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" - ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id))"); + query.prepare("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" + ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp " + "WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id)"); // 将参数绑定到占位符 query.bindValue(":item_category_id", item_category_id); if (query.exec()) { @@ -99,19 +109,24 @@ checkDCPower.remark = query.value("remark").toString(); result.append(checkDCPower); + } + } else { qDebug() << "Query execution failed: " << query.lastError().text(); } + *headList << "序号" << "核查类型" << "参数"<< "单位" + << "基准点" << "分辨率" << "循环次数" << "Urel" + << "电阻值" << "电阻值单位"; return result; } //根据id获取装置名称 -QString BizDeviceManage::getApparatus(QString id) const +QString BizDeviceManage::getApparatus(QString id) { QString result; QSqlQuery query; - query.exec("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " + query.prepare("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " "SELECT bei.meter_standard_id FROM biz_equipment_info bei WHERE bei.id = :id )"); // 将参数绑定到占位符 query.bindValue(":id", id); @@ -124,4 +139,5 @@ result = "Not Found"; } return result; + //if(result=="直流稳压电源检定装置")//根据判断进入不同的函数 } diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h index 6c95bed..71d7437 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h @@ -5,6 +5,8 @@ #include #include #include "QList" + +//OStringList //标准设备管理 class BizDevice { @@ -65,10 +67,11 @@ { public: BizDeviceManage(); + ~BizDeviceManage(); QListgetBizDeviceManage(); QListgetCatDeviceInfor(QString id); - virtual QString getApparatus(QString id) const = 0; - QListgetCheckDCPower(QString item_category_id); + QString getApparatus(QString id); + QListgetCheckDCPower(QString item_category_id,QStringList *headList); }; #endif // BIZDEVICEMANAGE_H diff --git a/softwareDirectory/AutoVerScheme/databaseconnection.cpp b/softwareDirectory/AutoVerScheme/databaseconnection.cpp index 64ed567..e74cf5e 100644 --- a/softwareDirectory/AutoVerScheme/databaseconnection.cpp +++ b/softwareDirectory/AutoVerScheme/databaseconnection.cpp @@ -24,6 +24,9 @@ bool DatabaseConnection::open() { return db.open(); } +bool DatabaseConnection::isopen() { + return db.isOpen(); +} void DatabaseConnection::close() { db.close(); diff --git a/softwareDirectory/AutoVerScheme/databaseconnection.h b/softwareDirectory/AutoVerScheme/databaseconnection.h index 98c4b6d..586b794 100644 --- a/softwareDirectory/AutoVerScheme/databaseconnection.h +++ b/softwareDirectory/AutoVerScheme/databaseconnection.h @@ -15,6 +15,7 @@ DatabaseConnection(); ~DatabaseConnection(); bool open(); + bool isopen(); void close(); QSqlDatabase& getDatabase(); private: diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 3bb55c3..76c04be 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -574,6 +574,6 @@ Version - 22 + 22 diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 deleted file mode 100644 index f11db66..0000000 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - EnvironmentId - {c08df58c-84a7-4965-bca6-e98789474efa} - - - ProjectExplorer.Project.ActiveTarget - 1 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - -fno-delayed-template-parsing - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.14.2 MinGW 32-bit - Desktop Qt 5.14.2 MinGW 32-bit - qt.qt5.5142.win32_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop Qt 5.14.2 MinGW 64-bit - Desktop Qt 5.14.2 MinGW 64-bit - qt.qt5.5142.win64_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 2 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/softwareDirectory/AutoVerScheme/InfoBase.h b/softwareDirectory/AutoVerScheme/InfoBase.h index 82db20e..6dd59f3 100644 --- a/softwareDirectory/AutoVerScheme/InfoBase.h +++ b/softwareDirectory/AutoVerScheme/InfoBase.h @@ -15,6 +15,8 @@ virtual void Load()=0; //QStandardItemModel 的实例。这个模型将用于存储和管理数据。 QStandardItemModel *model; + //信息管理页面 基类定义Conn对象 + DatabaseConnection *Conn=DatabaseConnection::getInstance(); }; #endif // INFOBASE_H diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp index ffb2bbc..d491a6c 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp @@ -1,7 +1,9 @@ #include "beexamined_deviceitem.h" #include "ui_beexamined_deviceitem.h" #include "QMessageBox.h" +#include "tested_device_manage_serve.h" +//被检设备 BeExamined_DeviceItem::BeExamined_DeviceItem(QWidget *parent) : InfoBase(parent), ui(new Ui::BeExamined_DeviceItem) @@ -27,13 +29,13 @@ "background-color:white;" "}"); - ui->tableWidget->setRowCount(10); // 设置10行 + // ui->tableWidget->setRowCount(10); // 设置10行 ui->tableWidget->setColumnCount(12); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + // item->setTextAlignment(Qt::AlignCenter); + //ui->tableWidget->setItem(0, 0, item); //设置数据 //初始化TableWidget 设置列 QStringList headers; @@ -60,5 +62,59 @@ } void BeExamined_DeviceItem::Load() { - //ShowMessageBox("被检设备","被检设备初始化完成"); + //获取主页面内容 + //进入主页面 + /* + ui->stackedWidget->setCurrentIndex(0); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + + // 创建数据库管理器对象 + //BizDeviceManage包含虚方法 指针实例化 + BeExamined_DeviceItem dbManager; + // 调用数据库管理器的函数获取数据 + int rowCount=0; + int row=0; + QList data = dbManager.getBizDeviceManage(); + + + for (const BizDevice& bizDevice : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(bizDevice.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(QString::number(row+1))); + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(bizDevice.equipment_name)); + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(bizDevice.model)); + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(bizDevice.manufacture_no)); + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(bizDevice.manufacturer)); + //添加操作按钮 + QPushButton *button = new QPushButton("查看"); + ui->tableWidget->setCellWidget(row, 6, button); + //设置按钮简单样式 + button->setStyleSheet("QPushButton {" + " border: none; /* 无边框 "*/ + // " color: green; /* 文本颜色 */" + // " text-decoration: underline; /* 文本下划线 */" + // "}"); + + // 设置鼠标悬停时的光标样式为小手图标 + // button->setCursor(Qt::PointingHandCursor); + // 连接按钮的 clicked 信号到自定义槽函数 + // connect(button, &QPushButton::clicked, this, [this, button, row]() { + // 获取当前行第一列的 ID + // QTableWidgetItem *idItem = this->ui->tableWidget->item(row, 0); + // if (idItem) { + // QString id = idItem->text(); +// + // OnButtonSelectClicked(id); + // } + + // }); + + // row++; + + // } + } diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h index ae46979..ffdc22a 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h @@ -7,7 +7,7 @@ namespace Ui { class BeExamined_DeviceItem; } - +//被检设备管理界面 class BeExamined_DeviceItem : public InfoBase { Q_OBJECT @@ -21,6 +21,7 @@ void ShowMessageBox(QString title,QString value); //继承父类的Load方法 void Load() override; + private: Ui::BeExamined_DeviceItem *ui; }; diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui index 5a0a3c9..ce63879 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui @@ -6,233 +6,959 @@ 0 0 - 1291 - 575 + 1432 + 571 Form - + + + 0 + + + 0 + + + 0 + + + 0 + - - - - 0 - 0 - - + - background-color:white; + - - + + 0 - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 设备名称: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 型号规则: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 出厂编号: - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 生产厂家: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用部门: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用单位: - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - Qt::RightToLeft - - - 查询 - - - - - - - Qt::RightToLeft - - - 重置 - - - - - - - - - - background-color:white; - - - - - - - - - - - - - - - - + + + + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 设备名称: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 型号规则: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 出厂编号: + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 生产厂家: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 使用单位: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::RightToLeft + + + 查询 + + + + + + + Qt::RightToLeft + + + 重置 + + + + + + + + + + background-color:white; + + + + + + + + + + + + + + + + + + + + + + + color:black; + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 20 + + + + + + + + Qt::Horizontal + + + + 60 + 20 + + + + + + + + Font-size:25px; + + + 查看设备信息 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 30 + 30 + + + + Qt::RightToLeft + + + background-color:grey; +color:white; + + + 返回 + + + + + + + + + + background-color:white; + + + + + + + + + background-color:white; + + + + + + + + + 设备基本信息: + + + + + + + 设备名称: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 型号规格: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 出厂编号: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定有效期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产国家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产厂家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 购进日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用年限: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备单价: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用状态: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 质量状况: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 所属部门: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 负责人: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备供方: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 位置信息: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 标准类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备分类: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 重要等级: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定周期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 对应开箱记录: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 备注: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + 2 + + + false + + + Qt::LogicalMoveStyle + + + + + + + + + + + + + + + + 核查项目及核查点: + + + + + + + + + + + + + + 0 + 0 + + + + + 30 + 0 + + + + + + + + + + false + + + + 6 + + + 0 + + + 0 + + + 0 + + + 6 + + + + + 检定项备注: + + + + + + + background-color: #f0f0f0; +color: grey; + + + + + + + + + + + diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp index 60486b4..f3b11e5 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp @@ -4,12 +4,17 @@ { } +BizDeviceManage::~BizDeviceManage() +{ + +} QListBizDeviceManage::getBizDeviceManage() { QList result; QSqlQuery query; - query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer FROM biz_equipment_info bei"); - if (query.exec()) { + bool IsSucc= query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer" + " FROM biz_equipment_info bei"); + if (IsSucc) { while (query.next()) { BizDevice device; device.id = query.value("id").toString(); @@ -28,18 +33,21 @@ QListBizDeviceManage::getCatDeviceInfor(QString id) { QList result; + + QSqlQuery query; - query.exec("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," + + query.prepare("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," "bei.product_country , bei.manufacturer , bei.produce_date, bei.purchase_date ,bei.unit_price , bei.usage_status , bei.quality_status , " "bei.dept_name , bei.director_name , bei.supplier_name , bei.location , bei.type , bei.standard_type , bei.category , bei.level , " "bei.measure_cycle , bei.unpack_record_name , bei.remark FROM biz_equipment_info bei WHERE bei.id = :id"); - // 将参数绑定到占位符 + //将参数绑定到占位符 query.bindValue(":id", id); if (query.exec()) { while (query.next()) { CatDeviceInfor device; - device.equipment_name = query.value("equipment_name").toString(); - device.model = query.value("model").toString(); + device.equipment_name = query.value("equipment_name").toString(); + device.model = query.value("model").toString(); device.manufacture_no = query.value("manufacture_no").toString(); device.measure_valid_date = query.value("measure_valid_date").toString(); device.product_country = query.value("product_country").toString(); @@ -73,13 +81,15 @@ - //直流稳压电源检定装置 -QListBizDeviceManage::getCheckDCPower(QString item_category_id) +//直流稳压电源检定装置 +QListBizDeviceManage::getCheckDCPower(QString item_category_id,QStringList *headList) { + item_category_id="直流稳压电源检定装置";//为获得测试数据 QList result; QSqlQuery query; - query.exec("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" - ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id))"); + query.prepare("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" + ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp " + "WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id)"); // 将参数绑定到占位符 query.bindValue(":item_category_id", item_category_id); if (query.exec()) { @@ -99,19 +109,24 @@ checkDCPower.remark = query.value("remark").toString(); result.append(checkDCPower); + } + } else { qDebug() << "Query execution failed: " << query.lastError().text(); } + *headList << "序号" << "核查类型" << "参数"<< "单位" + << "基准点" << "分辨率" << "循环次数" << "Urel" + << "电阻值" << "电阻值单位"; return result; } //根据id获取装置名称 -QString BizDeviceManage::getApparatus(QString id) const +QString BizDeviceManage::getApparatus(QString id) { QString result; QSqlQuery query; - query.exec("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " + query.prepare("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " "SELECT bei.meter_standard_id FROM biz_equipment_info bei WHERE bei.id = :id )"); // 将参数绑定到占位符 query.bindValue(":id", id); @@ -124,4 +139,5 @@ result = "Not Found"; } return result; + //if(result=="直流稳压电源检定装置")//根据判断进入不同的函数 } diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h index 6c95bed..71d7437 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h @@ -5,6 +5,8 @@ #include #include #include "QList" + +//OStringList //标准设备管理 class BizDevice { @@ -65,10 +67,11 @@ { public: BizDeviceManage(); + ~BizDeviceManage(); QListgetBizDeviceManage(); QListgetCatDeviceInfor(QString id); - virtual QString getApparatus(QString id) const = 0; - QListgetCheckDCPower(QString item_category_id); + QString getApparatus(QString id); + QListgetCheckDCPower(QString item_category_id,QStringList *headList); }; #endif // BIZDEVICEMANAGE_H diff --git a/softwareDirectory/AutoVerScheme/databaseconnection.cpp b/softwareDirectory/AutoVerScheme/databaseconnection.cpp index 64ed567..e74cf5e 100644 --- a/softwareDirectory/AutoVerScheme/databaseconnection.cpp +++ b/softwareDirectory/AutoVerScheme/databaseconnection.cpp @@ -24,6 +24,9 @@ bool DatabaseConnection::open() { return db.open(); } +bool DatabaseConnection::isopen() { + return db.isOpen(); +} void DatabaseConnection::close() { db.close(); diff --git a/softwareDirectory/AutoVerScheme/databaseconnection.h b/softwareDirectory/AutoVerScheme/databaseconnection.h index 98c4b6d..586b794 100644 --- a/softwareDirectory/AutoVerScheme/databaseconnection.h +++ b/softwareDirectory/AutoVerScheme/databaseconnection.h @@ -15,6 +15,7 @@ DatabaseConnection(); ~DatabaseConnection(); bool open(); + bool isopen(); void close(); QSqlDatabase& getDatabase(); private: diff --git a/softwareDirectory/AutoVerScheme/depar_task.cpp b/softwareDirectory/AutoVerScheme/depar_task.cpp index 2e9af28..5b5c3ef 100644 --- a/softwareDirectory/AutoVerScheme/depar_task.cpp +++ b/softwareDirectory/AutoVerScheme/depar_task.cpp @@ -36,9 +36,9 @@ ui->tableWidget->setColumnCount(10); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); //文件居中 - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + //item->setTextAlignment(Qt::AlignCenter); //文件居中 + //ui->tableWidget->setItem(0, 0, item); //设置数据 // 设置选择行为为选择整行 ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); //初始化TableWidget 设置列 @@ -69,6 +69,8 @@ } void Depar_Task::Load() { + //先设置为行为0 + ui->tableWidget->setRowCount(0); //查询部门任务 获取DatabaseConnection对象 //DatabaseConnection *Conn=DatabaseConnection::getInstance(); //QSqlQuery query(Conn->getDatabase()); @@ -83,11 +85,8 @@ QString State; for (const Dept& dept : data) { rowCount = ui->tableWidget->rowCount(); - if(row==273) - { - } - ui->tableWidget->insertRow(rowCount); + ui->tableWidget->insertRow(rowCount); ui->tableWidget->setItem(row, 0, new QTableWidgetItem(QString::number(row+1))); //ui->tableWidget->setItem(row, 0, new QTableWidgetItem(dept.id)); diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 3bb55c3..76c04be 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -574,6 +574,6 @@ Version - 22 + 22 diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 deleted file mode 100644 index f11db66..0000000 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - EnvironmentId - {c08df58c-84a7-4965-bca6-e98789474efa} - - - ProjectExplorer.Project.ActiveTarget - 1 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - -fno-delayed-template-parsing - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.14.2 MinGW 32-bit - Desktop Qt 5.14.2 MinGW 32-bit - qt.qt5.5142.win32_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop Qt 5.14.2 MinGW 64-bit - Desktop Qt 5.14.2 MinGW 64-bit - qt.qt5.5142.win64_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 2 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/softwareDirectory/AutoVerScheme/InfoBase.h b/softwareDirectory/AutoVerScheme/InfoBase.h index 82db20e..6dd59f3 100644 --- a/softwareDirectory/AutoVerScheme/InfoBase.h +++ b/softwareDirectory/AutoVerScheme/InfoBase.h @@ -15,6 +15,8 @@ virtual void Load()=0; //QStandardItemModel 的实例。这个模型将用于存储和管理数据。 QStandardItemModel *model; + //信息管理页面 基类定义Conn对象 + DatabaseConnection *Conn=DatabaseConnection::getInstance(); }; #endif // INFOBASE_H diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp index ffb2bbc..d491a6c 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp @@ -1,7 +1,9 @@ #include "beexamined_deviceitem.h" #include "ui_beexamined_deviceitem.h" #include "QMessageBox.h" +#include "tested_device_manage_serve.h" +//被检设备 BeExamined_DeviceItem::BeExamined_DeviceItem(QWidget *parent) : InfoBase(parent), ui(new Ui::BeExamined_DeviceItem) @@ -27,13 +29,13 @@ "background-color:white;" "}"); - ui->tableWidget->setRowCount(10); // 设置10行 + // ui->tableWidget->setRowCount(10); // 设置10行 ui->tableWidget->setColumnCount(12); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + // item->setTextAlignment(Qt::AlignCenter); + //ui->tableWidget->setItem(0, 0, item); //设置数据 //初始化TableWidget 设置列 QStringList headers; @@ -60,5 +62,59 @@ } void BeExamined_DeviceItem::Load() { - //ShowMessageBox("被检设备","被检设备初始化完成"); + //获取主页面内容 + //进入主页面 + /* + ui->stackedWidget->setCurrentIndex(0); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + + // 创建数据库管理器对象 + //BizDeviceManage包含虚方法 指针实例化 + BeExamined_DeviceItem dbManager; + // 调用数据库管理器的函数获取数据 + int rowCount=0; + int row=0; + QList data = dbManager.getBizDeviceManage(); + + + for (const BizDevice& bizDevice : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(bizDevice.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(QString::number(row+1))); + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(bizDevice.equipment_name)); + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(bizDevice.model)); + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(bizDevice.manufacture_no)); + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(bizDevice.manufacturer)); + //添加操作按钮 + QPushButton *button = new QPushButton("查看"); + ui->tableWidget->setCellWidget(row, 6, button); + //设置按钮简单样式 + button->setStyleSheet("QPushButton {" + " border: none; /* 无边框 "*/ + // " color: green; /* 文本颜色 */" + // " text-decoration: underline; /* 文本下划线 */" + // "}"); + + // 设置鼠标悬停时的光标样式为小手图标 + // button->setCursor(Qt::PointingHandCursor); + // 连接按钮的 clicked 信号到自定义槽函数 + // connect(button, &QPushButton::clicked, this, [this, button, row]() { + // 获取当前行第一列的 ID + // QTableWidgetItem *idItem = this->ui->tableWidget->item(row, 0); + // if (idItem) { + // QString id = idItem->text(); +// + // OnButtonSelectClicked(id); + // } + + // }); + + // row++; + + // } + } diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h index ae46979..ffdc22a 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h @@ -7,7 +7,7 @@ namespace Ui { class BeExamined_DeviceItem; } - +//被检设备管理界面 class BeExamined_DeviceItem : public InfoBase { Q_OBJECT @@ -21,6 +21,7 @@ void ShowMessageBox(QString title,QString value); //继承父类的Load方法 void Load() override; + private: Ui::BeExamined_DeviceItem *ui; }; diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui index 5a0a3c9..ce63879 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui @@ -6,233 +6,959 @@ 0 0 - 1291 - 575 + 1432 + 571 Form - + + + 0 + + + 0 + + + 0 + + + 0 + - - - - 0 - 0 - - + - background-color:white; + - - + + 0 - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 设备名称: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 型号规则: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 出厂编号: - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 生产厂家: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用部门: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用单位: - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - Qt::RightToLeft - - - 查询 - - - - - - - Qt::RightToLeft - - - 重置 - - - - - - - - - - background-color:white; - - - - - - - - - - - - - - - - + + + + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 设备名称: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 型号规则: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 出厂编号: + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 生产厂家: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 使用单位: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::RightToLeft + + + 查询 + + + + + + + Qt::RightToLeft + + + 重置 + + + + + + + + + + background-color:white; + + + + + + + + + + + + + + + + + + + + + + + color:black; + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 20 + + + + + + + + Qt::Horizontal + + + + 60 + 20 + + + + + + + + Font-size:25px; + + + 查看设备信息 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 30 + 30 + + + + Qt::RightToLeft + + + background-color:grey; +color:white; + + + 返回 + + + + + + + + + + background-color:white; + + + + + + + + + background-color:white; + + + + + + + + + 设备基本信息: + + + + + + + 设备名称: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 型号规格: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 出厂编号: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定有效期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产国家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产厂家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 购进日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用年限: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备单价: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用状态: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 质量状况: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 所属部门: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 负责人: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备供方: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 位置信息: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 标准类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备分类: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 重要等级: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定周期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 对应开箱记录: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 备注: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + 2 + + + false + + + Qt::LogicalMoveStyle + + + + + + + + + + + + + + + + 核查项目及核查点: + + + + + + + + + + + + + + 0 + 0 + + + + + 30 + 0 + + + + + + + + + + false + + + + 6 + + + 0 + + + 0 + + + 0 + + + 6 + + + + + 检定项备注: + + + + + + + background-color: #f0f0f0; +color: grey; + + + + + + + + + + + diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp index 60486b4..f3b11e5 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp @@ -4,12 +4,17 @@ { } +BizDeviceManage::~BizDeviceManage() +{ + +} QListBizDeviceManage::getBizDeviceManage() { QList result; QSqlQuery query; - query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer FROM biz_equipment_info bei"); - if (query.exec()) { + bool IsSucc= query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer" + " FROM biz_equipment_info bei"); + if (IsSucc) { while (query.next()) { BizDevice device; device.id = query.value("id").toString(); @@ -28,18 +33,21 @@ QListBizDeviceManage::getCatDeviceInfor(QString id) { QList result; + + QSqlQuery query; - query.exec("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," + + query.prepare("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," "bei.product_country , bei.manufacturer , bei.produce_date, bei.purchase_date ,bei.unit_price , bei.usage_status , bei.quality_status , " "bei.dept_name , bei.director_name , bei.supplier_name , bei.location , bei.type , bei.standard_type , bei.category , bei.level , " "bei.measure_cycle , bei.unpack_record_name , bei.remark FROM biz_equipment_info bei WHERE bei.id = :id"); - // 将参数绑定到占位符 + //将参数绑定到占位符 query.bindValue(":id", id); if (query.exec()) { while (query.next()) { CatDeviceInfor device; - device.equipment_name = query.value("equipment_name").toString(); - device.model = query.value("model").toString(); + device.equipment_name = query.value("equipment_name").toString(); + device.model = query.value("model").toString(); device.manufacture_no = query.value("manufacture_no").toString(); device.measure_valid_date = query.value("measure_valid_date").toString(); device.product_country = query.value("product_country").toString(); @@ -73,13 +81,15 @@ - //直流稳压电源检定装置 -QListBizDeviceManage::getCheckDCPower(QString item_category_id) +//直流稳压电源检定装置 +QListBizDeviceManage::getCheckDCPower(QString item_category_id,QStringList *headList) { + item_category_id="直流稳压电源检定装置";//为获得测试数据 QList result; QSqlQuery query; - query.exec("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" - ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id))"); + query.prepare("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" + ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp " + "WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id)"); // 将参数绑定到占位符 query.bindValue(":item_category_id", item_category_id); if (query.exec()) { @@ -99,19 +109,24 @@ checkDCPower.remark = query.value("remark").toString(); result.append(checkDCPower); + } + } else { qDebug() << "Query execution failed: " << query.lastError().text(); } + *headList << "序号" << "核查类型" << "参数"<< "单位" + << "基准点" << "分辨率" << "循环次数" << "Urel" + << "电阻值" << "电阻值单位"; return result; } //根据id获取装置名称 -QString BizDeviceManage::getApparatus(QString id) const +QString BizDeviceManage::getApparatus(QString id) { QString result; QSqlQuery query; - query.exec("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " + query.prepare("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " "SELECT bei.meter_standard_id FROM biz_equipment_info bei WHERE bei.id = :id )"); // 将参数绑定到占位符 query.bindValue(":id", id); @@ -124,4 +139,5 @@ result = "Not Found"; } return result; + //if(result=="直流稳压电源检定装置")//根据判断进入不同的函数 } diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h index 6c95bed..71d7437 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h @@ -5,6 +5,8 @@ #include #include #include "QList" + +//OStringList //标准设备管理 class BizDevice { @@ -65,10 +67,11 @@ { public: BizDeviceManage(); + ~BizDeviceManage(); QListgetBizDeviceManage(); QListgetCatDeviceInfor(QString id); - virtual QString getApparatus(QString id) const = 0; - QListgetCheckDCPower(QString item_category_id); + QString getApparatus(QString id); + QListgetCheckDCPower(QString item_category_id,QStringList *headList); }; #endif // BIZDEVICEMANAGE_H diff --git a/softwareDirectory/AutoVerScheme/databaseconnection.cpp b/softwareDirectory/AutoVerScheme/databaseconnection.cpp index 64ed567..e74cf5e 100644 --- a/softwareDirectory/AutoVerScheme/databaseconnection.cpp +++ b/softwareDirectory/AutoVerScheme/databaseconnection.cpp @@ -24,6 +24,9 @@ bool DatabaseConnection::open() { return db.open(); } +bool DatabaseConnection::isopen() { + return db.isOpen(); +} void DatabaseConnection::close() { db.close(); diff --git a/softwareDirectory/AutoVerScheme/databaseconnection.h b/softwareDirectory/AutoVerScheme/databaseconnection.h index 98c4b6d..586b794 100644 --- a/softwareDirectory/AutoVerScheme/databaseconnection.h +++ b/softwareDirectory/AutoVerScheme/databaseconnection.h @@ -15,6 +15,7 @@ DatabaseConnection(); ~DatabaseConnection(); bool open(); + bool isopen(); void close(); QSqlDatabase& getDatabase(); private: diff --git a/softwareDirectory/AutoVerScheme/depar_task.cpp b/softwareDirectory/AutoVerScheme/depar_task.cpp index 2e9af28..5b5c3ef 100644 --- a/softwareDirectory/AutoVerScheme/depar_task.cpp +++ b/softwareDirectory/AutoVerScheme/depar_task.cpp @@ -36,9 +36,9 @@ ui->tableWidget->setColumnCount(10); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); //文件居中 - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + //item->setTextAlignment(Qt::AlignCenter); //文件居中 + //ui->tableWidget->setItem(0, 0, item); //设置数据 // 设置选择行为为选择整行 ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); //初始化TableWidget 设置列 @@ -69,6 +69,8 @@ } void Depar_Task::Load() { + //先设置为行为0 + ui->tableWidget->setRowCount(0); //查询部门任务 获取DatabaseConnection对象 //DatabaseConnection *Conn=DatabaseConnection::getInstance(); //QSqlQuery query(Conn->getDatabase()); @@ -83,11 +85,8 @@ QString State; for (const Dept& dept : data) { rowCount = ui->tableWidget->rowCount(); - if(row==273) - { - } - ui->tableWidget->insertRow(rowCount); + ui->tableWidget->insertRow(rowCount); ui->tableWidget->setItem(row, 0, new QTableWidgetItem(QString::number(row+1))); //ui->tableWidget->setItem(row, 0, new QTableWidgetItem(dept.id)); diff --git a/softwareDirectory/AutoVerScheme/main.cpp b/softwareDirectory/AutoVerScheme/main.cpp index 7204a9c..714f89d 100644 --- a/softwareDirectory/AutoVerScheme/main.cpp +++ b/softwareDirectory/AutoVerScheme/main.cpp @@ -13,7 +13,7 @@ { QApplication a(argc, argv); // 加载外部的CSS文件 - a.setStyleSheet("file:///path/to/styles.css"); + //a.setStyleSheet("file:///path/to/styles.css"); //设置字体 QFont font; font.setFamily("Microsoft Yahei"); diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 3bb55c3..76c04be 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -574,6 +574,6 @@ Version - 22 + 22 diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 deleted file mode 100644 index f11db66..0000000 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - EnvironmentId - {c08df58c-84a7-4965-bca6-e98789474efa} - - - ProjectExplorer.Project.ActiveTarget - 1 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - -fno-delayed-template-parsing - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.14.2 MinGW 32-bit - Desktop Qt 5.14.2 MinGW 32-bit - qt.qt5.5142.win32_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop Qt 5.14.2 MinGW 64-bit - Desktop Qt 5.14.2 MinGW 64-bit - qt.qt5.5142.win64_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 2 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/softwareDirectory/AutoVerScheme/InfoBase.h b/softwareDirectory/AutoVerScheme/InfoBase.h index 82db20e..6dd59f3 100644 --- a/softwareDirectory/AutoVerScheme/InfoBase.h +++ b/softwareDirectory/AutoVerScheme/InfoBase.h @@ -15,6 +15,8 @@ virtual void Load()=0; //QStandardItemModel 的实例。这个模型将用于存储和管理数据。 QStandardItemModel *model; + //信息管理页面 基类定义Conn对象 + DatabaseConnection *Conn=DatabaseConnection::getInstance(); }; #endif // INFOBASE_H diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp index ffb2bbc..d491a6c 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp @@ -1,7 +1,9 @@ #include "beexamined_deviceitem.h" #include "ui_beexamined_deviceitem.h" #include "QMessageBox.h" +#include "tested_device_manage_serve.h" +//被检设备 BeExamined_DeviceItem::BeExamined_DeviceItem(QWidget *parent) : InfoBase(parent), ui(new Ui::BeExamined_DeviceItem) @@ -27,13 +29,13 @@ "background-color:white;" "}"); - ui->tableWidget->setRowCount(10); // 设置10行 + // ui->tableWidget->setRowCount(10); // 设置10行 ui->tableWidget->setColumnCount(12); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + // item->setTextAlignment(Qt::AlignCenter); + //ui->tableWidget->setItem(0, 0, item); //设置数据 //初始化TableWidget 设置列 QStringList headers; @@ -60,5 +62,59 @@ } void BeExamined_DeviceItem::Load() { - //ShowMessageBox("被检设备","被检设备初始化完成"); + //获取主页面内容 + //进入主页面 + /* + ui->stackedWidget->setCurrentIndex(0); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + + // 创建数据库管理器对象 + //BizDeviceManage包含虚方法 指针实例化 + BeExamined_DeviceItem dbManager; + // 调用数据库管理器的函数获取数据 + int rowCount=0; + int row=0; + QList data = dbManager.getBizDeviceManage(); + + + for (const BizDevice& bizDevice : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(bizDevice.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(QString::number(row+1))); + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(bizDevice.equipment_name)); + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(bizDevice.model)); + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(bizDevice.manufacture_no)); + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(bizDevice.manufacturer)); + //添加操作按钮 + QPushButton *button = new QPushButton("查看"); + ui->tableWidget->setCellWidget(row, 6, button); + //设置按钮简单样式 + button->setStyleSheet("QPushButton {" + " border: none; /* 无边框 "*/ + // " color: green; /* 文本颜色 */" + // " text-decoration: underline; /* 文本下划线 */" + // "}"); + + // 设置鼠标悬停时的光标样式为小手图标 + // button->setCursor(Qt::PointingHandCursor); + // 连接按钮的 clicked 信号到自定义槽函数 + // connect(button, &QPushButton::clicked, this, [this, button, row]() { + // 获取当前行第一列的 ID + // QTableWidgetItem *idItem = this->ui->tableWidget->item(row, 0); + // if (idItem) { + // QString id = idItem->text(); +// + // OnButtonSelectClicked(id); + // } + + // }); + + // row++; + + // } + } diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h index ae46979..ffdc22a 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h @@ -7,7 +7,7 @@ namespace Ui { class BeExamined_DeviceItem; } - +//被检设备管理界面 class BeExamined_DeviceItem : public InfoBase { Q_OBJECT @@ -21,6 +21,7 @@ void ShowMessageBox(QString title,QString value); //继承父类的Load方法 void Load() override; + private: Ui::BeExamined_DeviceItem *ui; }; diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui index 5a0a3c9..ce63879 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui @@ -6,233 +6,959 @@ 0 0 - 1291 - 575 + 1432 + 571 Form - + + + 0 + + + 0 + + + 0 + + + 0 + - - - - 0 - 0 - - + - background-color:white; + - - + + 0 - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 设备名称: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 型号规则: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 出厂编号: - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 生产厂家: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用部门: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用单位: - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - Qt::RightToLeft - - - 查询 - - - - - - - Qt::RightToLeft - - - 重置 - - - - - - - - - - background-color:white; - - - - - - - - - - - - - - - - + + + + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 设备名称: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 型号规则: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 出厂编号: + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 生产厂家: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 使用单位: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::RightToLeft + + + 查询 + + + + + + + Qt::RightToLeft + + + 重置 + + + + + + + + + + background-color:white; + + + + + + + + + + + + + + + + + + + + + + + color:black; + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 20 + + + + + + + + Qt::Horizontal + + + + 60 + 20 + + + + + + + + Font-size:25px; + + + 查看设备信息 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 30 + 30 + + + + Qt::RightToLeft + + + background-color:grey; +color:white; + + + 返回 + + + + + + + + + + background-color:white; + + + + + + + + + background-color:white; + + + + + + + + + 设备基本信息: + + + + + + + 设备名称: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 型号规格: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 出厂编号: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定有效期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产国家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产厂家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 购进日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用年限: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备单价: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用状态: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 质量状况: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 所属部门: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 负责人: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备供方: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 位置信息: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 标准类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备分类: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 重要等级: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定周期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 对应开箱记录: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 备注: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + 2 + + + false + + + Qt::LogicalMoveStyle + + + + + + + + + + + + + + + + 核查项目及核查点: + + + + + + + + + + + + + + 0 + 0 + + + + + 30 + 0 + + + + + + + + + + false + + + + 6 + + + 0 + + + 0 + + + 0 + + + 6 + + + + + 检定项备注: + + + + + + + background-color: #f0f0f0; +color: grey; + + + + + + + + + + + diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp index 60486b4..f3b11e5 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp @@ -4,12 +4,17 @@ { } +BizDeviceManage::~BizDeviceManage() +{ + +} QListBizDeviceManage::getBizDeviceManage() { QList result; QSqlQuery query; - query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer FROM biz_equipment_info bei"); - if (query.exec()) { + bool IsSucc= query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer" + " FROM biz_equipment_info bei"); + if (IsSucc) { while (query.next()) { BizDevice device; device.id = query.value("id").toString(); @@ -28,18 +33,21 @@ QListBizDeviceManage::getCatDeviceInfor(QString id) { QList result; + + QSqlQuery query; - query.exec("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," + + query.prepare("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," "bei.product_country , bei.manufacturer , bei.produce_date, bei.purchase_date ,bei.unit_price , bei.usage_status , bei.quality_status , " "bei.dept_name , bei.director_name , bei.supplier_name , bei.location , bei.type , bei.standard_type , bei.category , bei.level , " "bei.measure_cycle , bei.unpack_record_name , bei.remark FROM biz_equipment_info bei WHERE bei.id = :id"); - // 将参数绑定到占位符 + //将参数绑定到占位符 query.bindValue(":id", id); if (query.exec()) { while (query.next()) { CatDeviceInfor device; - device.equipment_name = query.value("equipment_name").toString(); - device.model = query.value("model").toString(); + device.equipment_name = query.value("equipment_name").toString(); + device.model = query.value("model").toString(); device.manufacture_no = query.value("manufacture_no").toString(); device.measure_valid_date = query.value("measure_valid_date").toString(); device.product_country = query.value("product_country").toString(); @@ -73,13 +81,15 @@ - //直流稳压电源检定装置 -QListBizDeviceManage::getCheckDCPower(QString item_category_id) +//直流稳压电源检定装置 +QListBizDeviceManage::getCheckDCPower(QString item_category_id,QStringList *headList) { + item_category_id="直流稳压电源检定装置";//为获得测试数据 QList result; QSqlQuery query; - query.exec("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" - ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id))"); + query.prepare("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" + ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp " + "WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id)"); // 将参数绑定到占位符 query.bindValue(":item_category_id", item_category_id); if (query.exec()) { @@ -99,19 +109,24 @@ checkDCPower.remark = query.value("remark").toString(); result.append(checkDCPower); + } + } else { qDebug() << "Query execution failed: " << query.lastError().text(); } + *headList << "序号" << "核查类型" << "参数"<< "单位" + << "基准点" << "分辨率" << "循环次数" << "Urel" + << "电阻值" << "电阻值单位"; return result; } //根据id获取装置名称 -QString BizDeviceManage::getApparatus(QString id) const +QString BizDeviceManage::getApparatus(QString id) { QString result; QSqlQuery query; - query.exec("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " + query.prepare("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " "SELECT bei.meter_standard_id FROM biz_equipment_info bei WHERE bei.id = :id )"); // 将参数绑定到占位符 query.bindValue(":id", id); @@ -124,4 +139,5 @@ result = "Not Found"; } return result; + //if(result=="直流稳压电源检定装置")//根据判断进入不同的函数 } diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h index 6c95bed..71d7437 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h @@ -5,6 +5,8 @@ #include #include #include "QList" + +//OStringList //标准设备管理 class BizDevice { @@ -65,10 +67,11 @@ { public: BizDeviceManage(); + ~BizDeviceManage(); QListgetBizDeviceManage(); QListgetCatDeviceInfor(QString id); - virtual QString getApparatus(QString id) const = 0; - QListgetCheckDCPower(QString item_category_id); + QString getApparatus(QString id); + QListgetCheckDCPower(QString item_category_id,QStringList *headList); }; #endif // BIZDEVICEMANAGE_H diff --git a/softwareDirectory/AutoVerScheme/databaseconnection.cpp b/softwareDirectory/AutoVerScheme/databaseconnection.cpp index 64ed567..e74cf5e 100644 --- a/softwareDirectory/AutoVerScheme/databaseconnection.cpp +++ b/softwareDirectory/AutoVerScheme/databaseconnection.cpp @@ -24,6 +24,9 @@ bool DatabaseConnection::open() { return db.open(); } +bool DatabaseConnection::isopen() { + return db.isOpen(); +} void DatabaseConnection::close() { db.close(); diff --git a/softwareDirectory/AutoVerScheme/databaseconnection.h b/softwareDirectory/AutoVerScheme/databaseconnection.h index 98c4b6d..586b794 100644 --- a/softwareDirectory/AutoVerScheme/databaseconnection.h +++ b/softwareDirectory/AutoVerScheme/databaseconnection.h @@ -15,6 +15,7 @@ DatabaseConnection(); ~DatabaseConnection(); bool open(); + bool isopen(); void close(); QSqlDatabase& getDatabase(); private: diff --git a/softwareDirectory/AutoVerScheme/depar_task.cpp b/softwareDirectory/AutoVerScheme/depar_task.cpp index 2e9af28..5b5c3ef 100644 --- a/softwareDirectory/AutoVerScheme/depar_task.cpp +++ b/softwareDirectory/AutoVerScheme/depar_task.cpp @@ -36,9 +36,9 @@ ui->tableWidget->setColumnCount(10); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); //文件居中 - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + //item->setTextAlignment(Qt::AlignCenter); //文件居中 + //ui->tableWidget->setItem(0, 0, item); //设置数据 // 设置选择行为为选择整行 ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); //初始化TableWidget 设置列 @@ -69,6 +69,8 @@ } void Depar_Task::Load() { + //先设置为行为0 + ui->tableWidget->setRowCount(0); //查询部门任务 获取DatabaseConnection对象 //DatabaseConnection *Conn=DatabaseConnection::getInstance(); //QSqlQuery query(Conn->getDatabase()); @@ -83,11 +85,8 @@ QString State; for (const Dept& dept : data) { rowCount = ui->tableWidget->rowCount(); - if(row==273) - { - } - ui->tableWidget->insertRow(rowCount); + ui->tableWidget->insertRow(rowCount); ui->tableWidget->setItem(row, 0, new QTableWidgetItem(QString::number(row+1))); //ui->tableWidget->setItem(row, 0, new QTableWidgetItem(dept.id)); diff --git a/softwareDirectory/AutoVerScheme/main.cpp b/softwareDirectory/AutoVerScheme/main.cpp index 7204a9c..714f89d 100644 --- a/softwareDirectory/AutoVerScheme/main.cpp +++ b/softwareDirectory/AutoVerScheme/main.cpp @@ -13,7 +13,7 @@ { QApplication a(argc, argv); // 加载外部的CSS文件 - a.setStyleSheet("file:///path/to/styles.css"); + //a.setStyleSheet("file:///path/to/styles.css"); //设置字体 QFont font; font.setFamily("Microsoft Yahei"); diff --git a/softwareDirectory/AutoVerScheme/my_task.cpp b/softwareDirectory/AutoVerScheme/my_task.cpp index 559a73b..12b0bcc 100644 --- a/softwareDirectory/AutoVerScheme/my_task.cpp +++ b/softwareDirectory/AutoVerScheme/my_task.cpp @@ -1,6 +1,7 @@ #include "my_task.h" #include "ui_my_task.h" #include "QMessageBox" +#include "my_tasks_serve.h" My_Task::My_Task(QWidget *parent) : InfoBase(parent), @@ -60,5 +61,40 @@ } void My_Task::Load() { - //ShowMessageBox("我的任务页面","我的任务初始化完成"); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + MyTasks dbManager; + // 调用数据库管理器的函数获取数据 + //模拟用户ID + QString userId="1640229293790650370"; + QList data = dbManager.getMyTasks(userId); + + int rowCount = 0; + int row=0; + QString State; + for (const MyTask& myTask : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(QString::number(row+1))); + + //ui->tableWidget->setItem(row, 0, new QTableWidgetItem(dept.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(myTask.sample_name)); //设置数据 + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(myTask.sample_model)); //设置数据 + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(myTask.help_instruction)); //设置数据 + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(myTask.manufacture_no)); //设置数据 + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(myTask.manufacturer)); //设置数据 + ui->tableWidget->setItem(row, 6, new QTableWidgetItem(myTask.customer_name)); //设置数据 + ui->tableWidget->setItem(row, 7, new QTableWidgetItem(myTask.FULL_NAME)); //设置数据 + ui->tableWidget->setItem(row, 8, new QTableWidgetItem(myTask.require_over_time)); //设置数据 + if(myTask.is_urgent=="1") + State="是"; + else + State="否"; + ui->tableWidget->setItem(row, 9, new QTableWidgetItem(State)); //设置数据 + //QDebug + row++; + + } } diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 3bb55c3..76c04be 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -574,6 +574,6 @@ Version - 22 + 22 diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 deleted file mode 100644 index f11db66..0000000 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - EnvironmentId - {c08df58c-84a7-4965-bca6-e98789474efa} - - - ProjectExplorer.Project.ActiveTarget - 1 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - -fno-delayed-template-parsing - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.14.2 MinGW 32-bit - Desktop Qt 5.14.2 MinGW 32-bit - qt.qt5.5142.win32_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop Qt 5.14.2 MinGW 64-bit - Desktop Qt 5.14.2 MinGW 64-bit - qt.qt5.5142.win64_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 2 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/softwareDirectory/AutoVerScheme/InfoBase.h b/softwareDirectory/AutoVerScheme/InfoBase.h index 82db20e..6dd59f3 100644 --- a/softwareDirectory/AutoVerScheme/InfoBase.h +++ b/softwareDirectory/AutoVerScheme/InfoBase.h @@ -15,6 +15,8 @@ virtual void Load()=0; //QStandardItemModel 的实例。这个模型将用于存储和管理数据。 QStandardItemModel *model; + //信息管理页面 基类定义Conn对象 + DatabaseConnection *Conn=DatabaseConnection::getInstance(); }; #endif // INFOBASE_H diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp index ffb2bbc..d491a6c 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp @@ -1,7 +1,9 @@ #include "beexamined_deviceitem.h" #include "ui_beexamined_deviceitem.h" #include "QMessageBox.h" +#include "tested_device_manage_serve.h" +//被检设备 BeExamined_DeviceItem::BeExamined_DeviceItem(QWidget *parent) : InfoBase(parent), ui(new Ui::BeExamined_DeviceItem) @@ -27,13 +29,13 @@ "background-color:white;" "}"); - ui->tableWidget->setRowCount(10); // 设置10行 + // ui->tableWidget->setRowCount(10); // 设置10行 ui->tableWidget->setColumnCount(12); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + // item->setTextAlignment(Qt::AlignCenter); + //ui->tableWidget->setItem(0, 0, item); //设置数据 //初始化TableWidget 设置列 QStringList headers; @@ -60,5 +62,59 @@ } void BeExamined_DeviceItem::Load() { - //ShowMessageBox("被检设备","被检设备初始化完成"); + //获取主页面内容 + //进入主页面 + /* + ui->stackedWidget->setCurrentIndex(0); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + + // 创建数据库管理器对象 + //BizDeviceManage包含虚方法 指针实例化 + BeExamined_DeviceItem dbManager; + // 调用数据库管理器的函数获取数据 + int rowCount=0; + int row=0; + QList data = dbManager.getBizDeviceManage(); + + + for (const BizDevice& bizDevice : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(bizDevice.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(QString::number(row+1))); + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(bizDevice.equipment_name)); + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(bizDevice.model)); + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(bizDevice.manufacture_no)); + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(bizDevice.manufacturer)); + //添加操作按钮 + QPushButton *button = new QPushButton("查看"); + ui->tableWidget->setCellWidget(row, 6, button); + //设置按钮简单样式 + button->setStyleSheet("QPushButton {" + " border: none; /* 无边框 "*/ + // " color: green; /* 文本颜色 */" + // " text-decoration: underline; /* 文本下划线 */" + // "}"); + + // 设置鼠标悬停时的光标样式为小手图标 + // button->setCursor(Qt::PointingHandCursor); + // 连接按钮的 clicked 信号到自定义槽函数 + // connect(button, &QPushButton::clicked, this, [this, button, row]() { + // 获取当前行第一列的 ID + // QTableWidgetItem *idItem = this->ui->tableWidget->item(row, 0); + // if (idItem) { + // QString id = idItem->text(); +// + // OnButtonSelectClicked(id); + // } + + // }); + + // row++; + + // } + } diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h index ae46979..ffdc22a 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h @@ -7,7 +7,7 @@ namespace Ui { class BeExamined_DeviceItem; } - +//被检设备管理界面 class BeExamined_DeviceItem : public InfoBase { Q_OBJECT @@ -21,6 +21,7 @@ void ShowMessageBox(QString title,QString value); //继承父类的Load方法 void Load() override; + private: Ui::BeExamined_DeviceItem *ui; }; diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui index 5a0a3c9..ce63879 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui @@ -6,233 +6,959 @@ 0 0 - 1291 - 575 + 1432 + 571 Form - + + + 0 + + + 0 + + + 0 + + + 0 + - - - - 0 - 0 - - + - background-color:white; + - - + + 0 - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 设备名称: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 型号规则: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 出厂编号: - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 生产厂家: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用部门: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用单位: - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - Qt::RightToLeft - - - 查询 - - - - - - - Qt::RightToLeft - - - 重置 - - - - - - - - - - background-color:white; - - - - - - - - - - - - - - - - + + + + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 设备名称: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 型号规则: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 出厂编号: + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 生产厂家: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 使用单位: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::RightToLeft + + + 查询 + + + + + + + Qt::RightToLeft + + + 重置 + + + + + + + + + + background-color:white; + + + + + + + + + + + + + + + + + + + + + + + color:black; + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 20 + + + + + + + + Qt::Horizontal + + + + 60 + 20 + + + + + + + + Font-size:25px; + + + 查看设备信息 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 30 + 30 + + + + Qt::RightToLeft + + + background-color:grey; +color:white; + + + 返回 + + + + + + + + + + background-color:white; + + + + + + + + + background-color:white; + + + + + + + + + 设备基本信息: + + + + + + + 设备名称: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 型号规格: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 出厂编号: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定有效期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产国家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产厂家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 购进日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用年限: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备单价: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用状态: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 质量状况: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 所属部门: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 负责人: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备供方: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 位置信息: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 标准类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备分类: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 重要等级: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定周期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 对应开箱记录: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 备注: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + 2 + + + false + + + Qt::LogicalMoveStyle + + + + + + + + + + + + + + + + 核查项目及核查点: + + + + + + + + + + + + + + 0 + 0 + + + + + 30 + 0 + + + + + + + + + + false + + + + 6 + + + 0 + + + 0 + + + 0 + + + 6 + + + + + 检定项备注: + + + + + + + background-color: #f0f0f0; +color: grey; + + + + + + + + + + + diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp index 60486b4..f3b11e5 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp @@ -4,12 +4,17 @@ { } +BizDeviceManage::~BizDeviceManage() +{ + +} QListBizDeviceManage::getBizDeviceManage() { QList result; QSqlQuery query; - query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer FROM biz_equipment_info bei"); - if (query.exec()) { + bool IsSucc= query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer" + " FROM biz_equipment_info bei"); + if (IsSucc) { while (query.next()) { BizDevice device; device.id = query.value("id").toString(); @@ -28,18 +33,21 @@ QListBizDeviceManage::getCatDeviceInfor(QString id) { QList result; + + QSqlQuery query; - query.exec("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," + + query.prepare("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," "bei.product_country , bei.manufacturer , bei.produce_date, bei.purchase_date ,bei.unit_price , bei.usage_status , bei.quality_status , " "bei.dept_name , bei.director_name , bei.supplier_name , bei.location , bei.type , bei.standard_type , bei.category , bei.level , " "bei.measure_cycle , bei.unpack_record_name , bei.remark FROM biz_equipment_info bei WHERE bei.id = :id"); - // 将参数绑定到占位符 + //将参数绑定到占位符 query.bindValue(":id", id); if (query.exec()) { while (query.next()) { CatDeviceInfor device; - device.equipment_name = query.value("equipment_name").toString(); - device.model = query.value("model").toString(); + device.equipment_name = query.value("equipment_name").toString(); + device.model = query.value("model").toString(); device.manufacture_no = query.value("manufacture_no").toString(); device.measure_valid_date = query.value("measure_valid_date").toString(); device.product_country = query.value("product_country").toString(); @@ -73,13 +81,15 @@ - //直流稳压电源检定装置 -QListBizDeviceManage::getCheckDCPower(QString item_category_id) +//直流稳压电源检定装置 +QListBizDeviceManage::getCheckDCPower(QString item_category_id,QStringList *headList) { + item_category_id="直流稳压电源检定装置";//为获得测试数据 QList result; QSqlQuery query; - query.exec("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" - ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id))"); + query.prepare("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" + ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp " + "WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id)"); // 将参数绑定到占位符 query.bindValue(":item_category_id", item_category_id); if (query.exec()) { @@ -99,19 +109,24 @@ checkDCPower.remark = query.value("remark").toString(); result.append(checkDCPower); + } + } else { qDebug() << "Query execution failed: " << query.lastError().text(); } + *headList << "序号" << "核查类型" << "参数"<< "单位" + << "基准点" << "分辨率" << "循环次数" << "Urel" + << "电阻值" << "电阻值单位"; return result; } //根据id获取装置名称 -QString BizDeviceManage::getApparatus(QString id) const +QString BizDeviceManage::getApparatus(QString id) { QString result; QSqlQuery query; - query.exec("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " + query.prepare("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " "SELECT bei.meter_standard_id FROM biz_equipment_info bei WHERE bei.id = :id )"); // 将参数绑定到占位符 query.bindValue(":id", id); @@ -124,4 +139,5 @@ result = "Not Found"; } return result; + //if(result=="直流稳压电源检定装置")//根据判断进入不同的函数 } diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h index 6c95bed..71d7437 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h @@ -5,6 +5,8 @@ #include #include #include "QList" + +//OStringList //标准设备管理 class BizDevice { @@ -65,10 +67,11 @@ { public: BizDeviceManage(); + ~BizDeviceManage(); QListgetBizDeviceManage(); QListgetCatDeviceInfor(QString id); - virtual QString getApparatus(QString id) const = 0; - QListgetCheckDCPower(QString item_category_id); + QString getApparatus(QString id); + QListgetCheckDCPower(QString item_category_id,QStringList *headList); }; #endif // BIZDEVICEMANAGE_H diff --git a/softwareDirectory/AutoVerScheme/databaseconnection.cpp b/softwareDirectory/AutoVerScheme/databaseconnection.cpp index 64ed567..e74cf5e 100644 --- a/softwareDirectory/AutoVerScheme/databaseconnection.cpp +++ b/softwareDirectory/AutoVerScheme/databaseconnection.cpp @@ -24,6 +24,9 @@ bool DatabaseConnection::open() { return db.open(); } +bool DatabaseConnection::isopen() { + return db.isOpen(); +} void DatabaseConnection::close() { db.close(); diff --git a/softwareDirectory/AutoVerScheme/databaseconnection.h b/softwareDirectory/AutoVerScheme/databaseconnection.h index 98c4b6d..586b794 100644 --- a/softwareDirectory/AutoVerScheme/databaseconnection.h +++ b/softwareDirectory/AutoVerScheme/databaseconnection.h @@ -15,6 +15,7 @@ DatabaseConnection(); ~DatabaseConnection(); bool open(); + bool isopen(); void close(); QSqlDatabase& getDatabase(); private: diff --git a/softwareDirectory/AutoVerScheme/depar_task.cpp b/softwareDirectory/AutoVerScheme/depar_task.cpp index 2e9af28..5b5c3ef 100644 --- a/softwareDirectory/AutoVerScheme/depar_task.cpp +++ b/softwareDirectory/AutoVerScheme/depar_task.cpp @@ -36,9 +36,9 @@ ui->tableWidget->setColumnCount(10); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); //文件居中 - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + //item->setTextAlignment(Qt::AlignCenter); //文件居中 + //ui->tableWidget->setItem(0, 0, item); //设置数据 // 设置选择行为为选择整行 ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); //初始化TableWidget 设置列 @@ -69,6 +69,8 @@ } void Depar_Task::Load() { + //先设置为行为0 + ui->tableWidget->setRowCount(0); //查询部门任务 获取DatabaseConnection对象 //DatabaseConnection *Conn=DatabaseConnection::getInstance(); //QSqlQuery query(Conn->getDatabase()); @@ -83,11 +85,8 @@ QString State; for (const Dept& dept : data) { rowCount = ui->tableWidget->rowCount(); - if(row==273) - { - } - ui->tableWidget->insertRow(rowCount); + ui->tableWidget->insertRow(rowCount); ui->tableWidget->setItem(row, 0, new QTableWidgetItem(QString::number(row+1))); //ui->tableWidget->setItem(row, 0, new QTableWidgetItem(dept.id)); diff --git a/softwareDirectory/AutoVerScheme/main.cpp b/softwareDirectory/AutoVerScheme/main.cpp index 7204a9c..714f89d 100644 --- a/softwareDirectory/AutoVerScheme/main.cpp +++ b/softwareDirectory/AutoVerScheme/main.cpp @@ -13,7 +13,7 @@ { QApplication a(argc, argv); // 加载外部的CSS文件 - a.setStyleSheet("file:///path/to/styles.css"); + //a.setStyleSheet("file:///path/to/styles.css"); //设置字体 QFont font; font.setFamily("Microsoft Yahei"); diff --git a/softwareDirectory/AutoVerScheme/my_task.cpp b/softwareDirectory/AutoVerScheme/my_task.cpp index 559a73b..12b0bcc 100644 --- a/softwareDirectory/AutoVerScheme/my_task.cpp +++ b/softwareDirectory/AutoVerScheme/my_task.cpp @@ -1,6 +1,7 @@ #include "my_task.h" #include "ui_my_task.h" #include "QMessageBox" +#include "my_tasks_serve.h" My_Task::My_Task(QWidget *parent) : InfoBase(parent), @@ -60,5 +61,40 @@ } void My_Task::Load() { - //ShowMessageBox("我的任务页面","我的任务初始化完成"); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + MyTasks dbManager; + // 调用数据库管理器的函数获取数据 + //模拟用户ID + QString userId="1640229293790650370"; + QList data = dbManager.getMyTasks(userId); + + int rowCount = 0; + int row=0; + QString State; + for (const MyTask& myTask : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(QString::number(row+1))); + + //ui->tableWidget->setItem(row, 0, new QTableWidgetItem(dept.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(myTask.sample_name)); //设置数据 + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(myTask.sample_model)); //设置数据 + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(myTask.help_instruction)); //设置数据 + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(myTask.manufacture_no)); //设置数据 + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(myTask.manufacturer)); //设置数据 + ui->tableWidget->setItem(row, 6, new QTableWidgetItem(myTask.customer_name)); //设置数据 + ui->tableWidget->setItem(row, 7, new QTableWidgetItem(myTask.FULL_NAME)); //设置数据 + ui->tableWidget->setItem(row, 8, new QTableWidgetItem(myTask.require_over_time)); //设置数据 + if(myTask.is_urgent=="1") + State="是"; + else + State="否"; + ui->tableWidget->setItem(row, 9, new QTableWidgetItem(State)); //设置数据 + //QDebug + row++; + + } } diff --git a/softwareDirectory/AutoVerScheme/my_tasks_serve.cpp b/softwareDirectory/AutoVerScheme/my_tasks_serve.cpp index 05c2ac4..9e54318 100644 --- a/softwareDirectory/AutoVerScheme/my_tasks_serve.cpp +++ b/softwareDirectory/AutoVerScheme/my_tasks_serve.cpp @@ -7,7 +7,7 @@ QList MyTasks::getMyTasks(QString id){ QList result; QSqlQuery query; - query.exec("SELECT " + query.prepare("SELECT " "bi.id, br.sample_name, br.sample_model, ei.help_instruction, ei.manufacture_no," "ei.manufacturer, bi.customer_name," "dept.FULL_NAME, bi.require_over_time," diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 3bb55c3..76c04be 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -574,6 +574,6 @@ Version - 22 + 22 diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 deleted file mode 100644 index f11db66..0000000 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - EnvironmentId - {c08df58c-84a7-4965-bca6-e98789474efa} - - - ProjectExplorer.Project.ActiveTarget - 1 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - -fno-delayed-template-parsing - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.14.2 MinGW 32-bit - Desktop Qt 5.14.2 MinGW 32-bit - qt.qt5.5142.win32_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop Qt 5.14.2 MinGW 64-bit - Desktop Qt 5.14.2 MinGW 64-bit - qt.qt5.5142.win64_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 2 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/softwareDirectory/AutoVerScheme/InfoBase.h b/softwareDirectory/AutoVerScheme/InfoBase.h index 82db20e..6dd59f3 100644 --- a/softwareDirectory/AutoVerScheme/InfoBase.h +++ b/softwareDirectory/AutoVerScheme/InfoBase.h @@ -15,6 +15,8 @@ virtual void Load()=0; //QStandardItemModel 的实例。这个模型将用于存储和管理数据。 QStandardItemModel *model; + //信息管理页面 基类定义Conn对象 + DatabaseConnection *Conn=DatabaseConnection::getInstance(); }; #endif // INFOBASE_H diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp index ffb2bbc..d491a6c 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp @@ -1,7 +1,9 @@ #include "beexamined_deviceitem.h" #include "ui_beexamined_deviceitem.h" #include "QMessageBox.h" +#include "tested_device_manage_serve.h" +//被检设备 BeExamined_DeviceItem::BeExamined_DeviceItem(QWidget *parent) : InfoBase(parent), ui(new Ui::BeExamined_DeviceItem) @@ -27,13 +29,13 @@ "background-color:white;" "}"); - ui->tableWidget->setRowCount(10); // 设置10行 + // ui->tableWidget->setRowCount(10); // 设置10行 ui->tableWidget->setColumnCount(12); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + // item->setTextAlignment(Qt::AlignCenter); + //ui->tableWidget->setItem(0, 0, item); //设置数据 //初始化TableWidget 设置列 QStringList headers; @@ -60,5 +62,59 @@ } void BeExamined_DeviceItem::Load() { - //ShowMessageBox("被检设备","被检设备初始化完成"); + //获取主页面内容 + //进入主页面 + /* + ui->stackedWidget->setCurrentIndex(0); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + + // 创建数据库管理器对象 + //BizDeviceManage包含虚方法 指针实例化 + BeExamined_DeviceItem dbManager; + // 调用数据库管理器的函数获取数据 + int rowCount=0; + int row=0; + QList data = dbManager.getBizDeviceManage(); + + + for (const BizDevice& bizDevice : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(bizDevice.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(QString::number(row+1))); + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(bizDevice.equipment_name)); + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(bizDevice.model)); + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(bizDevice.manufacture_no)); + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(bizDevice.manufacturer)); + //添加操作按钮 + QPushButton *button = new QPushButton("查看"); + ui->tableWidget->setCellWidget(row, 6, button); + //设置按钮简单样式 + button->setStyleSheet("QPushButton {" + " border: none; /* 无边框 "*/ + // " color: green; /* 文本颜色 */" + // " text-decoration: underline; /* 文本下划线 */" + // "}"); + + // 设置鼠标悬停时的光标样式为小手图标 + // button->setCursor(Qt::PointingHandCursor); + // 连接按钮的 clicked 信号到自定义槽函数 + // connect(button, &QPushButton::clicked, this, [this, button, row]() { + // 获取当前行第一列的 ID + // QTableWidgetItem *idItem = this->ui->tableWidget->item(row, 0); + // if (idItem) { + // QString id = idItem->text(); +// + // OnButtonSelectClicked(id); + // } + + // }); + + // row++; + + // } + } diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h index ae46979..ffdc22a 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h @@ -7,7 +7,7 @@ namespace Ui { class BeExamined_DeviceItem; } - +//被检设备管理界面 class BeExamined_DeviceItem : public InfoBase { Q_OBJECT @@ -21,6 +21,7 @@ void ShowMessageBox(QString title,QString value); //继承父类的Load方法 void Load() override; + private: Ui::BeExamined_DeviceItem *ui; }; diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui index 5a0a3c9..ce63879 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui @@ -6,233 +6,959 @@ 0 0 - 1291 - 575 + 1432 + 571 Form - + + + 0 + + + 0 + + + 0 + + + 0 + - - - - 0 - 0 - - + - background-color:white; + - - + + 0 - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 设备名称: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 型号规则: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 出厂编号: - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 生产厂家: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用部门: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用单位: - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - Qt::RightToLeft - - - 查询 - - - - - - - Qt::RightToLeft - - - 重置 - - - - - - - - - - background-color:white; - - - - - - - - - - - - - - - - + + + + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 设备名称: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 型号规则: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 出厂编号: + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 生产厂家: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 使用单位: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::RightToLeft + + + 查询 + + + + + + + Qt::RightToLeft + + + 重置 + + + + + + + + + + background-color:white; + + + + + + + + + + + + + + + + + + + + + + + color:black; + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 20 + + + + + + + + Qt::Horizontal + + + + 60 + 20 + + + + + + + + Font-size:25px; + + + 查看设备信息 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 30 + 30 + + + + Qt::RightToLeft + + + background-color:grey; +color:white; + + + 返回 + + + + + + + + + + background-color:white; + + + + + + + + + background-color:white; + + + + + + + + + 设备基本信息: + + + + + + + 设备名称: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 型号规格: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 出厂编号: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定有效期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产国家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产厂家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 购进日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用年限: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备单价: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用状态: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 质量状况: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 所属部门: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 负责人: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备供方: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 位置信息: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 标准类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备分类: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 重要等级: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定周期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 对应开箱记录: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 备注: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + 2 + + + false + + + Qt::LogicalMoveStyle + + + + + + + + + + + + + + + + 核查项目及核查点: + + + + + + + + + + + + + + 0 + 0 + + + + + 30 + 0 + + + + + + + + + + false + + + + 6 + + + 0 + + + 0 + + + 0 + + + 6 + + + + + 检定项备注: + + + + + + + background-color: #f0f0f0; +color: grey; + + + + + + + + + + + diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp index 60486b4..f3b11e5 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp @@ -4,12 +4,17 @@ { } +BizDeviceManage::~BizDeviceManage() +{ + +} QListBizDeviceManage::getBizDeviceManage() { QList result; QSqlQuery query; - query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer FROM biz_equipment_info bei"); - if (query.exec()) { + bool IsSucc= query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer" + " FROM biz_equipment_info bei"); + if (IsSucc) { while (query.next()) { BizDevice device; device.id = query.value("id").toString(); @@ -28,18 +33,21 @@ QListBizDeviceManage::getCatDeviceInfor(QString id) { QList result; + + QSqlQuery query; - query.exec("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," + + query.prepare("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," "bei.product_country , bei.manufacturer , bei.produce_date, bei.purchase_date ,bei.unit_price , bei.usage_status , bei.quality_status , " "bei.dept_name , bei.director_name , bei.supplier_name , bei.location , bei.type , bei.standard_type , bei.category , bei.level , " "bei.measure_cycle , bei.unpack_record_name , bei.remark FROM biz_equipment_info bei WHERE bei.id = :id"); - // 将参数绑定到占位符 + //将参数绑定到占位符 query.bindValue(":id", id); if (query.exec()) { while (query.next()) { CatDeviceInfor device; - device.equipment_name = query.value("equipment_name").toString(); - device.model = query.value("model").toString(); + device.equipment_name = query.value("equipment_name").toString(); + device.model = query.value("model").toString(); device.manufacture_no = query.value("manufacture_no").toString(); device.measure_valid_date = query.value("measure_valid_date").toString(); device.product_country = query.value("product_country").toString(); @@ -73,13 +81,15 @@ - //直流稳压电源检定装置 -QListBizDeviceManage::getCheckDCPower(QString item_category_id) +//直流稳压电源检定装置 +QListBizDeviceManage::getCheckDCPower(QString item_category_id,QStringList *headList) { + item_category_id="直流稳压电源检定装置";//为获得测试数据 QList result; QSqlQuery query; - query.exec("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" - ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id))"); + query.prepare("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" + ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp " + "WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id)"); // 将参数绑定到占位符 query.bindValue(":item_category_id", item_category_id); if (query.exec()) { @@ -99,19 +109,24 @@ checkDCPower.remark = query.value("remark").toString(); result.append(checkDCPower); + } + } else { qDebug() << "Query execution failed: " << query.lastError().text(); } + *headList << "序号" << "核查类型" << "参数"<< "单位" + << "基准点" << "分辨率" << "循环次数" << "Urel" + << "电阻值" << "电阻值单位"; return result; } //根据id获取装置名称 -QString BizDeviceManage::getApparatus(QString id) const +QString BizDeviceManage::getApparatus(QString id) { QString result; QSqlQuery query; - query.exec("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " + query.prepare("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " "SELECT bei.meter_standard_id FROM biz_equipment_info bei WHERE bei.id = :id )"); // 将参数绑定到占位符 query.bindValue(":id", id); @@ -124,4 +139,5 @@ result = "Not Found"; } return result; + //if(result=="直流稳压电源检定装置")//根据判断进入不同的函数 } diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h index 6c95bed..71d7437 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h @@ -5,6 +5,8 @@ #include #include #include "QList" + +//OStringList //标准设备管理 class BizDevice { @@ -65,10 +67,11 @@ { public: BizDeviceManage(); + ~BizDeviceManage(); QListgetBizDeviceManage(); QListgetCatDeviceInfor(QString id); - virtual QString getApparatus(QString id) const = 0; - QListgetCheckDCPower(QString item_category_id); + QString getApparatus(QString id); + QListgetCheckDCPower(QString item_category_id,QStringList *headList); }; #endif // BIZDEVICEMANAGE_H diff --git a/softwareDirectory/AutoVerScheme/databaseconnection.cpp b/softwareDirectory/AutoVerScheme/databaseconnection.cpp index 64ed567..e74cf5e 100644 --- a/softwareDirectory/AutoVerScheme/databaseconnection.cpp +++ b/softwareDirectory/AutoVerScheme/databaseconnection.cpp @@ -24,6 +24,9 @@ bool DatabaseConnection::open() { return db.open(); } +bool DatabaseConnection::isopen() { + return db.isOpen(); +} void DatabaseConnection::close() { db.close(); diff --git a/softwareDirectory/AutoVerScheme/databaseconnection.h b/softwareDirectory/AutoVerScheme/databaseconnection.h index 98c4b6d..586b794 100644 --- a/softwareDirectory/AutoVerScheme/databaseconnection.h +++ b/softwareDirectory/AutoVerScheme/databaseconnection.h @@ -15,6 +15,7 @@ DatabaseConnection(); ~DatabaseConnection(); bool open(); + bool isopen(); void close(); QSqlDatabase& getDatabase(); private: diff --git a/softwareDirectory/AutoVerScheme/depar_task.cpp b/softwareDirectory/AutoVerScheme/depar_task.cpp index 2e9af28..5b5c3ef 100644 --- a/softwareDirectory/AutoVerScheme/depar_task.cpp +++ b/softwareDirectory/AutoVerScheme/depar_task.cpp @@ -36,9 +36,9 @@ ui->tableWidget->setColumnCount(10); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); //文件居中 - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + //item->setTextAlignment(Qt::AlignCenter); //文件居中 + //ui->tableWidget->setItem(0, 0, item); //设置数据 // 设置选择行为为选择整行 ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); //初始化TableWidget 设置列 @@ -69,6 +69,8 @@ } void Depar_Task::Load() { + //先设置为行为0 + ui->tableWidget->setRowCount(0); //查询部门任务 获取DatabaseConnection对象 //DatabaseConnection *Conn=DatabaseConnection::getInstance(); //QSqlQuery query(Conn->getDatabase()); @@ -83,11 +85,8 @@ QString State; for (const Dept& dept : data) { rowCount = ui->tableWidget->rowCount(); - if(row==273) - { - } - ui->tableWidget->insertRow(rowCount); + ui->tableWidget->insertRow(rowCount); ui->tableWidget->setItem(row, 0, new QTableWidgetItem(QString::number(row+1))); //ui->tableWidget->setItem(row, 0, new QTableWidgetItem(dept.id)); diff --git a/softwareDirectory/AutoVerScheme/main.cpp b/softwareDirectory/AutoVerScheme/main.cpp index 7204a9c..714f89d 100644 --- a/softwareDirectory/AutoVerScheme/main.cpp +++ b/softwareDirectory/AutoVerScheme/main.cpp @@ -13,7 +13,7 @@ { QApplication a(argc, argv); // 加载外部的CSS文件 - a.setStyleSheet("file:///path/to/styles.css"); + //a.setStyleSheet("file:///path/to/styles.css"); //设置字体 QFont font; font.setFamily("Microsoft Yahei"); diff --git a/softwareDirectory/AutoVerScheme/my_task.cpp b/softwareDirectory/AutoVerScheme/my_task.cpp index 559a73b..12b0bcc 100644 --- a/softwareDirectory/AutoVerScheme/my_task.cpp +++ b/softwareDirectory/AutoVerScheme/my_task.cpp @@ -1,6 +1,7 @@ #include "my_task.h" #include "ui_my_task.h" #include "QMessageBox" +#include "my_tasks_serve.h" My_Task::My_Task(QWidget *parent) : InfoBase(parent), @@ -60,5 +61,40 @@ } void My_Task::Load() { - //ShowMessageBox("我的任务页面","我的任务初始化完成"); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + MyTasks dbManager; + // 调用数据库管理器的函数获取数据 + //模拟用户ID + QString userId="1640229293790650370"; + QList data = dbManager.getMyTasks(userId); + + int rowCount = 0; + int row=0; + QString State; + for (const MyTask& myTask : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(QString::number(row+1))); + + //ui->tableWidget->setItem(row, 0, new QTableWidgetItem(dept.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(myTask.sample_name)); //设置数据 + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(myTask.sample_model)); //设置数据 + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(myTask.help_instruction)); //设置数据 + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(myTask.manufacture_no)); //设置数据 + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(myTask.manufacturer)); //设置数据 + ui->tableWidget->setItem(row, 6, new QTableWidgetItem(myTask.customer_name)); //设置数据 + ui->tableWidget->setItem(row, 7, new QTableWidgetItem(myTask.FULL_NAME)); //设置数据 + ui->tableWidget->setItem(row, 8, new QTableWidgetItem(myTask.require_over_time)); //设置数据 + if(myTask.is_urgent=="1") + State="是"; + else + State="否"; + ui->tableWidget->setItem(row, 9, new QTableWidgetItem(State)); //设置数据 + //QDebug + row++; + + } } diff --git a/softwareDirectory/AutoVerScheme/my_tasks_serve.cpp b/softwareDirectory/AutoVerScheme/my_tasks_serve.cpp index 05c2ac4..9e54318 100644 --- a/softwareDirectory/AutoVerScheme/my_tasks_serve.cpp +++ b/softwareDirectory/AutoVerScheme/my_tasks_serve.cpp @@ -7,7 +7,7 @@ QList MyTasks::getMyTasks(QString id){ QList result; QSqlQuery query; - query.exec("SELECT " + query.prepare("SELECT " "bi.id, br.sample_name, br.sample_model, ei.help_instruction, ei.manufacture_no," "ei.manufacturer, bi.customer_name," "dept.FULL_NAME, bi.require_over_time," diff --git a/softwareDirectory/AutoVerScheme/standard_deviceitem.cpp b/softwareDirectory/AutoVerScheme/standard_deviceitem.cpp index d1a6a80..d51bdea 100644 --- a/softwareDirectory/AutoVerScheme/standard_deviceitem.cpp +++ b/softwareDirectory/AutoVerScheme/standard_deviceitem.cpp @@ -2,7 +2,10 @@ #include "ui_standard_deviceitem.h" #include "InfoBase.h" #include "QMessageBox" +#include "biz_device_manage_serve.h" + +//标准设备管理 .cpp Standard_DeviceItem::Standard_DeviceItem(QWidget *parent) : InfoBase(parent), ui(new Ui::Standard_DeviceItem) @@ -17,7 +20,8 @@ } void Standard_DeviceItem::initForm() { - //tableWidget设置 + +//主页面tableWidget设置 //设置控件的边框显示 ui->tableWidget->setStyleSheet("QHeaderView::section {" "border: 1px solid rgba(197, 196, 196, 1);" @@ -26,19 +30,41 @@ "background-color:white;" "}"); - ui->tableWidget->setRowCount(10); // 设置10行 - ui->tableWidget->setColumnCount(6); // 设置11列 + // ui->tableWidget->setRowCount(10); // 设置10行 + ui->tableWidget->setColumnCount(7); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); - ui->tableWidget->setItem(0, 0, item); //设置数据 - + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + //item->setTextAlignment(Qt::AlignCenter); + //ui->tableWidget->setItem(0, 0, item); //设置数据 + ui->tableWidget->setColumnWidth(0, 0); // 设置第一列的宽度为0 //初始化TableWidget 设置列 QStringList headers; - headers << "序号" << "设备名称" << "型号规则" << "出厂编号" + headers << "ID"<< "序号" << "设备名称" << "型号规则" << "出厂编号" << "生产厂家" <<"操作"; + ui->tableWidget->setHorizontalHeaderLabels(headers); + +//详情页面tableWidgetItem设置 + ui->tableWidgetItem->setStyleSheet("QHeaderView::section {" + "border: 1px solid rgba(197, 196, 196, 1);" + "border-left:none;" + "border-top:none;" + "background-color:white;" + "}"); + + // ui->tableWidget->setRowCount(10); // 设置10行 + //ui->tableWidgetItem->setColumnCount(14); // 设置11列 + ui->tableWidgetItem->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 + ui->tableWidgetItem->verticalHeader()->setParent(nullptr); //隐藏行头 + + //初始化TableWidget 设置列 + //QStringList headersItem; + //headersItem << "序号" << "核查类型" << "检测类型" << "参数"<< "单位" + // << "频率" << "核查点" << "分辨力" << "循环次数" << "Urel" + // << "通道" << "TFER" << "DCCP" << "FLIT"; + + //ui->tableWidgetItem->setHorizontalHeaderLabels(headersItem); } void Standard_DeviceItem::ShowMessageBox(QString title,QString value) { // 创建一个QMessageBox对象 @@ -58,5 +84,170 @@ } void Standard_DeviceItem::Load() { - //ShowMessageBox("标准管理","标准管理初始化完成"); + //获取主页面内容 + //进入主页面 + ui->stackedWidget->setCurrentIndex(0); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + // 创建数据库管理器对象 + //BizDeviceManage包含虚方法 指针实例化 + BizDeviceManage dbManager; + // 调用数据库管理器的函数获取数据 + int rowCount=0; + int row=0; + QList data = dbManager.getBizDeviceManage(); + + + for (const BizDevice& bizDevice : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(bizDevice.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(QString::number(row+1))); + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(bizDevice.equipment_name)); + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(bizDevice.model)); + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(bizDevice.manufacture_no)); + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(bizDevice.manufacturer)); + //添加操作按钮 + QPushButton *button = new QPushButton("查看"); + ui->tableWidget->setCellWidget(row, 6, button); + //设置按钮简单样式 + button->setStyleSheet("QPushButton {" + " border: none; /* 无边框 */" + " color: green; /* 文本颜色 */" + " text-decoration: underline; /* 文本下划线 */" + "}"); + + // 设置鼠标悬停时的光标样式为小手图标 + button->setCursor(Qt::PointingHandCursor); + // 连接按钮的 clicked 信号到自定义槽函数 + connect(button, &QPushButton::clicked, this, [this, button, row]() { + // 获取当前行第一列的 ID + QTableWidgetItem *idItem = this->ui->tableWidget->item(row, 0); + if (idItem) { + QString id = idItem->text(); + + OnButtonSelectClicked(id); + } + + }); + + row++; + } + } +void Standard_DeviceItem::OnButtonSelectClicked(QString id) +{ + //添加 + //设备信息页面 初始化方法 + DeviceInfoInit(id); + ui->stackedWidget->setCurrentIndex(1); + QMessageBox::information(this, "ID",id); +} +//返回按钮 +void Standard_DeviceItem::on_pushButton_clicked() +{ + ui->stackedWidget->setCurrentIndex(0); +} +void Standard_DeviceItem::DeviceInfoInit(QString id) +{ + + + BizDeviceManage dbManager; + QList data = dbManager.getCatDeviceInfor(id); + // 获取当前日期 使用年限=当前日期减去购进日期 + QDate currentDate = QDate::currentDate(); + QDate purchase_date; + + int yearsDiff ; + + // 定义日期的格式,这里假设是"yyyy-MM-dd" + QString format = "yyyy-MM-dd"; + //解析数据 + for (const CatDeviceInfor& catDeviceInfor : data) { + ui->equipment_name->setText(catDeviceInfor.equipment_name); + ui->model->setText(catDeviceInfor.model); + ui->manufacture_no->setText(catDeviceInfor.manufacture_no); + ui->measure_valid_date->setText(catDeviceInfor.measure_valid_date); + ui->product_country->setText(catDeviceInfor.product_country); + ui->manufacturer->setText(catDeviceInfor.manufacturer); + ui->produce_date->setText(catDeviceInfor.produce_date); + ui->purchase_date->setText(catDeviceInfor.purchase_date); + ui->unit_price->setText(catDeviceInfor.unit_price); + ui->usage_status->setText(catDeviceInfor.usage_status); + ui->quality_status->setText(catDeviceInfor.quality_status); + ui->dept_name->setText(catDeviceInfor.dept_name); + ui->director_name->setText(catDeviceInfor.director_name); + ui->supplier_name->setText(catDeviceInfor.supplier_name); + ui->location->setText(catDeviceInfor.location); + ui->type->setText(catDeviceInfor.type); + ui->standard_type->setText(catDeviceInfor.standard_type); + ui->category->setText(catDeviceInfor.category); + ui->level->setText(catDeviceInfor.level); + ui->measure_cycle->setText(catDeviceInfor.measure_cycle); + ui->unpack_record_name->setText(catDeviceInfor.unpack_record_name); + ui->remark->setText(catDeviceInfor.remark); + + //将catDeviceInfor.purchase_date转为Qdate类型 + purchase_date=QDate::fromString(catDeviceInfor.purchase_date,format); + //计算天数差 + yearsDiff=purchase_date.daysTo(currentDate) /365; + //使用年限 + ui->DurableYears->setText(QString::number(yearsDiff)); + } + + + //获取核查点tablewight的数据 + QStringList headlist; + QString DeviceName = dbManager.getApparatus(id); + QList bizDeviceManageData=dbManager.getCheckDCPower(DeviceName,&headlist); + //设置tablewight + ui->tableWidgetItem->setRowCount(0); + ui->tableWidgetItem->setColumnCount(headlist.count()); + ui->tableWidgetItem->setHorizontalHeaderLabels(headlist); + //循环数据 + int rowCount=0; + int row=0; + + for (const CheckDCPower& checkDCPower : bizDeviceManageData) + { + rowCount = ui->tableWidgetItem->rowCount(); + ui->tableWidgetItem->insertRow(rowCount); + ui->tableWidgetItem->setItem(row, 0, new QTableWidgetItem(QString::number(row+1))); + ui->tableWidgetItem->setItem(row, 1, new QTableWidgetItem(checkDCPower.check_type)); //核查类型 + ui->tableWidgetItem->setItem(row, 2, new QTableWidgetItem(checkDCPower.params)); //参数 + ui->tableWidgetItem->setItem(row, 3, new QTableWidgetItem(checkDCPower.unit)); //单位 + ui->tableWidgetItem->setItem(row, 4, new QTableWidgetItem(checkDCPower.datum_point));//基准点 + ui->tableWidgetItem->setItem(row, 5, new QTableWidgetItem(checkDCPower.resolution));//分辨力 + ui->tableWidgetItem->setItem(row, 6, new QTableWidgetItem(checkDCPower.cycle_number));//循环次数 + ui->tableWidgetItem->setItem(row, 7, new QTableWidgetItem(checkDCPower.urel));//urel + ui->tableWidgetItem->setItem(row, 8, new QTableWidgetItem(checkDCPower.resistance_value));//电阻值 + ui->tableWidgetItem->setItem(row, 9, new QTableWidgetItem(checkDCPower.resistance_value_unit));//电阻值单位 + //ui->tableWidget->setItem(row, 0, new QTableWidgetItem(dept.id)); + + //QDebug + row++; + + } +} + + + + + + + + + + + + + + + + + + + + diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 3bb55c3..76c04be 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -574,6 +574,6 @@ Version - 22 + 22 diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 deleted file mode 100644 index f11db66..0000000 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - EnvironmentId - {c08df58c-84a7-4965-bca6-e98789474efa} - - - ProjectExplorer.Project.ActiveTarget - 1 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - -fno-delayed-template-parsing - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.14.2 MinGW 32-bit - Desktop Qt 5.14.2 MinGW 32-bit - qt.qt5.5142.win32_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop Qt 5.14.2 MinGW 64-bit - Desktop Qt 5.14.2 MinGW 64-bit - qt.qt5.5142.win64_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 2 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/softwareDirectory/AutoVerScheme/InfoBase.h b/softwareDirectory/AutoVerScheme/InfoBase.h index 82db20e..6dd59f3 100644 --- a/softwareDirectory/AutoVerScheme/InfoBase.h +++ b/softwareDirectory/AutoVerScheme/InfoBase.h @@ -15,6 +15,8 @@ virtual void Load()=0; //QStandardItemModel 的实例。这个模型将用于存储和管理数据。 QStandardItemModel *model; + //信息管理页面 基类定义Conn对象 + DatabaseConnection *Conn=DatabaseConnection::getInstance(); }; #endif // INFOBASE_H diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp index ffb2bbc..d491a6c 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp @@ -1,7 +1,9 @@ #include "beexamined_deviceitem.h" #include "ui_beexamined_deviceitem.h" #include "QMessageBox.h" +#include "tested_device_manage_serve.h" +//被检设备 BeExamined_DeviceItem::BeExamined_DeviceItem(QWidget *parent) : InfoBase(parent), ui(new Ui::BeExamined_DeviceItem) @@ -27,13 +29,13 @@ "background-color:white;" "}"); - ui->tableWidget->setRowCount(10); // 设置10行 + // ui->tableWidget->setRowCount(10); // 设置10行 ui->tableWidget->setColumnCount(12); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + // item->setTextAlignment(Qt::AlignCenter); + //ui->tableWidget->setItem(0, 0, item); //设置数据 //初始化TableWidget 设置列 QStringList headers; @@ -60,5 +62,59 @@ } void BeExamined_DeviceItem::Load() { - //ShowMessageBox("被检设备","被检设备初始化完成"); + //获取主页面内容 + //进入主页面 + /* + ui->stackedWidget->setCurrentIndex(0); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + + // 创建数据库管理器对象 + //BizDeviceManage包含虚方法 指针实例化 + BeExamined_DeviceItem dbManager; + // 调用数据库管理器的函数获取数据 + int rowCount=0; + int row=0; + QList data = dbManager.getBizDeviceManage(); + + + for (const BizDevice& bizDevice : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(bizDevice.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(QString::number(row+1))); + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(bizDevice.equipment_name)); + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(bizDevice.model)); + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(bizDevice.manufacture_no)); + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(bizDevice.manufacturer)); + //添加操作按钮 + QPushButton *button = new QPushButton("查看"); + ui->tableWidget->setCellWidget(row, 6, button); + //设置按钮简单样式 + button->setStyleSheet("QPushButton {" + " border: none; /* 无边框 "*/ + // " color: green; /* 文本颜色 */" + // " text-decoration: underline; /* 文本下划线 */" + // "}"); + + // 设置鼠标悬停时的光标样式为小手图标 + // button->setCursor(Qt::PointingHandCursor); + // 连接按钮的 clicked 信号到自定义槽函数 + // connect(button, &QPushButton::clicked, this, [this, button, row]() { + // 获取当前行第一列的 ID + // QTableWidgetItem *idItem = this->ui->tableWidget->item(row, 0); + // if (idItem) { + // QString id = idItem->text(); +// + // OnButtonSelectClicked(id); + // } + + // }); + + // row++; + + // } + } diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h index ae46979..ffdc22a 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h @@ -7,7 +7,7 @@ namespace Ui { class BeExamined_DeviceItem; } - +//被检设备管理界面 class BeExamined_DeviceItem : public InfoBase { Q_OBJECT @@ -21,6 +21,7 @@ void ShowMessageBox(QString title,QString value); //继承父类的Load方法 void Load() override; + private: Ui::BeExamined_DeviceItem *ui; }; diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui index 5a0a3c9..ce63879 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui @@ -6,233 +6,959 @@ 0 0 - 1291 - 575 + 1432 + 571 Form - + + + 0 + + + 0 + + + 0 + + + 0 + - - - - 0 - 0 - - + - background-color:white; + - - + + 0 - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 设备名称: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 型号规则: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 出厂编号: - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 生产厂家: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用部门: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用单位: - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - Qt::RightToLeft - - - 查询 - - - - - - - Qt::RightToLeft - - - 重置 - - - - - - - - - - background-color:white; - - - - - - - - - - - - - - - - + + + + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 设备名称: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 型号规则: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 出厂编号: + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 生产厂家: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 使用单位: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::RightToLeft + + + 查询 + + + + + + + Qt::RightToLeft + + + 重置 + + + + + + + + + + background-color:white; + + + + + + + + + + + + + + + + + + + + + + + color:black; + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 20 + + + + + + + + Qt::Horizontal + + + + 60 + 20 + + + + + + + + Font-size:25px; + + + 查看设备信息 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 30 + 30 + + + + Qt::RightToLeft + + + background-color:grey; +color:white; + + + 返回 + + + + + + + + + + background-color:white; + + + + + + + + + background-color:white; + + + + + + + + + 设备基本信息: + + + + + + + 设备名称: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 型号规格: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 出厂编号: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定有效期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产国家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产厂家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 购进日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用年限: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备单价: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用状态: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 质量状况: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 所属部门: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 负责人: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备供方: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 位置信息: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 标准类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备分类: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 重要等级: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定周期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 对应开箱记录: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 备注: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + 2 + + + false + + + Qt::LogicalMoveStyle + + + + + + + + + + + + + + + + 核查项目及核查点: + + + + + + + + + + + + + + 0 + 0 + + + + + 30 + 0 + + + + + + + + + + false + + + + 6 + + + 0 + + + 0 + + + 0 + + + 6 + + + + + 检定项备注: + + + + + + + background-color: #f0f0f0; +color: grey; + + + + + + + + + + + diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp index 60486b4..f3b11e5 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp @@ -4,12 +4,17 @@ { } +BizDeviceManage::~BizDeviceManage() +{ + +} QListBizDeviceManage::getBizDeviceManage() { QList result; QSqlQuery query; - query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer FROM biz_equipment_info bei"); - if (query.exec()) { + bool IsSucc= query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer" + " FROM biz_equipment_info bei"); + if (IsSucc) { while (query.next()) { BizDevice device; device.id = query.value("id").toString(); @@ -28,18 +33,21 @@ QListBizDeviceManage::getCatDeviceInfor(QString id) { QList result; + + QSqlQuery query; - query.exec("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," + + query.prepare("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," "bei.product_country , bei.manufacturer , bei.produce_date, bei.purchase_date ,bei.unit_price , bei.usage_status , bei.quality_status , " "bei.dept_name , bei.director_name , bei.supplier_name , bei.location , bei.type , bei.standard_type , bei.category , bei.level , " "bei.measure_cycle , bei.unpack_record_name , bei.remark FROM biz_equipment_info bei WHERE bei.id = :id"); - // 将参数绑定到占位符 + //将参数绑定到占位符 query.bindValue(":id", id); if (query.exec()) { while (query.next()) { CatDeviceInfor device; - device.equipment_name = query.value("equipment_name").toString(); - device.model = query.value("model").toString(); + device.equipment_name = query.value("equipment_name").toString(); + device.model = query.value("model").toString(); device.manufacture_no = query.value("manufacture_no").toString(); device.measure_valid_date = query.value("measure_valid_date").toString(); device.product_country = query.value("product_country").toString(); @@ -73,13 +81,15 @@ - //直流稳压电源检定装置 -QListBizDeviceManage::getCheckDCPower(QString item_category_id) +//直流稳压电源检定装置 +QListBizDeviceManage::getCheckDCPower(QString item_category_id,QStringList *headList) { + item_category_id="直流稳压电源检定装置";//为获得测试数据 QList result; QSqlQuery query; - query.exec("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" - ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id))"); + query.prepare("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" + ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp " + "WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id)"); // 将参数绑定到占位符 query.bindValue(":item_category_id", item_category_id); if (query.exec()) { @@ -99,19 +109,24 @@ checkDCPower.remark = query.value("remark").toString(); result.append(checkDCPower); + } + } else { qDebug() << "Query execution failed: " << query.lastError().text(); } + *headList << "序号" << "核查类型" << "参数"<< "单位" + << "基准点" << "分辨率" << "循环次数" << "Urel" + << "电阻值" << "电阻值单位"; return result; } //根据id获取装置名称 -QString BizDeviceManage::getApparatus(QString id) const +QString BizDeviceManage::getApparatus(QString id) { QString result; QSqlQuery query; - query.exec("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " + query.prepare("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " "SELECT bei.meter_standard_id FROM biz_equipment_info bei WHERE bei.id = :id )"); // 将参数绑定到占位符 query.bindValue(":id", id); @@ -124,4 +139,5 @@ result = "Not Found"; } return result; + //if(result=="直流稳压电源检定装置")//根据判断进入不同的函数 } diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h index 6c95bed..71d7437 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h @@ -5,6 +5,8 @@ #include #include #include "QList" + +//OStringList //标准设备管理 class BizDevice { @@ -65,10 +67,11 @@ { public: BizDeviceManage(); + ~BizDeviceManage(); QListgetBizDeviceManage(); QListgetCatDeviceInfor(QString id); - virtual QString getApparatus(QString id) const = 0; - QListgetCheckDCPower(QString item_category_id); + QString getApparatus(QString id); + QListgetCheckDCPower(QString item_category_id,QStringList *headList); }; #endif // BIZDEVICEMANAGE_H diff --git a/softwareDirectory/AutoVerScheme/databaseconnection.cpp b/softwareDirectory/AutoVerScheme/databaseconnection.cpp index 64ed567..e74cf5e 100644 --- a/softwareDirectory/AutoVerScheme/databaseconnection.cpp +++ b/softwareDirectory/AutoVerScheme/databaseconnection.cpp @@ -24,6 +24,9 @@ bool DatabaseConnection::open() { return db.open(); } +bool DatabaseConnection::isopen() { + return db.isOpen(); +} void DatabaseConnection::close() { db.close(); diff --git a/softwareDirectory/AutoVerScheme/databaseconnection.h b/softwareDirectory/AutoVerScheme/databaseconnection.h index 98c4b6d..586b794 100644 --- a/softwareDirectory/AutoVerScheme/databaseconnection.h +++ b/softwareDirectory/AutoVerScheme/databaseconnection.h @@ -15,6 +15,7 @@ DatabaseConnection(); ~DatabaseConnection(); bool open(); + bool isopen(); void close(); QSqlDatabase& getDatabase(); private: diff --git a/softwareDirectory/AutoVerScheme/depar_task.cpp b/softwareDirectory/AutoVerScheme/depar_task.cpp index 2e9af28..5b5c3ef 100644 --- a/softwareDirectory/AutoVerScheme/depar_task.cpp +++ b/softwareDirectory/AutoVerScheme/depar_task.cpp @@ -36,9 +36,9 @@ ui->tableWidget->setColumnCount(10); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); //文件居中 - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + //item->setTextAlignment(Qt::AlignCenter); //文件居中 + //ui->tableWidget->setItem(0, 0, item); //设置数据 // 设置选择行为为选择整行 ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); //初始化TableWidget 设置列 @@ -69,6 +69,8 @@ } void Depar_Task::Load() { + //先设置为行为0 + ui->tableWidget->setRowCount(0); //查询部门任务 获取DatabaseConnection对象 //DatabaseConnection *Conn=DatabaseConnection::getInstance(); //QSqlQuery query(Conn->getDatabase()); @@ -83,11 +85,8 @@ QString State; for (const Dept& dept : data) { rowCount = ui->tableWidget->rowCount(); - if(row==273) - { - } - ui->tableWidget->insertRow(rowCount); + ui->tableWidget->insertRow(rowCount); ui->tableWidget->setItem(row, 0, new QTableWidgetItem(QString::number(row+1))); //ui->tableWidget->setItem(row, 0, new QTableWidgetItem(dept.id)); diff --git a/softwareDirectory/AutoVerScheme/main.cpp b/softwareDirectory/AutoVerScheme/main.cpp index 7204a9c..714f89d 100644 --- a/softwareDirectory/AutoVerScheme/main.cpp +++ b/softwareDirectory/AutoVerScheme/main.cpp @@ -13,7 +13,7 @@ { QApplication a(argc, argv); // 加载外部的CSS文件 - a.setStyleSheet("file:///path/to/styles.css"); + //a.setStyleSheet("file:///path/to/styles.css"); //设置字体 QFont font; font.setFamily("Microsoft Yahei"); diff --git a/softwareDirectory/AutoVerScheme/my_task.cpp b/softwareDirectory/AutoVerScheme/my_task.cpp index 559a73b..12b0bcc 100644 --- a/softwareDirectory/AutoVerScheme/my_task.cpp +++ b/softwareDirectory/AutoVerScheme/my_task.cpp @@ -1,6 +1,7 @@ #include "my_task.h" #include "ui_my_task.h" #include "QMessageBox" +#include "my_tasks_serve.h" My_Task::My_Task(QWidget *parent) : InfoBase(parent), @@ -60,5 +61,40 @@ } void My_Task::Load() { - //ShowMessageBox("我的任务页面","我的任务初始化完成"); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + MyTasks dbManager; + // 调用数据库管理器的函数获取数据 + //模拟用户ID + QString userId="1640229293790650370"; + QList data = dbManager.getMyTasks(userId); + + int rowCount = 0; + int row=0; + QString State; + for (const MyTask& myTask : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(QString::number(row+1))); + + //ui->tableWidget->setItem(row, 0, new QTableWidgetItem(dept.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(myTask.sample_name)); //设置数据 + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(myTask.sample_model)); //设置数据 + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(myTask.help_instruction)); //设置数据 + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(myTask.manufacture_no)); //设置数据 + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(myTask.manufacturer)); //设置数据 + ui->tableWidget->setItem(row, 6, new QTableWidgetItem(myTask.customer_name)); //设置数据 + ui->tableWidget->setItem(row, 7, new QTableWidgetItem(myTask.FULL_NAME)); //设置数据 + ui->tableWidget->setItem(row, 8, new QTableWidgetItem(myTask.require_over_time)); //设置数据 + if(myTask.is_urgent=="1") + State="是"; + else + State="否"; + ui->tableWidget->setItem(row, 9, new QTableWidgetItem(State)); //设置数据 + //QDebug + row++; + + } } diff --git a/softwareDirectory/AutoVerScheme/my_tasks_serve.cpp b/softwareDirectory/AutoVerScheme/my_tasks_serve.cpp index 05c2ac4..9e54318 100644 --- a/softwareDirectory/AutoVerScheme/my_tasks_serve.cpp +++ b/softwareDirectory/AutoVerScheme/my_tasks_serve.cpp @@ -7,7 +7,7 @@ QList MyTasks::getMyTasks(QString id){ QList result; QSqlQuery query; - query.exec("SELECT " + query.prepare("SELECT " "bi.id, br.sample_name, br.sample_model, ei.help_instruction, ei.manufacture_no," "ei.manufacturer, bi.customer_name," "dept.FULL_NAME, bi.require_over_time," diff --git a/softwareDirectory/AutoVerScheme/standard_deviceitem.cpp b/softwareDirectory/AutoVerScheme/standard_deviceitem.cpp index d1a6a80..d51bdea 100644 --- a/softwareDirectory/AutoVerScheme/standard_deviceitem.cpp +++ b/softwareDirectory/AutoVerScheme/standard_deviceitem.cpp @@ -2,7 +2,10 @@ #include "ui_standard_deviceitem.h" #include "InfoBase.h" #include "QMessageBox" +#include "biz_device_manage_serve.h" + +//标准设备管理 .cpp Standard_DeviceItem::Standard_DeviceItem(QWidget *parent) : InfoBase(parent), ui(new Ui::Standard_DeviceItem) @@ -17,7 +20,8 @@ } void Standard_DeviceItem::initForm() { - //tableWidget设置 + +//主页面tableWidget设置 //设置控件的边框显示 ui->tableWidget->setStyleSheet("QHeaderView::section {" "border: 1px solid rgba(197, 196, 196, 1);" @@ -26,19 +30,41 @@ "background-color:white;" "}"); - ui->tableWidget->setRowCount(10); // 设置10行 - ui->tableWidget->setColumnCount(6); // 设置11列 + // ui->tableWidget->setRowCount(10); // 设置10行 + ui->tableWidget->setColumnCount(7); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); - ui->tableWidget->setItem(0, 0, item); //设置数据 - + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + //item->setTextAlignment(Qt::AlignCenter); + //ui->tableWidget->setItem(0, 0, item); //设置数据 + ui->tableWidget->setColumnWidth(0, 0); // 设置第一列的宽度为0 //初始化TableWidget 设置列 QStringList headers; - headers << "序号" << "设备名称" << "型号规则" << "出厂编号" + headers << "ID"<< "序号" << "设备名称" << "型号规则" << "出厂编号" << "生产厂家" <<"操作"; + ui->tableWidget->setHorizontalHeaderLabels(headers); + +//详情页面tableWidgetItem设置 + ui->tableWidgetItem->setStyleSheet("QHeaderView::section {" + "border: 1px solid rgba(197, 196, 196, 1);" + "border-left:none;" + "border-top:none;" + "background-color:white;" + "}"); + + // ui->tableWidget->setRowCount(10); // 设置10行 + //ui->tableWidgetItem->setColumnCount(14); // 设置11列 + ui->tableWidgetItem->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 + ui->tableWidgetItem->verticalHeader()->setParent(nullptr); //隐藏行头 + + //初始化TableWidget 设置列 + //QStringList headersItem; + //headersItem << "序号" << "核查类型" << "检测类型" << "参数"<< "单位" + // << "频率" << "核查点" << "分辨力" << "循环次数" << "Urel" + // << "通道" << "TFER" << "DCCP" << "FLIT"; + + //ui->tableWidgetItem->setHorizontalHeaderLabels(headersItem); } void Standard_DeviceItem::ShowMessageBox(QString title,QString value) { // 创建一个QMessageBox对象 @@ -58,5 +84,170 @@ } void Standard_DeviceItem::Load() { - //ShowMessageBox("标准管理","标准管理初始化完成"); + //获取主页面内容 + //进入主页面 + ui->stackedWidget->setCurrentIndex(0); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + // 创建数据库管理器对象 + //BizDeviceManage包含虚方法 指针实例化 + BizDeviceManage dbManager; + // 调用数据库管理器的函数获取数据 + int rowCount=0; + int row=0; + QList data = dbManager.getBizDeviceManage(); + + + for (const BizDevice& bizDevice : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(bizDevice.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(QString::number(row+1))); + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(bizDevice.equipment_name)); + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(bizDevice.model)); + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(bizDevice.manufacture_no)); + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(bizDevice.manufacturer)); + //添加操作按钮 + QPushButton *button = new QPushButton("查看"); + ui->tableWidget->setCellWidget(row, 6, button); + //设置按钮简单样式 + button->setStyleSheet("QPushButton {" + " border: none; /* 无边框 */" + " color: green; /* 文本颜色 */" + " text-decoration: underline; /* 文本下划线 */" + "}"); + + // 设置鼠标悬停时的光标样式为小手图标 + button->setCursor(Qt::PointingHandCursor); + // 连接按钮的 clicked 信号到自定义槽函数 + connect(button, &QPushButton::clicked, this, [this, button, row]() { + // 获取当前行第一列的 ID + QTableWidgetItem *idItem = this->ui->tableWidget->item(row, 0); + if (idItem) { + QString id = idItem->text(); + + OnButtonSelectClicked(id); + } + + }); + + row++; + } + } +void Standard_DeviceItem::OnButtonSelectClicked(QString id) +{ + //添加 + //设备信息页面 初始化方法 + DeviceInfoInit(id); + ui->stackedWidget->setCurrentIndex(1); + QMessageBox::information(this, "ID",id); +} +//返回按钮 +void Standard_DeviceItem::on_pushButton_clicked() +{ + ui->stackedWidget->setCurrentIndex(0); +} +void Standard_DeviceItem::DeviceInfoInit(QString id) +{ + + + BizDeviceManage dbManager; + QList data = dbManager.getCatDeviceInfor(id); + // 获取当前日期 使用年限=当前日期减去购进日期 + QDate currentDate = QDate::currentDate(); + QDate purchase_date; + + int yearsDiff ; + + // 定义日期的格式,这里假设是"yyyy-MM-dd" + QString format = "yyyy-MM-dd"; + //解析数据 + for (const CatDeviceInfor& catDeviceInfor : data) { + ui->equipment_name->setText(catDeviceInfor.equipment_name); + ui->model->setText(catDeviceInfor.model); + ui->manufacture_no->setText(catDeviceInfor.manufacture_no); + ui->measure_valid_date->setText(catDeviceInfor.measure_valid_date); + ui->product_country->setText(catDeviceInfor.product_country); + ui->manufacturer->setText(catDeviceInfor.manufacturer); + ui->produce_date->setText(catDeviceInfor.produce_date); + ui->purchase_date->setText(catDeviceInfor.purchase_date); + ui->unit_price->setText(catDeviceInfor.unit_price); + ui->usage_status->setText(catDeviceInfor.usage_status); + ui->quality_status->setText(catDeviceInfor.quality_status); + ui->dept_name->setText(catDeviceInfor.dept_name); + ui->director_name->setText(catDeviceInfor.director_name); + ui->supplier_name->setText(catDeviceInfor.supplier_name); + ui->location->setText(catDeviceInfor.location); + ui->type->setText(catDeviceInfor.type); + ui->standard_type->setText(catDeviceInfor.standard_type); + ui->category->setText(catDeviceInfor.category); + ui->level->setText(catDeviceInfor.level); + ui->measure_cycle->setText(catDeviceInfor.measure_cycle); + ui->unpack_record_name->setText(catDeviceInfor.unpack_record_name); + ui->remark->setText(catDeviceInfor.remark); + + //将catDeviceInfor.purchase_date转为Qdate类型 + purchase_date=QDate::fromString(catDeviceInfor.purchase_date,format); + //计算天数差 + yearsDiff=purchase_date.daysTo(currentDate) /365; + //使用年限 + ui->DurableYears->setText(QString::number(yearsDiff)); + } + + + //获取核查点tablewight的数据 + QStringList headlist; + QString DeviceName = dbManager.getApparatus(id); + QList bizDeviceManageData=dbManager.getCheckDCPower(DeviceName,&headlist); + //设置tablewight + ui->tableWidgetItem->setRowCount(0); + ui->tableWidgetItem->setColumnCount(headlist.count()); + ui->tableWidgetItem->setHorizontalHeaderLabels(headlist); + //循环数据 + int rowCount=0; + int row=0; + + for (const CheckDCPower& checkDCPower : bizDeviceManageData) + { + rowCount = ui->tableWidgetItem->rowCount(); + ui->tableWidgetItem->insertRow(rowCount); + ui->tableWidgetItem->setItem(row, 0, new QTableWidgetItem(QString::number(row+1))); + ui->tableWidgetItem->setItem(row, 1, new QTableWidgetItem(checkDCPower.check_type)); //核查类型 + ui->tableWidgetItem->setItem(row, 2, new QTableWidgetItem(checkDCPower.params)); //参数 + ui->tableWidgetItem->setItem(row, 3, new QTableWidgetItem(checkDCPower.unit)); //单位 + ui->tableWidgetItem->setItem(row, 4, new QTableWidgetItem(checkDCPower.datum_point));//基准点 + ui->tableWidgetItem->setItem(row, 5, new QTableWidgetItem(checkDCPower.resolution));//分辨力 + ui->tableWidgetItem->setItem(row, 6, new QTableWidgetItem(checkDCPower.cycle_number));//循环次数 + ui->tableWidgetItem->setItem(row, 7, new QTableWidgetItem(checkDCPower.urel));//urel + ui->tableWidgetItem->setItem(row, 8, new QTableWidgetItem(checkDCPower.resistance_value));//电阻值 + ui->tableWidgetItem->setItem(row, 9, new QTableWidgetItem(checkDCPower.resistance_value_unit));//电阻值单位 + //ui->tableWidget->setItem(row, 0, new QTableWidgetItem(dept.id)); + + //QDebug + row++; + + } +} + + + + + + + + + + + + + + + + + + + + diff --git a/softwareDirectory/AutoVerScheme/standard_deviceitem.h b/softwareDirectory/AutoVerScheme/standard_deviceitem.h index 97f5d2b..b757e67 100644 --- a/softwareDirectory/AutoVerScheme/standard_deviceitem.h +++ b/softwareDirectory/AutoVerScheme/standard_deviceitem.h @@ -20,6 +20,9 @@ void ShowMessageBox(QString title,QString value); //继承父类的Load方法 void Load() override; + void OnButtonSelectClicked(QString id); + void on_pushButton_clicked(); + void DeviceInfoInit(QString id); private: Ui::Standard_DeviceItem *ui; }; diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 3bb55c3..76c04be 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -574,6 +574,6 @@ Version - 22 + 22 diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 deleted file mode 100644 index f11db66..0000000 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user.c08df58 +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - EnvironmentId - {c08df58c-84a7-4965-bca6-e98789474efa} - - - ProjectExplorer.Project.ActiveTarget - 1 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - -fno-delayed-template-parsing - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.14.2 MinGW 32-bit - Desktop Qt 5.14.2 MinGW 32-bit - qt.qt5.5142.win32_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop Qt 5.14.2 MinGW 64-bit - Desktop Qt 5.14.2 MinGW 64-bit - qt.qt5.5142.win64_mingw73_kit - 0 - 0 - 0 - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - C:/Users/admin/Desktop/SVN/software/softwareDirectory/AutoVerScheme/AutoVerScheme.pro - - false - - false - true - true - false - false - true - - D:/Auto_verification_scheme/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 2 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/softwareDirectory/AutoVerScheme/InfoBase.h b/softwareDirectory/AutoVerScheme/InfoBase.h index 82db20e..6dd59f3 100644 --- a/softwareDirectory/AutoVerScheme/InfoBase.h +++ b/softwareDirectory/AutoVerScheme/InfoBase.h @@ -15,6 +15,8 @@ virtual void Load()=0; //QStandardItemModel 的实例。这个模型将用于存储和管理数据。 QStandardItemModel *model; + //信息管理页面 基类定义Conn对象 + DatabaseConnection *Conn=DatabaseConnection::getInstance(); }; #endif // INFOBASE_H diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp index ffb2bbc..d491a6c 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.cpp @@ -1,7 +1,9 @@ #include "beexamined_deviceitem.h" #include "ui_beexamined_deviceitem.h" #include "QMessageBox.h" +#include "tested_device_manage_serve.h" +//被检设备 BeExamined_DeviceItem::BeExamined_DeviceItem(QWidget *parent) : InfoBase(parent), ui(new Ui::BeExamined_DeviceItem) @@ -27,13 +29,13 @@ "background-color:white;" "}"); - ui->tableWidget->setRowCount(10); // 设置10行 + // ui->tableWidget->setRowCount(10); // 设置10行 ui->tableWidget->setColumnCount(12); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + // item->setTextAlignment(Qt::AlignCenter); + //ui->tableWidget->setItem(0, 0, item); //设置数据 //初始化TableWidget 设置列 QStringList headers; @@ -60,5 +62,59 @@ } void BeExamined_DeviceItem::Load() { - //ShowMessageBox("被检设备","被检设备初始化完成"); + //获取主页面内容 + //进入主页面 + /* + ui->stackedWidget->setCurrentIndex(0); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + + // 创建数据库管理器对象 + //BizDeviceManage包含虚方法 指针实例化 + BeExamined_DeviceItem dbManager; + // 调用数据库管理器的函数获取数据 + int rowCount=0; + int row=0; + QList data = dbManager.getBizDeviceManage(); + + + for (const BizDevice& bizDevice : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(bizDevice.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(QString::number(row+1))); + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(bizDevice.equipment_name)); + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(bizDevice.model)); + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(bizDevice.manufacture_no)); + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(bizDevice.manufacturer)); + //添加操作按钮 + QPushButton *button = new QPushButton("查看"); + ui->tableWidget->setCellWidget(row, 6, button); + //设置按钮简单样式 + button->setStyleSheet("QPushButton {" + " border: none; /* 无边框 "*/ + // " color: green; /* 文本颜色 */" + // " text-decoration: underline; /* 文本下划线 */" + // "}"); + + // 设置鼠标悬停时的光标样式为小手图标 + // button->setCursor(Qt::PointingHandCursor); + // 连接按钮的 clicked 信号到自定义槽函数 + // connect(button, &QPushButton::clicked, this, [this, button, row]() { + // 获取当前行第一列的 ID + // QTableWidgetItem *idItem = this->ui->tableWidget->item(row, 0); + // if (idItem) { + // QString id = idItem->text(); +// + // OnButtonSelectClicked(id); + // } + + // }); + + // row++; + + // } + } diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h index ae46979..ffdc22a 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.h @@ -7,7 +7,7 @@ namespace Ui { class BeExamined_DeviceItem; } - +//被检设备管理界面 class BeExamined_DeviceItem : public InfoBase { Q_OBJECT @@ -21,6 +21,7 @@ void ShowMessageBox(QString title,QString value); //继承父类的Load方法 void Load() override; + private: Ui::BeExamined_DeviceItem *ui; }; diff --git a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui index 5a0a3c9..ce63879 100644 --- a/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui +++ b/softwareDirectory/AutoVerScheme/beexamined_deviceitem.ui @@ -6,233 +6,959 @@ 0 0 - 1291 - 575 + 1432 + 571 Form - + + + 0 + + + 0 + + + 0 + + + 0 + - - - - 0 - 0 - - + - background-color:white; + - - + + 0 - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 设备名称: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 型号规则: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 出厂编号: - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 生产厂家: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用部门: - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - 使用单位: - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - Qt::RightToLeft - - - 查询 - - - - - - - Qt::RightToLeft - - - 重置 - - - - - - - - - - background-color:white; - - - - - - - - - - - - - - - - + + + + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 设备名称: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 型号规则: + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 出厂编号: + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 生产厂家: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + 使用单位: + + + + + + + + 180 + 0 + + + + + 200 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::RightToLeft + + + 查询 + + + + + + + Qt::RightToLeft + + + 重置 + + + + + + + + + + background-color:white; + + + + + + + + + + + + + + + + + + + + + + + color:black; + + + + + + + 0 + 0 + + + + background-color:white; + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 20 + + + + + + + + Qt::Horizontal + + + + 60 + 20 + + + + + + + + Font-size:25px; + + + 查看设备信息 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 30 + 30 + + + + Qt::RightToLeft + + + background-color:grey; +color:white; + + + 返回 + + + + + + + + + + background-color:white; + + + + + + + + + background-color:white; + + + + + + + + + 设备基本信息: + + + + + + + 设备名称: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 型号规格: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 出厂编号: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定有效期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产国家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产厂家: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 生产日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 购进日期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用年限: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备单价: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 使用状态: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 质量状况: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 所属部门: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 负责人: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备供方: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 位置信息: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 标准类型: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 设备分类: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 重要等级: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 检定周期: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 对应开箱记录: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + + + + + 备注: + + + + + + + ForbiddenCursor + + + background-color: #f0f0f0; +color: grey; + + + XXX + + + 2 + + + false + + + Qt::LogicalMoveStyle + + + + + + + + + + + + + + + + 核查项目及核查点: + + + + + + + + + + + + + + 0 + 0 + + + + + 30 + 0 + + + + + + + + + + false + + + + 6 + + + 0 + + + 0 + + + 0 + + + 6 + + + + + 检定项备注: + + + + + + + background-color: #f0f0f0; +color: grey; + + + + + + + + + + + diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp index 60486b4..f3b11e5 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.cpp @@ -4,12 +4,17 @@ { } +BizDeviceManage::~BizDeviceManage() +{ + +} QListBizDeviceManage::getBizDeviceManage() { QList result; QSqlQuery query; - query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer FROM biz_equipment_info bei"); - if (query.exec()) { + bool IsSucc= query.exec("SELECT bei.id ,bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.manufacturer" + " FROM biz_equipment_info bei"); + if (IsSucc) { while (query.next()) { BizDevice device; device.id = query.value("id").toString(); @@ -28,18 +33,21 @@ QListBizDeviceManage::getCatDeviceInfor(QString id) { QList result; + + QSqlQuery query; - query.exec("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," + + query.prepare("SELECT bei.equipment_name ,bei.model ,bei.manufacture_no ,bei.measure_valid_date ," "bei.product_country , bei.manufacturer , bei.produce_date, bei.purchase_date ,bei.unit_price , bei.usage_status , bei.quality_status , " "bei.dept_name , bei.director_name , bei.supplier_name , bei.location , bei.type , bei.standard_type , bei.category , bei.level , " "bei.measure_cycle , bei.unpack_record_name , bei.remark FROM biz_equipment_info bei WHERE bei.id = :id"); - // 将参数绑定到占位符 + //将参数绑定到占位符 query.bindValue(":id", id); if (query.exec()) { while (query.next()) { CatDeviceInfor device; - device.equipment_name = query.value("equipment_name").toString(); - device.model = query.value("model").toString(); + device.equipment_name = query.value("equipment_name").toString(); + device.model = query.value("model").toString(); device.manufacture_no = query.value("manufacture_no").toString(); device.measure_valid_date = query.value("measure_valid_date").toString(); device.product_country = query.value("product_country").toString(); @@ -73,13 +81,15 @@ - //直流稳压电源检定装置 -QListBizDeviceManage::getCheckDCPower(QString item_category_id) +//直流稳压电源检定装置 +QListBizDeviceManage::getCheckDCPower(QString item_category_id,QStringList *headList) { + item_category_id="直流稳压电源检定装置";//为获得测试数据 QList result; QSqlQuery query; - query.exec("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" - ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id))"); + query.prepare("SELECT besciddp.id ,besciddp.params,besciddp.unit,resolution,besciddp.urel,besciddp.check_type,datum_point,cycle_number" + ", datum_point, resistance_value, resistance_value_unit, remark FROM biz_equipment_standard_check_item_data_dc_power besciddp " + "WHERE item_category_id = (SELECT bescic.id FROM biz_equipment_standard_check_item_category bescic WHERE bescic.belong_standard_equipment_name = :item_category_id)"); // 将参数绑定到占位符 query.bindValue(":item_category_id", item_category_id); if (query.exec()) { @@ -99,19 +109,24 @@ checkDCPower.remark = query.value("remark").toString(); result.append(checkDCPower); + } + } else { qDebug() << "Query execution failed: " << query.lastError().text(); } + *headList << "序号" << "核查类型" << "参数"<< "单位" + << "基准点" << "分辨率" << "循环次数" << "Urel" + << "电阻值" << "电阻值单位"; return result; } //根据id获取装置名称 -QString BizDeviceManage::getApparatus(QString id) const +QString BizDeviceManage::getApparatus(QString id) { QString result; QSqlQuery query; - query.exec("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " + query.prepare("SELECT besi.standard_name FROM biz_equipment_standard_info besi WHERE besi.id = ( " "SELECT bei.meter_standard_id FROM biz_equipment_info bei WHERE bei.id = :id )"); // 将参数绑定到占位符 query.bindValue(":id", id); @@ -124,4 +139,5 @@ result = "Not Found"; } return result; + //if(result=="直流稳压电源检定装置")//根据判断进入不同的函数 } diff --git a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h index 6c95bed..71d7437 100644 --- a/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h +++ b/softwareDirectory/AutoVerScheme/biz_device_manage_serve.h @@ -5,6 +5,8 @@ #include #include #include "QList" + +//OStringList //标准设备管理 class BizDevice { @@ -65,10 +67,11 @@ { public: BizDeviceManage(); + ~BizDeviceManage(); QListgetBizDeviceManage(); QListgetCatDeviceInfor(QString id); - virtual QString getApparatus(QString id) const = 0; - QListgetCheckDCPower(QString item_category_id); + QString getApparatus(QString id); + QListgetCheckDCPower(QString item_category_id,QStringList *headList); }; #endif // BIZDEVICEMANAGE_H diff --git a/softwareDirectory/AutoVerScheme/databaseconnection.cpp b/softwareDirectory/AutoVerScheme/databaseconnection.cpp index 64ed567..e74cf5e 100644 --- a/softwareDirectory/AutoVerScheme/databaseconnection.cpp +++ b/softwareDirectory/AutoVerScheme/databaseconnection.cpp @@ -24,6 +24,9 @@ bool DatabaseConnection::open() { return db.open(); } +bool DatabaseConnection::isopen() { + return db.isOpen(); +} void DatabaseConnection::close() { db.close(); diff --git a/softwareDirectory/AutoVerScheme/databaseconnection.h b/softwareDirectory/AutoVerScheme/databaseconnection.h index 98c4b6d..586b794 100644 --- a/softwareDirectory/AutoVerScheme/databaseconnection.h +++ b/softwareDirectory/AutoVerScheme/databaseconnection.h @@ -15,6 +15,7 @@ DatabaseConnection(); ~DatabaseConnection(); bool open(); + bool isopen(); void close(); QSqlDatabase& getDatabase(); private: diff --git a/softwareDirectory/AutoVerScheme/depar_task.cpp b/softwareDirectory/AutoVerScheme/depar_task.cpp index 2e9af28..5b5c3ef 100644 --- a/softwareDirectory/AutoVerScheme/depar_task.cpp +++ b/softwareDirectory/AutoVerScheme/depar_task.cpp @@ -36,9 +36,9 @@ ui->tableWidget->setColumnCount(10); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); //文件居中 - ui->tableWidget->setItem(0, 0, item); //设置数据 + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + //item->setTextAlignment(Qt::AlignCenter); //文件居中 + //ui->tableWidget->setItem(0, 0, item); //设置数据 // 设置选择行为为选择整行 ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); //初始化TableWidget 设置列 @@ -69,6 +69,8 @@ } void Depar_Task::Load() { + //先设置为行为0 + ui->tableWidget->setRowCount(0); //查询部门任务 获取DatabaseConnection对象 //DatabaseConnection *Conn=DatabaseConnection::getInstance(); //QSqlQuery query(Conn->getDatabase()); @@ -83,11 +85,8 @@ QString State; for (const Dept& dept : data) { rowCount = ui->tableWidget->rowCount(); - if(row==273) - { - } - ui->tableWidget->insertRow(rowCount); + ui->tableWidget->insertRow(rowCount); ui->tableWidget->setItem(row, 0, new QTableWidgetItem(QString::number(row+1))); //ui->tableWidget->setItem(row, 0, new QTableWidgetItem(dept.id)); diff --git a/softwareDirectory/AutoVerScheme/main.cpp b/softwareDirectory/AutoVerScheme/main.cpp index 7204a9c..714f89d 100644 --- a/softwareDirectory/AutoVerScheme/main.cpp +++ b/softwareDirectory/AutoVerScheme/main.cpp @@ -13,7 +13,7 @@ { QApplication a(argc, argv); // 加载外部的CSS文件 - a.setStyleSheet("file:///path/to/styles.css"); + //a.setStyleSheet("file:///path/to/styles.css"); //设置字体 QFont font; font.setFamily("Microsoft Yahei"); diff --git a/softwareDirectory/AutoVerScheme/my_task.cpp b/softwareDirectory/AutoVerScheme/my_task.cpp index 559a73b..12b0bcc 100644 --- a/softwareDirectory/AutoVerScheme/my_task.cpp +++ b/softwareDirectory/AutoVerScheme/my_task.cpp @@ -1,6 +1,7 @@ #include "my_task.h" #include "ui_my_task.h" #include "QMessageBox" +#include "my_tasks_serve.h" My_Task::My_Task(QWidget *parent) : InfoBase(parent), @@ -60,5 +61,40 @@ } void My_Task::Load() { - //ShowMessageBox("我的任务页面","我的任务初始化完成"); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + MyTasks dbManager; + // 调用数据库管理器的函数获取数据 + //模拟用户ID + QString userId="1640229293790650370"; + QList data = dbManager.getMyTasks(userId); + + int rowCount = 0; + int row=0; + QString State; + for (const MyTask& myTask : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(QString::number(row+1))); + + //ui->tableWidget->setItem(row, 0, new QTableWidgetItem(dept.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(myTask.sample_name)); //设置数据 + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(myTask.sample_model)); //设置数据 + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(myTask.help_instruction)); //设置数据 + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(myTask.manufacture_no)); //设置数据 + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(myTask.manufacturer)); //设置数据 + ui->tableWidget->setItem(row, 6, new QTableWidgetItem(myTask.customer_name)); //设置数据 + ui->tableWidget->setItem(row, 7, new QTableWidgetItem(myTask.FULL_NAME)); //设置数据 + ui->tableWidget->setItem(row, 8, new QTableWidgetItem(myTask.require_over_time)); //设置数据 + if(myTask.is_urgent=="1") + State="是"; + else + State="否"; + ui->tableWidget->setItem(row, 9, new QTableWidgetItem(State)); //设置数据 + //QDebug + row++; + + } } diff --git a/softwareDirectory/AutoVerScheme/my_tasks_serve.cpp b/softwareDirectory/AutoVerScheme/my_tasks_serve.cpp index 05c2ac4..9e54318 100644 --- a/softwareDirectory/AutoVerScheme/my_tasks_serve.cpp +++ b/softwareDirectory/AutoVerScheme/my_tasks_serve.cpp @@ -7,7 +7,7 @@ QList MyTasks::getMyTasks(QString id){ QList result; QSqlQuery query; - query.exec("SELECT " + query.prepare("SELECT " "bi.id, br.sample_name, br.sample_model, ei.help_instruction, ei.manufacture_no," "ei.manufacturer, bi.customer_name," "dept.FULL_NAME, bi.require_over_time," diff --git a/softwareDirectory/AutoVerScheme/standard_deviceitem.cpp b/softwareDirectory/AutoVerScheme/standard_deviceitem.cpp index d1a6a80..d51bdea 100644 --- a/softwareDirectory/AutoVerScheme/standard_deviceitem.cpp +++ b/softwareDirectory/AutoVerScheme/standard_deviceitem.cpp @@ -2,7 +2,10 @@ #include "ui_standard_deviceitem.h" #include "InfoBase.h" #include "QMessageBox" +#include "biz_device_manage_serve.h" + +//标准设备管理 .cpp Standard_DeviceItem::Standard_DeviceItem(QWidget *parent) : InfoBase(parent), ui(new Ui::Standard_DeviceItem) @@ -17,7 +20,8 @@ } void Standard_DeviceItem::initForm() { - //tableWidget设置 + +//主页面tableWidget设置 //设置控件的边框显示 ui->tableWidget->setStyleSheet("QHeaderView::section {" "border: 1px solid rgba(197, 196, 196, 1);" @@ -26,19 +30,41 @@ "background-color:white;" "}"); - ui->tableWidget->setRowCount(10); // 设置10行 - ui->tableWidget->setColumnCount(6); // 设置11列 + // ui->tableWidget->setRowCount(10); // 设置10行 + ui->tableWidget->setColumnCount(7); // 设置11列 ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头 - QTableWidgetItem *item = new QTableWidgetItem("测试数据"); - item->setTextAlignment(Qt::AlignCenter); - ui->tableWidget->setItem(0, 0, item); //设置数据 - + //QTableWidgetItem *item = new QTableWidgetItem("测试数据"); + //item->setTextAlignment(Qt::AlignCenter); + //ui->tableWidget->setItem(0, 0, item); //设置数据 + ui->tableWidget->setColumnWidth(0, 0); // 设置第一列的宽度为0 //初始化TableWidget 设置列 QStringList headers; - headers << "序号" << "设备名称" << "型号规则" << "出厂编号" + headers << "ID"<< "序号" << "设备名称" << "型号规则" << "出厂编号" << "生产厂家" <<"操作"; + ui->tableWidget->setHorizontalHeaderLabels(headers); + +//详情页面tableWidgetItem设置 + ui->tableWidgetItem->setStyleSheet("QHeaderView::section {" + "border: 1px solid rgba(197, 196, 196, 1);" + "border-left:none;" + "border-top:none;" + "background-color:white;" + "}"); + + // ui->tableWidget->setRowCount(10); // 设置10行 + //ui->tableWidgetItem->setColumnCount(14); // 设置11列 + ui->tableWidgetItem->setColumnWidth(0, 80); // 设置第一列的宽度为100像素 + ui->tableWidgetItem->verticalHeader()->setParent(nullptr); //隐藏行头 + + //初始化TableWidget 设置列 + //QStringList headersItem; + //headersItem << "序号" << "核查类型" << "检测类型" << "参数"<< "单位" + // << "频率" << "核查点" << "分辨力" << "循环次数" << "Urel" + // << "通道" << "TFER" << "DCCP" << "FLIT"; + + //ui->tableWidgetItem->setHorizontalHeaderLabels(headersItem); } void Standard_DeviceItem::ShowMessageBox(QString title,QString value) { // 创建一个QMessageBox对象 @@ -58,5 +84,170 @@ } void Standard_DeviceItem::Load() { - //ShowMessageBox("标准管理","标准管理初始化完成"); + //获取主页面内容 + //进入主页面 + ui->stackedWidget->setCurrentIndex(0); + //先设置为行为0 + ui->tableWidget->setRowCount(0); + + // 创建数据库管理器对象 + //BizDeviceManage包含虚方法 指针实例化 + BizDeviceManage dbManager; + // 调用数据库管理器的函数获取数据 + int rowCount=0; + int row=0; + QList data = dbManager.getBizDeviceManage(); + + + for (const BizDevice& bizDevice : data) { + rowCount = ui->tableWidget->rowCount(); + + ui->tableWidget->insertRow(rowCount); + ui->tableWidget->setItem(row, 0, new QTableWidgetItem(bizDevice.id)); + ui->tableWidget->setItem(row, 1, new QTableWidgetItem(QString::number(row+1))); + ui->tableWidget->setItem(row, 2, new QTableWidgetItem(bizDevice.equipment_name)); + ui->tableWidget->setItem(row, 3, new QTableWidgetItem(bizDevice.model)); + ui->tableWidget->setItem(row, 4, new QTableWidgetItem(bizDevice.manufacture_no)); + ui->tableWidget->setItem(row, 5, new QTableWidgetItem(bizDevice.manufacturer)); + //添加操作按钮 + QPushButton *button = new QPushButton("查看"); + ui->tableWidget->setCellWidget(row, 6, button); + //设置按钮简单样式 + button->setStyleSheet("QPushButton {" + " border: none; /* 无边框 */" + " color: green; /* 文本颜色 */" + " text-decoration: underline; /* 文本下划线 */" + "}"); + + // 设置鼠标悬停时的光标样式为小手图标 + button->setCursor(Qt::PointingHandCursor); + // 连接按钮的 clicked 信号到自定义槽函数 + connect(button, &QPushButton::clicked, this, [this, button, row]() { + // 获取当前行第一列的 ID + QTableWidgetItem *idItem = this->ui->tableWidget->item(row, 0); + if (idItem) { + QString id = idItem->text(); + + OnButtonSelectClicked(id); + } + + }); + + row++; + } + } +void Standard_DeviceItem::OnButtonSelectClicked(QString id) +{ + //添加 + //设备信息页面 初始化方法 + DeviceInfoInit(id); + ui->stackedWidget->setCurrentIndex(1); + QMessageBox::information(this, "ID",id); +} +//返回按钮 +void Standard_DeviceItem::on_pushButton_clicked() +{ + ui->stackedWidget->setCurrentIndex(0); +} +void Standard_DeviceItem::DeviceInfoInit(QString id) +{ + + + BizDeviceManage dbManager; + QList data = dbManager.getCatDeviceInfor(id); + // 获取当前日期 使用年限=当前日期减去购进日期 + QDate currentDate = QDate::currentDate(); + QDate purchase_date; + + int yearsDiff ; + + // 定义日期的格式,这里假设是"yyyy-MM-dd" + QString format = "yyyy-MM-dd"; + //解析数据 + for (const CatDeviceInfor& catDeviceInfor : data) { + ui->equipment_name->setText(catDeviceInfor.equipment_name); + ui->model->setText(catDeviceInfor.model); + ui->manufacture_no->setText(catDeviceInfor.manufacture_no); + ui->measure_valid_date->setText(catDeviceInfor.measure_valid_date); + ui->product_country->setText(catDeviceInfor.product_country); + ui->manufacturer->setText(catDeviceInfor.manufacturer); + ui->produce_date->setText(catDeviceInfor.produce_date); + ui->purchase_date->setText(catDeviceInfor.purchase_date); + ui->unit_price->setText(catDeviceInfor.unit_price); + ui->usage_status->setText(catDeviceInfor.usage_status); + ui->quality_status->setText(catDeviceInfor.quality_status); + ui->dept_name->setText(catDeviceInfor.dept_name); + ui->director_name->setText(catDeviceInfor.director_name); + ui->supplier_name->setText(catDeviceInfor.supplier_name); + ui->location->setText(catDeviceInfor.location); + ui->type->setText(catDeviceInfor.type); + ui->standard_type->setText(catDeviceInfor.standard_type); + ui->category->setText(catDeviceInfor.category); + ui->level->setText(catDeviceInfor.level); + ui->measure_cycle->setText(catDeviceInfor.measure_cycle); + ui->unpack_record_name->setText(catDeviceInfor.unpack_record_name); + ui->remark->setText(catDeviceInfor.remark); + + //将catDeviceInfor.purchase_date转为Qdate类型 + purchase_date=QDate::fromString(catDeviceInfor.purchase_date,format); + //计算天数差 + yearsDiff=purchase_date.daysTo(currentDate) /365; + //使用年限 + ui->DurableYears->setText(QString::number(yearsDiff)); + } + + + //获取核查点tablewight的数据 + QStringList headlist; + QString DeviceName = dbManager.getApparatus(id); + QList bizDeviceManageData=dbManager.getCheckDCPower(DeviceName,&headlist); + //设置tablewight + ui->tableWidgetItem->setRowCount(0); + ui->tableWidgetItem->setColumnCount(headlist.count()); + ui->tableWidgetItem->setHorizontalHeaderLabels(headlist); + //循环数据 + int rowCount=0; + int row=0; + + for (const CheckDCPower& checkDCPower : bizDeviceManageData) + { + rowCount = ui->tableWidgetItem->rowCount(); + ui->tableWidgetItem->insertRow(rowCount); + ui->tableWidgetItem->setItem(row, 0, new QTableWidgetItem(QString::number(row+1))); + ui->tableWidgetItem->setItem(row, 1, new QTableWidgetItem(checkDCPower.check_type)); //核查类型 + ui->tableWidgetItem->setItem(row, 2, new QTableWidgetItem(checkDCPower.params)); //参数 + ui->tableWidgetItem->setItem(row, 3, new QTableWidgetItem(checkDCPower.unit)); //单位 + ui->tableWidgetItem->setItem(row, 4, new QTableWidgetItem(checkDCPower.datum_point));//基准点 + ui->tableWidgetItem->setItem(row, 5, new QTableWidgetItem(checkDCPower.resolution));//分辨力 + ui->tableWidgetItem->setItem(row, 6, new QTableWidgetItem(checkDCPower.cycle_number));//循环次数 + ui->tableWidgetItem->setItem(row, 7, new QTableWidgetItem(checkDCPower.urel));//urel + ui->tableWidgetItem->setItem(row, 8, new QTableWidgetItem(checkDCPower.resistance_value));//电阻值 + ui->tableWidgetItem->setItem(row, 9, new QTableWidgetItem(checkDCPower.resistance_value_unit));//电阻值单位 + //ui->tableWidget->setItem(row, 0, new QTableWidgetItem(dept.id)); + + //QDebug + row++; + + } +} + + + + + + + + + + + + + + + + + + + + diff --git a/softwareDirectory/AutoVerScheme/standard_deviceitem.h b/softwareDirectory/AutoVerScheme/standard_deviceitem.h index 97f5d2b..b757e67 100644 --- a/softwareDirectory/AutoVerScheme/standard_deviceitem.h +++ b/softwareDirectory/AutoVerScheme/standard_deviceitem.h @@ -20,6 +20,9 @@ void ShowMessageBox(QString title,QString value); //继承父类的Load方法 void Load() override; + void OnButtonSelectClicked(QString id); + void on_pushButton_clicked(); + void DeviceInfoInit(QString id); private: Ui::Standard_DeviceItem *ui; }; diff --git a/softwareDirectory/AutoVerScheme/standard_deviceitem.ui b/softwareDirectory/AutoVerScheme/standard_deviceitem.ui index b2b278e..86486ca 100644 --- a/softwareDirectory/AutoVerScheme/standard_deviceitem.ui +++ b/softwareDirectory/AutoVerScheme/standard_deviceitem.ui @@ -74,6 +74,9 @@ + + + @@ -93,6 +96,9 @@ + + + @@ -112,6 +118,16 @@ + + + + 0 + 0 + + + + + @@ -131,22 +147,6 @@ - - - - - - - - - - 0 - 0 - - - - - @@ -229,6 +229,12 @@ + + + 0 + 0 + + background-color:white; @@ -327,13 +333,6 @@ - - - 核查项目及核查点: - - - - background-color:white; @@ -357,7 +356,7 @@ - + ForbiddenCursor @@ -373,12 +372,12 @@ - 设备名称: + 型号规格: - + ForbiddenCursor @@ -394,12 +393,12 @@ - 设备名称: + 出厂编号: - + ForbiddenCursor @@ -415,12 +414,12 @@ - 设备名称: + 检定有效期: - + ForbiddenCursor @@ -436,12 +435,12 @@ - 设备名称: + 生产国家: - + ForbiddenCursor @@ -457,12 +456,12 @@ - 设备名称: + 生产厂家: - + ForbiddenCursor @@ -478,12 +477,12 @@ - 设备名称: + 生产日期: - + ForbiddenCursor @@ -499,12 +498,12 @@ - 设备名称: + 购进日期: - + ForbiddenCursor @@ -520,12 +519,12 @@ - 设备名称: + 使用年限: - + ForbiddenCursor @@ -541,12 +540,12 @@ - 设备名称: + 设备单价: - + ForbiddenCursor @@ -562,12 +561,12 @@ - 设备名称: + 使用状态: - + ForbiddenCursor @@ -583,12 +582,12 @@ - 设备名称: + 质量状况: - + ForbiddenCursor @@ -604,12 +603,12 @@ - 设备名称: + 所属部门: - + ForbiddenCursor @@ -625,12 +624,12 @@ - 设备名称: + 负责人: - + ForbiddenCursor @@ -646,12 +645,12 @@ - 设备名称: + 设备供方: - + ForbiddenCursor @@ -667,12 +666,12 @@ - 设备名称: + 位置信息: - + ForbiddenCursor @@ -688,12 +687,12 @@ - 设备名称: + 设备类型: - + ForbiddenCursor @@ -709,12 +708,12 @@ - 设备名称: + 标准类型: - + ForbiddenCursor @@ -730,12 +729,12 @@ - 设备名称: + 设备分类: - + ForbiddenCursor @@ -751,12 +750,12 @@ - 设备名称: + 重要等级: - + ForbiddenCursor @@ -772,12 +771,12 @@ - 设备名称: + 检定周期: - + ForbiddenCursor @@ -793,12 +792,12 @@ - 设备名称: + 对应开箱记录: - + ForbiddenCursor @@ -814,12 +813,12 @@ - 设备名称: + 备注: - - + + ForbiddenCursor @@ -830,47 +829,14 @@ XXX - - - - - - 设备名称: + + 2 - - - - - - ForbiddenCursor + + false - - background-color: #f0f0f0; -color: grey; - - - XXX - - - - - - - 设备名称: - - - - - - - ForbiddenCursor - - - background-color: #f0f0f0; -color: grey; - - - XXX + + Qt::LogicalMoveStyle @@ -878,7 +844,23 @@ - + + + + + + + + + 核查项目及核查点: + + + + + + + + @@ -900,6 +882,9 @@ + + false + 6