167 lines
4.0 KiB
C++
167 lines
4.0 KiB
C++
// ReduerDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "ReduerDlg.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CReduerDlg dialog
|
|
|
|
|
|
CReduerDlg::CReduerDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CReduerDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CReduerDlg)
|
|
m_nDn = 0;
|
|
m_sPipeNo = _T("");
|
|
m_dScale = 0.0;
|
|
m_sSpec = _T("");
|
|
m_nFlag = -1;
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
|
|
void CReduerDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CReduerDlg)
|
|
DDX_Control(pDX, IDC_LISTREDUCER, m_wndListCtrl);
|
|
DDX_Text(pDX, IDC_DN, m_nDn);
|
|
DDX_Text(pDX, IDC_PIPENO, m_sPipeNo);
|
|
DDX_Text(pDX, IDC_SCALE, m_dScale);
|
|
DDX_Text(pDX, IDC_SPEC, m_sSpec);
|
|
DDX_Radio(pDX, IDC_RADIOC, m_nFlag);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CReduerDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CReduerDlg)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CReduerDlg message handlers
|
|
|
|
BOOL CReduerDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
m_wndListCtrl.InsertColumn(0,_T("主管公称直径"),LVCFMT_LEFT,120);
|
|
m_wndListCtrl.InsertColumn(1,_T("变径端公称直径"),LVCFMT_LEFT,120);
|
|
m_wndListCtrl.InsertColumn(2,_T("长度"),LVCFMT_LEFT,100);
|
|
m_wndListCtrl.SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
|
|
|
|
m_bitMapC.LoadBitmap(IDB_REDUCERC);
|
|
m_bitMapU.LoadBitmap(IDB_REDUCERU);
|
|
m_bitMapD.LoadBitmap(IDB_REDUCERD);
|
|
m_bitMapS.LoadBitmap(IDB_REDUCERS);
|
|
|
|
CButton* pButton = (CButton*)GetDlgItem(IDC_RADIOC);
|
|
if (pButton != NULL)
|
|
{
|
|
pButton->SetBitmap((HBITMAP)m_bitMapC);
|
|
}
|
|
pButton = (CButton*)GetDlgItem(IDC_RADIOU);
|
|
if (pButton != NULL)
|
|
{
|
|
pButton->SetBitmap((HBITMAP)m_bitMapU);
|
|
}
|
|
pButton = (CButton*)GetDlgItem(IDC_RADIOD);
|
|
if (pButton != NULL)
|
|
{
|
|
pButton->SetBitmap((HBITMAP)m_bitMapD);
|
|
}
|
|
|
|
pButton = (CButton*)GetDlgItem(IDC_RADIOS);
|
|
if (pButton != NULL)
|
|
{
|
|
pButton->SetBitmap((HBITMAP)m_bitMapS);
|
|
}
|
|
|
|
m_nFlag =0;
|
|
UpdateData(FALSE);
|
|
InitReducer();
|
|
|
|
return TRUE;
|
|
}
|
|
BOOL CReduerDlg::InitReducer()
|
|
{
|
|
if (m_pADOServer == NULL) return FALSE;
|
|
|
|
CString sSQL;
|
|
sSQL.Format(_T("select [公称直径L],[公称直径S],[长度] from AecReduceData where [公称直径L]=%d and [长度] > 0 and [外径系列] ='A' order by [公称直径S]"),m_nDn);
|
|
|
|
CUIIValueTable valTable;
|
|
m_pADOServer->GetSelData(sSQL,valTable);
|
|
|
|
CString sDN1,sDN2,sL;
|
|
CStringArray arVals;
|
|
int nSize = valTable.GetTableLogicSize();
|
|
for(int i = 0;i < nSize;i++)
|
|
{
|
|
arVals.RemoveAll();
|
|
valTable.GetValueRecord(i,arVals);
|
|
|
|
if (arVals.GetSize() >= 3)
|
|
{
|
|
sDN1 = arVals.GetAt(0);
|
|
sDN2 = arVals.GetAt(1);
|
|
sL = arVals.GetAt(2);
|
|
|
|
int nItem = m_wndListCtrl.GetItemCount();
|
|
m_wndListCtrl.InsertItem(nItem,sDN1);
|
|
m_wndListCtrl.SetItemText(nItem,1,sDN2);
|
|
m_wndListCtrl.SetItemText(nItem,2,sL);
|
|
}
|
|
}
|
|
|
|
valTable.RemoveAll();
|
|
sSQL.Format(_T("select [公称直径S],[公称直径L],[长度] from AecReduceData where [公称直径S]=%d and [长度] > 0 and [外径系列] ='A' order by [公称直径L]"),m_nDn);
|
|
m_pADOServer->GetSelData(sSQL,valTable);
|
|
|
|
nSize = valTable.GetTableLogicSize();
|
|
for(i = 0;i < nSize;i++)
|
|
{
|
|
arVals.RemoveAll();
|
|
valTable.GetValueRecord(i,arVals);
|
|
|
|
if (arVals.GetSize() >= 3)
|
|
{
|
|
sDN1 = arVals.GetAt(0);
|
|
sDN2 = arVals.GetAt(1);
|
|
sL = arVals.GetAt(2);
|
|
|
|
int nItem = m_wndListCtrl.GetItemCount();
|
|
m_wndListCtrl.InsertItem(nItem,sDN1);
|
|
m_wndListCtrl.SetItemText(nItem,1,sDN2);
|
|
m_wndListCtrl.SetItemText(nItem,2,sL);
|
|
}
|
|
}
|
|
m_wndListCtrl.SetItemState(0,LVIS_SELECTED,LVIS_SELECTED);
|
|
return TRUE;
|
|
}
|
|
|
|
void CReduerDlg::OnOK()
|
|
{
|
|
// TODO: Add extra validation here
|
|
UpdateData(TRUE);
|
|
POSITION ps = m_wndListCtrl.GetFirstSelectedItemPosition();
|
|
int nItem = m_wndListCtrl.GetNextSelectedItem(ps);
|
|
if (nItem == -1)
|
|
{
|
|
AfxMessageBox(_T("请选择变径系列!"));
|
|
return;
|
|
}
|
|
sDnStart = _T("");
|
|
sDnEnd = _T("");
|
|
sDnStart = m_wndListCtrl.GetItemText(nItem,0);
|
|
sDnEnd = m_wndListCtrl.GetItemText(nItem,1);
|
|
CDialog::OnOK();
|
|
}
|