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

📄 huopinmingxi.cpp

📁 面向软件工程的Visual C++网络程序开发
💻 CPP
字号:
// Huopinmingxi.cpp : implementation file
//

#include "stdafx.h"
#include "falcon_jxc.h"
#include "Huopinmingxi.h"
#include "mainfrm.h"
#include "FALCON_JXCView.h"
#include "message.h"

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

/////////////////////////////////////////////////////////////////////////////
// CHuopinmingxi dialog


CHuopinmingxi::CHuopinmingxi(CWnd* pParent /*=NULL*/)
	: CDialog(CHuopinmingxi::IDD, pParent)
{
	//{{AFX_DATA_INIT(CHuopinmingxi)
	m_strBeizhu = _T("");
	m_strBianma = _T("");
	m_strDanwei = _T("");
	m_strGuige = _T("");
	m_fJinjia = 0.0f;
	m_strMingcheng = _T("");
	m_fShoujia = 0.0f;
	m_nShuliang = 0;
	m_strXinghao = _T("");
	m_strGonghuoshang = _T("");
	m_strShengchanchangshang = _T("");
	//}}AFX_DATA_INIT
}


void CHuopinmingxi::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CHuopinmingxi)
	DDX_Text(pDX, IDC_EDIT_BEIZHU, m_strBeizhu);
	DDV_MaxChars(pDX, m_strBeizhu, 40);
	DDX_Text(pDX, IDC_EDIT_BIANMA, m_strBianma);
	DDV_MaxChars(pDX, m_strBianma, 40);
	DDX_Text(pDX, IDC_EDIT_DANWEI, m_strDanwei);
	DDV_MaxChars(pDX, m_strDanwei, 40);
	DDX_Text(pDX, IDC_EDIT_GUIGE, m_strGuige);
	DDV_MaxChars(pDX, m_strGuige, 40);
	DDX_Text(pDX, IDC_EDIT_JINJIA, m_fJinjia);
	DDX_Text(pDX, IDC_EDIT_MINGCHENG, m_strMingcheng);
	DDX_Text(pDX, IDC_EDIT_SHOUJIA, m_fShoujia);
	DDX_Text(pDX, IDC_EDIT_SHULIANG, m_nShuliang);
	DDX_Text(pDX, IDC_EDIT_XINGHAO, m_strXinghao);
	DDV_MaxChars(pDX, m_strXinghao, 40);
	DDX_Text(pDX, IDC_GONGHUOSHANG, m_strGonghuoshang);
	DDX_Text(pDX, IDC_SCCS, m_strShengchanchangshang);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CHuopinmingxi, CDialog)
	//{{AFX_MSG_MAP(CHuopinmingxi)
	ON_EN_KILLFOCUS(IDC_EDIT_BIANMA, OnKillfocusEditBianma)
	ON_BN_CLICKED(ID_QUXIAO, OnQuxiao)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CHuopinmingxi message handlers

void CHuopinmingxi::OnKillfocusEditBianma() 
{
	// TODO: Add your control notification handler code here
	UpdateData();
	CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
	CFALCON_JXCView* pView=(CFALCON_JXCView*)pwnd->GetActiveView();
	CFALCON_JXCDoc* pDoc = pView->GetDocument();


	CString strRequest;
	if(m_strBianma == "")
	{
		AfxMessageBox("请输入商品编码!");
		return;
	}
	else
		strRequest = m_strBianma;
	
	if(pDoc->ConnectToServer())
	{

		pDoc->SendMsg(strRequest,1212);//发送根据关键字查询商品资料的请求
	}
	else
		return;


a: 
	if(pDoc->m_b2212)
	{
		if(pDoc->m_pMsg->ShortMessage != "")
		{
			m_strMingcheng = pDoc->m_StrArray.GetAt(1);
			m_strDanwei = pDoc->m_StrArray.GetAt(2);
			m_strGuige = pDoc->m_StrArray.GetAt(3);
			m_strXinghao = pDoc->m_StrArray.GetAt(4);
			m_fJinjia = (float)atof(pDoc->m_StrArray.GetAt(7));
			m_fShoujia = (float)atof(pDoc->m_StrArray.GetAt(8));
			m_strGonghuoshang = pDoc->m_StrArray.GetAt(5);
			m_strShengchanchangshang = pDoc->m_StrArray.GetAt(6);
			((CButton*)GetDlgItem( IDOK ))->EnableWindow( TRUE );
			UpdateData(FALSE);
		}
		else 
		{
			AfxMessageBox("没有该编码的商品!");
			((CButton*)GetDlgItem( IDOK ))->EnableWindow( FALSE );
			m_strMingcheng = "";
			m_strDanwei = "";
			m_strGuige = "";
			m_strXinghao = "";
			m_fJinjia = 0.0;
			m_fShoujia = 0.0;
			m_strGonghuoshang = "";
			m_strShengchanchangshang = "";
			UpdateData(FALSE);
		}
		pDoc->m_b2212=false;
	}
	else
	{
		pDoc->ProcessReadMessage();
		goto a;
	}
	
}

BOOL CHuopinmingxi::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	((CButton*)GetDlgItem( IDOK ))->EnableWindow( FALSE );

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CHuopinmingxi::OnOK() 
{
	//Dummy OnOk function!
	CDialog::OnOK();
}

void CHuopinmingxi::OnCancel() 
{
	//Dummy OnCancel function!
}

void CHuopinmingxi::OnQuxiao() 
{
	// TODO: Add your control notification handler code here
	CDialog::OnCancel();
}

⌨️ 快捷键说明

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