|
|
|
@ -95,6 +95,21 @@ const nmFlowGaugeRecord* findFlowRecord(
|
|
|
|
return nullptr;
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nmFlowGaugeRecord* findMutableFlowRecord(
|
|
|
|
|
|
|
|
QVector<nmFlowGaugeRecord>& vecRecords,
|
|
|
|
|
|
|
|
const QString& sGaugeCode)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(sGaugeCode.isEmpty()) {
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for(int nIndex = 0; nIndex < vecRecords.size(); ++nIndex) {
|
|
|
|
|
|
|
|
if(vecRecords[nIndex].sGaugeCode == sGaugeCode) {
|
|
|
|
|
|
|
|
return &vecRecords[nIndex];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 压力曲线至少需要两个点才能用于历史曲线计算。
|
|
|
|
// 压力曲线至少需要两个点才能用于历史曲线计算。
|
|
|
|
bool isSelectablePressureRecord(const nmPressureGaugeRecord& oRecord)
|
|
|
|
bool isSelectablePressureRecord(const nmPressureGaugeRecord& oRecord)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -623,6 +638,38 @@ void nmWxIncludeOtherWells::normalizeFlowSelection(WellDataRow& data) const
|
|
|
|
data.m_nFlowSegmentIndex = nSegmentCount;
|
|
|
|
data.m_nFlowSegmentIndex = nSegmentCount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nmFlowGaugeRecord* pMutableRecord = findMutableFlowRecord(
|
|
|
|
|
|
|
|
data.m_vecFlowRecords, data.m_sFlowGaugeCode);
|
|
|
|
|
|
|
|
if(pMutableRecord != nullptr) {
|
|
|
|
|
|
|
|
pMutableRecord->nIndexF = data.m_nFlowSegmentIndex;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void nmWxIncludeOtherWells::switchRowFlowGaugeCode(
|
|
|
|
|
|
|
|
WellDataRow& data, const QString& sGaugeCode) const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// 行数据是对话框工作副本,切换前先保存当前记录自己的流动段。
|
|
|
|
|
|
|
|
nmFlowGaugeRecord* pOldRecord = findMutableFlowRecord(
|
|
|
|
|
|
|
|
data.m_vecFlowRecords, data.m_sFlowGaugeCode);
|
|
|
|
|
|
|
|
if(pOldRecord != nullptr) {
|
|
|
|
|
|
|
|
pOldRecord->nIndexF = data.m_nFlowSegmentIndex;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data.m_sFlowGaugeCode = sGaugeCode;
|
|
|
|
|
|
|
|
nmFlowGaugeRecord* pNewRecord = findMutableFlowRecord(
|
|
|
|
|
|
|
|
data.m_vecFlowRecords, data.m_sFlowGaugeCode);
|
|
|
|
|
|
|
|
if(pNewRecord == nullptr ||
|
|
|
|
|
|
|
|
pNewRecord->eStatus != NM_GaugeRecord_Usable) {
|
|
|
|
|
|
|
|
data.m_nFlowSegmentIndex = 0;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const int nSegmentCount = flowRecordSegmentCount(*pNewRecord);
|
|
|
|
|
|
|
|
data.m_nFlowSegmentIndex = pNewRecord->nIndexF;
|
|
|
|
|
|
|
|
if(data.m_nFlowSegmentIndex < 1 ||
|
|
|
|
|
|
|
|
data.m_nFlowSegmentIndex > nSegmentCount) {
|
|
|
|
|
|
|
|
data.m_nFlowSegmentIndex = nSegmentCount;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void nmWxIncludeOtherWells::populateRateCombo(
|
|
|
|
void nmWxIncludeOtherWells::populateRateCombo(
|
|
|
|
@ -794,6 +841,10 @@ void nmWxIncludeOtherWells::onRateSourceChanged(int nIndex)
|
|
|
|
const QString sGaugeCode = pComboBox->itemData(nIndex).toString();
|
|
|
|
const QString sGaugeCode = pComboBox->itemData(nIndex).toString();
|
|
|
|
if(sGaugeCode.isEmpty()) {
|
|
|
|
if(sGaugeCode.isEmpty()) {
|
|
|
|
setRowPhaseUsed(oData, ePhase, false);
|
|
|
|
setRowPhaseUsed(oData, ePhase, false);
|
|
|
|
|
|
|
|
if(!oData.m_bUseOilRate && !oData.m_bUseGasRate &&
|
|
|
|
|
|
|
|
!oData.m_bUseWaterRate) {
|
|
|
|
|
|
|
|
switchRowFlowGaugeCode(oData, QString());
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
const nmFlowGaugeRecord* pRecord = findFlowRecord(
|
|
|
|
const nmFlowGaugeRecord* pRecord = findFlowRecord(
|
|
|
|
oData.m_vecFlowRecords, sGaugeCode);
|
|
|
|
oData.m_vecFlowRecords, sGaugeCode);
|
|
|
|
@ -802,8 +853,7 @@ void nmWxIncludeOtherWells::onRateSourceChanged(int nIndex)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(oData.m_sFlowGaugeCode != sGaugeCode) {
|
|
|
|
if(oData.m_sFlowGaugeCode != sGaugeCode) {
|
|
|
|
oData.m_sFlowGaugeCode = sGaugeCode;
|
|
|
|
switchRowFlowGaugeCode(oData, sGaugeCode);
|
|
|
|
oData.m_nFlowSegmentIndex = pRecord->nIndexF;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setRowPhaseUsed(oData, ePhase, true);
|
|
|
|
setRowPhaseUsed(oData, ePhase, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -839,8 +889,13 @@ void nmWxIncludeOtherWells::onFlowSegmentChanged(int nIndex)
|
|
|
|
if(nRow < 0 || nRow >= m_vecWellData.size()) {
|
|
|
|
if(nRow < 0 || nRow >= m_vecWellData.size()) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_vecWellData[nRow].m_nFlowSegmentIndex =
|
|
|
|
WellDataRow& oData = m_vecWellData[nRow];
|
|
|
|
pComboBox->itemData(nIndex).toInt();
|
|
|
|
oData.m_nFlowSegmentIndex = pComboBox->itemData(nIndex).toInt();
|
|
|
|
|
|
|
|
nmFlowGaugeRecord* pRecord = findMutableFlowRecord(
|
|
|
|
|
|
|
|
oData.m_vecFlowRecords, oData.m_sFlowGaugeCode);
|
|
|
|
|
|
|
|
if(pRecord != nullptr) {
|
|
|
|
|
|
|
|
pRecord->nIndexF = oData.m_nFlowSegmentIndex;
|
|
|
|
|
|
|
|
}
|
|
|
|
pComboBox->setToolTip(pComboBox->currentText());
|
|
|
|
pComboBox->setToolTip(pComboBox->currentText());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|