📄 dialogproduceclient.cpp
字号:
if(lCount >= 6000) //10分钟10*60*1000=6000*100
{
CDialogEnter dlg;
dlg.m_strUser = m_strOperatorId;
dlg.m_pOperatorSet = m_pOperatorSet;
dlg.DoModal();
return FALSE;
}
return TRUE;
}
void CDialogProduceClient::OnKillfocusEditSerial()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_strSerial.IsEmpty())
return;
CString strSql;
strSql.Format("select * from [ProduceClient] where [Serial] = '%s'", m_strSerial);
if(m_pProduceClientSet->IsOpen())
m_pProduceClientSet->Close();
m_pProduceClientSet->Open(CRecordset::snapshot, strSql);
if(m_pProduceClientSet->IsEOF())
{
m_btnEdit.EnableWindow(FALSE);
m_btnDel.EnableWindow(FALSE);
m_btnAdd.EnableWindow();
return;
}
m_btnEdit.EnableWindow();
m_btnDel.EnableWindow();
m_btnAdd.EnableWindow(FALSE);
m_strSerial = m_pProduceClientSet->m_Serial;
m_strClientAddress = m_pProduceClientSet->m_ClientAddress;
m_strClientName = m_pProduceClientSet->m_ClientName;
m_strClientRemarks = m_pProduceClientSet->m_ClientRemarks;
m_strClientTele = m_pProduceClientSet->m_ClientTele;
m_strComputerMan = m_pProduceClientSet->m_ComputerMan;
m_strCutProductMan = m_pProduceClientSet->m_CutProductMan;
m_strKaiLiaoMan = m_pProduceClientSet->m_KaiLiaoMan;
m_strProduceDayMan = m_pProduceClientSet->m_ProduceDayMan;
m_strProduceNightMan = m_pProduceClientSet->m_ProduceNightMan;
m_strProduceRemarks = m_pProduceClientSet->m_ProduceRemarks;
if(m_pProduceClientSet->m_State == 0)
m_strState = "生产中";
else
m_strState = "完成";
m_strFee.Format("%.2f", atof(m_pProduceClientSet->m_Fee));
m_timeHandDate = m_pProduceClientSet->m_HandDate;
UpdateData(FALSE);
int i = 0;
m_List.DeleteAllItems();
strSql.Format("select * from [ProductWare] where [ProduceClientSerial] = '%s'", m_strSerial);
if(m_pProductWareSet->IsOpen())
m_pProductWareSet->Close();
m_pProductWareSet->Open(CRecordset::snapshot, strSql);
while(!m_pProductWareSet->IsEOF())
{
m_pWarePurposeSet->MoveFirst();
while(!m_pWarePurposeSet->IsEOF())
{
if(m_pWarePurposeSet->m_Id == m_pProductWareSet->m_WarePurposeId)
break;
m_pWarePurposeSet->MoveNext();
}
m_pWareTypeSet->MoveFirst();
while(!m_pWareTypeSet->IsEOF())
{
if(m_pWareTypeSet->m_Id == m_pProductWareSet->m_WareTypeId)
break;
m_pWareTypeSet->MoveNext();
}
m_pWareModeSet->MoveFirst();
while(!m_pWareModeSet->IsEOF())
{
if(m_pWareModeSet->m_Id == m_pProductWareSet->m_WareModeId)
break;
m_pWareModeSet->MoveNext();
}
strSql.Format("%d",m_pProductWareSet->m_Id);
m_List.InsertItem(i, strSql);
m_List.SetItemText(i, 1, m_pProductWareSet->m_Draft );
m_List.SetItemText(i, 2, m_pProductWareSet->m_Size );
m_List.SetItemText(i, 3, m_pProductWareSet->m_Unit );
strSql.Format("%.2f", m_pProductWareSet->m_Number);
m_List.SetItemText(i, 4, strSql );
strSql.Format("%.2f", atof(m_pProductWareSet->m_Price));
m_List.SetItemText(i, 5, strSql );
m_List.SetItemText(i, 6, m_pProductWareSet->m_ProduceType );
m_List.SetItemText(i, 7, m_pWarePurposeSet->m_WarePurpose);
m_List.SetItemText(i, 8, m_pWareTypeSet->m_WareType );
m_List.SetItemText(i, 9, m_pWareModeSet->m_WareMode );
m_List.SetItemText(i, 10, m_pWareTypeSet->m_Unit );
strSql.Format("%.2f", m_pProductWareSet->m_WareNumber);
m_List.SetItemText(i, 11, strSql );
m_List.SetItemText(i, 12, m_pProductWareSet->m_PinHouSize );
strSql.Format("%d", m_pProductWareSet->m_PinBanNumber);
m_List.SetItemText(i, 13, strSql );
m_List.SetItemText(i, 14, m_pProductWareSet->m_BanLei );
m_List.SetItemText(i, 15, m_pProductWareSet->m_PrintColorNumber );
m_List.SetItemText(i, 16, m_pProductWareSet->m_PrintJiTai );
m_List.SetItemText(i, 17, m_pProductWareSet->m_DanSeCheSu );
m_List.SetItemText(i, 18, m_pProductWareSet->m_XiaoHaoCheSu );
m_List.SetItemText(i, 19, m_pProductWareSet->m_DingSi );
m_List.SetItemText(i, 20, m_pProductWareSet->m_ShangJiao );
m_List.SetItemText(i, 21, m_pProductWareSet->m_BaoKe );
m_List.SetItemText(i, 22, m_pProductWareSet->m_ChengPingShu );
if(m_pProductWareSet->m_State == 0)
m_List.SetItemText(i, 23, "生产中" );
else
m_List.SetItemText(i, 23, "完成" );
m_pProductWareSet->MoveNext();
i++;
}
}
#include"DialogProductWare.h"
void CDialogProduceClient::OnButtonEditMeter()
{
// TODO: Add your control notification handler code here
int nItem = 0;
POSITION pos = m_List.GetFirstSelectedItemPosition();
if (pos != NULL)
{
while (pos)
{
nItem = m_List.GetNextSelectedItem(pos);
}
}
else
return;
CDialogProductWare dlg;
dlg.m_pProductWareSet = m_pProductWareSet;
dlg.m_pWareModeSet = m_pWareModeSet;
dlg.m_pWarePurposeSet = m_pWarePurposeSet;
dlg.m_pWareTypeSet = m_pWareTypeSet;
dlg.m_pOperatorSet = m_pOperatorSet;
dlg.m_strOperatorId = m_strOperatorId;
dlg.m_strSerial = m_strSerial;
dlg.m_strUserName = m_strClientName;
dlg.m_strAddress = m_strClientAddress;
dlg.m_nId = atoi(m_List.GetItemText(nItem, 0));
dlg.DoModal();
OnKillfocusEditSerial();
}
#include"DialogProductWare.h"
void CDialogProduceClient::OnButtonAddMeter()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_strSerial.IsEmpty())
return;
CDialogProductWare dlg;
dlg.m_pProductWareSet = m_pProductWareSet;
dlg.m_pWareModeSet = m_pWareModeSet;
dlg.m_pWarePurposeSet = m_pWarePurposeSet;
dlg.m_pWareTypeSet = m_pWareTypeSet;
dlg.m_pOperatorSet = m_pOperatorSet;
dlg.m_strOperatorId = m_strOperatorId;
dlg.m_strSerial = m_strSerial;
dlg.m_strUserName = m_strClientName;
dlg.m_strAddress = m_strClientAddress;
dlg.DoModal();
OnKillfocusEditSerial();
}
#include "printfile\\PrintRX.h"
void CDialogProduceClient::OnButtonPrintCell()
{
// TODO: Add your control notification handler code here
UpdateData();
CPrintRX m_Print;
m_Print.InitToPrint(NULL, 1);
m_Print.StartPrint();
m_Print.StartPage();
// start printing the lines
//二维点阵
int x_pos[2];
int y_pos[20];
//设置横坐标
for (int i=0; i < 20; i++)
y_pos[i] = -80 - (24 * i);
//设置纵坐标
x_pos[0] = 32;
x_pos[1] = 782;
CPen newPen;
newPen.CreatePen (PS_SOLID, 1, RGB(0,0,0));
//打印10行
for (i = 1; i < 11; i++)
{
m_Print.DrawHLine(x_pos[0], y_pos[i], x_pos[1], y_pos[i], newPen);
}
m_Print.DrawHLine(x_pos[0], y_pos[19], x_pos[1], y_pos[19], newPen);
m_Print.DrawHLine(x_pos[0], y_pos[4] - 2, x_pos[1], y_pos[4] - 2, newPen);
m_Print.DrawHLine(x_pos[0], y_pos[10] - 2, x_pos[1], y_pos[10] - 2, newPen);
//打印头、尾列
m_Print.DrawVLine(x_pos[0], y_pos[1], x_pos[0], y_pos[19], newPen);
m_Print.DrawVLine(x_pos[1], y_pos[1], x_pos[1], y_pos[19], newPen);
CSize Size;
CRect StrRect; //Draw text in Rect
CString str; //客户地址
str.Format("生 产 通 知 单");//标题
m_Print.SetFontFace(0, 3);
StrRect.SetRect(x_pos[0] + 1, -20, x_pos[1], -56);
m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
m_Print.SetFontFace(0, 0);
CTime t = CTime::GetCurrentTime();
str.Format("接稿日期 %d年 %d月 %d日", t.GetYear(), t.GetMonth(), t.GetDay());
StrRect.SetRect(x_pos[0] + 1, -56, x_pos[1], -80);
m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
str.Format("预定交货日期 %d年 %d月 %d日", m_timeHandDate.GetYear(), m_timeHandDate.GetMonth(), m_timeHandDate.GetDay());
StrRect.SetRect((x_pos[0] + x_pos[1])/2 - 60, -56, x_pos[1], -80);
m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
str.Format("客户名称:%s", m_strClientName);
StrRect.SetRect(x_pos[0] - 1, -56, x_pos[1], -80);
m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
str.Format("客户地址:%s", m_strClientAddress);
StrRect.SetRect(x_pos[0] + 1, y_pos[0], x_pos[1], y_pos[1]);
m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
str.Format("客户电话:%s", m_strClientTele);
StrRect.SetRect((x_pos[0] + x_pos[1])/2 - 60, y_pos[0], x_pos[1], y_pos[1]);
m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
str.Format("经 手:%s", m_strOperatorId);
StrRect.SetRect(x_pos[0] - 1, y_pos[0], x_pos[1], y_pos[1]);
m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
//打印1列
m_Print.DrawVLine(x_pos[0] + 30, y_pos[1], x_pos[0] + 30, y_pos[19], newPen);
for (i = 1; i < 11; i++)
{
if(i == 1 || i == 5 || i == 10)
{
StrRect.SetRect(x_pos[0], y_pos[i], x_pos[0] + 30, y_pos[i + 1]);
m_Print.DrawText("序号", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
}
}
//打印列
m_Print.DrawVLine(x_pos[0] + 240, y_pos[1], x_pos[0] + 240, y_pos[4], newPen);//210
m_Print.DrawVLine(x_pos[0] + 300, y_pos[1], x_pos[0] + 300, y_pos[4], newPen);//60
m_Print.DrawVLine(x_pos[0] + 330, y_pos[1], x_pos[0] + 330, y_pos[4], newPen);//30
m_Print.DrawVLine(x_pos[0] + 373, y_pos[1], x_pos[0] + 373, y_pos[4], newPen);//43
m_Print.DrawVLine(x_pos[0] + 375, y_pos[1], x_pos[0] + 375, y_pos[4], newPen);
m_Print.DrawVLine(x_pos[0] + 405, y_pos[1], x_pos[0] + 405, y_pos[4], newPen);//30
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -