330 lines
12 KiB
C++
330 lines
12 KiB
C++
#include "Well.h"
|
|
#include "../include/WelllogRound.h"
|
|
// #include "orm/sqlite/Persistence.h"
|
|
// #include "orm/gen/Well.h"
|
|
// #include "orm/gen/Wellloground.h"
|
|
#include <string>
|
|
|
|
// using namespace pai::error;
|
|
// using namespace pai::turtle;
|
|
using namespace std;
|
|
|
|
namespace pai {
|
|
namespace ios {
|
|
namespace welllog {
|
|
|
|
|
|
Well::Well(const Well& well):DataObject(well),m_AreaName(well.GetAreaName()), m_CompanyName(well.GetCompanyName()),
|
|
m_WellType(well.GetWellType()),m_XCode(well.GetXCode()),
|
|
m_YCode(well.GetYCode()),m_Asl(well.GetAsl()),m_Bsl(well.GetBsl()),m_SDrillDate(well.GetSDrillDate()),
|
|
m_EDrillDate(well.GetEDrillDate()),m_CompleteDate(well.GetCompleteDate()),m_CWMethod(well.GetCWMethod()),
|
|
m_Bit1Prog(well.GetBit1Prog()),m_Bit2Prog(well.GetBit2Prog()),m_Bit3Prog(well.GetBit3Prog()),m_Bit4Prog(well.GetBit4Prog()),
|
|
m_Bit5Prog(well.GetBit5Prog()),m_Cas1Prog(well.GetCas1Prog()),m_Cas2Prog(well.GetCas2Prog()),m_Cas3Prog(well.GetCas3Prog()),
|
|
m_Cas4Prog(well.GetCas4Prog()),m_Cas5Prog(well.GetCas5Prog()),m_Cas1Shot(well.GetCas1Shot()),m_SC1SDep(well.GetSC1SDep()),
|
|
m_SC1EDep(well.GetSC1EDep()),m_Cas2Shot(well.GetCas2Shot()),m_SC2SDep(well.GetSC2SDep()),m_SC2EDep(well.GetSC2EDep()),
|
|
m_Remark(well.GetRemark()),m_Points(well.GetPoint()),m_name(well.m_name)
|
|
{
|
|
filemessage=well.filemessage;
|
|
}
|
|
|
|
Well & Well::operator=(const Well& well)
|
|
{
|
|
if(this == &well)
|
|
return *this;
|
|
DataObject::operator=(well);
|
|
this->SetAreaName(well.GetAreaName());
|
|
this->SetCompanyName(well.GetCompanyName());
|
|
this->SetWellType(well.GetWellType());
|
|
this->SetXCode(well.GetXCode());
|
|
this->SetYCode(well.GetYCode());
|
|
this->SetAsl(well.GetAsl());
|
|
this->SetBsl(well.GetBsl());
|
|
this->SetSDrillDate(well.GetSDrillDate());
|
|
this->SetEDrillDate(well.GetEDrillDate());
|
|
this->SetCompleteDate(well.GetCompleteDate());
|
|
this->SetCWMethod(well.GetCWMethod());
|
|
this->SetBit1Prog(well.GetBit1Prog());
|
|
this->SetBit2Prog(well.GetBit2Prog());
|
|
this->SetBit3Prog(well.GetBit3Prog());
|
|
this->SetBit4Prog(well.GetBit4Prog());
|
|
this->SetBit5Prog(well.GetBit5Prog());
|
|
this->SetCas1Prog(well.GetCas1Prog());
|
|
this->SetCas2Prog(well.GetCas2Prog());
|
|
this->SetCas3Prog(well.GetCas3Prog());
|
|
this->SetCas4Prog(well.GetCas4Prog());
|
|
this->SetCas5Prog(well.GetCas5Prog());
|
|
this->SetCas1Shot(well.GetCas1Shot());
|
|
this->SetSC1SDep(well.GetSC1SDep());
|
|
this->SetSC1EDep(well.GetSC1EDep());
|
|
this->SetCas2Shot(well.GetCas2Shot());
|
|
this->SetSC2SDep(well.GetSC2SDep());
|
|
this->SetSC2EDep(well.GetSC2EDep());
|
|
this->SetRemark(well.GetRemark());
|
|
this->SetPoint(well.GetPoint());
|
|
return *this;
|
|
}
|
|
|
|
void Well::Save()
|
|
{
|
|
// pai::orm::Well well;
|
|
|
|
// well.SetProjectId(this->GetDataBelongID());
|
|
// well.SetAreaName(m_AreaName);
|
|
// well.SetCompanyName(m_CompanyName);
|
|
// well.SetWellName(this->GetName());
|
|
// well.SetWellType(m_WellType);
|
|
// well.SetXCoordinate(m_XCode);
|
|
// well.SetYCoordinate(m_YCode);
|
|
// well.SetAsl(m_Asl);
|
|
// well.SetBsl(m_Bsl);
|
|
// well.SetDateSdrill(m_SDrillDate);
|
|
// well.SetDateEdrill(m_EDrillDate);
|
|
// well.SetDateComplete(m_CompleteDate);
|
|
// well.SetMethodCwell(m_CWMethod);
|
|
// well.SetBit1Prog(m_Bit1Prog);
|
|
// well.SetBit2Prog(m_Bit2Prog);
|
|
// well.SetBit3Prog(m_Bit3Prog);
|
|
// well.SetBit4Prog(m_Bit4Prog);
|
|
// well.SetBit5Prog(m_Bit5Prog);
|
|
// well.SetCas1Prog(m_Cas1Prog);
|
|
// well.SetCas2Prog(m_Cas2Prog);
|
|
// well.SetCas3Prog(m_Cas3Prog);
|
|
// well.SetCas4Prog(m_Cas4Prog);
|
|
// well.SetCas5Prog(m_Cas5Prog);
|
|
// well.SetShotCas1(m_Cas1Shot);
|
|
// well.SetSc1Sdep(m_SC1SDep);
|
|
// well.SetSc1Edep(m_SC1EDep);
|
|
// well.SetShotCas2(m_Cas2Shot);
|
|
// well.SetSc2Sdep(m_SC2SDep);
|
|
// well.SetSc2Edep(m_SC2EDep);
|
|
// well.SetRemark(m_Remark);
|
|
// //存入井轨迹点
|
|
// size_t bufferLength = sizeof(size_t) + m_Points.size()*sizeof(Point);
|
|
// char *buffer = new char[bufferLength];
|
|
// size_t pointSize = m_Points.size();
|
|
|
|
// memcpy(buffer, &pointSize, sizeof(size_t));
|
|
// if (pointSize > 0)
|
|
// {
|
|
// memcpy(buffer+sizeof(size_t), reinterpret_cast<char*>(&(m_Points[0])), m_Points.size()*sizeof(Point));
|
|
// }
|
|
// pai::orm::Blob blob;
|
|
// blob.FromBuffer(buffer, bufferLength);
|
|
// if (buffer != NULL)
|
|
// {
|
|
// delete[] buffer;
|
|
// buffer = NULL;
|
|
// }
|
|
|
|
// well.SetTrajectory(blob);
|
|
|
|
// pai::orm::sqlite::Persistence &pdb = pai::orm::sqlite::Persistence::Get();
|
|
// long long wlogId = pdb.Persist(well, true);
|
|
// this->SetDataID(wlogId);
|
|
}
|
|
|
|
void Well::Get(long long id)
|
|
{
|
|
// if(id <= 0)
|
|
// {
|
|
// std::stringstream ss;
|
|
// ss << PAI_CURRENT_FUNCTION << ": WelllogID <= 0.";
|
|
// throw pai::error::db_error(ss.str(), ERR_PARAMETER_ERROR);
|
|
// }
|
|
|
|
// pai::orm::Well well;
|
|
// pai::orm::sqlite::Persistence &pdb = pai::orm::sqlite::Persistence::Get();
|
|
// pdb.Load(pai::orm::Well::Well_id == id, well, true);
|
|
|
|
// this->SetDataID(well.GetWellId());
|
|
// this->SetDataBelongID(well.GetProjectId());
|
|
// this->SetAreaName(well.GetAreaName());
|
|
// this->SetCompanyName(well.GetCompanyName());
|
|
// this->SetName(well.GetWellName());
|
|
// this->SetWellType(well.GetWellType());
|
|
// this->SetXCode(well.GetXCoordinate());
|
|
// this->SetYCode(well.GetYCoordinate());
|
|
// this->SetAsl(well.GetAsl());
|
|
// this->SetBsl(well.GetBsl());
|
|
// this->SetSDrillDate(well.GetDateSdrill());
|
|
// this->SetEDrillDate(well.GetDateEdrill());
|
|
// this->SetCompleteDate(well.GetDateComplete());
|
|
// this->SetCWMethod(well.GetMethodCwell());
|
|
// this->SetBit1Prog(well.GetBit1Prog());
|
|
// this->SetBit2Prog(well.GetBit2Prog());
|
|
// this->SetBit3Prog(well.GetBit3Prog());
|
|
// this->SetBit4Prog(well.GetBit4Prog());
|
|
// this->SetBit5Prog(well.GetBit5Prog());
|
|
// this->SetCas1Prog(well.GetCas1Prog());
|
|
// this->SetCas2Prog(well.GetCas2Prog());
|
|
// this->SetCas3Prog(well.GetCas3Prog());
|
|
// this->SetCas4Prog(well.GetCas4Prog());
|
|
// this->SetCas5Prog(well.GetCas5Prog());
|
|
// this->SetCas1Shot(well.GetShotCas1());
|
|
// this->SetSC1SDep(well.GetSc1Sdep());
|
|
// this->SetSC1EDep(well.GetSc1Edep());
|
|
// this->SetCas2Shot(well.GetShotCas2());
|
|
// this->SetSC2SDep(well.GetSc2Sdep());
|
|
// this->SetSC2EDep(well.GetSc2Edep());
|
|
// this->SetRemark(well.GetRemark());
|
|
// //获取井轨迹点
|
|
// pai::orm::Blob blob;
|
|
// blob = well.GetTrajectory();
|
|
// char *buffer = blob.GetData();
|
|
|
|
// size_t pointSize;
|
|
// memcpy(&pointSize, buffer,sizeof(size_t));
|
|
// if (pointSize > 0)
|
|
// {
|
|
// m_Points.resize(pointSize);
|
|
// memcpy(&(m_Points[0]), buffer+sizeof(size_t), sizeof(Point)*pointSize);
|
|
// }
|
|
}
|
|
|
|
void Well::Update()
|
|
{
|
|
// pai::orm::Well well;
|
|
// well.SetWellId(this->GetDataID());
|
|
// well.SetProjectId(this->GetDataBelongID());
|
|
// well.SetAreaName(m_AreaName);
|
|
// well.SetCompanyName(m_CompanyName);
|
|
// well.SetWellName(this->GetName());
|
|
// well.SetWellType(m_WellType);
|
|
// well.SetXCoordinate(m_XCode);
|
|
// well.SetYCoordinate(m_YCode);
|
|
// well.SetAsl(m_Asl);
|
|
// well.SetBsl(m_Bsl);
|
|
// well.SetDateSdrill(m_SDrillDate);
|
|
// well.SetDateEdrill(m_EDrillDate);
|
|
// well.SetDateComplete(m_CompleteDate);
|
|
// well.SetMethodCwell(m_CWMethod);
|
|
// well.SetBit1Prog(m_Bit1Prog);
|
|
// well.SetBit2Prog(m_Bit2Prog);
|
|
// well.SetBit3Prog(m_Bit3Prog);
|
|
// well.SetBit4Prog(m_Bit4Prog);
|
|
// well.SetBit5Prog(m_Bit5Prog);
|
|
// well.SetCas1Prog(m_Cas1Prog);
|
|
// well.SetCas2Prog(m_Cas2Prog);
|
|
// well.SetCas3Prog(m_Cas3Prog);
|
|
// well.SetCas4Prog(m_Cas4Prog);
|
|
// well.SetCas5Prog(m_Cas5Prog);
|
|
// well.SetShotCas1(m_Cas1Shot);
|
|
// well.SetSc1Sdep(m_SC1SDep);
|
|
// well.SetSc1Edep(m_SC1EDep);
|
|
// well.SetShotCas2(m_Cas2Shot);
|
|
// well.SetSc2Sdep(m_SC2SDep);
|
|
// well.SetSc2Edep(m_SC2EDep);
|
|
// well.SetRemark(m_Remark);
|
|
// //存入井轨迹点
|
|
// size_t bufferLength = sizeof(size_t) + m_Points.size()*sizeof(Point);
|
|
// char *buffer = new char[bufferLength];
|
|
// size_t pointSize = m_Points.size();
|
|
// memcpy(buffer, &pointSize, sizeof(size_t));
|
|
// if (pointSize > 0)
|
|
// {
|
|
// memcpy(buffer+sizeof(size_t), reinterpret_cast<char*>(&(m_Points[0])), m_Points.size()*sizeof(Point));
|
|
// }
|
|
// pai::orm::Blob blob;
|
|
// blob.FromBuffer(buffer, bufferLength);
|
|
// if (buffer != NULL)
|
|
// {
|
|
// delete[] buffer;
|
|
// buffer = NULL;
|
|
// }
|
|
|
|
// well.SetTrajectory(blob);
|
|
|
|
// pai::orm::sqlite::Persistence &pdb = pai::orm::sqlite::Persistence::Get();
|
|
// pdb.Update(well, true);
|
|
}
|
|
|
|
void Well::Delete(long long id)
|
|
{
|
|
// if(id <= 0)
|
|
// {
|
|
// std::stringstream ss;
|
|
// ss << PAI_CURRENT_FUNCTION << ": WellID <= 0.";
|
|
// throw pai::error::db_error(ss.str(), ERR_PARAMETER_ERROR);
|
|
// }
|
|
|
|
// pai::orm::sqlite::Persistence &pdb = pai::orm::sqlite::Persistence::Get();
|
|
|
|
// pdb.Delete<pai::orm::Well>(pai::orm::Well::Well_id == id);
|
|
}
|
|
|
|
void Well::GetWelllogRound(std::vector<WelllogRound>& infos)
|
|
{
|
|
// pai::orm::sqlite::Persistence &pdb = pai::orm::sqlite::Persistence::Get();
|
|
|
|
// vector<pai::orm::Wellloground> wRounds;
|
|
|
|
// pdb.Load((pai::orm::Wellloground::Well_id == this->GetDataID()), wRounds);
|
|
// for(size_t i = 0; i < wRounds.size(); i++)
|
|
// {
|
|
// WelllogRound welllogRound;
|
|
// welllogRound.SetDataID(wRounds[i].GetWelllogroundId());
|
|
// welllogRound.SetDataBelongID(wRounds[i].GetWellId());
|
|
// welllogRound.SetName(wRounds[i].GetWelllogroundName());
|
|
// welllogRound.SetCompanyName(wRounds[i].GetLogCompanyName());
|
|
// welllogRound.SetTeam(wRounds[i].GetTeam());
|
|
// welllogRound.SetOperator(wRounds[i].GetOperator());
|
|
// welllogRound.SetDate(wRounds[i].GetDate());
|
|
// welllogRound.SetSerial(wRounds[i].GetSerial());
|
|
// welllogRound.SetItem(wRounds[i].GetItem());
|
|
// welllogRound.SetMudType(wRounds[i].GetMudType());
|
|
// welllogRound.SetMudViscosity(wRounds[i].GetMudViscosity());
|
|
// welllogRound.SetWaterLoss(wRounds[i].GetWaterLoss());
|
|
// welllogRound.SetDensity(wRounds[i].GetMudDensity());
|
|
// welllogRound.SetResi(wRounds[i].GetMudResi());
|
|
// welllogRound.SetTemp(wRounds[i].GetMudTemp());
|
|
// welllogRound.SetINTLog(wRounds[i].GetIntLog());
|
|
// welllogRound.SetNITINT(wRounds[i].GetNitInt());
|
|
// welllogRound.SetTempBot(wRounds[i].GetTempBot());
|
|
// welllogRound.SetIntProg(wRounds[i].GetIntProg());
|
|
// welllogRound.SetInteDress(wRounds[i].GetInteDress());
|
|
// welllogRound.SetAudit(wRounds[i].GetAudit());
|
|
// welllogRound.SetRemark(wRounds[i].GetRemark());
|
|
// infos.push_back(welllogRound);
|
|
// }
|
|
}
|
|
|
|
void Well::SaveWelllogRound(std::vector<WelllogRound>& welllogrounds)
|
|
{
|
|
// std::vector<pai::orm::Wellloground> ormwelllogrounds;
|
|
// pai::orm::Wellloground ormwellloground;
|
|
// for(size_t i = 0; i < welllogrounds.size(); ++i)
|
|
// {
|
|
// ormwellloground.SetWelllogroundId(welllogrounds[i].GetDataID());
|
|
// ormwellloground.SetWellId(welllogrounds[i].GetDataBelongID());
|
|
// ormwellloground.SetWelllogroundName(welllogrounds[i].GetName());
|
|
// ormwellloground.SetLogCompanyName(welllogrounds[i].GetCompanyName());
|
|
// ormwellloground.SetTeam(welllogrounds[i].GetTeam());
|
|
// ormwellloground.SetOperator(welllogrounds[i].GetOperator());
|
|
// ormwellloground.SetDate(welllogrounds[i].GetDate());
|
|
// ormwellloground.SetSerial(welllogrounds[i].GetSerial());
|
|
// ormwellloground.SetItem(welllogrounds[i].GetItem());
|
|
// ormwellloground.SetMudType(welllogrounds[i].GetMudType());
|
|
// ormwellloground.SetMudViscosity(welllogrounds[i].GetMudViscosity());
|
|
// ormwellloground.SetWaterLoss(welllogrounds[i].GetWaterLoss());
|
|
// ormwellloground.SetMudDensity(welllogrounds[i].GetDensity());
|
|
// ormwellloground.SetMudResi(welllogrounds[i].GetResi());
|
|
// ormwellloground.SetMudTemp(welllogrounds[i].GetTemp());
|
|
// ormwellloground.SetIntLog(welllogrounds[i].GetINTLog());
|
|
// ormwellloground.SetNitInt(welllogrounds[i].GetNITINT());
|
|
// ormwellloground.SetTempBot(welllogrounds[i].GetTempBot());
|
|
// ormwellloground.SetIntProg(welllogrounds[i].GetIntProg());
|
|
// ormwellloground.SetInteDress(welllogrounds[i].GetInteDress());
|
|
// ormwellloground.SetAudit(welllogrounds[i].GetAudit());
|
|
// ormwellloground.SetRemark(welllogrounds[i].GetRemark());
|
|
|
|
// ormwelllogrounds.push_back(ormwellloground);
|
|
// }
|
|
|
|
// pai::orm::sqlite::Persistence &pdb = pai::orm::sqlite::Persistence::Get();
|
|
// pdb.Persist(ormwelllogrounds);
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|