diff --git a/softwareDirectory/AutoVerScheme/basecommonapi.cpp b/softwareDirectory/AutoVerScheme/basecommonapi.cpp index 89acbcf..ef5b373 100644 --- a/softwareDirectory/AutoVerScheme/basecommonapi.cpp +++ b/softwareDirectory/AutoVerScheme/basecommonapi.cpp @@ -2887,8 +2887,19 @@ //保存log信息 //log文件 - bool BaseCommonApi::SaveLogInfo(QString path,QString Info) + bool BaseCommonApi::SaveLogInfo(int pathIndex,QString Info) { + // 获取应用程序的根目录 + QString path = QCoreApplication::applicationDirPath(); + //QString path ="C:\\AutoVerScheme"; + switch (pathIndex) { + case 0: + path+="\\File\\sync_info.txt"; + break; + case 1: + path+="\\File\\textlog.txt"; + break; + } QByteArray utf8Dat; QString Message=Info; QFile file(path); @@ -2904,6 +2915,7 @@ if (!file.open(QIODevice::Append | QIODevice::Text)) { qDebug() << "无法打开文件:" << file.errorString(); + QString str=file.errorString(); return false; } QTextStream out(&file); diff --git a/softwareDirectory/AutoVerScheme/basecommonapi.cpp b/softwareDirectory/AutoVerScheme/basecommonapi.cpp index 89acbcf..ef5b373 100644 --- a/softwareDirectory/AutoVerScheme/basecommonapi.cpp +++ b/softwareDirectory/AutoVerScheme/basecommonapi.cpp @@ -2887,8 +2887,19 @@ //保存log信息 //log文件 - bool BaseCommonApi::SaveLogInfo(QString path,QString Info) + bool BaseCommonApi::SaveLogInfo(int pathIndex,QString Info) { + // 获取应用程序的根目录 + QString path = QCoreApplication::applicationDirPath(); + //QString path ="C:\\AutoVerScheme"; + switch (pathIndex) { + case 0: + path+="\\File\\sync_info.txt"; + break; + case 1: + path+="\\File\\textlog.txt"; + break; + } QByteArray utf8Dat; QString Message=Info; QFile file(path); @@ -2904,6 +2915,7 @@ if (!file.open(QIODevice::Append | QIODevice::Text)) { qDebug() << "无法打开文件:" << file.errorString(); + QString str=file.errorString(); return false; } QTextStream out(&file); diff --git a/softwareDirectory/AutoVerScheme/basecommonapi.h b/softwareDirectory/AutoVerScheme/basecommonapi.h index 0b4ca5d..4d3d17a 100644 --- a/softwareDirectory/AutoVerScheme/basecommonapi.h +++ b/softwareDirectory/AutoVerScheme/basecommonapi.h @@ -1205,7 +1205,7 @@ static InsertTask SelectTaskSingle(QString order_id); //log文件 - static bool SaveLogInfo(QString path,QString Info); + static bool SaveLogInfo(int pathIndex,QString Info); //新增日志表数据 static bool InsertzdLog(zdLog log); diff --git a/softwareDirectory/AutoVerScheme/basecommonapi.cpp b/softwareDirectory/AutoVerScheme/basecommonapi.cpp index 89acbcf..ef5b373 100644 --- a/softwareDirectory/AutoVerScheme/basecommonapi.cpp +++ b/softwareDirectory/AutoVerScheme/basecommonapi.cpp @@ -2887,8 +2887,19 @@ //保存log信息 //log文件 - bool BaseCommonApi::SaveLogInfo(QString path,QString Info) + bool BaseCommonApi::SaveLogInfo(int pathIndex,QString Info) { + // 获取应用程序的根目录 + QString path = QCoreApplication::applicationDirPath(); + //QString path ="C:\\AutoVerScheme"; + switch (pathIndex) { + case 0: + path+="\\File\\sync_info.txt"; + break; + case 1: + path+="\\File\\textlog.txt"; + break; + } QByteArray utf8Dat; QString Message=Info; QFile file(path); @@ -2904,6 +2915,7 @@ if (!file.open(QIODevice::Append | QIODevice::Text)) { qDebug() << "无法打开文件:" << file.errorString(); + QString str=file.errorString(); return false; } QTextStream out(&file); diff --git a/softwareDirectory/AutoVerScheme/basecommonapi.h b/softwareDirectory/AutoVerScheme/basecommonapi.h index 0b4ca5d..4d3d17a 100644 --- a/softwareDirectory/AutoVerScheme/basecommonapi.h +++ b/softwareDirectory/AutoVerScheme/basecommonapi.h @@ -1205,7 +1205,7 @@ static InsertTask SelectTaskSingle(QString order_id); //log文件 - static bool SaveLogInfo(QString path,QString Info); + static bool SaveLogInfo(int pathIndex,QString Info); //新增日志表数据 static bool InsertzdLog(zdLog log); diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index 268cbfd..82050e1 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -56,7 +56,6 @@ unitTransList.insert("KΩ",0.001); unitTransList.insert("MΩ",0.000001); //统一定义命令占位符 - cmdPlaceHolderList.insert("{CH}","通道"); cmdPlaceHolderList.insert("{RANV}","量程"); cmdPlaceHolderList.insert("{RANI}","量程"); @@ -384,9 +383,12 @@ //获取行号 并进行添加行 rowCount = ui->tableWidget_Point->rowCount(); ui->tableWidget_Point->insertRow(rowCount); - if(i==0) - ui->tableWidget_Point->setItem(row, 0, new QTableWidgetItem(dataRes[i][1])); - ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(dataRes[i][5])); + int idx= getIndexByHeader(sLabel,"检定项目"); + int idx2= getIndexByHeader(sLabel,"标准值"); + int idx3= getIndexByHeader(sLabel,"单位"); + if(idx==-1){idx=1;};if(idx2==-1){idx2=5;};if(idx3==-1){idx3=4;}; + ui->tableWidget_Point->setItem(row, 0, new QTableWidgetItem(dataRes[i][idx])); + ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(dataRes[i][idx2]+"("+dataRes[i][idx3]+")")); ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); row++; } @@ -833,7 +835,15 @@ } return dTmp; } - +//double CheckWindow::TranDecimals(QString sLabel,QStringList data,double TestValue) +//{ + /* int dex=getIndexByHeader(sLabel,"标准值"); + double StanValue=data[dex].toDouble(); + while (tmp != std::floor(tmp)) { + tmp *= 10; + ++decimalPlaces; + }*/ +//} QString CheckWindow::transCmd(QString sCmd,QString sLabel,QStringList data,bool devicetype) { QString sNewCmd = sCmd; @@ -843,6 +853,7 @@ if (re.indexIn(sNewCmd) != -1) { delay= re.cap(1).toUInt(); } + BaseCommonApi::SaveLogInfo(1,QString("延迟 %1 ms").arg(delay)); qDebug() << "delay time:" << delay; Delay_MSec(delay); return ""; @@ -870,19 +881,21 @@ void CheckWindow::on_pushButton_start_clicked() { + BaseCommonApi::SaveLogInfo(1,QString("---------------------")); connectDevice(); for(int i=0;i dataRes = caliDataList.value(sLabel); - + BaseCommonApi::SaveLogInfo(1,QString("开始 %1 测试").arg(sLabel)); for (int i = 0; i < dataRes.count(); ++i) { QString sRet=""; QString newCmd; double dStdValue,dError; //标准器输出 - + BaseCommonApi::SaveLogInfo(1,QString("标准器输出")); int idx= getIndexByHeader(sLabel,"检定项目"); QString sParam = dataRes[i][idx]; if(standardEngine.getState()){ @@ -901,7 +914,7 @@ } } //被检设备读数 - // InstructionLib *instrcutLib = getCmdByCheckName(0,sParam); + BaseCommonApi::SaveLogInfo(1,QString("被检设备输出")); if(deviceEngine.getState()){ InstructionLib *instrcutLib = getCmdByCheckName(0,sParam); if(instrcutLib!=nullptr){ @@ -922,6 +935,7 @@ sRet = deviceEngine.queryData(newCmd); idx= getIndexByHeader(sLabel,"单位"); dStdValue = transUnit(sRet,dataRes[i][idx]); + BaseCommonApi::SaveLogInfo(1,QString("测试值: %1").arg(dStdValue)); } } } diff --git a/softwareDirectory/AutoVerScheme/basecommonapi.cpp b/softwareDirectory/AutoVerScheme/basecommonapi.cpp index 89acbcf..ef5b373 100644 --- a/softwareDirectory/AutoVerScheme/basecommonapi.cpp +++ b/softwareDirectory/AutoVerScheme/basecommonapi.cpp @@ -2887,8 +2887,19 @@ //保存log信息 //log文件 - bool BaseCommonApi::SaveLogInfo(QString path,QString Info) + bool BaseCommonApi::SaveLogInfo(int pathIndex,QString Info) { + // 获取应用程序的根目录 + QString path = QCoreApplication::applicationDirPath(); + //QString path ="C:\\AutoVerScheme"; + switch (pathIndex) { + case 0: + path+="\\File\\sync_info.txt"; + break; + case 1: + path+="\\File\\textlog.txt"; + break; + } QByteArray utf8Dat; QString Message=Info; QFile file(path); @@ -2904,6 +2915,7 @@ if (!file.open(QIODevice::Append | QIODevice::Text)) { qDebug() << "无法打开文件:" << file.errorString(); + QString str=file.errorString(); return false; } QTextStream out(&file); diff --git a/softwareDirectory/AutoVerScheme/basecommonapi.h b/softwareDirectory/AutoVerScheme/basecommonapi.h index 0b4ca5d..4d3d17a 100644 --- a/softwareDirectory/AutoVerScheme/basecommonapi.h +++ b/softwareDirectory/AutoVerScheme/basecommonapi.h @@ -1205,7 +1205,7 @@ static InsertTask SelectTaskSingle(QString order_id); //log文件 - static bool SaveLogInfo(QString path,QString Info); + static bool SaveLogInfo(int pathIndex,QString Info); //新增日志表数据 static bool InsertzdLog(zdLog log); diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index 268cbfd..82050e1 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -56,7 +56,6 @@ unitTransList.insert("KΩ",0.001); unitTransList.insert("MΩ",0.000001); //统一定义命令占位符 - cmdPlaceHolderList.insert("{CH}","通道"); cmdPlaceHolderList.insert("{RANV}","量程"); cmdPlaceHolderList.insert("{RANI}","量程"); @@ -384,9 +383,12 @@ //获取行号 并进行添加行 rowCount = ui->tableWidget_Point->rowCount(); ui->tableWidget_Point->insertRow(rowCount); - if(i==0) - ui->tableWidget_Point->setItem(row, 0, new QTableWidgetItem(dataRes[i][1])); - ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(dataRes[i][5])); + int idx= getIndexByHeader(sLabel,"检定项目"); + int idx2= getIndexByHeader(sLabel,"标准值"); + int idx3= getIndexByHeader(sLabel,"单位"); + if(idx==-1){idx=1;};if(idx2==-1){idx2=5;};if(idx3==-1){idx3=4;}; + ui->tableWidget_Point->setItem(row, 0, new QTableWidgetItem(dataRes[i][idx])); + ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(dataRes[i][idx2]+"("+dataRes[i][idx3]+")")); ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); row++; } @@ -833,7 +835,15 @@ } return dTmp; } - +//double CheckWindow::TranDecimals(QString sLabel,QStringList data,double TestValue) +//{ + /* int dex=getIndexByHeader(sLabel,"标准值"); + double StanValue=data[dex].toDouble(); + while (tmp != std::floor(tmp)) { + tmp *= 10; + ++decimalPlaces; + }*/ +//} QString CheckWindow::transCmd(QString sCmd,QString sLabel,QStringList data,bool devicetype) { QString sNewCmd = sCmd; @@ -843,6 +853,7 @@ if (re.indexIn(sNewCmd) != -1) { delay= re.cap(1).toUInt(); } + BaseCommonApi::SaveLogInfo(1,QString("延迟 %1 ms").arg(delay)); qDebug() << "delay time:" << delay; Delay_MSec(delay); return ""; @@ -870,19 +881,21 @@ void CheckWindow::on_pushButton_start_clicked() { + BaseCommonApi::SaveLogInfo(1,QString("---------------------")); connectDevice(); for(int i=0;i dataRes = caliDataList.value(sLabel); - + BaseCommonApi::SaveLogInfo(1,QString("开始 %1 测试").arg(sLabel)); for (int i = 0; i < dataRes.count(); ++i) { QString sRet=""; QString newCmd; double dStdValue,dError; //标准器输出 - + BaseCommonApi::SaveLogInfo(1,QString("标准器输出")); int idx= getIndexByHeader(sLabel,"检定项目"); QString sParam = dataRes[i][idx]; if(standardEngine.getState()){ @@ -901,7 +914,7 @@ } } //被检设备读数 - // InstructionLib *instrcutLib = getCmdByCheckName(0,sParam); + BaseCommonApi::SaveLogInfo(1,QString("被检设备输出")); if(deviceEngine.getState()){ InstructionLib *instrcutLib = getCmdByCheckName(0,sParam); if(instrcutLib!=nullptr){ @@ -922,6 +935,7 @@ sRet = deviceEngine.queryData(newCmd); idx= getIndexByHeader(sLabel,"单位"); dStdValue = transUnit(sRet,dataRes[i][idx]); + BaseCommonApi::SaveLogInfo(1,QString("测试值: %1").arg(dStdValue)); } } } diff --git a/softwareDirectory/AutoVerScheme/syncdialog.cpp b/softwareDirectory/AutoVerScheme/syncdialog.cpp index e5cc4ae..db52073 100644 --- a/softwareDirectory/AutoVerScheme/syncdialog.cpp +++ b/softwareDirectory/AutoVerScheme/syncdialog.cpp @@ -61,7 +61,7 @@ threadPool= QThreadPool::globalInstance(); threadPool->setMaxThreadCount(5); // 设置线程池中的最大线程数 // 遍历表名,为每个表创建一个任务并提交到线程池 - BaseCommonApi::SaveLogInfo(filePath,"开始下载同步"); + BaseCommonApi::SaveLogInfo(1,"开始下载同步"); while (query.next()) { QString tableName = query.value(0).toString(); @@ -122,7 +122,7 @@ mess +=errorMessage+"....."; } //log保存 - BaseCommonApi::SaveLogInfo(filePath,mess); + BaseCommonApi::SaveLogInfo(1,mess); //界面listview显示 ui->listWidget->addItem(mess); // 当添加新项后,滚动到底部 @@ -191,7 +191,7 @@ dbmang.InsertzdDataSync(entity); } } - BaseCommonApi::SaveLogInfo(filePath,"结束下载同步"); + BaseCommonApi::SaveLogInfo(1,"结束下载同步"); QMessageBox::warning(this, "提示", "结束!"); } diff --git a/softwareDirectory/AutoVerScheme/basecommonapi.cpp b/softwareDirectory/AutoVerScheme/basecommonapi.cpp index 89acbcf..ef5b373 100644 --- a/softwareDirectory/AutoVerScheme/basecommonapi.cpp +++ b/softwareDirectory/AutoVerScheme/basecommonapi.cpp @@ -2887,8 +2887,19 @@ //保存log信息 //log文件 - bool BaseCommonApi::SaveLogInfo(QString path,QString Info) + bool BaseCommonApi::SaveLogInfo(int pathIndex,QString Info) { + // 获取应用程序的根目录 + QString path = QCoreApplication::applicationDirPath(); + //QString path ="C:\\AutoVerScheme"; + switch (pathIndex) { + case 0: + path+="\\File\\sync_info.txt"; + break; + case 1: + path+="\\File\\textlog.txt"; + break; + } QByteArray utf8Dat; QString Message=Info; QFile file(path); @@ -2904,6 +2915,7 @@ if (!file.open(QIODevice::Append | QIODevice::Text)) { qDebug() << "无法打开文件:" << file.errorString(); + QString str=file.errorString(); return false; } QTextStream out(&file); diff --git a/softwareDirectory/AutoVerScheme/basecommonapi.h b/softwareDirectory/AutoVerScheme/basecommonapi.h index 0b4ca5d..4d3d17a 100644 --- a/softwareDirectory/AutoVerScheme/basecommonapi.h +++ b/softwareDirectory/AutoVerScheme/basecommonapi.h @@ -1205,7 +1205,7 @@ static InsertTask SelectTaskSingle(QString order_id); //log文件 - static bool SaveLogInfo(QString path,QString Info); + static bool SaveLogInfo(int pathIndex,QString Info); //新增日志表数据 static bool InsertzdLog(zdLog log); diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index 268cbfd..82050e1 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -56,7 +56,6 @@ unitTransList.insert("KΩ",0.001); unitTransList.insert("MΩ",0.000001); //统一定义命令占位符 - cmdPlaceHolderList.insert("{CH}","通道"); cmdPlaceHolderList.insert("{RANV}","量程"); cmdPlaceHolderList.insert("{RANI}","量程"); @@ -384,9 +383,12 @@ //获取行号 并进行添加行 rowCount = ui->tableWidget_Point->rowCount(); ui->tableWidget_Point->insertRow(rowCount); - if(i==0) - ui->tableWidget_Point->setItem(row, 0, new QTableWidgetItem(dataRes[i][1])); - ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(dataRes[i][5])); + int idx= getIndexByHeader(sLabel,"检定项目"); + int idx2= getIndexByHeader(sLabel,"标准值"); + int idx3= getIndexByHeader(sLabel,"单位"); + if(idx==-1){idx=1;};if(idx2==-1){idx2=5;};if(idx3==-1){idx3=4;}; + ui->tableWidget_Point->setItem(row, 0, new QTableWidgetItem(dataRes[i][idx])); + ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(dataRes[i][idx2]+"("+dataRes[i][idx3]+")")); ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); row++; } @@ -833,7 +835,15 @@ } return dTmp; } - +//double CheckWindow::TranDecimals(QString sLabel,QStringList data,double TestValue) +//{ + /* int dex=getIndexByHeader(sLabel,"标准值"); + double StanValue=data[dex].toDouble(); + while (tmp != std::floor(tmp)) { + tmp *= 10; + ++decimalPlaces; + }*/ +//} QString CheckWindow::transCmd(QString sCmd,QString sLabel,QStringList data,bool devicetype) { QString sNewCmd = sCmd; @@ -843,6 +853,7 @@ if (re.indexIn(sNewCmd) != -1) { delay= re.cap(1).toUInt(); } + BaseCommonApi::SaveLogInfo(1,QString("延迟 %1 ms").arg(delay)); qDebug() << "delay time:" << delay; Delay_MSec(delay); return ""; @@ -870,19 +881,21 @@ void CheckWindow::on_pushButton_start_clicked() { + BaseCommonApi::SaveLogInfo(1,QString("---------------------")); connectDevice(); for(int i=0;i dataRes = caliDataList.value(sLabel); - + BaseCommonApi::SaveLogInfo(1,QString("开始 %1 测试").arg(sLabel)); for (int i = 0; i < dataRes.count(); ++i) { QString sRet=""; QString newCmd; double dStdValue,dError; //标准器输出 - + BaseCommonApi::SaveLogInfo(1,QString("标准器输出")); int idx= getIndexByHeader(sLabel,"检定项目"); QString sParam = dataRes[i][idx]; if(standardEngine.getState()){ @@ -901,7 +914,7 @@ } } //被检设备读数 - // InstructionLib *instrcutLib = getCmdByCheckName(0,sParam); + BaseCommonApi::SaveLogInfo(1,QString("被检设备输出")); if(deviceEngine.getState()){ InstructionLib *instrcutLib = getCmdByCheckName(0,sParam); if(instrcutLib!=nullptr){ @@ -922,6 +935,7 @@ sRet = deviceEngine.queryData(newCmd); idx= getIndexByHeader(sLabel,"单位"); dStdValue = transUnit(sRet,dataRes[i][idx]); + BaseCommonApi::SaveLogInfo(1,QString("测试值: %1").arg(dStdValue)); } } } diff --git a/softwareDirectory/AutoVerScheme/syncdialog.cpp b/softwareDirectory/AutoVerScheme/syncdialog.cpp index e5cc4ae..db52073 100644 --- a/softwareDirectory/AutoVerScheme/syncdialog.cpp +++ b/softwareDirectory/AutoVerScheme/syncdialog.cpp @@ -61,7 +61,7 @@ threadPool= QThreadPool::globalInstance(); threadPool->setMaxThreadCount(5); // 设置线程池中的最大线程数 // 遍历表名,为每个表创建一个任务并提交到线程池 - BaseCommonApi::SaveLogInfo(filePath,"开始下载同步"); + BaseCommonApi::SaveLogInfo(1,"开始下载同步"); while (query.next()) { QString tableName = query.value(0).toString(); @@ -122,7 +122,7 @@ mess +=errorMessage+"....."; } //log保存 - BaseCommonApi::SaveLogInfo(filePath,mess); + BaseCommonApi::SaveLogInfo(1,mess); //界面listview显示 ui->listWidget->addItem(mess); // 当添加新项后,滚动到底部 @@ -191,7 +191,7 @@ dbmang.InsertzdDataSync(entity); } } - BaseCommonApi::SaveLogInfo(filePath,"结束下载同步"); + BaseCommonApi::SaveLogInfo(1,"结束下载同步"); QMessageBox::warning(this, "提示", "结束!"); } diff --git a/softwareDirectory/AutoVerScheme/syncdialog.h b/softwareDirectory/AutoVerScheme/syncdialog.h index 2d5c41c..dc82e04 100644 --- a/softwareDirectory/AutoVerScheme/syncdialog.h +++ b/softwareDirectory/AutoVerScheme/syncdialog.h @@ -44,7 +44,6 @@ QSqlDatabase dstDb; QSqlDatabase srcDb; double progressDecrement; - QString filePath = "C:\\AutoVerScheme\\sync_info.txt"; QString zdlogId=""; diff --git a/softwareDirectory/AutoVerScheme/basecommonapi.cpp b/softwareDirectory/AutoVerScheme/basecommonapi.cpp index 89acbcf..ef5b373 100644 --- a/softwareDirectory/AutoVerScheme/basecommonapi.cpp +++ b/softwareDirectory/AutoVerScheme/basecommonapi.cpp @@ -2887,8 +2887,19 @@ //保存log信息 //log文件 - bool BaseCommonApi::SaveLogInfo(QString path,QString Info) + bool BaseCommonApi::SaveLogInfo(int pathIndex,QString Info) { + // 获取应用程序的根目录 + QString path = QCoreApplication::applicationDirPath(); + //QString path ="C:\\AutoVerScheme"; + switch (pathIndex) { + case 0: + path+="\\File\\sync_info.txt"; + break; + case 1: + path+="\\File\\textlog.txt"; + break; + } QByteArray utf8Dat; QString Message=Info; QFile file(path); @@ -2904,6 +2915,7 @@ if (!file.open(QIODevice::Append | QIODevice::Text)) { qDebug() << "无法打开文件:" << file.errorString(); + QString str=file.errorString(); return false; } QTextStream out(&file); diff --git a/softwareDirectory/AutoVerScheme/basecommonapi.h b/softwareDirectory/AutoVerScheme/basecommonapi.h index 0b4ca5d..4d3d17a 100644 --- a/softwareDirectory/AutoVerScheme/basecommonapi.h +++ b/softwareDirectory/AutoVerScheme/basecommonapi.h @@ -1205,7 +1205,7 @@ static InsertTask SelectTaskSingle(QString order_id); //log文件 - static bool SaveLogInfo(QString path,QString Info); + static bool SaveLogInfo(int pathIndex,QString Info); //新增日志表数据 static bool InsertzdLog(zdLog log); diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index 268cbfd..82050e1 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -56,7 +56,6 @@ unitTransList.insert("KΩ",0.001); unitTransList.insert("MΩ",0.000001); //统一定义命令占位符 - cmdPlaceHolderList.insert("{CH}","通道"); cmdPlaceHolderList.insert("{RANV}","量程"); cmdPlaceHolderList.insert("{RANI}","量程"); @@ -384,9 +383,12 @@ //获取行号 并进行添加行 rowCount = ui->tableWidget_Point->rowCount(); ui->tableWidget_Point->insertRow(rowCount); - if(i==0) - ui->tableWidget_Point->setItem(row, 0, new QTableWidgetItem(dataRes[i][1])); - ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(dataRes[i][5])); + int idx= getIndexByHeader(sLabel,"检定项目"); + int idx2= getIndexByHeader(sLabel,"标准值"); + int idx3= getIndexByHeader(sLabel,"单位"); + if(idx==-1){idx=1;};if(idx2==-1){idx2=5;};if(idx3==-1){idx3=4;}; + ui->tableWidget_Point->setItem(row, 0, new QTableWidgetItem(dataRes[i][idx])); + ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(dataRes[i][idx2]+"("+dataRes[i][idx3]+")")); ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); row++; } @@ -833,7 +835,15 @@ } return dTmp; } - +//double CheckWindow::TranDecimals(QString sLabel,QStringList data,double TestValue) +//{ + /* int dex=getIndexByHeader(sLabel,"标准值"); + double StanValue=data[dex].toDouble(); + while (tmp != std::floor(tmp)) { + tmp *= 10; + ++decimalPlaces; + }*/ +//} QString CheckWindow::transCmd(QString sCmd,QString sLabel,QStringList data,bool devicetype) { QString sNewCmd = sCmd; @@ -843,6 +853,7 @@ if (re.indexIn(sNewCmd) != -1) { delay= re.cap(1).toUInt(); } + BaseCommonApi::SaveLogInfo(1,QString("延迟 %1 ms").arg(delay)); qDebug() << "delay time:" << delay; Delay_MSec(delay); return ""; @@ -870,19 +881,21 @@ void CheckWindow::on_pushButton_start_clicked() { + BaseCommonApi::SaveLogInfo(1,QString("---------------------")); connectDevice(); for(int i=0;i dataRes = caliDataList.value(sLabel); - + BaseCommonApi::SaveLogInfo(1,QString("开始 %1 测试").arg(sLabel)); for (int i = 0; i < dataRes.count(); ++i) { QString sRet=""; QString newCmd; double dStdValue,dError; //标准器输出 - + BaseCommonApi::SaveLogInfo(1,QString("标准器输出")); int idx= getIndexByHeader(sLabel,"检定项目"); QString sParam = dataRes[i][idx]; if(standardEngine.getState()){ @@ -901,7 +914,7 @@ } } //被检设备读数 - // InstructionLib *instrcutLib = getCmdByCheckName(0,sParam); + BaseCommonApi::SaveLogInfo(1,QString("被检设备输出")); if(deviceEngine.getState()){ InstructionLib *instrcutLib = getCmdByCheckName(0,sParam); if(instrcutLib!=nullptr){ @@ -922,6 +935,7 @@ sRet = deviceEngine.queryData(newCmd); idx= getIndexByHeader(sLabel,"单位"); dStdValue = transUnit(sRet,dataRes[i][idx]); + BaseCommonApi::SaveLogInfo(1,QString("测试值: %1").arg(dStdValue)); } } } diff --git a/softwareDirectory/AutoVerScheme/syncdialog.cpp b/softwareDirectory/AutoVerScheme/syncdialog.cpp index e5cc4ae..db52073 100644 --- a/softwareDirectory/AutoVerScheme/syncdialog.cpp +++ b/softwareDirectory/AutoVerScheme/syncdialog.cpp @@ -61,7 +61,7 @@ threadPool= QThreadPool::globalInstance(); threadPool->setMaxThreadCount(5); // 设置线程池中的最大线程数 // 遍历表名,为每个表创建一个任务并提交到线程池 - BaseCommonApi::SaveLogInfo(filePath,"开始下载同步"); + BaseCommonApi::SaveLogInfo(1,"开始下载同步"); while (query.next()) { QString tableName = query.value(0).toString(); @@ -122,7 +122,7 @@ mess +=errorMessage+"....."; } //log保存 - BaseCommonApi::SaveLogInfo(filePath,mess); + BaseCommonApi::SaveLogInfo(1,mess); //界面listview显示 ui->listWidget->addItem(mess); // 当添加新项后,滚动到底部 @@ -191,7 +191,7 @@ dbmang.InsertzdDataSync(entity); } } - BaseCommonApi::SaveLogInfo(filePath,"结束下载同步"); + BaseCommonApi::SaveLogInfo(1,"结束下载同步"); QMessageBox::warning(this, "提示", "结束!"); } diff --git a/softwareDirectory/AutoVerScheme/syncdialog.h b/softwareDirectory/AutoVerScheme/syncdialog.h index 2d5c41c..dc82e04 100644 --- a/softwareDirectory/AutoVerScheme/syncdialog.h +++ b/softwareDirectory/AutoVerScheme/syncdialog.h @@ -44,7 +44,6 @@ QSqlDatabase dstDb; QSqlDatabase srcDb; double progressDecrement; - QString filePath = "C:\\AutoVerScheme\\sync_info.txt"; QString zdlogId=""; diff --git a/softwareDirectory/AutoVerScheme/testdataitem.cpp b/softwareDirectory/AutoVerScheme/testdataitem.cpp index f59db90..7046e86 100644 --- a/softwareDirectory/AutoVerScheme/testdataitem.cpp +++ b/softwareDirectory/AutoVerScheme/testdataitem.cpp @@ -211,7 +211,7 @@ ui->tableWidgetdevice->setHorizontalHeaderLabels(headers); DeviceInfoInit(entity); ui->stackedWidget->setCurrentIndex(1); - QMessageBox::information(this, "ID",entity.id); + //QMessageBox::information(this, "ID",entity.id); } void TestDataItem::OnButtonPreViewtClicked(QString id) { diff --git a/softwareDirectory/AutoVerScheme/basecommonapi.cpp b/softwareDirectory/AutoVerScheme/basecommonapi.cpp index 89acbcf..ef5b373 100644 --- a/softwareDirectory/AutoVerScheme/basecommonapi.cpp +++ b/softwareDirectory/AutoVerScheme/basecommonapi.cpp @@ -2887,8 +2887,19 @@ //保存log信息 //log文件 - bool BaseCommonApi::SaveLogInfo(QString path,QString Info) + bool BaseCommonApi::SaveLogInfo(int pathIndex,QString Info) { + // 获取应用程序的根目录 + QString path = QCoreApplication::applicationDirPath(); + //QString path ="C:\\AutoVerScheme"; + switch (pathIndex) { + case 0: + path+="\\File\\sync_info.txt"; + break; + case 1: + path+="\\File\\textlog.txt"; + break; + } QByteArray utf8Dat; QString Message=Info; QFile file(path); @@ -2904,6 +2915,7 @@ if (!file.open(QIODevice::Append | QIODevice::Text)) { qDebug() << "无法打开文件:" << file.errorString(); + QString str=file.errorString(); return false; } QTextStream out(&file); diff --git a/softwareDirectory/AutoVerScheme/basecommonapi.h b/softwareDirectory/AutoVerScheme/basecommonapi.h index 0b4ca5d..4d3d17a 100644 --- a/softwareDirectory/AutoVerScheme/basecommonapi.h +++ b/softwareDirectory/AutoVerScheme/basecommonapi.h @@ -1205,7 +1205,7 @@ static InsertTask SelectTaskSingle(QString order_id); //log文件 - static bool SaveLogInfo(QString path,QString Info); + static bool SaveLogInfo(int pathIndex,QString Info); //新增日志表数据 static bool InsertzdLog(zdLog log); diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index 268cbfd..82050e1 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -56,7 +56,6 @@ unitTransList.insert("KΩ",0.001); unitTransList.insert("MΩ",0.000001); //统一定义命令占位符 - cmdPlaceHolderList.insert("{CH}","通道"); cmdPlaceHolderList.insert("{RANV}","量程"); cmdPlaceHolderList.insert("{RANI}","量程"); @@ -384,9 +383,12 @@ //获取行号 并进行添加行 rowCount = ui->tableWidget_Point->rowCount(); ui->tableWidget_Point->insertRow(rowCount); - if(i==0) - ui->tableWidget_Point->setItem(row, 0, new QTableWidgetItem(dataRes[i][1])); - ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(dataRes[i][5])); + int idx= getIndexByHeader(sLabel,"检定项目"); + int idx2= getIndexByHeader(sLabel,"标准值"); + int idx3= getIndexByHeader(sLabel,"单位"); + if(idx==-1){idx=1;};if(idx2==-1){idx2=5;};if(idx3==-1){idx3=4;}; + ui->tableWidget_Point->setItem(row, 0, new QTableWidgetItem(dataRes[i][idx])); + ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(dataRes[i][idx2]+"("+dataRes[i][idx3]+")")); ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); row++; } @@ -833,7 +835,15 @@ } return dTmp; } - +//double CheckWindow::TranDecimals(QString sLabel,QStringList data,double TestValue) +//{ + /* int dex=getIndexByHeader(sLabel,"标准值"); + double StanValue=data[dex].toDouble(); + while (tmp != std::floor(tmp)) { + tmp *= 10; + ++decimalPlaces; + }*/ +//} QString CheckWindow::transCmd(QString sCmd,QString sLabel,QStringList data,bool devicetype) { QString sNewCmd = sCmd; @@ -843,6 +853,7 @@ if (re.indexIn(sNewCmd) != -1) { delay= re.cap(1).toUInt(); } + BaseCommonApi::SaveLogInfo(1,QString("延迟 %1 ms").arg(delay)); qDebug() << "delay time:" << delay; Delay_MSec(delay); return ""; @@ -870,19 +881,21 @@ void CheckWindow::on_pushButton_start_clicked() { + BaseCommonApi::SaveLogInfo(1,QString("---------------------")); connectDevice(); for(int i=0;i dataRes = caliDataList.value(sLabel); - + BaseCommonApi::SaveLogInfo(1,QString("开始 %1 测试").arg(sLabel)); for (int i = 0; i < dataRes.count(); ++i) { QString sRet=""; QString newCmd; double dStdValue,dError; //标准器输出 - + BaseCommonApi::SaveLogInfo(1,QString("标准器输出")); int idx= getIndexByHeader(sLabel,"检定项目"); QString sParam = dataRes[i][idx]; if(standardEngine.getState()){ @@ -901,7 +914,7 @@ } } //被检设备读数 - // InstructionLib *instrcutLib = getCmdByCheckName(0,sParam); + BaseCommonApi::SaveLogInfo(1,QString("被检设备输出")); if(deviceEngine.getState()){ InstructionLib *instrcutLib = getCmdByCheckName(0,sParam); if(instrcutLib!=nullptr){ @@ -922,6 +935,7 @@ sRet = deviceEngine.queryData(newCmd); idx= getIndexByHeader(sLabel,"单位"); dStdValue = transUnit(sRet,dataRes[i][idx]); + BaseCommonApi::SaveLogInfo(1,QString("测试值: %1").arg(dStdValue)); } } } diff --git a/softwareDirectory/AutoVerScheme/syncdialog.cpp b/softwareDirectory/AutoVerScheme/syncdialog.cpp index e5cc4ae..db52073 100644 --- a/softwareDirectory/AutoVerScheme/syncdialog.cpp +++ b/softwareDirectory/AutoVerScheme/syncdialog.cpp @@ -61,7 +61,7 @@ threadPool= QThreadPool::globalInstance(); threadPool->setMaxThreadCount(5); // 设置线程池中的最大线程数 // 遍历表名,为每个表创建一个任务并提交到线程池 - BaseCommonApi::SaveLogInfo(filePath,"开始下载同步"); + BaseCommonApi::SaveLogInfo(1,"开始下载同步"); while (query.next()) { QString tableName = query.value(0).toString(); @@ -122,7 +122,7 @@ mess +=errorMessage+"....."; } //log保存 - BaseCommonApi::SaveLogInfo(filePath,mess); + BaseCommonApi::SaveLogInfo(1,mess); //界面listview显示 ui->listWidget->addItem(mess); // 当添加新项后,滚动到底部 @@ -191,7 +191,7 @@ dbmang.InsertzdDataSync(entity); } } - BaseCommonApi::SaveLogInfo(filePath,"结束下载同步"); + BaseCommonApi::SaveLogInfo(1,"结束下载同步"); QMessageBox::warning(this, "提示", "结束!"); } diff --git a/softwareDirectory/AutoVerScheme/syncdialog.h b/softwareDirectory/AutoVerScheme/syncdialog.h index 2d5c41c..dc82e04 100644 --- a/softwareDirectory/AutoVerScheme/syncdialog.h +++ b/softwareDirectory/AutoVerScheme/syncdialog.h @@ -44,7 +44,6 @@ QSqlDatabase dstDb; QSqlDatabase srcDb; double progressDecrement; - QString filePath = "C:\\AutoVerScheme\\sync_info.txt"; QString zdlogId=""; diff --git a/softwareDirectory/AutoVerScheme/testdataitem.cpp b/softwareDirectory/AutoVerScheme/testdataitem.cpp index f59db90..7046e86 100644 --- a/softwareDirectory/AutoVerScheme/testdataitem.cpp +++ b/softwareDirectory/AutoVerScheme/testdataitem.cpp @@ -211,7 +211,7 @@ ui->tableWidgetdevice->setHorizontalHeaderLabels(headers); DeviceInfoInit(entity); ui->stackedWidget->setCurrentIndex(1); - QMessageBox::information(this, "ID",entity.id); + //QMessageBox::information(this, "ID",entity.id); } void TestDataItem::OnButtonPreViewtClicked(QString id) { diff --git a/softwareDirectory/AutoVerScheme/visacommonengine.cpp b/softwareDirectory/AutoVerScheme/visacommonengine.cpp index e0e16af..43cec07 100644 --- a/softwareDirectory/AutoVerScheme/visacommonengine.cpp +++ b/softwareDirectory/AutoVerScheme/visacommonengine.cpp @@ -216,6 +216,7 @@ QString VisaCommonEngine::queryData(QString sCmd) { if(commType=="Visa"){ + BaseCommonApi::SaveLogInfo(1,QString("读取指令:%1").arg(sCmd)); utf8Bytes = (sCmd+"\n").toUtf8(); ViConstRsrc sQuery = reinterpret_cast(utf8Bytes.constData()); @@ -250,7 +251,8 @@ //strcpy(stringinput, strData.toLatin1().data()); //strcpy(stringinput, "*IDN?\n"); if(commType=="Visa"){ - utf8Bytes = (sCmd+"\n").toUtf8(); + BaseCommonApi::SaveLogInfo(1,QString("配置指令:%1").arg(sCmd)); + utf8Bytes = (sCmd+"\n").toUtf8(); ViBuf buffer = reinterpret_cast(utf8Bytes.data()); ViUInt32 bufferSize = static_cast(utf8Bytes.size()); status = viWrite(instr, buffer, bufferSize, &writeCount); diff --git a/softwareDirectory/AutoVerScheme/basecommonapi.cpp b/softwareDirectory/AutoVerScheme/basecommonapi.cpp index 89acbcf..ef5b373 100644 --- a/softwareDirectory/AutoVerScheme/basecommonapi.cpp +++ b/softwareDirectory/AutoVerScheme/basecommonapi.cpp @@ -2887,8 +2887,19 @@ //保存log信息 //log文件 - bool BaseCommonApi::SaveLogInfo(QString path,QString Info) + bool BaseCommonApi::SaveLogInfo(int pathIndex,QString Info) { + // 获取应用程序的根目录 + QString path = QCoreApplication::applicationDirPath(); + //QString path ="C:\\AutoVerScheme"; + switch (pathIndex) { + case 0: + path+="\\File\\sync_info.txt"; + break; + case 1: + path+="\\File\\textlog.txt"; + break; + } QByteArray utf8Dat; QString Message=Info; QFile file(path); @@ -2904,6 +2915,7 @@ if (!file.open(QIODevice::Append | QIODevice::Text)) { qDebug() << "无法打开文件:" << file.errorString(); + QString str=file.errorString(); return false; } QTextStream out(&file); diff --git a/softwareDirectory/AutoVerScheme/basecommonapi.h b/softwareDirectory/AutoVerScheme/basecommonapi.h index 0b4ca5d..4d3d17a 100644 --- a/softwareDirectory/AutoVerScheme/basecommonapi.h +++ b/softwareDirectory/AutoVerScheme/basecommonapi.h @@ -1205,7 +1205,7 @@ static InsertTask SelectTaskSingle(QString order_id); //log文件 - static bool SaveLogInfo(QString path,QString Info); + static bool SaveLogInfo(int pathIndex,QString Info); //新增日志表数据 static bool InsertzdLog(zdLog log); diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index 268cbfd..82050e1 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -56,7 +56,6 @@ unitTransList.insert("KΩ",0.001); unitTransList.insert("MΩ",0.000001); //统一定义命令占位符 - cmdPlaceHolderList.insert("{CH}","通道"); cmdPlaceHolderList.insert("{RANV}","量程"); cmdPlaceHolderList.insert("{RANI}","量程"); @@ -384,9 +383,12 @@ //获取行号 并进行添加行 rowCount = ui->tableWidget_Point->rowCount(); ui->tableWidget_Point->insertRow(rowCount); - if(i==0) - ui->tableWidget_Point->setItem(row, 0, new QTableWidgetItem(dataRes[i][1])); - ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(dataRes[i][5])); + int idx= getIndexByHeader(sLabel,"检定项目"); + int idx2= getIndexByHeader(sLabel,"标准值"); + int idx3= getIndexByHeader(sLabel,"单位"); + if(idx==-1){idx=1;};if(idx2==-1){idx2=5;};if(idx3==-1){idx3=4;}; + ui->tableWidget_Point->setItem(row, 0, new QTableWidgetItem(dataRes[i][idx])); + ui->tableWidget_Point->setItem(row, 1, new QTableWidgetItem(dataRes[i][idx2]+"("+dataRes[i][idx3]+")")); ui->tableWidget_Point->setItem(row, 2, new QTableWidgetItem("1")); row++; } @@ -833,7 +835,15 @@ } return dTmp; } - +//double CheckWindow::TranDecimals(QString sLabel,QStringList data,double TestValue) +//{ + /* int dex=getIndexByHeader(sLabel,"标准值"); + double StanValue=data[dex].toDouble(); + while (tmp != std::floor(tmp)) { + tmp *= 10; + ++decimalPlaces; + }*/ +//} QString CheckWindow::transCmd(QString sCmd,QString sLabel,QStringList data,bool devicetype) { QString sNewCmd = sCmd; @@ -843,6 +853,7 @@ if (re.indexIn(sNewCmd) != -1) { delay= re.cap(1).toUInt(); } + BaseCommonApi::SaveLogInfo(1,QString("延迟 %1 ms").arg(delay)); qDebug() << "delay time:" << delay; Delay_MSec(delay); return ""; @@ -870,19 +881,21 @@ void CheckWindow::on_pushButton_start_clicked() { + BaseCommonApi::SaveLogInfo(1,QString("---------------------")); connectDevice(); for(int i=0;i dataRes = caliDataList.value(sLabel); - + BaseCommonApi::SaveLogInfo(1,QString("开始 %1 测试").arg(sLabel)); for (int i = 0; i < dataRes.count(); ++i) { QString sRet=""; QString newCmd; double dStdValue,dError; //标准器输出 - + BaseCommonApi::SaveLogInfo(1,QString("标准器输出")); int idx= getIndexByHeader(sLabel,"检定项目"); QString sParam = dataRes[i][idx]; if(standardEngine.getState()){ @@ -901,7 +914,7 @@ } } //被检设备读数 - // InstructionLib *instrcutLib = getCmdByCheckName(0,sParam); + BaseCommonApi::SaveLogInfo(1,QString("被检设备输出")); if(deviceEngine.getState()){ InstructionLib *instrcutLib = getCmdByCheckName(0,sParam); if(instrcutLib!=nullptr){ @@ -922,6 +935,7 @@ sRet = deviceEngine.queryData(newCmd); idx= getIndexByHeader(sLabel,"单位"); dStdValue = transUnit(sRet,dataRes[i][idx]); + BaseCommonApi::SaveLogInfo(1,QString("测试值: %1").arg(dStdValue)); } } } diff --git a/softwareDirectory/AutoVerScheme/syncdialog.cpp b/softwareDirectory/AutoVerScheme/syncdialog.cpp index e5cc4ae..db52073 100644 --- a/softwareDirectory/AutoVerScheme/syncdialog.cpp +++ b/softwareDirectory/AutoVerScheme/syncdialog.cpp @@ -61,7 +61,7 @@ threadPool= QThreadPool::globalInstance(); threadPool->setMaxThreadCount(5); // 设置线程池中的最大线程数 // 遍历表名,为每个表创建一个任务并提交到线程池 - BaseCommonApi::SaveLogInfo(filePath,"开始下载同步"); + BaseCommonApi::SaveLogInfo(1,"开始下载同步"); while (query.next()) { QString tableName = query.value(0).toString(); @@ -122,7 +122,7 @@ mess +=errorMessage+"....."; } //log保存 - BaseCommonApi::SaveLogInfo(filePath,mess); + BaseCommonApi::SaveLogInfo(1,mess); //界面listview显示 ui->listWidget->addItem(mess); // 当添加新项后,滚动到底部 @@ -191,7 +191,7 @@ dbmang.InsertzdDataSync(entity); } } - BaseCommonApi::SaveLogInfo(filePath,"结束下载同步"); + BaseCommonApi::SaveLogInfo(1,"结束下载同步"); QMessageBox::warning(this, "提示", "结束!"); } diff --git a/softwareDirectory/AutoVerScheme/syncdialog.h b/softwareDirectory/AutoVerScheme/syncdialog.h index 2d5c41c..dc82e04 100644 --- a/softwareDirectory/AutoVerScheme/syncdialog.h +++ b/softwareDirectory/AutoVerScheme/syncdialog.h @@ -44,7 +44,6 @@ QSqlDatabase dstDb; QSqlDatabase srcDb; double progressDecrement; - QString filePath = "C:\\AutoVerScheme\\sync_info.txt"; QString zdlogId=""; diff --git a/softwareDirectory/AutoVerScheme/testdataitem.cpp b/softwareDirectory/AutoVerScheme/testdataitem.cpp index f59db90..7046e86 100644 --- a/softwareDirectory/AutoVerScheme/testdataitem.cpp +++ b/softwareDirectory/AutoVerScheme/testdataitem.cpp @@ -211,7 +211,7 @@ ui->tableWidgetdevice->setHorizontalHeaderLabels(headers); DeviceInfoInit(entity); ui->stackedWidget->setCurrentIndex(1); - QMessageBox::information(this, "ID",entity.id); + //QMessageBox::information(this, "ID",entity.id); } void TestDataItem::OnButtonPreViewtClicked(QString id) { diff --git a/softwareDirectory/AutoVerScheme/visacommonengine.cpp b/softwareDirectory/AutoVerScheme/visacommonengine.cpp index e0e16af..43cec07 100644 --- a/softwareDirectory/AutoVerScheme/visacommonengine.cpp +++ b/softwareDirectory/AutoVerScheme/visacommonengine.cpp @@ -216,6 +216,7 @@ QString VisaCommonEngine::queryData(QString sCmd) { if(commType=="Visa"){ + BaseCommonApi::SaveLogInfo(1,QString("读取指令:%1").arg(sCmd)); utf8Bytes = (sCmd+"\n").toUtf8(); ViConstRsrc sQuery = reinterpret_cast(utf8Bytes.constData()); @@ -250,7 +251,8 @@ //strcpy(stringinput, strData.toLatin1().data()); //strcpy(stringinput, "*IDN?\n"); if(commType=="Visa"){ - utf8Bytes = (sCmd+"\n").toUtf8(); + BaseCommonApi::SaveLogInfo(1,QString("配置指令:%1").arg(sCmd)); + utf8Bytes = (sCmd+"\n").toUtf8(); ViBuf buffer = reinterpret_cast(utf8Bytes.data()); ViUInt32 bufferSize = static_cast(utf8Bytes.size()); status = viWrite(instr, buffer, bufferSize, &writeCount); diff --git a/softwareDirectory/AutoVerScheme/visacommonengine.h b/softwareDirectory/AutoVerScheme/visacommonengine.h index af0d978..f9ef609 100644 --- a/softwareDirectory/AutoVerScheme/visacommonengine.h +++ b/softwareDirectory/AutoVerScheme/visacommonengine.h @@ -4,6 +4,7 @@ #include #include #include +#include "basecommonApi.h" class VisaCommonEngine {