diff --git a/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp b/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp index 26629cc..b59b166 100644 --- a/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp +++ b/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp @@ -19,6 +19,7 @@ ui->tableWidgetStd->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); ui->tableWidgetChecker->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); } + ui->tableWidgetChecker->setFixedHeight(80); ui->tableWidgetStd->verticalHeader()->setParent(nullptr); ui->tableWidgetChecker->verticalHeader()->setParent(nullptr); ui->tableWidgetCheck->verticalHeader()->setParent(nullptr); diff --git a/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp b/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp index 26629cc..b59b166 100644 --- a/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp +++ b/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp @@ -19,6 +19,7 @@ ui->tableWidgetStd->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); ui->tableWidgetChecker->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); } + ui->tableWidgetChecker->setFixedHeight(80); ui->tableWidgetStd->verticalHeader()->setParent(nullptr); ui->tableWidgetChecker->verticalHeader()->setParent(nullptr); ui->tableWidgetCheck->verticalHeader()->setParent(nullptr); diff --git a/softwareDirectory/AutoVerScheme/formbizdeviceselect.cpp b/softwareDirectory/AutoVerScheme/formbizdeviceselect.cpp index b5bd5dc..49c514a 100644 --- a/softwareDirectory/AutoVerScheme/formbizdeviceselect.cpp +++ b/softwareDirectory/AutoVerScheme/formbizdeviceselect.cpp @@ -9,9 +9,11 @@ ui(new Ui::FormBizDeviceSelect) { ui->setupUi(this); - for(int i=1;i<7;i++){ - ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); - ui->tableWidget_3->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); + for(int i=0;i<8;i++){ + ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(i,QHeaderView::ResizeToContents); + } + for(int i=0;i<7;i++){ + ui->tableWidget_3->horizontalHeader()->setSectionResizeMode(i,QHeaderView::ResizeToContents); } ui->tableWidget_2->hideColumn(1); ui->comboBox_3->addItem("请选择标准装置名称"); diff --git a/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp b/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp index 26629cc..b59b166 100644 --- a/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp +++ b/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp @@ -19,6 +19,7 @@ ui->tableWidgetStd->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); ui->tableWidgetChecker->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); } + ui->tableWidgetChecker->setFixedHeight(80); ui->tableWidgetStd->verticalHeader()->setParent(nullptr); ui->tableWidgetChecker->verticalHeader()->setParent(nullptr); ui->tableWidgetCheck->verticalHeader()->setParent(nullptr); diff --git a/softwareDirectory/AutoVerScheme/formbizdeviceselect.cpp b/softwareDirectory/AutoVerScheme/formbizdeviceselect.cpp index b5bd5dc..49c514a 100644 --- a/softwareDirectory/AutoVerScheme/formbizdeviceselect.cpp +++ b/softwareDirectory/AutoVerScheme/formbizdeviceselect.cpp @@ -9,9 +9,11 @@ ui(new Ui::FormBizDeviceSelect) { ui->setupUi(this); - for(int i=1;i<7;i++){ - ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); - ui->tableWidget_3->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); + for(int i=0;i<8;i++){ + ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(i,QHeaderView::ResizeToContents); + } + for(int i=0;i<7;i++){ + ui->tableWidget_3->horizontalHeader()->setSectionResizeMode(i,QHeaderView::ResizeToContents); } ui->tableWidget_2->hideColumn(1); ui->comboBox_3->addItem("请选择标准装置名称"); diff --git a/softwareDirectory/AutoVerScheme/formbizdeviceselect.ui b/softwareDirectory/AutoVerScheme/formbizdeviceselect.ui index f782353..8e0ddc3 100644 --- a/softwareDirectory/AutoVerScheme/formbizdeviceselect.ui +++ b/softwareDirectory/AutoVerScheme/formbizdeviceselect.ui @@ -188,7 +188,7 @@ - 12 + 9 @@ -203,7 +203,7 @@ - 12 + 9 @@ -213,7 +213,7 @@ - 12 + 9 @@ -223,7 +223,7 @@ - 12 + 9 @@ -233,7 +233,7 @@ - 12 + 9 @@ -243,7 +243,7 @@ - 12 + 9 @@ -253,7 +253,7 @@ - 12 + 9 @@ -407,7 +407,7 @@ - 12 + 9 @@ -417,7 +417,7 @@ - 12 + 9 @@ -427,7 +427,7 @@ - 12 + 9 @@ -437,7 +437,7 @@ - 12 + 9 @@ -447,7 +447,7 @@ - 12 + 9 @@ -457,7 +457,7 @@ - 12 + 9 @@ -467,7 +467,7 @@ - 12 + 9 diff --git a/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp b/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp index 26629cc..b59b166 100644 --- a/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp +++ b/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp @@ -19,6 +19,7 @@ ui->tableWidgetStd->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); ui->tableWidgetChecker->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); } + ui->tableWidgetChecker->setFixedHeight(80); ui->tableWidgetStd->verticalHeader()->setParent(nullptr); ui->tableWidgetChecker->verticalHeader()->setParent(nullptr); ui->tableWidgetCheck->verticalHeader()->setParent(nullptr); diff --git a/softwareDirectory/AutoVerScheme/formbizdeviceselect.cpp b/softwareDirectory/AutoVerScheme/formbizdeviceselect.cpp index b5bd5dc..49c514a 100644 --- a/softwareDirectory/AutoVerScheme/formbizdeviceselect.cpp +++ b/softwareDirectory/AutoVerScheme/formbizdeviceselect.cpp @@ -9,9 +9,11 @@ ui(new Ui::FormBizDeviceSelect) { ui->setupUi(this); - for(int i=1;i<7;i++){ - ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); - ui->tableWidget_3->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); + for(int i=0;i<8;i++){ + ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(i,QHeaderView::ResizeToContents); + } + for(int i=0;i<7;i++){ + ui->tableWidget_3->horizontalHeader()->setSectionResizeMode(i,QHeaderView::ResizeToContents); } ui->tableWidget_2->hideColumn(1); ui->comboBox_3->addItem("请选择标准装置名称"); diff --git a/softwareDirectory/AutoVerScheme/formbizdeviceselect.ui b/softwareDirectory/AutoVerScheme/formbizdeviceselect.ui index f782353..8e0ddc3 100644 --- a/softwareDirectory/AutoVerScheme/formbizdeviceselect.ui +++ b/softwareDirectory/AutoVerScheme/formbizdeviceselect.ui @@ -188,7 +188,7 @@ - 12 + 9 @@ -203,7 +203,7 @@ - 12 + 9 @@ -213,7 +213,7 @@ - 12 + 9 @@ -223,7 +223,7 @@ - 12 + 9 @@ -233,7 +233,7 @@ - 12 + 9 @@ -243,7 +243,7 @@ - 12 + 9 @@ -253,7 +253,7 @@ - 12 + 9 @@ -407,7 +407,7 @@ - 12 + 9 @@ -417,7 +417,7 @@ - 12 + 9 @@ -427,7 +427,7 @@ - 12 + 9 @@ -437,7 +437,7 @@ - 12 + 9 @@ -447,7 +447,7 @@ - 12 + 9 @@ -457,7 +457,7 @@ - 12 + 9 @@ -467,7 +467,7 @@ - 12 + 9 diff --git a/softwareDirectory/AutoVerScheme/verifywindow.cpp b/softwareDirectory/AutoVerScheme/verifywindow.cpp index 79736b1..50f73ba 100644 --- a/softwareDirectory/AutoVerScheme/verifywindow.cpp +++ b/softwareDirectory/AutoVerScheme/verifywindow.cpp @@ -366,9 +366,41 @@ ui->tableWidget_Standard->setItem(row, 1, new QTableWidgetItem(info.state)); //设置数据 row++; } + //搜索仪器地址放入下拉框 + ui->comboBox_visa->clear(); + + VisaCommonEngine engine; + QStringList visaAddrs = engine.getVisaAddrs(); + ui->comboBox_visa->addItems(visaAddrs); ui->tableWidget_3->selectRow(0); + connect(ui->comboBox_visa,&QComboBox::currentTextChanged,this,&VerifyWindow::on_comboBox_visa_OnCurrentTextChanged); } +void VerifyWindow::on_comboBox_visa_OnCurrentTextChanged(QString arg1) +{ + //lab_deviceinfo + getJoinState(arg1); + +} + +bool VerifyWindow::getJoinState(QString arg1) +{ + bool IsSucc=false; + QString visaAdd=arg1; + VisaCommonEngine engine; + QStringList parts = engine.getdeviceIdninfo(visaAdd).split(","); + if(parts.count()>2) + { + ui->lab_deviceinfo->setText(parts[0]+"-"+parts[1]); + IsSucc=true; + } + + if(parts.contains("false")) + { + ui->lab_deviceinfo->setText("无连接"); + } + return IsSucc; +} void VerifyWindow::on_editButton_clicked() { @@ -410,6 +442,7 @@ void VerifyWindow::on_tableWidget_3_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn) { if(currentRow>=0&¤tRowcomboBox_stop->setCurrentText(sList[4]); } } + //修改连接状态 + if(getJoinState(addr.visa)) + { + ui->tableWidget_3->setItem(currentRow,2,new QTableWidgetItem("已连接")); + }else{ ui->tableWidget_3->setItem(currentRow,2,new QTableWidgetItem("未连接"));} } } @@ -518,7 +556,7 @@ //固定大小文字显示不全 //button->setFixedSize(85, 40); button->setCheckable(true); - button->setAutoExclusive(true); + //button->setAutoExclusive(true); //设置第一个按钮选中状态 if(index==0){ button->setChecked(true);} //button->setc(true); @@ -608,7 +646,7 @@ //固定大小文字显示不全 //button->setFixedSize(85, 40); button->setCheckable(true); - button->setAutoExclusive(true); + //button->setAutoExclusive(true); //设置第一个按钮选中状态 if(index==0){ button->setChecked(true);} //button->setc(true); @@ -1297,13 +1335,21 @@ void VerifyWindow::connectDevice(){ QString rolename; + int count=0; for(ConnectInfo &visa:connectList) { if(visa.programInterface.visa!=""){ if(visa.visaEngine==nullptr) visa.visaEngine = new VisaCommonEngine; visa.visaEngine->openDevice(visa.programInterface.visa,"Visa"); + if(visa.visaEngine->getState()){ + visa.state="已连接"; + ui->tableWidget_Standard->setItem(count,1,new QTableWidgetItem("ON")); + } } + //visa.state="已连接"; + //ui->tableWidget_Standard->setItem(count,1,new QTableWidgetItem("ON")); + count++; } } @@ -1323,11 +1369,13 @@ void VerifyWindow::closeDevice(){ //关闭设备连接 int count=0; - for(const ConnectInfo &visa:connectList) + for(ConnectInfo &visa:connectList) { VisaCommonEngine *Engine=visa.visaEngine; if(Engine!=nullptr) Engine->closeDevice(); + visa.state="未连接"; + ui->tableWidget_Standard->setItem(count,1,new QTableWidgetItem("OFF")); count++; } } @@ -1586,3 +1634,43 @@ } } } + +void VerifyWindow::on_pushButtonSaveAddress_clicked() +{ + if(currConnectIdx>=0&&currConnectIdxradioButton_serial->isChecked()) + item.programInterface.communication_type = "SerialPort"; + else + item.programInterface.communication_type = "Visa"; + item.programInterface.serial_port = QString("%1;%2;%3;%4;%5").arg(ui->comboBox_port->currentText()).arg(ui->comboBox_baurt->currentText()).arg(ui->comboBox_check->currentText()) + .arg(ui->comboBox_data->currentText()).arg(ui->comboBox_stop->currentText()); + item.programInterface.visa = ui->comboBox_visa->currentText(); + if(BaseCommonApi::InsertVerificationProgramConfigInterface(item.programInterface)){ + QMessageBox::information(this, "提示", "保存成功!"); + } + else + { + QMessageBox::warning(this, "警告", "保存失败!"); + } + }else{ + if(ui->radioButton_serial->isChecked()) + item.programInterface.communication_type = "SerialPort"; + else + item.programInterface.communication_type = "Visa"; + item.programInterface.serial_port = QString("%1;%2;%3;%4;%5").arg(ui->comboBox_port->currentText()).arg(ui->comboBox_baurt->currentText()).arg(ui->comboBox_check->currentText()) + .arg(ui->comboBox_data->currentText()).arg(ui->comboBox_stop->currentText()); + item.programInterface.visa = ui->comboBox_visa->currentText(); + if(BaseCommonApi::UpdateVerificationProgramConfigInterface(item.programInterface)){ + QMessageBox::information(this, "提示", "保存成功!"); + }else{ + QMessageBox::warning(this, "警告", "保存失败!"); + } + } + } +} diff --git a/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp b/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp index 26629cc..b59b166 100644 --- a/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp +++ b/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp @@ -19,6 +19,7 @@ ui->tableWidgetStd->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); ui->tableWidgetChecker->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); } + ui->tableWidgetChecker->setFixedHeight(80); ui->tableWidgetStd->verticalHeader()->setParent(nullptr); ui->tableWidgetChecker->verticalHeader()->setParent(nullptr); ui->tableWidgetCheck->verticalHeader()->setParent(nullptr); diff --git a/softwareDirectory/AutoVerScheme/formbizdeviceselect.cpp b/softwareDirectory/AutoVerScheme/formbizdeviceselect.cpp index b5bd5dc..49c514a 100644 --- a/softwareDirectory/AutoVerScheme/formbizdeviceselect.cpp +++ b/softwareDirectory/AutoVerScheme/formbizdeviceselect.cpp @@ -9,9 +9,11 @@ ui(new Ui::FormBizDeviceSelect) { ui->setupUi(this); - for(int i=1;i<7;i++){ - ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); - ui->tableWidget_3->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); + for(int i=0;i<8;i++){ + ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(i,QHeaderView::ResizeToContents); + } + for(int i=0;i<7;i++){ + ui->tableWidget_3->horizontalHeader()->setSectionResizeMode(i,QHeaderView::ResizeToContents); } ui->tableWidget_2->hideColumn(1); ui->comboBox_3->addItem("请选择标准装置名称"); diff --git a/softwareDirectory/AutoVerScheme/formbizdeviceselect.ui b/softwareDirectory/AutoVerScheme/formbizdeviceselect.ui index f782353..8e0ddc3 100644 --- a/softwareDirectory/AutoVerScheme/formbizdeviceselect.ui +++ b/softwareDirectory/AutoVerScheme/formbizdeviceselect.ui @@ -188,7 +188,7 @@ - 12 + 9 @@ -203,7 +203,7 @@ - 12 + 9 @@ -213,7 +213,7 @@ - 12 + 9 @@ -223,7 +223,7 @@ - 12 + 9 @@ -233,7 +233,7 @@ - 12 + 9 @@ -243,7 +243,7 @@ - 12 + 9 @@ -253,7 +253,7 @@ - 12 + 9 @@ -407,7 +407,7 @@ - 12 + 9 @@ -417,7 +417,7 @@ - 12 + 9 @@ -427,7 +427,7 @@ - 12 + 9 @@ -437,7 +437,7 @@ - 12 + 9 @@ -447,7 +447,7 @@ - 12 + 9 @@ -457,7 +457,7 @@ - 12 + 9 @@ -467,7 +467,7 @@ - 12 + 9 diff --git a/softwareDirectory/AutoVerScheme/verifywindow.cpp b/softwareDirectory/AutoVerScheme/verifywindow.cpp index 79736b1..50f73ba 100644 --- a/softwareDirectory/AutoVerScheme/verifywindow.cpp +++ b/softwareDirectory/AutoVerScheme/verifywindow.cpp @@ -366,9 +366,41 @@ ui->tableWidget_Standard->setItem(row, 1, new QTableWidgetItem(info.state)); //设置数据 row++; } + //搜索仪器地址放入下拉框 + ui->comboBox_visa->clear(); + + VisaCommonEngine engine; + QStringList visaAddrs = engine.getVisaAddrs(); + ui->comboBox_visa->addItems(visaAddrs); ui->tableWidget_3->selectRow(0); + connect(ui->comboBox_visa,&QComboBox::currentTextChanged,this,&VerifyWindow::on_comboBox_visa_OnCurrentTextChanged); } +void VerifyWindow::on_comboBox_visa_OnCurrentTextChanged(QString arg1) +{ + //lab_deviceinfo + getJoinState(arg1); + +} + +bool VerifyWindow::getJoinState(QString arg1) +{ + bool IsSucc=false; + QString visaAdd=arg1; + VisaCommonEngine engine; + QStringList parts = engine.getdeviceIdninfo(visaAdd).split(","); + if(parts.count()>2) + { + ui->lab_deviceinfo->setText(parts[0]+"-"+parts[1]); + IsSucc=true; + } + + if(parts.contains("false")) + { + ui->lab_deviceinfo->setText("无连接"); + } + return IsSucc; +} void VerifyWindow::on_editButton_clicked() { @@ -410,6 +442,7 @@ void VerifyWindow::on_tableWidget_3_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn) { if(currentRow>=0&¤tRowcomboBox_stop->setCurrentText(sList[4]); } } + //修改连接状态 + if(getJoinState(addr.visa)) + { + ui->tableWidget_3->setItem(currentRow,2,new QTableWidgetItem("已连接")); + }else{ ui->tableWidget_3->setItem(currentRow,2,new QTableWidgetItem("未连接"));} } } @@ -518,7 +556,7 @@ //固定大小文字显示不全 //button->setFixedSize(85, 40); button->setCheckable(true); - button->setAutoExclusive(true); + //button->setAutoExclusive(true); //设置第一个按钮选中状态 if(index==0){ button->setChecked(true);} //button->setc(true); @@ -608,7 +646,7 @@ //固定大小文字显示不全 //button->setFixedSize(85, 40); button->setCheckable(true); - button->setAutoExclusive(true); + //button->setAutoExclusive(true); //设置第一个按钮选中状态 if(index==0){ button->setChecked(true);} //button->setc(true); @@ -1297,13 +1335,21 @@ void VerifyWindow::connectDevice(){ QString rolename; + int count=0; for(ConnectInfo &visa:connectList) { if(visa.programInterface.visa!=""){ if(visa.visaEngine==nullptr) visa.visaEngine = new VisaCommonEngine; visa.visaEngine->openDevice(visa.programInterface.visa,"Visa"); + if(visa.visaEngine->getState()){ + visa.state="已连接"; + ui->tableWidget_Standard->setItem(count,1,new QTableWidgetItem("ON")); + } } + //visa.state="已连接"; + //ui->tableWidget_Standard->setItem(count,1,new QTableWidgetItem("ON")); + count++; } } @@ -1323,11 +1369,13 @@ void VerifyWindow::closeDevice(){ //关闭设备连接 int count=0; - for(const ConnectInfo &visa:connectList) + for(ConnectInfo &visa:connectList) { VisaCommonEngine *Engine=visa.visaEngine; if(Engine!=nullptr) Engine->closeDevice(); + visa.state="未连接"; + ui->tableWidget_Standard->setItem(count,1,new QTableWidgetItem("OFF")); count++; } } @@ -1586,3 +1634,43 @@ } } } + +void VerifyWindow::on_pushButtonSaveAddress_clicked() +{ + if(currConnectIdx>=0&&currConnectIdxradioButton_serial->isChecked()) + item.programInterface.communication_type = "SerialPort"; + else + item.programInterface.communication_type = "Visa"; + item.programInterface.serial_port = QString("%1;%2;%3;%4;%5").arg(ui->comboBox_port->currentText()).arg(ui->comboBox_baurt->currentText()).arg(ui->comboBox_check->currentText()) + .arg(ui->comboBox_data->currentText()).arg(ui->comboBox_stop->currentText()); + item.programInterface.visa = ui->comboBox_visa->currentText(); + if(BaseCommonApi::InsertVerificationProgramConfigInterface(item.programInterface)){ + QMessageBox::information(this, "提示", "保存成功!"); + } + else + { + QMessageBox::warning(this, "警告", "保存失败!"); + } + }else{ + if(ui->radioButton_serial->isChecked()) + item.programInterface.communication_type = "SerialPort"; + else + item.programInterface.communication_type = "Visa"; + item.programInterface.serial_port = QString("%1;%2;%3;%4;%5").arg(ui->comboBox_port->currentText()).arg(ui->comboBox_baurt->currentText()).arg(ui->comboBox_check->currentText()) + .arg(ui->comboBox_data->currentText()).arg(ui->comboBox_stop->currentText()); + item.programInterface.visa = ui->comboBox_visa->currentText(); + if(BaseCommonApi::UpdateVerificationProgramConfigInterface(item.programInterface)){ + QMessageBox::information(this, "提示", "保存成功!"); + }else{ + QMessageBox::warning(this, "警告", "保存失败!"); + } + } + } +} diff --git a/softwareDirectory/AutoVerScheme/verifywindow.h b/softwareDirectory/AutoVerScheme/verifywindow.h index d367467..45e47cf 100644 --- a/softwareDirectory/AutoVerScheme/verifywindow.h +++ b/softwareDirectory/AutoVerScheme/verifywindow.h @@ -87,6 +87,10 @@ void on_tableWidgetStd_cellChanged(int row, int column); void on_tableWidgetBiz_cellChanged(int row, int column); + void on_comboBox_visa_OnCurrentTextChanged(QString arg1); + bool getJoinState(QString arg1); + + void on_pushButtonSaveAddress_clicked(); private: Ui::VerifyWindow *ui; @@ -119,6 +123,7 @@ QMap unitTypeTransList; QMap cmdPlaceHolderList; QStringList readItems; + int currConnectIdx; }; #endif // VERIFYWINDOW_H diff --git a/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp b/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp index 26629cc..b59b166 100644 --- a/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp +++ b/softwareDirectory/AutoVerScheme/dialogverifyresult.cpp @@ -19,6 +19,7 @@ ui->tableWidgetStd->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); ui->tableWidgetChecker->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); } + ui->tableWidgetChecker->setFixedHeight(80); ui->tableWidgetStd->verticalHeader()->setParent(nullptr); ui->tableWidgetChecker->verticalHeader()->setParent(nullptr); ui->tableWidgetCheck->verticalHeader()->setParent(nullptr); diff --git a/softwareDirectory/AutoVerScheme/formbizdeviceselect.cpp b/softwareDirectory/AutoVerScheme/formbizdeviceselect.cpp index b5bd5dc..49c514a 100644 --- a/softwareDirectory/AutoVerScheme/formbizdeviceselect.cpp +++ b/softwareDirectory/AutoVerScheme/formbizdeviceselect.cpp @@ -9,9 +9,11 @@ ui(new Ui::FormBizDeviceSelect) { ui->setupUi(this); - for(int i=1;i<7;i++){ - ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); - ui->tableWidget_3->horizontalHeader()->setSectionResizeMode(i,QHeaderView::Stretch); + for(int i=0;i<8;i++){ + ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(i,QHeaderView::ResizeToContents); + } + for(int i=0;i<7;i++){ + ui->tableWidget_3->horizontalHeader()->setSectionResizeMode(i,QHeaderView::ResizeToContents); } ui->tableWidget_2->hideColumn(1); ui->comboBox_3->addItem("请选择标准装置名称"); diff --git a/softwareDirectory/AutoVerScheme/formbizdeviceselect.ui b/softwareDirectory/AutoVerScheme/formbizdeviceselect.ui index f782353..8e0ddc3 100644 --- a/softwareDirectory/AutoVerScheme/formbizdeviceselect.ui +++ b/softwareDirectory/AutoVerScheme/formbizdeviceselect.ui @@ -188,7 +188,7 @@ - 12 + 9 @@ -203,7 +203,7 @@ - 12 + 9 @@ -213,7 +213,7 @@ - 12 + 9 @@ -223,7 +223,7 @@ - 12 + 9 @@ -233,7 +233,7 @@ - 12 + 9 @@ -243,7 +243,7 @@ - 12 + 9 @@ -253,7 +253,7 @@ - 12 + 9 @@ -407,7 +407,7 @@ - 12 + 9 @@ -417,7 +417,7 @@ - 12 + 9 @@ -427,7 +427,7 @@ - 12 + 9 @@ -437,7 +437,7 @@ - 12 + 9 @@ -447,7 +447,7 @@ - 12 + 9 @@ -457,7 +457,7 @@ - 12 + 9 @@ -467,7 +467,7 @@ - 12 + 9 diff --git a/softwareDirectory/AutoVerScheme/verifywindow.cpp b/softwareDirectory/AutoVerScheme/verifywindow.cpp index 79736b1..50f73ba 100644 --- a/softwareDirectory/AutoVerScheme/verifywindow.cpp +++ b/softwareDirectory/AutoVerScheme/verifywindow.cpp @@ -366,9 +366,41 @@ ui->tableWidget_Standard->setItem(row, 1, new QTableWidgetItem(info.state)); //设置数据 row++; } + //搜索仪器地址放入下拉框 + ui->comboBox_visa->clear(); + + VisaCommonEngine engine; + QStringList visaAddrs = engine.getVisaAddrs(); + ui->comboBox_visa->addItems(visaAddrs); ui->tableWidget_3->selectRow(0); + connect(ui->comboBox_visa,&QComboBox::currentTextChanged,this,&VerifyWindow::on_comboBox_visa_OnCurrentTextChanged); } +void VerifyWindow::on_comboBox_visa_OnCurrentTextChanged(QString arg1) +{ + //lab_deviceinfo + getJoinState(arg1); + +} + +bool VerifyWindow::getJoinState(QString arg1) +{ + bool IsSucc=false; + QString visaAdd=arg1; + VisaCommonEngine engine; + QStringList parts = engine.getdeviceIdninfo(visaAdd).split(","); + if(parts.count()>2) + { + ui->lab_deviceinfo->setText(parts[0]+"-"+parts[1]); + IsSucc=true; + } + + if(parts.contains("false")) + { + ui->lab_deviceinfo->setText("无连接"); + } + return IsSucc; +} void VerifyWindow::on_editButton_clicked() { @@ -410,6 +442,7 @@ void VerifyWindow::on_tableWidget_3_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn) { if(currentRow>=0&¤tRowcomboBox_stop->setCurrentText(sList[4]); } } + //修改连接状态 + if(getJoinState(addr.visa)) + { + ui->tableWidget_3->setItem(currentRow,2,new QTableWidgetItem("已连接")); + }else{ ui->tableWidget_3->setItem(currentRow,2,new QTableWidgetItem("未连接"));} } } @@ -518,7 +556,7 @@ //固定大小文字显示不全 //button->setFixedSize(85, 40); button->setCheckable(true); - button->setAutoExclusive(true); + //button->setAutoExclusive(true); //设置第一个按钮选中状态 if(index==0){ button->setChecked(true);} //button->setc(true); @@ -608,7 +646,7 @@ //固定大小文字显示不全 //button->setFixedSize(85, 40); button->setCheckable(true); - button->setAutoExclusive(true); + //button->setAutoExclusive(true); //设置第一个按钮选中状态 if(index==0){ button->setChecked(true);} //button->setc(true); @@ -1297,13 +1335,21 @@ void VerifyWindow::connectDevice(){ QString rolename; + int count=0; for(ConnectInfo &visa:connectList) { if(visa.programInterface.visa!=""){ if(visa.visaEngine==nullptr) visa.visaEngine = new VisaCommonEngine; visa.visaEngine->openDevice(visa.programInterface.visa,"Visa"); + if(visa.visaEngine->getState()){ + visa.state="已连接"; + ui->tableWidget_Standard->setItem(count,1,new QTableWidgetItem("ON")); + } } + //visa.state="已连接"; + //ui->tableWidget_Standard->setItem(count,1,new QTableWidgetItem("ON")); + count++; } } @@ -1323,11 +1369,13 @@ void VerifyWindow::closeDevice(){ //关闭设备连接 int count=0; - for(const ConnectInfo &visa:connectList) + for(ConnectInfo &visa:connectList) { VisaCommonEngine *Engine=visa.visaEngine; if(Engine!=nullptr) Engine->closeDevice(); + visa.state="未连接"; + ui->tableWidget_Standard->setItem(count,1,new QTableWidgetItem("OFF")); count++; } } @@ -1586,3 +1634,43 @@ } } } + +void VerifyWindow::on_pushButtonSaveAddress_clicked() +{ + if(currConnectIdx>=0&&currConnectIdxradioButton_serial->isChecked()) + item.programInterface.communication_type = "SerialPort"; + else + item.programInterface.communication_type = "Visa"; + item.programInterface.serial_port = QString("%1;%2;%3;%4;%5").arg(ui->comboBox_port->currentText()).arg(ui->comboBox_baurt->currentText()).arg(ui->comboBox_check->currentText()) + .arg(ui->comboBox_data->currentText()).arg(ui->comboBox_stop->currentText()); + item.programInterface.visa = ui->comboBox_visa->currentText(); + if(BaseCommonApi::InsertVerificationProgramConfigInterface(item.programInterface)){ + QMessageBox::information(this, "提示", "保存成功!"); + } + else + { + QMessageBox::warning(this, "警告", "保存失败!"); + } + }else{ + if(ui->radioButton_serial->isChecked()) + item.programInterface.communication_type = "SerialPort"; + else + item.programInterface.communication_type = "Visa"; + item.programInterface.serial_port = QString("%1;%2;%3;%4;%5").arg(ui->comboBox_port->currentText()).arg(ui->comboBox_baurt->currentText()).arg(ui->comboBox_check->currentText()) + .arg(ui->comboBox_data->currentText()).arg(ui->comboBox_stop->currentText()); + item.programInterface.visa = ui->comboBox_visa->currentText(); + if(BaseCommonApi::UpdateVerificationProgramConfigInterface(item.programInterface)){ + QMessageBox::information(this, "提示", "保存成功!"); + }else{ + QMessageBox::warning(this, "警告", "保存失败!"); + } + } + } +} diff --git a/softwareDirectory/AutoVerScheme/verifywindow.h b/softwareDirectory/AutoVerScheme/verifywindow.h index d367467..45e47cf 100644 --- a/softwareDirectory/AutoVerScheme/verifywindow.h +++ b/softwareDirectory/AutoVerScheme/verifywindow.h @@ -87,6 +87,10 @@ void on_tableWidgetStd_cellChanged(int row, int column); void on_tableWidgetBiz_cellChanged(int row, int column); + void on_comboBox_visa_OnCurrentTextChanged(QString arg1); + bool getJoinState(QString arg1); + + void on_pushButtonSaveAddress_clicked(); private: Ui::VerifyWindow *ui; @@ -119,6 +123,7 @@ QMap unitTypeTransList; QMap cmdPlaceHolderList; QStringList readItems; + int currConnectIdx; }; #endif // VERIFYWINDOW_H diff --git a/softwareDirectory/AutoVerScheme/verifywindow.ui b/softwareDirectory/AutoVerScheme/verifywindow.ui index 15b7dfd..cf8e640 100644 --- a/softwareDirectory/AutoVerScheme/verifywindow.ui +++ b/softwareDirectory/AutoVerScheme/verifywindow.ui @@ -1210,6 +1210,55 @@ + + + + + 12 + + + + 设置信息: + + + + + + + + 12 + + + + + + + + + + + + 120 + 36 + + + + + 12 + 75 + true + + + + color: rgb(255, 255, 255); +background-color: rgb(55, 83, 123); +border-radius:5px; + + + 保存 + + +