Files
envi-code/SourceCode/Code2026/tg_shs/shs_TwtPump/SelWaterTankDlg.cpp
T
2026-09-28 15:28:50 +08:00

361 lines
12 KiB
C++

// SelWaterTankDlg.cpp : implementation file
//
#include "stdafx.h"
#include "SelWaterTankDlg.h"
#include "TGAs.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSelWaterTankDlg dialog
CSelWaterTankDlg::CSelWaterTankDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSelWaterTankDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSelWaterTankDlg)
m_iShape = 1;
m_dV = 0.0;
//}}AFX_DATA_INIT
}
void CSelWaterTankDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSelWaterTankDlg)
DDX_Control(pDX, IDC_LIST_DATA, m_listCtrl);
DDX_Radio(pDX, IDC_RADIO_SHAPE1, m_iShape);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSelWaterTankDlg, CDialog)
//{{AFX_MSG_MAP(CSelWaterTankDlg)
ON_BN_CLICKED(IDC_RADIO_SHAPE1, OnRadioShape1)
ON_BN_CLICKED(IDC_RADIO_SHAPE2, OnRadioShape2)
ON_NOTIFY(NM_DBLCLK, IDC_LIST_DATA, OnDblclkListData)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSelWaterTankDlg message handlers
BOOL CSelWaterTankDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_listCtrl.SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
ResetList();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSelWaterTankDlg::OnRadioShape1()
{
ResetList();
}
void CSelWaterTankDlg::OnRadioShape2()
{
ResetList();
}
void CSelWaterTankDlg::ResetList()
{
UpdateData();
int nColumnCount = m_listCtrl.GetHeaderCtrl()->GetItemCount();
for(int i=0;i<nColumnCount;i++)
{
m_listCtrl.DeleteColumn(0);
}
m_listCtrl.DeleteAllItems();
if(m_iShape == 0){
m_listCtrl.InsertColumn ( 0, _T("容积m^3"), LVCFMT_LEFT, 60 );
m_listCtrl.InsertColumn ( 1, _T("水箱直径"), LVCFMT_LEFT, 60 );
m_listCtrl.InsertColumn ( 2, _T("水箱高"), LVCFMT_LEFT, 50 );
m_listCtrl.InsertColumn ( 3, _T("支座边距"), LVCFMT_LEFT, 60 );
m_listCtrl.InsertColumn ( 4, _T("支座间距"), LVCFMT_LEFT, 60 );
m_listCtrl.InsertColumn ( 5, _T("重量kg"), LVCFMT_LEFT, 50 );
m_listCtrl.InsertColumn ( 6, _T("标准图号"), LVCFMT_LEFT, 0 );
m_listCtrl.InsertItem ( 0, _T("0.5"), 0 );
m_listCtrl.SetItemText ( 0, 1, _T("930"));
m_listCtrl.SetItemText ( 0, 2, _T("1000"));
m_listCtrl.SetItemText ( 0, 3, _T("200"));
m_listCtrl.SetItemText ( 0, 4, _T("500"));
m_listCtrl.SetItemText ( 0, 5, _T("153.6"));
m_listCtrl.SetItemText ( 0, 6, _T("S151(二),页4"));
m_listCtrl.InsertItem ( 1, _T("0.5"), 0 );
m_listCtrl.SetItemText ( 1, 1, _T("1030"));
m_listCtrl.SetItemText ( 1, 2, _T("900"));
m_listCtrl.SetItemText ( 1, 3, _T("250"));
m_listCtrl.SetItemText ( 1, 4, _T("500"));
m_listCtrl.SetItemText ( 1, 5, _T("163.4"));
m_listCtrl.SetItemText ( 1, 6, _T("S151(二),页4"));
m_listCtrl.InsertItem ( 2, _T("1.0"), 0 );
m_listCtrl.SetItemText ( 2, 1, _T("1130"));
m_listCtrl.SetItemText ( 2, 2, _T("1300"));
m_listCtrl.SetItemText ( 2, 3, _T("265"));
m_listCtrl.SetItemText ( 2, 4, _T("600"));
m_listCtrl.SetItemText ( 2, 5, _T("238.4"));
m_listCtrl.SetItemText ( 2, 6, _T("S151(二),页5"));
m_listCtrl.InsertItem ( 3, _T("1.0"), 0 );
m_listCtrl.SetItemText ( 3, 1, _T("1230"));
m_listCtrl.SetItemText ( 3, 2, _T("1200"));
m_listCtrl.SetItemText ( 3, 3, _T("315"));
m_listCtrl.SetItemText ( 3, 4, _T("600"));
m_listCtrl.SetItemText ( 3, 5, _T("253.1"));
m_listCtrl.SetItemText ( 3, 6, _T("S151(二),页5"));
m_listCtrl.InsertItem ( 4, _T("2.0"), 0 );
m_listCtrl.SetItemText ( 4, 1, _T("1430"));
m_listCtrl.SetItemText ( 4, 2, _T("1500"));
m_listCtrl.SetItemText ( 4, 3, _T("415"));
m_listCtrl.SetItemText ( 4, 4, _T("600"));
m_listCtrl.SetItemText ( 4, 5, _T("366.3"));
m_listCtrl.SetItemText ( 4, 6, _T("S151(二),页6"));
m_listCtrl.InsertItem ( 5, _T("2.0"), 0 );
m_listCtrl.SetItemText ( 5, 1, _T("1530"));
m_listCtrl.SetItemText ( 5, 2, _T("1300"));
m_listCtrl.SetItemText ( 5, 3, _T("415"));
m_listCtrl.SetItemText ( 5, 4, _T("700"));
m_listCtrl.SetItemText ( 5, 5, _T("341.9"));
m_listCtrl.SetItemText ( 5, 6, _T("S151(二),页6"));
m_listCtrl.InsertItem ( 6, _T("3.0"), 0 );
m_listCtrl.SetItemText ( 6, 1, _T("1630"));
m_listCtrl.SetItemText ( 6, 2, _T("1800"));
m_listCtrl.SetItemText ( 6, 3, _T("465"));
m_listCtrl.SetItemText ( 6, 4, _T("700"));
m_listCtrl.SetItemText ( 6, 5, _T("485.7"));
m_listCtrl.SetItemText ( 6, 6, _T("S151(二),页7"));
m_listCtrl.InsertItem ( 7, _T("3.0"), 0 );
m_listCtrl.SetItemText ( 7, 1, _T("1830"));
m_listCtrl.SetItemText ( 7, 2, _T("1500"));
m_listCtrl.SetItemText ( 7, 3, _T("565"));
m_listCtrl.SetItemText ( 7, 4, _T("700"));
m_listCtrl.SetItemText ( 7, 5, _T("503.9"));
m_listCtrl.SetItemText ( 7, 6, _T("S151(二),页7"));
m_listCtrl.InsertItem ( 8, _T("4.0"), 0 );
m_listCtrl.SetItemText ( 8, 1, _T("1830"));
m_listCtrl.SetItemText ( 8, 2, _T("1800"));
m_listCtrl.SetItemText ( 8, 3, _T("565"));
m_listCtrl.SetItemText ( 8, 4, _T("700"));
m_listCtrl.SetItemText ( 8, 5, _T("567.3"));
m_listCtrl.SetItemText ( 8, 6, _T("S151(二),页8"));
m_listCtrl.InsertItem ( 9, _T("4.0"), 0 );
m_listCtrl.SetItemText ( 9, 1, _T("2030"));
m_listCtrl.SetItemText ( 9, 2, _T("1600"));
m_listCtrl.SetItemText ( 9, 3, _T("415"));
m_listCtrl.SetItemText ( 9, 4, _T("600"));
m_listCtrl.SetItemText ( 9, 5, _T("606.5"));
m_listCtrl.SetItemText ( 9, 6, _T("S151(二),页8"));
m_listCtrl.InsertItem ( 10, _T("5.0"), 0 );
m_listCtrl.SetItemText ( 10, 1, _T("1830"));
m_listCtrl.SetItemText ( 10, 2, _T("2200"));
m_listCtrl.SetItemText ( 10, 3, _T("315"));
m_listCtrl.SetItemText ( 10, 4, _T("600"));
m_listCtrl.SetItemText ( 10, 5, _T("644.9"));
m_listCtrl.SetItemText ( 10, 6, _T("S151(二),页9"));
m_listCtrl.InsertItem ( 11, _T("5.0"), 0 );
m_listCtrl.SetItemText ( 11, 1, _T("2030"));
m_listCtrl.SetItemText ( 11, 2, _T("1800"));
m_listCtrl.SetItemText ( 11, 3, _T("365"));
m_listCtrl.SetItemText ( 11, 4, _T("650"));
m_listCtrl.SetItemText ( 11, 5, _T("650.2"));
m_listCtrl.SetItemText ( 11, 6, _T("S151(二),页9"));
m_listCtrl.InsertItem ( 12, _T("8.0"), 0 );
m_listCtrl.SetItemText ( 12, 1, _T("2240"));
m_listCtrl.SetItemText ( 12, 2, _T("2400"));
m_listCtrl.SetItemText ( 12, 3, _T("470"));
m_listCtrl.SetItemText ( 12, 4, _T("650"));
m_listCtrl.SetItemText ( 12, 5, _T("1034.9"));
m_listCtrl.SetItemText ( 12, 6, _T("S151(二),页10"));
m_listCtrl.InsertItem ( 13, _T("8.0"), 0 );
m_listCtrl.SetItemText ( 13, 1, _T("2440"));
m_listCtrl.SetItemText ( 13, 2, _T("2000"));
m_listCtrl.SetItemText ( 13, 3, _T("520"));
m_listCtrl.SetItemText ( 13, 4, _T("700"));
m_listCtrl.SetItemText ( 13, 5, _T("1031.2"));
m_listCtrl.SetItemText ( 13, 6, _T("S151(二),页10"));
m_listCtrl.InsertItem ( 14, _T("10.0"), 0 );
m_listCtrl.SetItemText ( 14, 1, _T("2440"));
m_listCtrl.SetItemText ( 14, 2, _T("2400"));
m_listCtrl.SetItemText ( 14, 3, _T("520"));
m_listCtrl.SetItemText ( 14, 4, _T("700"));
m_listCtrl.SetItemText ( 14, 5, _T("1161.5"));
m_listCtrl.SetItemText ( 14, 6, _T("S151(二),页11"));
m_listCtrl.InsertItem ( 15, _T("10.0"), 0 );
m_listCtrl.SetItemText ( 15, 1, _T("2640"));
m_listCtrl.SetItemText ( 15, 2, _T("2200"));
m_listCtrl.SetItemText ( 15, 3, _T("420"));
m_listCtrl.SetItemText ( 15, 4, _T("600"));
m_listCtrl.SetItemText ( 15, 5, _T("1219.4"));
m_listCtrl.SetItemText ( 15, 6, _T("S151(二),页11"));
m_listCtrl.InsertItem ( 16, _T("15.0"), 0 );
m_listCtrl.SetItemText ( 16, 1, _T("2840"));
m_listCtrl.SetItemText ( 16, 2, _T("2700"));
m_listCtrl.SetItemText ( 16, 3, _T("520"));
m_listCtrl.SetItemText ( 16, 4, _T("600"));
m_listCtrl.SetItemText ( 16, 5, _T("1500"));
m_listCtrl.SetItemText ( 16, 6, _T("S151(二),页12"));
m_listCtrl.InsertItem ( 17, _T("15.0"), 0 );
m_listCtrl.SetItemText ( 17, 1, _T("3040"));
m_listCtrl.SetItemText ( 17, 2, _T("2400"));
m_listCtrl.SetItemText ( 17, 3, _T("320"));
m_listCtrl.SetItemText ( 17, 4, _T("600"));
m_listCtrl.SetItemText ( 17, 5, _T("1564.6"));
m_listCtrl.SetItemText ( 17, 6, _T("S151(二),页12"));
m_listCtrl.InsertItem ( 18, _T("20.0"), 0 );
m_listCtrl.SetItemText ( 18, 1, _T("3040"));
m_listCtrl.SetItemText ( 18, 2, _T("3000"));
m_listCtrl.SetItemText ( 18, 3, _T("320"));
m_listCtrl.SetItemText ( 18, 4, _T("600"));
m_listCtrl.SetItemText ( 18, 5, _T("2108.8"));
m_listCtrl.SetItemText ( 18, 6, _T("S151(二),页13"));
m_listCtrl.InsertItem ( 19, _T("20.0"), 0 );
m_listCtrl.SetItemText ( 19, 1, _T("3440"));
m_listCtrl.SetItemText ( 19, 2, _T("2400"));
m_listCtrl.SetItemText ( 19, 3, _T("320"));
m_listCtrl.SetItemText ( 19, 4, _T("700"));
m_listCtrl.SetItemText ( 19, 5, _T("2168.5"));
m_listCtrl.SetItemText ( 19, 6, _T("S151(二),页13"));
m_listCtrl.InsertItem ( 20, _T("25.0"), 0 );
m_listCtrl.SetItemText ( 20, 1, _T("3440"));
m_listCtrl.SetItemText ( 20, 2, _T("3000"));
m_listCtrl.SetItemText ( 20, 3, _T("320"));
m_listCtrl.SetItemText ( 20, 4, _T("700"));
m_listCtrl.SetItemText ( 20, 5, _T("2524.4"));
m_listCtrl.SetItemText ( 20, 6, _T("S151(二),页14"));
m_listCtrl.InsertItem ( 21, _T("25.0"), 0 );
m_listCtrl.SetItemText ( 21, 1, _T("3640"));
m_listCtrl.SetItemText ( 21, 2, _T("2600"));
m_listCtrl.SetItemText ( 21, 3, _T("520"));
m_listCtrl.SetItemText ( 21, 4, _T("650"));
m_listCtrl.SetItemText ( 21, 5, _T("2506.5"));
m_listCtrl.SetItemText ( 21, 6, _T("S151(二),页14"));
m_listCtrl.InsertItem ( 22, _T("30.0"), 0 );
m_listCtrl.SetItemText ( 22, 1, _T("3640"));
m_listCtrl.SetItemText ( 22, 2, _T("3000"));
m_listCtrl.SetItemText ( 22, 3, _T("320"));
m_listCtrl.SetItemText ( 22, 4, _T("600"));
m_listCtrl.SetItemText ( 22, 5, _T("2860.5"));
m_listCtrl.SetItemText ( 22, 6, _T("S151(二),页15"));
m_listCtrl.InsertItem ( 23, _T("30.0"), 0 );
m_listCtrl.SetItemText ( 23, 1, _T("3840"));
m_listCtrl.SetItemText ( 23, 2, _T("2800"));
m_listCtrl.SetItemText ( 23, 3, _T("420"));
m_listCtrl.SetItemText ( 23, 4, _T("600"));
m_listCtrl.SetItemText ( 23, 5, _T("2844.4"));
m_listCtrl.SetItemText ( 23, 6, _T("S151(二),页15"));
}
else{
m_listCtrl.InsertColumn ( 0, _T("容积m^3"), LVCFMT_LEFT, 60 );
m_listCtrl.InsertColumn ( 1, _T("水箱长"), LVCFMT_LEFT, 55 );
m_listCtrl.InsertColumn ( 2, _T("水箱宽"), LVCFMT_LEFT, 55 );
m_listCtrl.InsertColumn ( 3, _T("水箱高"), LVCFMT_LEFT, 55 );
m_listCtrl.InsertColumn ( 4, _T("重量kg"), LVCFMT_LEFT, 55 );
m_listCtrl.InsertColumn ( 5, _T("名称"), LVCFMT_LEFT, 120 );
m_listCtrl.InsertColumn ( 6, _T("图集号页数"), LVCFMT_LEFT, 80 );
XString fullFile;
if(!FindFile(_T("rectangulartank.dbf"), fullFile))
{
AfxMessageBox(_T("对不起,没有发现rectangulartank.dbf文件!"));
return;
}
CodeBase db;
db.read_only = 1;
XDbfTable *pTable = db.Open(fullFile);
if(!pTable)
return;
int nRow = 0;
CString strV = _T("");
CString strL = _T("");
CString strB = _T("");
CString strH = _T("");
CString strW = _T("");
CString strName = _T("");
CString strPage = _T("");
for(pTable->MoveFirst();!pTable->IsEOF();pTable->MoveNext())
{
GET_FIELD(pTable, _T("V"), strV);
GET_FIELD(pTable, _T("L"), strL);
GET_FIELD(pTable, _T("B"), strB);
GET_FIELD(pTable, _T("H"), strH);
GET_FIELD(pTable, _T("Weight"), strW);
GET_FIELD(pTable, _T("Name"), strName);
GET_FIELD(pTable, _T("Page"), strPage);
if (m_dV > _tstof(strV))
{
continue;
}
m_listCtrl.InsertItem ( nRow, strV, 0 );
m_listCtrl.SetItemText ( nRow, 1, strL);
m_listCtrl.SetItemText ( nRow, 2, strB);
m_listCtrl.SetItemText ( nRow, 3, strH);
m_listCtrl.SetItemText ( nRow, 4, strW);
m_listCtrl.SetItemText ( nRow, 5, strName);
m_listCtrl.SetItemText ( nRow, 6, strPage);
nRow++;
}
}
}
void CSelWaterTankDlg::OnOK()
{
UpdateData(TRUE);
POSITION pos = m_listCtrl.GetFirstSelectedItemPosition();
if(!pos)
return;
int nItem = m_listCtrl.GetNextSelectedItem(pos);
m_csCubage = m_listCtrl.GetItemText(nItem, 0);
if(m_iShape == 0){
m_iRadius = _ttoi(m_listCtrl.GetItemText(nItem, 1));
m_iHeight = _ttoi(m_listCtrl.GetItemText(nItem, 2));
}
else{
m_iLength = _ttoi(m_listCtrl.GetItemText(nItem, 1));
m_iWidth = _ttoi(m_listCtrl.GetItemText(nItem, 2));
m_iHeight = _ttoi(m_listCtrl.GetItemText(nItem, 3));
}
CDialog::OnOK();
}
void CSelWaterTankDlg::OnDblclkListData(NMHDR* pNMHDR, LRESULT* pResult)
{
*pResult = 0;
OnOK();
}