2025-10-29 17:23:30 +08:00
|
|
|
|
#include "ui_importdataDialog.h"
|
|
|
|
|
|
#include "ImportdataDialog.h"
|
|
|
|
|
|
#include "InterIConvertor.h"
|
|
|
|
|
|
#include "IConvertor.h"
|
|
|
|
|
|
//#include "ObjWelllogRound.h"
|
|
|
|
|
|
#include <QLineEdit>
|
2026-03-27 21:26:43 +08:00
|
|
|
|
#include <qDebug>
|
2025-10-29 17:23:30 +08:00
|
|
|
|
//#include "DataImport.h"
|
|
|
|
|
|
#include "CStringType.h"
|
|
|
|
|
|
#include "MyWelllogRound.h"
|
|
|
|
|
|
#include "tishidialog.h"
|
|
|
|
|
|
#include "ui_interfaceWidget.h"
|
|
|
|
|
|
//#include "ObjectEvent.h"
|
2026-03-27 21:26:43 +08:00
|
|
|
|
#include "ObjWell.h"
|
2025-10-29 17:23:30 +08:00
|
|
|
|
#include "MemRdWt.h"
|
|
|
|
|
|
BEGIN_OSGGRAPHICS_NAMESPACE;
|
|
|
|
|
|
ImportDataDialog::ImportDataDialog(QWidget *parent,QString wellname,QString wellroundname): QDialog(parent),m_FilePath(""),m_ExistSameWellName(false),m_ExistSameWellRoundName(false)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_CurrentWellName=wellname;
|
|
|
|
|
|
m_CurrentWellRoundName=wellroundname;
|
|
|
|
|
|
m_pImportDataUI=new Ui::ImportData();
|
|
|
|
|
|
m_pImportDataUI->setupUi(this);
|
|
|
|
|
|
m_pImportDataUI->tabWidget->removeTab(1);
|
|
|
|
|
|
m_pImportDataUI->tabWidget->removeTab(0);
|
|
|
|
|
|
connect(m_pImportDataUI->pushButton_2, SIGNAL(clicked()), this, SLOT(AcceptOK()));
|
|
|
|
|
|
connect(m_pImportDataUI->pushButton, SIGNAL(clicked()), this, SLOT(reject()));
|
|
|
|
|
|
//whp add 2019.10.12
|
|
|
|
|
|
connect(m_pImportDataUI->pushButton_3, SIGNAL(clicked()), this, SLOT(SelAll()));
|
|
|
|
|
|
connect(m_pImportDataUI->pushButton_4, SIGNAL(clicked()), this, SLOT(NotSelAll()));
|
|
|
|
|
|
connect(m_pImportDataUI->pushButton_5, SIGNAL(clicked()), this, SLOT(ReverseSel()));
|
|
|
|
|
|
setAttribute( Qt::WA_DeleteOnClose ,true );
|
|
|
|
|
|
setWindowTitle("Import Well-Logging-Data");
|
|
|
|
|
|
m_pImportDataUI->pushButton_2->setIcon(QIcon( ::GetImagePath() + "icon/Import.png"));
|
|
|
|
|
|
m_pImportDataUI->pushButton->setIcon(QIcon( ::GetImagePath() + "icon/Exit.png"));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ImportDataDialog::~ImportDataDialog()
|
|
|
|
|
|
{
|
|
|
|
|
|
std::map<QWidget*,InterfaceWidget*>::iterator itor=m_TabInterWidget.begin();
|
|
|
|
|
|
for (;itor!=m_TabInterWidget.end();itor++)
|
|
|
|
|
|
{
|
|
|
|
|
|
InterfaceWidget *pIterWidget=itor->second;
|
|
|
|
|
|
if (pIterWidget)
|
|
|
|
|
|
{
|
|
|
|
|
|
delete pIterWidget;
|
|
|
|
|
|
pIterWidget=NULL;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
m_TabInterWidget.clear();
|
|
|
|
|
|
|
|
|
|
|
|
if (m_pImportDataUI)
|
|
|
|
|
|
{
|
|
|
|
|
|
delete m_pImportDataUI;
|
|
|
|
|
|
m_pImportDataUI=NULL;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ImportDataDialog::DisplayFileInformationAreaData( const QVector<IConvertor*>ConvertorVector,const QString filePath )
|
|
|
|
|
|
{
|
|
|
|
|
|
m_vConvertorVector.clear();
|
|
|
|
|
|
m_vConvertorVector=ConvertorVector;
|
|
|
|
|
|
std::map<sConvertorKey,IConvertorFactory::pCreateObjectFunction >&mapBuilderType =
|
|
|
|
|
|
IConvertor::GetFatory().m_map;
|
|
|
|
|
|
std::map<sConvertorKey,IConvertorFactory::pCreateObjectFunction >::iterator itor =
|
|
|
|
|
|
mapBuilderType.begin();
|
|
|
|
|
|
m_FilePath=filePath;
|
|
|
|
|
|
|
|
|
|
|
|
for (int i=0;i<ConvertorVector.size();i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
QWidget *tabWidget=new QWidget();
|
|
|
|
|
|
InterfaceWidget *pInterfaceWidget=new InterfaceWidget();
|
|
|
|
|
|
m_TabInterWidget[tabWidget]=pInterfaceWidget;
|
|
|
|
|
|
m_pImportDataUI->tabWidget->addTab(tabWidget,QString());
|
|
|
|
|
|
QHBoxLayout *Mainlayout=new QHBoxLayout(tabWidget);
|
|
|
|
|
|
QHBoxLayout *ScondLayout=new QHBoxLayout();
|
|
|
|
|
|
Mainlayout->addLayout(ScondLayout);
|
|
|
|
|
|
ScondLayout->addWidget(pInterfaceWidget);
|
|
|
|
|
|
m_pImportDataUI->tabWidget->setTabText(i,ConvertorVector[i]->GetConvertorTypeName());
|
|
|
|
|
|
pInterfaceWidget->GetDataPreviewArea()->setText(ConvertorVector[i]->GetFileContent(filePath));
|
|
|
|
|
|
FamilyDelegate* familyDelegate=new FamilyDelegate(this);
|
|
|
|
|
|
pInterfaceWidget->GetDataSelectAreaWidget()->setItemDelegateForColumn(2,familyDelegate);
|
|
|
|
|
|
pInterfaceWidget->m_pConvertor=ConvertorVector[i];
|
|
|
|
|
|
QStringList fileHead=ConvertorVector[i]->GetListHead();
|
|
|
|
|
|
if(fileHead.isEmpty())
|
|
|
|
|
|
fileHead<<"原始名称"<<"原始单位"<<"曲线类别"<<"输出名称"<<"输出单位";
|
|
|
|
|
|
|
|
|
|
|
|
ConvertorVector[i]->m_ColumnCount=fileHead.size();
|
|
|
|
|
|
DisplaySelectAreaData(pInterfaceWidget,fileHead,ConvertorVector[i]);
|
|
|
|
|
|
|
|
|
|
|
|
//初始化井和井次信息界面
|
|
|
|
|
|
InitWell(pInterfaceWidget,ConvertorVector[i]);
|
|
|
|
|
|
InitWellLogRound(pInterfaceWidget,ConvertorVector[i]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void ImportDataDialog::InitWell(InterfaceWidget *pInterfaceWidget,IConvertor*pConvertor)
|
|
|
|
|
|
{
|
|
|
|
|
|
MyWelllogRound *wellinfo=pConvertor->GetWellLogRoundInfo();
|
|
|
|
|
|
//无井代码
|
|
|
|
|
|
if(m_CurrentWellName!="")
|
|
|
|
|
|
pInterfaceWidget->GetWellNameLineEdit()->insert(m_CurrentWellName);
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
QString tempWellName=QString::fromStdString(wellinfo->GetWellName());//whp add 2020.7.15
|
|
|
|
|
|
tempWellName=tempWellName.simplified();
|
|
|
|
|
|
//whp change 2020.3.3 井名提取应该不含".zh"之类的后缀,应该取文件的基本名
|
|
|
|
|
|
//文件名中有一个以上的“."时,如3Oq.ZH.716,需要井名和文件名区分开,比如a.zh.716和a.wj.716同时解编,井名都取最前面的a,井次名分别为a.zh和a.wj
|
|
|
|
|
|
//pInterfaceWidget->GetWellNameLineEdit()->insert(QString::fromStdString(wellinfo->GetName()));
|
|
|
|
|
|
if(tempWellName=="")
|
|
|
|
|
|
{
|
|
|
|
|
|
QFileInfo temDir(QString::fromStdString(wellinfo->GetName()));
|
|
|
|
|
|
tempWellName=temDir.baseName();
|
|
|
|
|
|
}
|
|
|
|
|
|
pInterfaceWidget->GetWellNameLineEdit()->insert(tempWellName);
|
|
|
|
|
|
}
|
|
|
|
|
|
pInterfaceWidget->GetWellCompanyNameLineEdit()->insert(QString::fromStdString(wellinfo->GetCompanyName()));
|
|
|
|
|
|
pInterfaceWidget->GetWellAreaNameLineEdit()->insert(QString::fromStdString(wellinfo->GetAreaName()));
|
|
|
|
|
|
// pInterfaceWidget->GetWellCodeLineEdit()->insert("井代码");
|
|
|
|
|
|
pInterfaceWidget->GetXCodeLineEdit()->setText(QString::number(wellinfo->GetXCode(), 'f', 4));
|
|
|
|
|
|
pInterfaceWidget->GetYCodeLineEdit()->setText(QString::number(wellinfo->GetYCode(), 'f', 4));
|
|
|
|
|
|
pInterfaceWidget->GetAslLineEdit()->setText(QString::number(wellinfo->GetAsl(), 'f', 4));
|
|
|
|
|
|
pInterfaceWidget->GetBslLineEdit()->setText(QString::number(wellinfo->GetBsl(), 'f', 4));
|
|
|
|
|
|
pInterfaceWidget->GetCWMethodLineEdit()->insert(QString::fromStdString(wellinfo->GetCWMethod()));
|
|
|
|
|
|
pInterfaceWidget->GetBit1ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetBit1Prog()));
|
|
|
|
|
|
pInterfaceWidget->GetBit2ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetBit2Prog()));
|
|
|
|
|
|
pInterfaceWidget->GetBit3ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetBit3Prog()));
|
|
|
|
|
|
pInterfaceWidget->GetBit4ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetBit4Prog()));
|
|
|
|
|
|
pInterfaceWidget->GetBit5ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetBit5Prog()));
|
|
|
|
|
|
pInterfaceWidget->GetCas1ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetCas1Prog()));
|
|
|
|
|
|
pInterfaceWidget->GetCas2ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetCas2Prog()));
|
|
|
|
|
|
pInterfaceWidget->GetCas3ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetCas3Prog()));
|
|
|
|
|
|
pInterfaceWidget->GetCas4ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetCas4Prog()));
|
|
|
|
|
|
pInterfaceWidget->GetCas5ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetCas5Prog()));
|
|
|
|
|
|
pInterfaceWidget->GetCas1ShotLineEdit()->setText(QString::number(wellinfo->GetCas1Shot(), 'f', 4));
|
|
|
|
|
|
pInterfaceWidget->GetCas2ShotLineEdit()->setText(QString::number(wellinfo->GetCas2Shot(), 'f', 4));
|
|
|
|
|
|
pInterfaceWidget->GetSC1SDepLineEdit()->setText(QString::number(wellinfo->GetSC1SDep(), 'f', 4));
|
|
|
|
|
|
pInterfaceWidget->GetSC1EDepLineEdit()->setText(QString::number(wellinfo->GetSC1EDep(), 'f', 4));
|
|
|
|
|
|
pInterfaceWidget->GetSC2SDepLineEdit()->setText(QString::number(wellinfo->GetSC2SDep(), 'f', 4));
|
|
|
|
|
|
pInterfaceWidget->GetSC2EDepLineEdit()->setText(QString::number(wellinfo->GetSC2EDep(), 'f', 4));
|
|
|
|
|
|
pInterfaceWidget->GetWellTypeComboBox()->addItem(QString::fromStdString("直井"));
|
|
|
|
|
|
pInterfaceWidget->GetWellTypeComboBox()->addItem(QString::fromStdString("斜井"));
|
|
|
|
|
|
|
|
|
|
|
|
QDate SDrilltime;
|
|
|
|
|
|
SDrilltime=QDate::currentDate();
|
|
|
|
|
|
pInterfaceWidget->GerSDrillDateEdit()->setDate(SDrilltime);
|
|
|
|
|
|
pInterfaceWidget ->GerSDrillDateEdit()->setDisplayFormat("yyyy年 MM月 dd日");
|
|
|
|
|
|
|
|
|
|
|
|
QDate EDrilltime;
|
|
|
|
|
|
EDrilltime=QDate::currentDate();
|
|
|
|
|
|
pInterfaceWidget->GerEDrillDateEdit()->setDate(EDrilltime);
|
|
|
|
|
|
pInterfaceWidget ->GerEDrillDateEdit()->setDisplayFormat("yyyy年 MM月 dd日");
|
|
|
|
|
|
|
|
|
|
|
|
QDate Completetime;
|
|
|
|
|
|
Completetime=QDate::currentDate();
|
|
|
|
|
|
pInterfaceWidget->GerCompleteDateEdit()->setDate(Completetime);
|
|
|
|
|
|
pInterfaceWidget ->GerCompleteDateEdit()->setDisplayFormat("yyyy年 MM月 dd日");
|
|
|
|
|
|
}
|
|
|
|
|
|
void ImportDataDialog::InitWellLogRound(InterfaceWidget *pInterfaceWidget,IConvertor*pConvertor)
|
|
|
|
|
|
{
|
|
|
|
|
|
MyWelllogRound *welllogRound=pConvertor->GetWellLogRoundInfo();
|
|
|
|
|
|
//无测井剖面
|
|
|
|
|
|
if(m_CurrentWellRoundName!="")
|
|
|
|
|
|
pInterfaceWidget->GetWellRoundNameLineEdit()->insert(m_CurrentWellRoundName);
|
|
|
|
|
|
else
|
|
|
|
|
|
pInterfaceWidget->GetWellRoundNameLineEdit()->insert(QString::fromStdString(welllogRound->GetName()));
|
|
|
|
|
|
pInterfaceWidget->GetCompanyNameLineEdit()->insert(QString::fromStdString(welllogRound->GetCompanyName()));
|
|
|
|
|
|
pInterfaceWidget->GetTeamLineEdit()->insert(QString::fromStdString(welllogRound->GetTeam()));
|
|
|
|
|
|
pInterfaceWidget->GetOperatorLineEdit()->insert(QString::fromStdString(welllogRound->GetOperator()));
|
|
|
|
|
|
pInterfaceWidget->GetMudViscosityLineEdit()->insert(QString::number(welllogRound->GetMudViscosity(), 'f', 4));
|
|
|
|
|
|
pInterfaceWidget->GetRemarkTextEdit()->setText(QString::fromStdString(welllogRound->GetRemark()));
|
|
|
|
|
|
pInterfaceWidget->GetWaterLossLineEdit()->setText(QString::number(welllogRound->GetWaterLoss(), 'f', 4));
|
|
|
|
|
|
pInterfaceWidget->GetDensityLineEdit()->setText(QString::number(welllogRound->GetDensity(), 'f', 4));
|
|
|
|
|
|
pInterfaceWidget->GetResiLineEdit()->setText(QString::number(welllogRound->GetResi(), 'f', 4));
|
|
|
|
|
|
pInterfaceWidget->GetTempLineEdit()->setText(QString::number(welllogRound->GetTemp(), 'f', 4));
|
|
|
|
|
|
pInterfaceWidget->GetINTLogLineEdit()->insert(QString::fromStdString(welllogRound->GetINTLog()));
|
|
|
|
|
|
pInterfaceWidget->GetTempBotLineEdit()->setText(QString::number(welllogRound->GetTempBot(), 'f', 4));
|
|
|
|
|
|
pInterfaceWidget->GetNITINTLineEdit()->insert(QString::fromStdString(welllogRound->GetNITINT()));
|
|
|
|
|
|
pInterfaceWidget->GetIntProgLineEdit()->insert(QString::fromStdString(welllogRound->GetIntProg()));
|
|
|
|
|
|
pInterfaceWidget->GetInteDressLineEdit()->insert(QString::fromStdString(welllogRound->GetInteDress()));
|
|
|
|
|
|
pInterfaceWidget->GetAuditLineEdit()->insert(QString::fromStdString(welllogRound->GetAudit()));
|
|
|
|
|
|
pInterfaceWidget->GetEditTopDepth()->setText("-99999.");
|
|
|
|
|
|
pInterfaceWidget->GetEditBottomDepth()->setText("-99999.");
|
|
|
|
|
|
QString temp_topDepth = (welllogRound->GetTopDepth() > -9999) ? QString::number(welllogRound->GetTopDepth(),'f',6) : "-99999.";
|
|
|
|
|
|
QString temp_botDepth = (welllogRound->GetBottomDepth() > -9999) ? QString::number(welllogRound->GetBottomDepth(),'f',6) : "-99999.";
|
|
|
|
|
|
pInterfaceWidget->GetEditFileSDepth()->setText(temp_topDepth);
|
|
|
|
|
|
pInterfaceWidget->GetEditFileEDepth()->setText(temp_botDepth);
|
|
|
|
|
|
|
|
|
|
|
|
QDateTime time;
|
|
|
|
|
|
if (welllogRound->GetDate()=="")
|
|
|
|
|
|
{
|
|
|
|
|
|
time=QDateTime::currentDateTime();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
time =QDateTime::fromString(QString::fromStdString(welllogRound->GetDate()), "yyyy-MM-dd");
|
|
|
|
|
|
}
|
|
|
|
|
|
pInterfaceWidget->GerDateEdit()->setDateTime (time);
|
|
|
|
|
|
pInterfaceWidget ->GerDateEdit()->setDisplayFormat("yyyy年 MM月 dd日");
|
|
|
|
|
|
ComboxFromConfigFile(pInterfaceWidget->GetSerialComboBox(),"serial");
|
|
|
|
|
|
ComboxFromConfigFile(pInterfaceWidget->GetItemComboBox(),"wellItem");
|
|
|
|
|
|
ComboxFromConfigFile(pInterfaceWidget->GetMudTypeComboBox(),"mudType");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CObjWell * ImportDataDialog::GetWellBaseName( IConvertor *pConvertor,const std::string strWellName )
|
|
|
|
|
|
// {
|
|
|
|
|
|
// CObjWell *pWell(NULL);
|
|
|
|
|
|
// {
|
|
|
|
|
|
// QString strName=QString::fromStdString(strWellName);
|
|
|
|
|
|
// if (!GetProject())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if(!CProjectCommand::NewProject(true)) return NULL;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if( GetProject() )
|
|
|
|
|
|
// {
|
|
|
|
|
|
// pWell = dynamic_cast<CObjWell *>( GetProject()->GetObjectByName(strName));
|
|
|
|
|
|
// if (pWell)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// //pWell->SetDBWell(pConvertor->GetWellInfo());
|
|
|
|
|
|
// m_ExistSameWellName=true;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if( !pWell )
|
|
|
|
|
|
// {
|
|
|
|
|
|
// pWell = new CObjWell();
|
|
|
|
|
|
// pWell->SetName( strName );
|
|
|
|
|
|
// pWell->SetDBWell(*(pConvertor->GetWellInfo()));
|
|
|
|
|
|
// if( GetProject() )
|
|
|
|
|
|
// {
|
|
|
|
|
|
// GetProject()->GetWellsFolder(true)->AddChild( pWell );
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// return pWell;
|
|
|
|
|
|
// }
|
|
|
|
|
|
void ImportDataDialog::UpdateWell(InterfaceWidget *pInterfaceWidget,IConvertor *pConvertor)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!pInterfaceWidget||!pConvertor)
|
|
|
|
|
|
return ;
|
|
|
|
|
|
//井代码接口暂时没有
|
|
|
|
|
|
// pai::ios::welllog::Well &wellInfo=pConvertor->GetWellInfo();
|
|
|
|
|
|
InterIConvertor*pIC=dynamic_cast<InterIConvertor*>(pConvertor);
|
|
|
|
|
|
MyWelllogRound* wellInfo=pConvertor->GetWellLogRoundInfo();
|
|
|
|
|
|
QString wellname=pInterfaceWidget->GetWellNameLineEdit()->text();
|
|
|
|
|
|
wellname=wellname.toUpper();
|
|
|
|
|
|
if(pIC) strcpy(pIC->FILE_MESSAGE.WellName,wellname.toStdString().c_str());
|
|
|
|
|
|
wellInfo->SetWellName(wellname.toStdString());
|
|
|
|
|
|
wellInfo->SetName(wellname.toStdString());
|
|
|
|
|
|
//
|
|
|
|
|
|
wellInfo->SetCompanyName((pInterfaceWidget->GetWellCompanyNameLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellInfo->SetAreaName((pInterfaceWidget->GetWellAreaNameLineEdit()->text()).toStdString());
|
|
|
|
|
|
// wellInfo->SetWellCode((pInterfaceWidget->GetWellCodeLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellInfo->SetCWMethod((pInterfaceWidget->GetCWMethodLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellInfo->SetXCode((pInterfaceWidget->GetXCodeLineEdit()->text()).toFloat());
|
|
|
|
|
|
wellInfo->SetYCode((pInterfaceWidget->GetYCodeLineEdit()->text()).toFloat());
|
|
|
|
|
|
wellInfo->SetAsl((pInterfaceWidget->GetAslLineEdit()->text()).toFloat());
|
|
|
|
|
|
wellInfo->SetBsl((pInterfaceWidget->GetBslLineEdit()->text()).toFloat());
|
|
|
|
|
|
wellInfo->SetBit1Prog((pInterfaceWidget->GetBit1ProgLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellInfo->SetBit2Prog((pInterfaceWidget->GetBit2ProgLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellInfo->SetBit3Prog((pInterfaceWidget->GetBit3ProgLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellInfo->SetBit4Prog((pInterfaceWidget->GetBit4ProgLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellInfo->SetBit5Prog((pInterfaceWidget->GetBit5ProgLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellInfo->SetCas1Prog((pInterfaceWidget->GetCas1ProgLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellInfo->SetCas2Prog((pInterfaceWidget->GetCas2ProgLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellInfo->SetCas3Prog((pInterfaceWidget->GetCas3ProgLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellInfo->SetCas4Prog((pInterfaceWidget->GetCas4ProgLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellInfo->SetCas5Prog((pInterfaceWidget->GetCas5ProgLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellInfo->SetCas1Shot((pInterfaceWidget->GetCas1ShotLineEdit()->text()).toFloat());
|
|
|
|
|
|
wellInfo->SetCas2Shot((pInterfaceWidget->GetCas2ShotLineEdit()->text()).toFloat());
|
|
|
|
|
|
wellInfo->SetSC1SDep((pInterfaceWidget->GetSC1SDepLineEdit()->text()).toFloat());
|
|
|
|
|
|
wellInfo->SetSC1EDep((pInterfaceWidget->GetSC1EDepLineEdit()->text()).toFloat());
|
|
|
|
|
|
wellInfo->SetSC2SDep((pInterfaceWidget->GetSC2SDepLineEdit()->text()).toFloat());
|
|
|
|
|
|
wellInfo->SetSC2EDep((pInterfaceWidget->GetSC2EDepLineEdit()->text()).toFloat());
|
|
|
|
|
|
wellInfo->SetSDrillDate(pInterfaceWidget->GerSDrillDateEdit()->date().toString("yyyy年-MM月-dd日").toStdString());
|
|
|
|
|
|
wellInfo->SetEDrillDate(pInterfaceWidget->GerEDrillDateEdit()->date().toString("yyyy年-MM月-dd日").toStdString());
|
|
|
|
|
|
wellInfo->SetCompleteDate(pInterfaceWidget->GerCompleteDateEdit()->date().toString("yyyy年-MM月-dd日").toStdString());
|
|
|
|
|
|
wellInfo->SetWellType((pInterfaceWidget->GetWellTypeComboBox()->currentText()).toInt());
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ImportDataDialog::UpdateWellLogRound(InterfaceWidget *pInterfaceWidget,IConvertor *pConvertor)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!pInterfaceWidget||!pConvertor)
|
|
|
|
|
|
return ;
|
|
|
|
|
|
//剖面接口暂时没有
|
|
|
|
|
|
MyWelllogRound *wellRound=pConvertor->GetWellLogRoundInfo();
|
|
|
|
|
|
wellRound->SetCompanyName((pInterfaceWidget->GetCompanyNameLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellRound->SetTeam((pInterfaceWidget->GetTeamLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellRound->SetOperator((pInterfaceWidget->GetOperatorLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellRound->SetMudViscosity((pInterfaceWidget->GetMudViscosityLineEdit()->text()).toFloat());
|
|
|
|
|
|
wellRound->SetRemark(pInterfaceWidget->GetRemarkTextEdit()->toPlainText().toStdString());
|
|
|
|
|
|
wellRound->SetWaterLoss((pInterfaceWidget->GetWaterLossLineEdit()->text()).toFloat());
|
|
|
|
|
|
wellRound->SetDensity((pInterfaceWidget->GetDensityLineEdit()->text()).toFloat());
|
|
|
|
|
|
wellRound->SetResi((pInterfaceWidget->GetResiLineEdit()->text()).toFloat());
|
|
|
|
|
|
wellRound->SetTemp((pInterfaceWidget->GetTempLineEdit()->text()).toFloat());
|
|
|
|
|
|
wellRound->SetINTLog((pInterfaceWidget->GetINTLogLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellRound->SetTempBot((pInterfaceWidget->GetTempBotLineEdit()->text()).toFloat());
|
|
|
|
|
|
wellRound->SetNITINT((pInterfaceWidget->GetNITINTLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellRound->SetIntProg((pInterfaceWidget->GetIntProgLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellRound->SetInteDress((pInterfaceWidget->GetInteDressLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellRound->SetAudit((pInterfaceWidget->GetAuditLineEdit()->text()).toStdString());
|
|
|
|
|
|
wellRound->SetMudType((pInterfaceWidget->GetMudTypeComboBox()->currentText()).toStdString());
|
|
|
|
|
|
wellRound->SetItem((pInterfaceWidget->GetItemComboBox()->currentText()).toStdString());
|
|
|
|
|
|
wellRound->SetSerial((pInterfaceWidget->GetSerialComboBox()->currentText()).toStdString());
|
|
|
|
|
|
wellRound->SetDate(pInterfaceWidget->GerDateEdit()->date().toString("yyyy年-MM月-dd日").toStdString());
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
void ImportDataDialog::AcceptOK()
|
|
|
|
|
|
{
|
|
|
|
|
|
//whp del 2020.3.16 for 当井名不合理时,提示用户,然后回到解编界面,让用户修改,修改完后,再加载
|
|
|
|
|
|
//disconnect(m_pImportDataUI->pushButton_2, SIGNAL(clicked()), 0,0);
|
|
|
|
|
|
m_ExistSameWellRoundName=false;//TODO 多模块可同时解析一个文件时,需要处理
|
|
|
|
|
|
InterfaceWidget *pCurrentInterfaceWidget(NULL);
|
|
|
|
|
|
std::map< QWidget*,InterfaceWidget* >::iterator itor = m_TabInterWidget.find( m_pImportDataUI->tabWidget->currentWidget() );
|
|
|
|
|
|
int index=m_pImportDataUI->tabWidget->currentIndex();
|
|
|
|
|
|
if( itor != m_TabInterWidget.end() )
|
|
|
|
|
|
{
|
|
|
|
|
|
pCurrentInterfaceWidget=itor->second;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!pCurrentInterfaceWidget)
|
|
|
|
|
|
return ;
|
|
|
|
|
|
//whp add 2020.3.16
|
|
|
|
|
|
QString wellname=pCurrentInterfaceWidget->GetWellNameLineEdit()->text();
|
|
|
|
|
|
if(wellname=="")
|
|
|
|
|
|
{
|
|
|
|
|
|
QMessageBox::warning(NULL,"提示","井名不能为空");
|
|
|
|
|
|
return ;
|
|
|
|
|
|
}
|
|
|
|
|
|
if(!IsValidWellName(wellname))
|
|
|
|
|
|
{
|
|
|
|
|
|
QMessageBox::warning(NULL,"提示","'"+wellname+"'不符合井名命名规则");return ;
|
|
|
|
|
|
}
|
|
|
|
|
|
//
|
|
|
|
|
|
//std::map<IConvertor*,QList<CObjWellLog*> >::iterator it=m_ConvertorWellLog.find(m_vConvertorVector[index]);
|
|
|
|
|
|
//更新井次和井信息
|
|
|
|
|
|
UpdateWell(pCurrentInterfaceWidget,m_vConvertorVector[index]);
|
|
|
|
|
|
UpdateWellLogRound(pCurrentInterfaceWidget,m_vConvertorVector[index]);
|
|
|
|
|
|
|
|
|
|
|
|
std::string wellLogRoundName=m_vConvertorVector[index]->GetWellLogRoundInfo()->GetWellName();
|
|
|
|
|
|
|
|
|
|
|
|
if(/*!wellName.length()||*/!wellLogRoundName.length())
|
|
|
|
|
|
{
|
|
|
|
|
|
QMessageBox::about(NULL,"提示","井次名和井名不可为空!");
|
|
|
|
|
|
return ;
|
|
|
|
|
|
}
|
|
|
|
|
|
WellCurve wc=((InterIConvertor *)m_vConvertorVector[index])->GetWellCurves();
|
|
|
|
|
|
if(SelectAndDeleteWellLog(wc.Curve_Num,pCurrentInterfaceWidget,m_vConvertorVector[index]->m_ColumnCount,m_vConvertorVector[index]))
|
|
|
|
|
|
return;
|
|
|
|
|
|
//释放未被选取的解编器内存
|
|
|
|
|
|
QDialog::accept();
|
|
|
|
|
|
// ::GetObjectEvent().OnRefreshData(wellname,"");
|
|
|
|
|
|
}
|
|
|
|
|
|
//whp add 2019.10.12
|
|
|
|
|
|
void ImportDataDialog::SelAll()
|
|
|
|
|
|
{
|
|
|
|
|
|
InterfaceWidget *pCurrentInterfaceWidget(NULL);
|
|
|
|
|
|
std::map< QWidget*,InterfaceWidget* >::iterator itor = m_TabInterWidget.find( m_pImportDataUI->tabWidget->currentWidget() );
|
|
|
|
|
|
int index=m_pImportDataUI->tabWidget->currentIndex();
|
|
|
|
|
|
if( itor != m_TabInterWidget.end() )
|
|
|
|
|
|
{
|
|
|
|
|
|
pCurrentInterfaceWidget=itor->second;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!pCurrentInterfaceWidget)
|
|
|
|
|
|
return ;
|
|
|
|
|
|
QTableWidget *tableWidget=pCurrentInterfaceWidget->GetDataSelectAreaWidget();
|
|
|
|
|
|
int iRow=tableWidget->rowCount();
|
|
|
|
|
|
for (int i=0;i<iRow;i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
tableWidget->item(i,0)->setCheckState(Qt::Checked);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void ImportDataDialog::NotSelAll()
|
|
|
|
|
|
{
|
|
|
|
|
|
InterfaceWidget *pCurrentInterfaceWidget(NULL);
|
|
|
|
|
|
std::map< QWidget*,InterfaceWidget* >::iterator itor = m_TabInterWidget.find( m_pImportDataUI->tabWidget->currentWidget() );
|
|
|
|
|
|
int index=m_pImportDataUI->tabWidget->currentIndex();
|
|
|
|
|
|
if( itor != m_TabInterWidget.end() )
|
|
|
|
|
|
{
|
|
|
|
|
|
pCurrentInterfaceWidget=itor->second;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!pCurrentInterfaceWidget)
|
|
|
|
|
|
return ;
|
|
|
|
|
|
QTableWidget *tableWidget=pCurrentInterfaceWidget->GetDataSelectAreaWidget();
|
|
|
|
|
|
int iRow=tableWidget->rowCount();
|
|
|
|
|
|
for (int i=0;i<iRow;i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
tableWidget->item(i,0)->setCheckState(Qt::Unchecked);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void ImportDataDialog::ReverseSel()
|
|
|
|
|
|
{
|
|
|
|
|
|
InterfaceWidget *pCurrentInterfaceWidget(NULL);
|
|
|
|
|
|
std::map< QWidget*,InterfaceWidget* >::iterator itor = m_TabInterWidget.find( m_pImportDataUI->tabWidget->currentWidget() );
|
|
|
|
|
|
int index=m_pImportDataUI->tabWidget->currentIndex();
|
|
|
|
|
|
if( itor != m_TabInterWidget.end() )
|
|
|
|
|
|
{
|
|
|
|
|
|
pCurrentInterfaceWidget=itor->second;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!pCurrentInterfaceWidget)
|
|
|
|
|
|
return ;
|
|
|
|
|
|
QTableWidget *tableWidget=pCurrentInterfaceWidget->GetDataSelectAreaWidget();
|
|
|
|
|
|
int iRow=tableWidget->rowCount();
|
|
|
|
|
|
for (int i=0;i<iRow;i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
Qt::CheckState eState= tableWidget->item(i,0)->checkState();
|
|
|
|
|
|
if (eState==Qt::Checked)tableWidget->item(i,0)->setCheckState(Qt::Unchecked);
|
|
|
|
|
|
else tableWidget->item(i,0)->setCheckState(Qt::Checked);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void ImportDataDialog::DisplaySelectAreaData( InterfaceWidget *pInterface,const QStringList fileHead,IConvertor *pConvertor)
|
|
|
|
|
|
{
|
|
|
|
|
|
int iRow(0),iOrder(0);
|
|
|
|
|
|
|
|
|
|
|
|
vector<char *> CurveNames=((InterIConvertor*)pConvertor)->GetCurveNames();
|
|
|
|
|
|
vector<char *> CurveUnits=((InterIConvertor*)pConvertor)->GetCurveUnits();
|
|
|
|
|
|
WellCurve WellCurves= ((InterIConvertor*)pConvertor)->GetWellCurves();
|
|
|
|
|
|
|
|
|
|
|
|
//pConvertor->GetWellLogList(m_FilePath);
|
|
|
|
|
|
iRow=WellCurves.Curve_Num;//m_ConvertorWellLog[pConvertor].size();
|
|
|
|
|
|
pInterface->GetDataSelectAreaWidget()->setColumnCount(fileHead.size());
|
|
|
|
|
|
pInterface->GetDataSelectAreaWidget()->setRowCount(iRow);
|
|
|
|
|
|
for (int i=0;i<fileHead.size();i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(i==0) pInterface->GetDataSelectAreaWidget()->setColumnWidth(i,150);
|
|
|
|
|
|
if(i==1) pInterface->GetDataSelectAreaWidget()->setColumnWidth(i,80);
|
|
|
|
|
|
if(i==2) pInterface->GetDataSelectAreaWidget()->setColumnWidth(i,80);
|
|
|
|
|
|
if(i==3) pInterface->GetDataSelectAreaWidget()->setColumnWidth(i,150);
|
|
|
|
|
|
if (i==4)
|
|
|
|
|
|
{
|
|
|
|
|
|
pInterface->GetDataSelectAreaWidget()->setColumnWidth(i,80);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pInterface->GetDataSelectAreaWidget()->horizontalHeader()->setStretchLastSection(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
//pInterface->m_pInterfaceUI->widget->setFixedWidth(560);
|
|
|
|
|
|
pInterface->GetDataSelectAreaWidget()->setHorizontalHeaderLabels(fileHead);
|
|
|
|
|
|
QHeaderView* headerView = pInterface->GetDataSelectAreaWidget()->verticalHeader();
|
|
|
|
|
|
//headerView->setHidden(true);
|
|
|
|
|
|
pInterface->GetDataSelectAreaWidget()->setAlternatingRowColors(true);
|
|
|
|
|
|
pInterface->GetDataSelectAreaWidget()->setSelectionBehavior(QAbstractItemView::SelectRows);
|
|
|
|
|
|
for (int i=0;i<iRow;++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
QTableWidgetItem *head=new QTableWidgetItem(QTableWidgetItem::Type);
|
|
|
|
|
|
head->setCheckState(Qt::Checked); //加入复选框
|
|
|
|
|
|
head->setFlags(head->flags() ^ Qt::ItemIsEditable);
|
|
|
|
|
|
head->setText(CurveNames[i]);//曲线名
|
|
|
|
|
|
|
|
|
|
|
|
pInterface->GetDataSelectAreaWidget()->setItem(i,0,head); //插入该Item
|
|
|
|
|
|
QString unit=QString::fromLocal8Bit(CurveUnits[i]);
|
|
|
|
|
|
pInterface->GetDataSelectAreaWidget()->setItem(i,1,new QTableWidgetItem(unit));//导入曲线单位
|
|
|
|
|
|
pInterface->GetDataSelectAreaWidget()->setItem(i,2,new QTableWidgetItem(""));//family));//
|
|
|
|
|
|
pInterface->GetDataSelectAreaWidget()->setItem(i,3,new QTableWidgetItem(CurveNames[i]));//导入曲线名
|
|
|
|
|
|
pInterface->GetDataSelectAreaWidget()->setItem(i,4,new QTableWidgetItem(unit));//导入曲线单位
|
|
|
|
|
|
//whp add 2019.8.1 for 设置输入曲线单位列为只读
|
|
|
|
|
|
auto rFlags = pInterface->GetDataSelectAreaWidget()->item(i,1)->flags();
|
|
|
|
|
|
pInterface->GetDataSelectAreaWidget()->item(i,1)->setFlags(rFlags & (~Qt::ItemIsEditable));
|
|
|
|
|
|
iOrder++;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
bool ImportDataDialog::IsHaveSameCurve(int NumLog,vector<int> &OutCurveNo,vector<char*> &OutCurve)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString str,mes="";
|
|
|
|
|
|
int SameNameCurveNum=0;
|
|
|
|
|
|
QStringList ExistName;
|
|
|
|
|
|
for(int i=0;i<NumLog-1;i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(OutCurveNo[i]<0)continue;
|
|
|
|
|
|
if(ExistName.indexOf(QString(OutCurve[i]))>=0)continue;
|
|
|
|
|
|
int no=0;
|
|
|
|
|
|
str="\r\n第"+QString::number(i+1)+"条和第";
|
|
|
|
|
|
for(int j=i+1;j<NumLog;j++)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if((strcmp(OutCurve[i],OutCurve[j])==0)&&(OutCurveNo[j]>=0))
|
|
|
|
|
|
{
|
|
|
|
|
|
if(no>0)str+="、";
|
|
|
|
|
|
str+=QString::number(j+1);
|
|
|
|
|
|
no++;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if(no==0)continue;
|
|
|
|
|
|
ExistName.append(QString(QLatin1String(OutCurve[i])));
|
|
|
|
|
|
SameNameCurveNum++;
|
|
|
|
|
|
if(SameNameCurveNum<30) mes+=str+"条输出曲线名字为"+QString(QLatin1String(OutCurve[i]));
|
|
|
|
|
|
else if(SameNameCurveNum==30) mes+="\n重名>=30条...";
|
|
|
|
|
|
}
|
|
|
|
|
|
if(SameNameCurveNum>0)
|
|
|
|
|
|
{
|
|
|
|
|
|
/*str=CString("您所选择的解编曲线中存在下列同名曲线,请修改同名曲线,然后再解编\r\n\r\n")+mes;
|
|
|
|
|
|
AfxMessageBox(str);
|
|
|
|
|
|
return 1;*/
|
|
|
|
|
|
QString inf="您所选择的解编曲线中存在下列同名曲线:\r\n\r\n"+mes+"\r\n\r\n是否对同名曲线进行解编?";
|
|
|
|
|
|
QMessageBox box(QMessageBox::Warning,"提示",mes);
|
|
|
|
|
|
box.setStandardButtons (QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel);
|
|
|
|
|
|
box.setButtonText (QMessageBox::Yes,QString("自动重命名"));
|
|
|
|
|
|
box.setButtonText (QMessageBox::No,QString("跳过同名曲线"));
|
|
|
|
|
|
box.setButtonText (QMessageBox::Cancel,QString("返回、修改"));
|
|
|
|
|
|
int ret=box.exec();
|
|
|
|
|
|
if(ret==QMessageBox::Cancel)return 1;
|
|
|
|
|
|
QStringList OutCurveList;
|
|
|
|
|
|
for(int i=0;i<NumLog-1;i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(OutCurveNo[i]>=0)
|
|
|
|
|
|
{
|
|
|
|
|
|
int no=1;
|
|
|
|
|
|
for(int j=i+1;j<NumLog;j++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(OutCurveNo[j]<0)continue;
|
|
|
|
|
|
if((strcmp(OutCurve[i],OutCurve[j])==0))
|
|
|
|
|
|
{
|
|
|
|
|
|
if(ret==QMessageBox::No)OutCurveNo[j]=-1;
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
QString newname=QString(OutCurve[i])+"_"+QString::number(no++);
|
|
|
|
|
|
delete OutCurve[j];
|
|
|
|
|
|
OutCurve[j]=new char[strlen(newname.toStdString().c_str())+1];
|
|
|
|
|
|
strcpy(OutCurve[j],newname.toStdString().c_str());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
// int ImportDataDialog::CheckExistCurve(QString filename,int NumLog,vector<int>& OutCurveNo,vector<char*>& OutCurve)
|
|
|
|
|
|
// { //1-有输出曲线,需要继续输出,0-经跳过功能后,没有曲线要输出了,-1退回原界面
|
|
|
|
|
|
// CMemRdWt *logio=new CMemRdWt();
|
|
|
|
|
|
// if(!logio->Open(filename.toStdString().c_str(),CSlfIO::modeRead))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// delete logio;
|
|
|
|
|
|
// return 1;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// CString str,mes="";
|
|
|
|
|
|
// vector<int> ExistCurveNo;
|
|
|
|
|
|
// vector<char*> ExistCurve;
|
|
|
|
|
|
// int ExistCurveNum=0;
|
|
|
|
|
|
// for(int i=0;i<NumLog;i++)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if(OutCurveNo[i]<0)continue;
|
|
|
|
|
|
// int hh=logio->FindObjectName(OutCurve[i],-1,-1,OBJECT_NORMAL);
|
|
|
|
|
|
// if(logio->FindObjectName(OutCurve[i],-1,-1,OBJECT_NORMAL)<0)continue;
|
|
|
|
|
|
// ExistCurve.push_back(OutCurve[i]);
|
|
|
|
|
|
// ExistCurveNo.push_back(i);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if(ExistCurve.size()==0)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// delete logio;
|
|
|
|
|
|
// return 1;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// TiShiDialog *dlg=new TiShiDialog(NULL);
|
|
|
|
|
|
// dlg->init(ExistCurve);
|
|
|
|
|
|
// if(dlg->exec()==Accepted)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if(dlg->flag==0)//跳过
|
|
|
|
|
|
// {
|
|
|
|
|
|
// for(int i=0;i<ExistCurve.size();i++)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// int nn=ExistCurveNo[i];
|
|
|
|
|
|
// OutCurveNo[ExistCurveNo[i]]=-1;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else if(dlg->flag==1)//替换
|
|
|
|
|
|
// {
|
|
|
|
|
|
// for(int i=0;i<ExistCurve.size();i++)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// logio->DiscardObject(ExistCurve[i]);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else if(dlg->flag==3)//另存
|
|
|
|
|
|
// {
|
|
|
|
|
|
// QStringList OutCurveList;
|
|
|
|
|
|
// for(int i=0;i<logio->GetObjectCount();i++)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// char name[64];
|
|
|
|
|
|
// if(logio->GetObjectStatus(i)!=OBJECT_NORMAL)continue;
|
|
|
|
|
|
// logio->GetObjectName(i,name);
|
|
|
|
|
|
// OutCurveList.append(QString(name));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// for(int i=0;i<ExistCurve.size();i++)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// QString name1,name=QString(ExistCurve[i])+"_";
|
|
|
|
|
|
// for(int j=0;j<100;j++)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// name1=name+QString::number(j+1);
|
|
|
|
|
|
// if(OutCurveList.indexOf(name1)<0)break;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// char *temp = new char[name1.toStdString().size()+1];
|
|
|
|
|
|
// strcpy(temp, name1.toStdString().c_str());
|
|
|
|
|
|
// strcpy(OutCurve[ExistCurveNo[i]],temp);//name1->toStdString()->c_str());
|
|
|
|
|
|
// delete temp;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// delete logio;
|
|
|
|
|
|
// delete dlg;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// delete logio;
|
|
|
|
|
|
// delete dlg;
|
|
|
|
|
|
// return -1;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// for(int i=0;i<NumLog;i++)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if(OutCurveNo[i]>=0) return 1;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// return 0;
|
|
|
|
|
|
// }
|
2026-03-27 21:26:43 +08:00
|
|
|
|
|
|
|
|
|
|
void CreateWellFile(CLogIO *logio,Slf_FILE_MESSAGE &mssage,QString wellFile,CObjWell *pWell)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(logio) {
|
|
|
|
|
|
CLogIO * logiowell=new CLogIO();
|
|
|
|
|
|
Slf_FILE_MESSAGE ms=mssage;
|
|
|
|
|
|
strcpy(ms.Item,"井基本信息");
|
|
|
|
|
|
logiowell->Open(wellFile.toStdString().c_str(),CSlfIO::modeWrite);
|
|
|
|
|
|
logiowell->SetFileMessage(ms);
|
|
|
|
|
|
QStringList azims=GetSimilarCurves("AZIM");
|
|
|
|
|
|
int iAZIM=-1;
|
|
|
|
|
|
QString AZIM;
|
|
|
|
|
|
foreach(QString cname,azims)
|
|
|
|
|
|
{
|
|
|
|
|
|
iAZIM=logio->FindObjectName((char *)cname.toStdString().c_str());
|
|
|
|
|
|
if(iAZIM>-1) {
|
|
|
|
|
|
AZIM=cname;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
int iDev=-1;
|
|
|
|
|
|
QStringList devis=GetSimilarCurves("DEVI");
|
|
|
|
|
|
QString DEV;
|
|
|
|
|
|
foreach(QString cname,devis)
|
|
|
|
|
|
{
|
|
|
|
|
|
iDev=logio->FindObjectName((char *)cname.toStdString().c_str());
|
|
|
|
|
|
if(iDev>-1) {
|
|
|
|
|
|
DEV=cname;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
// if(logio->FindObjectIndex("井基本信息")>-1) {
|
|
|
|
|
|
// logiowell->CopyFromFile((CSlfIO &)(*logio),"井基本信息");
|
|
|
|
|
|
// }
|
|
|
|
|
|
if(iAZIM>-1)logiowell->CopyFromFile((CSlfIO &)(*logio),(char *)AZIM.toStdString().c_str());
|
|
|
|
|
|
if(iDev>-1)logiowell->CopyFromFile((CSlfIO &)(*logio),(char *)DEV.toStdString().c_str());
|
|
|
|
|
|
delete logiowell;
|
|
|
|
|
|
if(iDev>-1&&iAZIM>-1) {
|
|
|
|
|
|
pWell->ComputeTrajectory(pWell,wellFile);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
// 参考 CObjWell *CDataImport::ChangetoSlf(QString wellFile1,DiDepthProgress *pDepthProgress,bool IsTran)
|
|
|
|
|
|
CObjWell *ChangetoSlf(QString wellFile1,DiDepthProgress *pDepthProgress,bool IsTran)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString filename=wellFile1;
|
|
|
|
|
|
QString slffilename=filename;
|
|
|
|
|
|
|
|
|
|
|
|
///从文件内部读取井名
|
|
|
|
|
|
CLogIO * logio=new CLogIO();
|
|
|
|
|
|
if(!logio->Open(slffilename.toStdString().c_str(),CSlfIO::modeRead))
|
|
|
|
|
|
{
|
|
|
|
|
|
delete logio;
|
|
|
|
|
|
QString aa=slffilename+"文件打开失败,请检查!";
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
// AppendConsole(pai::log::PAI_ERROR,aa);
|
|
|
|
|
|
// return pWell;
|
|
|
|
|
|
}
|
|
|
|
|
|
//说明从项目或者井节点发起attachSLF,需要读取slf获得井名和井次信息
|
|
|
|
|
|
QString wellname="";
|
|
|
|
|
|
Slf_FILE_MESSAGE mssage;
|
|
|
|
|
|
logio->GetFileMessage(mssage);
|
|
|
|
|
|
wellname=mssage.WellName;
|
|
|
|
|
|
wellname=wellname.toUpper();
|
|
|
|
|
|
//辨别井名是否有效,无效则采用文件名
|
|
|
|
|
|
QFileInfo fileInfo(filename);
|
|
|
|
|
|
QString strWellName = fileInfo.completeBaseName();
|
|
|
|
|
|
strWellName=strWellName.toUpper();
|
|
|
|
|
|
QString wellRoundname=strWellName;
|
|
|
|
|
|
|
|
|
|
|
|
CObjWell *pWell = new CObjWell();
|
|
|
|
|
|
CObjWelllogRound* pWelllogRound=new CObjWelllogRound();
|
|
|
|
|
|
pWelllogRound->SetWell(pWell);
|
|
|
|
|
|
// pWell->AddChild(pWelllogRound);
|
|
|
|
|
|
|
|
|
|
|
|
pWell->SetCurrentObjWellRound(pWelllogRound);
|
|
|
|
|
|
|
|
|
|
|
|
wellRoundname=wellRoundname.toUpper();
|
|
|
|
|
|
// pWelllogRound->SetName(wellRoundname);
|
|
|
|
|
|
pWelllogRound->SetSlfFileName(filename);
|
|
|
|
|
|
if (wellname.isEmpty()||wellname.length()>64||wellname.indexOf('&')>-1)
|
|
|
|
|
|
{
|
|
|
|
|
|
wellname=strWellName.toStdString().c_str();
|
|
|
|
|
|
int len=strlen(strWellName.toStdString().c_str());
|
|
|
|
|
|
if(len>sizeof(mssage.WellName)) len=sizeof(mssage.WellName);
|
|
|
|
|
|
strncpy(mssage.WellName,strWellName.toStdString().c_str(),len);
|
|
|
|
|
|
mssage.WellName[len]=0;
|
|
|
|
|
|
logio->SetFileMessage(mssage);
|
|
|
|
|
|
}
|
|
|
|
|
|
wellname=wellname.toUpper();
|
|
|
|
|
|
QString welln;
|
|
|
|
|
|
if(filename.endsWith(".slf",Qt::CaseInsensitive))
|
|
|
|
|
|
{
|
|
|
|
|
|
// QString dirpath=GetLogdataPath()+GetProject()->GetName();
|
|
|
|
|
|
|
|
|
|
|
|
// welln=GetWellFileFromDir(dirpath,wellname,".well");
|
|
|
|
|
|
// if(welln.isEmpty()||(!pWell->GetName().isEmpty()&&wellname!=pWell->GetName())) {
|
|
|
|
|
|
// wellname=pWell->GetName();
|
|
|
|
|
|
int index=filename.lastIndexOf("\\");
|
|
|
|
|
|
int index1=filename.lastIndexOf("/");
|
|
|
|
|
|
if(index1>index) index=index1;
|
|
|
|
|
|
// welln=GetWellFileFromCurrentDir(filename.left(index+1),wellname,".well");
|
|
|
|
|
|
|
|
|
|
|
|
if(welln.isEmpty()) {
|
|
|
|
|
|
welln=filename.left(index+1)+wellname+".well";
|
|
|
|
|
|
QFileInfo check_file(welln);
|
|
|
|
|
|
if (!check_file.exists() || !check_file.isFile()) {//文件不存在
|
|
|
|
|
|
CreateWellFile(logio,mssage,welln,pWell);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CDataTree::SetTree(welln,pWell,NULL,(DepthProgress *)pDepthProgress,1);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
int iX=-1,iY=-1,iZ=-1;
|
|
|
|
|
|
int isrefress=true;
|
|
|
|
|
|
QString temp = ::GetConfPath()+"data.ini";
|
|
|
|
|
|
QSettings settings(temp,QSettings::IniFormat,0);
|
|
|
|
|
|
settings.setIniCodec(QTextCodec::codecForName("UTF-8"));
|
|
|
|
|
|
QStringList serials=settings.value("wellType",0).toStringList();
|
|
|
|
|
|
int type=serials.indexOf(mssage.WellType);
|
|
|
|
|
|
|
|
|
|
|
|
if(type>-1) pWell->SetWellSymbol("well" + QString::number(type) + ".png");
|
|
|
|
|
|
|
|
|
|
|
|
//else isrefress=true;
|
|
|
|
|
|
float Altitude=mssage.Altitude;
|
|
|
|
|
|
float X_COORDINATE=mssage.Xcoor;
|
|
|
|
|
|
float Y_COORDINATE=mssage.Ycoor;//井斜x,y坐标
|
|
|
|
|
|
WellHead &mWellHead=pWell->GetWellHead();
|
|
|
|
|
|
if(mssage.Kelly==9999999) mssage.Kelly=0;
|
|
|
|
|
|
if(mssage.Kelly==-9999) mssage.Kelly=0;
|
|
|
|
|
|
if(mssage.Kelly==-99999) mssage.Kelly=0;
|
|
|
|
|
|
if(mssage.azca) mWellHead.azca=mssage.azca;
|
|
|
|
|
|
if(mssage.Kelly)mWellHead.dEle=ConvertDataByFloat(mssage.Kelly).toFloat();
|
|
|
|
|
|
if(mssage.WellName[0])mWellHead.wellName=mssage.WellName;
|
|
|
|
|
|
if(X_COORDINATE)mWellHead.x=X_COORDINATE;
|
|
|
|
|
|
if(Y_COORDINATE)mWellHead.y=Y_COORDINATE;
|
|
|
|
|
|
if(Altitude)mWellHead.earthEle=Altitude;
|
|
|
|
|
|
if(mssage.X0)mWellHead.dxe=mssage.X0;
|
|
|
|
|
|
if(mssage.Y0)mWellHead.dyn=mssage.Y0;
|
|
|
|
|
|
if(mssage.TVD)mWellHead.tvd=mssage.TVD;
|
|
|
|
|
|
Slf_CURVE acurveinfo;
|
|
|
|
|
|
memset(&acurveinfo,0,sizeof(Slf_CURVE));
|
|
|
|
|
|
int curveCount=logio->GetObjectCount();
|
|
|
|
|
|
if(isrefress) {
|
|
|
|
|
|
logio->DiscardObject("X");
|
|
|
|
|
|
logio->DiscardObject("Y");
|
|
|
|
|
|
logio->DiscardObject("Z");
|
|
|
|
|
|
logio->DiscardObject("TVD");
|
|
|
|
|
|
}
|
|
|
|
|
|
iX=logio->OpenCurve("X");
|
|
|
|
|
|
iY=logio->OpenCurve("Y");
|
|
|
|
|
|
iZ=logio->OpenCurve("Z");
|
|
|
|
|
|
if(iX>-1) logio->GetCurveInfo(iX,&acurveinfo);
|
|
|
|
|
|
|
|
|
|
|
|
mWellHead.depth=acurveinfo.StartDepth;
|
|
|
|
|
|
if(mWellHead.tvd==0&&acurveinfo.StartDepth!=0)mWellHead.tvd=acurveinfo.StartDepth;
|
|
|
|
|
|
mWellHead.z=mWellHead.earthEle-mWellHead.tvd+mWellHead.dEle;
|
|
|
|
|
|
mWellHead.startDepth=acurveinfo.StartDepth;
|
|
|
|
|
|
mWellHead.endDepth=acurveinfo.EndDepth;
|
|
|
|
|
|
mWellHead.rlev=acurveinfo.DepLevel;
|
|
|
|
|
|
int iDepth=-1;
|
|
|
|
|
|
iDepth=logio->OpenCurve("TVD");
|
|
|
|
|
|
if(iX>=0&&iY>=0&&iZ>=0&&iDepth>=0) {
|
|
|
|
|
|
logio->GetCurveInfo(iX,&acurveinfo);
|
|
|
|
|
|
if(acurveinfo.DepLevel==0) {
|
|
|
|
|
|
logio->DiscardObject(iX);
|
|
|
|
|
|
logio->DiscardObject(iY);
|
|
|
|
|
|
logio->DiscardObject(iZ);
|
|
|
|
|
|
logio->DiscardObject(iDepth);
|
|
|
|
|
|
delete logio;
|
|
|
|
|
|
pWell->ComputeTrajectory(pWell,filename);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
delete logio;
|
|
|
|
|
|
pWell->SetDepth(pWell);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
delete logio;
|
|
|
|
|
|
pWell->ComputeTrajectory(pWell,slffilename);
|
|
|
|
|
|
}
|
|
|
|
|
|
logio=new CLogIO();
|
|
|
|
|
|
if(!logio->Open(slffilename.toStdString().c_str(),CSlfIO::modeRead))
|
|
|
|
|
|
{
|
|
|
|
|
|
delete logio;
|
|
|
|
|
|
QString aa=slffilename+"文件打开失败,请检查!";
|
|
|
|
|
|
// AppendConsole(pai::log::PAI_ERROR,aa);
|
|
|
|
|
|
return pWell;
|
|
|
|
|
|
}
|
|
|
|
|
|
curveCount=logio->GetObjectCount();
|
|
|
|
|
|
char* curvename=new char[65];
|
|
|
|
|
|
curvename[64]='\0';
|
|
|
|
|
|
char* aliasname=new char[65];
|
|
|
|
|
|
aliasname[64]='\0';
|
|
|
|
|
|
for(int i=0;i<curveCount;i++) {
|
|
|
|
|
|
logio->GetObjectName(i,curvename,NULL,aliasname);
|
|
|
|
|
|
if(!logio->IsObject(i)) {
|
|
|
|
|
|
logio->DiscardObject(i);
|
|
|
|
|
|
continue;
|
|
|
|
|
|
};
|
|
|
|
|
|
if(logio->GetObjectStatus(i)!=OBJECT_NORMAL) continue;
|
|
|
|
|
|
short curvetype=logio->GetObjectType(i);
|
|
|
|
|
|
short Attribute=0,SubAttribute=0;
|
|
|
|
|
|
logio->GetObjectAttribute(i,&Attribute,&SubAttribute);
|
|
|
|
|
|
if(curvetype==CURVE_OBJECT)
|
|
|
|
|
|
{
|
|
|
|
|
|
Slf_CURVE acurveinfo;
|
|
|
|
|
|
logio->GetCurveInfo(i,&acurveinfo);
|
|
|
|
|
|
if(acurveinfo.DepLevel!=0&&(acurveinfo.EndDepth-acurveinfo.StartDepth>0))
|
|
|
|
|
|
{
|
|
|
|
|
|
if(acurveinfo.MaxValue==acurveinfo.MinValue||acurveinfo.MaxValue==-99999||acurveinfo.MaxValue==-9999||acurveinfo.MinValue==999999||acurveinfo.MinValue==999999||acurveinfo.MinValue==99999||acurveinfo.MinValue==99999||acurveinfo.MinValue==-9999){
|
|
|
|
|
|
int curveindex=logio->OpenSlfTable(i,-1);
|
|
|
|
|
|
if(curveindex>-1)
|
|
|
|
|
|
{
|
|
|
|
|
|
MyDataTypeEnum vVdl;
|
|
|
|
|
|
DWORD count=(acurveinfo.EndDepth-acurveinfo.StartDepth)/acurveinfo.DepLevel+1.5;
|
|
|
|
|
|
DWORD len=count*acurveinfo.CodeLen;
|
|
|
|
|
|
acurveinfo.MinValue=99999999;
|
|
|
|
|
|
acurveinfo.MaxValue=-99999999;
|
|
|
|
|
|
if(acurveinfo.CodeLen==8) acurveinfo.MinValue=99999999;
|
|
|
|
|
|
vVdl.vchar=new char[len];
|
|
|
|
|
|
len=logio->ReadCurve(curveindex, acurveinfo.StartDepth,count,(void *)vVdl.vchar);
|
|
|
|
|
|
if(!len) {
|
|
|
|
|
|
QString cs;
|
|
|
|
|
|
char buf[1000];
|
|
|
|
|
|
sprintf(buf,"%s %f-%f",acurveinfo.Name,acurveinfo.StartDepth,acurveinfo.EndDepth);
|
|
|
|
|
|
cs=buf;
|
|
|
|
|
|
int flag = QMessageBox::warning(NULL,"提示",QString(cs+"\n曲线信息异常!删除该曲线可能需要较长时间,建议复制正常曲线等信息到新文件,然后删除此文件。是否此时直接将该曲线删除?"),QMessageBox::Yes,QMessageBox::No);
|
|
|
|
|
|
if(flag==QMessageBox::Yes) logio->DiscardObject(i);
|
|
|
|
|
|
delete vVdl.vchar;
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
for(int kk=0;kk<count;kk=kk+10)
|
|
|
|
|
|
{
|
|
|
|
|
|
float buf[200];
|
|
|
|
|
|
buf[0]=0;
|
|
|
|
|
|
float temp=logio->GetData(acurveinfo.RepCode,&vVdl.vchar[kk*acurveinfo.CodeLen],buf);
|
|
|
|
|
|
if(_isnan(temp)||!_finite(temp)) continue;
|
|
|
|
|
|
|
|
|
|
|
|
if(acurveinfo.MaxValue<temp) if(temp!=-9999.0&&temp!=-999.25&&temp!=-99999.0)acurveinfo.MaxValue=temp;
|
|
|
|
|
|
if(acurveinfo.MinValue>temp) if(temp!=-9999.0&&temp!=-999.25&&temp!=-99999.0)acurveinfo.MinValue=temp;
|
|
|
|
|
|
}
|
|
|
|
|
|
logio->SetCurveInfo(curveindex,&acurveinfo);
|
|
|
|
|
|
delete vVdl.vchar;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else if(acurveinfo.DepLevel==0||acurveinfo.StartDepth<-100000||acurveinfo.StartDepth>100000)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString cs;
|
|
|
|
|
|
char buf[1000];
|
|
|
|
|
|
sprintf(buf,"%s %f-%f",acurveinfo.Name,acurveinfo.StartDepth,acurveinfo.EndDepth);
|
|
|
|
|
|
cs=buf;
|
|
|
|
|
|
int flag = QMessageBox::warning(NULL,"提示",QString(cs+"\n曲线信息异常!删除该曲线可能需要较长时间,建议复制正常曲线等信息到新文件,然后删除此文件。是否此时直接将该曲线删除?"),QMessageBox::Yes,QMessageBox::No);
|
|
|
|
|
|
if(flag==QMessageBox::Yes) logio->DiscardObject(i);
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
delete []curvename;
|
|
|
|
|
|
delete []aliasname;
|
|
|
|
|
|
DepthProgress *pd=new DepthProgress;
|
|
|
|
|
|
pd->CreatProgress(0,2,"正在整理数据...");
|
|
|
|
|
|
pd->SetDepth(1);
|
|
|
|
|
|
delete logio;
|
|
|
|
|
|
delete pd;
|
|
|
|
|
|
|
|
|
|
|
|
delete pWelllogRound;
|
|
|
|
|
|
delete pWell;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-29 17:23:30 +08:00
|
|
|
|
bool ImportDataDialog::SelectAndDeleteWellLog(int iRow,InterfaceWidget *pCurrentInterfaceWidget,int ColumnCount,IConvertor *pConvertor)
|
|
|
|
|
|
{
|
|
|
|
|
|
InterIConvertor*tpConvertor=dynamic_cast<InterIConvertor*>(pConvertor);
|
|
|
|
|
|
if(!tpConvertor) return true;
|
|
|
|
|
|
QString outputfilename=GenerateSlfFileName(pCurrentInterfaceWidget);
|
|
|
|
|
|
if(outputfilename=="") {
|
|
|
|
|
|
QMessageBox::about(NULL,"提示","请先输入井名!");
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
vector<int> OutCurveNo;
|
|
|
|
|
|
vector<char*> OutCurve;
|
|
|
|
|
|
vector<char*> strChineseName;
|
|
|
|
|
|
vector<char*> strUnit;
|
|
|
|
|
|
QLineEdit *edittop=pCurrentInterfaceWidget->GetEditTopDepth();
|
|
|
|
|
|
QLineEdit *editbottom=pCurrentInterfaceWidget->GetEditBottomDepth();
|
|
|
|
|
|
QTableWidget *tableWidget=pCurrentInterfaceWidget->GetDataSelectAreaWidget();
|
|
|
|
|
|
iRow=tableWidget->rowCount();
|
|
|
|
|
|
for (int i=0;i<iRow;i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
Qt::CheckState eState=Qt::Unchecked;
|
|
|
|
|
|
if(!tableWidget->item(i,0)) {
|
|
|
|
|
|
char *curvename = new char[10];
|
|
|
|
|
|
strcpy(curvename, "ERROR");
|
|
|
|
|
|
OutCurve.push_back(curvename);
|
|
|
|
|
|
strChineseName.push_back(curvename);
|
|
|
|
|
|
char *curveunit = new char[10];
|
|
|
|
|
|
strcpy(curveunit,"");
|
|
|
|
|
|
strUnit.push_back(curveunit);
|
|
|
|
|
|
OutCurveNo.push_back(-1);
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
eState=tableWidget->item(i,0)->checkState();
|
|
|
|
|
|
if (eState==Qt::Checked)
|
|
|
|
|
|
{
|
|
|
|
|
|
//修改曲线单位
|
|
|
|
|
|
OutCurveNo.push_back(i);
|
|
|
|
|
|
}
|
|
|
|
|
|
else OutCurveNo.push_back(-1);
|
|
|
|
|
|
|
|
|
|
|
|
QString tstr=tableWidget->item(i,3)->text();
|
|
|
|
|
|
char *curvename = new char[strlen(tstr.toStdString().c_str())+10];
|
|
|
|
|
|
strcpy(curvename,tstr.toStdString().c_str());
|
|
|
|
|
|
OutCurve.push_back(curvename);
|
|
|
|
|
|
strChineseName.push_back(curvename);
|
|
|
|
|
|
tstr=tableWidget->item(i,4)->text();
|
|
|
|
|
|
char *curveunit = new char[strlen(tstr.toStdString().c_str())+10];
|
|
|
|
|
|
strcpy(curveunit,tstr.toStdString().c_str());
|
|
|
|
|
|
strUnit.push_back(curveunit);
|
|
|
|
|
|
}
|
|
|
|
|
|
if(tpConvertor->m_TableName.isEmpty()&&IsHaveSameCurve(iRow,OutCurveNo,OutCurve)){
|
|
|
|
|
|
for(int i=0;i<OutCurveNo.size();i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
delete OutCurve[i];
|
|
|
|
|
|
delete strUnit[i];
|
|
|
|
|
|
}
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
int HaveOut=1;
|
|
|
|
|
|
if(tpConvertor->m_TableName.isEmpty()) {
|
|
|
|
|
|
//HaveOut=CheckExistCurve(outputfilename,iRow,OutCurveNo,OutCurve);
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
vector<int> OutCurveNo;
|
|
|
|
|
|
vector<char*> OutCurve;
|
|
|
|
|
|
OutCurveNo.push_back(0);
|
|
|
|
|
|
char *buf=new char[strlen(tpConvertor->m_TableName.toStdString().c_str())+1];
|
|
|
|
|
|
strcpy(buf,tpConvertor->m_TableName.toStdString().c_str());
|
|
|
|
|
|
OutCurve.push_back(buf);
|
|
|
|
|
|
// HaveOut=CheckExistCurve(outputfilename,1,OutCurveNo,OutCurve);
|
|
|
|
|
|
delete buf;
|
|
|
|
|
|
}
|
|
|
|
|
|
if(HaveOut==0){
|
|
|
|
|
|
for(int i=0;i<OutCurveNo.size();i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
delete OutCurve[i];
|
|
|
|
|
|
delete strUnit[i];
|
|
|
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if(HaveOut<0)
|
|
|
|
|
|
{
|
|
|
|
|
|
for(int i=0;i<OutCurveNo.size();i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
delete OutCurve[i];
|
|
|
|
|
|
delete strUnit[i];
|
|
|
|
|
|
}
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
//此时测井专业模块开始执行,输出为slf文件
|
|
|
|
|
|
char *outfile = new char[outputfilename.toStdString().size()+300];
|
|
|
|
|
|
strcpy(outfile, outputfilename.toStdString().c_str());
|
|
|
|
|
|
|
|
|
|
|
|
char *logfilename = new char[m_FilePath.toStdString().size()+1];
|
|
|
|
|
|
|
|
|
|
|
|
strcpy(logfilename, m_FilePath.toStdString().c_str());
|
|
|
|
|
|
|
|
|
|
|
|
QLineEdit * xEdit=pCurrentInterfaceWidget->GetXCodeLineEdit();
|
|
|
|
|
|
QLineEdit * yEdit=pCurrentInterfaceWidget->GetYCodeLineEdit();
|
|
|
|
|
|
|
|
|
|
|
|
int l=strlen(outfile)+1;
|
|
|
|
|
|
strcpy(&outfile[l],xEdit->text().toStdString().c_str());//x坐标
|
|
|
|
|
|
|
|
|
|
|
|
l+=strlen(&outfile[l])+1;
|
|
|
|
|
|
strcpy(&outfile[l],yEdit->text().toStdString().c_str());//y坐标
|
|
|
|
|
|
|
|
|
|
|
|
QString top=edittop->text();
|
|
|
|
|
|
l+=strlen(&outfile[l])+1;
|
|
|
|
|
|
strcpy(&outfile[l],top.toStdString().c_str());//y坐标
|
|
|
|
|
|
|
|
|
|
|
|
QString bottom=editbottom->text();
|
|
|
|
|
|
l+=strlen(&outfile[l])+1;
|
|
|
|
|
|
strcpy(&outfile[l],bottom.toStdString().c_str());//y坐标
|
|
|
|
|
|
//TODO
|
|
|
|
|
|
l+=strlen(&outfile[l])+1;
|
|
|
|
|
|
*(int*)&outfile[l]=iRow;
|
|
|
|
|
|
if(((InterIConvertor*)(pCurrentInterfaceWidget->m_pConvertor))->Transfer(logfilename,outfile,&OutCurveNo[0],&OutCurve[0],&strChineseName[0],&strUnit[0],iRow))
|
|
|
|
|
|
{
|
|
|
|
|
|
MyWelllogRound *wellRound=pCurrentInterfaceWidget->m_pConvertor->GetWellLogRoundInfo();
|
|
|
|
|
|
if(wellRound) {
|
|
|
|
|
|
((InterIConvertor*)(pCurrentInterfaceWidget->m_pConvertor))->InitWellInfo(outfile);
|
|
|
|
|
|
wellRound->SaveMeesge(outfile);
|
|
|
|
|
|
}
|
2026-03-27 21:26:43 +08:00
|
|
|
|
// CDataImport::ChangetoSlf(outfile,NULL);
|
|
|
|
|
|
ChangetoSlf(outfile,NULL,true);
|
2025-10-29 17:23:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
for(int i=0;i<OutCurveNo.size();i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
delete OutCurve[i];
|
|
|
|
|
|
delete strUnit[i];
|
|
|
|
|
|
}
|
|
|
|
|
|
delete []logfilename;
|
|
|
|
|
|
delete []outfile;
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QString ImportDataDialog::GenerateSlfFileName(InterfaceWidget *pCurrentInterfaceWidget)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString wellname=pCurrentInterfaceWidget->GetWellNameLineEdit()->text();
|
|
|
|
|
|
if(wellname.isEmpty()) return "";
|
|
|
|
|
|
wellname=wellname.toUpper();
|
|
|
|
|
|
QString filename=pCurrentInterfaceWidget->GetWellRoundNameLineEdit()->text();
|
|
|
|
|
|
if(filename.isEmpty()) filename=wellname;
|
|
|
|
|
|
filename=filename.toUpper();
|
|
|
|
|
|
// //CObjProject *pPrj=::GetProject();
|
|
|
|
|
|
// if(!m_CurrentWellRoundName.isEmpty()) {
|
|
|
|
|
|
// int ret=QMessageBox::No;
|
|
|
|
|
|
// if(m_CurrentWellRoundName.compare(filename,Qt::CaseInsensitive)!=0)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// ret=QMessageBox::warning(NULL,"提示","输入文件名与选中的井次名不一致,您确信要创建新井名?",QMessageBox::Yes,QMessageBox::No);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if(ret==QMessageBox::No) {
|
|
|
|
|
|
// CObjWelllogRound *pWR=dynamic_cast<CObjWelllogRound*>(pPrj->GetObjectByName(m_CurrentWellRoundName,GetClassID_WellLogRound()));
|
|
|
|
|
|
// if(pWR)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// QString welln=pWR->GetSlfFileName();
|
|
|
|
|
|
// if(!welln.isEmpty()) return welln;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// PaiObject *pObj=pPrj->GetObjectByName(wellname,GetClassID_Well());
|
|
|
|
|
|
// CObjWell *pWell=dynamic_cast<CObjWell *>(pObj);
|
|
|
|
|
|
// if(pWell) {
|
|
|
|
|
|
// QString slf=pWell->GetWellMessageFileName();
|
|
|
|
|
|
// QString welln,path;
|
|
|
|
|
|
// GetWellNameAndPath(slf,welln,path);
|
|
|
|
|
|
// welln=path+"\\"+filename;
|
|
|
|
|
|
// welln+=".slf";
|
|
|
|
|
|
// filename=welln;
|
|
|
|
|
|
// return welln;
|
|
|
|
|
|
// }
|
|
|
|
|
|
/*
|
|
|
|
|
|
//Type(GetClassID_WellsFolder());
|
|
|
|
|
|
QList<PaiObject *> childs;
|
|
|
|
|
|
pObj->GetChildren(childs);
|
|
|
|
|
|
int wellnum=childs.count();
|
|
|
|
|
|
foreach(PaiObject *pChild,childs)
|
|
|
|
|
|
{
|
|
|
|
|
|
CObjWell *pWell=dynamic_cast<CObjWell*>(pChild);
|
|
|
|
|
|
if(pWell)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString well=pWell->GetName().toUpper();
|
|
|
|
|
|
if(well==wellname)
|
|
|
|
|
|
{
|
|
|
|
|
|
QList<PaiObject *> childsRound;
|
|
|
|
|
|
pChild->GetChildren(childsRound);
|
|
|
|
|
|
foreach(PaiObject *pChildRound,childsRound)
|
|
|
|
|
|
{
|
|
|
|
|
|
CObjWelllogRound *pWellRound=dynamic_cast<CObjWelllogRound*>(pChildRound);
|
|
|
|
|
|
if(pWellRound)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString file=pWellRound->GetName().toUpper();
|
|
|
|
|
|
if(file==filename)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString outname=pWellRound->GetSlfFileName();
|
|
|
|
|
|
return outname;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#pragma endregion 检查该井名文件名是否存在
|
|
|
|
|
|
*/
|
|
|
|
|
|
// QString strWellName="";
|
|
|
|
|
|
// CObjProject *pProject = ::GetProject();
|
|
|
|
|
|
// if(pProject != NULL)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// strWellName = pProject->GetName();
|
|
|
|
|
|
// }
|
|
|
|
|
|
// QString dir=::GetLogdataPath();
|
|
|
|
|
|
// QDir w;
|
|
|
|
|
|
// if(!strWellName.isEmpty()) {
|
|
|
|
|
|
// dir=dir+strWellName;
|
|
|
|
|
|
// w.mkdir(dir);
|
|
|
|
|
|
// dir+=QDir::separator();
|
|
|
|
|
|
// }
|
|
|
|
|
|
// dir+="#"+wellname;
|
|
|
|
|
|
// bool a=w.mkdir(dir);
|
|
|
|
|
|
|
|
|
|
|
|
// QFileInfo temDir(filename);
|
|
|
|
|
|
// QString tempWellName=temDir.completeBaseName();
|
|
|
|
|
|
// QString ss=dir+QDir::separator()+tempWellName+".slf";
|
|
|
|
|
|
// return ss;
|
|
|
|
|
|
// "D:/LogPlus/LogData/例子2/#JPH-307-1/JPH-307-1.slf";
|
|
|
|
|
|
// QString wellSlfFile = "D:/LogPlus/LogData/";
|
|
|
|
|
|
// wellSlfFile +=m_projectname + "/"+"#"+wellname + "/" + filename +".slf";
|
|
|
|
|
|
QString wellSlfFile = GetLogdataPath() +m_projectname + "/"+"#"+wellname + "/" + filename +".slf";
|
|
|
|
|
|
return wellSlfFile;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
END_OSGGRAPHICS_NAMESPACE;
|
|
|
|
|
|
|
|
|
|
|
|
|