fix(nmNum): 修正重复 Gauge Code 身份校验

- 分别统计压力和流量记录中的 Gauge Code
- 将空 Code 和同井全部重复 Code 记录标记为身份无效
- 避免重复记录被默认选中后导致数值成果保存失败
feature/nmNum-multi-gauge-record
lh 2 days ago
parent 5d3012abb7
commit 3e87db437e

@ -16,6 +16,7 @@
#include "ZxDataWell.h" #include "ZxDataWell.h"
#include "ZxBaseUtil.h" #include "ZxBaseUtil.h"
#include <QHash>
#include <QSet> #include <QSet>
#include <QThread> #include <QThread>
#include <QVariant> #include <QVariant>
@ -375,10 +376,10 @@ bool nmDataAnalyzeManager::readFrameworkWellCurves(
return false; return false;
} }
// 第一步:枚举全部压力记录,不再只取第一条 // 第一步:读取全部压力记录并统计非空 Code不在读取顺序中决定身份有效性
const ZxDataObjectList listGaugeP = const ZxDataObjectList listGaugeP =
pWellData->getChildren(iDataModelType::sTypeDataGaugeP); pWellData->getChildren(iDataModelType::sTypeDataGaugeP);
QSet<QString> setSeenPressureCodes; QHash<QString, int> mapPressureCodeCounts;
for(int nIndex = 0; nIndex < listGaugeP.size(); ++nIndex) { for(int nIndex = 0; nIndex < listGaugeP.size(); ++nIndex) {
ZxDataGaugeP* pGaugeP = dynamic_cast<ZxDataGaugeP*>(listGaugeP[nIndex]); ZxDataGaugeP* pGaugeP = dynamic_cast<ZxDataGaugeP*>(listGaugeP[nIndex]);
if(pGaugeP == nullptr) { if(pGaugeP == nullptr) {
@ -391,21 +392,26 @@ bool nmDataAnalyzeManager::readFrameworkWellCurves(
oRecord.sGaugeTime = pGaugeP->getGaugeTime(); oRecord.sGaugeTime = pGaugeP->getGaugeTime();
oRecord.eStatus = readBlockAndClassify( oRecord.eStatus = readBlockAndClassify(
pGaugeP->getGaugeData(), oRecord.vecPressurePoints); pGaugeP->getGaugeData(), oRecord.vecPressurePoints);
if(!oRecord.sGaugeCode.isEmpty()) {
mapPressureCodeCounts.insert(oRecord.sGaugeCode,
mapPressureCodeCounts.value(oRecord.sGaugeCode) + 1);
}
vecPressureRecords.append(oRecord);
}
// 空 Code 或同井重复 Code 属于身份问题,覆盖内容判定结果。 // 第二步:空 Code 或重复 Code 的全部压力记录都属于身份无效。
for(int nIndex = 0; nIndex < vecPressureRecords.size(); ++nIndex) {
nmPressureGaugeRecord& oRecord = vecPressureRecords[nIndex];
if(oRecord.sGaugeCode.isEmpty() || if(oRecord.sGaugeCode.isEmpty() ||
setSeenPressureCodes.contains(oRecord.sGaugeCode)) { mapPressureCodeCounts.value(oRecord.sGaugeCode) > 1) {
oRecord.eStatus = NM_GaugeRecord_InvalidIdentity; oRecord.eStatus = NM_GaugeRecord_InvalidIdentity;
} else {
setSeenPressureCodes.insert(oRecord.sGaugeCode);
} }
vecPressureRecords.append(oRecord);
} }
// 第二步:枚举全部流量记录,不再只取第一条 // 第三步:读取全部流量记录并统计非空 Code
const ZxDataObjectList listGaugeF = const ZxDataObjectList listGaugeF =
pWellData->getChildren(iDataModelType::sTypeDataGaugeF); pWellData->getChildren(iDataModelType::sTypeDataGaugeF);
QSet<QString> setSeenFlowCodes; QHash<QString, int> mapFlowCodeCounts;
for(int nIndex = 0; nIndex < listGaugeF.size(); ++nIndex) { for(int nIndex = 0; nIndex < listGaugeF.size(); ++nIndex) {
ZxDataGaugeF* pGaugeF = dynamic_cast<ZxDataGaugeF*>(listGaugeF[nIndex]); ZxDataGaugeF* pGaugeF = dynamic_cast<ZxDataGaugeF*>(listGaugeF[nIndex]);
if(pGaugeF == nullptr) { if(pGaugeF == nullptr) {
@ -427,15 +433,20 @@ bool nmDataAnalyzeManager::readFrameworkWellCurves(
pGaugeF, eWellCategory, pGaugeF, eWellCategory,
oRecord.vecOilPoints, oRecord.vecOilPoints,
oRecord.vecGasPoints, oRecord.vecWaterPoints); oRecord.vecGasPoints, oRecord.vecWaterPoints);
if(!oRecord.sGaugeCode.isEmpty()) {
mapFlowCodeCounts.insert(oRecord.sGaugeCode,
mapFlowCodeCounts.value(oRecord.sGaugeCode) + 1);
}
vecFlowRecords.append(oRecord);
}
// 空 Code 或同井重复 Code 属于身份问题,覆盖内容判定结果。 // 第四步:空 Code 或重复 Code 的全部流量记录都属于身份无效。
for(int nIndex = 0; nIndex < vecFlowRecords.size(); ++nIndex) {
nmFlowGaugeRecord& oRecord = vecFlowRecords[nIndex];
if(oRecord.sGaugeCode.isEmpty() || if(oRecord.sGaugeCode.isEmpty() ||
setSeenFlowCodes.contains(oRecord.sGaugeCode)) { mapFlowCodeCounts.value(oRecord.sGaugeCode) > 1) {
oRecord.eStatus = NM_GaugeRecord_InvalidIdentity; oRecord.eStatus = NM_GaugeRecord_InvalidIdentity;
} else {
setSeenFlowCodes.insert(oRecord.sGaugeCode);
} }
vecFlowRecords.append(oRecord);
} }
return true; return true;

Loading…
Cancel
Save