📄 storageview.cpp
字号:
// storageView.cpp : implementation of the CStorageView class
//
#include "stdafx.h"
#include "storage.h"
#include "storageSet.h"
#include "storageDoc.h"
#include "storageView.h"
#include "edit.h"
#include "entrygooddlg.h"
#include "storeset.h"
#include "goodset.h"
#include "storageeditdlg.h "
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CStorageView
IMPLEMENT_DYNCREATE(CStorageView, CRecordView)
BEGIN_MESSAGE_MAP(CStorageView, CRecordView)
//{{AFX_MSG_MAP(CStorageView)
ON_BN_CLICKED(IDC_storage, Onstoragemanage)
ON_BN_CLICKED(IDC_factory, Onfactorymanage)
ON_BN_CLICKED(IDC_good, Ongoodmanage)
ON_BN_CLICKED(IDC_storageadd, Onstorageadd)
ON_BN_CLICKED(IDC_storagedel, Onstoragedel)
ON_BN_CLICKED(IDC_factorageadd, Onfactorageadd)
ON_BN_CLICKED(IDC_factorageedit, Onfactorageedit)
ON_BN_CLICKED(IDC_factoragedel, Onfactoragedel)
ON_BN_CLICKED(IDC_storageedit, Onstorageedit)
ON_COMMAND(ID_MENUITEMentrygood, OnMENUITEMentrygood)
ON_BN_CLICKED(IDC_entrycommand, Onentrycommand)
ON_BN_CLICKED(IDC_goodadd, Ongoodadd)
ON_BN_CLICKED(IDC_gooddel, Ongooddel)
ON_BN_CLICKED(IDC_goodedit, Ongoodedit)
ON_BN_CLICKED(IDC_entry, Onentrygood)
ON_BN_CLICKED(IDC_out, Onoutgood)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CRecordView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CRecordView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CRecordView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CStorageView construction/destruction
CStorageView::CStorageView()
: CRecordView(CStorageView::IDD)
{
//{{AFX_DATA_INIT(CStorageView)
m_pSet = NULL;
m_storageid = _T("");
m_storagelocate = _T("");
m_storagename = _T("");
m_storagearea = _T("");
m_fatid = _T("");
m_fattel = _T("");
m_fatother = _T("");
m_fatname = _T("");
m_fatemail = _T("");
m_fataddress = _T("");
m_fatman = _T("");
m_entryamount = _T("");
m_entryfactoryid = _T("");
m_entrygoodid = _T("");
m_entrystorageid = _T("");
m_goodid = _T("");
m_goodname = _T("");
m_goodother = _T("");
m_goodprice = _T("");
//}}AFX_DATA_INIT
// TODO: add construction code here
flags='0';
getset='a';//仓库集
col=row=1;
inout=0;
}
CStorageView::~CStorageView()
{
}
void CStorageView::DoDataExchange(CDataExchange* pDX)
{
CRecordView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CStorageView)
DDX_Control(pDX, IDC_storagegrid, m_storagegrid);
DDX_Control(pDX, IDC_factorygrid, m_factorygrid);
DDX_Control(pDX, IDC_goodgrids, m_goodgrids);
DDX_Text(pDX, IDC_storageid, m_storageid);
DDX_Text(pDX, IDC_storagelocate, m_storagelocate);
DDX_Text(pDX, IDC_storagename, m_storagename);
DDX_Text(pDX, IDC_storagearea, m_storagearea);
DDX_Text(pDX, IDe_fatorageid, m_fatid);
DDX_Text(pDX, IDe_factoragetel, m_fattel);
DDX_Text(pDX, IDe_factorageother, m_fatother);
DDX_Text(pDX, IDe_factoragename, m_fatname);
DDX_Text(pDX, IDe_factorageemail, m_fatemail);
DDX_Text(pDX, IDe_factorageaddress, m_fataddress);
DDX_Text(pDX, IDe_relateman, m_fatman);
DDX_Text(pDX, IDC_entryamount, m_entryamount);
DDX_Text(pDX, IDC_entryfactoryid, m_entryfactoryid);
DDX_Text(pDX, IDC_entrygoodid, m_entrygoodid);
DDX_Text(pDX, IDC_entrystorageid, m_entrystorageid);
DDX_Text(pDX, IDe_goodid, m_goodid);
DDX_Text(pDX, IDe_goodname, m_goodname);
DDX_Text(pDX, IDe_goodother, m_goodother);
DDX_Text(pDX, IDe_goodprice, m_goodprice);
//}}AFX_DATA_MAP
}
BOOL CStorageView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
//this->GetParentFrame()->SetWindowPos(NULL,50,150,750,600,WS_OVERLAPPED);
return CRecordView::PreCreateWindow(cs);
}
void CStorageView::OnInitialUpdate()
{
m_pSet = &GetDocument()->m_storageSet;
CRecordView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
switch(flags)
{
case '0': //仓库
m_storagegrid.ShowWindow (1);
m_factorygrid.ShowWindow (0);
m_goodgrids.ShowWindow (0);
StorageRefresh();
break;
case '1'://厂商
m_storagegrid.ShowWindow (0);
m_factorygrid.ShowWindow (1);
m_goodgrids.ShowWindow (0);
FactoryRefresh();
break;
case '2'://商品
m_storagegrid.ShowWindow (0);
m_factorygrid.ShowWindow (0);
m_goodgrids.ShowWindow (1);
GoodRefresh();
break;
default:
break;
}
}
/////////////////////////////////////////////////////////////////////////////
// CStorageView printing
BOOL CStorageView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CStorageView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CStorageView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CStorageView diagnostics
#ifdef _DEBUG
void CStorageView::AssertValid() const
{
CRecordView::AssertValid();
}
void CStorageView::Dump(CDumpContext& dc) const
{
CRecordView::Dump(dc);
}
CStorageDoc* CStorageView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CStorageDoc)));
return (CStorageDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CStorageView database support
CRecordset* CStorageView::OnGetRecordset()
{ return m_pSet;
}
/////////////////////////////////////////////////////////////////////////////
// CStorageView message handlers
void CStorageView::StorageRefresh()
{
m_pSet->MoveFirst();
while(!m_pSet->IsEOF())
{
m_pSet->MoveNext();
m_pSet->GetRecordCount();
}
m_pSet->MoveFirst();
m_storagegrid.SetCols(4);
m_storagegrid.SetRows(m_pSet->GetRecordCount()+1);//
m_storagegrid.SetColWidth(0,800);
m_storagegrid.SetColWidth(1,800);
m_storagegrid.SetColWidth(2,800);
m_storagegrid.SetColWidth(3,800);
m_storagegrid.SetRow (0);
m_storagegrid.SetCol (0);
m_storagegrid.SetText ("仓库号");
m_storagegrid.SetRow (0);
m_storagegrid.SetCol (1);
m_storagegrid.SetText ("仓名" );
m_storagegrid.SetRow (0);
m_storagegrid.SetCol (2);
m_storagegrid.SetText ("位置");
m_storagegrid.SetCol (3);
m_storagegrid.SetRow (0);
m_storagegrid.SetText ("面积" );
int iRow=1;
while(!m_pSet->IsEOF())
{
m_storagegrid.SetRow(iRow);
m_storagegrid.SetCol(0);
m_storagegrid.SetText(m_pSet->m_id);
m_storagegrid.SetRow(iRow);
m_storagegrid.SetCol(1);
m_storagegrid.SetText(m_pSet->m_name );
m_storagegrid.SetRow(iRow);
m_storagegrid.SetCol(2);
m_storagegrid.SetText( m_pSet->m_locate );
m_storagegrid.SetRow(iRow);
m_storagegrid.SetCol(3);
m_storagegrid.SetText(m_pSet->m_area );
iRow++;
m_pSet->MoveNext();
}
m_storagegrid.SetRow(1);
m_storagegrid.SetCol(1);
m_pSet->MoveFirst();
}
void CStorageView::GoodRefresh()
{
m_goodset.Open();
m_goodset.MoveFirst();
while(!m_goodset.IsEOF())
{
m_goodset.MoveNext();
m_goodset.GetRecordCount();
}
m_goodset.MoveFirst();
m_goodgrids.SetCols(4);
m_goodgrids.SetRows(m_goodset.GetRecordCount()+1);
//m_pSet->GetRecordCount()+1
m_goodgrids.SetColWidth(0,800);
m_goodgrids.SetColWidth(1,800);
m_goodgrids.SetColWidth(2,800);
m_goodgrids.SetColWidth(3,800);
m_goodgrids.SetRow (0);
m_goodgrids.SetCol (0);
m_goodgrids.SetText ("商品号");
m_goodgrids.SetRow (0);
m_goodgrids.SetCol (1);
m_goodgrids.SetText ("商品名" );
m_goodgrids.SetRow (0);
m_goodgrids.SetCol (2);
m_goodgrids.SetText ("价格");
m_goodgrids.SetCol (3);
m_goodgrids.SetRow (0);
m_goodgrids.SetText ("备注" );
int iRow=1;
while(!m_goodset.IsEOF())
{
m_goodgrids.SetRow(iRow);
m_goodgrids.SetCol(0);
m_goodgrids.SetText(m_goodset.m_id);
m_goodgrids.SetRow(iRow);
m_goodgrids.SetCol(1);
m_goodgrids.SetText(m_goodset.m_name );
m_goodgrids.SetRow(iRow);
m_goodgrids.SetCol(2);
m_goodgrids.SetText( m_goodset.m_price );
m_goodgrids.SetRow(iRow);
m_goodgrids.SetCol(3);
m_goodgrids.SetText(m_goodset.m_other );
iRow++;
m_goodset.MoveNext();
}
m_goodgrids.SetRow(1);
m_goodgrids.SetCol(1);
m_goodset.MoveFirst();
m_goodset.Close();
}
void CStorageView::FactoryRefresh()
{
m_factoryset.Open();
m_factoryset.MoveFirst();
while(!m_factoryset.IsEOF())
{
m_factoryset.MoveNext();
m_factoryset.GetRecordCount();
}
m_factoryset.MoveFirst();
m_factorygrid.SetCols(7);
m_factorygrid.SetRows(m_factoryset.GetRecordCount()+1);
m_factorygrid.SetColWidth(0,800);
m_factorygrid.SetColWidth(1,800);
m_factorygrid.SetColWidth(2,800);
m_factorygrid.SetColWidth(3,1300);
m_factorygrid.SetColWidth(4,800);
m_factorygrid.SetColWidth(5,800);
m_factorygrid.SetColWidth(6,800);
m_factorygrid.SetRow (0);
m_factorygrid.SetCol (0);
m_factorygrid.SetText ("厂商号");
m_factorygrid.SetRow (0);
m_factorygrid.SetCol (1);
m_factorygrid.SetText ("厂商名" );
m_factorygrid.SetRow (0);
m_factorygrid.SetCol (2);
m_factorygrid.SetText ("地址");
m_factorygrid.SetRow (0);
m_factorygrid.SetCol (3);
m_factorygrid.SetText ("E-MAIL");
m_factorygrid.SetRow (0);
m_factorygrid.SetCol (4);
m_factorygrid.SetText ("电话");
m_factorygrid.SetRow (0);
m_factorygrid.SetCol (5);
m_factorygrid.SetText ("联系人");
m_factorygrid.SetCol (6);
m_factorygrid.SetRow (0);
m_factorygrid.SetText ("备注" );
int iRow=1;
while(!m_factoryset.IsEOF())
{
m_factorygrid.SetRow(iRow);
m_factorygrid.SetCol(0);
m_factorygrid.SetText(m_factoryset.m_id);
m_factorygrid.SetRow(iRow);
m_factorygrid.SetCol(1);
m_factorygrid.SetText(m_factoryset.m_name );
m_factorygrid.SetRow(iRow);
m_factorygrid.SetCol(2);
m_factorygrid.SetText(m_factoryset.m_address );
m_factorygrid.SetRow(iRow);
m_factorygrid.SetCol(3);
m_factorygrid.SetText( m_factoryset.m_email );
m_factorygrid.SetRow(iRow);
m_factorygrid.SetCol(4);
m_factorygrid.SetText( m_factoryset.m_tel );
m_factorygrid.SetRow(iRow);
m_factorygrid.SetCol(5);
m_factorygrid.SetText(m_factoryset.m_relatename );
m_factorygrid.SetRow(iRow);
m_factorygrid.SetCol(6);
m_factorygrid.SetText(m_factoryset.m_other );
iRow++;
m_factoryset.MoveNext();
}
m_factorygrid.SetRow(1);
m_factorygrid.SetCol(1);
m_factoryset.MoveFirst();
m_factoryset.Close();
}
void CStorageView::Onstoragemanage()
{
// TODO: Add your control notification handler code here
flags='0';
getset='a';
this->OnInitialUpdate();
}
void CStorageView::Onfactorymanage()
{
// TODO: Add your control notification handler code here
flags='1';
// getset='c';
this->OnInitialUpdate();
}
void CStorageView::Ongoodmanage()
{
// TODO: Add your control notification handler code here
flags='2';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -