diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index 09f4c71..2797ced 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -351,6 +351,7 @@ void CheckWindow::showCheck() { + curHeadIdx=-1; deleteItem(ui->horizontalLayout_14); int idx=0; for (const Dept& task : selectTaskList) @@ -489,6 +490,7 @@ ui->HeadListLayout->addStretch(); if(iEquipType==4){ + ui->pushButton_next->show(); QLabel* label = new QLabel(this); label->setText("单位:"); ui->HeadListLayout->addWidget(label); @@ -523,6 +525,8 @@ openGageResult(); }); ui->HeadListLayout->addWidget(button); + }else{ + ui->pushButton_next->hide(); } } std::sort(chList.begin(), chList.end()); @@ -532,8 +536,8 @@ } void CheckWindow::openGageResult(){ - QList calData = caliDataList.values().first(); - FormGageResult *checkWindow = new FormGageResult(nullptr,calData[0][0]); + //QList calData = caliDataList.values().first(); + FormGageResult *checkWindow = new FormGageResult(nullptr,selectTaskList[0].sample_id); //checkWindow->setWindowState(Qt::WindowMaximized); checkWindow->setWindowModality(Qt::ApplicationModal); checkWindow->show(); @@ -1016,11 +1020,8 @@ } caliDataList.insert(sLabel,dataRes); } -//下一步 -bool isBack = false; // 是否处于倒序状态 -int lastSelectedIndex = -1; // 记录上一次选中的行号 -void CheckWindow::on_pushButton_next_clicked() +void CheckWindow::stepGageCheck() { QBrush brush; QTableWidgetItem *currentItem; @@ -1034,26 +1035,58 @@ break; } } - if (lastSelectedIndex == -1) { - lastSelectedIndex = 0; - } +// if (lastSelectedIndex == -1) { +// lastSelectedIndex = 0; +// } int nextIndex = (lastSelectedIndex + 1) % ui->tableWidgetCheck->rowCount(); if(lastSelectedIndex == ui-> tableWidgetCheck->rowCount() - 1 ){ nextIndex = (lastSelectedIndex) % ui->tableWidgetCheck->rowCount(); } + + BaseCommonApi::SaveLogInfo(1,QString("标准器输出")); + QString sParam,newCmd; + QString sLabel = headTableList.keys()[curHeadIdx]; + QList dataRes = caliDataList.value(sLabel); + int idx= getIndexByHeader(sLabel,"检定项目"); + if(idx!=-1) + sParam = dataRes[nextIndex][idx]; + else + sParam = sLabel; //示值误差/回程误差/轻敲位移 + if(standardEngine.getState()){ + InstructionLib *instrcutLib = getCmdByCheckName(1,sParam); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + newCmd = transCmd(sCmd,sLabel,dataRes[nextIndex],true); + if(newCmd!=""){ + standardEngine.sendData(newCmd); + qDebug() << "standard cmds:" << newCmd; + } + } + } + } + } + currentItem = ui->tableWidgetCheck->item(nextIndex, 0); currentItem->setSelected(true); - brush = QBrush(Qt::green); - currentItem->setBackground(brush); + //brush = QBrush(Qt::green); + ui->tableWidgetCheck->cellWidget(nextIndex,2)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + ui->tableWidgetCheck->cellWidget(nextIndex,4)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + //currentItem->setBackground(brush); if (lastSelectedIndex != -1) { QTableWidgetItem *previousItem = ui->tableWidgetCheck->item(lastSelectedIndex, 0); previousItem->setSelected(false); + ui->tableWidgetCheck->cellWidget(lastSelectedIndex,2)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(lastSelectedIndex,4)->setStyleSheet(""); // previousItem->setBackground(Qt::NoBrush); } if(lastSelectedIndex == ui->tableWidgetCheck->rowCount() - 1){ isBack =!isBack; currentItem = ui->tableWidgetCheck->item(nextIndex, 0); currentItem->setSelected(true); + ui->tableWidgetCheck->cellWidget(nextIndex,3)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + ui->tableWidgetCheck->cellWidget(nextIndex,5)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); } } else { for (int i = ui->tableWidgetCheck->rowCount() - 1; i >= 0; --i) { @@ -1067,24 +1100,62 @@ lastSelectedIndex = ui->tableWidgetCheck->rowCount() - 1; } int nextIndex = (lastSelectedIndex == 0) ? ui->tableWidgetCheck->rowCount() - 1 : lastSelectedIndex - 1; + + BaseCommonApi::SaveLogInfo(1,QString("标准器输出")); + QString sParam,newCmd; + QString sLabel = headTableList.keys()[curHeadIdx]; + QList dataRes = caliDataList.value(sLabel); + int idx= getIndexByHeader(sLabel,"检定项目"); + if(idx!=-1) + sParam = dataRes[nextIndex][idx]; + else + sParam = sLabel; //示值误差/回程误差/轻敲位移 + if(standardEngine.getState()){ + InstructionLib *instrcutLib = getCmdByCheckName(1,sParam); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + newCmd = transCmd(sCmd,sLabel,dataRes[nextIndex],true); + if(newCmd!=""){ + standardEngine.sendData(newCmd); + qDebug() << "standard cmds:" << newCmd; + } + } + } + } + } + currentItem = ui->tableWidgetCheck->item(nextIndex, 0); currentItem->setSelected(true); - brush = QBrush(Qt::blue); - currentItem->setBackground(brush); + ui->tableWidgetCheck->cellWidget(nextIndex,3)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + ui->tableWidgetCheck->cellWidget(nextIndex,5)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + //brush = QBrush(Qt::blue); + //currentItem->setBackground(brush); // 取消之前选中项的选中状态 if (lastSelectedIndex != -1) { QTableWidgetItem *previousItem = ui->tableWidgetCheck->item(lastSelectedIndex, 0); previousItem->setSelected(false); + ui->tableWidgetCheck->cellWidget(lastSelectedIndex,3)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(lastSelectedIndex,5)->setStyleSheet(""); // previousItem->setBackground(Qt::NoBrush); } if(lastSelectedIndex == 1){ isBack = !isBack; + ui->pushButton_start->setEnabled(true); + ui->pushButton_next->setEnabled(false); + closeDevice(); } } ui->tableWidgetCheck->scrollToItem(currentItem); } } +//下一步 +void CheckWindow::on_pushButton_next_clicked() +{ + stepGageCheck(); +} //压力测试 用于控制数据是增加还是减少 void CheckWindow::addGageData(bool bAdd){ @@ -1328,6 +1399,23 @@ this->Oscilloscopetextflow(); return; } + else if(iEquipType==4){ + isBack=false; + lastSelectedIndex=-1; + ui->pushButton_next->setEnabled(true); + ui->pushButton_start->setEnabled(false); + for (int i = 0; i < ui->tableWidgetCheck->rowCount(); ++i) { + QTableWidgetItem *item = ui->tableWidgetCheck->item(i, 0); + item->setSelected(false); + ui->tableWidgetCheck->cellWidget(i,2)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(i,4)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(i,3)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(i,5)->setStyleSheet(""); + } + connectDevice(); + stepGageCheck(); + return; + } connectDevice(); for(int i=0;ihorizontalLayout_14); int idx=0; for (const Dept& task : selectTaskList) @@ -489,6 +490,7 @@ ui->HeadListLayout->addStretch(); if(iEquipType==4){ + ui->pushButton_next->show(); QLabel* label = new QLabel(this); label->setText("单位:"); ui->HeadListLayout->addWidget(label); @@ -523,6 +525,8 @@ openGageResult(); }); ui->HeadListLayout->addWidget(button); + }else{ + ui->pushButton_next->hide(); } } std::sort(chList.begin(), chList.end()); @@ -532,8 +536,8 @@ } void CheckWindow::openGageResult(){ - QList calData = caliDataList.values().first(); - FormGageResult *checkWindow = new FormGageResult(nullptr,calData[0][0]); + //QList calData = caliDataList.values().first(); + FormGageResult *checkWindow = new FormGageResult(nullptr,selectTaskList[0].sample_id); //checkWindow->setWindowState(Qt::WindowMaximized); checkWindow->setWindowModality(Qt::ApplicationModal); checkWindow->show(); @@ -1016,11 +1020,8 @@ } caliDataList.insert(sLabel,dataRes); } -//下一步 -bool isBack = false; // 是否处于倒序状态 -int lastSelectedIndex = -1; // 记录上一次选中的行号 -void CheckWindow::on_pushButton_next_clicked() +void CheckWindow::stepGageCheck() { QBrush brush; QTableWidgetItem *currentItem; @@ -1034,26 +1035,58 @@ break; } } - if (lastSelectedIndex == -1) { - lastSelectedIndex = 0; - } +// if (lastSelectedIndex == -1) { +// lastSelectedIndex = 0; +// } int nextIndex = (lastSelectedIndex + 1) % ui->tableWidgetCheck->rowCount(); if(lastSelectedIndex == ui-> tableWidgetCheck->rowCount() - 1 ){ nextIndex = (lastSelectedIndex) % ui->tableWidgetCheck->rowCount(); } + + BaseCommonApi::SaveLogInfo(1,QString("标准器输出")); + QString sParam,newCmd; + QString sLabel = headTableList.keys()[curHeadIdx]; + QList dataRes = caliDataList.value(sLabel); + int idx= getIndexByHeader(sLabel,"检定项目"); + if(idx!=-1) + sParam = dataRes[nextIndex][idx]; + else + sParam = sLabel; //示值误差/回程误差/轻敲位移 + if(standardEngine.getState()){ + InstructionLib *instrcutLib = getCmdByCheckName(1,sParam); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + newCmd = transCmd(sCmd,sLabel,dataRes[nextIndex],true); + if(newCmd!=""){ + standardEngine.sendData(newCmd); + qDebug() << "standard cmds:" << newCmd; + } + } + } + } + } + currentItem = ui->tableWidgetCheck->item(nextIndex, 0); currentItem->setSelected(true); - brush = QBrush(Qt::green); - currentItem->setBackground(brush); + //brush = QBrush(Qt::green); + ui->tableWidgetCheck->cellWidget(nextIndex,2)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + ui->tableWidgetCheck->cellWidget(nextIndex,4)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + //currentItem->setBackground(brush); if (lastSelectedIndex != -1) { QTableWidgetItem *previousItem = ui->tableWidgetCheck->item(lastSelectedIndex, 0); previousItem->setSelected(false); + ui->tableWidgetCheck->cellWidget(lastSelectedIndex,2)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(lastSelectedIndex,4)->setStyleSheet(""); // previousItem->setBackground(Qt::NoBrush); } if(lastSelectedIndex == ui->tableWidgetCheck->rowCount() - 1){ isBack =!isBack; currentItem = ui->tableWidgetCheck->item(nextIndex, 0); currentItem->setSelected(true); + ui->tableWidgetCheck->cellWidget(nextIndex,3)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + ui->tableWidgetCheck->cellWidget(nextIndex,5)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); } } else { for (int i = ui->tableWidgetCheck->rowCount() - 1; i >= 0; --i) { @@ -1067,24 +1100,62 @@ lastSelectedIndex = ui->tableWidgetCheck->rowCount() - 1; } int nextIndex = (lastSelectedIndex == 0) ? ui->tableWidgetCheck->rowCount() - 1 : lastSelectedIndex - 1; + + BaseCommonApi::SaveLogInfo(1,QString("标准器输出")); + QString sParam,newCmd; + QString sLabel = headTableList.keys()[curHeadIdx]; + QList dataRes = caliDataList.value(sLabel); + int idx= getIndexByHeader(sLabel,"检定项目"); + if(idx!=-1) + sParam = dataRes[nextIndex][idx]; + else + sParam = sLabel; //示值误差/回程误差/轻敲位移 + if(standardEngine.getState()){ + InstructionLib *instrcutLib = getCmdByCheckName(1,sParam); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + newCmd = transCmd(sCmd,sLabel,dataRes[nextIndex],true); + if(newCmd!=""){ + standardEngine.sendData(newCmd); + qDebug() << "standard cmds:" << newCmd; + } + } + } + } + } + currentItem = ui->tableWidgetCheck->item(nextIndex, 0); currentItem->setSelected(true); - brush = QBrush(Qt::blue); - currentItem->setBackground(brush); + ui->tableWidgetCheck->cellWidget(nextIndex,3)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + ui->tableWidgetCheck->cellWidget(nextIndex,5)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + //brush = QBrush(Qt::blue); + //currentItem->setBackground(brush); // 取消之前选中项的选中状态 if (lastSelectedIndex != -1) { QTableWidgetItem *previousItem = ui->tableWidgetCheck->item(lastSelectedIndex, 0); previousItem->setSelected(false); + ui->tableWidgetCheck->cellWidget(lastSelectedIndex,3)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(lastSelectedIndex,5)->setStyleSheet(""); // previousItem->setBackground(Qt::NoBrush); } if(lastSelectedIndex == 1){ isBack = !isBack; + ui->pushButton_start->setEnabled(true); + ui->pushButton_next->setEnabled(false); + closeDevice(); } } ui->tableWidgetCheck->scrollToItem(currentItem); } } +//下一步 +void CheckWindow::on_pushButton_next_clicked() +{ + stepGageCheck(); +} //压力测试 用于控制数据是增加还是减少 void CheckWindow::addGageData(bool bAdd){ @@ -1328,6 +1399,23 @@ this->Oscilloscopetextflow(); return; } + else if(iEquipType==4){ + isBack=false; + lastSelectedIndex=-1; + ui->pushButton_next->setEnabled(true); + ui->pushButton_start->setEnabled(false); + for (int i = 0; i < ui->tableWidgetCheck->rowCount(); ++i) { + QTableWidgetItem *item = ui->tableWidgetCheck->item(i, 0); + item->setSelected(false); + ui->tableWidgetCheck->cellWidget(i,2)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(i,4)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(i,3)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(i,5)->setStyleSheet(""); + } + connectDevice(); + stepGageCheck(); + return; + } connectDevice(); for(int i=0;i programList; @@ -132,6 +133,8 @@ QList pageButtons; QList chList; QList gaugeInfo; + bool isBack = false; // 是否处于倒序状态 + int lastSelectedIndex = -1; // 记录上一次选中的行号 }; #endif // CHECKWINDOW_H diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index 09f4c71..2797ced 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -351,6 +351,7 @@ void CheckWindow::showCheck() { + curHeadIdx=-1; deleteItem(ui->horizontalLayout_14); int idx=0; for (const Dept& task : selectTaskList) @@ -489,6 +490,7 @@ ui->HeadListLayout->addStretch(); if(iEquipType==4){ + ui->pushButton_next->show(); QLabel* label = new QLabel(this); label->setText("单位:"); ui->HeadListLayout->addWidget(label); @@ -523,6 +525,8 @@ openGageResult(); }); ui->HeadListLayout->addWidget(button); + }else{ + ui->pushButton_next->hide(); } } std::sort(chList.begin(), chList.end()); @@ -532,8 +536,8 @@ } void CheckWindow::openGageResult(){ - QList calData = caliDataList.values().first(); - FormGageResult *checkWindow = new FormGageResult(nullptr,calData[0][0]); + //QList calData = caliDataList.values().first(); + FormGageResult *checkWindow = new FormGageResult(nullptr,selectTaskList[0].sample_id); //checkWindow->setWindowState(Qt::WindowMaximized); checkWindow->setWindowModality(Qt::ApplicationModal); checkWindow->show(); @@ -1016,11 +1020,8 @@ } caliDataList.insert(sLabel,dataRes); } -//下一步 -bool isBack = false; // 是否处于倒序状态 -int lastSelectedIndex = -1; // 记录上一次选中的行号 -void CheckWindow::on_pushButton_next_clicked() +void CheckWindow::stepGageCheck() { QBrush brush; QTableWidgetItem *currentItem; @@ -1034,26 +1035,58 @@ break; } } - if (lastSelectedIndex == -1) { - lastSelectedIndex = 0; - } +// if (lastSelectedIndex == -1) { +// lastSelectedIndex = 0; +// } int nextIndex = (lastSelectedIndex + 1) % ui->tableWidgetCheck->rowCount(); if(lastSelectedIndex == ui-> tableWidgetCheck->rowCount() - 1 ){ nextIndex = (lastSelectedIndex) % ui->tableWidgetCheck->rowCount(); } + + BaseCommonApi::SaveLogInfo(1,QString("标准器输出")); + QString sParam,newCmd; + QString sLabel = headTableList.keys()[curHeadIdx]; + QList dataRes = caliDataList.value(sLabel); + int idx= getIndexByHeader(sLabel,"检定项目"); + if(idx!=-1) + sParam = dataRes[nextIndex][idx]; + else + sParam = sLabel; //示值误差/回程误差/轻敲位移 + if(standardEngine.getState()){ + InstructionLib *instrcutLib = getCmdByCheckName(1,sParam); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + newCmd = transCmd(sCmd,sLabel,dataRes[nextIndex],true); + if(newCmd!=""){ + standardEngine.sendData(newCmd); + qDebug() << "standard cmds:" << newCmd; + } + } + } + } + } + currentItem = ui->tableWidgetCheck->item(nextIndex, 0); currentItem->setSelected(true); - brush = QBrush(Qt::green); - currentItem->setBackground(brush); + //brush = QBrush(Qt::green); + ui->tableWidgetCheck->cellWidget(nextIndex,2)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + ui->tableWidgetCheck->cellWidget(nextIndex,4)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + //currentItem->setBackground(brush); if (lastSelectedIndex != -1) { QTableWidgetItem *previousItem = ui->tableWidgetCheck->item(lastSelectedIndex, 0); previousItem->setSelected(false); + ui->tableWidgetCheck->cellWidget(lastSelectedIndex,2)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(lastSelectedIndex,4)->setStyleSheet(""); // previousItem->setBackground(Qt::NoBrush); } if(lastSelectedIndex == ui->tableWidgetCheck->rowCount() - 1){ isBack =!isBack; currentItem = ui->tableWidgetCheck->item(nextIndex, 0); currentItem->setSelected(true); + ui->tableWidgetCheck->cellWidget(nextIndex,3)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + ui->tableWidgetCheck->cellWidget(nextIndex,5)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); } } else { for (int i = ui->tableWidgetCheck->rowCount() - 1; i >= 0; --i) { @@ -1067,24 +1100,62 @@ lastSelectedIndex = ui->tableWidgetCheck->rowCount() - 1; } int nextIndex = (lastSelectedIndex == 0) ? ui->tableWidgetCheck->rowCount() - 1 : lastSelectedIndex - 1; + + BaseCommonApi::SaveLogInfo(1,QString("标准器输出")); + QString sParam,newCmd; + QString sLabel = headTableList.keys()[curHeadIdx]; + QList dataRes = caliDataList.value(sLabel); + int idx= getIndexByHeader(sLabel,"检定项目"); + if(idx!=-1) + sParam = dataRes[nextIndex][idx]; + else + sParam = sLabel; //示值误差/回程误差/轻敲位移 + if(standardEngine.getState()){ + InstructionLib *instrcutLib = getCmdByCheckName(1,sParam); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + newCmd = transCmd(sCmd,sLabel,dataRes[nextIndex],true); + if(newCmd!=""){ + standardEngine.sendData(newCmd); + qDebug() << "standard cmds:" << newCmd; + } + } + } + } + } + currentItem = ui->tableWidgetCheck->item(nextIndex, 0); currentItem->setSelected(true); - brush = QBrush(Qt::blue); - currentItem->setBackground(brush); + ui->tableWidgetCheck->cellWidget(nextIndex,3)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + ui->tableWidgetCheck->cellWidget(nextIndex,5)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + //brush = QBrush(Qt::blue); + //currentItem->setBackground(brush); // 取消之前选中项的选中状态 if (lastSelectedIndex != -1) { QTableWidgetItem *previousItem = ui->tableWidgetCheck->item(lastSelectedIndex, 0); previousItem->setSelected(false); + ui->tableWidgetCheck->cellWidget(lastSelectedIndex,3)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(lastSelectedIndex,5)->setStyleSheet(""); // previousItem->setBackground(Qt::NoBrush); } if(lastSelectedIndex == 1){ isBack = !isBack; + ui->pushButton_start->setEnabled(true); + ui->pushButton_next->setEnabled(false); + closeDevice(); } } ui->tableWidgetCheck->scrollToItem(currentItem); } } +//下一步 +void CheckWindow::on_pushButton_next_clicked() +{ + stepGageCheck(); +} //压力测试 用于控制数据是增加还是减少 void CheckWindow::addGageData(bool bAdd){ @@ -1328,6 +1399,23 @@ this->Oscilloscopetextflow(); return; } + else if(iEquipType==4){ + isBack=false; + lastSelectedIndex=-1; + ui->pushButton_next->setEnabled(true); + ui->pushButton_start->setEnabled(false); + for (int i = 0; i < ui->tableWidgetCheck->rowCount(); ++i) { + QTableWidgetItem *item = ui->tableWidgetCheck->item(i, 0); + item->setSelected(false); + ui->tableWidgetCheck->cellWidget(i,2)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(i,4)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(i,3)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(i,5)->setStyleSheet(""); + } + connectDevice(); + stepGageCheck(); + return; + } connectDevice(); for(int i=0;i programList; @@ -132,6 +133,8 @@ QList pageButtons; QList chList; QList gaugeInfo; + bool isBack = false; // 是否处于倒序状态 + int lastSelectedIndex = -1; // 记录上一次选中的行号 }; #endif // CHECKWINDOW_H diff --git a/softwareDirectory/AutoVerScheme/checkwindow.ui b/softwareDirectory/AutoVerScheme/checkwindow.ui index 1c91d66..cff0abe 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.ui +++ b/softwareDirectory/AutoVerScheme/checkwindow.ui @@ -1563,9 +1563,30 @@ + + false + + + + 12 + 75 + true + + 下一步 + + + :/image/Index/u5089.png + + + + + 24 + 24 + + diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index 09f4c71..2797ced 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -351,6 +351,7 @@ void CheckWindow::showCheck() { + curHeadIdx=-1; deleteItem(ui->horizontalLayout_14); int idx=0; for (const Dept& task : selectTaskList) @@ -489,6 +490,7 @@ ui->HeadListLayout->addStretch(); if(iEquipType==4){ + ui->pushButton_next->show(); QLabel* label = new QLabel(this); label->setText("单位:"); ui->HeadListLayout->addWidget(label); @@ -523,6 +525,8 @@ openGageResult(); }); ui->HeadListLayout->addWidget(button); + }else{ + ui->pushButton_next->hide(); } } std::sort(chList.begin(), chList.end()); @@ -532,8 +536,8 @@ } void CheckWindow::openGageResult(){ - QList calData = caliDataList.values().first(); - FormGageResult *checkWindow = new FormGageResult(nullptr,calData[0][0]); + //QList calData = caliDataList.values().first(); + FormGageResult *checkWindow = new FormGageResult(nullptr,selectTaskList[0].sample_id); //checkWindow->setWindowState(Qt::WindowMaximized); checkWindow->setWindowModality(Qt::ApplicationModal); checkWindow->show(); @@ -1016,11 +1020,8 @@ } caliDataList.insert(sLabel,dataRes); } -//下一步 -bool isBack = false; // 是否处于倒序状态 -int lastSelectedIndex = -1; // 记录上一次选中的行号 -void CheckWindow::on_pushButton_next_clicked() +void CheckWindow::stepGageCheck() { QBrush brush; QTableWidgetItem *currentItem; @@ -1034,26 +1035,58 @@ break; } } - if (lastSelectedIndex == -1) { - lastSelectedIndex = 0; - } +// if (lastSelectedIndex == -1) { +// lastSelectedIndex = 0; +// } int nextIndex = (lastSelectedIndex + 1) % ui->tableWidgetCheck->rowCount(); if(lastSelectedIndex == ui-> tableWidgetCheck->rowCount() - 1 ){ nextIndex = (lastSelectedIndex) % ui->tableWidgetCheck->rowCount(); } + + BaseCommonApi::SaveLogInfo(1,QString("标准器输出")); + QString sParam,newCmd; + QString sLabel = headTableList.keys()[curHeadIdx]; + QList dataRes = caliDataList.value(sLabel); + int idx= getIndexByHeader(sLabel,"检定项目"); + if(idx!=-1) + sParam = dataRes[nextIndex][idx]; + else + sParam = sLabel; //示值误差/回程误差/轻敲位移 + if(standardEngine.getState()){ + InstructionLib *instrcutLib = getCmdByCheckName(1,sParam); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + newCmd = transCmd(sCmd,sLabel,dataRes[nextIndex],true); + if(newCmd!=""){ + standardEngine.sendData(newCmd); + qDebug() << "standard cmds:" << newCmd; + } + } + } + } + } + currentItem = ui->tableWidgetCheck->item(nextIndex, 0); currentItem->setSelected(true); - brush = QBrush(Qt::green); - currentItem->setBackground(brush); + //brush = QBrush(Qt::green); + ui->tableWidgetCheck->cellWidget(nextIndex,2)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + ui->tableWidgetCheck->cellWidget(nextIndex,4)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + //currentItem->setBackground(brush); if (lastSelectedIndex != -1) { QTableWidgetItem *previousItem = ui->tableWidgetCheck->item(lastSelectedIndex, 0); previousItem->setSelected(false); + ui->tableWidgetCheck->cellWidget(lastSelectedIndex,2)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(lastSelectedIndex,4)->setStyleSheet(""); // previousItem->setBackground(Qt::NoBrush); } if(lastSelectedIndex == ui->tableWidgetCheck->rowCount() - 1){ isBack =!isBack; currentItem = ui->tableWidgetCheck->item(nextIndex, 0); currentItem->setSelected(true); + ui->tableWidgetCheck->cellWidget(nextIndex,3)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + ui->tableWidgetCheck->cellWidget(nextIndex,5)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); } } else { for (int i = ui->tableWidgetCheck->rowCount() - 1; i >= 0; --i) { @@ -1067,24 +1100,62 @@ lastSelectedIndex = ui->tableWidgetCheck->rowCount() - 1; } int nextIndex = (lastSelectedIndex == 0) ? ui->tableWidgetCheck->rowCount() - 1 : lastSelectedIndex - 1; + + BaseCommonApi::SaveLogInfo(1,QString("标准器输出")); + QString sParam,newCmd; + QString sLabel = headTableList.keys()[curHeadIdx]; + QList dataRes = caliDataList.value(sLabel); + int idx= getIndexByHeader(sLabel,"检定项目"); + if(idx!=-1) + sParam = dataRes[nextIndex][idx]; + else + sParam = sLabel; //示值误差/回程误差/轻敲位移 + if(standardEngine.getState()){ + InstructionLib *instrcutLib = getCmdByCheckName(1,sParam); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + newCmd = transCmd(sCmd,sLabel,dataRes[nextIndex],true); + if(newCmd!=""){ + standardEngine.sendData(newCmd); + qDebug() << "standard cmds:" << newCmd; + } + } + } + } + } + currentItem = ui->tableWidgetCheck->item(nextIndex, 0); currentItem->setSelected(true); - brush = QBrush(Qt::blue); - currentItem->setBackground(brush); + ui->tableWidgetCheck->cellWidget(nextIndex,3)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + ui->tableWidgetCheck->cellWidget(nextIndex,5)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + //brush = QBrush(Qt::blue); + //currentItem->setBackground(brush); // 取消之前选中项的选中状态 if (lastSelectedIndex != -1) { QTableWidgetItem *previousItem = ui->tableWidgetCheck->item(lastSelectedIndex, 0); previousItem->setSelected(false); + ui->tableWidgetCheck->cellWidget(lastSelectedIndex,3)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(lastSelectedIndex,5)->setStyleSheet(""); // previousItem->setBackground(Qt::NoBrush); } if(lastSelectedIndex == 1){ isBack = !isBack; + ui->pushButton_start->setEnabled(true); + ui->pushButton_next->setEnabled(false); + closeDevice(); } } ui->tableWidgetCheck->scrollToItem(currentItem); } } +//下一步 +void CheckWindow::on_pushButton_next_clicked() +{ + stepGageCheck(); +} //压力测试 用于控制数据是增加还是减少 void CheckWindow::addGageData(bool bAdd){ @@ -1328,6 +1399,23 @@ this->Oscilloscopetextflow(); return; } + else if(iEquipType==4){ + isBack=false; + lastSelectedIndex=-1; + ui->pushButton_next->setEnabled(true); + ui->pushButton_start->setEnabled(false); + for (int i = 0; i < ui->tableWidgetCheck->rowCount(); ++i) { + QTableWidgetItem *item = ui->tableWidgetCheck->item(i, 0); + item->setSelected(false); + ui->tableWidgetCheck->cellWidget(i,2)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(i,4)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(i,3)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(i,5)->setStyleSheet(""); + } + connectDevice(); + stepGageCheck(); + return; + } connectDevice(); for(int i=0;i programList; @@ -132,6 +133,8 @@ QList pageButtons; QList chList; QList gaugeInfo; + bool isBack = false; // 是否处于倒序状态 + int lastSelectedIndex = -1; // 记录上一次选中的行号 }; #endif // CHECKWINDOW_H diff --git a/softwareDirectory/AutoVerScheme/checkwindow.ui b/softwareDirectory/AutoVerScheme/checkwindow.ui index 1c91d66..cff0abe 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.ui +++ b/softwareDirectory/AutoVerScheme/checkwindow.ui @@ -1563,9 +1563,30 @@ + + false + + + + 12 + 75 + true + + 下一步 + + + :/image/Index/u5089.png + + + + + 24 + 24 + + diff --git a/softwareDirectory/AutoVerScheme/res/image/Index/u5089.png b/softwareDirectory/AutoVerScheme/res/image/Index/u5089.png new file mode 100644 index 0000000..a73294d --- /dev/null +++ b/softwareDirectory/AutoVerScheme/res/image/Index/u5089.png Binary files differ diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index 09f4c71..2797ced 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -351,6 +351,7 @@ void CheckWindow::showCheck() { + curHeadIdx=-1; deleteItem(ui->horizontalLayout_14); int idx=0; for (const Dept& task : selectTaskList) @@ -489,6 +490,7 @@ ui->HeadListLayout->addStretch(); if(iEquipType==4){ + ui->pushButton_next->show(); QLabel* label = new QLabel(this); label->setText("单位:"); ui->HeadListLayout->addWidget(label); @@ -523,6 +525,8 @@ openGageResult(); }); ui->HeadListLayout->addWidget(button); + }else{ + ui->pushButton_next->hide(); } } std::sort(chList.begin(), chList.end()); @@ -532,8 +536,8 @@ } void CheckWindow::openGageResult(){ - QList calData = caliDataList.values().first(); - FormGageResult *checkWindow = new FormGageResult(nullptr,calData[0][0]); + //QList calData = caliDataList.values().first(); + FormGageResult *checkWindow = new FormGageResult(nullptr,selectTaskList[0].sample_id); //checkWindow->setWindowState(Qt::WindowMaximized); checkWindow->setWindowModality(Qt::ApplicationModal); checkWindow->show(); @@ -1016,11 +1020,8 @@ } caliDataList.insert(sLabel,dataRes); } -//下一步 -bool isBack = false; // 是否处于倒序状态 -int lastSelectedIndex = -1; // 记录上一次选中的行号 -void CheckWindow::on_pushButton_next_clicked() +void CheckWindow::stepGageCheck() { QBrush brush; QTableWidgetItem *currentItem; @@ -1034,26 +1035,58 @@ break; } } - if (lastSelectedIndex == -1) { - lastSelectedIndex = 0; - } +// if (lastSelectedIndex == -1) { +// lastSelectedIndex = 0; +// } int nextIndex = (lastSelectedIndex + 1) % ui->tableWidgetCheck->rowCount(); if(lastSelectedIndex == ui-> tableWidgetCheck->rowCount() - 1 ){ nextIndex = (lastSelectedIndex) % ui->tableWidgetCheck->rowCount(); } + + BaseCommonApi::SaveLogInfo(1,QString("标准器输出")); + QString sParam,newCmd; + QString sLabel = headTableList.keys()[curHeadIdx]; + QList dataRes = caliDataList.value(sLabel); + int idx= getIndexByHeader(sLabel,"检定项目"); + if(idx!=-1) + sParam = dataRes[nextIndex][idx]; + else + sParam = sLabel; //示值误差/回程误差/轻敲位移 + if(standardEngine.getState()){ + InstructionLib *instrcutLib = getCmdByCheckName(1,sParam); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + newCmd = transCmd(sCmd,sLabel,dataRes[nextIndex],true); + if(newCmd!=""){ + standardEngine.sendData(newCmd); + qDebug() << "standard cmds:" << newCmd; + } + } + } + } + } + currentItem = ui->tableWidgetCheck->item(nextIndex, 0); currentItem->setSelected(true); - brush = QBrush(Qt::green); - currentItem->setBackground(brush); + //brush = QBrush(Qt::green); + ui->tableWidgetCheck->cellWidget(nextIndex,2)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + ui->tableWidgetCheck->cellWidget(nextIndex,4)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + //currentItem->setBackground(brush); if (lastSelectedIndex != -1) { QTableWidgetItem *previousItem = ui->tableWidgetCheck->item(lastSelectedIndex, 0); previousItem->setSelected(false); + ui->tableWidgetCheck->cellWidget(lastSelectedIndex,2)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(lastSelectedIndex,4)->setStyleSheet(""); // previousItem->setBackground(Qt::NoBrush); } if(lastSelectedIndex == ui->tableWidgetCheck->rowCount() - 1){ isBack =!isBack; currentItem = ui->tableWidgetCheck->item(nextIndex, 0); currentItem->setSelected(true); + ui->tableWidgetCheck->cellWidget(nextIndex,3)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + ui->tableWidgetCheck->cellWidget(nextIndex,5)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); } } else { for (int i = ui->tableWidgetCheck->rowCount() - 1; i >= 0; --i) { @@ -1067,24 +1100,62 @@ lastSelectedIndex = ui->tableWidgetCheck->rowCount() - 1; } int nextIndex = (lastSelectedIndex == 0) ? ui->tableWidgetCheck->rowCount() - 1 : lastSelectedIndex - 1; + + BaseCommonApi::SaveLogInfo(1,QString("标准器输出")); + QString sParam,newCmd; + QString sLabel = headTableList.keys()[curHeadIdx]; + QList dataRes = caliDataList.value(sLabel); + int idx= getIndexByHeader(sLabel,"检定项目"); + if(idx!=-1) + sParam = dataRes[nextIndex][idx]; + else + sParam = sLabel; //示值误差/回程误差/轻敲位移 + if(standardEngine.getState()){ + InstructionLib *instrcutLib = getCmdByCheckName(1,sParam); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + newCmd = transCmd(sCmd,sLabel,dataRes[nextIndex],true); + if(newCmd!=""){ + standardEngine.sendData(newCmd); + qDebug() << "standard cmds:" << newCmd; + } + } + } + } + } + currentItem = ui->tableWidgetCheck->item(nextIndex, 0); currentItem->setSelected(true); - brush = QBrush(Qt::blue); - currentItem->setBackground(brush); + ui->tableWidgetCheck->cellWidget(nextIndex,3)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + ui->tableWidgetCheck->cellWidget(nextIndex,5)->setStyleSheet("color:white;background-color:rgb(1,10,128);"); + //brush = QBrush(Qt::blue); + //currentItem->setBackground(brush); // 取消之前选中项的选中状态 if (lastSelectedIndex != -1) { QTableWidgetItem *previousItem = ui->tableWidgetCheck->item(lastSelectedIndex, 0); previousItem->setSelected(false); + ui->tableWidgetCheck->cellWidget(lastSelectedIndex,3)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(lastSelectedIndex,5)->setStyleSheet(""); // previousItem->setBackground(Qt::NoBrush); } if(lastSelectedIndex == 1){ isBack = !isBack; + ui->pushButton_start->setEnabled(true); + ui->pushButton_next->setEnabled(false); + closeDevice(); } } ui->tableWidgetCheck->scrollToItem(currentItem); } } +//下一步 +void CheckWindow::on_pushButton_next_clicked() +{ + stepGageCheck(); +} //压力测试 用于控制数据是增加还是减少 void CheckWindow::addGageData(bool bAdd){ @@ -1328,6 +1399,23 @@ this->Oscilloscopetextflow(); return; } + else if(iEquipType==4){ + isBack=false; + lastSelectedIndex=-1; + ui->pushButton_next->setEnabled(true); + ui->pushButton_start->setEnabled(false); + for (int i = 0; i < ui->tableWidgetCheck->rowCount(); ++i) { + QTableWidgetItem *item = ui->tableWidgetCheck->item(i, 0); + item->setSelected(false); + ui->tableWidgetCheck->cellWidget(i,2)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(i,4)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(i,3)->setStyleSheet(""); + ui->tableWidgetCheck->cellWidget(i,5)->setStyleSheet(""); + } + connectDevice(); + stepGageCheck(); + return; + } connectDevice(); for(int i=0;i programList; @@ -132,6 +133,8 @@ QList pageButtons; QList chList; QList gaugeInfo; + bool isBack = false; // 是否处于倒序状态 + int lastSelectedIndex = -1; // 记录上一次选中的行号 }; #endif // CHECKWINDOW_H diff --git a/softwareDirectory/AutoVerScheme/checkwindow.ui b/softwareDirectory/AutoVerScheme/checkwindow.ui index 1c91d66..cff0abe 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.ui +++ b/softwareDirectory/AutoVerScheme/checkwindow.ui @@ -1563,9 +1563,30 @@ + + false + + + + 12 + 75 + true + + 下一步 + + + :/image/Index/u5089.png + + + + + 24 + 24 + + diff --git a/softwareDirectory/AutoVerScheme/res/image/Index/u5089.png b/softwareDirectory/AutoVerScheme/res/image/Index/u5089.png new file mode 100644 index 0000000..a73294d --- /dev/null +++ b/softwareDirectory/AutoVerScheme/res/image/Index/u5089.png Binary files differ diff --git a/softwareDirectory/AutoVerScheme/res/res.qrc b/softwareDirectory/AutoVerScheme/res/res.qrc index 1c6d395..e4fba1a 100644 --- a/softwareDirectory/AutoVerScheme/res/res.qrc +++ b/softwareDirectory/AutoVerScheme/res/res.qrc @@ -56,5 +56,6 @@ image/Index/u2189.svg image/Index/u642.svg image/Index/u794.svg + image/Index/u5089.png