diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index 876be07..8e5d8ea 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -5,6 +5,7 @@ #include "basecommonapi.h" #include #include "newcheckmethod.h" +#include "formcheckpoint.h" CheckWindow::CheckWindow(QWidget *parent) : QWidget(parent), @@ -32,6 +33,10 @@ ui->tableWidget_Standard->verticalHeader()->setParent(nullptr); for(int i=0;i<2;i++) ui->tableWidget_Standard->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); + ui->tableWidgetStd->verticalHeader()->setParent(nullptr); //隐藏行头 + for(int i=1;i<7;i++) + ui->tableWidgetStd->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); + ui->tableWidgetStd->setColumnWidth(0, 60); ui->tableWidgetCheck->verticalHeader()->setParent(nullptr); ui->comboBoxName->addItem("ALL"); ui->comboBoxModal->addItem("ALL"); @@ -78,8 +83,7 @@ } } -void CheckWindow::showDevice() -{ +void CheckWindow::showStandard(){ QString sId=""; for(int i=0;itableWidgetMethod->rowCount();i++){ Qt::CheckState state = ui->tableWidgetMethod->item(i,0)->checkState(); @@ -92,17 +96,68 @@ QMessageBox::warning(this, "提示", "请选择检定程序!"); }else{ programInfo = BaseCommonApi::getVerificationProgramInfo(sId); - initDeviceInfo(); + QStringList idList; + int rowCount=0; + int row=0; + ui->tableWidgetStd->clearContents(); + ui->tableWidgetStd->setRowCount(0); + catDeviceList.clear(); + if(programInfo.standard_device_id!=""){ + idList = programInfo.standard_device_id.split(","); + for(const QString& id : idList) + { + QList result = BaseCommonApi::getCatDeviceInfor(id); + if(result.length()>0){ + catDeviceList.append(result[0]); + //更新标准设备表格 + rowCount = ui->tableWidgetStd->rowCount(); + ui->tableWidgetStd->insertRow(rowCount); + QTableWidgetItem* p_check = new QTableWidgetItem(); + p_check->setCheckState(Qt::Unchecked); //设置首列为 CheckBox 控件 + ui->tableWidgetStd->setItem(row,0,p_check); + ui->tableWidgetStd->setItem(row, 1, new QTableWidgetItem(result[0].equipment_name)); + ui->tableWidgetStd->setItem(row, 2, new QTableWidgetItem(result[0].model)); //设置数据 + ui->tableWidgetStd->setItem(row, 3, new QTableWidgetItem(result[0].manufacture_no)); + ui->tableWidgetStd->setItem(row, 4, new QTableWidgetItem(result[0].dept_name)); + ui->tableWidgetStd->setItem(row, 5, new QTableWidgetItem(result[0].director_name)); + ui->tableWidgetStd->setItem(row, 6, new QTableWidgetItem(result[0].measure_valid_date)); + row++; + } + result.clear(); + } + idList.clear(); + } ui->stackedWidget->setCurrentIndex(2); } } -void CheckWindow::initDeviceInfo() +void CheckWindow::showDevice() +{ + QStringList idList = programInfo.standard_device_id.split(","); + QString sId=""; + for(int i=0;itableWidgetStd->rowCount();i++){ + Qt::CheckState state = ui->tableWidgetStd->item(i,0)->checkState(); + if(state == Qt::Checked){ + sId = idList[i]; + break; + } + } + if(sId==""){ + QMessageBox::warning(this, "提示", "请选择标准设备!"); + }else{ + //programInfo = BaseCommonApi::getVerificationProgramInfo(sId); + initDeviceInfo(sId); + ui->stackedWidget->setCurrentIndex(3); + } +} + +void CheckWindow::initDeviceInfo(QString sId) { QString strStyle = QString("QLabel{image:url(%1);}").arg(programInfo.img_path); qDebug() << "strStyle:" << strStyle; ui->label_8->setStyleSheet(strStyle); + ui->tableWidget_3->clearContents(); ui->tableWidget_3->setRowCount(0); ui->tableWidget_Standard->clearContents(); @@ -113,6 +168,10 @@ connectList.clear(); if(selectTaskList.length()>0) { + QList catory = BaseCommonApi::getDeviceMeasureEquipmentCatory(selectTaskList[0].sample_id); + if(catory.length() > 0 ){ + ui->lineEdit_category->setText(catory[0].item_category_name); + } //idList = programInfo.tested_device_id.split(","); for(const Dept& task : selectTaskList) { @@ -136,6 +195,8 @@ idList = programInfo.standard_device_id.split(","); for(const QString& id : idList) { + if(id!=sId) + continue; ConnectInfo info; info.id = id; info.type = 1; @@ -208,7 +269,9 @@ //QStringList headlist; headList.clear(); calibrationList.clear(); - calibrationList =BaseCommonApi::Search_CalibrationTable(deviceId,&headList); + headTableList.clear(); + //calibrationList =BaseCommonApi::Search_CalibrationTable(deviceId,&headList); + caliDataList = BaseCommonApi::Search_CalibrationTableClass(deviceId,&headTableList); //tableWidgetItem ui->tableWidget_Point->clearContents(); @@ -216,18 +279,38 @@ //循环数据 int rowCount=0; int row=0; - for (const QStringList& item : calibrationList) - { - //获取行号 并进行添加行 - rowCount = ui->tableWidget_Point->rowCount(); - ui->tableWidget_Point->insertRow(rowCount); - QTableWidgetItem* p_check = new QTableWidgetItem(); - p_check->setCheckState(Qt::Unchecked); //设置首列为 CheckBox 控件 - ui->tableWidget_Point->setItem(row,0,p_check); - ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(item[8])); - ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); - row++; - } +// for (const QStringList& item : calibrationList) +// { +// //获取行号 并进行添加行 +// rowCount = ui->tableWidget_Point->rowCount(); +// ui->tableWidget_Point->insertRow(rowCount); +// QTableWidgetItem* p_check = new QTableWidgetItem(); +// p_check->setCheckState(Qt::Unchecked); //设置首列为 CheckBox 控件 +// ui->tableWidget_Point->setItem(row,0,p_check); +// ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(item[8])); +// ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); +// row++; +// } + int index=0; + for (const auto &item : headTableList) { + // ======================================================================================== + // 数据循环显示 + // =================================================================================== + const auto &dataRes = caliDataList.value(headTableList.keys()[index]); + //tableWidget->setRowCount(data.count()); + + for (int i = 0; i < dataRes.count(); ++i) { + //获取行号 并进行添加行 + rowCount = ui->tableWidget_Point->rowCount(); + ui->tableWidget_Point->insertRow(rowCount); + if(i==0) + ui->tableWidget_Point->setItem(row, 0, new QTableWidgetItem(dataRes[i][1])); + ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(dataRes[i][5])); + ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); + row++; + } + ++index; + } } ui->stackedWidget_2->setCurrentIndex(1); @@ -482,7 +565,8 @@ void CheckWindow::on_pushButton_9_clicked() { - showDevice(); + //showDevice(); + showStandard(); } void CheckWindow::on_tableWidget_3_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn) @@ -665,3 +749,26 @@ ui->lineEditCreator->setText(""); getCheckMethod(); } + +void CheckWindow::on_pushButton_4_clicked() +{ + +} + +void CheckWindow::on_pushButton_5_clicked() +{ + +} + +void CheckWindow::on_pushButton_6_clicked() +{ + showDevice(); +} + +void CheckWindow::on_pushButton_7_clicked() +{ + FormCheckPoint *checkWindow = new FormCheckPoint(nullptr,selectTaskList[0].sample_id); + checkWindow->setWindowState(Qt::WindowMaximized); + checkWindow->setWindowModality(Qt::ApplicationModal); + checkWindow->show(); +} diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index 876be07..8e5d8ea 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -5,6 +5,7 @@ #include "basecommonapi.h" #include #include "newcheckmethod.h" +#include "formcheckpoint.h" CheckWindow::CheckWindow(QWidget *parent) : QWidget(parent), @@ -32,6 +33,10 @@ ui->tableWidget_Standard->verticalHeader()->setParent(nullptr); for(int i=0;i<2;i++) ui->tableWidget_Standard->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); + ui->tableWidgetStd->verticalHeader()->setParent(nullptr); //隐藏行头 + for(int i=1;i<7;i++) + ui->tableWidgetStd->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); + ui->tableWidgetStd->setColumnWidth(0, 60); ui->tableWidgetCheck->verticalHeader()->setParent(nullptr); ui->comboBoxName->addItem("ALL"); ui->comboBoxModal->addItem("ALL"); @@ -78,8 +83,7 @@ } } -void CheckWindow::showDevice() -{ +void CheckWindow::showStandard(){ QString sId=""; for(int i=0;itableWidgetMethod->rowCount();i++){ Qt::CheckState state = ui->tableWidgetMethod->item(i,0)->checkState(); @@ -92,17 +96,68 @@ QMessageBox::warning(this, "提示", "请选择检定程序!"); }else{ programInfo = BaseCommonApi::getVerificationProgramInfo(sId); - initDeviceInfo(); + QStringList idList; + int rowCount=0; + int row=0; + ui->tableWidgetStd->clearContents(); + ui->tableWidgetStd->setRowCount(0); + catDeviceList.clear(); + if(programInfo.standard_device_id!=""){ + idList = programInfo.standard_device_id.split(","); + for(const QString& id : idList) + { + QList result = BaseCommonApi::getCatDeviceInfor(id); + if(result.length()>0){ + catDeviceList.append(result[0]); + //更新标准设备表格 + rowCount = ui->tableWidgetStd->rowCount(); + ui->tableWidgetStd->insertRow(rowCount); + QTableWidgetItem* p_check = new QTableWidgetItem(); + p_check->setCheckState(Qt::Unchecked); //设置首列为 CheckBox 控件 + ui->tableWidgetStd->setItem(row,0,p_check); + ui->tableWidgetStd->setItem(row, 1, new QTableWidgetItem(result[0].equipment_name)); + ui->tableWidgetStd->setItem(row, 2, new QTableWidgetItem(result[0].model)); //设置数据 + ui->tableWidgetStd->setItem(row, 3, new QTableWidgetItem(result[0].manufacture_no)); + ui->tableWidgetStd->setItem(row, 4, new QTableWidgetItem(result[0].dept_name)); + ui->tableWidgetStd->setItem(row, 5, new QTableWidgetItem(result[0].director_name)); + ui->tableWidgetStd->setItem(row, 6, new QTableWidgetItem(result[0].measure_valid_date)); + row++; + } + result.clear(); + } + idList.clear(); + } ui->stackedWidget->setCurrentIndex(2); } } -void CheckWindow::initDeviceInfo() +void CheckWindow::showDevice() +{ + QStringList idList = programInfo.standard_device_id.split(","); + QString sId=""; + for(int i=0;itableWidgetStd->rowCount();i++){ + Qt::CheckState state = ui->tableWidgetStd->item(i,0)->checkState(); + if(state == Qt::Checked){ + sId = idList[i]; + break; + } + } + if(sId==""){ + QMessageBox::warning(this, "提示", "请选择标准设备!"); + }else{ + //programInfo = BaseCommonApi::getVerificationProgramInfo(sId); + initDeviceInfo(sId); + ui->stackedWidget->setCurrentIndex(3); + } +} + +void CheckWindow::initDeviceInfo(QString sId) { QString strStyle = QString("QLabel{image:url(%1);}").arg(programInfo.img_path); qDebug() << "strStyle:" << strStyle; ui->label_8->setStyleSheet(strStyle); + ui->tableWidget_3->clearContents(); ui->tableWidget_3->setRowCount(0); ui->tableWidget_Standard->clearContents(); @@ -113,6 +168,10 @@ connectList.clear(); if(selectTaskList.length()>0) { + QList catory = BaseCommonApi::getDeviceMeasureEquipmentCatory(selectTaskList[0].sample_id); + if(catory.length() > 0 ){ + ui->lineEdit_category->setText(catory[0].item_category_name); + } //idList = programInfo.tested_device_id.split(","); for(const Dept& task : selectTaskList) { @@ -136,6 +195,8 @@ idList = programInfo.standard_device_id.split(","); for(const QString& id : idList) { + if(id!=sId) + continue; ConnectInfo info; info.id = id; info.type = 1; @@ -208,7 +269,9 @@ //QStringList headlist; headList.clear(); calibrationList.clear(); - calibrationList =BaseCommonApi::Search_CalibrationTable(deviceId,&headList); + headTableList.clear(); + //calibrationList =BaseCommonApi::Search_CalibrationTable(deviceId,&headList); + caliDataList = BaseCommonApi::Search_CalibrationTableClass(deviceId,&headTableList); //tableWidgetItem ui->tableWidget_Point->clearContents(); @@ -216,18 +279,38 @@ //循环数据 int rowCount=0; int row=0; - for (const QStringList& item : calibrationList) - { - //获取行号 并进行添加行 - rowCount = ui->tableWidget_Point->rowCount(); - ui->tableWidget_Point->insertRow(rowCount); - QTableWidgetItem* p_check = new QTableWidgetItem(); - p_check->setCheckState(Qt::Unchecked); //设置首列为 CheckBox 控件 - ui->tableWidget_Point->setItem(row,0,p_check); - ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(item[8])); - ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); - row++; - } +// for (const QStringList& item : calibrationList) +// { +// //获取行号 并进行添加行 +// rowCount = ui->tableWidget_Point->rowCount(); +// ui->tableWidget_Point->insertRow(rowCount); +// QTableWidgetItem* p_check = new QTableWidgetItem(); +// p_check->setCheckState(Qt::Unchecked); //设置首列为 CheckBox 控件 +// ui->tableWidget_Point->setItem(row,0,p_check); +// ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(item[8])); +// ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); +// row++; +// } + int index=0; + for (const auto &item : headTableList) { + // ======================================================================================== + // 数据循环显示 + // =================================================================================== + const auto &dataRes = caliDataList.value(headTableList.keys()[index]); + //tableWidget->setRowCount(data.count()); + + for (int i = 0; i < dataRes.count(); ++i) { + //获取行号 并进行添加行 + rowCount = ui->tableWidget_Point->rowCount(); + ui->tableWidget_Point->insertRow(rowCount); + if(i==0) + ui->tableWidget_Point->setItem(row, 0, new QTableWidgetItem(dataRes[i][1])); + ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(dataRes[i][5])); + ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); + row++; + } + ++index; + } } ui->stackedWidget_2->setCurrentIndex(1); @@ -482,7 +565,8 @@ void CheckWindow::on_pushButton_9_clicked() { - showDevice(); + //showDevice(); + showStandard(); } void CheckWindow::on_tableWidget_3_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn) @@ -665,3 +749,26 @@ ui->lineEditCreator->setText(""); getCheckMethod(); } + +void CheckWindow::on_pushButton_4_clicked() +{ + +} + +void CheckWindow::on_pushButton_5_clicked() +{ + +} + +void CheckWindow::on_pushButton_6_clicked() +{ + showDevice(); +} + +void CheckWindow::on_pushButton_7_clicked() +{ + FormCheckPoint *checkWindow = new FormCheckPoint(nullptr,selectTaskList[0].sample_id); + checkWindow->setWindowState(Qt::WindowMaximized); + checkWindow->setWindowModality(Qt::ApplicationModal); + checkWindow->show(); +} diff --git a/softwareDirectory/AutoVerScheme/checkwindow.h b/softwareDirectory/AutoVerScheme/checkwindow.h index 7b5cba0..2655417 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.h +++ b/softwareDirectory/AutoVerScheme/checkwindow.h @@ -55,16 +55,25 @@ void on_pushButton_11_clicked(); + void on_pushButton_4_clicked(); + + void on_pushButton_5_clicked(); + + void on_pushButton_6_clicked(); + + void on_pushButton_7_clicked(); + private: void getCheckDevice(bool bInit=true); void getCheckMethod(); - void initDeviceInfo(); + void initDeviceInfo(QString sId); void deleteItem(QLayout *layout); void initCheckTable(); InstructionLib* getCmdByCheckName(int idx,QString name); void Delay_MSec(unsigned int msec); void SetHomePaheCombox(Dept task); bool comboBoxContainsItem(QComboBox *comboBox, const QString &itemText); + void showStandard(); private: Ui::CheckWindow *ui; QList programList; @@ -78,6 +87,9 @@ VisaCommonEngine standardEngine; QList measureCalList; SaveDeviceMeasureInfo measureInfo; + QMap> caliDataList; + QMap headTableList; + QList catDeviceList; }; #endif // CHECKWINDOW_H diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index 876be07..8e5d8ea 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -5,6 +5,7 @@ #include "basecommonapi.h" #include #include "newcheckmethod.h" +#include "formcheckpoint.h" CheckWindow::CheckWindow(QWidget *parent) : QWidget(parent), @@ -32,6 +33,10 @@ ui->tableWidget_Standard->verticalHeader()->setParent(nullptr); for(int i=0;i<2;i++) ui->tableWidget_Standard->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); + ui->tableWidgetStd->verticalHeader()->setParent(nullptr); //隐藏行头 + for(int i=1;i<7;i++) + ui->tableWidgetStd->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); + ui->tableWidgetStd->setColumnWidth(0, 60); ui->tableWidgetCheck->verticalHeader()->setParent(nullptr); ui->comboBoxName->addItem("ALL"); ui->comboBoxModal->addItem("ALL"); @@ -78,8 +83,7 @@ } } -void CheckWindow::showDevice() -{ +void CheckWindow::showStandard(){ QString sId=""; for(int i=0;itableWidgetMethod->rowCount();i++){ Qt::CheckState state = ui->tableWidgetMethod->item(i,0)->checkState(); @@ -92,17 +96,68 @@ QMessageBox::warning(this, "提示", "请选择检定程序!"); }else{ programInfo = BaseCommonApi::getVerificationProgramInfo(sId); - initDeviceInfo(); + QStringList idList; + int rowCount=0; + int row=0; + ui->tableWidgetStd->clearContents(); + ui->tableWidgetStd->setRowCount(0); + catDeviceList.clear(); + if(programInfo.standard_device_id!=""){ + idList = programInfo.standard_device_id.split(","); + for(const QString& id : idList) + { + QList result = BaseCommonApi::getCatDeviceInfor(id); + if(result.length()>0){ + catDeviceList.append(result[0]); + //更新标准设备表格 + rowCount = ui->tableWidgetStd->rowCount(); + ui->tableWidgetStd->insertRow(rowCount); + QTableWidgetItem* p_check = new QTableWidgetItem(); + p_check->setCheckState(Qt::Unchecked); //设置首列为 CheckBox 控件 + ui->tableWidgetStd->setItem(row,0,p_check); + ui->tableWidgetStd->setItem(row, 1, new QTableWidgetItem(result[0].equipment_name)); + ui->tableWidgetStd->setItem(row, 2, new QTableWidgetItem(result[0].model)); //设置数据 + ui->tableWidgetStd->setItem(row, 3, new QTableWidgetItem(result[0].manufacture_no)); + ui->tableWidgetStd->setItem(row, 4, new QTableWidgetItem(result[0].dept_name)); + ui->tableWidgetStd->setItem(row, 5, new QTableWidgetItem(result[0].director_name)); + ui->tableWidgetStd->setItem(row, 6, new QTableWidgetItem(result[0].measure_valid_date)); + row++; + } + result.clear(); + } + idList.clear(); + } ui->stackedWidget->setCurrentIndex(2); } } -void CheckWindow::initDeviceInfo() +void CheckWindow::showDevice() +{ + QStringList idList = programInfo.standard_device_id.split(","); + QString sId=""; + for(int i=0;itableWidgetStd->rowCount();i++){ + Qt::CheckState state = ui->tableWidgetStd->item(i,0)->checkState(); + if(state == Qt::Checked){ + sId = idList[i]; + break; + } + } + if(sId==""){ + QMessageBox::warning(this, "提示", "请选择标准设备!"); + }else{ + //programInfo = BaseCommonApi::getVerificationProgramInfo(sId); + initDeviceInfo(sId); + ui->stackedWidget->setCurrentIndex(3); + } +} + +void CheckWindow::initDeviceInfo(QString sId) { QString strStyle = QString("QLabel{image:url(%1);}").arg(programInfo.img_path); qDebug() << "strStyle:" << strStyle; ui->label_8->setStyleSheet(strStyle); + ui->tableWidget_3->clearContents(); ui->tableWidget_3->setRowCount(0); ui->tableWidget_Standard->clearContents(); @@ -113,6 +168,10 @@ connectList.clear(); if(selectTaskList.length()>0) { + QList catory = BaseCommonApi::getDeviceMeasureEquipmentCatory(selectTaskList[0].sample_id); + if(catory.length() > 0 ){ + ui->lineEdit_category->setText(catory[0].item_category_name); + } //idList = programInfo.tested_device_id.split(","); for(const Dept& task : selectTaskList) { @@ -136,6 +195,8 @@ idList = programInfo.standard_device_id.split(","); for(const QString& id : idList) { + if(id!=sId) + continue; ConnectInfo info; info.id = id; info.type = 1; @@ -208,7 +269,9 @@ //QStringList headlist; headList.clear(); calibrationList.clear(); - calibrationList =BaseCommonApi::Search_CalibrationTable(deviceId,&headList); + headTableList.clear(); + //calibrationList =BaseCommonApi::Search_CalibrationTable(deviceId,&headList); + caliDataList = BaseCommonApi::Search_CalibrationTableClass(deviceId,&headTableList); //tableWidgetItem ui->tableWidget_Point->clearContents(); @@ -216,18 +279,38 @@ //循环数据 int rowCount=0; int row=0; - for (const QStringList& item : calibrationList) - { - //获取行号 并进行添加行 - rowCount = ui->tableWidget_Point->rowCount(); - ui->tableWidget_Point->insertRow(rowCount); - QTableWidgetItem* p_check = new QTableWidgetItem(); - p_check->setCheckState(Qt::Unchecked); //设置首列为 CheckBox 控件 - ui->tableWidget_Point->setItem(row,0,p_check); - ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(item[8])); - ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); - row++; - } +// for (const QStringList& item : calibrationList) +// { +// //获取行号 并进行添加行 +// rowCount = ui->tableWidget_Point->rowCount(); +// ui->tableWidget_Point->insertRow(rowCount); +// QTableWidgetItem* p_check = new QTableWidgetItem(); +// p_check->setCheckState(Qt::Unchecked); //设置首列为 CheckBox 控件 +// ui->tableWidget_Point->setItem(row,0,p_check); +// ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(item[8])); +// ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); +// row++; +// } + int index=0; + for (const auto &item : headTableList) { + // ======================================================================================== + // 数据循环显示 + // =================================================================================== + const auto &dataRes = caliDataList.value(headTableList.keys()[index]); + //tableWidget->setRowCount(data.count()); + + for (int i = 0; i < dataRes.count(); ++i) { + //获取行号 并进行添加行 + rowCount = ui->tableWidget_Point->rowCount(); + ui->tableWidget_Point->insertRow(rowCount); + if(i==0) + ui->tableWidget_Point->setItem(row, 0, new QTableWidgetItem(dataRes[i][1])); + ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(dataRes[i][5])); + ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); + row++; + } + ++index; + } } ui->stackedWidget_2->setCurrentIndex(1); @@ -482,7 +565,8 @@ void CheckWindow::on_pushButton_9_clicked() { - showDevice(); + //showDevice(); + showStandard(); } void CheckWindow::on_tableWidget_3_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn) @@ -665,3 +749,26 @@ ui->lineEditCreator->setText(""); getCheckMethod(); } + +void CheckWindow::on_pushButton_4_clicked() +{ + +} + +void CheckWindow::on_pushButton_5_clicked() +{ + +} + +void CheckWindow::on_pushButton_6_clicked() +{ + showDevice(); +} + +void CheckWindow::on_pushButton_7_clicked() +{ + FormCheckPoint *checkWindow = new FormCheckPoint(nullptr,selectTaskList[0].sample_id); + checkWindow->setWindowState(Qt::WindowMaximized); + checkWindow->setWindowModality(Qt::ApplicationModal); + checkWindow->show(); +} diff --git a/softwareDirectory/AutoVerScheme/checkwindow.h b/softwareDirectory/AutoVerScheme/checkwindow.h index 7b5cba0..2655417 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.h +++ b/softwareDirectory/AutoVerScheme/checkwindow.h @@ -55,16 +55,25 @@ void on_pushButton_11_clicked(); + void on_pushButton_4_clicked(); + + void on_pushButton_5_clicked(); + + void on_pushButton_6_clicked(); + + void on_pushButton_7_clicked(); + private: void getCheckDevice(bool bInit=true); void getCheckMethod(); - void initDeviceInfo(); + void initDeviceInfo(QString sId); void deleteItem(QLayout *layout); void initCheckTable(); InstructionLib* getCmdByCheckName(int idx,QString name); void Delay_MSec(unsigned int msec); void SetHomePaheCombox(Dept task); bool comboBoxContainsItem(QComboBox *comboBox, const QString &itemText); + void showStandard(); private: Ui::CheckWindow *ui; QList programList; @@ -78,6 +87,9 @@ VisaCommonEngine standardEngine; QList measureCalList; SaveDeviceMeasureInfo measureInfo; + QMap> caliDataList; + QMap headTableList; + QList catDeviceList; }; #endif // CHECKWINDOW_H diff --git a/softwareDirectory/AutoVerScheme/checkwindow.ui b/softwareDirectory/AutoVerScheme/checkwindow.ui index 90a3172..e27b34e 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.ui +++ b/softwareDirectory/AutoVerScheme/checkwindow.ui @@ -22,7 +22,7 @@ background-color: rgb(255, 255, 255); - + @@ -83,7 +83,7 @@ - + @@ -195,6 +195,60 @@ + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 48 + 48 + + + + + 12 + 75 + true + + + + image: url(:/image/Index/u51.svg); + + + + + + + + + + + 12 + 75 + true + + + + 选择标准设备 + + + + + + Qt::Horizontal @@ -269,124 +323,8 @@ 0 - - - - - QAbstractItemView::NoEditTriggers - - - true - - - - 选择 - - - - - 序号 - - - - - 设备名称 - - - - - 型号规格 - - - - - 辅助字段 - - - - - 出厂编号 - - - - - 生产厂家 - - - - - 委托方 - - - - - - - - 12 - - - - - - 0 - 0 - - - - color: rgb(51, 51, 51); - - - 检定地点 - - - - - - - - 0 - 0 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - color: rgb(51, 51, 51); - - - 介质 - - - - - - - - 0 - 0 - - - - - - - + + 12 @@ -478,7 +416,123 @@ - + + + + 12 + + + + + + 0 + 0 + + + + color: rgb(51, 51, 51); + + + 检定地点 + + + + + + + + 0 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + color: rgb(51, 51, 51); + + + 介质 + + + + + + + + 0 + 0 + + + + + + + + + + QAbstractItemView::NoEditTriggers + + + true + + + + 选择 + + + + + 序号 + + + + + 设备名称 + + + + + 型号规格 + + + + + 辅助字段 + + + + + 出厂编号 + + + + + 生产厂家 + + + + + 委托方 + + + + + @@ -542,96 +596,8 @@ - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 120 - 36 - - - - color: rgb(255, 255, 255); -background-color: rgb(55, 83, 123); -border-radius:5px; - - - 加载 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - QAbstractItemView::NoEditTriggers - - - true - - - - 选择 - - - - - 检定程序名称 - - - - - 创建人 - - - - - 创建时间 - - - - - 说明 - - - - - 操作 - - - - - + + 12 @@ -727,12 +693,403 @@ + + + + QAbstractItemView::NoEditTriggers + + + true + + + + 选择 + + + + + 检定程序名称 + + + + + 创建人 + + + + + 创建时间 + + + + + 说明 + + + + + 操作 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 120 + 36 + + + + color: rgb(255, 255, 255); +background-color: rgb(55, 83, 123); +border-radius:5px; + + + 加载 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + 12 + + + + + 扫码枪触发栏 + + + + + + + + + + + + + 出厂编号 + + + + + + + 所属部门 + + + + + + + + 1 + 0 + + + + + 72 + 26 + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); +background-color: rgb(74, 102, 186); +border-radius:5px; + + + 查询 + + + + + + + + 0 + 0 + + + + + 72 + 26 + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); +background-color: rgb(207, 132, 33); +border-radius:5px; + + + 重置 + + + + + + + + + QAbstractItemView::NoEditTriggers + + + true + + + + 选择 + + + + + 设备名称 + + + + + 型号规格 + + + + + 出厂编号 + + + + + 所属部门 + + + + + 负责人 + + + + + 检定有效期 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 120 + 36 + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); +background-color: rgb(55, 83, 123); +border-radius:5px; + + + 确定 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + - - - + + + + + + + 检定项提示 + + + + 20 + + + + + + 12 + 75 + true + + + + 设备检定项分类 + + + Qt::AlignCenter + + + + + + + + 12 + + + + true + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); +background-color: rgb(55, 83, 123); +border-radius:5px; + + + 查看详情 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 244 + + + + + + + @@ -749,6 +1106,9 @@ 设备连接状态提示 + + 6 + @@ -814,7 +1174,7 @@ - + @@ -1583,7 +1943,7 @@ - 选择 + 检定项目 @@ -1661,8 +2021,8 @@ showMethod() - 726 - 760 + 153 + 234 884 @@ -1693,8 +2053,8 @@ showMethodWidget() - 408 - 102 + 61 + 91 3 @@ -1709,8 +2069,8 @@ showResult() - 363 - 97 + 55 + 91 -1 diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index 876be07..8e5d8ea 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -5,6 +5,7 @@ #include "basecommonapi.h" #include #include "newcheckmethod.h" +#include "formcheckpoint.h" CheckWindow::CheckWindow(QWidget *parent) : QWidget(parent), @@ -32,6 +33,10 @@ ui->tableWidget_Standard->verticalHeader()->setParent(nullptr); for(int i=0;i<2;i++) ui->tableWidget_Standard->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); + ui->tableWidgetStd->verticalHeader()->setParent(nullptr); //隐藏行头 + for(int i=1;i<7;i++) + ui->tableWidgetStd->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); + ui->tableWidgetStd->setColumnWidth(0, 60); ui->tableWidgetCheck->verticalHeader()->setParent(nullptr); ui->comboBoxName->addItem("ALL"); ui->comboBoxModal->addItem("ALL"); @@ -78,8 +83,7 @@ } } -void CheckWindow::showDevice() -{ +void CheckWindow::showStandard(){ QString sId=""; for(int i=0;itableWidgetMethod->rowCount();i++){ Qt::CheckState state = ui->tableWidgetMethod->item(i,0)->checkState(); @@ -92,17 +96,68 @@ QMessageBox::warning(this, "提示", "请选择检定程序!"); }else{ programInfo = BaseCommonApi::getVerificationProgramInfo(sId); - initDeviceInfo(); + QStringList idList; + int rowCount=0; + int row=0; + ui->tableWidgetStd->clearContents(); + ui->tableWidgetStd->setRowCount(0); + catDeviceList.clear(); + if(programInfo.standard_device_id!=""){ + idList = programInfo.standard_device_id.split(","); + for(const QString& id : idList) + { + QList result = BaseCommonApi::getCatDeviceInfor(id); + if(result.length()>0){ + catDeviceList.append(result[0]); + //更新标准设备表格 + rowCount = ui->tableWidgetStd->rowCount(); + ui->tableWidgetStd->insertRow(rowCount); + QTableWidgetItem* p_check = new QTableWidgetItem(); + p_check->setCheckState(Qt::Unchecked); //设置首列为 CheckBox 控件 + ui->tableWidgetStd->setItem(row,0,p_check); + ui->tableWidgetStd->setItem(row, 1, new QTableWidgetItem(result[0].equipment_name)); + ui->tableWidgetStd->setItem(row, 2, new QTableWidgetItem(result[0].model)); //设置数据 + ui->tableWidgetStd->setItem(row, 3, new QTableWidgetItem(result[0].manufacture_no)); + ui->tableWidgetStd->setItem(row, 4, new QTableWidgetItem(result[0].dept_name)); + ui->tableWidgetStd->setItem(row, 5, new QTableWidgetItem(result[0].director_name)); + ui->tableWidgetStd->setItem(row, 6, new QTableWidgetItem(result[0].measure_valid_date)); + row++; + } + result.clear(); + } + idList.clear(); + } ui->stackedWidget->setCurrentIndex(2); } } -void CheckWindow::initDeviceInfo() +void CheckWindow::showDevice() +{ + QStringList idList = programInfo.standard_device_id.split(","); + QString sId=""; + for(int i=0;itableWidgetStd->rowCount();i++){ + Qt::CheckState state = ui->tableWidgetStd->item(i,0)->checkState(); + if(state == Qt::Checked){ + sId = idList[i]; + break; + } + } + if(sId==""){ + QMessageBox::warning(this, "提示", "请选择标准设备!"); + }else{ + //programInfo = BaseCommonApi::getVerificationProgramInfo(sId); + initDeviceInfo(sId); + ui->stackedWidget->setCurrentIndex(3); + } +} + +void CheckWindow::initDeviceInfo(QString sId) { QString strStyle = QString("QLabel{image:url(%1);}").arg(programInfo.img_path); qDebug() << "strStyle:" << strStyle; ui->label_8->setStyleSheet(strStyle); + ui->tableWidget_3->clearContents(); ui->tableWidget_3->setRowCount(0); ui->tableWidget_Standard->clearContents(); @@ -113,6 +168,10 @@ connectList.clear(); if(selectTaskList.length()>0) { + QList catory = BaseCommonApi::getDeviceMeasureEquipmentCatory(selectTaskList[0].sample_id); + if(catory.length() > 0 ){ + ui->lineEdit_category->setText(catory[0].item_category_name); + } //idList = programInfo.tested_device_id.split(","); for(const Dept& task : selectTaskList) { @@ -136,6 +195,8 @@ idList = programInfo.standard_device_id.split(","); for(const QString& id : idList) { + if(id!=sId) + continue; ConnectInfo info; info.id = id; info.type = 1; @@ -208,7 +269,9 @@ //QStringList headlist; headList.clear(); calibrationList.clear(); - calibrationList =BaseCommonApi::Search_CalibrationTable(deviceId,&headList); + headTableList.clear(); + //calibrationList =BaseCommonApi::Search_CalibrationTable(deviceId,&headList); + caliDataList = BaseCommonApi::Search_CalibrationTableClass(deviceId,&headTableList); //tableWidgetItem ui->tableWidget_Point->clearContents(); @@ -216,18 +279,38 @@ //循环数据 int rowCount=0; int row=0; - for (const QStringList& item : calibrationList) - { - //获取行号 并进行添加行 - rowCount = ui->tableWidget_Point->rowCount(); - ui->tableWidget_Point->insertRow(rowCount); - QTableWidgetItem* p_check = new QTableWidgetItem(); - p_check->setCheckState(Qt::Unchecked); //设置首列为 CheckBox 控件 - ui->tableWidget_Point->setItem(row,0,p_check); - ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(item[8])); - ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); - row++; - } +// for (const QStringList& item : calibrationList) +// { +// //获取行号 并进行添加行 +// rowCount = ui->tableWidget_Point->rowCount(); +// ui->tableWidget_Point->insertRow(rowCount); +// QTableWidgetItem* p_check = new QTableWidgetItem(); +// p_check->setCheckState(Qt::Unchecked); //设置首列为 CheckBox 控件 +// ui->tableWidget_Point->setItem(row,0,p_check); +// ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(item[8])); +// ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); +// row++; +// } + int index=0; + for (const auto &item : headTableList) { + // ======================================================================================== + // 数据循环显示 + // =================================================================================== + const auto &dataRes = caliDataList.value(headTableList.keys()[index]); + //tableWidget->setRowCount(data.count()); + + for (int i = 0; i < dataRes.count(); ++i) { + //获取行号 并进行添加行 + rowCount = ui->tableWidget_Point->rowCount(); + ui->tableWidget_Point->insertRow(rowCount); + if(i==0) + ui->tableWidget_Point->setItem(row, 0, new QTableWidgetItem(dataRes[i][1])); + ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(dataRes[i][5])); + ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); + row++; + } + ++index; + } } ui->stackedWidget_2->setCurrentIndex(1); @@ -482,7 +565,8 @@ void CheckWindow::on_pushButton_9_clicked() { - showDevice(); + //showDevice(); + showStandard(); } void CheckWindow::on_tableWidget_3_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn) @@ -665,3 +749,26 @@ ui->lineEditCreator->setText(""); getCheckMethod(); } + +void CheckWindow::on_pushButton_4_clicked() +{ + +} + +void CheckWindow::on_pushButton_5_clicked() +{ + +} + +void CheckWindow::on_pushButton_6_clicked() +{ + showDevice(); +} + +void CheckWindow::on_pushButton_7_clicked() +{ + FormCheckPoint *checkWindow = new FormCheckPoint(nullptr,selectTaskList[0].sample_id); + checkWindow->setWindowState(Qt::WindowMaximized); + checkWindow->setWindowModality(Qt::ApplicationModal); + checkWindow->show(); +} diff --git a/softwareDirectory/AutoVerScheme/checkwindow.h b/softwareDirectory/AutoVerScheme/checkwindow.h index 7b5cba0..2655417 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.h +++ b/softwareDirectory/AutoVerScheme/checkwindow.h @@ -55,16 +55,25 @@ void on_pushButton_11_clicked(); + void on_pushButton_4_clicked(); + + void on_pushButton_5_clicked(); + + void on_pushButton_6_clicked(); + + void on_pushButton_7_clicked(); + private: void getCheckDevice(bool bInit=true); void getCheckMethod(); - void initDeviceInfo(); + void initDeviceInfo(QString sId); void deleteItem(QLayout *layout); void initCheckTable(); InstructionLib* getCmdByCheckName(int idx,QString name); void Delay_MSec(unsigned int msec); void SetHomePaheCombox(Dept task); bool comboBoxContainsItem(QComboBox *comboBox, const QString &itemText); + void showStandard(); private: Ui::CheckWindow *ui; QList programList; @@ -78,6 +87,9 @@ VisaCommonEngine standardEngine; QList measureCalList; SaveDeviceMeasureInfo measureInfo; + QMap> caliDataList; + QMap headTableList; + QList catDeviceList; }; #endif // CHECKWINDOW_H diff --git a/softwareDirectory/AutoVerScheme/checkwindow.ui b/softwareDirectory/AutoVerScheme/checkwindow.ui index 90a3172..e27b34e 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.ui +++ b/softwareDirectory/AutoVerScheme/checkwindow.ui @@ -22,7 +22,7 @@ background-color: rgb(255, 255, 255); - + @@ -83,7 +83,7 @@ - + @@ -195,6 +195,60 @@ + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 48 + 48 + + + + + 12 + 75 + true + + + + image: url(:/image/Index/u51.svg); + + + + + + + + + + + 12 + 75 + true + + + + 选择标准设备 + + + + + + Qt::Horizontal @@ -269,124 +323,8 @@ 0 - - - - - QAbstractItemView::NoEditTriggers - - - true - - - - 选择 - - - - - 序号 - - - - - 设备名称 - - - - - 型号规格 - - - - - 辅助字段 - - - - - 出厂编号 - - - - - 生产厂家 - - - - - 委托方 - - - - - - - - 12 - - - - - - 0 - 0 - - - - color: rgb(51, 51, 51); - - - 检定地点 - - - - - - - - 0 - 0 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - color: rgb(51, 51, 51); - - - 介质 - - - - - - - - 0 - 0 - - - - - - - + + 12 @@ -478,7 +416,123 @@ - + + + + 12 + + + + + + 0 + 0 + + + + color: rgb(51, 51, 51); + + + 检定地点 + + + + + + + + 0 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + color: rgb(51, 51, 51); + + + 介质 + + + + + + + + 0 + 0 + + + + + + + + + + QAbstractItemView::NoEditTriggers + + + true + + + + 选择 + + + + + 序号 + + + + + 设备名称 + + + + + 型号规格 + + + + + 辅助字段 + + + + + 出厂编号 + + + + + 生产厂家 + + + + + 委托方 + + + + + @@ -542,96 +596,8 @@ - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 120 - 36 - - - - color: rgb(255, 255, 255); -background-color: rgb(55, 83, 123); -border-radius:5px; - - - 加载 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - QAbstractItemView::NoEditTriggers - - - true - - - - 选择 - - - - - 检定程序名称 - - - - - 创建人 - - - - - 创建时间 - - - - - 说明 - - - - - 操作 - - - - - + + 12 @@ -727,12 +693,403 @@ + + + + QAbstractItemView::NoEditTriggers + + + true + + + + 选择 + + + + + 检定程序名称 + + + + + 创建人 + + + + + 创建时间 + + + + + 说明 + + + + + 操作 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 120 + 36 + + + + color: rgb(255, 255, 255); +background-color: rgb(55, 83, 123); +border-radius:5px; + + + 加载 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + 12 + + + + + 扫码枪触发栏 + + + + + + + + + + + + + 出厂编号 + + + + + + + 所属部门 + + + + + + + + 1 + 0 + + + + + 72 + 26 + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); +background-color: rgb(74, 102, 186); +border-radius:5px; + + + 查询 + + + + + + + + 0 + 0 + + + + + 72 + 26 + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); +background-color: rgb(207, 132, 33); +border-radius:5px; + + + 重置 + + + + + + + + + QAbstractItemView::NoEditTriggers + + + true + + + + 选择 + + + + + 设备名称 + + + + + 型号规格 + + + + + 出厂编号 + + + + + 所属部门 + + + + + 负责人 + + + + + 检定有效期 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 120 + 36 + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); +background-color: rgb(55, 83, 123); +border-radius:5px; + + + 确定 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + - - - + + + + + + + 检定项提示 + + + + 20 + + + + + + 12 + 75 + true + + + + 设备检定项分类 + + + Qt::AlignCenter + + + + + + + + 12 + + + + true + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); +background-color: rgb(55, 83, 123); +border-radius:5px; + + + 查看详情 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 244 + + + + + + + @@ -749,6 +1106,9 @@ 设备连接状态提示 + + 6 + @@ -814,7 +1174,7 @@ - + @@ -1583,7 +1943,7 @@ - 选择 + 检定项目 @@ -1661,8 +2021,8 @@ showMethod() - 726 - 760 + 153 + 234 884 @@ -1693,8 +2053,8 @@ showMethodWidget() - 408 - 102 + 61 + 91 3 @@ -1709,8 +2069,8 @@ showResult() - 363 - 97 + 55 + 91 -1 diff --git a/softwareDirectory/AutoVerScheme/formaddrsetting.cpp b/softwareDirectory/AutoVerScheme/formaddrsetting.cpp index e96a3e1..11bc88b 100644 --- a/softwareDirectory/AutoVerScheme/formaddrsetting.cpp +++ b/softwareDirectory/AutoVerScheme/formaddrsetting.cpp @@ -126,25 +126,32 @@ void FormAddrSetting::on_pushButton_18_clicked() { if(editIdx==-1){ + InstructionLib cmd; + BaseCommonApi baseApi; + qint64 id = baseApi.generateId(); + cmd.id = QString::number(id); + cmd.type = iType; QString sName = ""; if(iType==0){ - QList result = BaseCommonApi::getTestedCatDevice(sId); - if(result.length()>0){ - sName = result[0].equipment_name; + if(checkMode){ + cmd.verification_program_id = sId; + cmd.device_id = sId; + }else{ + QList result = BaseCommonApi::getTestedCatDevice(sId); + if(result.length()>0){ + sName = result[0].equipment_name; + } + cmd.device_id = sId; + cmd.device_name = sName; } }else{ QList result = BaseCommonApi::getCatDeviceInfor(sId); if(result.length()>0){ sName = result[0].equipment_name; } + cmd.device_id = sId; + cmd.device_name = sName; } - InstructionLib cmd; - BaseCommonApi baseApi; - qint64 id = baseApi.generateId(); - cmd.id = QString::number(id); - cmd.device_id = sId; - cmd.device_name = sName; - cmd.type = iType; if(checkMode) cmd.belong_vername = this->ui->comboBox->currentText(); else diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index 876be07..8e5d8ea 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -5,6 +5,7 @@ #include "basecommonapi.h" #include #include "newcheckmethod.h" +#include "formcheckpoint.h" CheckWindow::CheckWindow(QWidget *parent) : QWidget(parent), @@ -32,6 +33,10 @@ ui->tableWidget_Standard->verticalHeader()->setParent(nullptr); for(int i=0;i<2;i++) ui->tableWidget_Standard->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); + ui->tableWidgetStd->verticalHeader()->setParent(nullptr); //隐藏行头 + for(int i=1;i<7;i++) + ui->tableWidgetStd->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); + ui->tableWidgetStd->setColumnWidth(0, 60); ui->tableWidgetCheck->verticalHeader()->setParent(nullptr); ui->comboBoxName->addItem("ALL"); ui->comboBoxModal->addItem("ALL"); @@ -78,8 +83,7 @@ } } -void CheckWindow::showDevice() -{ +void CheckWindow::showStandard(){ QString sId=""; for(int i=0;itableWidgetMethod->rowCount();i++){ Qt::CheckState state = ui->tableWidgetMethod->item(i,0)->checkState(); @@ -92,17 +96,68 @@ QMessageBox::warning(this, "提示", "请选择检定程序!"); }else{ programInfo = BaseCommonApi::getVerificationProgramInfo(sId); - initDeviceInfo(); + QStringList idList; + int rowCount=0; + int row=0; + ui->tableWidgetStd->clearContents(); + ui->tableWidgetStd->setRowCount(0); + catDeviceList.clear(); + if(programInfo.standard_device_id!=""){ + idList = programInfo.standard_device_id.split(","); + for(const QString& id : idList) + { + QList result = BaseCommonApi::getCatDeviceInfor(id); + if(result.length()>0){ + catDeviceList.append(result[0]); + //更新标准设备表格 + rowCount = ui->tableWidgetStd->rowCount(); + ui->tableWidgetStd->insertRow(rowCount); + QTableWidgetItem* p_check = new QTableWidgetItem(); + p_check->setCheckState(Qt::Unchecked); //设置首列为 CheckBox 控件 + ui->tableWidgetStd->setItem(row,0,p_check); + ui->tableWidgetStd->setItem(row, 1, new QTableWidgetItem(result[0].equipment_name)); + ui->tableWidgetStd->setItem(row, 2, new QTableWidgetItem(result[0].model)); //设置数据 + ui->tableWidgetStd->setItem(row, 3, new QTableWidgetItem(result[0].manufacture_no)); + ui->tableWidgetStd->setItem(row, 4, new QTableWidgetItem(result[0].dept_name)); + ui->tableWidgetStd->setItem(row, 5, new QTableWidgetItem(result[0].director_name)); + ui->tableWidgetStd->setItem(row, 6, new QTableWidgetItem(result[0].measure_valid_date)); + row++; + } + result.clear(); + } + idList.clear(); + } ui->stackedWidget->setCurrentIndex(2); } } -void CheckWindow::initDeviceInfo() +void CheckWindow::showDevice() +{ + QStringList idList = programInfo.standard_device_id.split(","); + QString sId=""; + for(int i=0;itableWidgetStd->rowCount();i++){ + Qt::CheckState state = ui->tableWidgetStd->item(i,0)->checkState(); + if(state == Qt::Checked){ + sId = idList[i]; + break; + } + } + if(sId==""){ + QMessageBox::warning(this, "提示", "请选择标准设备!"); + }else{ + //programInfo = BaseCommonApi::getVerificationProgramInfo(sId); + initDeviceInfo(sId); + ui->stackedWidget->setCurrentIndex(3); + } +} + +void CheckWindow::initDeviceInfo(QString sId) { QString strStyle = QString("QLabel{image:url(%1);}").arg(programInfo.img_path); qDebug() << "strStyle:" << strStyle; ui->label_8->setStyleSheet(strStyle); + ui->tableWidget_3->clearContents(); ui->tableWidget_3->setRowCount(0); ui->tableWidget_Standard->clearContents(); @@ -113,6 +168,10 @@ connectList.clear(); if(selectTaskList.length()>0) { + QList catory = BaseCommonApi::getDeviceMeasureEquipmentCatory(selectTaskList[0].sample_id); + if(catory.length() > 0 ){ + ui->lineEdit_category->setText(catory[0].item_category_name); + } //idList = programInfo.tested_device_id.split(","); for(const Dept& task : selectTaskList) { @@ -136,6 +195,8 @@ idList = programInfo.standard_device_id.split(","); for(const QString& id : idList) { + if(id!=sId) + continue; ConnectInfo info; info.id = id; info.type = 1; @@ -208,7 +269,9 @@ //QStringList headlist; headList.clear(); calibrationList.clear(); - calibrationList =BaseCommonApi::Search_CalibrationTable(deviceId,&headList); + headTableList.clear(); + //calibrationList =BaseCommonApi::Search_CalibrationTable(deviceId,&headList); + caliDataList = BaseCommonApi::Search_CalibrationTableClass(deviceId,&headTableList); //tableWidgetItem ui->tableWidget_Point->clearContents(); @@ -216,18 +279,38 @@ //循环数据 int rowCount=0; int row=0; - for (const QStringList& item : calibrationList) - { - //获取行号 并进行添加行 - rowCount = ui->tableWidget_Point->rowCount(); - ui->tableWidget_Point->insertRow(rowCount); - QTableWidgetItem* p_check = new QTableWidgetItem(); - p_check->setCheckState(Qt::Unchecked); //设置首列为 CheckBox 控件 - ui->tableWidget_Point->setItem(row,0,p_check); - ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(item[8])); - ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); - row++; - } +// for (const QStringList& item : calibrationList) +// { +// //获取行号 并进行添加行 +// rowCount = ui->tableWidget_Point->rowCount(); +// ui->tableWidget_Point->insertRow(rowCount); +// QTableWidgetItem* p_check = new QTableWidgetItem(); +// p_check->setCheckState(Qt::Unchecked); //设置首列为 CheckBox 控件 +// ui->tableWidget_Point->setItem(row,0,p_check); +// ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(item[8])); +// ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); +// row++; +// } + int index=0; + for (const auto &item : headTableList) { + // ======================================================================================== + // 数据循环显示 + // =================================================================================== + const auto &dataRes = caliDataList.value(headTableList.keys()[index]); + //tableWidget->setRowCount(data.count()); + + for (int i = 0; i < dataRes.count(); ++i) { + //获取行号 并进行添加行 + rowCount = ui->tableWidget_Point->rowCount(); + ui->tableWidget_Point->insertRow(rowCount); + if(i==0) + ui->tableWidget_Point->setItem(row, 0, new QTableWidgetItem(dataRes[i][1])); + ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(dataRes[i][5])); + ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); + row++; + } + ++index; + } } ui->stackedWidget_2->setCurrentIndex(1); @@ -482,7 +565,8 @@ void CheckWindow::on_pushButton_9_clicked() { - showDevice(); + //showDevice(); + showStandard(); } void CheckWindow::on_tableWidget_3_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn) @@ -665,3 +749,26 @@ ui->lineEditCreator->setText(""); getCheckMethod(); } + +void CheckWindow::on_pushButton_4_clicked() +{ + +} + +void CheckWindow::on_pushButton_5_clicked() +{ + +} + +void CheckWindow::on_pushButton_6_clicked() +{ + showDevice(); +} + +void CheckWindow::on_pushButton_7_clicked() +{ + FormCheckPoint *checkWindow = new FormCheckPoint(nullptr,selectTaskList[0].sample_id); + checkWindow->setWindowState(Qt::WindowMaximized); + checkWindow->setWindowModality(Qt::ApplicationModal); + checkWindow->show(); +} diff --git a/softwareDirectory/AutoVerScheme/checkwindow.h b/softwareDirectory/AutoVerScheme/checkwindow.h index 7b5cba0..2655417 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.h +++ b/softwareDirectory/AutoVerScheme/checkwindow.h @@ -55,16 +55,25 @@ void on_pushButton_11_clicked(); + void on_pushButton_4_clicked(); + + void on_pushButton_5_clicked(); + + void on_pushButton_6_clicked(); + + void on_pushButton_7_clicked(); + private: void getCheckDevice(bool bInit=true); void getCheckMethod(); - void initDeviceInfo(); + void initDeviceInfo(QString sId); void deleteItem(QLayout *layout); void initCheckTable(); InstructionLib* getCmdByCheckName(int idx,QString name); void Delay_MSec(unsigned int msec); void SetHomePaheCombox(Dept task); bool comboBoxContainsItem(QComboBox *comboBox, const QString &itemText); + void showStandard(); private: Ui::CheckWindow *ui; QList programList; @@ -78,6 +87,9 @@ VisaCommonEngine standardEngine; QList measureCalList; SaveDeviceMeasureInfo measureInfo; + QMap> caliDataList; + QMap headTableList; + QList catDeviceList; }; #endif // CHECKWINDOW_H diff --git a/softwareDirectory/AutoVerScheme/checkwindow.ui b/softwareDirectory/AutoVerScheme/checkwindow.ui index 90a3172..e27b34e 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.ui +++ b/softwareDirectory/AutoVerScheme/checkwindow.ui @@ -22,7 +22,7 @@ background-color: rgb(255, 255, 255); - + @@ -83,7 +83,7 @@ - + @@ -195,6 +195,60 @@ + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 48 + 48 + + + + + 12 + 75 + true + + + + image: url(:/image/Index/u51.svg); + + + + + + + + + + + 12 + 75 + true + + + + 选择标准设备 + + + + + + Qt::Horizontal @@ -269,124 +323,8 @@ 0 - - - - - QAbstractItemView::NoEditTriggers - - - true - - - - 选择 - - - - - 序号 - - - - - 设备名称 - - - - - 型号规格 - - - - - 辅助字段 - - - - - 出厂编号 - - - - - 生产厂家 - - - - - 委托方 - - - - - - - - 12 - - - - - - 0 - 0 - - - - color: rgb(51, 51, 51); - - - 检定地点 - - - - - - - - 0 - 0 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - color: rgb(51, 51, 51); - - - 介质 - - - - - - - - 0 - 0 - - - - - - - + + 12 @@ -478,7 +416,123 @@ - + + + + 12 + + + + + + 0 + 0 + + + + color: rgb(51, 51, 51); + + + 检定地点 + + + + + + + + 0 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + color: rgb(51, 51, 51); + + + 介质 + + + + + + + + 0 + 0 + + + + + + + + + + QAbstractItemView::NoEditTriggers + + + true + + + + 选择 + + + + + 序号 + + + + + 设备名称 + + + + + 型号规格 + + + + + 辅助字段 + + + + + 出厂编号 + + + + + 生产厂家 + + + + + 委托方 + + + + + @@ -542,96 +596,8 @@ - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 120 - 36 - - - - color: rgb(255, 255, 255); -background-color: rgb(55, 83, 123); -border-radius:5px; - - - 加载 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - QAbstractItemView::NoEditTriggers - - - true - - - - 选择 - - - - - 检定程序名称 - - - - - 创建人 - - - - - 创建时间 - - - - - 说明 - - - - - 操作 - - - - - + + 12 @@ -727,12 +693,403 @@ + + + + QAbstractItemView::NoEditTriggers + + + true + + + + 选择 + + + + + 检定程序名称 + + + + + 创建人 + + + + + 创建时间 + + + + + 说明 + + + + + 操作 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 120 + 36 + + + + color: rgb(255, 255, 255); +background-color: rgb(55, 83, 123); +border-radius:5px; + + + 加载 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + 12 + + + + + 扫码枪触发栏 + + + + + + + + + + + + + 出厂编号 + + + + + + + 所属部门 + + + + + + + + 1 + 0 + + + + + 72 + 26 + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); +background-color: rgb(74, 102, 186); +border-radius:5px; + + + 查询 + + + + + + + + 0 + 0 + + + + + 72 + 26 + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); +background-color: rgb(207, 132, 33); +border-radius:5px; + + + 重置 + + + + + + + + + QAbstractItemView::NoEditTriggers + + + true + + + + 选择 + + + + + 设备名称 + + + + + 型号规格 + + + + + 出厂编号 + + + + + 所属部门 + + + + + 负责人 + + + + + 检定有效期 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 120 + 36 + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); +background-color: rgb(55, 83, 123); +border-radius:5px; + + + 确定 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + - - - + + + + + + + 检定项提示 + + + + 20 + + + + + + 12 + 75 + true + + + + 设备检定项分类 + + + Qt::AlignCenter + + + + + + + + 12 + + + + true + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); +background-color: rgb(55, 83, 123); +border-radius:5px; + + + 查看详情 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 244 + + + + + + + @@ -749,6 +1106,9 @@ 设备连接状态提示 + + 6 + @@ -814,7 +1174,7 @@ - + @@ -1583,7 +1943,7 @@ - 选择 + 检定项目 @@ -1661,8 +2021,8 @@ showMethod() - 726 - 760 + 153 + 234 884 @@ -1693,8 +2053,8 @@ showMethodWidget() - 408 - 102 + 61 + 91 3 @@ -1709,8 +2069,8 @@ showResult() - 363 - 97 + 55 + 91 -1 diff --git a/softwareDirectory/AutoVerScheme/formaddrsetting.cpp b/softwareDirectory/AutoVerScheme/formaddrsetting.cpp index e96a3e1..11bc88b 100644 --- a/softwareDirectory/AutoVerScheme/formaddrsetting.cpp +++ b/softwareDirectory/AutoVerScheme/formaddrsetting.cpp @@ -126,25 +126,32 @@ void FormAddrSetting::on_pushButton_18_clicked() { if(editIdx==-1){ + InstructionLib cmd; + BaseCommonApi baseApi; + qint64 id = baseApi.generateId(); + cmd.id = QString::number(id); + cmd.type = iType; QString sName = ""; if(iType==0){ - QList result = BaseCommonApi::getTestedCatDevice(sId); - if(result.length()>0){ - sName = result[0].equipment_name; + if(checkMode){ + cmd.verification_program_id = sId; + cmd.device_id = sId; + }else{ + QList result = BaseCommonApi::getTestedCatDevice(sId); + if(result.length()>0){ + sName = result[0].equipment_name; + } + cmd.device_id = sId; + cmd.device_name = sName; } }else{ QList result = BaseCommonApi::getCatDeviceInfor(sId); if(result.length()>0){ sName = result[0].equipment_name; } + cmd.device_id = sId; + cmd.device_name = sName; } - InstructionLib cmd; - BaseCommonApi baseApi; - qint64 id = baseApi.generateId(); - cmd.id = QString::number(id); - cmd.device_id = sId; - cmd.device_name = sName; - cmd.type = iType; if(checkMode) cmd.belong_vername = this->ui->comboBox->currentText(); else diff --git a/softwareDirectory/AutoVerScheme/newcheckmethod.cpp b/softwareDirectory/AutoVerScheme/newcheckmethod.cpp index 965f532..91b23e2 100644 --- a/softwareDirectory/AutoVerScheme/newcheckmethod.cpp +++ b/softwareDirectory/AutoVerScheme/newcheckmethod.cpp @@ -61,6 +61,10 @@ ui->label_11->setStyleSheet(strStyle); } chooseDevices(programInfo.tested_device_id,programInfo.standard_device_id); + }else{ + BaseCommonApi baseApi; + qint64 id = baseApi.generateId(); + methodId = QString::number(id); } } @@ -113,7 +117,7 @@ int idx = ui->comboBoxCategory->currentIndex(); if(idx>=0&&idxsetWindowModality(Qt::ApplicationModal); form->show(); } @@ -124,9 +128,9 @@ return; if(programInfo.id=="") { - BaseCommonApi baseApi; - qint64 id = baseApi.generateId(); - programInfo.id = QString::number(id); + //BaseCommonApi baseApi; + //qint64 id = baseApi.generateId(); + programInfo.id = methodId; programInfo.belong_standard_equipment = QString::number(ui->comboBoxEquipment->currentIndex()+1); int idx = ui->comboBoxCategory->currentIndex(); if(idx>=0&&idxcomboBoxEquipment->currentIndex()+1); + QString catId; + int idx = ui->comboBoxCategory->currentIndex(); + if(idx>=0&&idxsetWindowModality(Qt::ApplicationModal); form->show(); }