Compare commits

...

2 Commits

Author SHA1 Message Date
lh 011976390e fix(nmNum): 保留包含井三相全关时的流量配置
- 三相全部关闭时保留有效 Flow Gauge Code 和流动段索引
- 最后一相切换为“无”时不再清空流量记录选择
- 仅在流量记录无效或不可选择时清空相关配置
- 保持不可计算井自动取消包含的现有行为
2 days ago
lh 3e87db437e fix(nmNum): 修正重复 Gauge Code 身份校验
- 分别统计压力和流量记录中的 Gauge Code
- 将空 Code 和同井全部重复 Code 记录标记为身份无效
- 避免重复记录被默认选中后导致数值成果保存失败
2 days ago

@ -16,6 +16,7 @@
#include "ZxDataWell.h"
#include "ZxBaseUtil.h"
#include <QHash>
#include <QSet>
#include <QThread>
#include <QVariant>
@ -375,10 +376,10 @@ bool nmDataAnalyzeManager::readFrameworkWellCurves(
return false;
}
// 第一步:枚举全部压力记录,不再只取第一条
// 第一步:读取全部压力记录并统计非空 Code不在读取顺序中决定身份有效性
const ZxDataObjectList listGaugeP =
pWellData->getChildren(iDataModelType::sTypeDataGaugeP);
QSet<QString> setSeenPressureCodes;
QHash<QString, int> mapPressureCodeCounts;
for(int nIndex = 0; nIndex < listGaugeP.size(); ++nIndex) {
ZxDataGaugeP* pGaugeP = dynamic_cast<ZxDataGaugeP*>(listGaugeP[nIndex]);
if(pGaugeP == nullptr) {
@ -391,21 +392,26 @@ bool nmDataAnalyzeManager::readFrameworkWellCurves(
oRecord.sGaugeTime = pGaugeP->getGaugeTime();
oRecord.eStatus = readBlockAndClassify(
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() ||
setSeenPressureCodes.contains(oRecord.sGaugeCode)) {
mapPressureCodeCounts.value(oRecord.sGaugeCode) > 1) {
oRecord.eStatus = NM_GaugeRecord_InvalidIdentity;
} else {
setSeenPressureCodes.insert(oRecord.sGaugeCode);
}
vecPressureRecords.append(oRecord);
}
// 第二步:枚举全部流量记录,不再只取第一条
// 第三步:读取全部流量记录并统计非空 Code
const ZxDataObjectList listGaugeF =
pWellData->getChildren(iDataModelType::sTypeDataGaugeF);
QSet<QString> setSeenFlowCodes;
QHash<QString, int> mapFlowCodeCounts;
for(int nIndex = 0; nIndex < listGaugeF.size(); ++nIndex) {
ZxDataGaugeF* pGaugeF = dynamic_cast<ZxDataGaugeF*>(listGaugeF[nIndex]);
if(pGaugeF == nullptr) {
@ -427,15 +433,20 @@ bool nmDataAnalyzeManager::readFrameworkWellCurves(
pGaugeF, eWellCategory,
oRecord.vecOilPoints,
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() ||
setSeenFlowCodes.contains(oRecord.sGaugeCode)) {
mapFlowCodeCounts.value(oRecord.sGaugeCode) > 1) {
oRecord.eStatus = NM_GaugeRecord_InvalidIdentity;
} else {
setSeenFlowCodes.insert(oRecord.sGaugeCode);
}
vecFlowRecords.append(oRecord);
}
return true;

@ -576,8 +576,7 @@ void nmWxIncludeOtherWells::normalizeFlowSelection(WellDataRow& data) const
{
const nmFlowGaugeRecord* pRecord = findFlowRecord(
data.m_vecFlowRecords, data.m_sFlowGaugeCode);
if(pRecord == nullptr ||
pRecord->eStatus != NM_GaugeRecord_Usable) {
if(pRecord == nullptr || !nmIsSelectableFlowRecord(*pRecord)) {
data.m_sFlowGaugeCode.clear();
data.m_bUseOilRate = false;
data.m_bUseGasRate = false;
@ -592,12 +591,6 @@ void nmWxIncludeOtherWells::normalizeFlowSelection(WellDataRow& data) const
isSelectableFlowPhase(*pRecord, PHASE_Gas);
data.m_bUseWaterRate = data.m_bUseWaterRate &&
isSelectableFlowPhase(*pRecord, PHASE_Water);
if(!data.m_bUseOilRate && !data.m_bUseGasRate &&
!data.m_bUseWaterRate) {
data.m_sFlowGaugeCode.clear();
data.m_nFlowSegmentIndex = 0;
return;
}
const int nSegmentCount = flowRecordSegmentCount(*pRecord);
if(nSegmentCount <= 0) {
@ -819,10 +812,6 @@ void nmWxIncludeOtherWells::onRateSourceChanged(int nIndex)
const QString sGaugeCode = pComboBox->itemData(nIndex).toString();
if(sGaugeCode.isEmpty()) {
setRowPhaseUsed(oData, ePhase, false);
if(!oData.m_bUseOilRate && !oData.m_bUseGasRate &&
!oData.m_bUseWaterRate) {
switchRowFlowGaugeCode(oData, QString());
}
} else {
const nmFlowGaugeRecord* pRecord = findFlowRecord(
oData.m_vecFlowRecords, sGaugeCode);

Loading…
Cancel
Save