diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 02579f1..3da6680 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -299,7 +299,7 @@ false true - + D:/dev/software/softwareDirectory/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug 1 diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 02579f1..3da6680 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -299,7 +299,7 @@ false true - + D:/dev/software/softwareDirectory/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug 1 diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index c90f1dc..d7aed77 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -252,7 +252,7 @@ ui->label_21->setText(QString("设备名称: %1").arg(task.sample_name)); ui->label_22->setText(QString("型号规格: %1").arg(task.sample_model)); ui->label_23->setText(QString("出厂编号: %1").arg(task.manufacture_no)); - ui->label_24->setText(QString("生产厂家: %1").arg(task.manufacture_no)); + ui->label_24->setText(QString("生产厂家: %1").arg(task.manufacturer)); } void CheckWindow::deleteItem(QLayout *layout) diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 02579f1..3da6680 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -299,7 +299,7 @@ false true - + D:/dev/software/softwareDirectory/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug 1 diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index c90f1dc..d7aed77 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -252,7 +252,7 @@ ui->label_21->setText(QString("设备名称: %1").arg(task.sample_name)); ui->label_22->setText(QString("型号规格: %1").arg(task.sample_model)); ui->label_23->setText(QString("出厂编号: %1").arg(task.manufacture_no)); - ui->label_24->setText(QString("生产厂家: %1").arg(task.manufacture_no)); + ui->label_24->setText(QString("生产厂家: %1").arg(task.manufacturer)); } void CheckWindow::deleteItem(QLayout *layout) diff --git a/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp b/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp index 41e1816..a45d295 100644 --- a/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp +++ b/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp @@ -27,6 +27,7 @@ int rowCount=0; int row=0; measureCalList = measList; + measHeadList = headList; for (const SaveDeviceMeasureCalibrator& measItem : measList) { //获取行号 并进行添加行 @@ -79,7 +80,46 @@ void DialogCheckResult::on_pushButton_2_clicked() { - + WordEngine engine; + QString strPath = "D://数字多用表8846A校准证书模板.doc"; + engine.open(strPath); + QStringList itemList; + QStringList conentList; + itemList <<"unit"<<"address"<<"jianAddr"<<"time2"<<"temperature"<<"humidity"; + conentList <<""<<""<comboBoxPlace->currentText()<dateEditCheck->text()<lineEditTemp->text()<lineEdit_Hum->text(); + engine.setMarks("unit",""); + engine.setMarks("address",""); + engine.setMarks("jianAddr",ui->comboBoxPlace->currentText()); + engine.setMarks("time2",ui->dateEditCheck->text()); + engine.setMarks("temperature",ui->lineEditTemp->text()); + engine.setMarks("humidity",ui->lineEdit_Hum->text()); + //engine.setBatchMarks(itemList,conentLis;t) + QString strLabel = "result"; + //engine.setMarks(strLabel,"1.表格1"); + QString strTitle = "1.表格1"; + int rows = measureCalList.length()+1; + int cols = measHeadList.length(); + QAxObject* pTable = engine.insertTable(strLabel,rows,cols,strTitle); + for (int i=0;i - + EnvironmentId @@ -299,7 +299,7 @@ false true - + D:/dev/software/softwareDirectory/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug 1 diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index c90f1dc..d7aed77 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -252,7 +252,7 @@ ui->label_21->setText(QString("设备名称: %1").arg(task.sample_name)); ui->label_22->setText(QString("型号规格: %1").arg(task.sample_model)); ui->label_23->setText(QString("出厂编号: %1").arg(task.manufacture_no)); - ui->label_24->setText(QString("生产厂家: %1").arg(task.manufacture_no)); + ui->label_24->setText(QString("生产厂家: %1").arg(task.manufacturer)); } void CheckWindow::deleteItem(QLayout *layout) diff --git a/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp b/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp index 41e1816..a45d295 100644 --- a/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp +++ b/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp @@ -27,6 +27,7 @@ int rowCount=0; int row=0; measureCalList = measList; + measHeadList = headList; for (const SaveDeviceMeasureCalibrator& measItem : measList) { //获取行号 并进行添加行 @@ -79,7 +80,46 @@ void DialogCheckResult::on_pushButton_2_clicked() { - + WordEngine engine; + QString strPath = "D://数字多用表8846A校准证书模板.doc"; + engine.open(strPath); + QStringList itemList; + QStringList conentList; + itemList <<"unit"<<"address"<<"jianAddr"<<"time2"<<"temperature"<<"humidity"; + conentList <<""<<""<comboBoxPlace->currentText()<dateEditCheck->text()<lineEditTemp->text()<lineEdit_Hum->text(); + engine.setMarks("unit",""); + engine.setMarks("address",""); + engine.setMarks("jianAddr",ui->comboBoxPlace->currentText()); + engine.setMarks("time2",ui->dateEditCheck->text()); + engine.setMarks("temperature",ui->lineEditTemp->text()); + engine.setMarks("humidity",ui->lineEdit_Hum->text()); + //engine.setBatchMarks(itemList,conentLis;t) + QString strLabel = "result"; + //engine.setMarks(strLabel,"1.表格1"); + QString strTitle = "1.表格1"; + int rows = measureCalList.length()+1; + int cols = measHeadList.length(); + QAxObject* pTable = engine.insertTable(strLabel,rows,cols,strTitle); + for (int i=0;i #include "basecommonapi.h" +#include "wordengine.h" namespace Ui { class DialogCheckResult; @@ -27,6 +28,7 @@ private: Ui::DialogCheckResult *ui; QList measureCalList; + QStringList measHeadList; }; #endif // DIALOGCHECKRESULT_H diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 02579f1..3da6680 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -299,7 +299,7 @@ false true - + D:/dev/software/softwareDirectory/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug 1 diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index c90f1dc..d7aed77 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -252,7 +252,7 @@ ui->label_21->setText(QString("设备名称: %1").arg(task.sample_name)); ui->label_22->setText(QString("型号规格: %1").arg(task.sample_model)); ui->label_23->setText(QString("出厂编号: %1").arg(task.manufacture_no)); - ui->label_24->setText(QString("生产厂家: %1").arg(task.manufacture_no)); + ui->label_24->setText(QString("生产厂家: %1").arg(task.manufacturer)); } void CheckWindow::deleteItem(QLayout *layout) diff --git a/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp b/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp index 41e1816..a45d295 100644 --- a/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp +++ b/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp @@ -27,6 +27,7 @@ int rowCount=0; int row=0; measureCalList = measList; + measHeadList = headList; for (const SaveDeviceMeasureCalibrator& measItem : measList) { //获取行号 并进行添加行 @@ -79,7 +80,46 @@ void DialogCheckResult::on_pushButton_2_clicked() { - + WordEngine engine; + QString strPath = "D://数字多用表8846A校准证书模板.doc"; + engine.open(strPath); + QStringList itemList; + QStringList conentList; + itemList <<"unit"<<"address"<<"jianAddr"<<"time2"<<"temperature"<<"humidity"; + conentList <<""<<""<comboBoxPlace->currentText()<dateEditCheck->text()<lineEditTemp->text()<lineEdit_Hum->text(); + engine.setMarks("unit",""); + engine.setMarks("address",""); + engine.setMarks("jianAddr",ui->comboBoxPlace->currentText()); + engine.setMarks("time2",ui->dateEditCheck->text()); + engine.setMarks("temperature",ui->lineEditTemp->text()); + engine.setMarks("humidity",ui->lineEdit_Hum->text()); + //engine.setBatchMarks(itemList,conentLis;t) + QString strLabel = "result"; + //engine.setMarks(strLabel,"1.表格1"); + QString strTitle = "1.表格1"; + int rows = measureCalList.length()+1; + int cols = measHeadList.length(); + QAxObject* pTable = engine.insertTable(strLabel,rows,cols,strTitle); + for (int i=0;i #include "basecommonapi.h" +#include "wordengine.h" namespace Ui { class DialogCheckResult; @@ -27,6 +28,7 @@ private: Ui::DialogCheckResult *ui; QList measureCalList; + QStringList measHeadList; }; #endif // DIALOGCHECKRESULT_H diff --git a/softwareDirectory/AutoVerScheme/verifywindow.cpp b/softwareDirectory/AutoVerScheme/verifywindow.cpp index 34b5197..c78962c 100644 --- a/softwareDirectory/AutoVerScheme/verifywindow.cpp +++ b/softwareDirectory/AutoVerScheme/verifywindow.cpp @@ -1,6 +1,7 @@ #include "verifywindow.h" #include "ui_verifywindow.h" #include +#include VerifyWindow::VerifyWindow(QWidget *parent) : QWidget(parent), @@ -21,12 +22,16 @@ VerifyWindow::~VerifyWindow() { + programList.clear(); delete ui; } void VerifyWindow::getVerifyMethod() { + programList.clear(); programList = BaseCommonApi::getCheckProgramManage(); + ui->tableWidgetMethod->clearContents(); + ui->tableWidgetMethod->setRowCount(0); int rowCount = 0; int row=0; for (const CheckProgramManage& program : programList) { @@ -99,6 +104,7 @@ { ConnectInfo info; info.state="未连接"; + info.type = 1; QList result = BaseCommonApi::getCatDeviceInfor(id); if(result.length()>0){ info.deviceName = result[0].equipment_name; @@ -108,6 +114,7 @@ if(addrList.length()>0){ info.programInterface = addrList[0]; } + info.cmdList = BaseCommonApi::getInstructionLib(id); connectList.append(info); addrList.clear(); } @@ -120,6 +127,7 @@ { ConnectInfo info; info.state="未连接"; + info.type = 0; QList result = BaseCommonApi::getTestedCatDevice(id); if(result.length()>0){ info.deviceName = result[0].equipment_name; @@ -129,6 +137,7 @@ if(addrList.length()>0){ info.programInterface = addrList[0]; } + info.cmdList = BaseCommonApi::getInstructionLib(id); connectList.append(info); addrList.clear(); } @@ -186,3 +195,263 @@ } } } + +void VerifyWindow::deleteItem(QLayout *layout) +{ + QLayoutItem *child; + while ((child = layout->takeAt(0)) != nullptr) + { + //setParent为NULL,防止删除之后界面不消失 + if(child->widget()) + { + child->widget()->setParent(nullptr); + delete child->widget(); + } + else if (child->layout()) + { + deleteItem(child->layout()); + child->layout()->deleteLater(); + } + delete child; + } +} +void VerifyWindow::on_deviceButton_clicked(CatDeviceInfor info,int idx) +{ + for(int i=0;ihorizontalLayout_14->itemAt(i); + QPushButton *btn_1 = qobject_cast(child->widget()); + if(i==idx){ + btn_1->setStyleSheet("QPushButton{" + "background-color:rgb(55,83,123);" + "color:rgb(255,255,255);" + "}"); + }else{ + btn_1->setStyleSheet("QPushButton{" + "background-color:rgb(240,240,240);" + "color:rgb(51,51,51);" + "}"); + } + } + ui->label_21->setText(QString("设备名称: %1").arg(info.equipment_name)); + ui->label_22->setText(QString("型号规格: %1").arg(info.model)); + ui->label_23->setText(QString("出厂编号: %1").arg(info.manufacture_no)); + ui->label_24->setText(QString("生产厂家: %1").arg(info.manufacturer)); +} + +void VerifyWindow::on_pushButton_13_clicked() +{ + deleteItem(ui->horizontalLayout_14); + int idx=0; + catDeviceList.clear(); + QString standardId=""; + if(programInfo.standard_device_id!="") + { + QStringList idList = programInfo.standard_device_id.split(","); + for(const QString& id : idList) + { + standardId = id; + QList result = BaseCommonApi::getCatDeviceInfor(id); + if(result.length()>0){ + CatDeviceInfor info = result[0]; + catDeviceList.append(info); + QPushButton *btn_1 = new QPushButton(); + btn_1->setText(info.equipment_name); + btn_1->setStyleSheet("QPushButton{" + "background-color:rgb(240,240,240);" + "color:rgb(51,51,51);" + "}"); + //btn_1->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed); + QFont font; + font.setPointSize(12);//字体大小 + font.setBold(true); + btn_1->setFont(font); + btn_1->setCursor(Qt::PointingHandCursor); + connect(btn_1, &QPushButton::clicked, this, [this,info,idx]() { + on_deviceButton_clicked(info,idx); + }); + ui->horizontalLayout_14->addWidget(btn_1); + idx++; + } + result.clear(); + } + idList.clear(); + } + on_deviceButton_clicked(catDeviceList[0],0); + ui->horizontalLayout_14->addStretch(); + + if(catDeviceList.length()>0) + { + headList.clear(); + calibrationList.clear(); + calibrationList =BaseCommonApi::Search_VerifyTable(standardId,&headList); + + //tableWidgetItem + ui->tableWidget_Point->clearContents(); + ui->tableWidget_Point->setRowCount(0); + //循环数据 + 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[2])); + ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); + row++; + } + } + + ui->stackedWidget_2->setCurrentIndex(1); +} + +void VerifyWindow::initCheckTable() +{ + ui->tableWidgetCheck->clearContents(); + ui->tableWidgetCheck->setRowCount(0); + ui->tableWidgetCheck->setColumnCount(0); + int rowCount = 0; + int row=0; + ui->tableWidgetCheck->setColumnCount(headList.count()); + ui->tableWidgetCheck->setHorizontalHeaderLabels(headList); + for(int i=0;itableWidgetCheck->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); + } + measureCalList.clear(); + for(int i=0;itableWidget_Point->rowCount();i++){ + Qt::CheckState state = ui->tableWidget_Point->item(i,0)->checkState(); + if(state == Qt::Checked){ + QStringList& item = calibrationList[i]; + int cnt = ui->tableWidget_Point->item(i,2)->text().toInt(); + for(int j=0;jtableWidgetCheck->rowCount(); + ui->tableWidgetCheck->insertRow(rowCount); + ui->tableWidgetCheck->setItem(row, 0, new QTableWidgetItem(QString::number(row+1))); + //循环读取值 headlist,count是列的数量 + for(int k=1;ktableWidgetCheck->setItem(row, k, new QTableWidgetItem(item[k])); + } + StandCheckDataCalibrator measItem; +// measItem.item_data_id = item[1]; +// measItem.maximum_error_formula = item[10];//最大允许误差(公式) +// measItem.error_param_a = item[11];//误差参数a +// measItem.error_param_b = item[12];//误差参数b +// measItem.params = item[2];//参数 +// measItem.capacity=item[3];//量 +// measItem.unit=item[4];//单位 +// measItem.frequency=item[5];//频率 +// measItem.frequency_unit=item[6];//频率单位 +// measItem.range_range=item[7];//量程 +// measItem.standard_value=item[8];//标准值(输入字段,特殊:指针式万用表输出字段) +// measItem.indicating_value=item[15];//示值(输出字段,特殊:指针式万用表输入字段) +// measItem.maximum_error=item[10];//最大允许误差(值) +// //measItem.absolute_error=item[11];//绝对误差 +// measItem.resolution=item[9];//分辨力 +// measItem.measure_indication_value=item[19];//被检表示值 + measureCalList.append(measItem); + row++; + } + } + } + if(connectList.length()>0&&connectList[0].type==1) + standardEngine.openDevice(connectList[0].programInterface.visa,"Visa"); + if(connectList.length()>1&&connectList[1].type==0) + deviceEngine.openDevice(connectList[1].programInterface.visa,"Visa"); +} + +InstructionLib* VerifyWindow::getCmdByCheckName(int idx,QString name) +{ + if(idx>=0&&idxinstruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + standardEngine.sendData(sCmd); + } + } + } + } + //被检设备读数 + if(deviceEngine.getState()){ + InstructionLib *instrcutLib = getCmdByCheckName(0,item.params); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + deviceEngine.sendData(sCmd); + } + } + Delay_MSec(2000); + sRet = deviceEngine.queryData(instrcutLib->instruct_read); + } + } + // + if(sRet==""){ + bool bOk = false; + double dRet = QInputDialog::getDouble(this,"手动测试","请输入被检示值",0,-100000, 100000,1,&bOk); + + if (bOk) { + sRet = QString::number(dRet); + } + } + item.test_value_one = sRet; + ui->tableWidgetCheck->setItem(i,19,new QTableWidgetItem(sRet)); + } +} + +void VerifyWindow::on_pushButton_pause_clicked() +{ + +} + +void VerifyWindow::on_pushButton_stop_clicked() +{ + +} + +void VerifyWindow::on_pushButton_save_clicked() +{ + +} + +void VerifyWindow::on_pushButton_close_clicked() +{ + ui->stackedWidget_2->setCurrentIndex(0); + ui->stackedWidget->setCurrentIndex(0); + getVerifyMethod(); +} + +void VerifyWindow::on_pushButton_12_clicked() +{ + showDevice(); +} diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 02579f1..3da6680 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -299,7 +299,7 @@ false true - + D:/dev/software/softwareDirectory/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug 1 diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index c90f1dc..d7aed77 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -252,7 +252,7 @@ ui->label_21->setText(QString("设备名称: %1").arg(task.sample_name)); ui->label_22->setText(QString("型号规格: %1").arg(task.sample_model)); ui->label_23->setText(QString("出厂编号: %1").arg(task.manufacture_no)); - ui->label_24->setText(QString("生产厂家: %1").arg(task.manufacture_no)); + ui->label_24->setText(QString("生产厂家: %1").arg(task.manufacturer)); } void CheckWindow::deleteItem(QLayout *layout) diff --git a/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp b/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp index 41e1816..a45d295 100644 --- a/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp +++ b/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp @@ -27,6 +27,7 @@ int rowCount=0; int row=0; measureCalList = measList; + measHeadList = headList; for (const SaveDeviceMeasureCalibrator& measItem : measList) { //获取行号 并进行添加行 @@ -79,7 +80,46 @@ void DialogCheckResult::on_pushButton_2_clicked() { - + WordEngine engine; + QString strPath = "D://数字多用表8846A校准证书模板.doc"; + engine.open(strPath); + QStringList itemList; + QStringList conentList; + itemList <<"unit"<<"address"<<"jianAddr"<<"time2"<<"temperature"<<"humidity"; + conentList <<""<<""<comboBoxPlace->currentText()<dateEditCheck->text()<lineEditTemp->text()<lineEdit_Hum->text(); + engine.setMarks("unit",""); + engine.setMarks("address",""); + engine.setMarks("jianAddr",ui->comboBoxPlace->currentText()); + engine.setMarks("time2",ui->dateEditCheck->text()); + engine.setMarks("temperature",ui->lineEditTemp->text()); + engine.setMarks("humidity",ui->lineEdit_Hum->text()); + //engine.setBatchMarks(itemList,conentLis;t) + QString strLabel = "result"; + //engine.setMarks(strLabel,"1.表格1"); + QString strTitle = "1.表格1"; + int rows = measureCalList.length()+1; + int cols = measHeadList.length(); + QAxObject* pTable = engine.insertTable(strLabel,rows,cols,strTitle); + for (int i=0;i #include "basecommonapi.h" +#include "wordengine.h" namespace Ui { class DialogCheckResult; @@ -27,6 +28,7 @@ private: Ui::DialogCheckResult *ui; QList measureCalList; + QStringList measHeadList; }; #endif // DIALOGCHECKRESULT_H diff --git a/softwareDirectory/AutoVerScheme/verifywindow.cpp b/softwareDirectory/AutoVerScheme/verifywindow.cpp index 34b5197..c78962c 100644 --- a/softwareDirectory/AutoVerScheme/verifywindow.cpp +++ b/softwareDirectory/AutoVerScheme/verifywindow.cpp @@ -1,6 +1,7 @@ #include "verifywindow.h" #include "ui_verifywindow.h" #include +#include VerifyWindow::VerifyWindow(QWidget *parent) : QWidget(parent), @@ -21,12 +22,16 @@ VerifyWindow::~VerifyWindow() { + programList.clear(); delete ui; } void VerifyWindow::getVerifyMethod() { + programList.clear(); programList = BaseCommonApi::getCheckProgramManage(); + ui->tableWidgetMethod->clearContents(); + ui->tableWidgetMethod->setRowCount(0); int rowCount = 0; int row=0; for (const CheckProgramManage& program : programList) { @@ -99,6 +104,7 @@ { ConnectInfo info; info.state="未连接"; + info.type = 1; QList result = BaseCommonApi::getCatDeviceInfor(id); if(result.length()>0){ info.deviceName = result[0].equipment_name; @@ -108,6 +114,7 @@ if(addrList.length()>0){ info.programInterface = addrList[0]; } + info.cmdList = BaseCommonApi::getInstructionLib(id); connectList.append(info); addrList.clear(); } @@ -120,6 +127,7 @@ { ConnectInfo info; info.state="未连接"; + info.type = 0; QList result = BaseCommonApi::getTestedCatDevice(id); if(result.length()>0){ info.deviceName = result[0].equipment_name; @@ -129,6 +137,7 @@ if(addrList.length()>0){ info.programInterface = addrList[0]; } + info.cmdList = BaseCommonApi::getInstructionLib(id); connectList.append(info); addrList.clear(); } @@ -186,3 +195,263 @@ } } } + +void VerifyWindow::deleteItem(QLayout *layout) +{ + QLayoutItem *child; + while ((child = layout->takeAt(0)) != nullptr) + { + //setParent为NULL,防止删除之后界面不消失 + if(child->widget()) + { + child->widget()->setParent(nullptr); + delete child->widget(); + } + else if (child->layout()) + { + deleteItem(child->layout()); + child->layout()->deleteLater(); + } + delete child; + } +} +void VerifyWindow::on_deviceButton_clicked(CatDeviceInfor info,int idx) +{ + for(int i=0;ihorizontalLayout_14->itemAt(i); + QPushButton *btn_1 = qobject_cast(child->widget()); + if(i==idx){ + btn_1->setStyleSheet("QPushButton{" + "background-color:rgb(55,83,123);" + "color:rgb(255,255,255);" + "}"); + }else{ + btn_1->setStyleSheet("QPushButton{" + "background-color:rgb(240,240,240);" + "color:rgb(51,51,51);" + "}"); + } + } + ui->label_21->setText(QString("设备名称: %1").arg(info.equipment_name)); + ui->label_22->setText(QString("型号规格: %1").arg(info.model)); + ui->label_23->setText(QString("出厂编号: %1").arg(info.manufacture_no)); + ui->label_24->setText(QString("生产厂家: %1").arg(info.manufacturer)); +} + +void VerifyWindow::on_pushButton_13_clicked() +{ + deleteItem(ui->horizontalLayout_14); + int idx=0; + catDeviceList.clear(); + QString standardId=""; + if(programInfo.standard_device_id!="") + { + QStringList idList = programInfo.standard_device_id.split(","); + for(const QString& id : idList) + { + standardId = id; + QList result = BaseCommonApi::getCatDeviceInfor(id); + if(result.length()>0){ + CatDeviceInfor info = result[0]; + catDeviceList.append(info); + QPushButton *btn_1 = new QPushButton(); + btn_1->setText(info.equipment_name); + btn_1->setStyleSheet("QPushButton{" + "background-color:rgb(240,240,240);" + "color:rgb(51,51,51);" + "}"); + //btn_1->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed); + QFont font; + font.setPointSize(12);//字体大小 + font.setBold(true); + btn_1->setFont(font); + btn_1->setCursor(Qt::PointingHandCursor); + connect(btn_1, &QPushButton::clicked, this, [this,info,idx]() { + on_deviceButton_clicked(info,idx); + }); + ui->horizontalLayout_14->addWidget(btn_1); + idx++; + } + result.clear(); + } + idList.clear(); + } + on_deviceButton_clicked(catDeviceList[0],0); + ui->horizontalLayout_14->addStretch(); + + if(catDeviceList.length()>0) + { + headList.clear(); + calibrationList.clear(); + calibrationList =BaseCommonApi::Search_VerifyTable(standardId,&headList); + + //tableWidgetItem + ui->tableWidget_Point->clearContents(); + ui->tableWidget_Point->setRowCount(0); + //循环数据 + 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[2])); + ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); + row++; + } + } + + ui->stackedWidget_2->setCurrentIndex(1); +} + +void VerifyWindow::initCheckTable() +{ + ui->tableWidgetCheck->clearContents(); + ui->tableWidgetCheck->setRowCount(0); + ui->tableWidgetCheck->setColumnCount(0); + int rowCount = 0; + int row=0; + ui->tableWidgetCheck->setColumnCount(headList.count()); + ui->tableWidgetCheck->setHorizontalHeaderLabels(headList); + for(int i=0;itableWidgetCheck->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); + } + measureCalList.clear(); + for(int i=0;itableWidget_Point->rowCount();i++){ + Qt::CheckState state = ui->tableWidget_Point->item(i,0)->checkState(); + if(state == Qt::Checked){ + QStringList& item = calibrationList[i]; + int cnt = ui->tableWidget_Point->item(i,2)->text().toInt(); + for(int j=0;jtableWidgetCheck->rowCount(); + ui->tableWidgetCheck->insertRow(rowCount); + ui->tableWidgetCheck->setItem(row, 0, new QTableWidgetItem(QString::number(row+1))); + //循环读取值 headlist,count是列的数量 + for(int k=1;ktableWidgetCheck->setItem(row, k, new QTableWidgetItem(item[k])); + } + StandCheckDataCalibrator measItem; +// measItem.item_data_id = item[1]; +// measItem.maximum_error_formula = item[10];//最大允许误差(公式) +// measItem.error_param_a = item[11];//误差参数a +// measItem.error_param_b = item[12];//误差参数b +// measItem.params = item[2];//参数 +// measItem.capacity=item[3];//量 +// measItem.unit=item[4];//单位 +// measItem.frequency=item[5];//频率 +// measItem.frequency_unit=item[6];//频率单位 +// measItem.range_range=item[7];//量程 +// measItem.standard_value=item[8];//标准值(输入字段,特殊:指针式万用表输出字段) +// measItem.indicating_value=item[15];//示值(输出字段,特殊:指针式万用表输入字段) +// measItem.maximum_error=item[10];//最大允许误差(值) +// //measItem.absolute_error=item[11];//绝对误差 +// measItem.resolution=item[9];//分辨力 +// measItem.measure_indication_value=item[19];//被检表示值 + measureCalList.append(measItem); + row++; + } + } + } + if(connectList.length()>0&&connectList[0].type==1) + standardEngine.openDevice(connectList[0].programInterface.visa,"Visa"); + if(connectList.length()>1&&connectList[1].type==0) + deviceEngine.openDevice(connectList[1].programInterface.visa,"Visa"); +} + +InstructionLib* VerifyWindow::getCmdByCheckName(int idx,QString name) +{ + if(idx>=0&&idxinstruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + standardEngine.sendData(sCmd); + } + } + } + } + //被检设备读数 + if(deviceEngine.getState()){ + InstructionLib *instrcutLib = getCmdByCheckName(0,item.params); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + deviceEngine.sendData(sCmd); + } + } + Delay_MSec(2000); + sRet = deviceEngine.queryData(instrcutLib->instruct_read); + } + } + // + if(sRet==""){ + bool bOk = false; + double dRet = QInputDialog::getDouble(this,"手动测试","请输入被检示值",0,-100000, 100000,1,&bOk); + + if (bOk) { + sRet = QString::number(dRet); + } + } + item.test_value_one = sRet; + ui->tableWidgetCheck->setItem(i,19,new QTableWidgetItem(sRet)); + } +} + +void VerifyWindow::on_pushButton_pause_clicked() +{ + +} + +void VerifyWindow::on_pushButton_stop_clicked() +{ + +} + +void VerifyWindow::on_pushButton_save_clicked() +{ + +} + +void VerifyWindow::on_pushButton_close_clicked() +{ + ui->stackedWidget_2->setCurrentIndex(0); + ui->stackedWidget->setCurrentIndex(0); + getVerifyMethod(); +} + +void VerifyWindow::on_pushButton_12_clicked() +{ + showDevice(); +} diff --git a/softwareDirectory/AutoVerScheme/verifywindow.h b/softwareDirectory/AutoVerScheme/verifywindow.h index e32aea4..5cd4b06 100644 --- a/softwareDirectory/AutoVerScheme/verifywindow.h +++ b/softwareDirectory/AutoVerScheme/verifywindow.h @@ -19,6 +19,10 @@ private: void getVerifyMethod(); void initDeviceInfo(); + void deleteItem(QLayout *layout); + void initCheckTable(); + InstructionLib* getCmdByCheckName(int idx,QString name); + void Delay_MSec(unsigned int msec); private slots: void showDevice(); void on_editButton_clicked(); @@ -27,12 +31,32 @@ void on_tableWidget_3_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn); + void on_pushButton_13_clicked(); + + void on_pushButton_start_clicked(); + + void on_pushButton_pause_clicked(); + + void on_pushButton_stop_clicked(); + + void on_pushButton_save_clicked(); + + void on_pushButton_close_clicked(); + + void on_pushButton_12_clicked(); + void on_deviceButton_clicked(CatDeviceInfor info,int idx); + private: Ui::VerifyWindow *ui; QList programList; CheckProgramManage programInfo; QList connectList; - + QList catDeviceList; + QStringList headList; + QList calibrationList; + QList measureCalList; + VisaCommonEngine deviceEngine; + VisaCommonEngine standardEngine; }; #endif // VERIFYWINDOW_H diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 02579f1..3da6680 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -299,7 +299,7 @@ false true - + D:/dev/software/softwareDirectory/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug 1 diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index c90f1dc..d7aed77 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -252,7 +252,7 @@ ui->label_21->setText(QString("设备名称: %1").arg(task.sample_name)); ui->label_22->setText(QString("型号规格: %1").arg(task.sample_model)); ui->label_23->setText(QString("出厂编号: %1").arg(task.manufacture_no)); - ui->label_24->setText(QString("生产厂家: %1").arg(task.manufacture_no)); + ui->label_24->setText(QString("生产厂家: %1").arg(task.manufacturer)); } void CheckWindow::deleteItem(QLayout *layout) diff --git a/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp b/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp index 41e1816..a45d295 100644 --- a/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp +++ b/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp @@ -27,6 +27,7 @@ int rowCount=0; int row=0; measureCalList = measList; + measHeadList = headList; for (const SaveDeviceMeasureCalibrator& measItem : measList) { //获取行号 并进行添加行 @@ -79,7 +80,46 @@ void DialogCheckResult::on_pushButton_2_clicked() { - + WordEngine engine; + QString strPath = "D://数字多用表8846A校准证书模板.doc"; + engine.open(strPath); + QStringList itemList; + QStringList conentList; + itemList <<"unit"<<"address"<<"jianAddr"<<"time2"<<"temperature"<<"humidity"; + conentList <<""<<""<comboBoxPlace->currentText()<dateEditCheck->text()<lineEditTemp->text()<lineEdit_Hum->text(); + engine.setMarks("unit",""); + engine.setMarks("address",""); + engine.setMarks("jianAddr",ui->comboBoxPlace->currentText()); + engine.setMarks("time2",ui->dateEditCheck->text()); + engine.setMarks("temperature",ui->lineEditTemp->text()); + engine.setMarks("humidity",ui->lineEdit_Hum->text()); + //engine.setBatchMarks(itemList,conentLis;t) + QString strLabel = "result"; + //engine.setMarks(strLabel,"1.表格1"); + QString strTitle = "1.表格1"; + int rows = measureCalList.length()+1; + int cols = measHeadList.length(); + QAxObject* pTable = engine.insertTable(strLabel,rows,cols,strTitle); + for (int i=0;i #include "basecommonapi.h" +#include "wordengine.h" namespace Ui { class DialogCheckResult; @@ -27,6 +28,7 @@ private: Ui::DialogCheckResult *ui; QList measureCalList; + QStringList measHeadList; }; #endif // DIALOGCHECKRESULT_H diff --git a/softwareDirectory/AutoVerScheme/verifywindow.cpp b/softwareDirectory/AutoVerScheme/verifywindow.cpp index 34b5197..c78962c 100644 --- a/softwareDirectory/AutoVerScheme/verifywindow.cpp +++ b/softwareDirectory/AutoVerScheme/verifywindow.cpp @@ -1,6 +1,7 @@ #include "verifywindow.h" #include "ui_verifywindow.h" #include +#include VerifyWindow::VerifyWindow(QWidget *parent) : QWidget(parent), @@ -21,12 +22,16 @@ VerifyWindow::~VerifyWindow() { + programList.clear(); delete ui; } void VerifyWindow::getVerifyMethod() { + programList.clear(); programList = BaseCommonApi::getCheckProgramManage(); + ui->tableWidgetMethod->clearContents(); + ui->tableWidgetMethod->setRowCount(0); int rowCount = 0; int row=0; for (const CheckProgramManage& program : programList) { @@ -99,6 +104,7 @@ { ConnectInfo info; info.state="未连接"; + info.type = 1; QList result = BaseCommonApi::getCatDeviceInfor(id); if(result.length()>0){ info.deviceName = result[0].equipment_name; @@ -108,6 +114,7 @@ if(addrList.length()>0){ info.programInterface = addrList[0]; } + info.cmdList = BaseCommonApi::getInstructionLib(id); connectList.append(info); addrList.clear(); } @@ -120,6 +127,7 @@ { ConnectInfo info; info.state="未连接"; + info.type = 0; QList result = BaseCommonApi::getTestedCatDevice(id); if(result.length()>0){ info.deviceName = result[0].equipment_name; @@ -129,6 +137,7 @@ if(addrList.length()>0){ info.programInterface = addrList[0]; } + info.cmdList = BaseCommonApi::getInstructionLib(id); connectList.append(info); addrList.clear(); } @@ -186,3 +195,263 @@ } } } + +void VerifyWindow::deleteItem(QLayout *layout) +{ + QLayoutItem *child; + while ((child = layout->takeAt(0)) != nullptr) + { + //setParent为NULL,防止删除之后界面不消失 + if(child->widget()) + { + child->widget()->setParent(nullptr); + delete child->widget(); + } + else if (child->layout()) + { + deleteItem(child->layout()); + child->layout()->deleteLater(); + } + delete child; + } +} +void VerifyWindow::on_deviceButton_clicked(CatDeviceInfor info,int idx) +{ + for(int i=0;ihorizontalLayout_14->itemAt(i); + QPushButton *btn_1 = qobject_cast(child->widget()); + if(i==idx){ + btn_1->setStyleSheet("QPushButton{" + "background-color:rgb(55,83,123);" + "color:rgb(255,255,255);" + "}"); + }else{ + btn_1->setStyleSheet("QPushButton{" + "background-color:rgb(240,240,240);" + "color:rgb(51,51,51);" + "}"); + } + } + ui->label_21->setText(QString("设备名称: %1").arg(info.equipment_name)); + ui->label_22->setText(QString("型号规格: %1").arg(info.model)); + ui->label_23->setText(QString("出厂编号: %1").arg(info.manufacture_no)); + ui->label_24->setText(QString("生产厂家: %1").arg(info.manufacturer)); +} + +void VerifyWindow::on_pushButton_13_clicked() +{ + deleteItem(ui->horizontalLayout_14); + int idx=0; + catDeviceList.clear(); + QString standardId=""; + if(programInfo.standard_device_id!="") + { + QStringList idList = programInfo.standard_device_id.split(","); + for(const QString& id : idList) + { + standardId = id; + QList result = BaseCommonApi::getCatDeviceInfor(id); + if(result.length()>0){ + CatDeviceInfor info = result[0]; + catDeviceList.append(info); + QPushButton *btn_1 = new QPushButton(); + btn_1->setText(info.equipment_name); + btn_1->setStyleSheet("QPushButton{" + "background-color:rgb(240,240,240);" + "color:rgb(51,51,51);" + "}"); + //btn_1->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed); + QFont font; + font.setPointSize(12);//字体大小 + font.setBold(true); + btn_1->setFont(font); + btn_1->setCursor(Qt::PointingHandCursor); + connect(btn_1, &QPushButton::clicked, this, [this,info,idx]() { + on_deviceButton_clicked(info,idx); + }); + ui->horizontalLayout_14->addWidget(btn_1); + idx++; + } + result.clear(); + } + idList.clear(); + } + on_deviceButton_clicked(catDeviceList[0],0); + ui->horizontalLayout_14->addStretch(); + + if(catDeviceList.length()>0) + { + headList.clear(); + calibrationList.clear(); + calibrationList =BaseCommonApi::Search_VerifyTable(standardId,&headList); + + //tableWidgetItem + ui->tableWidget_Point->clearContents(); + ui->tableWidget_Point->setRowCount(0); + //循环数据 + 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[2])); + ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); + row++; + } + } + + ui->stackedWidget_2->setCurrentIndex(1); +} + +void VerifyWindow::initCheckTable() +{ + ui->tableWidgetCheck->clearContents(); + ui->tableWidgetCheck->setRowCount(0); + ui->tableWidgetCheck->setColumnCount(0); + int rowCount = 0; + int row=0; + ui->tableWidgetCheck->setColumnCount(headList.count()); + ui->tableWidgetCheck->setHorizontalHeaderLabels(headList); + for(int i=0;itableWidgetCheck->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); + } + measureCalList.clear(); + for(int i=0;itableWidget_Point->rowCount();i++){ + Qt::CheckState state = ui->tableWidget_Point->item(i,0)->checkState(); + if(state == Qt::Checked){ + QStringList& item = calibrationList[i]; + int cnt = ui->tableWidget_Point->item(i,2)->text().toInt(); + for(int j=0;jtableWidgetCheck->rowCount(); + ui->tableWidgetCheck->insertRow(rowCount); + ui->tableWidgetCheck->setItem(row, 0, new QTableWidgetItem(QString::number(row+1))); + //循环读取值 headlist,count是列的数量 + for(int k=1;ktableWidgetCheck->setItem(row, k, new QTableWidgetItem(item[k])); + } + StandCheckDataCalibrator measItem; +// measItem.item_data_id = item[1]; +// measItem.maximum_error_formula = item[10];//最大允许误差(公式) +// measItem.error_param_a = item[11];//误差参数a +// measItem.error_param_b = item[12];//误差参数b +// measItem.params = item[2];//参数 +// measItem.capacity=item[3];//量 +// measItem.unit=item[4];//单位 +// measItem.frequency=item[5];//频率 +// measItem.frequency_unit=item[6];//频率单位 +// measItem.range_range=item[7];//量程 +// measItem.standard_value=item[8];//标准值(输入字段,特殊:指针式万用表输出字段) +// measItem.indicating_value=item[15];//示值(输出字段,特殊:指针式万用表输入字段) +// measItem.maximum_error=item[10];//最大允许误差(值) +// //measItem.absolute_error=item[11];//绝对误差 +// measItem.resolution=item[9];//分辨力 +// measItem.measure_indication_value=item[19];//被检表示值 + measureCalList.append(measItem); + row++; + } + } + } + if(connectList.length()>0&&connectList[0].type==1) + standardEngine.openDevice(connectList[0].programInterface.visa,"Visa"); + if(connectList.length()>1&&connectList[1].type==0) + deviceEngine.openDevice(connectList[1].programInterface.visa,"Visa"); +} + +InstructionLib* VerifyWindow::getCmdByCheckName(int idx,QString name) +{ + if(idx>=0&&idxinstruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + standardEngine.sendData(sCmd); + } + } + } + } + //被检设备读数 + if(deviceEngine.getState()){ + InstructionLib *instrcutLib = getCmdByCheckName(0,item.params); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + deviceEngine.sendData(sCmd); + } + } + Delay_MSec(2000); + sRet = deviceEngine.queryData(instrcutLib->instruct_read); + } + } + // + if(sRet==""){ + bool bOk = false; + double dRet = QInputDialog::getDouble(this,"手动测试","请输入被检示值",0,-100000, 100000,1,&bOk); + + if (bOk) { + sRet = QString::number(dRet); + } + } + item.test_value_one = sRet; + ui->tableWidgetCheck->setItem(i,19,new QTableWidgetItem(sRet)); + } +} + +void VerifyWindow::on_pushButton_pause_clicked() +{ + +} + +void VerifyWindow::on_pushButton_stop_clicked() +{ + +} + +void VerifyWindow::on_pushButton_save_clicked() +{ + +} + +void VerifyWindow::on_pushButton_close_clicked() +{ + ui->stackedWidget_2->setCurrentIndex(0); + ui->stackedWidget->setCurrentIndex(0); + getVerifyMethod(); +} + +void VerifyWindow::on_pushButton_12_clicked() +{ + showDevice(); +} diff --git a/softwareDirectory/AutoVerScheme/verifywindow.h b/softwareDirectory/AutoVerScheme/verifywindow.h index e32aea4..5cd4b06 100644 --- a/softwareDirectory/AutoVerScheme/verifywindow.h +++ b/softwareDirectory/AutoVerScheme/verifywindow.h @@ -19,6 +19,10 @@ private: void getVerifyMethod(); void initDeviceInfo(); + void deleteItem(QLayout *layout); + void initCheckTable(); + InstructionLib* getCmdByCheckName(int idx,QString name); + void Delay_MSec(unsigned int msec); private slots: void showDevice(); void on_editButton_clicked(); @@ -27,12 +31,32 @@ void on_tableWidget_3_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn); + void on_pushButton_13_clicked(); + + void on_pushButton_start_clicked(); + + void on_pushButton_pause_clicked(); + + void on_pushButton_stop_clicked(); + + void on_pushButton_save_clicked(); + + void on_pushButton_close_clicked(); + + void on_pushButton_12_clicked(); + void on_deviceButton_clicked(CatDeviceInfor info,int idx); + private: Ui::VerifyWindow *ui; QList programList; CheckProgramManage programInfo; QList connectList; - + QList catDeviceList; + QStringList headList; + QList calibrationList; + QList measureCalList; + VisaCommonEngine deviceEngine; + VisaCommonEngine standardEngine; }; #endif // VERIFYWINDOW_H diff --git a/softwareDirectory/AutoVerScheme/verifywindow.ui b/softwareDirectory/AutoVerScheme/verifywindow.ui index a4ee6c2..750ff51 100644 --- a/softwareDirectory/AutoVerScheme/verifywindow.ui +++ b/softwareDirectory/AutoVerScheme/verifywindow.ui @@ -16,7 +16,7 @@ background-color: rgb(255, 255, 255); - + @@ -75,141 +75,13 @@ - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - + + + - - - - 48 - 48 - - - - - 12 - 75 - true - - - - image: url(:/image/Index/u51.svg); - - - - - - - - - - - 12 - 75 - true - - - - 选择核查程序 - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 48 - 48 - - - - - 12 - 75 - true - - - - image: url(:/image/Index/u53.svg); - - - - - - - - - - - 12 - 75 - true - - - - 设备连接状态 - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - 0 - - - - - + - + Qt::Horizontal @@ -222,31 +94,102 @@ - - - - 0 - 0 - - - - - 120 - 36 - - - - color: rgb(255, 255, 255); -background-color: rgb(55, 83, 123); -border-radius:5px; - - - 加载 - - + + + + + + 48 + 48 + + + + + 12 + 75 + true + + + + image: url(:/image/Index/u51.svg); + + + + + + + + + + + 12 + 75 + true + + + + 选择核查程序 + + + + - + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 48 + 48 + + + + + 12 + 75 + true + + + + image: url(:/image/Index/u53.svg); + + + + + + + + + + + 12 + 75 + true + + + + 设备连接状态 + + + + + + + Qt::Horizontal @@ -260,188 +203,1090 @@ - - - - true - - - - 选择 - - - - 12 - - - - - - 核查程序名称 - - - - 12 - - - - - - 创建人 - - - - 12 - - - - - - 创建时间 - - - - 12 - - - - - - 说明 - - - - 12 - - - - - - 操作 - - - - 12 - - - - - - - - - 12 + + + + 0 - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 1 - 0 - - - - - 72 - 26 - - - - - 12 - 75 - true - - - - color: rgb(255, 255, 255); + + + + + + 12 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 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); + + + 查询 + + + + + + + + 0 + 0 + + + + + 72 + 26 + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); background-color: rgb(207, 132, 33); border-radius:5px; - - - 重置 - - - - + + + 重置 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 120 + 36 + + + + color: rgb(255, 255, 255); +background-color: rgb(55, 83, 123); +border-radius:5px; + + + 加载 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + true + + + + 选择 + + + + 12 + + + + + + 核查程序名称 + + + + 12 + + + + + + 创建人 + + + + 12 + + + + + + 创建时间 + + + + 12 + + + + + + 说明 + + + + 12 + + + + + + 操作 + + + + 12 + + + + + + + + + + + + + + + 设备连接关系图 + + + Qt::AlignCenter + + + + + + + 设备连接状态提示 + + + + + + + 设备名称 + + + + 12 + 75 + true + + + + + + 连接状态 + + + + 12 + 75 + true + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + 确定 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + 0 + 0 + + + + + 0 + 160 + + + + 设备接口设置 + + + + + + + 12 + + + + 串口 + + + + + + + + 12 + + + + 端口号: + + + + + + + + 12 + + + + true + + + + + + + + 12 + + + + 波特率: + + + + + + + + 12 + + + + true + + + 9600 + + + 1 + + + + 4800 + + + + + 9600 + + + + + 14400 + + + + + 19200 + + + + + 38400 + + + + + + + + + 12 + + + + 校验位: + + + + + + + + 12 + + + + + None + + + + + Odd + + + + + Even + + + + + + + + + 12 + + + + 数据位: + + + + + + + + 12 + + + + 1 + + + + 7 + + + + + 8 + + + + + + + + + 12 + + + + 停止位: + + + + + + + + 12 + + + + 1 + + + + None + + + + + One + + + + + Two + + + + + OnePointFive + + + + + + + + + 12 + + + + VISA + + + + + + + + 12 + + + + true + + + + + + + + + - - - - + + + + + + 20 + + + 10 + + + 0 + - - - 设备连接关系图 + + + + 12 + 75 + true + - - Qt::AlignCenter + + 执行测试 + + + + :/image/Index/u712.svg + + + + + 24 + 24 + - - - 设备连接状态提示 + + + + 12 + 75 + true + - + + 暂停测试 + + + + :/image/Index/u715.svg + + + + + 24 + 24 + + + + + + + + + 12 + 75 + true + + + + 终止测试 + + + + :/image/Index/u703.svg + + + + + 24 + 24 + + + + + + + + + 12 + 75 + true + + + + 结果保存 + + + + :/image/Index/u706.svg + + + + + 24 + 24 + + + + + + + + + 12 + 75 + true + + + + 关闭 + + + + :/image/Index/u709.svg + + + + + 24 + 24 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 12 + 75 + true + + + + 环境温度: + + + + + + + + 12 + 75 + true + + + + 20℃ + + + + + + + + 12 + 75 + true + + + + 环境湿度: + + + + + + + + 12 + 75 + true + + + + 50%RH + + + + + + + + + + + + + + 12 + 75 + true + + + + 状态面板 + + + + + + + + 12 + 75 + true + + + + 标准设备面板 + + + + + + + 设备名称 + + + + 12 + 75 + true + + + + + + 状态 + + + + 12 + 75 + true + + + + + + + + + + + + + + + 0 + 0 + + + + + 12 + - + + + 2 + + + + + + + + + + 12 + 75 + true + + + + 设备名称: + + + + + + + + 12 + 75 + true + + + + 型号规格: + + + + + + + + 12 + 75 + true + + + + 出厂编号: + + + + + + + + 12 + 75 + true + + + + 生产厂家: + + + + + + + + + background-color: rgb(55, 83, 123); + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + image: url(:/image/Index/u642.svg); + + + + + + + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); + + + 外观及功能性检查 + + + + + + + + + + + + + + 12 + + + + + + 12 + + + + + + + 合格 + + + + + + + + 12 + + + + + + + 外观完好,工作正常 + + + + + + + + + + background-color: rgb(55, 83, 123); + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + image: url(:/image/Index/u642.svg); + + + + + + + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); + + + 检定数据 + + + + + + + + + + + + + + + + + 12 + 75 + true + + + + 检定设置面板 + + + + - 设备名称 + 选择 @@ -453,7 +1298,19 @@ - 连接状态 + 核查点 + + + + 12 + 75 + true + + + + + + 循环次数 @@ -466,303 +1323,32 @@ - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - 确定 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); +background-color: rgb(55, 83, 123); +padding:10px; + + + 运行提示 + + + + + - - - - - 0 - 0 - - - - - 0 - 160 - - - - 设备接口设置 - - - - - - - 12 - - - - 串口 - - - - - - - - 12 - - - - 端口号: - - - - - - - - 12 - - - - true - - - - - - - - 12 - - - - 波特率: - - - - - - - - 12 - - - - true - - - 9600 - - - 1 - - - - 4800 - - - - - 9600 - - - - - 14400 - - - - - 19200 - - - - - 38400 - - - - - - - - - 12 - - - - 校验位: - - - - - - - - 12 - - - - - None - - - - - Odd - - - - - Even - - - - - - - - - 12 - - - - 数据位: - - - - - - - - 12 - - - - 1 - - - - 7 - - - - - 8 - - - - - - - - - 12 - - - - 停止位: - - - - - - - - 12 - - - - 1 - - - - None - - - - - One - - - - - Two - - - - - OnePointFive - - - - - - - - - 12 - - - - VISA - - - - - - - - 12 - - - - true - - - - - - @@ -770,24 +1356,7 @@ - - - pushButton_12 - clicked() - VerifyWindow - showDevice() - - - 669 - 753 - - - 916 - 788 - - - - + showDevice() diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 02579f1..3da6680 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -299,7 +299,7 @@ false true - + D:/dev/software/softwareDirectory/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug 1 diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index c90f1dc..d7aed77 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -252,7 +252,7 @@ ui->label_21->setText(QString("设备名称: %1").arg(task.sample_name)); ui->label_22->setText(QString("型号规格: %1").arg(task.sample_model)); ui->label_23->setText(QString("出厂编号: %1").arg(task.manufacture_no)); - ui->label_24->setText(QString("生产厂家: %1").arg(task.manufacture_no)); + ui->label_24->setText(QString("生产厂家: %1").arg(task.manufacturer)); } void CheckWindow::deleteItem(QLayout *layout) diff --git a/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp b/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp index 41e1816..a45d295 100644 --- a/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp +++ b/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp @@ -27,6 +27,7 @@ int rowCount=0; int row=0; measureCalList = measList; + measHeadList = headList; for (const SaveDeviceMeasureCalibrator& measItem : measList) { //获取行号 并进行添加行 @@ -79,7 +80,46 @@ void DialogCheckResult::on_pushButton_2_clicked() { - + WordEngine engine; + QString strPath = "D://数字多用表8846A校准证书模板.doc"; + engine.open(strPath); + QStringList itemList; + QStringList conentList; + itemList <<"unit"<<"address"<<"jianAddr"<<"time2"<<"temperature"<<"humidity"; + conentList <<""<<""<comboBoxPlace->currentText()<dateEditCheck->text()<lineEditTemp->text()<lineEdit_Hum->text(); + engine.setMarks("unit",""); + engine.setMarks("address",""); + engine.setMarks("jianAddr",ui->comboBoxPlace->currentText()); + engine.setMarks("time2",ui->dateEditCheck->text()); + engine.setMarks("temperature",ui->lineEditTemp->text()); + engine.setMarks("humidity",ui->lineEdit_Hum->text()); + //engine.setBatchMarks(itemList,conentLis;t) + QString strLabel = "result"; + //engine.setMarks(strLabel,"1.表格1"); + QString strTitle = "1.表格1"; + int rows = measureCalList.length()+1; + int cols = measHeadList.length(); + QAxObject* pTable = engine.insertTable(strLabel,rows,cols,strTitle); + for (int i=0;i #include "basecommonapi.h" +#include "wordengine.h" namespace Ui { class DialogCheckResult; @@ -27,6 +28,7 @@ private: Ui::DialogCheckResult *ui; QList measureCalList; + QStringList measHeadList; }; #endif // DIALOGCHECKRESULT_H diff --git a/softwareDirectory/AutoVerScheme/verifywindow.cpp b/softwareDirectory/AutoVerScheme/verifywindow.cpp index 34b5197..c78962c 100644 --- a/softwareDirectory/AutoVerScheme/verifywindow.cpp +++ b/softwareDirectory/AutoVerScheme/verifywindow.cpp @@ -1,6 +1,7 @@ #include "verifywindow.h" #include "ui_verifywindow.h" #include +#include VerifyWindow::VerifyWindow(QWidget *parent) : QWidget(parent), @@ -21,12 +22,16 @@ VerifyWindow::~VerifyWindow() { + programList.clear(); delete ui; } void VerifyWindow::getVerifyMethod() { + programList.clear(); programList = BaseCommonApi::getCheckProgramManage(); + ui->tableWidgetMethod->clearContents(); + ui->tableWidgetMethod->setRowCount(0); int rowCount = 0; int row=0; for (const CheckProgramManage& program : programList) { @@ -99,6 +104,7 @@ { ConnectInfo info; info.state="未连接"; + info.type = 1; QList result = BaseCommonApi::getCatDeviceInfor(id); if(result.length()>0){ info.deviceName = result[0].equipment_name; @@ -108,6 +114,7 @@ if(addrList.length()>0){ info.programInterface = addrList[0]; } + info.cmdList = BaseCommonApi::getInstructionLib(id); connectList.append(info); addrList.clear(); } @@ -120,6 +127,7 @@ { ConnectInfo info; info.state="未连接"; + info.type = 0; QList result = BaseCommonApi::getTestedCatDevice(id); if(result.length()>0){ info.deviceName = result[0].equipment_name; @@ -129,6 +137,7 @@ if(addrList.length()>0){ info.programInterface = addrList[0]; } + info.cmdList = BaseCommonApi::getInstructionLib(id); connectList.append(info); addrList.clear(); } @@ -186,3 +195,263 @@ } } } + +void VerifyWindow::deleteItem(QLayout *layout) +{ + QLayoutItem *child; + while ((child = layout->takeAt(0)) != nullptr) + { + //setParent为NULL,防止删除之后界面不消失 + if(child->widget()) + { + child->widget()->setParent(nullptr); + delete child->widget(); + } + else if (child->layout()) + { + deleteItem(child->layout()); + child->layout()->deleteLater(); + } + delete child; + } +} +void VerifyWindow::on_deviceButton_clicked(CatDeviceInfor info,int idx) +{ + for(int i=0;ihorizontalLayout_14->itemAt(i); + QPushButton *btn_1 = qobject_cast(child->widget()); + if(i==idx){ + btn_1->setStyleSheet("QPushButton{" + "background-color:rgb(55,83,123);" + "color:rgb(255,255,255);" + "}"); + }else{ + btn_1->setStyleSheet("QPushButton{" + "background-color:rgb(240,240,240);" + "color:rgb(51,51,51);" + "}"); + } + } + ui->label_21->setText(QString("设备名称: %1").arg(info.equipment_name)); + ui->label_22->setText(QString("型号规格: %1").arg(info.model)); + ui->label_23->setText(QString("出厂编号: %1").arg(info.manufacture_no)); + ui->label_24->setText(QString("生产厂家: %1").arg(info.manufacturer)); +} + +void VerifyWindow::on_pushButton_13_clicked() +{ + deleteItem(ui->horizontalLayout_14); + int idx=0; + catDeviceList.clear(); + QString standardId=""; + if(programInfo.standard_device_id!="") + { + QStringList idList = programInfo.standard_device_id.split(","); + for(const QString& id : idList) + { + standardId = id; + QList result = BaseCommonApi::getCatDeviceInfor(id); + if(result.length()>0){ + CatDeviceInfor info = result[0]; + catDeviceList.append(info); + QPushButton *btn_1 = new QPushButton(); + btn_1->setText(info.equipment_name); + btn_1->setStyleSheet("QPushButton{" + "background-color:rgb(240,240,240);" + "color:rgb(51,51,51);" + "}"); + //btn_1->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed); + QFont font; + font.setPointSize(12);//字体大小 + font.setBold(true); + btn_1->setFont(font); + btn_1->setCursor(Qt::PointingHandCursor); + connect(btn_1, &QPushButton::clicked, this, [this,info,idx]() { + on_deviceButton_clicked(info,idx); + }); + ui->horizontalLayout_14->addWidget(btn_1); + idx++; + } + result.clear(); + } + idList.clear(); + } + on_deviceButton_clicked(catDeviceList[0],0); + ui->horizontalLayout_14->addStretch(); + + if(catDeviceList.length()>0) + { + headList.clear(); + calibrationList.clear(); + calibrationList =BaseCommonApi::Search_VerifyTable(standardId,&headList); + + //tableWidgetItem + ui->tableWidget_Point->clearContents(); + ui->tableWidget_Point->setRowCount(0); + //循环数据 + 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[2])); + ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); + row++; + } + } + + ui->stackedWidget_2->setCurrentIndex(1); +} + +void VerifyWindow::initCheckTable() +{ + ui->tableWidgetCheck->clearContents(); + ui->tableWidgetCheck->setRowCount(0); + ui->tableWidgetCheck->setColumnCount(0); + int rowCount = 0; + int row=0; + ui->tableWidgetCheck->setColumnCount(headList.count()); + ui->tableWidgetCheck->setHorizontalHeaderLabels(headList); + for(int i=0;itableWidgetCheck->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); + } + measureCalList.clear(); + for(int i=0;itableWidget_Point->rowCount();i++){ + Qt::CheckState state = ui->tableWidget_Point->item(i,0)->checkState(); + if(state == Qt::Checked){ + QStringList& item = calibrationList[i]; + int cnt = ui->tableWidget_Point->item(i,2)->text().toInt(); + for(int j=0;jtableWidgetCheck->rowCount(); + ui->tableWidgetCheck->insertRow(rowCount); + ui->tableWidgetCheck->setItem(row, 0, new QTableWidgetItem(QString::number(row+1))); + //循环读取值 headlist,count是列的数量 + for(int k=1;ktableWidgetCheck->setItem(row, k, new QTableWidgetItem(item[k])); + } + StandCheckDataCalibrator measItem; +// measItem.item_data_id = item[1]; +// measItem.maximum_error_formula = item[10];//最大允许误差(公式) +// measItem.error_param_a = item[11];//误差参数a +// measItem.error_param_b = item[12];//误差参数b +// measItem.params = item[2];//参数 +// measItem.capacity=item[3];//量 +// measItem.unit=item[4];//单位 +// measItem.frequency=item[5];//频率 +// measItem.frequency_unit=item[6];//频率单位 +// measItem.range_range=item[7];//量程 +// measItem.standard_value=item[8];//标准值(输入字段,特殊:指针式万用表输出字段) +// measItem.indicating_value=item[15];//示值(输出字段,特殊:指针式万用表输入字段) +// measItem.maximum_error=item[10];//最大允许误差(值) +// //measItem.absolute_error=item[11];//绝对误差 +// measItem.resolution=item[9];//分辨力 +// measItem.measure_indication_value=item[19];//被检表示值 + measureCalList.append(measItem); + row++; + } + } + } + if(connectList.length()>0&&connectList[0].type==1) + standardEngine.openDevice(connectList[0].programInterface.visa,"Visa"); + if(connectList.length()>1&&connectList[1].type==0) + deviceEngine.openDevice(connectList[1].programInterface.visa,"Visa"); +} + +InstructionLib* VerifyWindow::getCmdByCheckName(int idx,QString name) +{ + if(idx>=0&&idxinstruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + standardEngine.sendData(sCmd); + } + } + } + } + //被检设备读数 + if(deviceEngine.getState()){ + InstructionLib *instrcutLib = getCmdByCheckName(0,item.params); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + deviceEngine.sendData(sCmd); + } + } + Delay_MSec(2000); + sRet = deviceEngine.queryData(instrcutLib->instruct_read); + } + } + // + if(sRet==""){ + bool bOk = false; + double dRet = QInputDialog::getDouble(this,"手动测试","请输入被检示值",0,-100000, 100000,1,&bOk); + + if (bOk) { + sRet = QString::number(dRet); + } + } + item.test_value_one = sRet; + ui->tableWidgetCheck->setItem(i,19,new QTableWidgetItem(sRet)); + } +} + +void VerifyWindow::on_pushButton_pause_clicked() +{ + +} + +void VerifyWindow::on_pushButton_stop_clicked() +{ + +} + +void VerifyWindow::on_pushButton_save_clicked() +{ + +} + +void VerifyWindow::on_pushButton_close_clicked() +{ + ui->stackedWidget_2->setCurrentIndex(0); + ui->stackedWidget->setCurrentIndex(0); + getVerifyMethod(); +} + +void VerifyWindow::on_pushButton_12_clicked() +{ + showDevice(); +} diff --git a/softwareDirectory/AutoVerScheme/verifywindow.h b/softwareDirectory/AutoVerScheme/verifywindow.h index e32aea4..5cd4b06 100644 --- a/softwareDirectory/AutoVerScheme/verifywindow.h +++ b/softwareDirectory/AutoVerScheme/verifywindow.h @@ -19,6 +19,10 @@ private: void getVerifyMethod(); void initDeviceInfo(); + void deleteItem(QLayout *layout); + void initCheckTable(); + InstructionLib* getCmdByCheckName(int idx,QString name); + void Delay_MSec(unsigned int msec); private slots: void showDevice(); void on_editButton_clicked(); @@ -27,12 +31,32 @@ void on_tableWidget_3_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn); + void on_pushButton_13_clicked(); + + void on_pushButton_start_clicked(); + + void on_pushButton_pause_clicked(); + + void on_pushButton_stop_clicked(); + + void on_pushButton_save_clicked(); + + void on_pushButton_close_clicked(); + + void on_pushButton_12_clicked(); + void on_deviceButton_clicked(CatDeviceInfor info,int idx); + private: Ui::VerifyWindow *ui; QList programList; CheckProgramManage programInfo; QList connectList; - + QList catDeviceList; + QStringList headList; + QList calibrationList; + QList measureCalList; + VisaCommonEngine deviceEngine; + VisaCommonEngine standardEngine; }; #endif // VERIFYWINDOW_H diff --git a/softwareDirectory/AutoVerScheme/verifywindow.ui b/softwareDirectory/AutoVerScheme/verifywindow.ui index a4ee6c2..750ff51 100644 --- a/softwareDirectory/AutoVerScheme/verifywindow.ui +++ b/softwareDirectory/AutoVerScheme/verifywindow.ui @@ -16,7 +16,7 @@ background-color: rgb(255, 255, 255); - + @@ -75,141 +75,13 @@ - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - + + + - - - - 48 - 48 - - - - - 12 - 75 - true - - - - image: url(:/image/Index/u51.svg); - - - - - - - - - - - 12 - 75 - true - - - - 选择核查程序 - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 48 - 48 - - - - - 12 - 75 - true - - - - image: url(:/image/Index/u53.svg); - - - - - - - - - - - 12 - 75 - true - - - - 设备连接状态 - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - 0 - - - - - + - + Qt::Horizontal @@ -222,31 +94,102 @@ - - - - 0 - 0 - - - - - 120 - 36 - - - - color: rgb(255, 255, 255); -background-color: rgb(55, 83, 123); -border-radius:5px; - - - 加载 - - + + + + + + 48 + 48 + + + + + 12 + 75 + true + + + + image: url(:/image/Index/u51.svg); + + + + + + + + + + + 12 + 75 + true + + + + 选择核查程序 + + + + - + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 48 + 48 + + + + + 12 + 75 + true + + + + image: url(:/image/Index/u53.svg); + + + + + + + + + + + 12 + 75 + true + + + + 设备连接状态 + + + + + + + Qt::Horizontal @@ -260,188 +203,1090 @@ - - - - true - - - - 选择 - - - - 12 - - - - - - 核查程序名称 - - - - 12 - - - - - - 创建人 - - - - 12 - - - - - - 创建时间 - - - - 12 - - - - - - 说明 - - - - 12 - - - - - - 操作 - - - - 12 - - - - - - - - - 12 + + + + 0 - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 1 - 0 - - - - - 72 - 26 - - - - - 12 - 75 - true - - - - color: rgb(255, 255, 255); + + + + + + 12 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 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); + + + 查询 + + + + + + + + 0 + 0 + + + + + 72 + 26 + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); background-color: rgb(207, 132, 33); border-radius:5px; - - - 重置 - - - - + + + 重置 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 120 + 36 + + + + color: rgb(255, 255, 255); +background-color: rgb(55, 83, 123); +border-radius:5px; + + + 加载 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + true + + + + 选择 + + + + 12 + + + + + + 核查程序名称 + + + + 12 + + + + + + 创建人 + + + + 12 + + + + + + 创建时间 + + + + 12 + + + + + + 说明 + + + + 12 + + + + + + 操作 + + + + 12 + + + + + + + + + + + + + + + 设备连接关系图 + + + Qt::AlignCenter + + + + + + + 设备连接状态提示 + + + + + + + 设备名称 + + + + 12 + 75 + true + + + + + + 连接状态 + + + + 12 + 75 + true + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + 确定 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + 0 + 0 + + + + + 0 + 160 + + + + 设备接口设置 + + + + + + + 12 + + + + 串口 + + + + + + + + 12 + + + + 端口号: + + + + + + + + 12 + + + + true + + + + + + + + 12 + + + + 波特率: + + + + + + + + 12 + + + + true + + + 9600 + + + 1 + + + + 4800 + + + + + 9600 + + + + + 14400 + + + + + 19200 + + + + + 38400 + + + + + + + + + 12 + + + + 校验位: + + + + + + + + 12 + + + + + None + + + + + Odd + + + + + Even + + + + + + + + + 12 + + + + 数据位: + + + + + + + + 12 + + + + 1 + + + + 7 + + + + + 8 + + + + + + + + + 12 + + + + 停止位: + + + + + + + + 12 + + + + 1 + + + + None + + + + + One + + + + + Two + + + + + OnePointFive + + + + + + + + + 12 + + + + VISA + + + + + + + + 12 + + + + true + + + + + + + + + - - - - + + + + + + 20 + + + 10 + + + 0 + - - - 设备连接关系图 + + + + 12 + 75 + true + - - Qt::AlignCenter + + 执行测试 + + + + :/image/Index/u712.svg + + + + + 24 + 24 + - - - 设备连接状态提示 + + + + 12 + 75 + true + - + + 暂停测试 + + + + :/image/Index/u715.svg + + + + + 24 + 24 + + + + + + + + + 12 + 75 + true + + + + 终止测试 + + + + :/image/Index/u703.svg + + + + + 24 + 24 + + + + + + + + + 12 + 75 + true + + + + 结果保存 + + + + :/image/Index/u706.svg + + + + + 24 + 24 + + + + + + + + + 12 + 75 + true + + + + 关闭 + + + + :/image/Index/u709.svg + + + + + 24 + 24 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 12 + 75 + true + + + + 环境温度: + + + + + + + + 12 + 75 + true + + + + 20℃ + + + + + + + + 12 + 75 + true + + + + 环境湿度: + + + + + + + + 12 + 75 + true + + + + 50%RH + + + + + + + + + + + + + + 12 + 75 + true + + + + 状态面板 + + + + + + + + 12 + 75 + true + + + + 标准设备面板 + + + + + + + 设备名称 + + + + 12 + 75 + true + + + + + + 状态 + + + + 12 + 75 + true + + + + + + + + + + + + + + + 0 + 0 + + + + + 12 + - + + + 2 + + + + + + + + + + 12 + 75 + true + + + + 设备名称: + + + + + + + + 12 + 75 + true + + + + 型号规格: + + + + + + + + 12 + 75 + true + + + + 出厂编号: + + + + + + + + 12 + 75 + true + + + + 生产厂家: + + + + + + + + + background-color: rgb(55, 83, 123); + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + image: url(:/image/Index/u642.svg); + + + + + + + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); + + + 外观及功能性检查 + + + + + + + + + + + + + + 12 + + + + + + 12 + + + + + + + 合格 + + + + + + + + 12 + + + + + + + 外观完好,工作正常 + + + + + + + + + + background-color: rgb(55, 83, 123); + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + image: url(:/image/Index/u642.svg); + + + + + + + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); + + + 检定数据 + + + + + + + + + + + + + + + + + 12 + 75 + true + + + + 检定设置面板 + + + + - 设备名称 + 选择 @@ -453,7 +1298,19 @@ - 连接状态 + 核查点 + + + + 12 + 75 + true + + + + + + 循环次数 @@ -466,303 +1323,32 @@ - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - 确定 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); +background-color: rgb(55, 83, 123); +padding:10px; + + + 运行提示 + + + + + - - - - - 0 - 0 - - - - - 0 - 160 - - - - 设备接口设置 - - - - - - - 12 - - - - 串口 - - - - - - - - 12 - - - - 端口号: - - - - - - - - 12 - - - - true - - - - - - - - 12 - - - - 波特率: - - - - - - - - 12 - - - - true - - - 9600 - - - 1 - - - - 4800 - - - - - 9600 - - - - - 14400 - - - - - 19200 - - - - - 38400 - - - - - - - - - 12 - - - - 校验位: - - - - - - - - 12 - - - - - None - - - - - Odd - - - - - Even - - - - - - - - - 12 - - - - 数据位: - - - - - - - - 12 - - - - 1 - - - - 7 - - - - - 8 - - - - - - - - - 12 - - - - 停止位: - - - - - - - - 12 - - - - 1 - - - - None - - - - - One - - - - - Two - - - - - OnePointFive - - - - - - - - - 12 - - - - VISA - - - - - - - - 12 - - - - true - - - - - - @@ -770,24 +1356,7 @@ - - - pushButton_12 - clicked() - VerifyWindow - showDevice() - - - 669 - 753 - - - 916 - 788 - - - - + showDevice() diff --git a/softwareDirectory/AutoVerScheme/wordengine.cpp b/softwareDirectory/AutoVerScheme/wordengine.cpp index 04d4231..9808fd4 100644 --- a/softwareDirectory/AutoVerScheme/wordengine.cpp +++ b/softwareDirectory/AutoVerScheme/wordengine.cpp @@ -229,7 +229,7 @@ } } -QAxObject *WordEngine::insertTable(QString sLabel,int row, int column){ +QAxObject *WordEngine::insertTable(QString sLabel,int row, int column,QString sTitle){ QAxObject *bookmark = m_wordDocuments->querySubObject("Bookmarks(QVariant)", sLabel); if(bookmark) { @@ -238,9 +238,9 @@ selection->dynamicCall("InsertAfter(QString&)", "\n"); //selection->dynamicCall("MoveLeft(int)", 1); - selection->querySubObject("ParagraphFormat")->dynamicCall("Alignment", "wdAlignParagraphCenter"); + //selection->querySubObject("ParagraphFormat")->dynamicCall("Alignment", "wdAlignParagraphCenter"); //selection->dynamicCall("TypeText(QString&)", "Table Test");//设置标题 - + selection->dynamicCall("TypeText(QString&)", sTitle); QAxObject *range = selection->querySubObject("Range"); QAxObject *tables = m_wordDocuments->querySubObject("Tables"); QAxObject *table = tables->querySubObject("Add(QVariant,int,int)",range->asVariant(),row,column); diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index 02579f1..3da6680 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -299,7 +299,7 @@ false true - + D:/dev/software/softwareDirectory/build-AutoVerScheme-Desktop_Qt_5_14_2_MinGW_64_bit-Debug 1 diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index c90f1dc..d7aed77 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -252,7 +252,7 @@ ui->label_21->setText(QString("设备名称: %1").arg(task.sample_name)); ui->label_22->setText(QString("型号规格: %1").arg(task.sample_model)); ui->label_23->setText(QString("出厂编号: %1").arg(task.manufacture_no)); - ui->label_24->setText(QString("生产厂家: %1").arg(task.manufacture_no)); + ui->label_24->setText(QString("生产厂家: %1").arg(task.manufacturer)); } void CheckWindow::deleteItem(QLayout *layout) diff --git a/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp b/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp index 41e1816..a45d295 100644 --- a/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp +++ b/softwareDirectory/AutoVerScheme/dialogcheckresult.cpp @@ -27,6 +27,7 @@ int rowCount=0; int row=0; measureCalList = measList; + measHeadList = headList; for (const SaveDeviceMeasureCalibrator& measItem : measList) { //获取行号 并进行添加行 @@ -79,7 +80,46 @@ void DialogCheckResult::on_pushButton_2_clicked() { - + WordEngine engine; + QString strPath = "D://数字多用表8846A校准证书模板.doc"; + engine.open(strPath); + QStringList itemList; + QStringList conentList; + itemList <<"unit"<<"address"<<"jianAddr"<<"time2"<<"temperature"<<"humidity"; + conentList <<""<<""<comboBoxPlace->currentText()<dateEditCheck->text()<lineEditTemp->text()<lineEdit_Hum->text(); + engine.setMarks("unit",""); + engine.setMarks("address",""); + engine.setMarks("jianAddr",ui->comboBoxPlace->currentText()); + engine.setMarks("time2",ui->dateEditCheck->text()); + engine.setMarks("temperature",ui->lineEditTemp->text()); + engine.setMarks("humidity",ui->lineEdit_Hum->text()); + //engine.setBatchMarks(itemList,conentLis;t) + QString strLabel = "result"; + //engine.setMarks(strLabel,"1.表格1"); + QString strTitle = "1.表格1"; + int rows = measureCalList.length()+1; + int cols = measHeadList.length(); + QAxObject* pTable = engine.insertTable(strLabel,rows,cols,strTitle); + for (int i=0;i #include "basecommonapi.h" +#include "wordengine.h" namespace Ui { class DialogCheckResult; @@ -27,6 +28,7 @@ private: Ui::DialogCheckResult *ui; QList measureCalList; + QStringList measHeadList; }; #endif // DIALOGCHECKRESULT_H diff --git a/softwareDirectory/AutoVerScheme/verifywindow.cpp b/softwareDirectory/AutoVerScheme/verifywindow.cpp index 34b5197..c78962c 100644 --- a/softwareDirectory/AutoVerScheme/verifywindow.cpp +++ b/softwareDirectory/AutoVerScheme/verifywindow.cpp @@ -1,6 +1,7 @@ #include "verifywindow.h" #include "ui_verifywindow.h" #include +#include VerifyWindow::VerifyWindow(QWidget *parent) : QWidget(parent), @@ -21,12 +22,16 @@ VerifyWindow::~VerifyWindow() { + programList.clear(); delete ui; } void VerifyWindow::getVerifyMethod() { + programList.clear(); programList = BaseCommonApi::getCheckProgramManage(); + ui->tableWidgetMethod->clearContents(); + ui->tableWidgetMethod->setRowCount(0); int rowCount = 0; int row=0; for (const CheckProgramManage& program : programList) { @@ -99,6 +104,7 @@ { ConnectInfo info; info.state="未连接"; + info.type = 1; QList result = BaseCommonApi::getCatDeviceInfor(id); if(result.length()>0){ info.deviceName = result[0].equipment_name; @@ -108,6 +114,7 @@ if(addrList.length()>0){ info.programInterface = addrList[0]; } + info.cmdList = BaseCommonApi::getInstructionLib(id); connectList.append(info); addrList.clear(); } @@ -120,6 +127,7 @@ { ConnectInfo info; info.state="未连接"; + info.type = 0; QList result = BaseCommonApi::getTestedCatDevice(id); if(result.length()>0){ info.deviceName = result[0].equipment_name; @@ -129,6 +137,7 @@ if(addrList.length()>0){ info.programInterface = addrList[0]; } + info.cmdList = BaseCommonApi::getInstructionLib(id); connectList.append(info); addrList.clear(); } @@ -186,3 +195,263 @@ } } } + +void VerifyWindow::deleteItem(QLayout *layout) +{ + QLayoutItem *child; + while ((child = layout->takeAt(0)) != nullptr) + { + //setParent为NULL,防止删除之后界面不消失 + if(child->widget()) + { + child->widget()->setParent(nullptr); + delete child->widget(); + } + else if (child->layout()) + { + deleteItem(child->layout()); + child->layout()->deleteLater(); + } + delete child; + } +} +void VerifyWindow::on_deviceButton_clicked(CatDeviceInfor info,int idx) +{ + for(int i=0;ihorizontalLayout_14->itemAt(i); + QPushButton *btn_1 = qobject_cast(child->widget()); + if(i==idx){ + btn_1->setStyleSheet("QPushButton{" + "background-color:rgb(55,83,123);" + "color:rgb(255,255,255);" + "}"); + }else{ + btn_1->setStyleSheet("QPushButton{" + "background-color:rgb(240,240,240);" + "color:rgb(51,51,51);" + "}"); + } + } + ui->label_21->setText(QString("设备名称: %1").arg(info.equipment_name)); + ui->label_22->setText(QString("型号规格: %1").arg(info.model)); + ui->label_23->setText(QString("出厂编号: %1").arg(info.manufacture_no)); + ui->label_24->setText(QString("生产厂家: %1").arg(info.manufacturer)); +} + +void VerifyWindow::on_pushButton_13_clicked() +{ + deleteItem(ui->horizontalLayout_14); + int idx=0; + catDeviceList.clear(); + QString standardId=""; + if(programInfo.standard_device_id!="") + { + QStringList idList = programInfo.standard_device_id.split(","); + for(const QString& id : idList) + { + standardId = id; + QList result = BaseCommonApi::getCatDeviceInfor(id); + if(result.length()>0){ + CatDeviceInfor info = result[0]; + catDeviceList.append(info); + QPushButton *btn_1 = new QPushButton(); + btn_1->setText(info.equipment_name); + btn_1->setStyleSheet("QPushButton{" + "background-color:rgb(240,240,240);" + "color:rgb(51,51,51);" + "}"); + //btn_1->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed); + QFont font; + font.setPointSize(12);//字体大小 + font.setBold(true); + btn_1->setFont(font); + btn_1->setCursor(Qt::PointingHandCursor); + connect(btn_1, &QPushButton::clicked, this, [this,info,idx]() { + on_deviceButton_clicked(info,idx); + }); + ui->horizontalLayout_14->addWidget(btn_1); + idx++; + } + result.clear(); + } + idList.clear(); + } + on_deviceButton_clicked(catDeviceList[0],0); + ui->horizontalLayout_14->addStretch(); + + if(catDeviceList.length()>0) + { + headList.clear(); + calibrationList.clear(); + calibrationList =BaseCommonApi::Search_VerifyTable(standardId,&headList); + + //tableWidgetItem + ui->tableWidget_Point->clearContents(); + ui->tableWidget_Point->setRowCount(0); + //循环数据 + 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[2])); + ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); + row++; + } + } + + ui->stackedWidget_2->setCurrentIndex(1); +} + +void VerifyWindow::initCheckTable() +{ + ui->tableWidgetCheck->clearContents(); + ui->tableWidgetCheck->setRowCount(0); + ui->tableWidgetCheck->setColumnCount(0); + int rowCount = 0; + int row=0; + ui->tableWidgetCheck->setColumnCount(headList.count()); + ui->tableWidgetCheck->setHorizontalHeaderLabels(headList); + for(int i=0;itableWidgetCheck->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); + } + measureCalList.clear(); + for(int i=0;itableWidget_Point->rowCount();i++){ + Qt::CheckState state = ui->tableWidget_Point->item(i,0)->checkState(); + if(state == Qt::Checked){ + QStringList& item = calibrationList[i]; + int cnt = ui->tableWidget_Point->item(i,2)->text().toInt(); + for(int j=0;jtableWidgetCheck->rowCount(); + ui->tableWidgetCheck->insertRow(rowCount); + ui->tableWidgetCheck->setItem(row, 0, new QTableWidgetItem(QString::number(row+1))); + //循环读取值 headlist,count是列的数量 + for(int k=1;ktableWidgetCheck->setItem(row, k, new QTableWidgetItem(item[k])); + } + StandCheckDataCalibrator measItem; +// measItem.item_data_id = item[1]; +// measItem.maximum_error_formula = item[10];//最大允许误差(公式) +// measItem.error_param_a = item[11];//误差参数a +// measItem.error_param_b = item[12];//误差参数b +// measItem.params = item[2];//参数 +// measItem.capacity=item[3];//量 +// measItem.unit=item[4];//单位 +// measItem.frequency=item[5];//频率 +// measItem.frequency_unit=item[6];//频率单位 +// measItem.range_range=item[7];//量程 +// measItem.standard_value=item[8];//标准值(输入字段,特殊:指针式万用表输出字段) +// measItem.indicating_value=item[15];//示值(输出字段,特殊:指针式万用表输入字段) +// measItem.maximum_error=item[10];//最大允许误差(值) +// //measItem.absolute_error=item[11];//绝对误差 +// measItem.resolution=item[9];//分辨力 +// measItem.measure_indication_value=item[19];//被检表示值 + measureCalList.append(measItem); + row++; + } + } + } + if(connectList.length()>0&&connectList[0].type==1) + standardEngine.openDevice(connectList[0].programInterface.visa,"Visa"); + if(connectList.length()>1&&connectList[1].type==0) + deviceEngine.openDevice(connectList[1].programInterface.visa,"Visa"); +} + +InstructionLib* VerifyWindow::getCmdByCheckName(int idx,QString name) +{ + if(idx>=0&&idxinstruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + standardEngine.sendData(sCmd); + } + } + } + } + //被检设备读数 + if(deviceEngine.getState()){ + InstructionLib *instrcutLib = getCmdByCheckName(0,item.params); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + deviceEngine.sendData(sCmd); + } + } + Delay_MSec(2000); + sRet = deviceEngine.queryData(instrcutLib->instruct_read); + } + } + // + if(sRet==""){ + bool bOk = false; + double dRet = QInputDialog::getDouble(this,"手动测试","请输入被检示值",0,-100000, 100000,1,&bOk); + + if (bOk) { + sRet = QString::number(dRet); + } + } + item.test_value_one = sRet; + ui->tableWidgetCheck->setItem(i,19,new QTableWidgetItem(sRet)); + } +} + +void VerifyWindow::on_pushButton_pause_clicked() +{ + +} + +void VerifyWindow::on_pushButton_stop_clicked() +{ + +} + +void VerifyWindow::on_pushButton_save_clicked() +{ + +} + +void VerifyWindow::on_pushButton_close_clicked() +{ + ui->stackedWidget_2->setCurrentIndex(0); + ui->stackedWidget->setCurrentIndex(0); + getVerifyMethod(); +} + +void VerifyWindow::on_pushButton_12_clicked() +{ + showDevice(); +} diff --git a/softwareDirectory/AutoVerScheme/verifywindow.h b/softwareDirectory/AutoVerScheme/verifywindow.h index e32aea4..5cd4b06 100644 --- a/softwareDirectory/AutoVerScheme/verifywindow.h +++ b/softwareDirectory/AutoVerScheme/verifywindow.h @@ -19,6 +19,10 @@ private: void getVerifyMethod(); void initDeviceInfo(); + void deleteItem(QLayout *layout); + void initCheckTable(); + InstructionLib* getCmdByCheckName(int idx,QString name); + void Delay_MSec(unsigned int msec); private slots: void showDevice(); void on_editButton_clicked(); @@ -27,12 +31,32 @@ void on_tableWidget_3_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn); + void on_pushButton_13_clicked(); + + void on_pushButton_start_clicked(); + + void on_pushButton_pause_clicked(); + + void on_pushButton_stop_clicked(); + + void on_pushButton_save_clicked(); + + void on_pushButton_close_clicked(); + + void on_pushButton_12_clicked(); + void on_deviceButton_clicked(CatDeviceInfor info,int idx); + private: Ui::VerifyWindow *ui; QList programList; CheckProgramManage programInfo; QList connectList; - + QList catDeviceList; + QStringList headList; + QList calibrationList; + QList measureCalList; + VisaCommonEngine deviceEngine; + VisaCommonEngine standardEngine; }; #endif // VERIFYWINDOW_H diff --git a/softwareDirectory/AutoVerScheme/verifywindow.ui b/softwareDirectory/AutoVerScheme/verifywindow.ui index a4ee6c2..750ff51 100644 --- a/softwareDirectory/AutoVerScheme/verifywindow.ui +++ b/softwareDirectory/AutoVerScheme/verifywindow.ui @@ -16,7 +16,7 @@ background-color: rgb(255, 255, 255); - + @@ -75,141 +75,13 @@ - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - + + + - - - - 48 - 48 - - - - - 12 - 75 - true - - - - image: url(:/image/Index/u51.svg); - - - - - - - - - - - 12 - 75 - true - - - - 选择核查程序 - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 48 - 48 - - - - - 12 - 75 - true - - - - image: url(:/image/Index/u53.svg); - - - - - - - - - - - 12 - 75 - true - - - - 设备连接状态 - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - 0 - - - - - + - + Qt::Horizontal @@ -222,31 +94,102 @@ - - - - 0 - 0 - - - - - 120 - 36 - - - - color: rgb(255, 255, 255); -background-color: rgb(55, 83, 123); -border-radius:5px; - - - 加载 - - + + + + + + 48 + 48 + + + + + 12 + 75 + true + + + + image: url(:/image/Index/u51.svg); + + + + + + + + + + + 12 + 75 + true + + + + 选择核查程序 + + + + - + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 48 + 48 + + + + + 12 + 75 + true + + + + image: url(:/image/Index/u53.svg); + + + + + + + + + + + 12 + 75 + true + + + + 设备连接状态 + + + + + + + Qt::Horizontal @@ -260,188 +203,1090 @@ - - - - true - - - - 选择 - - - - 12 - - - - - - 核查程序名称 - - - - 12 - - - - - - 创建人 - - - - 12 - - - - - - 创建时间 - - - - 12 - - - - - - 说明 - - - - 12 - - - - - - 操作 - - - - 12 - - - - - - - - - 12 + + + + 0 - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 1 - 0 - - - - - 72 - 26 - - - - - 12 - 75 - true - - - - color: rgb(255, 255, 255); + + + + + + 12 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 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); + + + 查询 + + + + + + + + 0 + 0 + + + + + 72 + 26 + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); background-color: rgb(207, 132, 33); border-radius:5px; - - - 重置 - - - - + + + 重置 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 120 + 36 + + + + color: rgb(255, 255, 255); +background-color: rgb(55, 83, 123); +border-radius:5px; + + + 加载 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + true + + + + 选择 + + + + 12 + + + + + + 核查程序名称 + + + + 12 + + + + + + 创建人 + + + + 12 + + + + + + 创建时间 + + + + 12 + + + + + + 说明 + + + + 12 + + + + + + 操作 + + + + 12 + + + + + + + + + + + + + + + 设备连接关系图 + + + Qt::AlignCenter + + + + + + + 设备连接状态提示 + + + + + + + 设备名称 + + + + 12 + 75 + true + + + + + + 连接状态 + + + + 12 + 75 + true + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + 确定 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + 0 + 0 + + + + + 0 + 160 + + + + 设备接口设置 + + + + + + + 12 + + + + 串口 + + + + + + + + 12 + + + + 端口号: + + + + + + + + 12 + + + + true + + + + + + + + 12 + + + + 波特率: + + + + + + + + 12 + + + + true + + + 9600 + + + 1 + + + + 4800 + + + + + 9600 + + + + + 14400 + + + + + 19200 + + + + + 38400 + + + + + + + + + 12 + + + + 校验位: + + + + + + + + 12 + + + + + None + + + + + Odd + + + + + Even + + + + + + + + + 12 + + + + 数据位: + + + + + + + + 12 + + + + 1 + + + + 7 + + + + + 8 + + + + + + + + + 12 + + + + 停止位: + + + + + + + + 12 + + + + 1 + + + + None + + + + + One + + + + + Two + + + + + OnePointFive + + + + + + + + + 12 + + + + VISA + + + + + + + + 12 + + + + true + + + + + + + + + - - - - + + + + + + 20 + + + 10 + + + 0 + - - - 设备连接关系图 + + + + 12 + 75 + true + - - Qt::AlignCenter + + 执行测试 + + + + :/image/Index/u712.svg + + + + + 24 + 24 + - - - 设备连接状态提示 + + + + 12 + 75 + true + - + + 暂停测试 + + + + :/image/Index/u715.svg + + + + + 24 + 24 + + + + + + + + + 12 + 75 + true + + + + 终止测试 + + + + :/image/Index/u703.svg + + + + + 24 + 24 + + + + + + + + + 12 + 75 + true + + + + 结果保存 + + + + :/image/Index/u706.svg + + + + + 24 + 24 + + + + + + + + + 12 + 75 + true + + + + 关闭 + + + + :/image/Index/u709.svg + + + + + 24 + 24 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 12 + 75 + true + + + + 环境温度: + + + + + + + + 12 + 75 + true + + + + 20℃ + + + + + + + + 12 + 75 + true + + + + 环境湿度: + + + + + + + + 12 + 75 + true + + + + 50%RH + + + + + + + + + + + + + + 12 + 75 + true + + + + 状态面板 + + + + + + + + 12 + 75 + true + + + + 标准设备面板 + + + + + + + 设备名称 + + + + 12 + 75 + true + + + + + + 状态 + + + + 12 + 75 + true + + + + + + + + + + + + + + + 0 + 0 + + + + + 12 + - + + + 2 + + + + + + + + + + 12 + 75 + true + + + + 设备名称: + + + + + + + + 12 + 75 + true + + + + 型号规格: + + + + + + + + 12 + 75 + true + + + + 出厂编号: + + + + + + + + 12 + 75 + true + + + + 生产厂家: + + + + + + + + + background-color: rgb(55, 83, 123); + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + image: url(:/image/Index/u642.svg); + + + + + + + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); + + + 外观及功能性检查 + + + + + + + + + + + + + + 12 + + + + + + 12 + + + + + + + 合格 + + + + + + + + 12 + + + + + + + 外观完好,工作正常 + + + + + + + + + + background-color: rgb(55, 83, 123); + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + image: url(:/image/Index/u642.svg); + + + + + + + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); + + + 检定数据 + + + + + + + + + + + + + + + + + 12 + 75 + true + + + + 检定设置面板 + + + + - 设备名称 + 选择 @@ -453,7 +1298,19 @@ - 连接状态 + 核查点 + + + + 12 + 75 + true + + + + + + 循环次数 @@ -466,303 +1323,32 @@ - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - 确定 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); +background-color: rgb(55, 83, 123); +padding:10px; + + + 运行提示 + + + + + - - - - - 0 - 0 - - - - - 0 - 160 - - - - 设备接口设置 - - - - - - - 12 - - - - 串口 - - - - - - - - 12 - - - - 端口号: - - - - - - - - 12 - - - - true - - - - - - - - 12 - - - - 波特率: - - - - - - - - 12 - - - - true - - - 9600 - - - 1 - - - - 4800 - - - - - 9600 - - - - - 14400 - - - - - 19200 - - - - - 38400 - - - - - - - - - 12 - - - - 校验位: - - - - - - - - 12 - - - - - None - - - - - Odd - - - - - Even - - - - - - - - - 12 - - - - 数据位: - - - - - - - - 12 - - - - 1 - - - - 7 - - - - - 8 - - - - - - - - - 12 - - - - 停止位: - - - - - - - - 12 - - - - 1 - - - - None - - - - - One - - - - - Two - - - - - OnePointFive - - - - - - - - - 12 - - - - VISA - - - - - - - - 12 - - - - true - - - - - - @@ -770,24 +1356,7 @@ - - - pushButton_12 - clicked() - VerifyWindow - showDevice() - - - 669 - 753 - - - 916 - 788 - - - - + showDevice() diff --git a/softwareDirectory/AutoVerScheme/wordengine.cpp b/softwareDirectory/AutoVerScheme/wordengine.cpp index 04d4231..9808fd4 100644 --- a/softwareDirectory/AutoVerScheme/wordengine.cpp +++ b/softwareDirectory/AutoVerScheme/wordengine.cpp @@ -229,7 +229,7 @@ } } -QAxObject *WordEngine::insertTable(QString sLabel,int row, int column){ +QAxObject *WordEngine::insertTable(QString sLabel,int row, int column,QString sTitle){ QAxObject *bookmark = m_wordDocuments->querySubObject("Bookmarks(QVariant)", sLabel); if(bookmark) { @@ -238,9 +238,9 @@ selection->dynamicCall("InsertAfter(QString&)", "\n"); //selection->dynamicCall("MoveLeft(int)", 1); - selection->querySubObject("ParagraphFormat")->dynamicCall("Alignment", "wdAlignParagraphCenter"); + //selection->querySubObject("ParagraphFormat")->dynamicCall("Alignment", "wdAlignParagraphCenter"); //selection->dynamicCall("TypeText(QString&)", "Table Test");//设置标题 - + selection->dynamicCall("TypeText(QString&)", sTitle); QAxObject *range = selection->querySubObject("Range"); QAxObject *tables = m_wordDocuments->querySubObject("Tables"); QAxObject *table = tables->querySubObject("Add(QVariant,int,int)",range->asVariant(),row,column); diff --git a/softwareDirectory/AutoVerScheme/wordengine.h b/softwareDirectory/AutoVerScheme/wordengine.h index 466749a..25d0319 100644 --- a/softwareDirectory/AutoVerScheme/wordengine.h +++ b/softwareDirectory/AutoVerScheme/wordengine.h @@ -26,7 +26,7 @@ bool setBatchMarks(QStringList &itemList,QStringList sometexts); // 创建表格 void insertTable(int nStart, int nEnd, int row, int column); - QAxObject *insertTable(QString sLabel,int row, int column); + QAxObject *insertTable(QString sLabel,int row, int column,QString sTitle); //合并单元格 void MergeCells(QAxObject *table, int nStartRow,int nStartCol,int nEndRow,int nEndCol); //插入图片 @@ -55,4 +55,4 @@ public slots: }; -#endif // WORDENGINE_H \ No newline at end of file +#endif // WORDENGINE_H