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

📄 dlggoodbadquery4.cpp

📁 主要功能 企业仓库管理系统由基本信息管理模块、入库管理模块、库存管理模块、查询管理模块等几部分组成。 &#61553 基本信息管理模块 该模块主要包括操作员管理、商品信息管理、库存信息管理、供
💻 CPP
字号:
// DlgGoodBadQuery4.cpp : implementation file
//

#include "stdafx.h"
#include "aaa.h"
#include "DlgGoodBadQuery4.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDlgGoodBadQuery4 dialog


CDlgGoodBadQuery4::CDlgGoodBadQuery4(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgGoodBadQuery4::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgGoodBadQuery4)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CDlgGoodBadQuery4::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgGoodBadQuery4)
	DDX_Control(pDX, IDC_LIST1, list);
	DDX_Control(pDX, IDC_EDIT1, value);
	DDX_Control(pDX, IDC_DATETIMEPICKER2, endtime);
	DDX_Control(pDX, IDC_DATETIMEPICKER1, starttime);
	DDX_Control(pDX, IDC_COMBO1, fields);
	DDX_Control(pDX, IDC_CHECK2, check2);
	DDX_Control(pDX, IDC_CHECK1, check1);
	DDX_Control(pDX,IDC_CHECKLOSE,checklose);
	DDX_Control(pDX,IDC_CHECKMORE,checkmore);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgGoodBadQuery4, CDialog)
	//{{AFX_MSG_MAP(CDlgGoodBadQuery4)
	ON_WM_CLOSE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgGoodBadQuery4 message handlers

BOOL CDlgGoodBadQuery4::OnInitDialog() 
{
	CDialog::OnInitDialog();
	checklose.SetCheck(1);//选中报损按钮
	list.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_FLATSB);
	//向表格中添加列
	list.InsertColumn(0,"盘点单号");
	list.InsertColumn(1,"仓库名称");
	list.InsertColumn(2,"商品编号");
	list.InsertColumn(3,"商品名称");
	list.InsertColumn(4,"数量");

	list.SetColumnWidth(0,120);
	list.SetColumnWidth(1,100);
	list.SetColumnWidth(2,120);
	list.SetColumnWidth(3,120);
	list.SetColumnWidth(4,100);

	return TRUE; 
}

void CDlgGoodBadQuery4::OnClose() 
{
	CDialog::OnClose();
}
void CDlgGoodBadQuery4::CancelQuery()
{
	check1.SetCheck(0);
	check2.SetCheck(0);
	fields.SetCurSel(-1);

	checklose.SetCheck(1);
	checkmore.SetCheck(0);
	value.SetWindowText("");
	CTime temp = CTime::GetCurrentTime();
	starttime.SetTime(&temp);
	endtime.SetTime(&temp);
	list.DeleteAllItems();
}

BOOL CDlgGoodBadQuery4::PreTranslateMessage(MSG* pMsg) 
{
	if (pMsg->message ==WM_KEYDOWN)
	{
		if (pMsg->wParam==13)
			pMsg->wParam = 9;
	}	
	return CDialog::PreTranslateMessage(pMsg);
}
void CDlgGoodBadQuery4::Query()
{
	if ((check1.GetCheck() ==false)&&(check2.GetCheck()==false))
	{
		MessageBox("请设置查询条件","提示",64);
		return;
	}
	int checkspec = checkmore.GetCheck(); //盘点标识0报损1报溢
	
	if ( (check1.GetCheck()==true)&&(check2.GetCheck()==false))
	{
		CString c_field,c_value;
		fields.GetWindowText(c_field);
		value.GetWindowText(c_value);
		if (c_field.IsEmpty()||(c_value.IsEmpty()))
		{
			MessageBox("请设置查询条件","提示",64);
			return;
		}
		CString sql;
		list.DeleteAllItems();
		switch (fields.GetCurSel())
		{
			case 0: 
			{ 
				c_field = "checkid"; 
				sql.Format("select a.checkid,a.storage,b.merchandiseid,c.name,b.sum  from tb_check_main a inner join tb_check_sub b on a.checkid = b.checkid  inner join tb_merchandiseinfo c on b.merchandiseid = c.id and a.checkspec = %i and a.%s = '%s'",checkspec,c_field,c_value); 
				break;
			}
			case 1: 
			{ 
				c_field = "name";
				sql.Format("select a.checkid,a.storage,b.merchandiseid,c.name,b.sum  from tb_check_main a inner join tb_check_sub b on a.checkid = b.checkid  inner join tb_merchandiseinfo c on b.merchandiseid = c.id and a.checkspec = %i and c.%s = '%s'",checkspec,c_field,c_value); 
				break;
			}
			case 2: 
			{ 
				c_field = "principal";
				sql.Format("select a.checkid,a.storage,b.merchandiseid,c.name,b.sum  from tb_check_main a inner join tb_check_sub b on a.checkid = b.checkid  inner join tb_merchandiseinfo c on b.merchandiseid = c.id and a.checkspec = %i and a.%s = '%s'",checkspec,c_field,c_value); 
				break;
			}
		}
		m_pRs->raw_Close();
		m_pRs->Open((_variant_t)sql,m_pCon.GetInterfacePtr(),adOpenKeyset,adLockOptimistic,adCmdText);
		int row = 0;
		while (! m_pRs->adoEOF)
		{
			CString temp;
			list.InsertItem(100,"");
			for (int i = 0;i<5;i++)
			{
				temp = (TCHAR *)(_bstr_t)m_pRs->GetFields()->GetItem((long)i)->Value;
				list.SetItemText(row,i,temp);
			}
			m_pRs->MoveNext();
			row +=1;
		}		
	}
	else if ((check1.GetCheck()==false)&&(check2.GetCheck()==true))
	{
		list.DeleteAllItems();
		CString sql,c_starttime,c_endtime;
		starttime.GetWindowText(c_starttime);
		endtime.GetWindowText(c_endtime);
		sql.Format("select a.checkid,a.storage,b.merchandiseid,c.name,b.sum  from tb_check_main a inner join tb_check_sub b on a.checkid = b.checkid inner join tb_merchandiseinfo c on b.merchandiseid = c.id and a.checktime between '%s' and '%s' and a.checkspec = %i ",c_starttime,c_endtime,checkspec);			
		m_pRs->raw_Close();
		m_pRs->Open((_variant_t)sql,m_pCon.GetInterfacePtr(),adOpenKeyset,adLockOptimistic,adCmdText);
		int row = 0;
		while (! m_pRs->adoEOF)
		{
			CString temp;
			list.InsertItem(100,"");
			for (int i = 0;i<5;i++)
			{
				temp = (TCHAR *)(_bstr_t)m_pRs->GetFields()->GetItem((long)i)->Value;
				list.SetItemText(row,i,temp);
			}
			m_pRs->MoveNext();
			row +=1;
		}				
	}
	else
	{
		CString c_field,c_value;
		CString sql,c_starttime,c_endtime;
		starttime.GetWindowText(c_starttime);
		endtime.GetWindowText(c_endtime);

		fields.GetWindowText(c_field);
		value.GetWindowText(c_value);
		if (c_field.IsEmpty()||(c_value.IsEmpty()))
		{
			MessageBox("请设置查询条件","提示",64);
			return;
		}
		list.DeleteAllItems();
		switch (fields.GetCurSel())
		{
			case 0: 
			{ 
				c_field = "checkid"; 
				sql.Format("select a.checkid,a.storage,b.merchandiseid,c.name,b.sum  from tb_check_main a inner join tb_check_sub b on a.checkid = b.checkid  inner join tb_merchandiseinfo c on b.merchandiseid = c.id and a.checkspec = %i and a.%s = '%s' and a.checktime between '%s' and '%s'",checkspec,c_field,c_value,c_starttime,c_endtime); 
				break;
			}
			case 1: 
			{ 
				c_field = "name";
				sql.Format("select a.checkid,a.storage,b.merchandiseid,c.name,b.sum  from tb_check_main a inner join tb_check_sub b on a.checkid = b.checkid  inner join tb_merchandiseinfo c on b.merchandiseid = c.id and a.checkspec = %i and c.%s = '%s' and a.checktime between '%s' and '%s'",checkspec,c_field,c_value,c_starttime,c_endtime); 
				break;
			}
			case 2: 
			{ 
				c_field = "principal";
				sql.Format("select a.checkid,a.storage,b.merchandiseid,c.name,b.sum  from tb_check_main a inner join tb_check_sub b on a.checkid = b.checkid  inner join tb_merchandiseinfo c on b.merchandiseid = c.id and a.checkspec = %i and a.%s = '%s' and a.checktime between '%s' and '%s'",checkspec,c_field,c_value,c_starttime,c_endtime); 
				break;
			}
		}
		m_pRs->Close();
		m_pRs->Open((_variant_t)sql,m_pCon.GetInterfacePtr(),adOpenKeyset,adLockOptimistic,adCmdText);
		int row = 0;
		while (! m_pRs->adoEOF)
		{
			CString temp;
			list.InsertItem(100,"");
			for (int i = 0;i<5;i++)
			{
				temp = (TCHAR *)(_bstr_t)m_pRs->GetFields()->GetItem((long)i)->Value;
				list.SetItemText(row,i,temp);
			}
			m_pRs->MoveNext();
			row +=1;
		}	
	}

}

⌨️ 快捷键说明

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