⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainfrm.cpp

📁 用VC编写的立体仓库的管理软件源程序和设计说明书。
💻 CPP
字号:
// MainFrm.cpp : implementation of the CMainFrame class
//

#include "stdafx.h"
#include "Manage_WH.h"
#include "Manage_WHView.h"
#include "GoodsView1.h"
#include "GoodsView2.h"
#include "DlgEntry.h"
#include "DlgAdjust.h"
#include "DlgBackup.h"
#include "DlgRestore.h"
#include "DlgWorkLog.h"
#include "DlgInlibrary.h"
#include "DlgStockAlert.h"
#include "DlgTrayManage.h"
#include "DlgStockMange.h"
#include "DlgOutlibSort.h"
#include "DlgOutlibWhole.h"
#include "DlgDeviceFault.h"
#include "DlgProductsInfo.h"
#include "DlgCustomerInfo.h"
#include "DlgProductQuery.h"
#include "DlgModifyGoodsSite.h"
#include "DlgOrderInlibSearch.h"
#include "DlgOrderOutlibSearch.h"
#include "DlgInlibRecSearch.h"
#include "DlgOutlibRecSearch.h"
#include "DlgAdministratorInfo.h"
#include "DlgManageTask.h"
#include "DlgStockVelocity.h"
#include "DlgAverageTime.h"
#include "DlgDeviceVelocity.h"

#include "MainFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMainFrame

IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
	//{{AFX_MSG_MAP(CMainFrame)
	ON_WM_CREATE()
	ON_WM_WINDOWPOSCHANGING()
	ON_COMMAND(IDM_BACKUP, OnBackup)
	ON_COMMAND(IDM_ADMINISTRATOR_INFO, OnAdministratorInfo)
	ON_COMMAND(IDM_WORKLOG, OnWorklog)
	ON_COMMAND(IDM_RESTORE, OnRestore)
	ON_COMMAND(IDM_STOCK_ALERT, OnStockAlert)
	ON_COMMAND(IDM_ADJUST_TASK, OnAdjustTask)
	ON_COMMAND(IDM_INPUT_TASK, OnInputTask)
	ON_COMMAND(IDM_CUSTOMER_INFO, OnCustomerInfo)
	ON_COMMAND(IDM_SUPPLIER_INFO, OnSupplierInfo)
	ON_COMMAND(IDM_CARRIER_INFO, OnCarrierInfo)
	ON_COMMAND(IDM_PRODUCTS_INFO, OnProductsInfo)
	ON_COMMAND(IDM_STOCK_SET, OnStockSet)
	ON_COMMAND(IDM_TRAY_INFO, OnTrayInfo)
	ON_COMMAND(IDM_DEVICE_FAULT, OnDeviceFault)
	ON_COMMAND(IDM_OUT_TASK, OnOutTask)
	ON_COMMAND(IDM_GOODS_STORY_QUERY, OnGoodsStoryQuery)
	ON_COMMAND(IDM_SORT_TASK, OnSortTask)
	ON_COMMAND(IDM_ORDER_INLIB_SEARCH, OnOrderInlibSearch)
	ON_COMMAND(IDM_SITE_INFO, OnSiteInfo)
	ON_COMMAND(IDM_ORDER_OUTLIB_SEARCH, OnOrderOutlibSearch)
	ON_COMMAND(IDM_INLIB_INFO_QUERY, OnInlibInfoQuery)
	ON_COMMAND(IDM_OULIB_INFO_QUERY, OnOulibInfoQuery)
	ON_WM_CLOSE()
	ON_COMMAND(IDM_MANAGE_TASK, OnManageTask)
	ON_COMMAND(IDM_STOCK_VELOCITY, OnStockVelocity)
	ON_COMMAND(IDM_AVERAGE_TIME, OnAverageTime)
	ON_COMMAND(IDM_EQUIPMENT_AVAILABILITY, OnEquipmentAvailability)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

static UINT indicators[] =
{
	ID_SEPARATOR,           // status line indicator
	ID_INDICATOR_OP,
	ID_INDICATOR_COMPANY,
};

/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction

CMainFrame::CMainFrame()
{
	CDlgEntry dlg;
	dlg.DoModal();
	m_hIcon = AfxGetApp()->LoadIcon(IDI_MYICON);
}

CMainFrame::~CMainFrame()
{
}

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}

	// TODO: Delete these three lines if you don't want the toolbar to
	//  be dockable
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	EnableDocking(CBRS_ALIGN_ANY);
	DockControlBar(&m_wndToolBar);

	int nIndex;
	nIndex = m_wndStatusBar.CommandToIndex(ID_INDICATOR_OP);
	CString sText;
	sText = "操作员:【" + gstrOperator + "】";
	m_wndStatusBar.SetPaneText(nIndex,sText);
	CWindowDC dc(&m_wndStatusBar);
	CSize sizeText = dc.GetTextExtent(sText);
	m_wndStatusBar.SetPaneInfo(nIndex,ID_INDICATOR_OP,SBPS_NORMAL,sizeText.cx+30);
	gpDoc->m_pStatusWnd = static_cast<CWnd *>(&m_wndStatusBar);
/*
	//获得系统菜单
	CMenu *pMenu=GetSystemMenu(FALSE);

	//获得关闭按钮的ID
	int x=pMenu->GetMenuItemCount();
	UINT pID=pMenu->GetMenuItemID(x-1);

	//使关闭按钮无效
	pMenu->EnableMenuItem(pID, MF_DISABLED);
*/
	SetIcon(m_hIcon,TRUE);

	return 0;
}

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	if( !CFrameWnd::PreCreateWindow(cs) )
		return FALSE;
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs
//	cs.style &= ~WS_MAXIMIZEBOX;

	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics

#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
	CFrameWnd::AssertValid();
}

void CMainFrame::Dump(CDumpContext& dc) const
{
	CFrameWnd::Dump(dc);
}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers


BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
	// TODO: Add your specialized code here and/or call the base class
	// create a splitter with 2 rows, 1 column
	if (!m_wndSplitter1.CreateStatic(this, 2, 1))
	{
		TRACE0("Failed to CreateStaticSplitter\n");
		return FALSE;
	}

	CRect rc;
	GetClientRect(rc);
	int w = rc.Width();
	int h = rc.Height();

	if (!m_wndSplitter1.CreateView(0, 0,
		RUNTIME_CLASS(CManage_WHView), CSize(0, h), pContext))
	{
		TRACE0("Failed to create first pane\n");
		return FALSE;
	}

	// add the second splitter pane - which is a nested splitter with 2 columns
	if (!m_wndSplitter2.CreateStatic(
		&m_wndSplitter1,     // our parent window is the first splitter
		1, 2,                // the new splitter is 1 row, 2 columns
		WS_CHILD | WS_VISIBLE | WS_BORDER,  // style, WS_BORDER is needed
		m_wndSplitter1.IdFromRowCol(1, 0)
			// new splitter is in the first column, 2nd row of first splitter
	   ))
	{
		TRACE0("Failed to create nested splitter\n");
		return FALSE;
	}

	if (!m_wndSplitter2.CreateView(0, 0,
		RUNTIME_CLASS(CGoodsView1), CSize(static_cast<int>(w/1.5), 0), pContext))
	{
		TRACE0("Failed to create second pane\n");
		return FALSE;
	}
	if (!m_wndSplitter2.CreateView(0, 1,
		RUNTIME_CLASS(CGoodsView2), CSize(0, 0), pContext))
	{
		TRACE0("Failed to create third pane\n");
		return FALSE;
	}

	return TRUE;
}

void CMainFrame::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos) 
{
	lpwndpos->x = -2;
	lpwndpos->y = -2;
	CFrameWnd::OnWindowPosChanging(lpwndpos);	
}

void CMainFrame::OnBackup() 
{
	CDlgBackup dlg;
	dlg.DoModal();
}

void CMainFrame::OnAdministratorInfo() 
{
	CDlgAdministratorInfo dlg;
	dlg.DoModal();
}

void CMainFrame::OnWorklog() 
{
	CDlgWorkLog dlg;
	dlg.DoModal();
}

void CMainFrame::OnRestore() 
{
	CDlgRestore dlg;
	dlg.DoModal();
}

void CMainFrame::OnStockAlert() 
{
	CDlgStockAlert dlg;
	dlg.DoModal();
}

void CMainFrame::OnAdjustTask() 
{
	CDlgAdjust dlg;
	dlg.DoModal();
}

void CMainFrame::OnInputTask() 
{
	CDlgInlibrary dlg;
	dlg.DoModal();
}

void CMainFrame::OnCustomerInfo() 
{
	CDlgCustomerInfo dlg;
	dlg.m_iTitle = 2;
	dlg.DoModal();
}

void CMainFrame::OnSupplierInfo() 
{
	CDlgCustomerInfo dlg;
	dlg.m_iTitle = 3;
	dlg.DoModal();
}

void CMainFrame::OnCarrierInfo() 
{
	CDlgCustomerInfo dlg;
	dlg.m_iTitle = 1;
	dlg.DoModal();
}

void CMainFrame::OnProductsInfo() 
{
	CDlgProductsInfo dlg;
	dlg.DoModal();
}

void CMainFrame::OnStockSet() 
{
	CDlgStockMange dlg;
	dlg.DoModal();
}

void CMainFrame::OnTrayInfo() 
{
	CDlgTrayManage dlg;
	dlg.DoModal();
}

void CMainFrame::OnDeviceFault() 
{
	CDlgDeviceFault dlg;
	dlg.DoModal();
}

void CMainFrame::OnOutTask() 
{
	CDlgOutlibWhole dlg;
	dlg.DoModal();
}

void CMainFrame::OnGoodsStoryQuery() 
{
	CDlgProductQuery dlg;
	dlg.DoModal();
}

void CMainFrame::OnSortTask() 
{
	CDlgOutlibSort dlg;
	dlg.DoModal();
}

void CMainFrame::OnOrderInlibSearch() 
{
	CDlgOrderInlibSearch dlg;
	dlg.DoModal();
}

void CMainFrame::OnSiteInfo() 
{
	CDlgModifyGoodsSite dlg;
	dlg.DoModal();
}

void CMainFrame::OnOrderOutlibSearch() 
{
	CDlgOrderOutlibSearch dlg;
	dlg.DoModal();
}

void CMainFrame::OnInlibInfoQuery() 
{
	CDlgInlibRecSearch dlg;
	dlg.DoModal();
}

void CMainFrame::OnOulibInfoQuery() 
{
	CDlgOutlibRecSearch dlg;
	dlg.DoModal();
}

void CMainFrame::OnClose() 
{
	CFrameWnd::OnClose();
}

void CMainFrame::OnManageTask() 
{
	CDlgManageTask dlg;
	dlg.DoModal();
}

void CMainFrame::OnStockVelocity() 
{
	CDlgStockVelocity dlg;
	dlg.DoModal();
}

void CMainFrame::OnAverageTime() 
{
	CDlgAverageTime dlg;
	dlg.DoModal();
}

void CMainFrame::OnEquipmentAvailability() 
{
	CDlgDeviceVelocity dlg;
	dlg.DoModal();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -