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

📄 mainfrm.cpp

📁 仓储管理系统主要提供一个仓储业务及其作业管理的信息存储和检索系统。通过入库管理、出库管理、报表生成管理、仓库人员管理、仓库位置信息管理等功能模块来实现仓库的综合管理
💻 CPP
📖 第 1 页 / 共 2 页
字号:
}

void CMainFrame::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) 
{

	// Here is the actual code which will display the company logo in menubar.
//	m_mnu.DrawItem(lpDrawItemStruct);
}

void CMainFrame::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) 
{
	// Here is where the menuitem that needs to be display is 
//	m_mnu.MeasureItem(lpMeasureItemStruct);
	
}
/***********************************************************************************
*函数名称: CreateExToolBar
*功    能: 重画工具栏
*作    者: 杨伟军
*创建时间: 2005-12-18
***********************************************************************************/
BOOL CMainFrame::CreateExToolBar()
{	
	if(!m_wndReBar.Create(this))
	{
		return -1;
	}
	
	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC))
	{
		return -1;      
	}	
	
	m_wndToolBar.GetToolBarCtrl().SetButtonWidth(40, 80);  //设置按钮的宽度和长度
	CImageList img;   //图标列表
	
	//设置"热"图标
	img.Create(22, 22, ILC_COLOR24|ILC_MASK,2,2);
	img.SetBkColor(::GetSysColor(COLOR_BTNFACE));
	img.Add(AfxGetApp()->LoadIcon(IDI_BASE_INFO));  //0
    img.Add(AfxGetApp()->LoadIcon(IDI_INPUT));  //1	
	img.Add(AfxGetApp()->LoadIcon(IDI_STORE));  //2
    img.Add(AfxGetApp()->LoadIcon(IDI_FIND_INFO));  //3    
    img.Add(AfxGetApp()->LoadIcon(IDI_ICON5));  //4
	img.Add(AfxGetApp()->LoadIcon(IDI_ICON8));  //5    
  	//m_wndToolBar.GetToolBarCtrl().SetHotImageList(&img);
	img.Detach();
	
	//设置"冷"图标
	img.Create(19, 19,ILC_COLOR24|ILC_MASK, 2,2);
	img.SetBkColor(::GetSysColor(COLOR_BTNFACE));	
	img.Add(AfxGetApp()->LoadIcon(IDI_BASE_INFO));  //0
    img.Add(AfxGetApp()->LoadIcon(IDI_INPUT));  //1    
    img.Add(AfxGetApp()->LoadIcon(IDI_STORE));  //2
    img.Add(AfxGetApp()->LoadIcon(IDI_FIND_INFO));  //3     
	img.Add(AfxGetApp()->LoadIcon(IDI_ICON5));  //4    
	img.Add(AfxGetApp()->LoadIcon(IDI_ICON8));  //5
//	m_wndToolBar.GetToolBarCtrl().SetImageList(&img);
	img.Detach();	
	
	m_wndToolBar.ModifyStyle(0, TBSTYLE_FLAT |CBRS_TOOLTIPS | TBSTYLE_TRANSPARENT|TBBS_CHECKBOX );	//改变工具栏属性

	m_wndToolBar.SetButtons(NULL, 6); //共7个按钮
	
	// 设置每个工具按钮文字
	m_wndToolBar.SetButtonInfo(0, IDC_BASEINFOM, TBSTYLE_BUTTON, 0);
	m_wndToolBar.SetButtonText(0, "基本管理");	
	
	m_wndToolBar.SetButtonInfo(1, IDC_INPUTM, TBSTYLE_BUTTON, 1);
	m_wndToolBar.SetButtonText(1, "入库管理");
	
	m_wndToolBar.SetButtonInfo(2, IDC_STOREM, TBSTYLE_BUTTON, 2);
	m_wndToolBar.SetButtonText(2, "库存管理");
	
	m_wndToolBar.SetButtonInfo(3, IDC_QUERYM, TBSTYLE_BUTTON, 3);
	m_wndToolBar.SetButtonText(3, "查询管理");
	
	m_wndToolBar.SetButtonInfo(4, IDC_OPERATORM, TBSTYLE_BUTTON, 4);
	m_wndToolBar.SetButtonText(4, "操作员");	

	m_wndToolBar.SetButtonInfo(5, IDC_MSG_SENDED, TBSTYLE_BUTTON , 5);
	m_wndToolBar.SetButtonText(5, "欢迎信息");
	

	CRect rectToolBar;	
	m_wndToolBar.GetItemRect(0, &rectToolBar);  //得到按钮的大小	
	m_wndToolBar.SetSizes(rectToolBar.Size(), CSize(20,20)); //设置按钮的大小
	
	//在Rebar中加入ToolBar
	m_wndReBar.AddBar(&m_wndToolBar);
	
	//改变Rebar属性
	REBARBANDINFO rbbi;
	rbbi.cbSize = sizeof(rbbi);		//必须填项
	rbbi.fMask = RBBIM_CHILDSIZE | RBBIM_IDEALSIZE | RBBIM_SIZE|RBBIM_BACKGROUND;	
	rbbi.cxMinChild = rectToolBar.Width(); //工具条的宽度	
	rbbi.cyMinChild = rectToolBar.Height(); //工具条高度

	//为工具条加入背景位图,请注意上rbbi.fMask中RBBIM_BACKGROUND标志
	
	rbbi.hbmBack = LoadBitmap(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BMP_TOOL_BACK));	
	rbbi.cx = rbbi.cxIdeal = rectToolBar.Width() * 10;

	//载入信息	
	m_wndReBar.GetReBarCtrl().SetBandInfo(0, &rbbi);

	return TRUE;
}

void CMainFrame::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	
	// Do not call CFrameWnd::OnPaint() for painting messages
}

void CMainFrame::OnProductInQuery() 
{
	// TODO: Add your command handler code here
	m_pdlgQueryM = new CDlgQueryM(0); //进入查询管理中的第一个属性页面
	m_pdlgQueryM->DoModal();
	delete m_pdlgQueryM;
	
}

void CMainFrame::OnProductInput() 
{
	// TODO: Add your command handler code here
	m_pdlgInputM = new CDlgInputStorageM(0);//进入入库管理中的第一个属性页面
	m_pdlgInputM->DoModal();
	delete m_pdlgInputM;
	
}

void CMainFrame::OnProductM() 
{
	// TODO: Add your command handler code here
	m_pdlgBaseInfoM = new CDlgBaseInfoM(1);//进入基本信息管理中的第二个属性页面
	m_pdlgBaseInfoM->DoModal();	
	delete m_pdlgBaseInfoM;
	
	
}

void CMainFrame::OnProductOut() 
{
	// TODO: Add your command handler code here
	m_pdlgStoreageM = new CDlgStorageM(2);//进入库存管理中的第三个属性页面
	m_pdlgStoreageM->DoModal();
	delete m_pdlgStoreageM;
	
}

void CMainFrame::OnProductOutPrint() 
{
	// TODO: Add your command handler code here
	m_pdlgQueryM = new CDlgQueryM(4);//进入查询管理中的第五个属性页面
	m_pdlgQueryM->DoModal();
	delete m_pdlgQueryM;
	
}

void CMainFrame::OnReportGoodBadQuery() 
{
	// TODO: Add your command handler code here
	m_pdlgQueryM = new CDlgQueryM(2);//进入查询管理中的第三个属性页面
	m_pdlgQueryM->DoModal();
	delete m_pdlgQueryM;
	
}

void CMainFrame::OnStoreAdjust() 
{
	// TODO: Add your command handler code here
	m_pdlgStoreageM = new CDlgStorageM(1);
	m_pdlgStoreageM->DoModal();
	delete m_pdlgStoreageM;
	
}

void CMainFrame::OnStoreM() 
{
	// TODO: Add your command handler code here
	m_pdlgBaseInfoM = new CDlgBaseInfoM(2);
	m_pdlgBaseInfoM->DoModal();	
	delete m_pdlgBaseInfoM;
	
}

void CMainFrame::OnStorePd() 
{
	// TODO: Add your command handler code here
	m_pdlgStoreageM = new CDlgStorageM(0);
	m_pdlgStoreageM->DoModal();
	delete m_pdlgStoreageM;
	
}

void CMainFrame::OnStorePrint() 
{
	// TODO: Add your command handler code here
	
}

void CMainFrame::OnStoreTopBottom() 
{
	// TODO: Add your command handler code here
	m_pdlgStoreageM = new CDlgStorageM(3);
	m_pdlgStoreageM->DoModal();
	delete m_pdlgStoreageM;
	
}

void CMainFrame::OnInputBackQuery() 
{
	// TODO: Add your command handler code here
	m_pdlgQueryM = new CDlgQueryM(1);
	m_pdlgQueryM->DoModal();
	delete m_pdlgQueryM;
	
}

void CMainFrame::OnInputBack() 
{
	// TODO: Add your command handler code here
	m_pdlgInputM = new CDlgInputStorageM(1);
	m_pdlgInputM->DoModal();
	delete m_pdlgInputM;
	
}

void CMainFrame::OnOperatorM() 
{
	// TODO: Add your command handler code here	
	m_pdlgBaseInfoM = new CDlgBaseInfoM(0);
	m_pdlgBaseInfoM->DoModal();	
	delete m_pdlgBaseInfoM;
	
	
}

void CMainFrame::OnPrividerM() 
{
	// TODO: Add your command handler code here
	m_pdlgBaseInfoM = new CDlgBaseInfoM(3);
	m_pdlgBaseInfoM->DoModal();	
	delete m_pdlgBaseInfoM;
	
}

void CMainFrame::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	if (!ADOFLAG)
	{
		AdoInit();
	}
	else
	{
		CAaaApp *pApp = (CAaaApp *)AfxGetApp();
		if (pApp->strUser!="" && pApp->strPassWord!="" && !bFlag)
		{
			int nIndex = 0;;
			strsql.Format("select [level] as lev from tb_operator where name = '%s' and   password ='%s' ", 
			pApp->strUser, pApp->strPassWord);
						m_pRs = m_pCon->Execute(_bstr_t(strsql),NULL,adCmdText);
			while (!m_pRs->adoEOF)
			{
				CString str = (LPCSTR)_bstr_t(m_pRs->GetCollect("lev"));
				nIndex++;
				bFlag = TRUE;
				pApp->iLevel = atoi((LPSTR)(LPCTSTR)str);
				m_pRs->MoveNext();
			}
						
			if (nIndex == 0) 
			{
				bFlag = TRUE;
				KillTimer(1);				
				MessageBox("操作员名称或密码错误\n\n   请您重新登录!", "登录错误", MB_ICONERROR);
				this->PostMessage(WM_CLOSE);				
			}			
						
		}
	}
	
	CFrameWnd::OnTimer(nIDEvent);
}

void CMainFrame::AdoInit()
{
	//先释放未关闭的结果集和连接
	if (m_pRs != NULL)
	{
		if(m_pRs->State != adStateClosed)
		{
			m_pRs->Close();
			m_pRs.Release();
		}

	}	
	if (m_pRs1 != NULL)
	{
		if(m_pRs1->State != adStateClosed)
		{
			m_pRs1->Close();
			m_pRs1.Release();
		}

	}	
	if (m_pCon != NULL)
	{
		if(m_pCon->State)
		{
			m_pCon->Close();
			m_pCon.Release();
		}
	}

	CAaaApp *pApp = (CAaaApp *)AfxGetApp();

	//建立连接后面直接利用了连接对象的Execute方法执行SQL命令
	try
	{		
		m_pCon.CreateInstance(_uuidof(Connection));
		m_pCon->CursorLocation =adUseClient;
		//m_pCon.CreateInstance("ADODB.Connection");
		m_pCon->ConnectionString = (_bstr_t)pApp->strAdoConn;
		//m_pCon->ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=StorageManage";
		m_pCon->Open("","","",-1);
		m_pRs.CreateInstance(_uuidof(Recordset));
		//m_pRs->MarshalOptions = adMarshalAll;
		m_pRs1.CreateInstance(_uuidof(Recordset));
		//m_pcom.CreateInstance("ADODB.Command");
		ADOFLAG = TRUE;

	}
	catch(_com_error)
	{
		if (ADOFLAG == FALSE)
		{
			ADOFLAG = TRUE;
		}
		MessageBox("连接数据库错误", "错误信息");
		PostMessage(WM_CLOSE);
		return;
	}
	catch(...)
	{	
		AfxMessageBox("SYS Error");
		return ;
	}
	
}

void CMainFrame::OnQuery2() 
{
	// TODO: Add your command handler code here
	
}

⌨️ 快捷键说明

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