Files
envi-code/SourceCode/Code2026/tg_shs/shs_TwtKernal/PrincipleFeedDlg.cpp
T

647 lines
21 KiB
C++
Raw Normal View History

2026-10-04 00:04:20 +08:00
// PrincipleFeedDlg.cpp : implementation file
2026-09-28 15:28:50 +08:00
//
#include "stdafx.h"
#include <PipeWireMonitor.h>
#include <DbEquipment.h>
//#include <cbclass.h>
#include <xtext.h>
#include "PrincipleFeedDlg.h"
#include "DistFloorDlg.h"
#include "SanitaryDangDlg.h"
#include "DangFloorDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern void DrawFloorLine(XPoint p1, XPoint p2, const TCHAR*szPipeLayer, const TCHAR*szText, double nHeight, const TCHAR*szSerial);
/////////////////////////////////////////////////////////////////////////////////////////////
2026-10-04 00:04:20 +08:00
// 住宅给水原理
2026-09-28 15:28:50 +08:00
/////////////////////////////////////////////////////////////////////////////////////////////
void PrincipleFeed()
{
CTemporaryResourceOverride vTemp;
CPrincipleFeedDlg dlg;
if(dlg.DoModal() != IDOK)
return;
CString csLayer = LAY_PIPE_FEED;
InitPipeLayer(LAY_PIPE_FEED);
InitLayer(LAY_EQ_FEED);
XPoint ptIns, ptStart, ptEnd, ptFloor;
xg_getvar(_T("VIEWCTR"), ptIns);
ptIns = Ucs2Wcs(ptIns);
PickSet ss(SS_FREE);
ss.IncludeBegin();
double nAllHeight = dlg.m_nAllHeight;
double nBraLength = dlg.m_nFloorLen;
ptStart = ptIns;
ads_polar(ptStart, PI/2*3, dlg.m_nHeight*1000, ptStart);
ptFloor = ptIns;
CString csDwb = g_csDwbPath + _T("TwtSys");
XString xsTmp, xsTmp2, xsTmp4, xsTmp5, xsTmp7;
2026-10-04 00:04:20 +08:00
if(LoadDwbBlock(csDwb, _T("00000132"), xsTmp) != RTNORM) //断线
2026-09-28 15:28:50 +08:00
return;
if(dlg.m_iStyle == 1){
2026-10-04 00:04:20 +08:00
if(LoadDwbBlock(csDwb, _T("00000005"), xsTmp7) != RTNORM) //水龙头
2026-09-28 15:28:50 +08:00
return;
}
csDwb = g_csDwbPath + _T("valve");
2026-10-04 00:04:20 +08:00
if(LoadDwbBlock(csDwb, _T("00000295"), xsTmp5) != RTNORM) //阀门
2026-09-28 15:28:50 +08:00
return;
ads_polar(ptStart, PI/2, dlg.m_nHeight*1000/2, ptEnd);
InsValveByName((const TCHAR*)xsTmp5, ptEnd, csLayer);
if(dlg.m_bValve){
2026-10-04 00:04:20 +08:00
if(LoadDwbBlock(csDwb, _T("00000497"), xsTmp2) != RTNORM) //截止阀
2026-09-28 15:28:50 +08:00
return;
}
if(dlg.m_bAmmeter){
2026-10-04 00:04:20 +08:00
if(LoadDwbBlock(csDwb, _T("00000752"), xsTmp4) != RTNORM) //水表
2026-09-28 15:28:50 +08:00
return;
}
double nCountHeight = dlg.m_nMinEle;
Entity entLast;
InitTwtTextStyle(g_csTwtDimStyle);
for(int i=0;i<dlg.m_iNum+1;i++){
ptStart = ptFloor;
XPoint ptVerPipeS, ptVerPipeE;
ads_polar(ptStart, PI/2, dlg.m_nElevation*1000, ptVerPipeS);
if(i==0)
ads_polar(ptVerPipeS, PI/2*3, dlg.m_nHeight*1000, ptVerPipeE);
else
ads_polar(ptVerPipeS, PI/2*3, _tstof(dlg.m_lstHeight[i-1])*1000, ptVerPipeE);
2026-10-04 00:04:20 +08:00
//绘制每层立管
2026-09-28 15:28:50 +08:00
AcDbObjectId idPipe = DrawSysPipeByLayer(ptVerPipeE, ptVerPipeS, LAY_PIPE_FEED);
OPENOBJ_BEGIN(idPipe, AcDb::kForWrite, TDbPipe, pPipe);
if(pPipe){
2026-10-04 00:04:20 +08:00
pPipe->SetSysLabel(XString(_T("%d楼立管-1"), i+1));
// pPipe->SetSpareStr(_T("1#立管"));
2026-09-28 15:28:50 +08:00
}
OPENOBJ_END();
if(dlg.m_bFloor){
2026-10-04 00:04:20 +08:00
//楼板线和字
2026-09-28 15:28:50 +08:00
ads_polar(ptStart, PI, dlg.m_nHeight*1500, ptStart);
ads_polar(ptFloor, 0, dlg.m_nFloorLen, ptEnd);
CString csText;
if(i == dlg.m_iNum)
2026-10-04 00:04:20 +08:00
csText = _T("屋面");
2026-09-28 15:28:50 +08:00
else
csText = dlg.m_lstName[i];
double nLastHeight(0);
if(i > 0)
nLastHeight = _tstof(dlg.m_lstHeight[i-1]);
nCountHeight += nLastHeight;
DrawFloorLine(ptStart, ptEnd, csLayer, csText, nCountHeight,_T(""));
}
if(i == dlg.m_iNum)
break;
2026-10-04 00:04:20 +08:00
//干管
2026-09-28 15:28:50 +08:00
XPoint ptPipeS, ptPipeE, ptValve, ptAmmeter;
ads_polar(ptFloor, PI/2, dlg.m_nElevation*1000, ptPipeS);
BOOL bLeft = FALSE;
double nRotate(0);
if(dlg.m_iMode == 0)
nRotate = 0;
else if(dlg.m_iMode == 1){
nRotate = PI;
bLeft = TRUE;
}
2026-10-04 00:04:20 +08:00
//仅绘制一边 公共建筑 或 2户以下的住宅
2026-09-28 15:28:50 +08:00
if(dlg.m_iDoorNum == 1){
ads_polar(ptPipeS, nRotate, dlg.m_nLen, ptPipeE);
ads_polar(ptPipeS, nRotate, dlg.m_nLen/4, ptValve);
ads_polar(ptPipeS, nRotate, dlg.m_nLen/5*3, ptAmmeter);
if(bLeft)
DrawSysPipeByLayer(ptPipeE, ptPipeS, csLayer);
else
DrawSysPipeByLayer(ptPipeS, ptPipeE, csLayer);
entLast.GetLast();
OPENOBJ_BEGIN(entLast, AcDb::kForWrite, TDbPipe, pPipe);
if(pPipe){
2026-10-04 00:04:20 +08:00
pPipe->SetSysLabel(XString(_T("%d楼-1"), i+1));
2026-09-28 15:28:50 +08:00
}
OPENOBJ_END();
if(dlg.m_iStyle == 0)
InsEquipmentByName(xsTmp, ptPipeE, nRotate, LAY_EQ_FEED, FALSE, FALSE);
else{
if(dlg.m_iMode == 0)
InsEquipmentByName(xsTmp7, ptPipeE, 0, LAY_EQ_FEED, FALSE, FALSE);
else if(dlg.m_iMode == 1)
InsEquipmentByName(xsTmp7, ptPipeE, 0, LAY_EQ_FEED, TRUE, FALSE);
}
2026-10-04 00:04:20 +08:00
entLast.GetLast();//输入住宅参数
2026-09-28 15:28:50 +08:00
OPENOBJ_BEGIN(entLast, AcDb::kForWrite, TDbEquipment, pEquipTmp);
if(pEquipTmp){
2026-10-04 00:04:20 +08:00
pEquipTmp->SetDang(dlg.m_nNg); //总当量
pEquipTmp->SetPipeLength(dlg.m_nNumPeople); //每户人数
pEquipTmp->SetNumber(XString(_T("%.2f"), dlg.m_nFactor)); //小时变化系数
pEquipTmp->SetSysBlock(XString(_T("%.d"), dlg.m_iRation));//用水定额
2026-09-28 15:28:50 +08:00
}
OPENOBJ_END();
CString csDim;
2026-10-04 00:04:20 +08:00
csDim.Format(_T("%.1f人每户/q0=%d/Ng=%.1f每户/Kh=%.1f"), dlg.m_nNumPeople, dlg.m_iRation, dlg.m_nNg, dlg.m_nFactor);
2026-09-28 15:28:50 +08:00
XPoint ptText;
ads_polar(ptPipeE, 0, g_nTwtDimHeight * DocGetPScale(), ptText);
XText text(csDim, ptText, g_nTwtDimHeight * DocGetPScale(), g_nDimScale, g_csTwtDimStyle, LAY_CALC_TEXT);
if(bLeft)
text.Draw(AcDb::kTextBase, AcDb::kTextRight);
else
text.Draw();
entLast.GetLast();
WriteXdata(entLast, _T("TG-LAYER"), csLayer);
if(dlg.m_bValve)
InsValveByName((const TCHAR*)xsTmp2, ptValve, csLayer);
if(dlg.m_bAmmeter)
InsValveByName((const TCHAR*)xsTmp4, ptAmmeter, csLayer, ptPipeS, ptPipeE);
}
2026-10-04 00:04:20 +08:00
//2户以上的住宅
2026-09-28 15:28:50 +08:00
else if(dlg.m_iDoorNum > 1){
if(dlg.m_iFloorDir == 0)
ads_polar(ptPipeS, nRotate, dlg.m_nLen, ptPipeE);
else
ads_polar(ptPipeS, nRotate, dlg.m_nLen*dlg.m_iDoorNum, ptPipeE);
if(bLeft)
DrawSysPipeByLayer(ptPipeE, ptPipeS, csLayer);
else
DrawSysPipeByLayer(ptPipeS, ptPipeE, csLayer);
entLast.GetLast();
OPENOBJ_BEGIN(entLast, AcDb::kForWrite, TDbPipe, pPipe);
if(pPipe){
2026-10-04 00:04:20 +08:00
pPipe->SetSysLabel(XString(_T("%d楼-1"), i+1));
2026-09-28 15:28:50 +08:00
}
OPENOBJ_END();
if(dlg.m_bValve)
{
XPoint ptMid;
ads_polar(ptPipeS, nRotate, dlg.m_nLen/2, ptMid);
InsValveByName((const TCHAR*)xsTmp2, ptMid, csLayer);
}
Entity entLast;
entLast.GetLast();
OPENOBJ_BEGIN(entLast, AcDb::kForWrite, TDbPipe, pPipe);
if(pPipe){
2026-10-04 00:04:20 +08:00
pPipe->SetSysLabel(XString(_T("%d楼-1"), i+1));
2026-09-28 15:28:50 +08:00
}
OPENOBJ_END();
2026-10-04 00:04:20 +08:00
if(dlg.m_iFloorDir == 0) //横向绘制
2026-09-28 15:28:50 +08:00
{
double nDist = (dlg.m_iDoorNum-1) * 500;
XPoint ptBraS, ptBraE, ptBraTmp;
ads_polar(ptPipeE, PI/2, nDist/2, ptBraS);
ads_polar(ptPipeE, PI/2, -nDist/2, ptBraE);
DrawSysPipeByLayer(ptBraS, ptBraE, LAY_PIPE_FEED);
ptBraTmp = ptBraS;
for(int m=0;m<dlg.m_iDoorNum;m++){
ads_polar(ptBraTmp, -PI/2, 500*m, ptBraS);
ads_polar(ptBraS, nRotate, dlg.m_nLen/4, ptValve);
ads_polar(ptBraS, nRotate, dlg.m_nLen/5*3, ptAmmeter);
ads_polar(ptBraS, nRotate, dlg.m_nLen, ptBraE);
if(bLeft)
DrawSysPipeByLayer(ptBraE, ptBraS, csLayer);
else
DrawSysPipeByLayer(ptBraS, ptBraE, csLayer);
if(dlg.m_iStyle == 0)
InsEquipmentByName(xsTmp, ptBraE, nRotate, LAY_EQ_FEED, FALSE, FALSE);
else{
if(dlg.m_iMode == 0)
InsEquipmentByName(xsTmp7, ptBraE, 0, LAY_EQ_FEED, FALSE, FALSE);
else if(dlg.m_iMode == 1)
InsEquipmentByName(xsTmp7, ptBraE, 0, LAY_EQ_FEED, TRUE, FALSE);
}
Entity entLast;
entLast.GetLast();
OPENOBJ_BEGIN(entLast, AcDb::kForWrite, TDbEquipment, pEquipTmp);
if(pEquipTmp){
2026-10-04 00:04:20 +08:00
pEquipTmp->SetDang(dlg.m_nNg); //总当量
pEquipTmp->SetPipeLength(dlg.m_nNumPeople); //每户人数
pEquipTmp->SetNumber(XString(_T("%.2f"), dlg.m_nFactor)); //小时变化系数
pEquipTmp->SetSysBlock(XString(_T("%.d"), dlg.m_iRation));//用水定额
2026-09-28 15:28:50 +08:00
// pEquipTmp->SetDang(-1);
}
OPENOBJ_END();
CString csDim;
2026-10-04 00:04:20 +08:00
csDim.Format(_T("%.1f人每户/q0=%d/Ng=%.1f每户/Kh=%.1f"), dlg.m_nNumPeople, dlg.m_iRation, dlg.m_nNg, dlg.m_nFactor);
2026-09-28 15:28:50 +08:00
XPoint ptText;
ads_polar(ptBraE, 0, g_nTwtDimHeight * DocGetPScale(), ptText);
XText text(csDim, ptText, g_nTwtDimHeight * DocGetPScale(), g_nDimScale, g_csTwtDimStyle, LAY_CALC_TEXT);
if(bLeft)
text.Draw(AcDb::kTextBase, AcDb::kTextRight);
else
text.Draw();
entLast.GetLast();
WriteXdata(entLast, _T("TG-LAYER"), csLayer);
if(dlg.m_bValve)
InsValveByName((const TCHAR*)xsTmp2, ptValve, csLayer);
if(dlg.m_bAmmeter)
InsValveByName((const TCHAR*)xsTmp4, ptAmmeter, csLayer, ptPipeS, ptPipeE);
}
}
2026-10-04 00:04:20 +08:00
else{ //竖向绘制
2026-09-28 15:28:50 +08:00
XPoint ptBraS, ptBraE, ptBraTmp;
for(int m=0;m<dlg.m_iDoorNum;m++){
ads_polar(ptPipeS, nRotate, dlg.m_nLen*(m+1), ptBraS);
ads_polar(ptBraS, PI/2, dlg.m_nLen, ptBraE);
ads_polar(ptBraS, PI/2, dlg.m_nLen/4, ptValve);
ads_polar(ptBraS, PI/2, dlg.m_nLen/5*3, ptAmmeter);
DrawSysPipeByLayer(ptBraS, ptBraE, csLayer);
if(dlg.m_iStyle == 0)
InsEquipmentByName(xsTmp, ptBraE, PI/2, LAY_EQ_FEED, FALSE, FALSE);
else{
if(dlg.m_iMode == 0)
InsEquipmentByName(xsTmp7, ptBraE, 0, LAY_EQ_FEED, FALSE, FALSE);
else if(dlg.m_iMode == 1)
InsEquipmentByName(xsTmp7, ptBraE, 0, LAY_EQ_FEED, TRUE, FALSE);
}
Entity entLast;
entLast.GetLast();
OPENOBJ_BEGIN(entLast, AcDb::kForWrite, TDbEquipment, pEquipTmp);
if(pEquipTmp){
2026-10-04 00:04:20 +08:00
pEquipTmp->SetDang(dlg.m_nNg); //总当量
pEquipTmp->SetPipeLength(dlg.m_nNumPeople); //每户人数
pEquipTmp->SetNumber(XString(_T("%.2f"), dlg.m_nFactor)); //小时变化系数
pEquipTmp->SetSysBlock(XString(_T("%.d"), dlg.m_iRation));//用水定额
2026-09-28 15:28:50 +08:00
}
OPENOBJ_END();
if(dlg.m_bValve)
InsValveByName((const TCHAR*)xsTmp2, ptValve, csLayer);
if(dlg.m_bAmmeter)
InsValveByName((const TCHAR*)xsTmp4, ptAmmeter, csLayer, ptPipeS, ptPipeE);
}
}
}
ads_polar(ptFloor, PI/2, _tstof(dlg.m_lstHeight[i])*1000, ptFloor);
}
ss.IncludeEnd();
PickSet ssCopy(SS_FREE);
for(long m=0;m<ss.Length();m++){
Entity entTmp = ss[m];
if(!(entTmp.Is(_T("LINE")) || entTmp.Is(_T("ATS_ELEVATION")) || entTmp.Is(_T("ATS_TEXT"))))
ssCopy += entTmp;
OPENOBJ_BEGIN(entTmp, AcDb::kForWrite, TDbPipe, pPipe);
if(pPipe){
pPipe->SetMaterial(dlg.m_iMaterial);
}
OPENOBJ_END();
}
int nOsMode=0;
xg_getvar(_T("OSMODE"), &nOsMode);
nOsMode &= ~0x4000;
nOsMode |= OS_INT|OS_END|OS_NEA|OS_MID;
XPushVar<int> vOsMode(_T("OSMODE"), nOsMode);
ptIns = Wcs2Ucs(ptIns);
ss.Redraw(2);
XPoint ptFinal;
2026-10-04 00:04:20 +08:00
actrTransactionManager->flushGraphics(); //acad 刷新
int nRet = DragMovePickSet(ss, _T("\n请点取系统图位置<退出>: "), ptIns, ptFinal);
2026-09-28 15:28:50 +08:00
if(nRet != RTNORM){
ss.Erase();
TPipePerDocData *pData = GetCurPipeDocData();
pData->EnableWork(FALSE);
return;
}
ss.Redraw(1);
if(dlg.m_iVPipeNum > 1){
if(dlg.m_iFeedDir == 0)
ads_polar(ptFinal, PI/2*3, dlg.m_nHeight*1000-dlg.m_nElevation*1000, ptFinal);
else
ads_polar(ptFinal, PI/2, dlg.m_nHeight*1000*dlg.m_iNum+dlg.m_nElevation*1000, ptFinal);
XPoint ptMove = ptFinal;
XPushVar<int> vOsMode3(_T("OSMODE"), 0);
for(int m=0;m<dlg.m_iVPipeNum;m++){
PickSet ssNew2(SS_FREE);
XPoint ptTmp = ptMove;
ptMove.x += dlg.m_iVPipeDist;
AcDbObjectId idPipe = DrawSysPipeByLayer(ptTmp, ptMove, LAY_PIPE_FEED);
OPENOBJ_BEGIN(idPipe, AcDb::kForWrite, TDbPipe, pPipe);
if(pPipe){
2026-10-04 00:04:20 +08:00
pPipe->SetSysLabel(XString(_T("干管-%d"),m+1));
2026-09-28 15:28:50 +08:00
}
OPENOBJ_END();
entLast.GetLast();
if(dlg.m_iFeedDir == 0)
2026-10-04 00:04:20 +08:00
WriteXdata(entLast, _T("TG-FEED-DIR"), _T("自下而上"));
2026-09-28 15:28:50 +08:00
else
2026-10-04 00:04:20 +08:00
WriteXdata(entLast, _T("TG-FEED-DIR"), _T("自上而下"));
2026-09-28 15:28:50 +08:00
if(m == dlg.m_iVPipeNum-1)
continue;
ssNew2.IncludeBegin();
SHads_command(RTSTR, _T("COPY"), RTPICKS, (TLong_ptr *)ssCopy, RTSTR, _T(""),
RT3DPOINT, &ptFinal, RT3DPOINT, &ptMove, RTNONE);
ssNew2.IncludeEnd();
for(long n=0;n<ssNew2.Length();n++){
Entity entTmp = ssNew2[n];
OPENOBJ_BEGIN(entTmp, AcDb::kForWrite, TDbPipe, pPipe);
if(pPipe){
CString csFloor = pPipe->GetSysLabel();
int idx = csFloor.Find(_T("-"));
if(idx > -1){
CString csLeft = csFloor.Left(idx);
csLeft.Format(_T("%s-%d"), csLeft, m+2);
pPipe->SetSysLabel(csLeft);
}
}
OPENOBJ_END();
}
}
}
}
/////////////////////////////////////////////////////////////////////////////
// CPrincipleFeedDlg dialog
BOOL CPrincipleFeedDlg::m_bFloor = TRUE;
int CPrincipleFeedDlg::m_iNum = 6;
CString CPrincipleFeedDlg::m_csMaterial = "";
double CPrincipleFeedDlg::m_nNumPeople = 4;
double CPrincipleFeedDlg::m_nFactor = 2.8;
int CPrincipleFeedDlg::m_iRation = 250;
double CPrincipleFeedDlg::m_nNg = 4;
CPrincipleFeedDlg::CPrincipleFeedDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPrincipleFeedDlg::IDD, pParent), m_spinFloor(1), m_spinLen(50), m_spinDoor(1)
{
//{{AFX_DATA_INIT(CPrincipleFeedDlg)
m_iMode = 0;
m_iStyle = 0;
m_bValve = TRUE;
m_bAmmeter = FALSE;
m_nFloorLen = 500;
m_nHeight = 3;
m_nElevation = 0.3;
m_nLen = 600;
m_iDoorNum = 1;
m_iMaterial = -1;
m_iVPipeDist = 10000;
m_iVPipeNum = 1;
m_iFeedDir = 0;
m_iFloorDir = 0;
//}}AFX_DATA_INIT
m_nAllHeight = 0;
m_nMinEle = 0;
}
void CPrincipleFeedDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPrincipleFeedDlg)
DDX_Control(pDX, IDC_COMBO_MATERIAL, m_comboMat);
DDX_Control(pDX, IDC_SPIN_DOORNUM, m_spinDoor);
DDX_Control(pDX, IDC_SPIN_LEN, m_spinLen);
DDX_Control(pDX, IDC_SPIN_FLOOR, m_spinFloor);
DDX_Radio(pDX, IDC_RADIO_TYPE1, m_iMode);
DDX_Radio(pDX, IDC_RADIO_STYLE1, m_iStyle);
DDX_Check(pDX, IDC_CHECK_VALVE, m_bValve);
DDX_Check(pDX, IDC_CHECK_AMMETER, m_bAmmeter);
DDX_Text(pDX, IDC_FLOOR_LEN2, m_nFloorLen);
DDX_Text(pDX, IDC_EDIT_FOOR_HEIGHT, m_nHeight);
DDX_Text(pDX, IDC_EDIT_ELEVATION, m_nElevation);
DDX_Text(pDX, IDC_FLOOR_LEN, m_nLen);
DDX_Text(pDX, IDC_EDIT_DOORNUM, m_iDoorNum);
DDX_CBIndex(pDX, IDC_COMBO_MATERIAL, m_iMaterial);
DDX_Text(pDX, IDC_VPIPE_DIST, m_iVPipeDist);
DDX_Text(pDX, IDC_VPIPE_NUM, m_iVPipeNum);
DDX_Radio(pDX, IDC_RADIO_FEEDDIR, m_iFeedDir);
DDX_Text(pDX, IDC_EDIT_RATION, m_iRation);
DDX_Text(pDX, IDC_EDIT_HOUR_FACTOR, m_nFactor);
DDX_Text(pDX, IDC_EDIT_PEOPLE_NUM, m_nNumPeople);
DDX_Text(pDX, IDC_FLOOR_NUM, m_iNum);
DDX_Check(pDX, IDC_CHECK_FLOOR, m_bFloor);
DDX_Text(pDX, IDC_EDIT_DOOR_DANG, m_nNg);
DDX_CBIndex(pDX, IDC_COMBO_FLOOR_DIR, m_iFloorDir);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPrincipleFeedDlg, CDialog)
//{{AFX_MSG_MAP(CPrincipleFeedDlg)
ON_WM_PAINT()
ON_BN_CLICKED(IDC_RADIO_TYPE1, OnRadioType1)
ON_BN_CLICKED(IDC_RADIO_TYPE2, OnRadioType2)
ON_BN_CLICKED(IDC_BUTTON_HEIGHT, OnButtonHeight)
ON_BN_CLICKED(IDC_BUTTON_RATION, OnButtonRation)
ON_BN_CLICKED(IDC_BUTTON_FACTOR, OnButtonFactor)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPrincipleFeedDlg message handlers
BOOL CPrincipleFeedDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_spinFloor.SetRange(1, 50);
m_spinLen.SetRange(50, 5000);
m_spinDoor.SetRange(1, 50);
XStringList lstMat;
GetPipeMaterialList(lstMat);
for(int i=0;i<lstMat.Length();i++){
m_comboMat.AddString(lstMat[i]);
CString csTmp = lstMat[i];
if(m_csMaterial == csTmp)
m_iMaterial = i;
}
if(m_iMaterial < 0)
m_iMaterial = g_iPipeMaterial[0];
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CPrincipleFeedDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
OpenSlide();
}
void CPrincipleFeedDlg::OpenSlide()
{
CWnd *pWnd = GetDlgItem(IDC_STATIC_PREVIEW);
CString csTmp;
UpdateData(TRUE);
csTmp.Format(_T("TWT(ZKT%d)"), m_iMode+1);
DrawSlide(csTmp, pWnd);
}
void CPrincipleFeedDlg::OnRadioType1()
{
OpenSlide();
}
void CPrincipleFeedDlg::OnRadioType2()
{
OpenSlide();
}
void CPrincipleFeedDlg::OnButtonHeight()
{
UpdateData(TRUE);
CTemporaryResourceOverride vTemp;
CDistFloorDlg dlg;
for(int i=0;i<m_iNum;i++){
CString csText, csHeight;
2026-10-04 00:04:20 +08:00
csText.Format(_T("%d楼"), i+1);
2026-09-28 15:28:50 +08:00
dlg.m_lstName.Append(tstrnew(csText));
csHeight.Format(_T("%.2f"), m_nHeight);
dlg.m_lstHeight.Append(tstrnew(csHeight));
}
if(dlg.DoModal() != IDOK)
return;
m_nMinEle = _tstof(dlg.m_sStartBaseEle);//zxl 2011.10.20 add
m_lstHeight.Reset();
m_iNum = dlg.m_lstHeight.Length();
for(i=0;i<m_iNum;i++){
CString csHeight = dlg.m_lstHeight[i];
m_lstHeight.Append(tstrnew(csHeight));
CString csText = dlg.m_lstName[i];
m_lstName.Append(tstrnew(csText));
}
UpdateData(FALSE);
}
void CPrincipleFeedDlg::OnOK()
{
UpdateData(TRUE);
m_comboMat.GetLBText(m_iMaterial, m_csMaterial);
CString csHeight, csText;
2026-10-04 00:04:20 +08:00
//把楼层高列表补齐
2026-09-28 15:28:50 +08:00
if(m_lstHeight.Length() < 1){
for(int i=0;i<m_iNum;i++){
2026-10-04 00:04:20 +08:00
csText.Format(_T("%d楼"), i+1);
2026-09-28 15:28:50 +08:00
m_lstName.Append(tstrnew(csText));
csHeight.Format(_T("%.2f"), m_nHeight);
m_lstHeight.Append(tstrnew(csHeight));
}
}
int len = m_iNum - m_lstHeight.Length();
for(int j=0;j<len;j++){
csHeight.Format(_T("%.2f"), m_nHeight);
m_lstHeight.Append(tstrnew(csHeight));
2026-10-04 00:04:20 +08:00
csText.Format(_T("%d楼"), m_lstHeight.Length());
2026-09-28 15:28:50 +08:00
m_lstName.Append(tstrnew(csText));
}
2026-10-04 00:04:20 +08:00
//计算总高度
2026-09-28 15:28:50 +08:00
for(int i=0;i<m_iNum;i++){
csHeight = m_lstHeight[i];
m_nAllHeight += (_tstof(csHeight)*1000);
CString csText = m_lstName[i];
2026-10-04 00:04:20 +08:00
//if(csText.Find(_T("地下")) > -1)
if(csText.Find(_T("地下")) > -1 || csText.Find(_T("-")) > -1)//添加-1F -2F表示楼层 zxl 2011.10.20 add
2026-09-28 15:28:50 +08:00
m_nMinEle -= _tstof(m_lstHeight[i]);
}
if(m_nLen < 1)
m_nLen = 10;
if(m_bAmmeter && m_bValve && m_nLen < 10)
m_nLen = 600;
CDialog::OnOK();
}
void CPrincipleFeedDlg::OnButtonRation()
{
2026-10-04 00:04:20 +08:00
//AfxMessageBox(_T("住宅最高日生活用水定额\n\n1.普通住宅Ⅰ (有大便器、洗涤盆) 85~150\n2.普通住宅Ⅱ(有大便器、洗脸盆、洗涤盆、洗衣机、 热水器和沐浴设备) 130~300\n3.普通住宅Ⅲ(有大便器、洗脸盆、洗涤盆、洗衣机、 集中热水供应和沐浴设备) 180~320\n4.别墅 (有大便器、洗脸盆、洗涤盆、洗衣机、洒水栓,家用热水机组和沐浴设备) 200~350\n\n"));
2026-09-28 15:28:50 +08:00
RBList rbCmd=ads_buildlist(RTSTR, _T("IPrincipleFeed"), NULL);
resbuf *rbRes=NULL;
if(ads_invoke(rbCmd, &rbRes) == RTNORM && rbRes)
{
ads_relrb(rbRes);
}
}
void CPrincipleFeedDlg::OnButtonFactor()
{
2026-10-04 00:04:20 +08:00
//AfxMessageBox(_T("住宅最高日生活用水小时变化系数Kh\n\n1.普通住宅Ⅰ (有大便器、洗涤盆) 3.0~2.5\n2.普通住宅Ⅱ(有大便器、洗脸盆、洗涤盆、洗衣机、 热水器和沐浴设备) 2.8~2.3\n3.普通住宅Ⅲ(有大便器、洗脸盆、洗涤盆、洗衣机、 集中热水供应和沐浴设备) 2.5~2.0\n4.别墅 (有大便器、洗脸盆、洗涤盆、洗衣机、洒水栓,家用热水机组和沐浴设备) 2.3~1.8\n\n"));
2026-09-28 15:28:50 +08:00
RBList rbCmd=ads_buildlist(RTSTR, _T("IPrincipleFeed"), NULL);
resbuf *rbRes=NULL;
if(ads_invoke(rbCmd, &rbRes) == RTNORM && rbRes)
{
ads_relrb(rbRes);
}
}