📄 dlgchuku.cpp
字号:
// DlgChuku.cpp : implementation file
////
#include "stdafx.h"
#include "falcon_jxc.h"
#include "DlgChuku.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
/////////////////////////////////////////////////////////////////////////////
// CDlgChuku dialog
CDlgChuku::CDlgChuku(CWnd* pParent /*=NULL*/)
: CDialog(CDlgChuku::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgChuku)
m_sBeizhu = _T("");
m_sBaoguanren = _T("");
m_sChepaihao = _T("");
m_sChuhuobumen = _T("");
m_sJingli = _T("");
m_sKuhao = _T("");
m_sShenheren = _T("");
m_sShouhuobumen = _T("");
m_sTihuoren = _T("");
m_sZhidanren = _T("");
m_sZhidanriqi = _T("");
m_strChukuleibie = _T("");
m_strDanjuleixin = _T("");
m_strDanhao = _T("");
//}}AFX_DATA_INIT
m_iSelectRow = 0;
m_bSave = FALSE;
}
void CDlgChuku::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgChuku)
DDX_Control(pDX, IDC_COM_DANJULEIXIN, m_ctrDanjuleixin);
DDX_Control(pDX, IDC_COM_CHUKULEIBIE, m_ctrChukuleibie);
DDX_Control(pDX, IDC_CHUHUOBUMEN, m_ctrChuhuobumen);
DDX_Text(pDX, IDC_BEIZHU, m_sBeizhu);
DDX_Text(pDX, IDC_BAOGUANREN, m_sBaoguanren);
DDX_Text(pDX, IDC_CHEPAIHAO, m_sChepaihao);
DDX_Text(pDX, IDC_CHUHUOBUMEN, m_sChuhuobumen);
DDX_Text(pDX, IDC_JINGLI, m_sJingli);
DDX_Text(pDX, IDC_KUHAO, m_sKuhao);
DDX_Control(pDX, IDC_MSFLEXGRID1, m_ctrMSFlexGrid);
DDX_Text(pDX, IDC_SHENHEREN, m_sShenheren);
DDX_Text(pDX, IDC_SHOUHUOBUMEN, m_sShouhuobumen);
DDX_Text(pDX, IDC_TIHUOREN, m_sTihuoren);
DDX_Text(pDX, IDC_ZHIDANREN1, m_sZhidanren);
DDX_Text(pDX, IDC_ZHIDANRIQI, m_sZhidanriqi);
DDX_CBString(pDX, IDC_COM_CHUKULEIBIE, m_strChukuleibie);
DDX_CBString(pDX, IDC_COM_DANJULEIXIN, m_strDanjuleixin);
DDX_Text(pDX, IDC_DANHAO, m_strDanhao);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgChuku, CDialog)
//{{AFX_MSG_MAP(CDlgChuku)
ON_BN_CLICKED(IDC_CHAXUN, OnChaxun)
ON_BN_CLICKED(IDC_QUEDING, OnQueding)
ON_BN_CLICKED(IDC_TUICHU1, OnTuichu1)
ON_BN_CLICKED(IDC_SHANCHU, OnShanchu)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgChuku message handlers
BOOL CDlgChuku::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_ctrChuhuobumen.AddString("库房");
m_ctrChuhuobumen.AddString("南洋");
m_ctrChuhuobumen.AddString("欧典");
m_ctrChuhuobumen.AddString("圣地亚");
m_ctrChuhuobumen.SetCurSel(1);
m_ctrDanjuleixin.AddString("送货单编号");
m_ctrDanjuleixin.AddString("收款凭据编号");
m_ctrDanjuleixin.SetCurSel(1);
m_ctrChukuleibie.AddString("销售");
m_ctrChukuleibie.AddString("调拨");
m_ctrChukuleibie.SetCurSel(1);
m_ctrMSFlexGrid.SetTextMatrix(0,0,"商品编码");
m_ctrMSFlexGrid.SetTextMatrix(0,1,"名称");
m_ctrMSFlexGrid.SetTextMatrix(0,2,"规格");
m_ctrMSFlexGrid.SetTextMatrix(0,3,"单位");
m_ctrMSFlexGrid.SetTextMatrix(0,4,"数量");
m_ctrMSFlexGrid.SetTextMatrix(0,5,"商品所在地");
CTime time=CTime::GetCurrentTime();
CString str;
int yy,mm,dd;
yy=time.GetYear();
mm=time.GetMonth();
dd=time.GetDay();
str.Format("%d-%d-%d",yy,mm,dd);
m_sZhidanriqi = str;
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDlgChuku::OnChaxun()
{
// TODO: Add your control notification handler code here
CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
CFALCON_JXCView* pView=(CFALCON_JXCView*)pwnd->GetActiveView();
CFALCON_JXCDoc* pDoc = pView->GetDocument();
UpdateData(TRUE);
if(m_strDanjuleixin == "")
{
AfxMessageBox("请选择单据类型!");
return;
}
if(m_strDanhao == "")
{
AfxMessageBox("请输入单号!");
return;
}
int i,j;
for(i = 1; i < 5; i++)
{
for(j = 0; j < 5; j++)
{
m_ctrMSFlexGrid.SetTextMatrix(i,j,"");
}
}
CString sRequest;
sRequest = m_strDanjuleixin;
sRequest += CHARFLAG;
sRequest += m_strDanhao;
sRequest += CHARFLAG;
if(pDoc->ConnectToServer())
{
pDoc->SendMsg(sRequest,1233);
}
else
return;
a:
if(pDoc->m_b2233)
{
if(pDoc->m_pMsg->ShortMessage != "")
{
CString str;
for(i = 1; i < 5; i++)
{
for(j = 0; j < 6; j++)
{
str = pDoc->m_StrArray[(i-1)*6+j];
m_ctrMSFlexGrid.SetTextMatrix(i,j,str);
}
}
if(m_strDanjuleixin == "收款凭据编号")
{
for(i = 1; i < 5; i++)
{
str = m_ctrMSFlexGrid.GetTextMatrix(i,2);
m_ctrMSFlexGrid.SetTextMatrix(i,2,m_ctrMSFlexGrid.GetTextMatrix(i,3));
m_ctrMSFlexGrid.SetTextMatrix(i,3,str);
}
}
UpdateData(FALSE);
}
else
{
AfxMessageBox("未查到相符记录!");
}
pDoc->m_b2233 = FALSE;
}
else
{
pDoc->ProcessReadMessage();
goto a;
}
}
void CDlgChuku::OnQueding()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_ctrMSFlexGrid.GetTextMatrix(1,0) == "")
{
AfxMessageBox("无出库货品!");
return;
}
CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
CFALCON_JXCView* pView=(CFALCON_JXCView*)pwnd->GetActiveView();
CFALCON_JXCDoc* pDoc = pView->GetDocument();
if(pDoc->ConnectToServer())
{
pDoc->SendMsg("",1230);
}
else
return;
a:
if(pDoc->m_b2230)
{
m_sCkdbh=pDoc->m_pMsg->ShortMessage;
pDoc->m_b2230 = FALSE;
}
else
{
pDoc->ProcessReadMessage();
goto a;
}
int i,j;
int iRows = 0;
int iCols = 20;
for (i=1;i<5;i++)
{
if(m_ctrMSFlexGrid.GetTextMatrix(i,0) != "")
{
iRows++;
}
else
{
break;
}
}
CString strInsert,strtemp;
strtemp.Format("%d",iRows);
strInsert = strtemp;
strInsert+=CHARFLAG;
strtemp.Format("%d",iCols);
strInsert += strtemp;
strInsert+=CHARFLAG;
int iTemp = atoi(m_sCkdbh);
iTemp++;
for (i=0; i<iRows; i++)
{
m_sCkdbh.Format("%d",iTemp);
strInsert += m_sCkdbh;
strInsert+=CHARFLAG;
if(m_strDanjuleixin == "收款凭据编号")
{
strInsert += m_strDanhao;
strInsert+=CHARFLAG;
strInsert += "";
strInsert+=CHARFLAG;
}
else
{
strInsert += "";
strInsert+=CHARFLAG;
strInsert += m_strDanhao;
strInsert+=CHARFLAG;
}
strInsert+=m_sChuhuobumen;
strInsert+=CHARFLAG;
strInsert+=m_sShouhuobumen;
strInsert+=CHARFLAG;
strInsert+=m_sChepaihao;
strInsert+=CHARFLAG;
strInsert+=m_sKuhao;
strInsert+=CHARFLAG;
for(j=0;j<5;j++)
{
strInsert+=m_ctrMSFlexGrid.GetTextMatrix(i+1,j);
strInsert+=CHARFLAG;
}
strInsert+=m_sJingli;
strInsert+=CHARFLAG;
strInsert+=m_sBaoguanren;
strInsert+=CHARFLAG;
strInsert+=m_sTihuoren;
strInsert+=CHARFLAG;
strInsert+=m_sZhidanren;
strInsert+=CHARFLAG;
strInsert+=m_sZhidanriqi;
strInsert+=CHARFLAG;
strInsert+=m_sShenheren;
strInsert+=CHARFLAG;
strInsert+=m_sBeizhu;
strInsert+=CHARFLAG;
strInsert+=m_strChukuleibie;
strInsert+=CHARFLAG;
}
if(pDoc->ConnectToServer())
{
pDoc->SendMsg(strInsert,1232);
}
else
return;
/*/////////////////////
添加打印函数
*/////////////////////
a1:
if(pDoc->m_b2232)
{
pDoc->m_b2232 = FALSE;
m_bSave = TRUE;
for(i=1;i<5;i++)
{
for(j=0;j<6;j++)
{
m_ctrMSFlexGrid.SetTextMatrix(i,j,"");
}
}
m_sBeizhu = _T("");
m_sBaoguanren = _T("");
m_sChepaihao = _T("");
m_sChuhuobumen = _T("");
m_sJingli = _T("");
m_sKuhao = _T("");
m_sShenheren = _T("");
m_sShouhuobumen = _T("");
m_sTihuoren = _T("");
m_sZhidanren = _T("");
m_strChukuleibie = _T("");
m_strDanhao = _T("");
UpdateData(FALSE);
}
else
{
pDoc->ProcessReadMessage();
goto a1;
}
}
void CDlgChuku::OnOK()
{
//Dummy OnOk function!
}
void CDlgChuku::OnCancel()
{
//Dummy OnCancel function!
}
void CDlgChuku::OnTuichu1()
{
// TODO: Add your control notification handler code here
if (m_bSave == FALSE && AfxMessageBox("尚未出单!是否退出?", MB_YESNO | MB_ICONQUESTION) == IDNO)
{
return;
}
else
{
CDialog::OnOK();
}
}
BEGIN_EVENTSINK_MAP(CDlgChuku, CDialog)
//{{AFX_EVENTSINK_MAP(CDlgChuku)
ON_EVENT(CDlgChuku, IDC_MSFLEXGRID1, -600 /* Click */, OnClickMsflexgrid1, VTS_NONE)
//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()
void CDlgChuku::OnClickMsflexgrid1()
{
// TODO: Add your control notification handler code here
m_iSelectRow = m_ctrMSFlexGrid.GetRow();
}
void CDlgChuku::OnShanchu()
{
// TODO: Add your control notification handler code here UpdateData();
// if(m_iSelectRow == 0)
// {
// AfxMessageBox("请选择要删除的条目!");
// return;
// }
CString str;
if (m_iSelectRow >0)
{
if ( m_ctrMSFlexGrid.GetTextMatrix(m_iSelectRow,0) == "")
{
return;
}
else
{
str.Format("是否删除第%d条记录?",m_iSelectRow);
if(AfxMessageBox(str,MB_YESNO) == IDYES)
{
m_ctrMSFlexGrid.RemoveItem(m_iSelectRow);
m_ctrMSFlexGrid.SetRows(5);
m_ctrMSFlexGrid.Refresh();
}
m_iSelectRow=0;
}
}
else
{
AfxMessageBox("请选择要删除的记录!");
return;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -