|
|
|
|
#include "zxLogInstance.h"
|
|
|
|
|
|
|
|
|
|
#include "ZxDataProject.h"
|
|
|
|
|
#include "ZxDataWell.h"
|
|
|
|
|
#include "nmDataDemo.h"
|
|
|
|
|
#include "nmDataUtils.h"
|
|
|
|
|
|
|
|
|
|
nmDataUtils::nmDataUtils()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nmDataUtils::~nmDataUtils()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool nmDataUtils::extendChildrenOfProj(ZxDataProject* pDataProj)
|
|
|
|
|
{
|
|
|
|
|
Q_ASSERT (NULL != pDataProj);
|
|
|
|
|
|
|
|
|
|
/* 如下代码只是参照,请根据具体需求咨询框架负责人员后进行处理
|
|
|
|
|
|
|
|
|
|
pDataObj->clearChildren(iDataModelType::sTypePvtInfo);
|
|
|
|
|
|
|
|
|
|
// load Job PVTs
|
|
|
|
|
QString sSql = "Select PvtID, PvtName, JobID from V_PVT_INFO";
|
|
|
|
|
sSql += QString(" order by PvtID");
|
|
|
|
|
VVecVariant vvec;
|
|
|
|
|
QString sLog = "";
|
|
|
|
|
if (_load(sSql, vvec, sLog, false, true))
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < vvec.count(); i++)
|
|
|
|
|
{
|
|
|
|
|
ZxDataPvtInfo* p = new ZxDataPvtInfo();
|
|
|
|
|
Q_ASSERT (NULL != p);
|
|
|
|
|
p->setCode(vvec.at(i).at(0).toString());
|
|
|
|
|
p->setName(vvec.at(i).at(1).toString());
|
|
|
|
|
p->setJobID(vvec.at(i).at(2).toString());
|
|
|
|
|
p->createChildren();
|
|
|
|
|
appendChild(p);
|
|
|
|
|
p->setLoaded(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (!sLog.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
zxLogRunW(QObject::tr("Failed to load PVTInfo with \r\n '%1'").arg(sLog));
|
|
|
|
|
return false;
|
|
|
|
|
}//*/
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool nmDataUtils::extendChildrenOfWell(ZxDataWell* pDataWell)
|
|
|
|
|
{
|
|
|
|
|
Q_ASSERT (NULL != pDataWell);
|
|
|
|
|
|
|
|
|
|
// 此处仅仅以获取样表举例 Alias="n数值样例数据表" Name="N_DATA_DEMO"
|
|
|
|
|
QString sWellCode = pDataWell->getCode();
|
|
|
|
|
QString sSql = "Select distinct ID from N_DATA_DEMO";
|
|
|
|
|
sSql += QString(" where WellCode = '%1'").arg(sWellCode);
|
|
|
|
|
sSql += QString(" order by ID");
|
|
|
|
|
VVecVariant vvec;
|
|
|
|
|
QString sLog = "";
|
|
|
|
|
if (pDataWell->loadData(sSql, vvec, sLog, false))
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < vvec.count(); i++)
|
|
|
|
|
{
|
|
|
|
|
nmDataDemo* p = new nmDataDemo();
|
|
|
|
|
Q_ASSERT (NULL != p);
|
|
|
|
|
p->setCode(vvec.at(i).at(0).toString());
|
|
|
|
|
p->setWellCode(sWellCode);
|
|
|
|
|
pDataWell->appendChild(p);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (!sLog.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
zxLogRunW(QObject::tr("Failed to load nmDataDemo with \r\n '%1'").arg(sLog));
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|