2238 lines
56 KiB
C++
2238 lines
56 KiB
C++
#include "StdAfx.h"
|
|
#include "aecPipeSupport.h"
|
|
#include "EarThwormDef.h"
|
|
#include "KTModelLayoutXData.h"
|
|
#include "coretools.h"
|
|
|
|
TDbPipeSupport::TDbPipeSupport(void)
|
|
{
|
|
}
|
|
|
|
TDbPipeSupport::~TDbPipeSupport(void)
|
|
{
|
|
}
|
|
|
|
double TDbPipeSupport::MakeSureMMUnit(double& dDn)
|
|
{
|
|
return CoreTools::MakeSureMMUnit(dDn);
|
|
}
|
|
|
|
BOOL TDbPipeSupport::XData2PipeParam(WPipe::PipeParam* pParamL,const AecDbObjXDataMap* pXDataMapSrc)
|
|
{
|
|
//D
|
|
double dVal = 100.0;
|
|
pXDataMapSrc->GetAt(PIPE_D,dVal);
|
|
pParamL->m_dD = dVal;
|
|
|
|
//eD
|
|
int nDir = 0;
|
|
pXDataMapSrc->GetAt(PIPE_DRAWDIR,nDir);
|
|
pParamL->m_eD = (WPipe::EDia)(nDir);
|
|
|
|
//DN
|
|
dVal = 100.0;
|
|
pXDataMapSrc->GetAt(PIPE_DN,dVal);
|
|
pParamL->m_dDN = dVal;
|
|
|
|
//OD
|
|
dVal = 100.0;
|
|
pXDataMapSrc->GetAt(PIPE_OD,dVal);
|
|
pParamL->m_dOD = dVal;
|
|
|
|
//Thick
|
|
dVal = 100.0;
|
|
pXDataMapSrc->GetAt(PIPE_THICK,dVal);
|
|
pParamL->m_dThick = dVal;
|
|
|
|
//补充风管壁厚
|
|
dVal = 0.0;
|
|
if ( pXDataMapSrc->GetAt(DUCT_THICK, dVal) )
|
|
pParamL->m_dThick = dVal;
|
|
|
|
//EL
|
|
|
|
//Ratio
|
|
dVal = 1.5;
|
|
pXDataMapSrc->GetAt(PIPE_RATIO,dVal);
|
|
pParamL->m_dRRatio = dVal;
|
|
|
|
pXDataMapSrc->GetAt(KEY_RadRatio, pParamL->m_nRadioOn);
|
|
pXDataMapSrc->GetAt(PIPE_ODSN, pParamL->szODSn);
|
|
if (!pXDataMapSrc->GetAt(PIPE_ODSN, pParamL->szODSn))
|
|
{
|
|
//兼容旧版本
|
|
pXDataMapSrc->GetAt(PIPE_OD_SN, pParamL->szODSn);
|
|
pParamL->szODSn[16] = _T('\0');
|
|
}
|
|
pXDataMapSrc->GetAt(PIPE_SHTNO, pParamL->szShtNo);
|
|
pXDataMapSrc->GetAt(PIPE_GASKET, pParamL->m_szGastInf);
|
|
|
|
//dW
|
|
dVal = 0.0;
|
|
pXDataMapSrc->GetAt(DUCT_W, dVal);
|
|
pParamL->m_dW = dVal;
|
|
|
|
//dH
|
|
dVal = 0.0;
|
|
pXDataMapSrc->GetAt(DUCT_H, dVal);
|
|
pParamL->m_dH = dVal;
|
|
|
|
//app
|
|
nDir = 0;
|
|
pXDataMapSrc->GetAt(PIPE_EAPP, nDir);
|
|
pParamL->m_app = (WPipe::EApp)nDir;
|
|
|
|
//nConnectType
|
|
nDir = 0;
|
|
pXDataMapSrc->GetAt(PIPE_CONNECT,nDir);
|
|
pParamL->m_nConnectType = nDir;
|
|
|
|
//dInterfaceL
|
|
dVal = 0.0;
|
|
pXDataMapSrc->GetAt(PIPE_INTERFACEL,dVal);
|
|
pParamL->m_dInterfaceL = dVal;
|
|
|
|
//dInterfaceD
|
|
dVal = 0.0;
|
|
pXDataMapSrc->GetAt(PIPE_INTERFACED,dVal);
|
|
pParamL->m_dInterfaceD = dVal;
|
|
|
|
//dInterfaceD2
|
|
dVal = 0.0;
|
|
pXDataMapSrc->GetAt(PIPE_INTERFACED2,dVal);
|
|
pParamL->m_dInterfaceD2 = dVal;
|
|
|
|
//dInterfaceL2
|
|
dVal = 0.0;
|
|
pXDataMapSrc->GetAt(PIPE_INTERFACEL2,dVal);
|
|
pParamL->m_dInterfaceL2 = dVal;
|
|
|
|
//dInsThk
|
|
dVal = 1.0;
|
|
pXDataMapSrc->GetAt(PIPE_INSTHICK,dVal);
|
|
pParamL->m_dInsThk = dVal;
|
|
|
|
//dInterfaceL3
|
|
dVal = 0.0;
|
|
pXDataMapSrc->GetAt(PIPE_INTERFACEL3,dVal);
|
|
pParamL->m_dInterfaceL3 = dVal;
|
|
|
|
//m_eRed
|
|
//m_vtECCen
|
|
//m_vtDir
|
|
//m_eElBase
|
|
|
|
//szPipeno
|
|
CString sVal;
|
|
pXDataMapSrc->GetAt(PIPE_NO,sVal);
|
|
_tcscpy(pParamL->szPipeno,sVal);
|
|
|
|
//szMertial
|
|
sVal = _T("");
|
|
pXDataMapSrc->GetAt(PIPE_MATERIAL,sVal);
|
|
_tcscpy(pParamL->szMertial,sVal);
|
|
|
|
//szMertialFit
|
|
sVal = _T("");
|
|
pXDataMapSrc->GetAt(PIPE_MATERIALFT,sVal);
|
|
_tcscpy(pParamL->szMertialFit,sVal);
|
|
|
|
//szZoneNo
|
|
sVal = _T("");
|
|
pXDataMapSrc->GetAt(PIPE_ZONE,sVal);
|
|
_tcscpy(pParamL->szZoneNo,sVal);
|
|
|
|
//szInsMtr
|
|
sVal = _T("");
|
|
pXDataMapSrc->GetAt(DOC_INSMATER,sVal);
|
|
_tcscpy(pParamL->szInsMtr,sVal);
|
|
|
|
//szDescr
|
|
sVal = _T("");
|
|
pXDataMapSrc->GetAt(PIPE_DESCR,sVal);
|
|
_tcscpy(pParamL->szDescr,sVal);
|
|
|
|
//szSys
|
|
sVal = _T("");
|
|
pXDataMapSrc->GetAt(PIPE_SYS,sVal);
|
|
_tcscpy(pParamL->szSys,sVal);
|
|
|
|
//m_nGroupID
|
|
//?
|
|
|
|
//LEVEL
|
|
sVal = _T("");
|
|
pXDataMapSrc->GetAt(PIPE_LEVEL,sVal);
|
|
_tcscpy(pParamL->szLevel,sVal);
|
|
|
|
dVal = 1.0;
|
|
pXDataMapSrc->GetAt(PID_PIPE_DPRESS,dVal);
|
|
pParamL->m_dPress = dVal;
|
|
|
|
//szZone
|
|
sVal = _T("");
|
|
pXDataMapSrc->GetAt(PIPE_ZONE,sVal);
|
|
_tcscpy(pParamL->szZone,sVal);
|
|
|
|
//szMedia
|
|
sVal = _T("");
|
|
pXDataMapSrc->GetAt(PIPE_MEDIA,sVal);
|
|
_tcscpy(pParamL->szMedia,sVal);
|
|
|
|
//szNo
|
|
sVal = _T("");
|
|
pXDataMapSrc->GetAt(PIPE_NO,sVal);
|
|
_tcscpy(pParamL->szNo,sVal);
|
|
|
|
//Spec
|
|
sVal = _T("");
|
|
pXDataMapSrc->GetAt(PIPE_SPEC,sVal);
|
|
_tcscpy(pParamL->szSpec,sVal);
|
|
|
|
//LineNo
|
|
sVal = _T("");
|
|
pXDataMapSrc->GetAt(PIPE_LINENO,sVal);
|
|
_tcscpy(pParamL->szLineNo,sVal);
|
|
|
|
//szInsTag
|
|
sVal = _T("");
|
|
pXDataMapSrc->GetAt(PIPE_INSTAG,sVal);
|
|
_tcscpy(pParamL->szInsTag,sVal);
|
|
|
|
//szInsDim
|
|
sVal = _T("");
|
|
pXDataMapSrc->GetAt(DOC_INSDIM,sVal);
|
|
_tcscpy(pParamL->szInsDim,sVal);
|
|
|
|
//szInsMateral
|
|
sVal = _T("");
|
|
pXDataMapSrc->GetAt(DOC_INSMATER,sVal);
|
|
_tcscpy(pParamL->szInsMateral,sVal);
|
|
|
|
//szInsSpec
|
|
sVal = _T("");
|
|
pXDataMapSrc->GetAt(DOC_INSSPEC,sVal);
|
|
_tcscpy(pParamL->szInsSpec,sVal);
|
|
|
|
//DOC_TRAMTOINF
|
|
sVal = _T("");
|
|
pXDataMapSrc->GetAt(DOC_TRAMTOINF,sVal);
|
|
_tcscpy(pParamL->szTraMtoInfo,sVal);
|
|
|
|
//szTraDescr
|
|
sVal = _T("");
|
|
pXDataMapSrc->GetAt(DOC_TRADESCR,sVal);
|
|
_tcscpy(pParamL->szTraDescr,sVal);
|
|
|
|
//szFitType
|
|
sVal = _T("");
|
|
pXDataMapSrc->GetAt(PIPE_FITTYPE,sVal);
|
|
_tcscpy(pParamL->szFitType,sVal);
|
|
|
|
//szMtoInfo
|
|
sVal = _T("");
|
|
pXDataMapSrc->GetAt(PIPE_MTOALL,sVal);
|
|
_tcscpy(pParamL->szMtoInfo,sVal);
|
|
|
|
//以下是全局设置信息,Param中没有对应
|
|
nDir = 0;
|
|
pXDataMapSrc->GetAt(KEY_2DSTYLE,nDir);
|
|
//??
|
|
|
|
nDir = 0;
|
|
pXDataMapSrc->GetAt(PIPE_COLOR,nDir);
|
|
pParamL->m_nPipeColor = nDir;
|
|
|
|
nDir = 0;
|
|
pXDataMapSrc->GetAt(KEY_SINGLE,nDir);
|
|
//??
|
|
|
|
dVal = 100;
|
|
pXDataMapSrc->GetAt(PIPE_TDN,dVal);
|
|
//??
|
|
|
|
dVal = 100.0;
|
|
pXDataMapSrc->GetAt(PIPE_TOD,dVal);
|
|
//??
|
|
|
|
nDir = 0;
|
|
pXDataMapSrc->GetAt(PIPE_ELBOWFLG,nDir);
|
|
//??
|
|
|
|
nDir = 0;
|
|
pXDataMapSrc->GetAt(PIPE_BWELDDOT,nDir);
|
|
//??
|
|
|
|
dVal = 1.0;
|
|
pXDataMapSrc->GetAt(DOC_PLOTWIDTH,dVal);
|
|
//??
|
|
|
|
dVal = 1.0;
|
|
pXDataMapSrc->GetAt(DOC_DPLOTWIDTH,dVal);
|
|
//??
|
|
|
|
dVal = 1.0;
|
|
pXDataMapSrc->GetAt(DOC_WELDDIA,dVal);
|
|
//??
|
|
|
|
dVal = 1.0;
|
|
pXDataMapSrc->GetAt(PIPE_PIDD,dVal);
|
|
//??
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryFitSpecInf(CUIISQLiteServer *pDb, double dDn, WPipe::FITSPEC& fitSpec,WPipe::Trade &eTrade, LPCTSTR pszFitName, LPCTSTR pszProName, LPCTSTR pszPreSpecName)
|
|
{
|
|
if (eTrade == WPipe::eCivial)//市政 不考虑等级 Z系列 暂 A
|
|
return FALSE;
|
|
|
|
/*
|
|
TCHAR szODSN[7]; //外径系列
|
|
TCHAR szShtNo[33]; //表号
|
|
TCHAR szStdNo[33]; //标准号
|
|
TCHAR szMat[33]; //材质
|
|
TCHAR szDesc[128]; //描述
|
|
*/
|
|
memset(&fitSpec, 0, sizeof(WPipe::FITSPEC));
|
|
|
|
CString sSQL, sTip;
|
|
|
|
BOOL bFind = FALSE;
|
|
if (pszProName != NULL && pszPreSpecName != NULL)
|
|
{
|
|
CStringArray arVals;
|
|
if (_tcscmp(pszFitName, _T("法兰")) == 0)
|
|
{
|
|
sSQL.Format(_T("select distinct [制造类型],[标准号],[材质],[描述] from AecSpecFlange where [项目名称]='%s' and [类别]='%s' and [等级名称]='%s' and [公称直径]=%d"), pszProName, pszFitName, pszPreSpecName, (int)(dDn + 0.5));
|
|
|
|
if (pDb->GetSelData(sSQL, arVals))
|
|
{
|
|
if (arVals.GetSize() >= 4)
|
|
{
|
|
_tcscpy(fitSpec.szODSN, _T("A"));
|
|
_tcscpy(fitSpec.szShtNo, arVals.GetAt(0));
|
|
_tcscpy(fitSpec.szStdNo, arVals.GetAt(1));
|
|
_tcscpy(fitSpec.szMat, arVals.GetAt(2));
|
|
_tcscpy(fitSpec.szDesc, arVals.GetAt(3));
|
|
bFind = TRUE;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
sSQL.Format(_T("select distinct [外径系列],[表号],[标准号],[材质],[描述] from AecSpecFit where [项目名称]='%s' and [类型]='%s' and [等级名称]='%s' and [公称直径]=%d"), pszProName, pszFitName, pszPreSpecName, (int)(dDn + 0.5));
|
|
|
|
if (pDb->GetSelData(sSQL, arVals))
|
|
{
|
|
if (arVals.GetSize() >= 5)
|
|
{
|
|
_tcscpy(fitSpec.szODSN, arVals.GetAt(0));
|
|
_tcscpy(fitSpec.szShtNo, arVals.GetAt(1));
|
|
_tcscpy(fitSpec.szStdNo, arVals.GetAt(2));
|
|
_tcscpy(fitSpec.szMat, arVals.GetAt(3));
|
|
_tcscpy(fitSpec.szDesc, arVals.GetAt(4));
|
|
bFind = TRUE;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!bFind)
|
|
{
|
|
sTip.Format(_T("缺少项目名称=%s 等级名称=%s DN=%d 等级数据!\n请设置该项目和等级需要的%s等级数据!\n参见 KTSpeEdit\\等级生成器\\管件 设置"), pszProName, pszPreSpecName,(int)(dDn + 0.5), pszFitName);
|
|
AfxMessageBox(sTip);
|
|
return FALSE;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//没有项目 等级 设置,默认取A系列
|
|
//CString sSNo = _T("A");
|
|
}
|
|
return bFind;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryPipeSpecInf(CUIISQLiteServer *pDb, double dDn, WPipe::PIPESPEC &pipeSpec, WPipe::Trade &eTrade, LPCTSTR pszProName, LPCTSTR pszPreSpecName)
|
|
{
|
|
if (eTrade == WPipe::eCivial)//市政 不考虑等级 Z系列 暂 A
|
|
return FALSE;
|
|
|
|
/*
|
|
* TCHAR szODSN[7]; //外径系列
|
|
TCHAR szShtNo[33]; //表号
|
|
TCHAR szStdNo[33]; //标准号
|
|
TCHAR szMat[33]; //材质
|
|
TCHAR szDesc[128]; //描述
|
|
*/
|
|
memset(&pipeSpec, 0, sizeof(WPipe::FITSPEC));
|
|
|
|
CString sSQL, sTip;
|
|
|
|
BOOL bFind = FALSE;
|
|
if (pszProName != NULL && pszPreSpecName != NULL)
|
|
{
|
|
CStringArray arVals;
|
|
sSQL.Format(_T("select distinct [外径系列],[表号],[标准号],[材质],[描述] from AecSpecPipe where [项目名称]='%s' and [类别]='管道' and [等级名称]='%s' and [公称直径]=%d"), pszProName, pszPreSpecName, (int)(dDn + 0.5));
|
|
|
|
if (pDb->GetSelData(sSQL, arVals))
|
|
{
|
|
if (arVals.GetSize() >= 5)
|
|
{
|
|
_tcscpy(pipeSpec.szODSN, arVals.GetAt(0));
|
|
_tcscpy(pipeSpec.szShtNo, arVals.GetAt(1));
|
|
_tcscpy(pipeSpec.szStdNo, arVals.GetAt(2));
|
|
_tcscpy(pipeSpec.szMat, arVals.GetAt(3));
|
|
_tcscpy(pipeSpec.szDesc, arVals.GetAt(4));
|
|
bFind = TRUE;
|
|
}
|
|
}
|
|
|
|
if (!bFind)
|
|
{
|
|
sTip.Format(_T("缺少项目名称=%s 等级名称=%s DN=%d 等级数据!\n请设置该项目和等级需要的%s等级数据!\n参见 KTSpeEdit\\等级生成器\\管道 设置"), pszProName, pszPreSpecName, (int)(dDn + 0.5));
|
|
AfxMessageBox(sTip);
|
|
return FALSE;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//没有项目 等级 设置,默认取A系列
|
|
//CString sSNo = _T("A");
|
|
}
|
|
return bFind;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryFitSpecsNo(CUIISQLiteServer *pDb, double dDn, CString &sSNo, WPipe::Trade &eTrade, LPCTSTR pszFitName, LPCTSTR pszProName, LPCTSTR pszPreSpecName)
|
|
{
|
|
CString sSQL, sTip;
|
|
//行业 全局
|
|
AecDbObjXDataMap xInitMap;
|
|
KTModelLayoutXData::ReadModelXData(KT_PIPEINIT, xInitMap);
|
|
|
|
int nTrade = 4;
|
|
xInitMap.GetAt(DOC_PIDTRADE, nTrade); //应用行业,石油
|
|
|
|
sSNo = _T("A");
|
|
eTrade = (WPipe::Trade)nTrade;
|
|
if (eTrade == WPipe::eCivial)//市政 不考虑等级 Z系列 暂 A
|
|
{
|
|
sSNo = _T("A");
|
|
}
|
|
else
|
|
{
|
|
bool bFind = false;
|
|
if (pszProName != NULL && pszPreSpecName != NULL)
|
|
{
|
|
CString sSNo1 = _T(""), sSQL1;
|
|
sSQL1.Format(_T("select distinct [外径系列] from AecSpecFit where [项目名称]='%s' and [类型]='%s' and [等级名称]='%s' and [公称直径]=%d"), pszProName, pszFitName, pszPreSpecName, (int)(dDn + 0.5));
|
|
|
|
if (pDb->GetSelData(sSQL1, sSNo1) )
|
|
{
|
|
sSNo = sSQL1;
|
|
bFind = true;
|
|
}
|
|
|
|
if (!bFind)
|
|
{
|
|
//后续补强或焊接处理
|
|
//sTip.Format(_T("缺少项目名称=%s 等级名称=%s 的%s外径系列 DN%d 选型数据!\n请设置该项目和等级需要的%s选型数据!\n参见 KTSpeEdit\\等级生成器\\管件 设置"), pszProName, pszPreSpecName, pszFitName, (int)(dDn + 0.5), pszFitName);
|
|
//AfxMessageBox(sTip);
|
|
return FALSE;
|
|
}
|
|
return TRUE;
|
|
}
|
|
else
|
|
{
|
|
//没有项目 等级 设置,默认取A系列
|
|
//CString sSNo = _T("A");
|
|
}
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryFitSpecsNo(CUIISQLiteServer *pDb, double dDn1, double dDn2, CString& sSNo, WPipe::Trade& eTrade,LPCTSTR pszFitName,LPCTSTR pszProName, LPCTSTR pszPreSpecName)
|
|
{
|
|
CString sSQL,sTip;
|
|
//行业 全局
|
|
AecDbObjXDataMap xInitMap;
|
|
KTModelLayoutXData::ReadModelXData(KT_PIPEINIT, xInitMap);
|
|
|
|
int nTrade = 4;
|
|
xInitMap.GetAt(DOC_PIDTRADE, nTrade); //应用行业,石油
|
|
|
|
sSNo = _T("A");
|
|
eTrade = (WPipe::Trade)nTrade;
|
|
if (eTrade == WPipe::eCivial)//市政 不考虑等级 Z系列 暂 A
|
|
{
|
|
sSNo = _T("A");
|
|
}
|
|
else
|
|
{
|
|
bool bFind = false;
|
|
if (pszProName != NULL && pszPreSpecName != NULL)
|
|
{
|
|
CString sSNo1 = _T(""), sSNo2 = _T(""), sSQL1, sSQL2;
|
|
sSQL1.Format(_T("select distinct [外径系列] from AecSpecFit where [项目名称]='%s' and [类型]='%s' and [等级名称]='%s' and [公称直径]=%d"), pszProName, pszFitName, pszPreSpecName, (int)(dDn1 + 0.5));
|
|
sSQL2.Format(_T("select distinct [外径系列] from AecSpecFit where [项目名称]='%s' and [类型]='%s' and [等级名称]='%s' and [公称直径]=%d"), pszProName, pszFitName, pszPreSpecName, (int)(dDn2 + 0.5));
|
|
|
|
if (pDb->GetSelData(sSQL1, sSNo1) && pDb->GetSelData(sSQL2, sSNo2))
|
|
{
|
|
if (sSNo1.CompareNoCase(sSNo2) == 0)
|
|
{
|
|
sSNo = sSNo1;
|
|
bFind = true;
|
|
}
|
|
else
|
|
{
|
|
sSNo = sSNo1;
|
|
bFind = true;
|
|
//...
|
|
}
|
|
}
|
|
|
|
if (!bFind)
|
|
{
|
|
//后续补强或焊接处理
|
|
//sTip.Format(_T("缺少项目名称=%s 等级名称=%s 的%s外径系列 DN%d : DN%d 选型数据!\n请设置该项目和等级需要的%s选型数据!\n参见 KTSpeEdit\\等级生成器\\管件 设置"), pszProName, pszPreSpecName, pszFitName,(int)(dDn1 + 0.5), (int)(dDn2 + 0.5), pszFitName);
|
|
//AfxMessageBox(sTip);
|
|
return FALSE;
|
|
}
|
|
return TRUE;
|
|
}
|
|
else
|
|
{
|
|
//没有项目 等级 设置,默认取A系列
|
|
//CString sSNo = _T("A");
|
|
}
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryElbowL(CUIISQLiteServer *pDb, double dDN, double &dL, double dRadio, int nCn, LPCTSTR pszLevel,AecDbObjXDataMap *pXData)
|
|
{
|
|
BOOL bOk = FALSE;
|
|
|
|
//附加替换的数据
|
|
double dAng = 0.0;
|
|
pXData->GetAt(PIPE_ELBOWANG, dAng); //角度-弧度
|
|
|
|
BOOL bRdioOn = FALSE;
|
|
pXData->GetAt(KEY_RadRatio, bRdioOn);
|
|
if (bRdioOn)
|
|
{
|
|
dRadio = 1.0;//最小
|
|
}
|
|
|
|
CString sSQL, sODNo = _T("B");
|
|
sSQL.Format(_T("select distinct [外径系列] from AecSpecFit where [类型]='弯头' and [等级名称]='%s'"), pszLevel);
|
|
pDb->GetSelData(sSQL, sODNo);
|
|
|
|
static CStringList lstField;
|
|
if (lstField.IsEmpty())
|
|
{
|
|
pDb->GetTableStru(_T("AecElbowData"), lstField);
|
|
}
|
|
|
|
if (lstField.Find(_T("r")) != NULL ||
|
|
lstField.Find(_T("R")) != NULL)//兼容旧版
|
|
{
|
|
sSQL.Format(_T("select [结构长度],R,F,H from [AecElbowData] where [公称直径]=%d and [弯头曲率]>=%.2f and [外径系列]='%s' order by [弯头曲率]"),
|
|
(int)(dDN + 0.5), dRadio - 0.01, sODNo);
|
|
}
|
|
else
|
|
{
|
|
sSQL.Format(_T("select [结构长度] from [AecElbowData] where [公称直径]=%d and [弯头曲率]>=%.2f and [外径系列]='%s' order by [弯头曲率]"),
|
|
(int)(dDN + 0.5), dRadio - 0.01, sODNo);
|
|
}
|
|
|
|
CStringArray arVals;
|
|
pDb->GetSelData(sSQL, arVals);
|
|
|
|
if (arVals.GetSize() >= 3)
|
|
{
|
|
dL = _ttof(arVals.GetAt(0));
|
|
|
|
if (arVals.GetSize() >= 4)
|
|
{
|
|
if (_ttof(arVals.GetAt(1)) > 1.e-6)
|
|
{
|
|
pXData->SetAt(_T("R"), _ttof(arVals.GetAt(1)));
|
|
pXData->SetAt(_T("F"), _ttof(arVals.GetAt(2)));
|
|
pXData->SetAt(_T("H"), _ttof(arVals.GetAt(3)));
|
|
}
|
|
}
|
|
bOk = TRUE;
|
|
}
|
|
else//没有一律计算
|
|
{
|
|
if (lstField.Find(_T("r")) != NULL ||
|
|
lstField.Find(_T("R")) != NULL)//兼容旧版
|
|
{
|
|
sSQL.Format(_T("select [结构长度],R,F,H from [AecElbowData] where [公称直径]=%d and [弯头曲率]>=%.2f and [外径系列]='%s' order by [弯头曲率]"),
|
|
(int)(dDN + 0.5), dRadio, sODNo);
|
|
}
|
|
else
|
|
{
|
|
sSQL.Format(_T("select [结构长度] from [AecElbowData] where [公称直径]=%d and [弯头曲率]>=%.2f and [外径系列]='%s' order by [弯头曲率]"),
|
|
(int)(dDN + 0.5), dRadio, sODNo);
|
|
}
|
|
|
|
pDb->GetSelData(sSQL, arVals);
|
|
|
|
if (arVals.GetSize() > 0)
|
|
{
|
|
dL = _ttof(arVals.GetAt(0));
|
|
if (arVals.GetSize() >= 4)
|
|
{
|
|
if (_ttof(arVals.GetAt(1)) > 1.e-6)
|
|
{
|
|
pXData->SetAt(_T("R"), _ttof(arVals.GetAt(1)));
|
|
pXData->SetAt(_T("F"), _ttof(arVals.GetAt(2)));
|
|
pXData->SetAt(_T("H"), _ttof(arVals.GetAt(3)));
|
|
}
|
|
}
|
|
|
|
bOk = TRUE;
|
|
}
|
|
else
|
|
{
|
|
dL = dDN * dRadio;
|
|
}
|
|
}
|
|
|
|
if (fabs(dAng - PI / 8.0) < 1.e-3)//22.5
|
|
{
|
|
if (TDbPipeSupport::Query225ElbowL(pDb, dDN, dL, dRadio, nCn, pszLevel, sODNo, pXData))
|
|
return TRUE;
|
|
}
|
|
else if (fabs(dAng - PI / 6.0) < 1.e-3)//30
|
|
{
|
|
if (TDbPipeSupport::Query30ElbowL(pDb, dDN, dL, dRadio, nCn, pszLevel, sODNo, pXData))
|
|
return TRUE;
|
|
}
|
|
else if (fabs(dAng - PI / 4.0) < 1.e-3)//45
|
|
{
|
|
if (TDbPipeSupport::Query45ElbowL(pDb, dDN, dL, dRadio, nCn, pszLevel, sODNo, pXData))
|
|
return TRUE;
|
|
}
|
|
else if (fabs(dAng - PI / 3.0) < 1.e-3)//60
|
|
{
|
|
if (TDbPipeSupport::Query60ElbowL(pDb, dDN, dL, dRadio, nCn, pszLevel, sODNo, pXData))
|
|
return TRUE;
|
|
}
|
|
|
|
return bOk;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::Query45ElbowL(CUIISQLiteServer *pDb, double dDN, double &dL, double dRadio, int nCn, LPCTSTR pszLevel, LPCTSTR pszDNo, AecDbObjXDataMap *pXData)
|
|
{
|
|
static CStringList lstField;
|
|
if (lstField.IsEmpty())
|
|
{
|
|
pDb->GetTableStru(_T("Aec45ElbowData"), lstField);
|
|
}
|
|
|
|
CString sSQL;
|
|
|
|
if (lstField.Find(_T("r")) != NULL ||
|
|
lstField.Find(_T("R")) != NULL)//兼容旧版
|
|
{
|
|
sSQL.Format(_T("select [结构长度],R,F,H from [Aec45ElbowData] where [公称直径]=%d and [弯头曲率]>=%.2f and [外径系列]='%s' order by [弯头曲率]"),
|
|
(int)(dDN + 0.5), dRadio - 0.01, pszDNo);
|
|
}
|
|
else
|
|
{
|
|
sSQL.Format(_T("select [结构长度] from [Aec45ElbowData] where [公称直径]=%d and [弯头曲率]>=%.2f and [外径系列]='%s' order by [弯头曲率]"),
|
|
(int)(dDN + 0.5), dRadio - 0.01, pszDNo);
|
|
}
|
|
|
|
CStringArray arVals;
|
|
pDb->GetSelData(sSQL, arVals);
|
|
if (arVals.GetSize() > 0)
|
|
{
|
|
dL = _ttof(arVals.GetAt(0));
|
|
if (arVals.GetSize() >= 4)
|
|
{
|
|
if (_ttof(arVals.GetAt(1)) > 1.e-6)
|
|
{
|
|
pXData->SetAt(_T("R"), _ttof(arVals.GetAt(1)));
|
|
pXData->SetAt(_T("F"), _ttof(arVals.GetAt(2)));
|
|
pXData->SetAt(_T("H"), _ttof(arVals.GetAt(3)));
|
|
}
|
|
}
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::Query225ElbowL(CUIISQLiteServer *pDb, double dDN, double &dL, double dRadio, int nCn, LPCTSTR pszLevel, LPCTSTR pszDNo, AecDbObjXDataMap *pXData)
|
|
{
|
|
CString sSQL;
|
|
sSQL.Format(_T("select [结构长度],R,F,H from [Aec22_5ElbowData] where [公称直径]=%d and [弯头曲率]>=%.2f and [外径系列]='%s' order by [弯头曲率]"),
|
|
(int)(dDN + 0.5), dRadio - 0.01, pszDNo);
|
|
|
|
CStringArray arVals;
|
|
pDb->GetSelData(sSQL, arVals);
|
|
if (arVals.GetSize() >= 4)
|
|
{
|
|
dL = _ttof(arVals.GetAt(0));
|
|
if (_ttof(arVals.GetAt(1)) > 1.e-6)
|
|
{
|
|
pXData->SetAt(_T("R"), _ttof(arVals.GetAt(1)));
|
|
pXData->SetAt(_T("F"), _ttof(arVals.GetAt(2)));
|
|
pXData->SetAt(_T("H"), _ttof(arVals.GetAt(3)));
|
|
}
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::Query30ElbowL(CUIISQLiteServer *pDb, double dDN, double &dL, double dRadio, int nCn, LPCTSTR pszLevel, LPCTSTR pszDNo, AecDbObjXDataMap *pXData)
|
|
{
|
|
CString sSQL;
|
|
sSQL.Format(_T("select [结构长度],R,F,H from [Aec30ElbowData] where [公称直径]=%d and [弯头曲率]>=%.2f and [外径系列]='%s' order by [弯头曲率]"),
|
|
(int)(dDN + 0.5), dRadio - 0.01, pszDNo);
|
|
|
|
CStringArray arVals;
|
|
pDb->GetSelData(sSQL, arVals);
|
|
if (arVals.GetSize() >= 4)
|
|
{
|
|
dL = _ttof(arVals.GetAt(0));
|
|
if (_ttof(arVals.GetAt(1)) > 1.e-6)
|
|
{
|
|
pXData->SetAt(_T("R"), _ttof(arVals.GetAt(1)));
|
|
pXData->SetAt(_T("F"), _ttof(arVals.GetAt(2)));
|
|
pXData->SetAt(_T("H"), _ttof(arVals.GetAt(3)));
|
|
}
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::Query60ElbowL(CUIISQLiteServer *pDb, double dDN, double &dL, double dRadio, int nCn, LPCTSTR pszLevel, LPCTSTR pszDNo, AecDbObjXDataMap *pXData)
|
|
{
|
|
CString sSQL;
|
|
sSQL.Format(_T("select [结构长度],R,F,H from [Aec60ElbowData] where [公称直径]=%d and [弯头曲率]>=%.2f and [外径系列]='%s' order by [弯头曲率]"),
|
|
(int)(dDN + 0.5), dRadio - 0.01, pszDNo);
|
|
|
|
CStringArray arVals;
|
|
pDb->GetSelData(sSQL, arVals);
|
|
if (arVals.GetSize() >= 4)
|
|
{
|
|
dL = _ttof(arVals.GetAt(0));
|
|
if (_ttof(arVals.GetAt(1)) > 1.e-6)
|
|
{
|
|
pXData->SetAt(_T("R"), _ttof(arVals.GetAt(1)));
|
|
pXData->SetAt(_T("F"), _ttof(arVals.GetAt(2)));
|
|
pXData->SetAt(_T("H"), _ttof(arVals.GetAt(3)));
|
|
}
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryRElbowL(CUIISQLiteServer *pDb, double dDNL, double dDNs, double &dL, double dRadio, int nCn, LPCTSTR pszLevel,AecDbObjXDataMap *pXData)
|
|
{
|
|
//附加替换的数据
|
|
double dAng = 0.0;
|
|
pXData->GetAt(PIPE_ELBOWANG, dAng); //角度-弧度
|
|
|
|
//继续按默认90度设置
|
|
BOOL bOk = FALSE;
|
|
CString sSQL, sODNo;
|
|
pXData->GetAt(PIPE_ODSN,sODNo);
|
|
if (pszLevel != NULL && _tcslen(pszLevel) > 0)//
|
|
{
|
|
sSQL.Format(_T("select distinct [外径系列] from AecSpecFit where [类型]='弯头' and [等级名称]='%s'"), pszLevel);
|
|
pDb->GetSelData(sSQL, sODNo);
|
|
|
|
}
|
|
|
|
static CStringList lstField;
|
|
if (lstField.IsEmpty())
|
|
{
|
|
pDb->GetTableStru(_T("AecRElbowData"), lstField);
|
|
}
|
|
|
|
if (lstField.Find(_T("r")) != NULL ||
|
|
lstField.Find(_T("R")) != NULL)//兼容旧版
|
|
{
|
|
sSQL.Format(_T("select [长度],R,F,H from [AecRElbowData] where [公称直径L]=%d and [公称直径S]=%d and [外径系列]='%s'"),
|
|
(int)(dDNL + 0.5), (int)(dDNs + 0.5), sODNo);
|
|
}
|
|
else
|
|
{
|
|
sSQL.Format(_T("select [长度] from [AecRElbowData] where [公称直径L]=%d and [公称直径S]=%d and [外径系列]='%s'"),
|
|
(int)(dDNL + 0.5), (int)(dDNs + 0.5), sODNo);
|
|
}
|
|
|
|
CStringArray arVals;
|
|
pDb->GetSelData(sSQL, arVals);
|
|
|
|
if (arVals.GetSize() >= 3)
|
|
{
|
|
dL = _ttof(arVals.GetAt(0));
|
|
|
|
if (arVals.GetSize() >= 4)
|
|
{
|
|
if (_ttof(arVals.GetAt(1)) > 1.e-6)
|
|
{
|
|
pXData->SetAt(_T("R"), _ttof(arVals.GetAt(1)));
|
|
pXData->SetAt(_T("F"), _ttof(arVals.GetAt(2)));
|
|
pXData->SetAt(_T("H"), _ttof(arVals.GetAt(3)));
|
|
|
|
if (sODNo.CompareNoCase(_T("S")) == 0 && nCn < 3 || nCn == 4)
|
|
{
|
|
//02s403焊接弯头结构长度为R0
|
|
dL = _ttof(arVals.GetAt(1));
|
|
}
|
|
}
|
|
}
|
|
bOk = TRUE;
|
|
}
|
|
|
|
return bOk;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryTeeData(CUIISQLiteServer* pDb,double dDn1,double dDn2,double& dL,double& dS,LPCTSTR pszProName,LPCTSTR pszPreSpecName)
|
|
{
|
|
double dUnit = MakeSureMMUnit(dDn1);
|
|
MakeSureMMUnit(dDn2);
|
|
|
|
CString sSQL, sSNo, sTip;
|
|
CStringArray arValues;
|
|
|
|
WPipe::Trade eTrade = WPipe::eCivial;
|
|
if (!QueryFitSpecsNo(pDb, dDn1, dDn2, sSNo, eTrade,_T("三通"), pszProName, pszPreSpecName))
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
//A B 系列 Z系列位市政,无等级
|
|
//查询三通尺寸
|
|
sSQL.Format(_T("select [长度L],[长度S] from AecTeeData where [公称直径L] = %d and")
|
|
_T(" [公称直径S] = %d and [外径系列] = '%s'"),(int)(dDn1+0.5),(int)(dDn2+0.5), sSNo);
|
|
|
|
pDb->GetSelData(sSQL,arValues);
|
|
|
|
if (arValues.GetSize() < 2 && eTrade == WPipe::eCivial) //再反查B
|
|
{
|
|
sSQL.Format(_T("select [长度L],[长度S] from AecTeeData where [公称直径L] = %d and")
|
|
_T(" [公称直径S] = %d and [外径系列] = 'B'"),(int)(dDn1+0.5),(int)(dDn2+0.5));
|
|
pDb->GetSelData(sSQL,arValues);
|
|
}
|
|
|
|
if (arValues.GetSize() < 2)
|
|
{
|
|
//不用提示,后续焊接或补强或半管处理
|
|
//sTip.Format(_T("缺少公称直径L=%d 公称直径S=%d 外径系列='%s' 的三通选型数据!\
|
|
//\n请完善三通的安装数据!\n参见KTSpeEdit\\安装数据\\三通数据!"),(int)(dDn1 + 0.5), (int)(dDn2 + 0.5), sSNo);
|
|
//AfxMessageBox(sTip);
|
|
return FALSE;
|
|
}
|
|
|
|
//对方是主尺寸,自己是支尺寸
|
|
if (arValues.GetSize() >= 2) //有
|
|
{
|
|
dL = _ttof(arValues.GetAt(0)); //M 尺寸
|
|
dS = _ttof(arValues.GetAt(1)); //B 尺寸
|
|
|
|
dL /= dUnit;
|
|
dS /= dUnit;
|
|
|
|
return TRUE;
|
|
}
|
|
else
|
|
{
|
|
//不用提示,后续焊接或补强或半管处理
|
|
//sTip.Format(_T("缺少公称直径L=%d 公称直径S=%d 外径系列='%s' 的三通选型数据!\
|
|
//\n请完善三通的安装数据!\n参见KTSpeEdit\\安装数据\\三通数据!"),(int)(dDn1 + 0.5), (int)(dDn2 + 0.5), sSNo);
|
|
//AfxMessageBox(sTip);
|
|
return FALSE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryCrossData(CUIISQLiteServer* pDb,double dDN1,double dDN2,double& dL,double& dB, LPCTSTR pszProName, LPCTSTR pszPreSpecName)
|
|
{
|
|
double dUnit = MakeSureMMUnit(dDN1);
|
|
MakeSureMMUnit(dDN2);
|
|
|
|
CString sSQL, sSNo, sTip;
|
|
CStringArray arValues;
|
|
|
|
WPipe::Trade eTrade = WPipe::eCivial;
|
|
if (!QueryFitSpecsNo(pDb, dDN1, dDN2, sSNo, eTrade, _T("四通"), pszProName, pszPreSpecName))
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
//param1.
|
|
if ( ((int)(dDN1+0.5)) == ((int)(dDN2+0.5)) )
|
|
{
|
|
sSQL.Format(_T("select [结构长度L],[结构长度S],f1,f2 from AecCross where [公称直径] = %d and [外径系列] = '%s'"),(int)(dDN1+0.5), sSNo);
|
|
pDb->GetSelData(sSQL,arValues);
|
|
|
|
if (arValues.GetSize() < 4)
|
|
{
|
|
//从三通中取
|
|
if (QueryTeeData(pDb, dDN1, dDN2, dL, dB, pszProName, pszPreSpecName))
|
|
{
|
|
return TRUE;
|
|
}
|
|
|
|
sTip.Format(_T("\n数据库中缺少系列=%s公称直径=%dx%d类型的四通!"), sSNo, (int)(dDN1 + 0.5), (int)(dDN2 + 0.5));
|
|
AfxMessageBox(sTip);
|
|
return FALSE;
|
|
}
|
|
else
|
|
{
|
|
dL = _ttof(arValues.GetAt(0));
|
|
dB = _ttof(arValues.GetAt(1));
|
|
|
|
dL += _ttof(arValues.GetAt(2));
|
|
dB += _ttof(arValues.GetAt(3));
|
|
|
|
dL /= dUnit;
|
|
dB /= dUnit;
|
|
|
|
return TRUE;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
sSQL.Format(_T("select [结构长度L],[结构长度S] from AecCrossR \
|
|
where [公称直径L] = %d and [公称直径S] = %d and [外径系列] = '%s'"),(int)(dDN1+0.5),(int)(dDN2+0.5),sSNo);
|
|
pDb->GetSelData(sSQL,arValues);
|
|
if (arValues.GetSize() < 2)
|
|
{
|
|
arValues.RemoveAll();
|
|
sSQL.Format(_T("select [结构长度L],[结构长度S] from AecCrossR \
|
|
where [公称直径L] = %d and [公称直径S] = %d and [外径系列] = '%s'"),(int)(dDN2+0.5),(int)(dDN1+0.5),sSNo);
|
|
pDb->GetSelData(sSQL,arValues);
|
|
|
|
if (arValues.GetSize() < 2)
|
|
{
|
|
//从三通中取
|
|
if (QueryTeeData(pDb, dDN1, dDN2, dL, dB, pszProName, pszPreSpecName))
|
|
{
|
|
return TRUE;
|
|
}
|
|
|
|
sTip.Format(_T("\n数据库中缺少系列=%s公称直径=%dx%d类型的四通!"), sSNo, (int)(dDN1 + 0.5), (int)(dDN2 + 0.5));
|
|
AfxMessageBox(sTip);
|
|
return FALSE;
|
|
}
|
|
else
|
|
{
|
|
dB = _ttof(arValues.GetAt(0));
|
|
dL = _ttof(arValues.GetAt(1));
|
|
|
|
dL /= dUnit;
|
|
dB /= dUnit;
|
|
return TRUE;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
dL = _ttof(arValues.GetAt(0));
|
|
dB = _ttof(arValues.GetAt(1));
|
|
|
|
dL /= dUnit;
|
|
dB /= dUnit;
|
|
|
|
return TRUE;
|
|
}
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryFlangSpecs(CUIISQLiteServer *pDb
|
|
, double dDN
|
|
, WPipe::Trade &eTrade
|
|
, CString &sStd
|
|
, CString &sTyp
|
|
, LPCTSTR pszProName
|
|
, LPCTSTR pszPreSpecName)
|
|
{
|
|
return CoreTools::QueryFlangSpecs(pDb
|
|
, dDN
|
|
, eTrade
|
|
, sStd
|
|
, sTyp
|
|
, pszPreSpecName
|
|
, pszPreSpecName);
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryFlangData(CUIISQLiteServer* pDb
|
|
, double dDN
|
|
, double dPre
|
|
, double& dWD
|
|
, double& dWh
|
|
, double& dThk
|
|
, double& dN
|
|
, LPCTSTR pszProName
|
|
, LPCTSTR pszPreSpecName)
|
|
{
|
|
return CoreTools::QueryFlangData(pDb
|
|
, dDN
|
|
, dPre
|
|
, dWD
|
|
, dWh
|
|
, dThk
|
|
, dN
|
|
, pszProName
|
|
, pszPreSpecName);
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryFlangData(CUIISQLiteServer *pDb, double dDn, double dPress, AecDbObjXDataMap * pXDataMap)
|
|
{
|
|
CString sSQL,sStd, sTyp;
|
|
sStd = _T("HG/T 20592-2009");
|
|
sTyp = _T("PL");
|
|
|
|
pXDataMap->GetAt(PIPE_FLANGP, sTyp);
|
|
pXDataMap->GetAt(PIPE_STDNO, sStd);
|
|
|
|
sSQL.Format(_T("select * from aecflangedata where \
|
|
[公称直径]=%d and [压力]>%.2f and [压力]<%.2f and [法兰类型]='%s' and [标准号]='%s' order by [法兰厚度]"),
|
|
(int)(dDn + 0.5), dPress - 0.01, dPress + 0.01, sTyp, sStd);
|
|
|
|
CStringArray arVals;
|
|
pDb->GetSelData(sSQL, arVals);
|
|
|
|
double dUnit = MakeSureMMUnit(dDn);
|
|
|
|
if (arVals.GetSize() < 8) return FALSE;
|
|
|
|
double dWD = _ttof(arVals[5]); // 法兰外经
|
|
double dWh = _ttof(arVals[7]); // 法兰厚度
|
|
double dThk = _ttof(arVals[6]);// 法兰高度
|
|
double dN = _ttof(arVals[8]); // 法兰颈
|
|
|
|
dWD /= dUnit;
|
|
dWh /= dUnit;
|
|
dThk /= dUnit;
|
|
dN /= dUnit;
|
|
|
|
pXDataMap->SetAt(PIPE_N, dN);
|
|
pXDataMap->SetAt(PIPE_WD, dWD); //发兰盘外径
|
|
pXDataMap->SetAt(PIPE_WTHICK, dWh); //大盘面厚度
|
|
pXDataMap->SetAt(PIPE_THICK, dWh);//总厚
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryFlangSpec(CUIISQLiteServer *pDb, double dDn, double dPress, LPCTSTR pszLevel, AecDbObjXDataMap *pXDataMap)
|
|
{
|
|
CString sSQL;
|
|
sSQL.Format(_T("select [标准号],[材质],[类型],[端面],[描述],[制造类型],[元件代码] from [AecSpecFlange] where [公称直径]=%d and [等级名称]='%s' and [压力]>=%.1f and [压力]<=%.1f"),
|
|
(int)(dDn + 0.5),pszLevel,dPress-0.01,dPress+0.01);
|
|
|
|
CUIIValueTable table;
|
|
pDb->GetSelData(sSQL, table);
|
|
|
|
if (table.GetTableLogicSize() > 0)
|
|
{
|
|
CStringArray arVals;
|
|
table.GetValueRecord(0, arVals);
|
|
|
|
pXDataMap->SetAt(PIPE_STDNO, arVals.GetAt(0));
|
|
pXDataMap->SetAt(PIPE_MATERIALFT, arVals.GetAt(1));
|
|
pXDataMap->SetAt(PIPE_FITTYPE, arVals.GetAt(2));
|
|
pXDataMap->SetAt(PIPE_FLANGF, arVals.GetAt(3));
|
|
pXDataMap->SetAt(PIPE_DESCR, arVals.GetAt(4));
|
|
pXDataMap->SetAt(KEY_PRODTP, arVals.GetAt(5));
|
|
pXDataMap->SetAt(KEY_ICODE, arVals.GetAt(6));
|
|
pXDataMap->SetAt(KEY_SCODE, _T("FLG"));
|
|
}
|
|
else
|
|
{
|
|
sSQL.Format(_T("select [标准号],[法兰类型],[端面] from [AecFlangeData] where [公称直径]=%d and [压力]>=%.1f and [压力]<=%.1f"),
|
|
(int)(dDn + 0.5), dPress - 0.01, dPress + 0.01);
|
|
|
|
table.RemoveAll();
|
|
pDb->GetSelData(sSQL, table);
|
|
|
|
if (table.GetTableLogicSize() > 0)
|
|
{
|
|
CStringArray arVals;
|
|
table.GetValueRecord(0, arVals);
|
|
|
|
pXDataMap->SetAt(PIPE_STDNO, arVals.GetAt(0));
|
|
pXDataMap->SetAt(PIPE_FITTYPE, arVals.GetAt(1));
|
|
pXDataMap->SetAt(PIPE_FLANGF, arVals.GetAt(2));
|
|
pXDataMap->SetAt(KEY_SCODE, _T("FLG"));
|
|
}
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryGasketSpec(CUIISQLiteServer* pDb, WPipe::Trade& eTrade,double dDN, double dPre, LPCTSTR pszProName, LPCTSTR pszPreSpecName)
|
|
{
|
|
CString sSQL, sTip;
|
|
//行业 全局
|
|
AecDbObjXDataMap xInitMap;
|
|
KTModelLayoutXData::ReadModelXData(KT_PIPEINIT, xInitMap);
|
|
|
|
int nTrade = 4;
|
|
xInitMap.GetAt(DOC_PIDTRADE, nTrade); //应用行业,石油
|
|
|
|
eTrade = (WPipe::Trade)nTrade;
|
|
if (eTrade == WPipe::eCivial)//市政 不考虑等级 Z系列 暂 A
|
|
{
|
|
return TRUE;
|
|
}
|
|
|
|
if (pszProName != NULL && pszPreSpecName != NULL)
|
|
{
|
|
sSQL.Format(_T("select * from AecSpecGasket where [项目名称]='%s' and [等级名称]='%s' and [公称直径]=%d and [压力]>%.2f and [压力]<%.2f"),
|
|
pszProName,pszPreSpecName,(int)(dDN+0.5),dPre-0.1,dPre+0.1);
|
|
|
|
if (!pDb->IsSelEmpty(sSQL))
|
|
{
|
|
return TRUE;
|
|
}
|
|
else
|
|
{
|
|
sTip.Format(_T("缺少项目名称=%s 等级名称=%s 公称直径=%d 压力=%.1f 的垫片等级选型设置!"),pszProName,pszPreSpecName, (int)(dDN + 0.5),dPre);
|
|
AfxMessageBox(sTip);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//AfxMessageBox(_T("查询垫片缺少项目名称,等级名称!"));
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryGasketData(CUIISQLiteServer* pDb,double dDN,double dPre,CStringArray& arGasketG, LPCTSTR pszProName, LPCTSTR pszPreSpecName)
|
|
{
|
|
double dUnit = MakeSureMMUnit(dDN);
|
|
|
|
WPipe::Trade eTrade = WPipe::eCivial;
|
|
if (!QueryGasketSpec(pDb, eTrade,dDN,dPre,pszProName,pszPreSpecName))
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
CString sSQL, sTemp;
|
|
if (eTrade == WPipe::eCivial) //从垫片数据库中查
|
|
{
|
|
sSQL.Format(_T("select [公称直径],[材质],[压力],[垫片厚度],[描述],[类别],[类型],[标准号] from AecSpecGasket \
|
|
where [公称直径]=%d and [压力]>%g and [压力]<%g"), (int)(dDN + 0.5), dPre - 0.1, dPre + 0.1);
|
|
|
|
CUIIValueTable table;
|
|
pDb->GetSelData(sSQL, table);
|
|
|
|
CStringArray arValues;
|
|
if (table.GetTableLogicSize() > 0)
|
|
{
|
|
arGasketG.RemoveAll();
|
|
table.GetValueRecord(0, arGasketG);
|
|
|
|
CString sText;
|
|
if (arGasketG.GetSize() >= 5)
|
|
{
|
|
sText.Format(_T("%.1f"), dDN);
|
|
arGasketG.SetAt(0, sText);
|
|
|
|
sText = arGasketG.GetAt(3);
|
|
double dVal = dUnit * _ttof(sText);
|
|
|
|
sText.Format(_T("%.1f"), dVal);
|
|
arGasketG.SetAt(3, sText);
|
|
}
|
|
return TRUE;
|
|
}
|
|
else
|
|
{
|
|
sSQL.Format(_T("select [公称直径],[材质],[压力],[垫片厚度],[描述],[类别],[类型],[标准号] from AecSpecGasket \
|
|
where [公称直径]=%d"), (int)(dDN + 0.5));
|
|
|
|
pDb->GetSelData(sSQL, table);
|
|
if (table.GetTableLogicSize() > 0)
|
|
{
|
|
arGasketG.RemoveAll();
|
|
table.GetValueRecord(0, arGasketG);
|
|
|
|
CString sText;
|
|
if (arGasketG.GetSize() >= 5)
|
|
{
|
|
sText.Format(_T("%.1f"), dDN);
|
|
arGasketG.SetAt(0, sText);
|
|
|
|
sText = arGasketG.GetAt(3);
|
|
double dVal = dUnit * _ttof(sText);
|
|
|
|
sText.Format(_T("%.1f"), dVal);
|
|
arGasketG.SetAt(3, sText);
|
|
}
|
|
return TRUE;
|
|
}
|
|
else
|
|
{
|
|
acutPrintf(_T("\n没有查到公称直径:%d 压力%g 的垫片参数!"), (int)dDN, dPre);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (pszProName != NULL && pszPreSpecName != NULL)
|
|
{
|
|
sSQL.Format(_T("select [公称直径],[材质],[压力],[垫片厚度],[描述],[类别],[类型],[标准号] from AecSpecGasket where [项目名称]='%s' and [等级名称]='%s' and [公称直径]=%d and [压力]>%.2f and [压力]<%.2f"),
|
|
pszProName, pszPreSpecName, (int)(dDN + 0.5), dPre - 0.1, dPre + 0.1);
|
|
|
|
CUIIValueTable table;
|
|
pDb->GetSelData(sSQL, table);
|
|
|
|
CStringArray arValues;
|
|
if (table.GetTableLogicSize() > 0)
|
|
{
|
|
arGasketG.RemoveAll();
|
|
table.GetValueRecord(0, arGasketG);
|
|
|
|
CString sText;
|
|
if (arGasketG.GetSize() >= 5)
|
|
{
|
|
sText.Format(_T("%.1f"), dDN);
|
|
arGasketG.SetAt(0, sText);
|
|
|
|
sText = arGasketG.GetAt(3);
|
|
double dVal = dUnit * _ttof(sText);
|
|
|
|
sText.Format(_T("%.1f"), dVal);
|
|
arGasketG.SetAt(3, sText);
|
|
}
|
|
return TRUE;
|
|
}
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::IsPointHitWPipe(ads_point ptRes,AcDbObjectId& id)
|
|
{
|
|
ads_point pt[4];
|
|
ads_point_set(ptRes,pt[0]);
|
|
pt[0][X] += 10.0;
|
|
pt[0][Y] += 10.0;//??
|
|
pt[1][X] = pt[0][X] - 20.0;
|
|
pt[1][Y] = pt[0][Y];
|
|
pt[2][X] = pt[1][X];
|
|
pt[2][Y] = pt[1][Y] - 20.0;
|
|
pt[3][X] = pt[0][X];
|
|
pt[3][Y] = pt[2][Y];
|
|
|
|
TCHAR szBuf[64];
|
|
memset(szBuf,0,sizeof(szBuf));
|
|
_tcscpy(szBuf, _T("AEC_EWPIPE"));
|
|
|
|
struct resbuf rb;
|
|
rb.restype = 0;
|
|
rb.resval.rstring = szBuf;
|
|
rb.rbnext = NULL;
|
|
|
|
struct resbuf* pointlist = NULL;
|
|
pointlist = acutBuildList(RTPOINT, pt[0], RTPOINT, pt[1],
|
|
RTPOINT, pt[2], RTPOINT, pt[3], 0);
|
|
|
|
ads_name ss;
|
|
acedSSGet(_T("CP"),pointlist,NULL,&rb,ss);
|
|
acutRelRb(pointlist);
|
|
|
|
Adesk::Int32 lLen = 0;
|
|
acedSSLength(ss,&lLen);
|
|
|
|
if (lLen > 0)
|
|
{
|
|
ads_name ent;
|
|
acedSSName(ss,0,ent);
|
|
acdbGetObjectId(id,ent);
|
|
acedSSFree(ss);
|
|
|
|
return TRUE;
|
|
}
|
|
acedSSFree(ss);
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::InsertFlangeAndGasketData(CUIISQLiteServer *pDb, const int &Dn,CString& sPro,CString& sLevel)
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryLateralData(CUIISQLiteServer* pDb,double dDn,double& dE,double& dM,double& dB,double& dInsL,double& dInfD,int nType,LPCTSTR pszProName,LPCTSTR pszPreSpecName)
|
|
{
|
|
double dUnit = MakeSureMMUnit(dDn);
|
|
|
|
CString sSQL, sSNo = _T("A"), sTip;
|
|
CStringArray arValues;
|
|
|
|
WPipe::Trade eTrade = WPipe::eCivial;
|
|
if (!QueryFitSpecsNo(pDb, dDn, dDn, sSNo, eTrade, _T("斜三通"), pszProName, pszPreSpecName))
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
if (eTrade == WPipe::eCivial)//市政
|
|
{
|
|
if (nType == 0)
|
|
{
|
|
sSQL.Format(_T("select [结构长度E],[结构长度M],[结构长度B] from aeclateral where [公称直径]=%d "),(int)(dDn+0.5));
|
|
}
|
|
else if (nType == 1)
|
|
{
|
|
sSQL.Format(_T("select [结构长度E],[结构长度M],[结构长度B],[承插长度],[接口直径] from aeclaterals where [公称直径]=%d"),(int)(dDn+0.5));
|
|
}
|
|
else if(nType == 2)
|
|
{
|
|
sSQL.Format(_T("select [结构长度E],[结构长度M],[结构长度B],[螺纹长度],[接口直径] from aeclateralt where [公称直径]=%d"),(int)(dDn+0.5));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (nType == 0)
|
|
{
|
|
sSQL.Format(_T("select [结构长度E],[结构长度M],[结构长度B] from aeclateral where [公称直径]=%d and 外径系列='%s'"), (int)(dDn + 0.5),sSNo);
|
|
}
|
|
else if (nType == 1)
|
|
{
|
|
sSQL.Format(_T("select [结构长度E],[结构长度M],[结构长度B],[承插长度],[接口直径] from aeclaterals where [公称直径]=%d and 外径系列='%s'"), (int)(dDn + 0.5), sSNo);
|
|
}
|
|
else if (nType == 2)
|
|
{
|
|
sSQL.Format(_T("select [结构长度E],[结构长度M],[结构长度B],[螺纹长度],[接口直径] from aeclateralt where [公称直径]=%d and 外径系列='%s'"), (int)(dDn + 0.5), sSNo);
|
|
}
|
|
}
|
|
|
|
CStringArray arVals;
|
|
pDb->GetSelData(sSQL,arVals);
|
|
|
|
if (arVals.GetSize() >= 3)
|
|
{
|
|
dE = _ttof(arVals.GetAt(0));
|
|
dM = _ttof(arVals.GetAt(1));
|
|
dB = _ttof(arVals.GetAt(2));
|
|
|
|
if (arVals.GetSize() >= 5)
|
|
{
|
|
dInsL = _ttof(arVals.GetAt(3));
|
|
dInfD = _ttof(arVals.GetAt(4));
|
|
}
|
|
|
|
dE /= dUnit;
|
|
dM /= dUnit;
|
|
dB /= dUnit;
|
|
|
|
dInsL /= dUnit;
|
|
dInfD /= dUnit;
|
|
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryWYeData(CUIISQLiteServer* pDb,double dDn,double& dM,double& dB,double& dInsL,double& dInfD,int nType,LPCTSTR pszProName,LPCTSTR pszPreSpecName)
|
|
{
|
|
double dUnit = MakeSureMMUnit(dDn);
|
|
|
|
CString sSQL, sSNo = _T("A"), sTip;
|
|
CStringArray arValues;
|
|
|
|
WPipe::Trade eTrade = WPipe::eCivial;
|
|
if (!QueryFitSpecsNo(pDb, dDn, dDn, sSNo, eTrade, _T("Y三通"), pszProName, pszPreSpecName))
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
if (eTrade == WPipe::eCivial)
|
|
{
|
|
if (nType == 0)
|
|
{
|
|
sSQL.Format(_T("select [结构长度M],[结构长度B] from AecWye where [公称直径]=%d"),(int)(dDn+0.5));
|
|
}
|
|
else if (nType == 1)
|
|
{
|
|
sSQL.Format(_T("select [结构长度M],[结构长度B],[承插长度],[接口直径] from AecWyes where [公称直径]=%d"),(int)(dDn + 0.5));
|
|
}
|
|
else if(nType == 2)
|
|
{
|
|
sSQL.Format(_T("select [结构长度M],[结构长度B],[螺纹长度],[接口直径] from AecWyet where [公称直径]=%d"),(int)(dDn + 0.5));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (nType == 0)
|
|
{
|
|
sSQL.Format(_T("select [结构长度M],[结构长度B] from AecWye where [公称直径]=%d and 外径系列='%s'"), (int)(dDn + 0.5),sSNo);
|
|
}
|
|
else if (nType == 1)
|
|
{
|
|
sSQL.Format(_T("select [结构长度M],[结构长度B],[承插长度],[接口直径] from AecWyes where [公称直径]=%d and 外径系列='%s'"), (int)(dDn + 0.5), sSNo);
|
|
}
|
|
else if (nType == 2)
|
|
{
|
|
sSQL.Format(_T("select [结构长度M],[结构长度B],[螺纹长度],[接口直径] from AecWyet where [公称直径]=%d and 外径系列='%s'"), (int)(dDn + 0.5), sSNo);
|
|
}
|
|
}
|
|
|
|
CStringArray arVals;
|
|
pDb->GetSelData(sSQL,arVals);
|
|
|
|
if (arVals.GetSize() >= 2)
|
|
{
|
|
dM = _ttof(arVals.GetAt(0));
|
|
dB = _ttof(arVals.GetAt(1));
|
|
|
|
if (arVals.GetSize() >= 4)
|
|
{
|
|
dInsL = _ttof(arVals.GetAt(2));
|
|
dInfD = _ttof(arVals.GetAt(3));
|
|
}
|
|
|
|
dM /= dUnit;
|
|
dB /= dUnit;
|
|
|
|
dInsL /= dUnit;
|
|
dInfD /= dUnit;
|
|
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryCapData(CUIISQLiteServer* pDb,double dDn,double& dL)
|
|
{
|
|
MakeSureMMUnit(dDn);
|
|
|
|
dL = dDn * 0.3;//经验值
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
BOOL TDbPipeSupport::QueryReduceData(CUIISQLiteServer *pDb, int nCntype, double dDn, double dTDN, double &dL, AecDbObjXDataMap *pXData, LPCTSTR pszSDN /*= _T("A")*/)
|
|
{
|
|
CString sSQL, sTbl;
|
|
CStringArray arVals;
|
|
|
|
if (nCntype == 0)
|
|
{
|
|
sTbl = _T("AecReduceData");
|
|
if (IsPlasticsMat(pszSDN))
|
|
sTbl = _T("AecReduceSData");
|
|
}
|
|
else if (nCntype == 1)
|
|
{
|
|
sTbl = _T("AecReduceSData");
|
|
}
|
|
else if (nCntype == 2)
|
|
{
|
|
sTbl = _T("AecReduceTData");
|
|
}
|
|
else
|
|
{
|
|
sTbl = _T("AecReduceData");
|
|
}
|
|
|
|
//如果是偏心
|
|
AcGeVector3d vtOff(0, 0, 0);
|
|
pXData->GetAt(KEY_OFFSET, vtOff);
|
|
if (!vtOff.isZeroLength())
|
|
{
|
|
if (_tcscmp(pszSDN, _T("S")) == 0)
|
|
{
|
|
sTbl = _T("AecEccReduceData");
|
|
}
|
|
}
|
|
|
|
bool bLS = false;
|
|
if (nCntype == 3 || nCntype == 5)
|
|
bLS = true;
|
|
|
|
if (sTbl.CompareNoCase(_T("AecReduceData")) == 0 ||
|
|
sTbl.CompareNoCase(_T("AecEccReduceData")) == 0)
|
|
{
|
|
sSQL.Format(_T("select [长度],[H],[H2],[H1] from %s where [外径系列] = '%s' and [公称直径L]=%d and [公称直径S]=%d and [长度] > 0"), sTbl, pszSDN, __max((int)(dDn + 0.5), (int)(dTDN + 0.5)), __min((int)(dDn + 0.5), (int)(dTDN + 0.5)));
|
|
pDb->GetSelData(sSQL, arVals);
|
|
|
|
if (arVals.IsEmpty())
|
|
{
|
|
bLS = false;
|
|
sSQL.Format(_T("select [长度],[H],[H1],[H2] from %s where [公称直径L]=%d and [公称直径S]=%d and [长度] > 0"), sTbl, (int)(dTDN + 0.5), (int)(dDn + 0.5));
|
|
pDb->GetSelData(sSQL, arVals);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
sSQL.Format(_T("select [长度] from %s where [外径系列] = '%s' and [公称直径L]=%d and [公称直径S]=%d and [长度] > 0"), sTbl, pszSDN, __max((int)(dDn + 0.5), (int)(dTDN + 0.5)), __min((int)(dDn + 0.5), (int)(dTDN + 0.5)));
|
|
pDb->GetSelData(sSQL, arVals);
|
|
|
|
if (arVals.IsEmpty())
|
|
{
|
|
bLS = false;
|
|
sSQL.Format(_T("select [长度] from %s where [公称直径L]=%d and [公称直径S]=%d and [长度] > 0"), sTbl, (int)(dTDN + 0.5), (int)(dDn + 0.5));
|
|
pDb->GetSelData(sSQL, arVals);
|
|
}
|
|
}
|
|
|
|
if (!arVals.IsEmpty())
|
|
{
|
|
dL = _ttof(arVals.GetAt(0));
|
|
|
|
if (arVals.GetSize() >= 4)
|
|
{
|
|
if (bLS)
|
|
{
|
|
pXData->SetAt(_T("H"), _ttof(arVals.GetAt(1)));
|
|
pXData->SetAt(_T("H2"), _ttof(arVals.GetAt(2)));
|
|
pXData->SetAt(_T("H1"), _ttof(arVals.GetAt(3)));
|
|
|
|
dL += 2.0 * _ttof(arVals.GetAt(1));
|
|
dL += _ttof(arVals.GetAt(2));
|
|
dL += _ttof(arVals.GetAt(3));
|
|
}
|
|
else
|
|
{
|
|
pXData->SetAt(_T("H"), _ttof(arVals.GetAt(1)));
|
|
pXData->SetAt(_T("H1"), _ttof(arVals.GetAt(2)));
|
|
pXData->SetAt(_T("H2"), _ttof(arVals.GetAt(3)));
|
|
|
|
//焊接不需要
|
|
//dL += 2.0 * _ttof(arVals.GetAt(1));
|
|
//dL += _ttof(arVals.GetAt(2));
|
|
//dL += _ttof(arVals.GetAt(3));
|
|
}
|
|
}
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
|
|
BOOL TDbPipeSupport::QueryFlxJoinData(CUIISQLiteServer *pDb, double dDN, double dPre, AecDbObjXDataMap* pXDataMap)
|
|
{
|
|
CString sSQL;
|
|
|
|
sSQL.Format(_T("select [尺寸A],[尺寸B],[尺寸C],[型号],[标准号] from AecFlxJoin where [公称直径]=%d and [压力]>%.3f and [压力]<%.3f"),
|
|
(int)(dDN + 0.5), dPre - 0.01, dPre + 0.01);
|
|
|
|
CStringArray arVals;
|
|
pDb->GetSelData(sSQL, arVals);
|
|
|
|
if (arVals.GetSize() >= 5)
|
|
{
|
|
pXDataMap->SetAt(KEY_A, _ttof(arVals.GetAt(0)));
|
|
pXDataMap->SetAt(KEY_B, _ttof(arVals.GetAt(1)));
|
|
pXDataMap->SetAt(KEY_C, _ttof(arVals.GetAt(2)));
|
|
pXDataMap->SetAt(KEY_TYPE, arVals.GetAt(3));
|
|
pXDataMap->SetAt(PIPE_STDNO, arVals.GetAt(4));
|
|
pXDataMap->SetAt(PIPE_DN, dDN);
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryInfFDFL(CUIISQLiteServer* pDb,int nObjectKind,int nCntype,double dDN,double& dFD,double& dFL, LPCTSTR pszProName, LPCTSTR pszPreSpecName)
|
|
{
|
|
double dUnit = MakeSureMMUnit(dDN);
|
|
CString sTablename = _T(""),sFitName = _T(""), sSNo = _T("A");
|
|
|
|
EFittingType eKind = (EFittingType)nObjectKind;
|
|
switch(eKind)
|
|
{
|
|
case eElbow:
|
|
{
|
|
if (nCntype == 1)
|
|
{
|
|
sTablename = _T("AecElbowSData");
|
|
sFitName = _T("螺纹弯头");
|
|
}
|
|
else if(nCntype == 2)
|
|
{
|
|
sTablename = _T("AecElbowTData");
|
|
sFitName = _T("承插弯头");
|
|
}
|
|
break;
|
|
}
|
|
case eReduce:
|
|
{
|
|
if (nCntype == 1)
|
|
{
|
|
sTablename = _T("AecReduceSData");
|
|
sFitName = _T("螺纹变径");
|
|
}
|
|
else if(nCntype == 2)
|
|
{
|
|
sTablename = _T("AecReduceTData");
|
|
sFitName = _T("承插变径");
|
|
}
|
|
break;
|
|
}
|
|
case eCross:
|
|
{
|
|
if (nCntype == 1)
|
|
{
|
|
sTablename = _T("AecCrossS");
|
|
sFitName = _T("螺纹四通");
|
|
}
|
|
else if(nCntype == 2)
|
|
{
|
|
sTablename = _T("AecCrossT");
|
|
sFitName = _T("承插四通");
|
|
}
|
|
break;
|
|
}
|
|
case eTee:
|
|
{
|
|
if (nCntype == 1)
|
|
{
|
|
sTablename = _T("AecTeeSData");
|
|
sFitName = _T("螺纹三通");
|
|
}
|
|
else if(nCntype == 2)
|
|
{
|
|
sTablename = _T("AecTeeTData");
|
|
sFitName = _T("承插三通");
|
|
}
|
|
break;
|
|
}
|
|
case eLateral:
|
|
{
|
|
if (nCntype == 1)
|
|
{
|
|
sTablename = _T("AecLateralS");
|
|
sFitName = _T("螺纹斜三通");
|
|
}
|
|
else if(nCntype == 2)
|
|
{
|
|
sTablename = _T("AecLateralT");
|
|
sFitName = _T("承插斜三通");
|
|
}
|
|
break;
|
|
}
|
|
case eWye:
|
|
{
|
|
if (nCntype == 1)
|
|
{
|
|
sTablename = _T("AecWyes");
|
|
sFitName = _T("螺纹Y三通");
|
|
}
|
|
else if(nCntype == 2)
|
|
{
|
|
sTablename = _T("AecWyeT");
|
|
sFitName = _T("承插Y三通");
|
|
}
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
|
|
if (!sTablename.IsEmpty())
|
|
{
|
|
//等级系列 查询系列
|
|
WPipe::Trade eTrade = WPipe::eCivial;
|
|
if (!QueryFitSpecsNo(pDb, dDN, dDN, sSNo, eTrade, sFitName, pszProName, pszPreSpecName))
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
CString sSQL;
|
|
CStringArray arVals;
|
|
|
|
if (eTrade == WPipe::eCivial)
|
|
{
|
|
if (eKind == eReduce)
|
|
{
|
|
if (nCntype == 1) //cheng cha
|
|
{
|
|
sSQL.Format(_T("select [接口直径L],[承插长度L] from [%s] where [公称直径L]=%d"), sTablename, (int)(dDN + 0.5));
|
|
}
|
|
else if (nCntype == 2)//luo wen
|
|
{
|
|
sSQL.Format(_T("select [接口直径L],[螺纹长度L] from [%s] where [公称直径L]=%d"), sTablename, (int)(dDN + 0.5));
|
|
}
|
|
|
|
pDb->GetSelData(sSQL, arVals);
|
|
if (arVals.GetSize() == 0)
|
|
{
|
|
if (nCntype == 1) //cheng cha
|
|
{
|
|
sSQL.Format(_T("select [接口直径S],[承插长度S] from [%s] where [公称直径S]=%d"), sTablename, (int)(dDN + 0.5));
|
|
}
|
|
else if (nCntype == 2)//luo wen
|
|
{
|
|
sSQL.Format(_T("select [接口直径S],[螺纹长度S] from [%s] where [公称直径S]=%d"), sTablename, (int)(dDN + 0.5));
|
|
}
|
|
pDb->GetSelData(sSQL, arVals);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (nCntype == 1) //cheng cha
|
|
{
|
|
sSQL.Format(_T("select [接口直径],[承插长度] from [%s] where [公称直径]=%d"), sTablename, (int)(dDN + 0.5));
|
|
}
|
|
else if (nCntype == 2)//luo wen
|
|
{
|
|
sSQL.Format(_T("select [接口直径],[螺纹长度] from [%s] where [公称直径]=%d"), sTablename, (int)(dDN + 0.5));
|
|
}
|
|
pDb->GetSelData(sSQL, arVals);
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
if (eKind == eReduce)
|
|
{
|
|
if (nCntype == 1) //cheng cha
|
|
{
|
|
sSQL.Format(_T("select [接口直径L],[承插长度L] from [%s] where [公称直径L]=%d and [外径系列]='%s'"), sTablename, (int)(dDN + 0.5),sSNo);
|
|
}
|
|
else if (nCntype == 2)//luo wen
|
|
{
|
|
sSQL.Format(_T("select [接口直径L],[螺纹长度L] from [%s] where [公称直径L]=%d and [外径系列]='%s'"), sTablename, (int)(dDN + 0.5), sSNo);
|
|
}
|
|
|
|
pDb->GetSelData(sSQL, arVals);
|
|
if (arVals.GetSize() == 0)
|
|
{
|
|
if (nCntype == 1) //cheng cha
|
|
{
|
|
sSQL.Format(_T("select [接口直径S],[承插长度S] from [%s] where [公称直径S]=%d and [外径系列]='%s'"), sTablename, (int)(dDN + 0.5), sSNo);
|
|
}
|
|
else if (nCntype == 2)//luo wen
|
|
{
|
|
sSQL.Format(_T("select [接口直径S],[螺纹长度S] from [%s] where [公称直径S]=%d and [外径系列]='%s'"), sTablename, (int)(dDN + 0.5), sSNo);
|
|
}
|
|
pDb->GetSelData(sSQL, arVals);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (nCntype == 1) //cheng cha
|
|
{
|
|
sSQL.Format(_T("select [接口直径],[承插长度] from [%s] where [公称直径]=%d and [外径系列]='%s'"), sTablename, (int)(dDN + 0.5), sSNo);
|
|
}
|
|
else if (nCntype == 2)//luo wen
|
|
{
|
|
sSQL.Format(_T("select [接口直径],[螺纹长度] from [%s] where [公称直径]=%d and [外径系列]='%s'"), sTablename, (int)(dDN + 0.5), sSNo);
|
|
}
|
|
pDb->GetSelData(sSQL, arVals);
|
|
}
|
|
}
|
|
|
|
if (arVals.GetSize() >= 2)
|
|
{
|
|
dFD = _ttof(arVals.GetAt(0));
|
|
dFL = _ttof(arVals.GetAt(1));
|
|
|
|
dFD /= dUnit;
|
|
dFL /= dUnit;
|
|
|
|
return TRUE;
|
|
}
|
|
else
|
|
{
|
|
acutPrintf(_T("\n没有查到管件结构参数!"));
|
|
acutPrintf(_T("\n%s"),sSQL);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (nCntype == 3 || nCntype == 5)//法兰管
|
|
{
|
|
//水池暂时取压力小于2
|
|
double dThk = 0.0,dN = 0.0;
|
|
dDN /= dUnit;
|
|
return QueryFlangData(pDb,dDN,1.0,dFD,dFL,dThk,dN);
|
|
}
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
//设置法兰垫片
|
|
BOOL TDbPipeSupport::SetGasketData(CUIISQLiteServer *pDb, int iInf,double dDn, double dPre, LPCTSTR pszProj, LPCTSTR pszLevel, AecDbObjXDataMap *pXDataMap)
|
|
{
|
|
BOOL bSet = FALSE;
|
|
CStringArray arGasket;
|
|
if (QueryGasketData(pDb, dDn, dPre, arGasket, pszProj, pszLevel))
|
|
{
|
|
//公称直径],[材质],[压力],[垫片厚度],[描述]
|
|
|
|
CString sGasketInf,sKey;
|
|
for (int i = 0;i < arGasket.GetSize();i++)
|
|
{
|
|
sGasketInf += arGasket.GetAt(i);
|
|
sGasketInf += _T("#");
|
|
}
|
|
sGasketInf.TrimRight(_T('#'));
|
|
|
|
sKey.Format(_T("%s%d"), PIPE_GASKETINF,iInf);
|
|
pXDataMap->SetAt(sKey, sGasketInf);
|
|
bSet = TRUE;
|
|
}
|
|
arGasket.RemoveAll();
|
|
|
|
return bSet;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryFBoltData(CUIISQLiteServer *pDb, double dDn, double dPre, LPCTSTR pszProj, LPCTSTR pszLevel, CStringArray &arBoltData)
|
|
{
|
|
CString sSQL;
|
|
//类型 材质 标准号 描述
|
|
sSQL.Format(_T("select [类型],[材质],[标准号],[描述] from AecSpecBolt where [项目名称]='%s' and [等级名称]='%s' and [类别]='螺栓' and [公称直径]=%d and [压力]>%.2f and [压力]<%.2f"),
|
|
pszProj,pszLevel,(int)(dDn+0.5),dPre-0.1,dPre + 0.1);
|
|
|
|
CUIIValueTable table;
|
|
pDb->GetSelData(sSQL, table);
|
|
|
|
if (table.GetTableLogicSize() > 0)
|
|
{
|
|
table.GetValueRecord(0, arBoltData);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
//类型 材质 标准号 描述
|
|
sSQL.Format(_T("select [类型],[材质],[标准号],[描述] from AecSpecBolt where [项目名称]='%s' and [等级名称]='%s' and [类别]='螺母' and [公称直径]=%d and [压力]>%.2f and [压力]<%.2f"),
|
|
pszProj, pszLevel, (int)(dDn + 0.5), dPre - 0.1, dPre + 0.1);
|
|
|
|
CUIIValueTable table2;
|
|
pDb->GetSelData(sSQL, table2);
|
|
|
|
if (table2.GetTableLogicSize() > 0)
|
|
{
|
|
table2.GetValueRecord(0, arBoltData);
|
|
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryBoltData(CUIISQLiteServer *pDb, double dDn, double dPre, CStringArray &arBoltData)
|
|
{
|
|
CString sSQL;
|
|
|
|
//螺栓规格 螺栓长度 螺栓数量
|
|
sSQL.Format(_T("select [螺栓规格],[螺栓长度],[螺栓数量] from AecBoltData where [公称直径]=%d and [压力]>%.2f and [压力]<%.2f"),
|
|
(int)(dDn+0.5),dPre - 0.1,dPre + 0.1);
|
|
|
|
return pDb->GetSelData(sSQL, arBoltData);
|
|
}
|
|
|
|
//设置法兰螺栓
|
|
BOOL TDbPipeSupport::SetBoltData(CUIISQLiteServer *pDb, int iInf,double dDn, double dPre, LPCTSTR pszProj, LPCTSTR pszLevel, AecDbObjXDataMap *pXDataMap)
|
|
{
|
|
//螺栓信息
|
|
BOOL bSet = FALSE;
|
|
CStringArray arBoltData;
|
|
|
|
//[类型],[材质],[标准号],[描述]
|
|
if (QueryFBoltData(pDb, dDn, dPre, pszProj, pszLevel, arBoltData))
|
|
{
|
|
//螺栓规格 螺栓长度 数量
|
|
if (QueryBoltData(pDb,dDn,dPre,arBoltData))
|
|
{
|
|
CString sKey, sBoltData;
|
|
for (int i = 0;i < arBoltData.GetSize();i++)
|
|
{
|
|
sBoltData += arBoltData.GetAt(i);
|
|
sBoltData += _T("#");
|
|
}
|
|
sBoltData.TrimRight(_T("#"));
|
|
|
|
sKey.Format(_T("%s%d"), PIPE_BOLTINF, iInf);
|
|
pXDataMap->SetAt(sKey, sBoltData);
|
|
|
|
bSet = TRUE;
|
|
}
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
bool TDbPipeSupport::IsPlasticsMat(LPCTSTR pszODNO)
|
|
{
|
|
const CString sPlastic = _T("UPVC CPVC PVC-C PP-H (PE) HDPE");
|
|
CStringArray arNos;
|
|
CoreTools::SplitStrintToArray(sPlastic, arNos, _T(' '));
|
|
for (int i = 0; i < arNos.GetSize(); i++)
|
|
{
|
|
if (arNos.GetAt(i).CompareNoCase(pszODNO) == 0)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryPVCReducerData(CUIISQLiteServer *pDb, double dDN, double dEDN, AecDbObjXDataMap *pXDataMap, LPCTSTR pszSDNo)
|
|
{
|
|
double dUnit = MakeSureMMUnit(dDN);
|
|
|
|
int nConnectType = 0;//焊接0 承插1 螺纹2 法兰管3
|
|
pXDataMap->GetAt(PIPE_CONNECT, nConnectType);
|
|
|
|
CString sSQL;
|
|
if (nConnectType <= 1)
|
|
{
|
|
sSQL.Format(_T("select [长度],[承插长度L],[承插长度S],[接口直径L],[接口直径S] from [AecReduceSData] where [公称直径L]=%d and [公称直径S]=%d and [外径系列]='%s'"),
|
|
(int)(dDN + 0.5), (int)(dEDN + 0.5), pszSDNo);
|
|
}
|
|
else if (nConnectType == 2)
|
|
{
|
|
sSQL.Format(_T("select [长度],[螺纹长度L],[螺纹长度S],[接口直径L],[接口直径S] from [AecReduceTData] where [公称直径L]=%d and [公称直径S]=%d and [外径系列]='%s'"),
|
|
(int)(dDN + 0.5), (int)(dEDN + 0.5), pszSDNo);
|
|
}
|
|
|
|
CStringArray arVals;
|
|
pDb->GetSelData(sSQL, arVals);
|
|
|
|
if (arVals.GetSize() >= 4)
|
|
{
|
|
pXDataMap->SetAt(KEY_Length, _ttof(arVals.GetAt(0)) / dUnit);
|
|
|
|
pXDataMap->SetAt(PIPE_INTERFACEL, _ttof(arVals.GetAt(1)) / dUnit);
|
|
pXDataMap->SetAt(PIPE_INTERFACEL2, _ttof(arVals.GetAt(2)) / dUnit);
|
|
|
|
pXDataMap->SetAt(PIPE_INTERFACED, _ttof(arVals.GetAt(3)) / dUnit);
|
|
pXDataMap->SetAt(PIPE_INTERFACED2, _ttof(arVals.GetAt(4)) / dUnit);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryPVCElbow(CUIISQLiteServer *pDb, double dDN, AecDbObjXDataMap *pXDataMap, LPCTSTR pszSDNo)
|
|
{
|
|
double dUnit = MakeSureMMUnit(dDN);
|
|
|
|
int nConnectType = 0;//焊接0 承插1 螺纹2 法兰管3
|
|
pXDataMap->GetAt(PIPE_CONNECT, nConnectType);
|
|
|
|
CString sSQL;
|
|
|
|
if (nConnectType <= 1)
|
|
{
|
|
sSQL.Format(_T("select [结构长度],[承插长度],[接口直径] from [AecElbowSData] where [公称直径]=%d and [外径系列]='%s'"),
|
|
(int)(dDN + 0.5), pszSDNo);
|
|
|
|
}
|
|
else if (nConnectType == 2)
|
|
{
|
|
sSQL.Format(_T("select [结构长度],[螺纹长度],[接口直径] from [AecElbowTData] where [公称直径]=%d and [外径系列]='%s'"),
|
|
(int)(dDN + 0.5), pszSDNo);
|
|
}
|
|
|
|
CStringArray arVals;
|
|
pDb->GetSelData(sSQL, arVals);
|
|
|
|
if (arVals.GetSize() >= 3)
|
|
{
|
|
pXDataMap->SetAt(KEY_L, _ttof(arVals.GetAt(0)) / dUnit);
|
|
pXDataMap->SetAt(PIPE_INTERFACEL, _ttof(arVals.GetAt(1)) / dUnit);
|
|
pXDataMap->SetAt(PIPE_INTERFACED, _ttof(arVals.GetAt(2)) / dUnit);
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryPVCTeeData(CUIISQLiteServer *pDb, double dDn1, double dDn2, AecDbObjXDataMap *pXDataMap, LPCTSTR pszSDNo)
|
|
{
|
|
double dUnit = MakeSureMMUnit(dDn1);
|
|
|
|
double dMaxD = __max(dDn1, dDn2);
|
|
double dMinD = __min(dDn1, dDn2);
|
|
|
|
int nConnectType = 0;//焊接0 承插1 螺纹2 法兰管3
|
|
pXDataMap->GetAt(PIPE_CONNECT, nConnectType);
|
|
|
|
CString sSQL;
|
|
if (nConnectType <= 1)
|
|
{
|
|
sSQL.Format(_T("select [承插长度],[接口直径] from [AecTeeSData] where [公称直径]=%d and [外径系列]='%s'"),
|
|
(int)(dMaxD + 0.5), pszSDNo);
|
|
}
|
|
else if (nConnectType == 2)
|
|
{
|
|
sSQL.Format(_T("select [螺纹长度],[接口直径] from [AecTeeTData] where [公称直径]=%d and [外径系列]='%s'"),
|
|
(int)(dMaxD + 0.5), pszSDNo);
|
|
}
|
|
|
|
CStringArray arVals;
|
|
pDb->GetSelData(sSQL, arVals);
|
|
|
|
if (arVals.GetSize() >= 2)
|
|
{
|
|
pXDataMap->SetAt(PIPE_INTERFACEL, _ttof(arVals.GetAt(0)) / dUnit);
|
|
pXDataMap->SetAt(PIPE_INTERFACED, _ttof(arVals.GetAt(1)) / dUnit);
|
|
}
|
|
|
|
if (nConnectType <= 1)
|
|
{
|
|
sSQL.Format(_T("select [承插长度],[接口直径] from [AecTeeSData] where [公称直径]=%d and [外径系列]='%s'"),
|
|
(int)(dMinD + 0.5), pszSDNo);
|
|
}
|
|
else if (nConnectType == 2)
|
|
{
|
|
sSQL.Format(_T("select [螺纹长度],[接口直径] from [AecTeeTData] where [公称直径]=%d and [外径系列]='%s'"),
|
|
(int)(dMinD + 0.5), pszSDNo);
|
|
}
|
|
|
|
arVals.RemoveAll();
|
|
pDb->GetSelData(sSQL, arVals);
|
|
|
|
if (arVals.GetSize() >= 2)
|
|
{
|
|
pXDataMap->SetAt(PIPE_INTERFACEL2, _ttof(arVals.GetAt(0)) / dUnit);
|
|
pXDataMap->SetAt(PIPE_INTERFACED2, _ttof(arVals.GetAt(1)) / dUnit);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryPVCCrossData(CUIISQLiteServer *pDb, double dDn1, double dDn2, AecDbObjXDataMap *pXDataMap, LPCTSTR pszSDNo)
|
|
{
|
|
double dUnit = MakeSureMMUnit(dDn1);
|
|
|
|
double dMaxD = __max(dDn1, dDn2);
|
|
double dMinD = __min(dDn1, dDn2);
|
|
|
|
int nConnectType = 0;//焊接0 承插1 螺纹2 法兰管3
|
|
pXDataMap->GetAt(PIPE_CONNECT, nConnectType);
|
|
|
|
CString sSQL;
|
|
if (nConnectType <= 1)
|
|
{
|
|
sSQL.Format(_T("select [结构长度],[承插长度],[接口直径] from [AecCrossS] where [公称直径]=%d and [外径系列]='%s'"),
|
|
(int)(dMaxD + 0.5), pszSDNo);
|
|
}
|
|
else if (nConnectType == 2)
|
|
{
|
|
sSQL.Format(_T("select [结构长度],[螺纹长度],[接口直径] from [AecCrossT] where [公称直径]=%d and [外径系列]='%s'"),
|
|
(int)(dMaxD + 0.5), pszSDNo);
|
|
}
|
|
|
|
CStringArray arVals;
|
|
pDb->GetSelData(sSQL, arVals);
|
|
|
|
if (arVals.GetSize() >= 2)
|
|
{
|
|
pXDataMap->SetAt(PIPE_INTERFACEL, _ttof(arVals.GetAt(0)) / dUnit);
|
|
pXDataMap->SetAt(PIPE_INTERFACED, _ttof(arVals.GetAt(1)) / dUnit);
|
|
}
|
|
|
|
if (nConnectType <= 1)
|
|
{
|
|
sSQL.Format(_T("select [承插长度],[接口直径] from [AecCrossS] where [公称直径]=%d and [外径系列]='%s'"),
|
|
(int)(dMinD + 0.5), pszSDNo);
|
|
}
|
|
else if (nConnectType == 2)
|
|
{
|
|
sSQL.Format(_T("select [螺纹长度],[接口直径] from [AecCrossT] where [公称直径]=%d and [外径系列]='%s'"),
|
|
(int)(dMinD + 0.5), pszSDNo);
|
|
}
|
|
|
|
arVals.RemoveAll();
|
|
pDb->GetSelData(sSQL, arVals);
|
|
|
|
if (arVals.GetSize() >= 2)
|
|
{
|
|
pXDataMap->SetAt(PIPE_INTERFACEL2, _ttof(arVals.GetAt(0)) / dUnit);
|
|
pXDataMap->SetAt(PIPE_INTERFACED2, _ttof(arVals.GetAt(1)) / dUnit);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
int TDbPipeSupport::QueryRPorHP(CUIISQLiteServer *pDb,LPCTSTR pszLevel,double dDn,double ddn)
|
|
{
|
|
//[AecSpecBranch] (
|
|
//[等级] CHAR(256),
|
|
//[主管] INTEGER,
|
|
//[支管] INTEGER,
|
|
//[结构] CHAR(17));
|
|
|
|
/*
|
|
0 RT REDUCING TEE
|
|
1 T EQUAL TEE
|
|
2 H HALF COUPLING
|
|
3 P BRANCH WELD
|
|
4 RP REINFORCING PAD
|
|
5 SO SOCKOLET
|
|
6 W WELDOLET
|
|
*/
|
|
static LPCTSTR ssBs[] = {_T("RT"),_T("T"),_T("H"),_T("P"),_T("RP"),_T("SO"),_T("W"),NULL};
|
|
int nLen = sizeof(ssBs) / sizeof(LPCTSTR)-1;
|
|
|
|
CString sSQL,sB;
|
|
sSQL.Format(_T("select [结构] from AecSpecBranch where [等级]='%s' and [主管]=%d and [支管]=%d"),pszLevel,(int)(dDn+0.5),(int)(ddn+0.5));
|
|
|
|
CStringArray arVals;
|
|
pDb->GetSelData(sSQL,arVals);
|
|
|
|
if (arVals.GetSize() >= 1)
|
|
{
|
|
sB = arVals.GetAt(0);
|
|
|
|
for(int i = 0;i < nLen;i++)
|
|
{
|
|
if (sB.CompareNoCase(ssBs[i]) == 0)
|
|
{
|
|
return i;
|
|
}
|
|
}
|
|
}
|
|
else//无等级查询
|
|
{
|
|
sSQL.Format(_T("select [结构] from AecSpecBranch where [主管]=%d and [支管]=%d"), (int)(dDn + 0.5), (int)(ddn + 0.5));
|
|
pDb->GetSelData(sSQL, arVals);
|
|
|
|
if (arVals.GetSize() >= 1)
|
|
{
|
|
sB = arVals.GetAt(0);
|
|
|
|
for (int i = 0; i < nLen; i++)
|
|
{
|
|
if (sB.CompareNoCase(ssBs[i]) == 0)
|
|
{
|
|
return i;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryRP(CUIISQLiteServer *pDb, double dDn, AecDbObjXDataMap *pXDataMap)
|
|
{
|
|
CString sSQL;
|
|
sSQL.Format(_T("select [外径D2],[壁厚],[标准号] from [AecRp] where [接管公称直径]=%d"), (int)(dDn + 0.5));
|
|
|
|
CStringArray arVals;
|
|
pDb->GetSelData(sSQL, arVals);
|
|
|
|
if (arVals.GetSize() >= 3)
|
|
{
|
|
pXDataMap->SetAt(PIPE_D, _ttof(arVals.GetAt(0)));
|
|
pXDataMap->SetAt(PIPE_THICK, _ttof(arVals.GetAt(1)));
|
|
pXDataMap->SetAt(PIPE_STDNO, arVals.GetAt(2));
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QueryHP(CUIISQLiteServer *pDb, double dDn, AecDbObjXDataMap *pXDataMap)
|
|
{
|
|
CString sSQL;
|
|
sSQL.Format(_T("select [外径],[长度],[标准号] from [AecHp] where [接管公称直径]=%d"), (int)(dDn+0.5));
|
|
|
|
CStringArray arVals;
|
|
pDb->GetSelData(sSQL, arVals);
|
|
|
|
if (arVals.GetSize() >= 3)
|
|
{
|
|
pXDataMap->SetAt(PIPE_D, _ttof(arVals.GetAt(0)));
|
|
pXDataMap->SetAt(KEY_L, _ttof(arVals.GetAt(1)));
|
|
pXDataMap->SetAt(PIPE_STDNO, arVals.GetAt(2));
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QuerySBFSpec(CUIISQLiteServer *pDb, const CString &sLevel, double dDn, AecDbObjXDataMap *pXDataMap)
|
|
{
|
|
CString sSQL;
|
|
sSQL.Format(_T("select * from [AecSpecFlange] where [公称直径]=%d and [等级名称]='%s' and [类别]='8字盲板'"),(int)(dDn + 0.5), sLevel);
|
|
|
|
CStringArray arVals;
|
|
pDb->GetSelData(sSQL, arVals);
|
|
|
|
/*
|
|
*0 [ID] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
|
1 [项目名称] varchar(255),
|
|
2 [等级名称] varchar(250),
|
|
3 [类别] varchar(250),
|
|
4 [类型] varchar(250),
|
|
5 [公称直径] INTEGER,
|
|
6 [材质] varchar(50),
|
|
7 [标准号] varchar(250),
|
|
8 [端面] varchar(50),
|
|
9 [压力] FLOAT,
|
|
10 [描述] varchar(255),
|
|
11 [制造类型] CHAR(50),
|
|
12 [元件代码] CHAR(50),
|
|
13 [短代码] CHAR(50));
|
|
*/
|
|
|
|
if (arVals.GetSize() < 14)
|
|
{
|
|
acutPrintf(_T("\n没有查询到8字盲板数据 %s"),sSQL);
|
|
return FALSE;
|
|
}
|
|
|
|
pXDataMap->SetAt(PIPE_FLANGP, arVals.GetAt(4));
|
|
pXDataMap->SetAt(PIPE_MATERIALFT, arVals.GetAt(6));
|
|
pXDataMap->SetAt(PIPE_STDNO, arVals.GetAt(7));
|
|
pXDataMap->SetAt(PIPE_FLANGF, arVals.GetAt(8));
|
|
pXDataMap->SetAt(PIPE_PRESSURE, arVals.GetAt(9));
|
|
pXDataMap->SetAt(PIPE_DESCR, arVals.GetAt(10));
|
|
pXDataMap->SetAt(KEY_PRODTP, arVals.GetAt(11));
|
|
pXDataMap->SetAt(KEY_ICODE, arVals.GetAt(12));
|
|
pXDataMap->SetAt(KEY_SCODE, arVals.GetAt(13));
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL TDbPipeSupport::QuerySBFlange(CUIISQLiteServer *pDb, double dDn, double dPress, AecDbObjXDataMap *pXDataMap)
|
|
{
|
|
CString sSQL;
|
|
|
|
CString sStd = _T("HG/T 21547");
|
|
pXDataMap->GetAt(PIPE_STDNO, sStd);
|
|
|
|
CString sFF = _T("FF");
|
|
pXDataMap->GetAt(PIPE_FLANGF, sFF);
|
|
|
|
/*
|
|
0 [ID] INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
1 [公称直径] INTEGER,
|
|
2 [压力] FLOAT,
|
|
3 [d] INTEGER,
|
|
4 [L] INTEGER,
|
|
5 [T1] INTEGER,
|
|
6 [T] FLOAT,
|
|
7 [B] INTEGER,
|
|
8 [Q] INTEGER,
|
|
9 [G] INTEGER,
|
|
10 [端面] CHAR(17),
|
|
11 [标准号] CHAR(50));
|
|
*/
|
|
|
|
sSQL.Format(_T("select * from [AecBFlangeData] where [公称直径]=%d and [压力]>%.1f and [压力]<%.1f "),
|
|
(int)(dDn+0.5),dPress-0.05,dPress+0.05);
|
|
|
|
CStringArray arVals;
|
|
pDb->GetSelData(sSQL, arVals);
|
|
|
|
if (arVals.GetSize() < 11)
|
|
{
|
|
acutPrintf(_T("\n没有查询到插板数据 %s"), sSQL);
|
|
return FALSE;
|
|
}
|
|
|
|
pXDataMap->SetAt(KEY_B, _ttof(arVals.GetAt(7)));
|
|
pXDataMap->SetAt(KEY_DD, _ttof(arVals.GetAt(3)));
|
|
pXDataMap->SetAt(KEY_L, _ttof(arVals.GetAt(4)));
|
|
pXDataMap->SetAt(KEY_T, _ttof(arVals.GetAt(6)));
|
|
pXDataMap->SetAt(PIPE_THICK, _ttof(arVals.GetAt(6)));//总厚度
|
|
pXDataMap->SetAt(KEY_T2, _ttof(arVals.GetAt(5)));
|
|
pXDataMap->SetAt(KEY_Q, _ttof(arVals.GetAt(8)));
|
|
pXDataMap->SetAt(KEY_G, _ttof(arVals.GetAt(9)));
|
|
pXDataMap->SetAt(KEY_ON, TRUE);//开关
|
|
pXDataMap->SetAt(PIPE_FLANGF, arVals.GetAt(10));
|
|
|
|
return TRUE;
|
|
} |