diff --git a/softwareDirectory/AutoVerScheme/basecommonapi.cpp b/softwareDirectory/AutoVerScheme/basecommonapi.cpp index bb70bfc..e2da63f 100644 --- a/softwareDirectory/AutoVerScheme/basecommonapi.cpp +++ b/softwareDirectory/AutoVerScheme/basecommonapi.cpp @@ -900,25 +900,23 @@ switch (CliTable[0].belong_standard_equipment.toInt()) { case 1: - //CliTable[0].id - //1717086652508487681 - //根据被检设备的检定项分类去查询 TODO - DataList=BaseCommonApi::getVerMultiCalClass(deviceCatoryName,CliTable[0].id,HeadList); + DataList=BaseCommonApi::getVerMultiCalClass(deviceCatoryName,CliTable[0].id,HeadList); break; - case 4: - DataList=BaseCommonApi::getDeviceMeasureCalibratorPistonGauge(deviceCatoryName,CliTable[0].id,HeadList); - break; - case 13: + case 2: + DataList=BaseCommonApi::getDeviceMeasureItemDataDcPower(deviceCatoryName,CliTable[0].id,HeadList); + break; + case 4: + DataList=BaseCommonApi::getDeviceMeasureCalibratorPistonGauge(deviceCatoryName,CliTable[0].id,HeadList); + break; + case 13: //示波器标准装置 = 13 - DataList=BaseCommonApi::getDeviceOscilloscopeCalibration(deviceCatoryName,CliTable[0].id,HeadList); + //DataList=BaseCommonApi::getDeviceOscilloscopeCalibration(deviceCatoryName,CliTable[0].id,HeadList); break; - default: - break; } return DataList; -} +}; //根据被检设备ID获取当前设备的 检定项目及检定点 测试函数 QList BaseCommonApi::Search_CalibrationTable(QString DeiverId,QStringList *HeadList) { @@ -938,7 +936,7 @@ } return DataList; -} +}; //核查设备对应的装置表 核查项及核查点 传参设备id QList BaseCommonApi::Search_VerifyTable(QString DeiverId,QStringList *HeadList ) { @@ -952,7 +950,7 @@ break; } return DataList; -} +}; //判断检定数据管理 结果信息表 QList BaseCommonApi::Search_CalibrationDataTable(QString DeiverId,QString dataId,QStringList *HeadList) { @@ -966,7 +964,7 @@ break; } return DataList; -} +}; //判断核查数据管理 结果信息表 QList BaseCommonApi::Search_VerifyDataTable(QString DeiverId,QString dataId,QStringList *HeadList) { @@ -981,7 +979,7 @@ break; } return DataList; -} +}; //被检设备管理-检定项目及检定点-多功能校准源 QList BaseCommonApi::getVerMultiCal(QString itemId,QStringList *headList) { @@ -1091,21 +1089,19 @@ QList DCIList; QList ACIList; QList RList; - if(itemCatoryName.contains("数字多用表")){ - for(const QStringList &row : ResultData) - { - QStringList head; - QStringList Data; - QString VerificationItem=NULL; - if (!row.isEmpty()) { // 确保行不为空 - if(row[2]=="DCV") - { - VerificationItem = "DCV"; - //添加列头 - + if(itemCatoryName.contains("数字多用表")){ + for(const QStringList &row : ResultData) + { + QStringList head; + QStringList Data; + QString VerificationItem=NULL; + if (!row.isEmpty()) { // 确保行不为空 + if(row[2]=="DCV") + { + VerificationItem = "DCV"; + //添加列头 head << "序号" << "检定项目" << "量" << "单位" << "量程"<< "标准值" << "示值" << "绝对误差" << "最大允许误差" << "分辨力"; HeadMapList->insert(VerificationItem,head); - //添加数据 Data.append(row[0]); //ID Data.append(row[2]); //检定项目 @@ -1314,13 +1310,11 @@ verificationData.measure_valid_date = query.value("measure_valid_date").toDateTime(); verificationData.meter_identify = query.value("meter_identify").toString(); verificationData.restriction_instruction = query.value("restriction_instruction").toString(); - result.append(verificationData); } } else { qDebug() << "Query execution failed: " << query.lastError().text(); } - return result; } //检定数据管理-检定基本信息-标准设备 参数:首页数据的id @@ -1736,7 +1730,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //新建检定程序 @@ -1770,7 +1764,7 @@ } return isSuccess; -} +}; //新增通讯接口 bool BaseCommonApi::InsertVerificationProgramConfigInterface(VerificationProgramConfigInterface configInterdace) @@ -1793,7 +1787,7 @@ } return isSuccess; -} +}; //更新检定程序 bool BaseCommonApi::UpdateVerificationProgramInfo(VerificationProgramInfo verInfo) @@ -1836,7 +1830,7 @@ qDebug() << "InsertOrderSampleRelation query failed: " << query.lastError().text(); } return isSuccess; -} +}; //更新通讯接口 bool BaseCommonApi::UpdateVerificationProgramConfigInterface(VerificationProgramConfigInterface configInterdace) { @@ -1855,7 +1849,7 @@ qDebug() << "InsertOrderSampleRelation query failed: " << query.lastError().text(); } return isSuccess; -} +}; //删除检定程序 bool BaseCommonApi::DeleteVerificationProgramInfo(QString id) { @@ -1869,7 +1863,7 @@ return false; } return true; -} +}; //查询指令库 参数 检定程序id QList BaseCommonApi::getInstructionLib(QString verification_program_id) @@ -1899,7 +1893,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //查询检定项用于在新增指令时筛选 例如DCV ACI 如果equipment_item_category_id为空查询所有 QList BaseCommonApi::getParams(QString belong_standard_equipment_id,QString equipment_item_category_id) { @@ -1929,7 +1923,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //新增指令库 bool BaseCommonApi::InsertInstructionLib(InstructionLib instructionLib) @@ -1959,7 +1953,7 @@ } return isSuccess; -} +}; //删除指令库 bool BaseCommonApi::DeleteInstructionLib(QString id) { @@ -1971,7 +1965,7 @@ return false; } return true; -} +}; //更新指令库 bool BaseCommonApi::UpdateInstructionLib(InstructionLib instructionLib) { @@ -1998,21 +1992,21 @@ qDebug() << "InsertOrderSampleRelation query failed: " << query.lastError().text(); } return isSuccess; -} +}; //雪花算法生成id qint64 BaseCommonApi::generateId() { return this->idWorker.nextId(); -} +}; QString BaseCommonApi::GenerateTaskNumber() { QList TaskList= BaseCommonApi::getCreateTaskListNew(); return TaskManager::generateTask(TaskList.first().order_no); -} +}; bool BaseCommonApi::AddTaskNumber() { return TaskManager::AddCurrenTaskCount(); -} +}; ////自动检定-根据被检设备 查询检定项分类 QList BaseCommonApi::getDeviceMeasureEquipmentCatory(QString deviceId) { @@ -2052,7 +2046,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; ////自动检定-根据被检设备 查询检定项分类 在查询检定程序 //根据getDeviceMeasureEquipmentCatory返回的item_category_id查询检定程序 QList BaseCommonApi::getVerificationProgramInfoByDeviceId(QString deviceId) @@ -2091,7 +2085,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //自动检定-结果保存-biz_business_device_measure_info 基本信息表 @@ -2189,7 +2183,7 @@ } return isSuccess; -} +}; //计量检定业务-受检设备检定管理-检定数据管理-所使用的标准、主要测量设备 bool BaseCommonApi::InsertDeviceMeasureEquipment(DeviceMeasureEquipment deviceMeasure) { @@ -2211,8 +2205,7 @@ } return isSuccess; -} - +}; //自动检定-结果保存-检定数据管理多功能校准源数据(自动检定输出或业务创建) bool BaseCommonApi::InsertVerMultiCal(SaveDeviceMeasureCalibrator measureCalibrator) { @@ -2262,7 +2255,7 @@ qDebug() << "InsertOrderSampleRelation query failed: " << query.lastError().text(); } return isSuccess; -} +}; // 核查程序管理首页查询 QList BaseCommonApi::getCheckProgramManage() { @@ -2284,7 +2277,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //核查程序管理-编辑查询单个 CheckProgramManage BaseCommonApi::getCheckProgramManageById(QString id) { @@ -2311,7 +2304,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //核查程序管理-编辑查询 选择设备 选择标准 QList BaseCommonApi::getCheckDeviceList() { @@ -2332,7 +2325,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //核查程序管理-编辑查询 选择设备 选择核查件 为标准和被检的并集 QList BaseCommonApi::getCheckAndTestedDeviceList() { @@ -2357,7 +2350,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //核查程序管理-核查设置-多功能校准源 参数设备id 同信息管理-标准设备管理-核查项及核查点 QList BaseCommonApi::getVerificationItemsMultiList(QString equipment_id,QStringList *headList) { @@ -2398,7 +2391,7 @@ *headList <<"id"<<"核查项分类id"<<"配套设备id"<<"核查类型"<<"核查点类型"<<"核查项目"<<"单位"<<"频率"<<"分辨力"<<"核查点" <<"频率单位"<<"循环次数"<<"Urel"<<"通道"<<"TFER"<<"DCCP"<<"FLIT"<<"核查项备注"<<"创建时间"<<"更新时间"; return resultData; -} +}; //新增核查程序 bool BaseCommonApi::InsertCheckProgramManage(CheckProgramManage check) @@ -2425,7 +2418,7 @@ } return isSuccess; -} +}; //更新核查程序 bool BaseCommonApi::UpdateCheckProgramManage(CheckProgramManage check) @@ -2448,7 +2441,7 @@ qDebug() << "InsertOrderSampleRelation query failed: " << query.lastError().text(); } return isSuccess; -} +}; //删除核查程序 bool BaseCommonApi::DeleteCheckProgramManage(QString id) { @@ -2460,7 +2453,7 @@ qDebug() << "InsertOrderSampleRelation query failed: " << query.lastError().text(); } return isSuccess; -} +}; // 自动核查-根据 设备id查询核查件设备信息 CheckAndTestedDevice BaseCommonApi::getCheckAndTestedDeviceById(QString deviceId) { @@ -2487,7 +2480,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //自动核查-结果保存-设备与装置-标准装置管理-核查数据管理0.02级活塞式压力计数据表 bool BaseCommonApi::InsertStandardCheckDatePistonGauge(StandardCheckDatePistonGauge gauge) { @@ -2536,7 +2529,7 @@ return isSuccess; -} +}; //自动核查-结果保存-基本信息 bool BaseCommonApi::InsertCheckDataManageBasicInfo(CheckDataManageBasicInfo baseInfo) { @@ -2572,7 +2565,7 @@ } return isSuccess; -} +}; //自动检定和自动核查 查询实验室及温湿度 QList BaseCommonApi::getLocationInfo() { @@ -2602,7 +2595,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //查询出所有实验室地点,用于自动检定/核查 结果保存 地点下拉框查询 QList BaseCommonApi::getLocationInfoList() { @@ -2627,7 +2620,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //查询所有用户,用于自动检定/核查 结果保存 QList BaseCommonApi::getUser() { @@ -2647,7 +2640,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; // 设备与装置-标准装置管理-核查数据基本信息关联的核查标准设备,即给设备做核查的设备 bool BaseCommonApi::InsertStandCheckInfoEquipent(StandCheckInfoEquipent equiment) { @@ -2665,7 +2658,7 @@ } return isSuccess; -} +}; @@ -2722,7 +2715,7 @@ } return isSuccess; -} +}; //根据用户ID查询 当前部门ID和部门名称全程 QList BaseCommonApi::SelectDeptData(QString UserId) { @@ -2742,7 +2735,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //查询出所有委托方 QList BaseCommonApi::SelectCustomerData() { @@ -2760,7 +2753,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //计量检定业务-受检设备检定管理-检定数据管理检定数据历史修改记录[新增] bool BaseCommonApi::InsertModifyRecord(MeasureModifyRecord record) { @@ -2784,7 +2777,7 @@ } return isSuccess; -} +}; //计量检定业务-受检设备检定管理-检定数据管理检定数据历史修改记录[查询] 参数 检定数据管理基础信息表id QList BaseCommonApi::getModifyRecord(QString data_id) { @@ -2809,7 +2802,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //设备与装置-标准装置管理-核查数据管理核查数据历史修改记录 bool BaseCommonApi::InsertCheckModifyRecord(MeasureModifyRecord record) { @@ -2833,7 +2826,7 @@ } return isSuccess; -} +}; //设备与装置-标准装置管理-核查数据管理核查数据历史修改记录[查询] 参数 检定数据管理基础信息表id QList BaseCommonApi::getMeasureModifyRecord(QString data_id) @@ -2859,7 +2852,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //保存log信息 //log文件 @@ -2900,7 +2893,7 @@ << "\t" << utf8Dat << "\n"; file.close(); return true; - } + }; //新增日志表数据 @@ -2926,7 +2919,7 @@ } return isSuccess; -} +}; //根据userid查询日志表数据 QList BaseCommonApi::getzdLogByuserId(QString userid) { @@ -2951,7 +2944,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //新增数据同步表 bool BaseCommonApi::InsertzdDataSync(zdDataSync data) { @@ -2977,7 +2970,7 @@ } return isSuccess; -} +}; //根据userid查询数据同步表 QList BaseCommonApi::getzdDataSyncByuserId(QString log_sync_id) { @@ -3003,10 +2996,10 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; -//检定项0.02活塞式压力计数据(包含字典的字段都存为字典value) +//【查询】检定项0.02活塞式压力计数据(包含字典的字段都存为字典value) QMap> BaseCommonApi::getDeviceMeasureCalibratorPistonGauge(QString itemCatoryName,QString itemId,QMap *headList) { QMap> DataMapList; @@ -3066,7 +3059,7 @@ //进行检定项目列头转换 DataMapList= GetDataReturnItemListByPistonGauge(itemCatoryName,resultData,DataMapList,headList); return DataMapList; -} +}; //检定项 示波器检定装置 QMap> BaseCommonApi::getDeviceOscilloscopeCalibration(QString itemCatoryName,QString itemId,QMap *headList) { @@ -3084,7 +3077,7 @@ if (query.exec()) { while (query.next()) { result.clear(); - result.append(query.value("id").toString()); + result.append(query.value("id").toString()); result.append(query.value("item_id").toString()); //检定项目ID result.append(query.value("time_base").toString());//时基 result.append(query.value("current_gain").toString());//直流增益(示波器-数字) @@ -3114,7 +3107,6 @@ result.append(query.value("signal_frequency").toString());//信号频率 result.append(query.value("nominal_value").toString());//标称值 result.append(query.value("nominal_value_unit").toString());//标称值单位 - result.append(query.value("item_type").toString());//项目 result.append(query.value("create_time").toString()); result.append(query.value("update_time").toString()); resultData.append(result); @@ -3124,205 +3116,45 @@ } - DataMapList=GetDataReturnItemListByOscilloscope(itemCatoryName,resultData,DataMapList,headList); + DataMapList= GetDataReturnItemListByPistonGauge(itemCatoryName,resultData,DataMapList,headList); return DataMapList; -} +}; QMap> BaseCommonApi::GetDataReturnItemListByOscilloscope(QString itemCatoryName,QList ResultData,QMap> DataMapList,QMap *HeadMapList) { - QList time_baseList; - QList Current_gainList; - QList Current_biasList; - QList band_widthList; - QList trigger_sensitivityList; - QList rise_timeList; - QList input_resistanceList; - QList calibrating_signalList; - + QList IndicationErrorList; if(itemCatoryName.contains("数字示波器")){ for(const QStringList &row : ResultData) { QString VerificationItem=NULL; - QStringList head; - QStringList Data; if (!row.isEmpty() && row[2] =="1") { - VerificationItem = "时基"; + VerificationItem = "示值误差"; //添加列头 - head <<"序号"<<"检定项目"<<"参考输出"<<"差拍波形频率测量值(Hz)"<<"时基相对误差△δ"<<"技术指标" - <<"结论"; + QStringList head; + head <<"序号"<<"检定项目"<<"轻敲前示值-正"<<"轻敲前示值-反"<<"轻敲后示值-正" + <<"轻敲后示值-反"<<"轻敲前后变动量-正"<<"轻敲前后变动量-反" ; HeadMapList->insert(VerificationItem,head); //添加数据 - Data.append(row[0]); //ID - Data.append(VerificationItem); //检定项目 - Data.append("缺少");//参考输出 - Data.append("");//差拍波形频率测量值(Hz) - Data.append("");//时基相对误差△δ - Data.append("");//技术指标 - Data.append("");//结论 - time_baseList.append(Data); - } - if (!row.isEmpty() && row[3] =="1") { - VerificationItem = "直流增益"; - //添加列头 - head <<"序号"<<"检定项目"<<"通道"<<"阻抗"<<"垂直偏转系数(/div)"<<"标准值" - <<"测量值"<<"相对误差"<<"技术指标" <<"结论"; - HeadMapList->insert(VerificationItem,head); - //添加数据 - Data.append(row[0]); //ID - Data.append(VerificationItem); //检定项目 - Data.append(row[15]);//通道 - Data.append(row[16]);//阻抗 - Data.append(row[17]);//垂直偏转系数(/div) - Data.append(row[19]);//标准值 - Data.append("");//测量值 - Data.append("");//相对误差 - Data.append(row[13]);//技术指标 - Data.append("");//结论 - Current_gainList.append(Data); - } - if (!row.isEmpty() && row[4] =="1") { - VerificationItem = "直流偏置"; - //添加列头 - head <<"序号"<<"检定项目"<<"通道"<<"阻抗"<<"垂直偏转系数(/div)"<<"标准值" - <<"测量值"<<"误差"<<"相对误差"<<"技术指标" <<"结论"; - HeadMapList->insert(VerificationItem,head); - //添加数据 - Data.append(row[0]); //ID - Data.append(VerificationItem); //检定项目 - Data.append(row[15]);//通道 - Data.append(row[16]);//阻抗 - Data.append(row[17]);//垂直偏转系数(/div) - Data.append(row[19]);//标准值 - Data.append("");//测量值 - Data.append("");//误差 - Data.append("");//相对误差 - Data.append(row[13]);//技术指标 - Data.append("");//结论 - Current_biasList.append(Data); - } - if (!row.isEmpty() && row[5] =="1") { - VerificationItem = "频带宽度"; - //添加列头 - head <<"序号"<<"检定项目"<<"通道"<<"阻抗"<<"垂直偏转系数(/div)" - << "频带宽度" <<"参考幅度" <<"参考幅度单位" <<"测量幅度" <<"测量幅度单位" - <<"分贝数(dB)" <<"技术指标" << "结论"; - HeadMapList->insert(VerificationItem,head); - //添加数据 - Data.append(row[0]); //ID - Data.append(VerificationItem); //检定项目 - Data.append(row[15]);//通道 - Data.append(row[16]);//阻抗 - Data.append(row[17]);//垂直偏转系数(/div) - Data.append(row[22]);//频带宽度 - Data.append("");//参考幅度 - Data.append("");//参考幅度单位 - Data.append("");//测量幅度 - Data.append("");//测量幅度单位 - Data.append("");//分贝数(dB) - Data.append(row[13]);//技术指标 - Data.append("");//结论 - band_widthList.append(Data); - } - if (!row.isEmpty() && row[6] =="1") { - VerificationItem = "触发灵敏度"; - //添加列头 - head <<"序号"<<"检定项目"<<"通道"<<"触发类型"<<"信号频率" - << "标称值" <<"测量值" <<"结论"; - HeadMapList->insert(VerificationItem,head); - //添加数据 - Data.append(row[0]); //ID - Data.append(VerificationItem); //检定项目 - Data.append(row[15]);//通道 - Data.append(row[26]);//触发类型 - Data.append(row[27]);//信号频率 - Data.append(row[28]);//标称值 - Data.append("");//测量值 + QStringList Data; - Data.append("");//结论 - trigger_sensitivityList.append(Data); - } - if (!row.isEmpty() && row[7] =="1") { - VerificationItem = "上升时间"; - //添加列头 - head <<"序号"<<"检定项目"<<"通道"<<"阻抗"<<"垂直偏转系数(/div)" - <<"测量值"<<"测量值单位"<<"技术指标" <<"结论"; - HeadMapList->insert(VerificationItem,head); - //添加数据 Data.append(row[0]); //ID - Data.append(VerificationItem); //检定项目 - Data.append(row[15]);//通道 - Data.append(row[16]);//阻抗 - Data.append(row[17]);//垂直偏转系数(/div) - Data.append("");//测量值 - Data.append("");//测量值单位 - Data.append(row[13]);//技术指标 - Data.append("");//结论 - rise_timeList.append(Data); + Data.append(row[2]); //标准器示值 + + Data.append(row[2]);//轻敲前示值-正 + Data.append(row[2]);//"轻敲前示值-反" + Data.append(row[2]);//轻敲后示值-正 + Data.append(row[2]);//轻敲后示值-反 + Data.append("0");//轻敲前后变动量-正 + Data.append("0");//轻敲前后变动量-反 + IndicationErrorList.append(Data); } - if (!row.isEmpty() && row[8] =="1") { - VerificationItem = "输入电阻"; - //添加列头 - head <<"序号"<<"检定项目"<<"通道"<<"标称值"<<"垂直偏转系数(/div)" - <<"测量值"<<"测量值单位"<<"技术指标" <<"结论"; - HeadMapList->insert(VerificationItem,head); - //添加数据 - Data.append(row[0]); //ID - Data.append(VerificationItem); //检定项目 - Data.append(row[15]);//通道 - Data.append(row[28]+row[29]);//标称值 - Data.append(row[17]);//垂直偏转系数(/div) - Data.append("");//测量值 - Data.append("");//测量值单位 - Data.append(row[13]);//技术指标 - Data.append("");//结论 - input_resistanceList.append(Data); - } - if (!row.isEmpty() && row[9] =="1") { - VerificationItem = "校准信号"; - //添加列头 - head <<"序号"<<"检定项目"<<"项目"<<"标称值"<<"顶部测量值"<<"底部测量值" - <<"测量值"<<"测量值单位"<<"相对误差"; - HeadMapList->insert(VerificationItem,head); - //添加数据 - Data.append(row[0]); //ID - Data.append(VerificationItem); //检定项目 - Data.append(row[30]);//项目 - Data.append(row[28]+row[29]);//标称值 - Data.append("");//顶部测量值 - Data.append("");//底部测量值 - Data.append("");//测量值 - Data.append("");//测量值单位 - Data.append(row[13]);//技术指标 - Data.append("");//相对误差 - calibrating_signalList.append(Data); - } + } } - if(time_baseList.count()!=0){ - DataMapList.insert("时基",time_baseList); - }; - if(Current_gainList.count()!=0){ - DataMapList.insert("直流增益",Current_gainList); - }; - if(Current_biasList.count()!=0){ - DataMapList.insert("直流偏置",Current_biasList); - }; - if(band_widthList.count()!=0){ - DataMapList.insert("频带宽度",band_widthList); - }; - if(trigger_sensitivityList.count()!=0){ - DataMapList.insert("触发灵敏度",trigger_sensitivityList); - }; - if(rise_timeList.count()!=0){ - DataMapList.insert("上升时间",rise_timeList); - }; - if(input_resistanceList.count()!=0){ - DataMapList.insert("输入电阻",input_resistanceList); - }; - if(calibrating_signalList.count()!=0){ - DataMapList.insert("校准信号",calibrating_signalList); + if(IndicationErrorList.count()!=0){ + DataMapList.insert("示值误差",IndicationErrorList); }; return DataMapList; -} +}; QMap> BaseCommonApi::GetDataReturnItemListByPistonGauge(QString itemCatoryName,QList ResultData,QMap> DataMapList,QMap *HeadMapList) { QList IndicationErrorList; @@ -3362,7 +3194,7 @@ DataMapList.insert("示值误差",IndicationErrorList); }; return DataMapList; -} +}; //测试界面 外观及功能性检查和检定数据头 //QMap>> ; @@ -3372,37 +3204,48 @@ bool result = false; // 初始化为 false 或根据需要初始化为其他值 switch (id.toInt()) { case 1: { - //多功能校准源 + //多功能校准源 + SaveDeviceMeasureCalibrator *recordCal = dynamic_cast(object); + if (recordCal != nullptr) { + result = BaseCommonApi::InsertVerMultiCal(*recordCal); // 注意这里使用recordCal而不是recordGauge + } else { + // 处理转换失败的情况 + result = false; + } + break; + } + case 2: { + //直流稳压电源 + bizBusinessDeviceMeasureDataDcPower *dcPower = dynamic_cast(object); + if (dcPower != nullptr) { + result = BaseCommonApi::InsertbizBusinessDeviceMeasureDataDcPower(*dcPower); + } else { + // 处理转换失败的情况 + result = false; + } + break; + } + case 4: { + //0.02压力活塞计 DeviceMeasureDataPistonGauge *recordGauge = dynamic_cast(object); if (recordGauge != nullptr) { result = BaseCommonApi::InsertDeviceMeasureDataPistonGauge(*recordGauge); } else { // 处理转换失败的情况 - result = false; // 或者其他表示失败的值 - } - break; - } - case 4: { - //0.02压力活塞计 - SaveDeviceMeasureCalibrator *recordCal = dynamic_cast(object); - if (recordCal != nullptr) { - result = BaseCommonApi::InsertVerMultiCal(*recordCal); // 注意这里使用recordCal而不是recordGauge - } else { - // 处理转换失败的情况 - result = false; // 或者其他表示失败的值 + result = false; } break; } // 可能还有其他的case default: // 处理未知或未处理的id - result = false; // 或者其他表示失败的值 + result = false; break; } return result; // 返回结果 -} +}; //【结果保存】压力 bool BaseCommonApi::InsertDeviceMeasureDataPistonGauge(DeviceMeasureDataPistonGauge gauge) { @@ -3500,9 +3343,9 @@ } return isSuccess; -} +}; //【查询】 0.02压力结果表数据 -QList getDeviceMeasureDataPistonGauge(QString data_id,QStringList *HeadList) +QList BaseCommonApi::getDeviceMeasureDataPistonGauge(QString data_id,QStringList *HeadList) { QList resultData; QStringList result; @@ -3583,4 +3426,290 @@ <<"零位漂移(数字压力计手工输入的第5个示值)"<<"截距a(结果表)"<<"斜率b(结果表)"<<"灵敏度b(结果表)"<<"重复性ξR(结果表)"<<"迟滞ξH(结果表)" <<"线性ξL(结果表)"<<"基本误差A(结果表)"<<"周期稳定性Sb(结果表)"<<"创建日期"<<"更新日期"; return resultData; -} +}; +//【查询】检定项直流稳压电源 + QMap> BaseCommonApi::getDeviceMeasureItemDataDcPower(QString itemCatoryName,QString itemId,QMap *headList){ + QMap> DataMapList; + QList resultData; + QStringList result; + resultData.clear(); + + QSqlQuery query; + query.prepare( + "SELECT bbdmiddp.*,bbdmii.appearance_function_check,bbdmii.voltage_regulation,bbdmii.load_regulation," + " bbdmii.voltage_represent_error,bbdmii.current_represent_error_direct,bbdmii.current_represent_error_indirect," + " bbdmii.ripple_voltage,bbdmii.voltage_output_stability " + " FROM biz_business_device_measure_item_data_dc_power bbdmiddp " + " JOIN biz_business_device_measure_item_info bbdmii ON bbdmii.id = bbdmiddp.item_id " + " WHERE bbdmiddp.item_id = :itemId " + " ORDER BY bbdmiddp.update_time DESC "); + // 将参数绑定到占位符 + query.bindValue(":itemId", itemId); + if (query.exec()) { + while (query.next()) { + result.clear(); + result.append(query.value("id").toString()); + result.append(query.value("item_id").toString()); //检定项目ID + result.append(query.value("data_type").toString());//检定项数据类型(一个检定项中区分两个表格)(字典code) + result.append(query.value("data_type_type").toString());//检定项数据类型的类型(一个检定项中一个表格切换的类型)(字典code) + result.append(query.value("output_channel").toString());//输出通道 + result.append(query.value("unit").toString());//单位 + result.append(query.value("voltage_regulator_output_value").toString());//调压器输出值 + result.append(query.value("technical_index").toString());//被检电源技术指标/仪器技术指标 + result.append(query.value("technical_index_symbol").toString());//被检电源技术指标/仪器技术指标前符号 + result.append(query.value("load_situation").toString());//负载情况 + result.append(query.value("measure_indication_value").toString());//被检表示值 + result.append(query.value("full_scale_value").toString());//指针式仪表满量程值 + result.append(query.value("standard_resistance_value").toString());//标准电阻值 + result.append(query.value("standard_resistance_value_unit").toString());//标准电阻值单位 + result.append(query.value("error_param_a").toString());//误差参数a + result.append(query.value("accuracy_a").toString());//准确度a + result.append(query.value("error_param_b").toString());//误差参数b + result.append(query.value("maximum_error").toString());//最大允许误差 + result.append(query.value("resolution").toString());//分辨力 + result.append(query.value("appearance_function_check").toString());//外观及功能性检查(1/0) + result.append(query.value("voltage_regulation").toString());//电源电压调整率(1/0)(直流稳压电源) + result.append(query.value("load_regulation").toString());//负载调整率(1/0)(直流稳压电源) + result.append(query.value("voltage_represent_error").toString());//电压表示值误差(1/0)(直流稳压电源) + result.append(query.value("current_represent_error_direct").toString());//电流表示值误差(直接测量)(1/0)(直流稳压电源) + result.append(query.value("current_represent_error_indirect").toString());//电流表示值误差(间接测量)(1/0)(直流稳压电源) + result.append(query.value("ripple_voltage").toString());//纹波电压(1/0)(直流稳压电源) + result.append(query.value("voltage_output_stability").toString());//输出电压短期稳定性(1/0)(直流稳压电源) + result.append(query.value("create_time").toString()); + result.append(query.value("update_time").toString()); + resultData.append(result); + } + } else { + qDebug() << "Query execution failed: " << query.lastError().text(); + } + + + //进行检定项目列头转换 + DataMapList= GetDataReturnItemListByDcPower(itemCatoryName,resultData,DataMapList,headList); + return DataMapList; +}; + +QMap> BaseCommonApi::GetDataReturnItemListByDcPower(QString itemCatoryName,QList ResultData,QMap> DataMapList,QMap *HeadMapList){ + QList VpsAdjustmentRateList; + QList LoadAdjustmentRateList; + QList VoltageIndicationErrorList; + QList CurrentIndicationErrorDirectList; + QList CurrentIndicationErrorIndirectList; + QList RippleVoltageList; + QList ShortTermStabilityVoltageList; + if(itemCatoryName.contains("直流稳压电源")){ + for(const QStringList &row : ResultData) + { + QString VerificationItem=NULL; + if (!row.isEmpty() && row[20]=="1") { + VerificationItem = "电源电压调整率"; + //添加列头 + QStringList head; + head <<"序号"<<"检定项目"<<"输出通道"<<"单位"<<"调压器输出值" + <<"被检电源输出电压值"<<"被检电源输出电压最大差值"<<"被检电源技术指标"<<"电源电压调整率" ; + HeadMapList->insert(VerificationItem,head); + //添加数据 + QStringList Data; + Data.append(row[0]); //ID + Data.append(row[2]); //检定项目 + Data.append(row[4]);//输出通道 + Data.append(row[5]);//单位 + Data.append(row[6]);//调压器输出值 + Data.append("");//被检电源输出电压值 + Data.append("");//被检电源输出电压最大差值 公式 + Data.append(row[8] + row[7]);//被检电源技术指标 + Data.append("");//电源电压调整率 公式 + VpsAdjustmentRateList.append(Data); + }else if(!row.isEmpty() && row[21]=="1"){ + VerificationItem = "负载调整率"; + //添加列头 + QStringList head; + head <<"序号"<<"检定项目"<<"输出通道"<<"单位"<<"负载情况" + <<"被检电源输出电压值"<<"电压差值"<<"被检电源技术指标"<<"负载调整率" ; + HeadMapList->insert(VerificationItem,head); + //添加数据 + QStringList Data; + Data.append(row[0]); //ID + Data.append(row[2]); //检定项目 + Data.append(row[4]);//输出通道 + Data.append(row[5]);//单位 + Data.append(row[9]);//负载情况 + Data.append("");//被检电源输出电压值 + Data.append("");//电压差值 + Data.append(row[8] + row[7]);//被检电源技术指标 + Data.append("");//负载调整率 + LoadAdjustmentRateList.append(Data); + }else if(!row.isEmpty() && row[22]=="1"){ + VerificationItem = "电压示值误差"; + //添加列头 + QStringList head; + head <<"序号"<<"检定项目"<<"输出通道"<<"单位"<<"被检表示值" + <<"标准值"<<"最大允许误差"<<"绝对误差" ; + HeadMapList->insert(VerificationItem,head); + //添加数据 + QStringList Data; + Data.append(row[0]); //ID + Data.append(row[2]); //检定项目 + Data.append(row[4]);//输出通道 + Data.append(row[5]);//单位 + Data.append(row[10]);//被检表示值 + Data.append("");//标准值 + Data.append(row[17]);//最大允许误差 + Data.append("");//绝对误差 + VoltageIndicationErrorList.append(Data); + }else if(!row.isEmpty() && row[23]=="1"){ + VerificationItem = "电流示值误差(直接测量)"; + //添加列头 + QStringList head; + head <<"序号"<<"检定项目"<<"输出通道"<<"单位"<<"被检表示值" + <<"标准值"<<"最大允许误差"<<"绝对误差" ; + HeadMapList->insert(VerificationItem,head); + //添加数据 + QStringList Data; + Data.append(row[0]); //ID + Data.append(row[2]); //检定项目 + Data.append(row[4]);//输出通道 + Data.append(row[5]);//单位 + Data.append(row[10]);//被检表示值 + Data.append("");//标准值 + Data.append(row[17]);//最大允许误差 + Data.append("");//绝对误差 + CurrentIndicationErrorDirectList.append(Data); + }else if(!row.isEmpty() && row[24]=="1"){ + VerificationItem = "电流示值误差(间接测量)"; + //添加列头 + QStringList head; + head <<"序号"<<"检定项目"<<"输出通道"<<"单位"<<"被检表示值" + <<"标准电压值"<<"标准电阻值"<<"标准值"<<"最大允许误差"<<"绝对误差" ; + HeadMapList->insert(VerificationItem,head); + //添加数据 + QStringList Data; + Data.append(row[0]); //ID + Data.append(row[2]); //检定项目 + Data.append(row[4]);//输出通道 + Data.append(row[5]);//单位 + Data.append(row[10]);//被检表示值 + Data.append("");//标准电压值 + Data.append(row[12]);//标准电阻值 + Data.append("");//标准值 + Data.append(row[17]);//最大允许误差 + Data.append("");//绝对误差 + CurrentIndicationErrorIndirectList.append(Data); + }else if(!row.isEmpty() && row[25]=="1"){ + VerificationItem = "纹波电压"; + //添加列头 + QStringList head; + head <<"序号"<<"检定项目"<<"输出通道"<<"单位"<<"被检电源技术指标"<<"纹波电压" ; + HeadMapList->insert(VerificationItem,head); + //添加数据 + QStringList Data; + Data.append(row[0]); //ID + Data.append(row[2]); //检定项目 + Data.append(row[4]);//输出通道 + Data.append(row[5]);//单位 + Data.append(row[8] + row[7]);//被检电源技术指标 + Data.append("");//纹波电压 + RippleVoltageList.append(Data); + }else if(!row.isEmpty() && row[25]=="1"){ + VerificationItem = "输出电压短期稳定性"; + //添加列头 + QStringList head; + head <<"序号"<<"检定项目"<<"输出通道"<<"单位"<<"被测电源输出电压"<<"输出电压最大变化值" + <<"仪器技术指标"<<"短期稳定性"; + HeadMapList->insert(VerificationItem,head); + //添加数据 + QStringList Data; + Data.append(row[0]); //ID + Data.append(row[2]); //检定项目 + Data.append(row[4]);//输出通道 + Data.append(row[5]);//单位 + Data.append("");//被测电源输出电压 + Data.append("");//输出电压最大变化值 + Data.append(row[8] + row[7]);//仪器技术指标 + Data.append("");//短期稳定性 + ShortTermStabilityVoltageList.append(Data); + } + + } + } + if(VpsAdjustmentRateList.count()!=0){ + DataMapList.insert("直流稳压电源",VpsAdjustmentRateList); + }; + if(LoadAdjustmentRateList.count()!=0){ + DataMapList.insert("负载调整率",LoadAdjustmentRateList); + }; + if(VoltageIndicationErrorList.count()!=0){ + DataMapList.insert("电压示值误差",VoltageIndicationErrorList); + }; + if(CurrentIndicationErrorDirectList.count()!=0){ + DataMapList.insert("电流示值误差(直接测量)",CurrentIndicationErrorDirectList); + }; + if(CurrentIndicationErrorIndirectList.count()!=0){ + DataMapList.insert("电流示值误差(间接测量)",CurrentIndicationErrorIndirectList); + }; + if(RippleVoltageList.count()!=0){ + DataMapList.insert("纹波电压",RippleVoltageList); + }; + if(ShortTermStabilityVoltageList.count()!=0){ + DataMapList.insert("输出电压短期稳定性",ShortTermStabilityVoltageList); + }; + return DataMapList; +}; + //【结果保存】直流稳压电源 +bool BaseCommonApi::InsertbizBusinessDeviceMeasureDataDcPower(bizBusinessDeviceMeasureDataDcPower power) +{ + QSqlQuery query; + query.prepare( + "INSERT INTO biz_business_device_measure_data_dc_power " + "(id, data_id, data_type, data_type_type, output_channel, unit, voltage_regulator_output_value, voltage_max_difference, " + "technical_index, technical_index_symbol, voltage_regulation, load_situation, voltage_output_value, voltage_difference, " + "load_regulation, measure_indication_value, standard_value, maximum_error, maximum_error_unit, absolute_error, resolution, " + "standard_voltage_value, standard_voltage_value_unit, standard_resistance_value, standard_resistance_value_unit, ripple_voltage, " + "output_voltage_max_change, short_term_stability, exceed_mark, create_time, update_time) " + "VALUES " + "(:id, :data_id, :data_type, :data_type_type, :output_channel, :unit, :voltage_regulator_output_value, :voltage_max_difference, " + ":technical_index, :technical_index_symbol, :voltage_regulation, :load_situation, :voltage_output_value, :voltage_difference, " + ":load_regulation, :measure_indication_value, :standard_value, :maximum_error, :maximum_error_unit, :absolute_error, :resolution, " + ":standard_voltage_value, :standard_voltage_value_unit, :standard_resistance_value, :standard_resistance_value_unit, :ripple_voltage, " + ":output_voltage_max_change, :short_term_stability, :exceed_mark, :create_time, :update_time)" + ); + QString currentDateTime = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss"); + query.bindValue(":id", power.id); + query.bindValue(":data_id", power.data_id); + query.bindValue(":data_type", power.data_type); + query.bindValue(":data_type_type", power.data_type_type); + query.bindValue(":output_channel", power.output_channel); + query.bindValue(":unit", power.unit); + query.bindValue(":voltage_regulator_output_value", power.voltage_regulator_output_value); + query.bindValue(":voltage_max_difference", power.voltage_max_difference); + query.bindValue(":technical_index", power.technical_index); + query.bindValue(":technical_index_symbol", power.technical_index_symbol); + query.bindValue(":voltage_regulation", power.voltage_regulation); + query.bindValue(":load_situation", power.load_situation); + query.bindValue(":voltage_output_value", power.voltage_output_value); + query.bindValue(":voltage_difference", power.voltage_difference); + query.bindValue(":load_regulation", power.load_regulation); + query.bindValue(":measure_indication_value", power.measure_indication_value); + query.bindValue(":standard_value", power.standard_value); + query.bindValue(":maximum_error", power.maximum_error); + query.bindValue(":maximum_error_unit", power.maximum_error_unit); + query.bindValue(":absolute_error", power.absolute_error); + query.bindValue(":resolution", power.resolution); + query.bindValue(":standard_voltage_value", power.standard_voltage_value); + query.bindValue(":standard_voltage_value_unit", power.standard_voltage_value_unit); + query.bindValue(":standard_resistance_value", power.standard_resistance_value); + query.bindValue(":standard_resistance_value_unit", power.standard_resistance_value_unit); + query.bindValue(":ripple_voltage", power.ripple_voltage); + query.bindValue(":output_voltage_max_change", power.output_voltage_max_change); + query.bindValue(":short_term_stability", power.short_term_stability); + query.bindValue(":exceed_mark", power.exceed_mark); + query.bindValue(":create_time", currentDateTime); + query.bindValue(":update_time", currentDateTime); + bool isSuccess = query.exec(); + if (!isSuccess) { + qDebug() << "Insert data failed: " << query.lastError().text(); + } + + return isSuccess; +}; + diff --git a/softwareDirectory/AutoVerScheme/basecommonapi.cpp b/softwareDirectory/AutoVerScheme/basecommonapi.cpp index bb70bfc..e2da63f 100644 --- a/softwareDirectory/AutoVerScheme/basecommonapi.cpp +++ b/softwareDirectory/AutoVerScheme/basecommonapi.cpp @@ -900,25 +900,23 @@ switch (CliTable[0].belong_standard_equipment.toInt()) { case 1: - //CliTable[0].id - //1717086652508487681 - //根据被检设备的检定项分类去查询 TODO - DataList=BaseCommonApi::getVerMultiCalClass(deviceCatoryName,CliTable[0].id,HeadList); + DataList=BaseCommonApi::getVerMultiCalClass(deviceCatoryName,CliTable[0].id,HeadList); break; - case 4: - DataList=BaseCommonApi::getDeviceMeasureCalibratorPistonGauge(deviceCatoryName,CliTable[0].id,HeadList); - break; - case 13: + case 2: + DataList=BaseCommonApi::getDeviceMeasureItemDataDcPower(deviceCatoryName,CliTable[0].id,HeadList); + break; + case 4: + DataList=BaseCommonApi::getDeviceMeasureCalibratorPistonGauge(deviceCatoryName,CliTable[0].id,HeadList); + break; + case 13: //示波器标准装置 = 13 - DataList=BaseCommonApi::getDeviceOscilloscopeCalibration(deviceCatoryName,CliTable[0].id,HeadList); + //DataList=BaseCommonApi::getDeviceOscilloscopeCalibration(deviceCatoryName,CliTable[0].id,HeadList); break; - default: - break; } return DataList; -} +}; //根据被检设备ID获取当前设备的 检定项目及检定点 测试函数 QList BaseCommonApi::Search_CalibrationTable(QString DeiverId,QStringList *HeadList) { @@ -938,7 +936,7 @@ } return DataList; -} +}; //核查设备对应的装置表 核查项及核查点 传参设备id QList BaseCommonApi::Search_VerifyTable(QString DeiverId,QStringList *HeadList ) { @@ -952,7 +950,7 @@ break; } return DataList; -} +}; //判断检定数据管理 结果信息表 QList BaseCommonApi::Search_CalibrationDataTable(QString DeiverId,QString dataId,QStringList *HeadList) { @@ -966,7 +964,7 @@ break; } return DataList; -} +}; //判断核查数据管理 结果信息表 QList BaseCommonApi::Search_VerifyDataTable(QString DeiverId,QString dataId,QStringList *HeadList) { @@ -981,7 +979,7 @@ break; } return DataList; -} +}; //被检设备管理-检定项目及检定点-多功能校准源 QList BaseCommonApi::getVerMultiCal(QString itemId,QStringList *headList) { @@ -1091,21 +1089,19 @@ QList DCIList; QList ACIList; QList RList; - if(itemCatoryName.contains("数字多用表")){ - for(const QStringList &row : ResultData) - { - QStringList head; - QStringList Data; - QString VerificationItem=NULL; - if (!row.isEmpty()) { // 确保行不为空 - if(row[2]=="DCV") - { - VerificationItem = "DCV"; - //添加列头 - + if(itemCatoryName.contains("数字多用表")){ + for(const QStringList &row : ResultData) + { + QStringList head; + QStringList Data; + QString VerificationItem=NULL; + if (!row.isEmpty()) { // 确保行不为空 + if(row[2]=="DCV") + { + VerificationItem = "DCV"; + //添加列头 head << "序号" << "检定项目" << "量" << "单位" << "量程"<< "标准值" << "示值" << "绝对误差" << "最大允许误差" << "分辨力"; HeadMapList->insert(VerificationItem,head); - //添加数据 Data.append(row[0]); //ID Data.append(row[2]); //检定项目 @@ -1314,13 +1310,11 @@ verificationData.measure_valid_date = query.value("measure_valid_date").toDateTime(); verificationData.meter_identify = query.value("meter_identify").toString(); verificationData.restriction_instruction = query.value("restriction_instruction").toString(); - result.append(verificationData); } } else { qDebug() << "Query execution failed: " << query.lastError().text(); } - return result; } //检定数据管理-检定基本信息-标准设备 参数:首页数据的id @@ -1736,7 +1730,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //新建检定程序 @@ -1770,7 +1764,7 @@ } return isSuccess; -} +}; //新增通讯接口 bool BaseCommonApi::InsertVerificationProgramConfigInterface(VerificationProgramConfigInterface configInterdace) @@ -1793,7 +1787,7 @@ } return isSuccess; -} +}; //更新检定程序 bool BaseCommonApi::UpdateVerificationProgramInfo(VerificationProgramInfo verInfo) @@ -1836,7 +1830,7 @@ qDebug() << "InsertOrderSampleRelation query failed: " << query.lastError().text(); } return isSuccess; -} +}; //更新通讯接口 bool BaseCommonApi::UpdateVerificationProgramConfigInterface(VerificationProgramConfigInterface configInterdace) { @@ -1855,7 +1849,7 @@ qDebug() << "InsertOrderSampleRelation query failed: " << query.lastError().text(); } return isSuccess; -} +}; //删除检定程序 bool BaseCommonApi::DeleteVerificationProgramInfo(QString id) { @@ -1869,7 +1863,7 @@ return false; } return true; -} +}; //查询指令库 参数 检定程序id QList BaseCommonApi::getInstructionLib(QString verification_program_id) @@ -1899,7 +1893,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //查询检定项用于在新增指令时筛选 例如DCV ACI 如果equipment_item_category_id为空查询所有 QList BaseCommonApi::getParams(QString belong_standard_equipment_id,QString equipment_item_category_id) { @@ -1929,7 +1923,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //新增指令库 bool BaseCommonApi::InsertInstructionLib(InstructionLib instructionLib) @@ -1959,7 +1953,7 @@ } return isSuccess; -} +}; //删除指令库 bool BaseCommonApi::DeleteInstructionLib(QString id) { @@ -1971,7 +1965,7 @@ return false; } return true; -} +}; //更新指令库 bool BaseCommonApi::UpdateInstructionLib(InstructionLib instructionLib) { @@ -1998,21 +1992,21 @@ qDebug() << "InsertOrderSampleRelation query failed: " << query.lastError().text(); } return isSuccess; -} +}; //雪花算法生成id qint64 BaseCommonApi::generateId() { return this->idWorker.nextId(); -} +}; QString BaseCommonApi::GenerateTaskNumber() { QList TaskList= BaseCommonApi::getCreateTaskListNew(); return TaskManager::generateTask(TaskList.first().order_no); -} +}; bool BaseCommonApi::AddTaskNumber() { return TaskManager::AddCurrenTaskCount(); -} +}; ////自动检定-根据被检设备 查询检定项分类 QList BaseCommonApi::getDeviceMeasureEquipmentCatory(QString deviceId) { @@ -2052,7 +2046,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; ////自动检定-根据被检设备 查询检定项分类 在查询检定程序 //根据getDeviceMeasureEquipmentCatory返回的item_category_id查询检定程序 QList BaseCommonApi::getVerificationProgramInfoByDeviceId(QString deviceId) @@ -2091,7 +2085,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //自动检定-结果保存-biz_business_device_measure_info 基本信息表 @@ -2189,7 +2183,7 @@ } return isSuccess; -} +}; //计量检定业务-受检设备检定管理-检定数据管理-所使用的标准、主要测量设备 bool BaseCommonApi::InsertDeviceMeasureEquipment(DeviceMeasureEquipment deviceMeasure) { @@ -2211,8 +2205,7 @@ } return isSuccess; -} - +}; //自动检定-结果保存-检定数据管理多功能校准源数据(自动检定输出或业务创建) bool BaseCommonApi::InsertVerMultiCal(SaveDeviceMeasureCalibrator measureCalibrator) { @@ -2262,7 +2255,7 @@ qDebug() << "InsertOrderSampleRelation query failed: " << query.lastError().text(); } return isSuccess; -} +}; // 核查程序管理首页查询 QList BaseCommonApi::getCheckProgramManage() { @@ -2284,7 +2277,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //核查程序管理-编辑查询单个 CheckProgramManage BaseCommonApi::getCheckProgramManageById(QString id) { @@ -2311,7 +2304,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //核查程序管理-编辑查询 选择设备 选择标准 QList BaseCommonApi::getCheckDeviceList() { @@ -2332,7 +2325,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //核查程序管理-编辑查询 选择设备 选择核查件 为标准和被检的并集 QList BaseCommonApi::getCheckAndTestedDeviceList() { @@ -2357,7 +2350,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //核查程序管理-核查设置-多功能校准源 参数设备id 同信息管理-标准设备管理-核查项及核查点 QList BaseCommonApi::getVerificationItemsMultiList(QString equipment_id,QStringList *headList) { @@ -2398,7 +2391,7 @@ *headList <<"id"<<"核查项分类id"<<"配套设备id"<<"核查类型"<<"核查点类型"<<"核查项目"<<"单位"<<"频率"<<"分辨力"<<"核查点" <<"频率单位"<<"循环次数"<<"Urel"<<"通道"<<"TFER"<<"DCCP"<<"FLIT"<<"核查项备注"<<"创建时间"<<"更新时间"; return resultData; -} +}; //新增核查程序 bool BaseCommonApi::InsertCheckProgramManage(CheckProgramManage check) @@ -2425,7 +2418,7 @@ } return isSuccess; -} +}; //更新核查程序 bool BaseCommonApi::UpdateCheckProgramManage(CheckProgramManage check) @@ -2448,7 +2441,7 @@ qDebug() << "InsertOrderSampleRelation query failed: " << query.lastError().text(); } return isSuccess; -} +}; //删除核查程序 bool BaseCommonApi::DeleteCheckProgramManage(QString id) { @@ -2460,7 +2453,7 @@ qDebug() << "InsertOrderSampleRelation query failed: " << query.lastError().text(); } return isSuccess; -} +}; // 自动核查-根据 设备id查询核查件设备信息 CheckAndTestedDevice BaseCommonApi::getCheckAndTestedDeviceById(QString deviceId) { @@ -2487,7 +2480,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //自动核查-结果保存-设备与装置-标准装置管理-核查数据管理0.02级活塞式压力计数据表 bool BaseCommonApi::InsertStandardCheckDatePistonGauge(StandardCheckDatePistonGauge gauge) { @@ -2536,7 +2529,7 @@ return isSuccess; -} +}; //自动核查-结果保存-基本信息 bool BaseCommonApi::InsertCheckDataManageBasicInfo(CheckDataManageBasicInfo baseInfo) { @@ -2572,7 +2565,7 @@ } return isSuccess; -} +}; //自动检定和自动核查 查询实验室及温湿度 QList BaseCommonApi::getLocationInfo() { @@ -2602,7 +2595,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //查询出所有实验室地点,用于自动检定/核查 结果保存 地点下拉框查询 QList BaseCommonApi::getLocationInfoList() { @@ -2627,7 +2620,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //查询所有用户,用于自动检定/核查 结果保存 QList BaseCommonApi::getUser() { @@ -2647,7 +2640,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; // 设备与装置-标准装置管理-核查数据基本信息关联的核查标准设备,即给设备做核查的设备 bool BaseCommonApi::InsertStandCheckInfoEquipent(StandCheckInfoEquipent equiment) { @@ -2665,7 +2658,7 @@ } return isSuccess; -} +}; @@ -2722,7 +2715,7 @@ } return isSuccess; -} +}; //根据用户ID查询 当前部门ID和部门名称全程 QList BaseCommonApi::SelectDeptData(QString UserId) { @@ -2742,7 +2735,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //查询出所有委托方 QList BaseCommonApi::SelectCustomerData() { @@ -2760,7 +2753,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //计量检定业务-受检设备检定管理-检定数据管理检定数据历史修改记录[新增] bool BaseCommonApi::InsertModifyRecord(MeasureModifyRecord record) { @@ -2784,7 +2777,7 @@ } return isSuccess; -} +}; //计量检定业务-受检设备检定管理-检定数据管理检定数据历史修改记录[查询] 参数 检定数据管理基础信息表id QList BaseCommonApi::getModifyRecord(QString data_id) { @@ -2809,7 +2802,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //设备与装置-标准装置管理-核查数据管理核查数据历史修改记录 bool BaseCommonApi::InsertCheckModifyRecord(MeasureModifyRecord record) { @@ -2833,7 +2826,7 @@ } return isSuccess; -} +}; //设备与装置-标准装置管理-核查数据管理核查数据历史修改记录[查询] 参数 检定数据管理基础信息表id QList BaseCommonApi::getMeasureModifyRecord(QString data_id) @@ -2859,7 +2852,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //保存log信息 //log文件 @@ -2900,7 +2893,7 @@ << "\t" << utf8Dat << "\n"; file.close(); return true; - } + }; //新增日志表数据 @@ -2926,7 +2919,7 @@ } return isSuccess; -} +}; //根据userid查询日志表数据 QList BaseCommonApi::getzdLogByuserId(QString userid) { @@ -2951,7 +2944,7 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; //新增数据同步表 bool BaseCommonApi::InsertzdDataSync(zdDataSync data) { @@ -2977,7 +2970,7 @@ } return isSuccess; -} +}; //根据userid查询数据同步表 QList BaseCommonApi::getzdDataSyncByuserId(QString log_sync_id) { @@ -3003,10 +2996,10 @@ qDebug() << "Query execution failed: " << query.lastError().text(); } return result; -} +}; -//检定项0.02活塞式压力计数据(包含字典的字段都存为字典value) +//【查询】检定项0.02活塞式压力计数据(包含字典的字段都存为字典value) QMap> BaseCommonApi::getDeviceMeasureCalibratorPistonGauge(QString itemCatoryName,QString itemId,QMap *headList) { QMap> DataMapList; @@ -3066,7 +3059,7 @@ //进行检定项目列头转换 DataMapList= GetDataReturnItemListByPistonGauge(itemCatoryName,resultData,DataMapList,headList); return DataMapList; -} +}; //检定项 示波器检定装置 QMap> BaseCommonApi::getDeviceOscilloscopeCalibration(QString itemCatoryName,QString itemId,QMap *headList) { @@ -3084,7 +3077,7 @@ if (query.exec()) { while (query.next()) { result.clear(); - result.append(query.value("id").toString()); + result.append(query.value("id").toString()); result.append(query.value("item_id").toString()); //检定项目ID result.append(query.value("time_base").toString());//时基 result.append(query.value("current_gain").toString());//直流增益(示波器-数字) @@ -3114,7 +3107,6 @@ result.append(query.value("signal_frequency").toString());//信号频率 result.append(query.value("nominal_value").toString());//标称值 result.append(query.value("nominal_value_unit").toString());//标称值单位 - result.append(query.value("item_type").toString());//项目 result.append(query.value("create_time").toString()); result.append(query.value("update_time").toString()); resultData.append(result); @@ -3124,205 +3116,45 @@ } - DataMapList=GetDataReturnItemListByOscilloscope(itemCatoryName,resultData,DataMapList,headList); + DataMapList= GetDataReturnItemListByPistonGauge(itemCatoryName,resultData,DataMapList,headList); return DataMapList; -} +}; QMap> BaseCommonApi::GetDataReturnItemListByOscilloscope(QString itemCatoryName,QList ResultData,QMap> DataMapList,QMap *HeadMapList) { - QList time_baseList; - QList Current_gainList; - QList Current_biasList; - QList band_widthList; - QList trigger_sensitivityList; - QList rise_timeList; - QList input_resistanceList; - QList calibrating_signalList; - + QList IndicationErrorList; if(itemCatoryName.contains("数字示波器")){ for(const QStringList &row : ResultData) { QString VerificationItem=NULL; - QStringList head; - QStringList Data; if (!row.isEmpty() && row[2] =="1") { - VerificationItem = "时基"; + VerificationItem = "示值误差"; //添加列头 - head <<"序号"<<"检定项目"<<"参考输出"<<"差拍波形频率测量值(Hz)"<<"时基相对误差△δ"<<"技术指标" - <<"结论"; + QStringList head; + head <<"序号"<<"检定项目"<<"轻敲前示值-正"<<"轻敲前示值-反"<<"轻敲后示值-正" + <<"轻敲后示值-反"<<"轻敲前后变动量-正"<<"轻敲前后变动量-反" ; HeadMapList->insert(VerificationItem,head); //添加数据 - Data.append(row[0]); //ID - Data.append(VerificationItem); //检定项目 - Data.append("缺少");//参考输出 - Data.append("");//差拍波形频率测量值(Hz) - Data.append("");//时基相对误差△δ - Data.append("");//技术指标 - Data.append("");//结论 - time_baseList.append(Data); - } - if (!row.isEmpty() && row[3] =="1") { - VerificationItem = "直流增益"; - //添加列头 - head <<"序号"<<"检定项目"<<"通道"<<"阻抗"<<"垂直偏转系数(/div)"<<"标准值" - <<"测量值"<<"相对误差"<<"技术指标" <<"结论"; - HeadMapList->insert(VerificationItem,head); - //添加数据 - Data.append(row[0]); //ID - Data.append(VerificationItem); //检定项目 - Data.append(row[15]);//通道 - Data.append(row[16]);//阻抗 - Data.append(row[17]);//垂直偏转系数(/div) - Data.append(row[19]);//标准值 - Data.append("");//测量值 - Data.append("");//相对误差 - Data.append(row[13]);//技术指标 - Data.append("");//结论 - Current_gainList.append(Data); - } - if (!row.isEmpty() && row[4] =="1") { - VerificationItem = "直流偏置"; - //添加列头 - head <<"序号"<<"检定项目"<<"通道"<<"阻抗"<<"垂直偏转系数(/div)"<<"标准值" - <<"测量值"<<"误差"<<"相对误差"<<"技术指标" <<"结论"; - HeadMapList->insert(VerificationItem,head); - //添加数据 - Data.append(row[0]); //ID - Data.append(VerificationItem); //检定项目 - Data.append(row[15]);//通道 - Data.append(row[16]);//阻抗 - Data.append(row[17]);//垂直偏转系数(/div) - Data.append(row[19]);//标准值 - Data.append("");//测量值 - Data.append("");//误差 - Data.append("");//相对误差 - Data.append(row[13]);//技术指标 - Data.append("");//结论 - Current_biasList.append(Data); - } - if (!row.isEmpty() && row[5] =="1") { - VerificationItem = "频带宽度"; - //添加列头 - head <<"序号"<<"检定项目"<<"通道"<<"阻抗"<<"垂直偏转系数(/div)" - << "频带宽度" <<"参考幅度" <<"参考幅度单位" <<"测量幅度" <<"测量幅度单位" - <<"分贝数(dB)" <<"技术指标" << "结论"; - HeadMapList->insert(VerificationItem,head); - //添加数据 - Data.append(row[0]); //ID - Data.append(VerificationItem); //检定项目 - Data.append(row[15]);//通道 - Data.append(row[16]);//阻抗 - Data.append(row[17]);//垂直偏转系数(/div) - Data.append(row[22]);//频带宽度 - Data.append("");//参考幅度 - Data.append("");//参考幅度单位 - Data.append("");//测量幅度 - Data.append("");//测量幅度单位 - Data.append("");//分贝数(dB) - Data.append(row[13]);//技术指标 - Data.append("");//结论 - band_widthList.append(Data); - } - if (!row.isEmpty() && row[6] =="1") { - VerificationItem = "触发灵敏度"; - //添加列头 - head <<"序号"<<"检定项目"<<"通道"<<"触发类型"<<"信号频率" - << "标称值" <<"测量值" <<"结论"; - HeadMapList->insert(VerificationItem,head); - //添加数据 - Data.append(row[0]); //ID - Data.append(VerificationItem); //检定项目 - Data.append(row[15]);//通道 - Data.append(row[26]);//触发类型 - Data.append(row[27]);//信号频率 - Data.append(row[28]);//标称值 - Data.append("");//测量值 + QStringList Data; - Data.append("");//结论 - trigger_sensitivityList.append(Data); - } - if (!row.isEmpty() && row[7] =="1") { - VerificationItem = "上升时间"; - //添加列头 - head <<"序号"<<"检定项目"<<"通道"<<"阻抗"<<"垂直偏转系数(/div)" - <<"测量值"<<"测量值单位"<<"技术指标" <<"结论"; - HeadMapList->insert(VerificationItem,head); - //添加数据 Data.append(row[0]); //ID - Data.append(VerificationItem); //检定项目 - Data.append(row[15]);//通道 - Data.append(row[16]);//阻抗 - Data.append(row[17]);//垂直偏转系数(/div) - Data.append("");//测量值 - Data.append("");//测量值单位 - Data.append(row[13]);//技术指标 - Data.append("");//结论 - rise_timeList.append(Data); + Data.append(row[2]); //标准器示值 + + Data.append(row[2]);//轻敲前示值-正 + Data.append(row[2]);//"轻敲前示值-反" + Data.append(row[2]);//轻敲后示值-正 + Data.append(row[2]);//轻敲后示值-反 + Data.append("0");//轻敲前后变动量-正 + Data.append("0");//轻敲前后变动量-反 + IndicationErrorList.append(Data); } - if (!row.isEmpty() && row[8] =="1") { - VerificationItem = "输入电阻"; - //添加列头 - head <<"序号"<<"检定项目"<<"通道"<<"标称值"<<"垂直偏转系数(/div)" - <<"测量值"<<"测量值单位"<<"技术指标" <<"结论"; - HeadMapList->insert(VerificationItem,head); - //添加数据 - Data.append(row[0]); //ID - Data.append(VerificationItem); //检定项目 - Data.append(row[15]);//通道 - Data.append(row[28]+row[29]);//标称值 - Data.append(row[17]);//垂直偏转系数(/div) - Data.append("");//测量值 - Data.append("");//测量值单位 - Data.append(row[13]);//技术指标 - Data.append("");//结论 - input_resistanceList.append(Data); - } - if (!row.isEmpty() && row[9] =="1") { - VerificationItem = "校准信号"; - //添加列头 - head <<"序号"<<"检定项目"<<"项目"<<"标称值"<<"顶部测量值"<<"底部测量值" - <<"测量值"<<"测量值单位"<<"相对误差"; - HeadMapList->insert(VerificationItem,head); - //添加数据 - Data.append(row[0]); //ID - Data.append(VerificationItem); //检定项目 - Data.append(row[30]);//项目 - Data.append(row[28]+row[29]);//标称值 - Data.append("");//顶部测量值 - Data.append("");//底部测量值 - Data.append("");//测量值 - Data.append("");//测量值单位 - Data.append(row[13]);//技术指标 - Data.append("");//相对误差 - calibrating_signalList.append(Data); - } + } } - if(time_baseList.count()!=0){ - DataMapList.insert("时基",time_baseList); - }; - if(Current_gainList.count()!=0){ - DataMapList.insert("直流增益",Current_gainList); - }; - if(Current_biasList.count()!=0){ - DataMapList.insert("直流偏置",Current_biasList); - }; - if(band_widthList.count()!=0){ - DataMapList.insert("频带宽度",band_widthList); - }; - if(trigger_sensitivityList.count()!=0){ - DataMapList.insert("触发灵敏度",trigger_sensitivityList); - }; - if(rise_timeList.count()!=0){ - DataMapList.insert("上升时间",rise_timeList); - }; - if(input_resistanceList.count()!=0){ - DataMapList.insert("输入电阻",input_resistanceList); - }; - if(calibrating_signalList.count()!=0){ - DataMapList.insert("校准信号",calibrating_signalList); + if(IndicationErrorList.count()!=0){ + DataMapList.insert("示值误差",IndicationErrorList); }; return DataMapList; -} +}; QMap> BaseCommonApi::GetDataReturnItemListByPistonGauge(QString itemCatoryName,QList ResultData,QMap> DataMapList,QMap *HeadMapList) { QList IndicationErrorList; @@ -3362,7 +3194,7 @@ DataMapList.insert("示值误差",IndicationErrorList); }; return DataMapList; -} +}; //测试界面 外观及功能性检查和检定数据头 //QMap>> ; @@ -3372,37 +3204,48 @@ bool result = false; // 初始化为 false 或根据需要初始化为其他值 switch (id.toInt()) { case 1: { - //多功能校准源 + //多功能校准源 + SaveDeviceMeasureCalibrator *recordCal = dynamic_cast(object); + if (recordCal != nullptr) { + result = BaseCommonApi::InsertVerMultiCal(*recordCal); // 注意这里使用recordCal而不是recordGauge + } else { + // 处理转换失败的情况 + result = false; + } + break; + } + case 2: { + //直流稳压电源 + bizBusinessDeviceMeasureDataDcPower *dcPower = dynamic_cast(object); + if (dcPower != nullptr) { + result = BaseCommonApi::InsertbizBusinessDeviceMeasureDataDcPower(*dcPower); + } else { + // 处理转换失败的情况 + result = false; + } + break; + } + case 4: { + //0.02压力活塞计 DeviceMeasureDataPistonGauge *recordGauge = dynamic_cast(object); if (recordGauge != nullptr) { result = BaseCommonApi::InsertDeviceMeasureDataPistonGauge(*recordGauge); } else { // 处理转换失败的情况 - result = false; // 或者其他表示失败的值 - } - break; - } - case 4: { - //0.02压力活塞计 - SaveDeviceMeasureCalibrator *recordCal = dynamic_cast(object); - if (recordCal != nullptr) { - result = BaseCommonApi::InsertVerMultiCal(*recordCal); // 注意这里使用recordCal而不是recordGauge - } else { - // 处理转换失败的情况 - result = false; // 或者其他表示失败的值 + result = false; } break; } // 可能还有其他的case default: // 处理未知或未处理的id - result = false; // 或者其他表示失败的值 + result = false; break; } return result; // 返回结果 -} +}; //【结果保存】压力 bool BaseCommonApi::InsertDeviceMeasureDataPistonGauge(DeviceMeasureDataPistonGauge gauge) { @@ -3500,9 +3343,9 @@ } return isSuccess; -} +}; //【查询】 0.02压力结果表数据 -QList getDeviceMeasureDataPistonGauge(QString data_id,QStringList *HeadList) +QList BaseCommonApi::getDeviceMeasureDataPistonGauge(QString data_id,QStringList *HeadList) { QList resultData; QStringList result; @@ -3583,4 +3426,290 @@ <<"零位漂移(数字压力计手工输入的第5个示值)"<<"截距a(结果表)"<<"斜率b(结果表)"<<"灵敏度b(结果表)"<<"重复性ξR(结果表)"<<"迟滞ξH(结果表)" <<"线性ξL(结果表)"<<"基本误差A(结果表)"<<"周期稳定性Sb(结果表)"<<"创建日期"<<"更新日期"; return resultData; -} +}; +//【查询】检定项直流稳压电源 + QMap> BaseCommonApi::getDeviceMeasureItemDataDcPower(QString itemCatoryName,QString itemId,QMap *headList){ + QMap> DataMapList; + QList resultData; + QStringList result; + resultData.clear(); + + QSqlQuery query; + query.prepare( + "SELECT bbdmiddp.*,bbdmii.appearance_function_check,bbdmii.voltage_regulation,bbdmii.load_regulation," + " bbdmii.voltage_represent_error,bbdmii.current_represent_error_direct,bbdmii.current_represent_error_indirect," + " bbdmii.ripple_voltage,bbdmii.voltage_output_stability " + " FROM biz_business_device_measure_item_data_dc_power bbdmiddp " + " JOIN biz_business_device_measure_item_info bbdmii ON bbdmii.id = bbdmiddp.item_id " + " WHERE bbdmiddp.item_id = :itemId " + " ORDER BY bbdmiddp.update_time DESC "); + // 将参数绑定到占位符 + query.bindValue(":itemId", itemId); + if (query.exec()) { + while (query.next()) { + result.clear(); + result.append(query.value("id").toString()); + result.append(query.value("item_id").toString()); //检定项目ID + result.append(query.value("data_type").toString());//检定项数据类型(一个检定项中区分两个表格)(字典code) + result.append(query.value("data_type_type").toString());//检定项数据类型的类型(一个检定项中一个表格切换的类型)(字典code) + result.append(query.value("output_channel").toString());//输出通道 + result.append(query.value("unit").toString());//单位 + result.append(query.value("voltage_regulator_output_value").toString());//调压器输出值 + result.append(query.value("technical_index").toString());//被检电源技术指标/仪器技术指标 + result.append(query.value("technical_index_symbol").toString());//被检电源技术指标/仪器技术指标前符号 + result.append(query.value("load_situation").toString());//负载情况 + result.append(query.value("measure_indication_value").toString());//被检表示值 + result.append(query.value("full_scale_value").toString());//指针式仪表满量程值 + result.append(query.value("standard_resistance_value").toString());//标准电阻值 + result.append(query.value("standard_resistance_value_unit").toString());//标准电阻值单位 + result.append(query.value("error_param_a").toString());//误差参数a + result.append(query.value("accuracy_a").toString());//准确度a + result.append(query.value("error_param_b").toString());//误差参数b + result.append(query.value("maximum_error").toString());//最大允许误差 + result.append(query.value("resolution").toString());//分辨力 + result.append(query.value("appearance_function_check").toString());//外观及功能性检查(1/0) + result.append(query.value("voltage_regulation").toString());//电源电压调整率(1/0)(直流稳压电源) + result.append(query.value("load_regulation").toString());//负载调整率(1/0)(直流稳压电源) + result.append(query.value("voltage_represent_error").toString());//电压表示值误差(1/0)(直流稳压电源) + result.append(query.value("current_represent_error_direct").toString());//电流表示值误差(直接测量)(1/0)(直流稳压电源) + result.append(query.value("current_represent_error_indirect").toString());//电流表示值误差(间接测量)(1/0)(直流稳压电源) + result.append(query.value("ripple_voltage").toString());//纹波电压(1/0)(直流稳压电源) + result.append(query.value("voltage_output_stability").toString());//输出电压短期稳定性(1/0)(直流稳压电源) + result.append(query.value("create_time").toString()); + result.append(query.value("update_time").toString()); + resultData.append(result); + } + } else { + qDebug() << "Query execution failed: " << query.lastError().text(); + } + + + //进行检定项目列头转换 + DataMapList= GetDataReturnItemListByDcPower(itemCatoryName,resultData,DataMapList,headList); + return DataMapList; +}; + +QMap> BaseCommonApi::GetDataReturnItemListByDcPower(QString itemCatoryName,QList ResultData,QMap> DataMapList,QMap *HeadMapList){ + QList VpsAdjustmentRateList; + QList LoadAdjustmentRateList; + QList VoltageIndicationErrorList; + QList CurrentIndicationErrorDirectList; + QList CurrentIndicationErrorIndirectList; + QList RippleVoltageList; + QList ShortTermStabilityVoltageList; + if(itemCatoryName.contains("直流稳压电源")){ + for(const QStringList &row : ResultData) + { + QString VerificationItem=NULL; + if (!row.isEmpty() && row[20]=="1") { + VerificationItem = "电源电压调整率"; + //添加列头 + QStringList head; + head <<"序号"<<"检定项目"<<"输出通道"<<"单位"<<"调压器输出值" + <<"被检电源输出电压值"<<"被检电源输出电压最大差值"<<"被检电源技术指标"<<"电源电压调整率" ; + HeadMapList->insert(VerificationItem,head); + //添加数据 + QStringList Data; + Data.append(row[0]); //ID + Data.append(row[2]); //检定项目 + Data.append(row[4]);//输出通道 + Data.append(row[5]);//单位 + Data.append(row[6]);//调压器输出值 + Data.append("");//被检电源输出电压值 + Data.append("");//被检电源输出电压最大差值 公式 + Data.append(row[8] + row[7]);//被检电源技术指标 + Data.append("");//电源电压调整率 公式 + VpsAdjustmentRateList.append(Data); + }else if(!row.isEmpty() && row[21]=="1"){ + VerificationItem = "负载调整率"; + //添加列头 + QStringList head; + head <<"序号"<<"检定项目"<<"输出通道"<<"单位"<<"负载情况" + <<"被检电源输出电压值"<<"电压差值"<<"被检电源技术指标"<<"负载调整率" ; + HeadMapList->insert(VerificationItem,head); + //添加数据 + QStringList Data; + Data.append(row[0]); //ID + Data.append(row[2]); //检定项目 + Data.append(row[4]);//输出通道 + Data.append(row[5]);//单位 + Data.append(row[9]);//负载情况 + Data.append("");//被检电源输出电压值 + Data.append("");//电压差值 + Data.append(row[8] + row[7]);//被检电源技术指标 + Data.append("");//负载调整率 + LoadAdjustmentRateList.append(Data); + }else if(!row.isEmpty() && row[22]=="1"){ + VerificationItem = "电压示值误差"; + //添加列头 + QStringList head; + head <<"序号"<<"检定项目"<<"输出通道"<<"单位"<<"被检表示值" + <<"标准值"<<"最大允许误差"<<"绝对误差" ; + HeadMapList->insert(VerificationItem,head); + //添加数据 + QStringList Data; + Data.append(row[0]); //ID + Data.append(row[2]); //检定项目 + Data.append(row[4]);//输出通道 + Data.append(row[5]);//单位 + Data.append(row[10]);//被检表示值 + Data.append("");//标准值 + Data.append(row[17]);//最大允许误差 + Data.append("");//绝对误差 + VoltageIndicationErrorList.append(Data); + }else if(!row.isEmpty() && row[23]=="1"){ + VerificationItem = "电流示值误差(直接测量)"; + //添加列头 + QStringList head; + head <<"序号"<<"检定项目"<<"输出通道"<<"单位"<<"被检表示值" + <<"标准值"<<"最大允许误差"<<"绝对误差" ; + HeadMapList->insert(VerificationItem,head); + //添加数据 + QStringList Data; + Data.append(row[0]); //ID + Data.append(row[2]); //检定项目 + Data.append(row[4]);//输出通道 + Data.append(row[5]);//单位 + Data.append(row[10]);//被检表示值 + Data.append("");//标准值 + Data.append(row[17]);//最大允许误差 + Data.append("");//绝对误差 + CurrentIndicationErrorDirectList.append(Data); + }else if(!row.isEmpty() && row[24]=="1"){ + VerificationItem = "电流示值误差(间接测量)"; + //添加列头 + QStringList head; + head <<"序号"<<"检定项目"<<"输出通道"<<"单位"<<"被检表示值" + <<"标准电压值"<<"标准电阻值"<<"标准值"<<"最大允许误差"<<"绝对误差" ; + HeadMapList->insert(VerificationItem,head); + //添加数据 + QStringList Data; + Data.append(row[0]); //ID + Data.append(row[2]); //检定项目 + Data.append(row[4]);//输出通道 + Data.append(row[5]);//单位 + Data.append(row[10]);//被检表示值 + Data.append("");//标准电压值 + Data.append(row[12]);//标准电阻值 + Data.append("");//标准值 + Data.append(row[17]);//最大允许误差 + Data.append("");//绝对误差 + CurrentIndicationErrorIndirectList.append(Data); + }else if(!row.isEmpty() && row[25]=="1"){ + VerificationItem = "纹波电压"; + //添加列头 + QStringList head; + head <<"序号"<<"检定项目"<<"输出通道"<<"单位"<<"被检电源技术指标"<<"纹波电压" ; + HeadMapList->insert(VerificationItem,head); + //添加数据 + QStringList Data; + Data.append(row[0]); //ID + Data.append(row[2]); //检定项目 + Data.append(row[4]);//输出通道 + Data.append(row[5]);//单位 + Data.append(row[8] + row[7]);//被检电源技术指标 + Data.append("");//纹波电压 + RippleVoltageList.append(Data); + }else if(!row.isEmpty() && row[25]=="1"){ + VerificationItem = "输出电压短期稳定性"; + //添加列头 + QStringList head; + head <<"序号"<<"检定项目"<<"输出通道"<<"单位"<<"被测电源输出电压"<<"输出电压最大变化值" + <<"仪器技术指标"<<"短期稳定性"; + HeadMapList->insert(VerificationItem,head); + //添加数据 + QStringList Data; + Data.append(row[0]); //ID + Data.append(row[2]); //检定项目 + Data.append(row[4]);//输出通道 + Data.append(row[5]);//单位 + Data.append("");//被测电源输出电压 + Data.append("");//输出电压最大变化值 + Data.append(row[8] + row[7]);//仪器技术指标 + Data.append("");//短期稳定性 + ShortTermStabilityVoltageList.append(Data); + } + + } + } + if(VpsAdjustmentRateList.count()!=0){ + DataMapList.insert("直流稳压电源",VpsAdjustmentRateList); + }; + if(LoadAdjustmentRateList.count()!=0){ + DataMapList.insert("负载调整率",LoadAdjustmentRateList); + }; + if(VoltageIndicationErrorList.count()!=0){ + DataMapList.insert("电压示值误差",VoltageIndicationErrorList); + }; + if(CurrentIndicationErrorDirectList.count()!=0){ + DataMapList.insert("电流示值误差(直接测量)",CurrentIndicationErrorDirectList); + }; + if(CurrentIndicationErrorIndirectList.count()!=0){ + DataMapList.insert("电流示值误差(间接测量)",CurrentIndicationErrorIndirectList); + }; + if(RippleVoltageList.count()!=0){ + DataMapList.insert("纹波电压",RippleVoltageList); + }; + if(ShortTermStabilityVoltageList.count()!=0){ + DataMapList.insert("输出电压短期稳定性",ShortTermStabilityVoltageList); + }; + return DataMapList; +}; + //【结果保存】直流稳压电源 +bool BaseCommonApi::InsertbizBusinessDeviceMeasureDataDcPower(bizBusinessDeviceMeasureDataDcPower power) +{ + QSqlQuery query; + query.prepare( + "INSERT INTO biz_business_device_measure_data_dc_power " + "(id, data_id, data_type, data_type_type, output_channel, unit, voltage_regulator_output_value, voltage_max_difference, " + "technical_index, technical_index_symbol, voltage_regulation, load_situation, voltage_output_value, voltage_difference, " + "load_regulation, measure_indication_value, standard_value, maximum_error, maximum_error_unit, absolute_error, resolution, " + "standard_voltage_value, standard_voltage_value_unit, standard_resistance_value, standard_resistance_value_unit, ripple_voltage, " + "output_voltage_max_change, short_term_stability, exceed_mark, create_time, update_time) " + "VALUES " + "(:id, :data_id, :data_type, :data_type_type, :output_channel, :unit, :voltage_regulator_output_value, :voltage_max_difference, " + ":technical_index, :technical_index_symbol, :voltage_regulation, :load_situation, :voltage_output_value, :voltage_difference, " + ":load_regulation, :measure_indication_value, :standard_value, :maximum_error, :maximum_error_unit, :absolute_error, :resolution, " + ":standard_voltage_value, :standard_voltage_value_unit, :standard_resistance_value, :standard_resistance_value_unit, :ripple_voltage, " + ":output_voltage_max_change, :short_term_stability, :exceed_mark, :create_time, :update_time)" + ); + QString currentDateTime = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss"); + query.bindValue(":id", power.id); + query.bindValue(":data_id", power.data_id); + query.bindValue(":data_type", power.data_type); + query.bindValue(":data_type_type", power.data_type_type); + query.bindValue(":output_channel", power.output_channel); + query.bindValue(":unit", power.unit); + query.bindValue(":voltage_regulator_output_value", power.voltage_regulator_output_value); + query.bindValue(":voltage_max_difference", power.voltage_max_difference); + query.bindValue(":technical_index", power.technical_index); + query.bindValue(":technical_index_symbol", power.technical_index_symbol); + query.bindValue(":voltage_regulation", power.voltage_regulation); + query.bindValue(":load_situation", power.load_situation); + query.bindValue(":voltage_output_value", power.voltage_output_value); + query.bindValue(":voltage_difference", power.voltage_difference); + query.bindValue(":load_regulation", power.load_regulation); + query.bindValue(":measure_indication_value", power.measure_indication_value); + query.bindValue(":standard_value", power.standard_value); + query.bindValue(":maximum_error", power.maximum_error); + query.bindValue(":maximum_error_unit", power.maximum_error_unit); + query.bindValue(":absolute_error", power.absolute_error); + query.bindValue(":resolution", power.resolution); + query.bindValue(":standard_voltage_value", power.standard_voltage_value); + query.bindValue(":standard_voltage_value_unit", power.standard_voltage_value_unit); + query.bindValue(":standard_resistance_value", power.standard_resistance_value); + query.bindValue(":standard_resistance_value_unit", power.standard_resistance_value_unit); + query.bindValue(":ripple_voltage", power.ripple_voltage); + query.bindValue(":output_voltage_max_change", power.output_voltage_max_change); + query.bindValue(":short_term_stability", power.short_term_stability); + query.bindValue(":exceed_mark", power.exceed_mark); + query.bindValue(":create_time", currentDateTime); + query.bindValue(":update_time", currentDateTime); + bool isSuccess = query.exec(); + if (!isSuccess) { + qDebug() << "Insert data failed: " << query.lastError().text(); + } + + return isSuccess; +}; + diff --git a/softwareDirectory/AutoVerScheme/basecommonapi.h b/softwareDirectory/AutoVerScheme/basecommonapi.h index fad47ba..6c92e0b 100644 --- a/softwareDirectory/AutoVerScheme/basecommonapi.h +++ b/softwareDirectory/AutoVerScheme/basecommonapi.h @@ -997,6 +997,69 @@ QDateTime create_time; QDateTime update_time; }; +//检定项-直流稳压电源 +class DeviceMeasureItemDataDcPower +{ +public: + QString id; + QString item_id;//检定项id + QString data_type;//检定项数据类型(一个检定项中区分两个表格)(字典code) + QString data_type_type;//检定项数据类型的类型(一个检定项中一个表格切换的类型)(字典code) + QString output_channel;//输出通道 + QString unit;//单位 + QString voltage_regulator_output_value;//调压器输出值 + QString technical_index;//被检电源技术指标/仪器技术指标 + QString technical_index_symbol;//被检电源技术指标/仪器技术指标前符号 + QString load_situation;//负载情况 + QString measure_indication_value;//被检表示值 + QString full_scale_value;//指针式仪表满量程值 + QString standard_resistance_value;//标准电阻值 + QString standard_resistance_value_unit;//标准电阻值单位 + QString error_param_a;//误差参数a + QString accuracy_a;//准确度a + QString error_param_b;//误差参数b + QString maximum_error;//最大允许误差 + QString resolution;//分辨力 + QDateTime create_time; + QDateTime update_time; +}; +//结果保存-直流稳压电源 +class bizBusinessDeviceMeasureDataDcPower:public BaseClass +{ +public: + QString id; + QString data_id;//检定数据管理基础信息表id + QString data_type;//检定数据类型(一个检定数据中区分多个表格)(字典code) + QString data_type_type;//检定项数据类型的类型(一个检定项中一个表格切换的类型)(字典value) + QString output_channel;//输出通道 + QString unit;//单位 + QString voltage_regulator_output_value;//调压器输出值 + QString voltage_max_difference;//被检电源输出电压最大差值 + QString technical_index;//被检电源技术指标/仪器技术指标 + QString technical_index_symbol;//被检电源技术指标/仪器技术指标前符号 + QString voltage_regulation;//电源电压调整率 + QString load_situation;//负载情况 + QString voltage_output_value;//被检电源输出电压值 + QString voltage_difference;//电压差值 + QString load_regulation;//负载调整率 + QString measure_indication_value;//被检表示值 + QString standard_value;//标准值 + QString maximum_error;//最大允许误差 + QString maximum_error_unit;//最大允许误差单位 + QString absolute_error;//绝对误差 + QString resolution;//分辨力 + QString standard_voltage_value;//标准电压值 + QString standard_voltage_value_unit;//标准电压值单位 + QString standard_resistance_value;//标准电阻值 + QString standard_resistance_value_unit;//标准电阻值单位 + QString ripple_voltage;//纹波电压 + QString output_voltage_max_change;//输出电压最大变化值 + QString short_term_stability;//短期稳定性 + QString exceed_mark;//超出范围标*(1/0) + QString create_time; + QString update_time; +}; + enum class SyncRunStatus { Running, Stopped, @@ -1216,17 +1279,25 @@ //根据log_sync_id查询数据同步表 static QList getzdDataSyncByuserId(QString log_sync_id); + static bool SearchSelectTable(QString id, BaseClass *object); //【查询】检定项0.02活塞式压力计数据(包含字典的字段都存为字典value) // static QList getDeviceMeasureCalibratorPistonGauge(QString itemId,QStringList *headList); static QMap> getDeviceMeasureCalibratorPistonGauge(QString itemCatoryName,QString itemId,QMap *headList); static QMap> GetDataReturnItemListByPistonGauge(QString itemCatoryName,QList ResultData,QMap> DataMapList,QMap *HeadMapList); - static bool SearchSelectTable(QString id, BaseClass *object); //【结果保存】压力 static bool InsertDeviceMeasureDataPistonGauge(DeviceMeasureDataPistonGauge gauge); +// 【查询】直流稳压电源 + static QMap> getDeviceMeasureItemDataDcPower(QString itemCatoryName,QString itemId,QMap *headList); + static QMap> GetDataReturnItemListByDcPower(QString itemCatoryName,QList ResultData,QMap> DataMapList,QMap *HeadMapList); + //【结果保存】直流稳压电源 + static bool InsertbizBusinessDeviceMeasureDataDcPower(bizBusinessDeviceMeasureDataDcPower power); + + //示波器 static QMap> getDeviceOscilloscopeCalibration(QString itemCatoryName,QString itemId,QMap *headList); - static QMap> GetDataReturnItemListByOscilloscope(QString itemCatoryName,QList ResultData,QMap> DataMapList,QMap *HeadMapList); + QMap> GetDataReturnItemListByOscilloscope(QString itemCatoryName,QList ResultData,QMap> DataMapList,QMap *HeadMapList); }; + #endif // BASECOMMONAPI_H