Explorar o código

除了打印都完成了

张洋 %!s(int64=4) %!d(string=hai) anos
pai
achega
39b65a2491

BIN=BIN
bin/Win32/Debug/zhipuzi_pos_windows/dump/2021-11-24-20-03-44.dmp


BIN=BIN
bin/Win32/Debug/zhipuzi_pos_windows/dump/2021-11-24-20-27-42.dmp


+ 6 - 2
bin/Win32/Debug/zhipuzi_pos_windows/skin/diandan_page.xml

@@ -55,6 +55,8 @@
 						<Button name="btn_diandan_cundan" width="90" height="38" padding="15,50,15,0" text="存单" normalimage="file='Btn_White.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_White_Click.png' corner='5,5,5,5'" />
 						<Button name="btn_diandan_qudan" width="90" height="38" padding="15,15,15,0" text="取单" normalimage="file='Btn_White.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_White_Click.png' corner='5,5,5,5'" />
 						
+						<Label name="diandan_page_qudan_num" text="10" mouse="false" width="20" height="20" textcolor="#FFFFFFFF" bkcolor="#FFFF0000" float="true" pos="85,450,105,470" bordercolor="#FFFF0000" bordersize="2" borderround="15,15" borderstyle="3"></Label>
+						
 						<Button name="btn_diandan_zhengdanbeizhu" width="90" height="38" padding="15,15,15,0" text="整单备注" normalimage="file='Btn_White.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_White_Click.png' corner='5,5,5,5'" />
 					</VerticalLayout>
 				</HorizontalLayout>
@@ -101,11 +103,13 @@
 				</TileLayout>
 				
 				<HorizontalLayout height="70" padding="0,0,0,0" bkcolor="#FFFFFFFF">
-					<Edit name="diandan_food_search_edit" tooltip="请输入商品名字搜索" width="500" height="50" padding="30,10,0,10" textpadding="50,0,50,0" borderround="45,45" bkcolor="#FFECEFED" nativebkcolor="#FFECEFED" />
+					<Edit name="diandan_food_search_edit" tooltip="请输入商品名字搜索" width="400" height="50" padding="30,10,0,10" textpadding="50,0,50,0" borderround="45,45" bkcolor="#FFECEFED" nativebkcolor="#FFECEFED" />
+					
+					<Label name="diandan_food_search_tishi" text="请输入商品名字搜索" width="120" height="35" font="2" float="true" pos="90,18,425,50" mouse="false"></Label>
 					
 					<Control bkimage="search_icon.png" width="25" height="26" pos="45,23,70,49" float="true"></Control>
 					
-					<Button name="diandan_food_search_clear" visible="false" normalimage="search_clear.png" hotimage="search_clear.png" pushedimage="search_clear.png" bkimage="search_clear.png" width="23" height="23" pos="485,23,68,46" float="true"></Button>
+					<Button name="diandan_food_search_clear" visible="false" normalimage="search_clear.png" hotimage="search_clear.png" pushedimage="search_clear.png" bkimage="search_clear.png" width="23" height="23" pos="385,23,68,46" float="true"></Button>
 				</HorizontalLayout>
 			</VerticalLayout>
 			

+ 21 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/guadan_wnd.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Window size="700,650" caption="0,0,0,36" roundcorner="4,4" >
+	<Font id="0" name="微软雅黑" size="22" />
+	<Font id="1" name="微软雅黑" size="32" />
+	
+	<VerticalLayout bkcolor="#FFF4F4F4">
+		<HorizontalLayout height="50" inset="10,2,10,0">
+			<Label name="memo_dlg_title" text="" align="center" valign="center" padding="0,15,0,0" font="0"/>
+		</HorizontalLayout>
+		
+		<VerticalLayout name="guadan_wnd_layout" vscrollbar="true" padding="0,10,0,0">
+		
+		</VerticalLayout>
+		
+		<HorizontalLayout height="50" valign="center" padding="30,20,0,20">
+			<Control></Control>
+			<Button name="quit" align="center" width="180" height="45" padding="0,2,0,0" text="取消" normalimage="file='Btn_White.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_White_Click.png' corner='5,5,5,5'" />
+			<Control></Control>
+		</HorizontalLayout>
+	</VerticalLayout>
+</Window>

+ 11 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/guadan_wnd_food_item.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Window size="700,650" caption="0,0,0,36" roundcorner="4,4" >
+	<Font id="0" name="微软雅黑" size="26" />
+	<Font id="1" name="微软雅黑" size="32" />
+	
+	<HorizontalLayout name="guadan_food_item" bkcolor="#FFFFFFFF" height="40" padding="15,0,15,0">
+		<Label name="food_name" width="350"></Label>
+		<Label name="food_num" width="150"></Label>
+		<Label name="food_price" width="250"></Label>
+	</HorizontalLayout>
+</Window>

+ 28 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/guadan_wnd_order_item.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Window size="700,800" caption="0,0,0,36" roundcorner="4,4" >
+	<Font id="0" name="微软雅黑" size="26" />
+	<Font id="1" name="微软雅黑" size="32" />
+	
+	<VerticalLayout name="guadan_order_layout" bkcolor="#FFFFFFFF" padding="30,20,30,0">
+		<HorizontalLayout>
+			<Label name="guadan_order_num" text="" width="30" height="40" padding="15,0,0,0"></Label>
+			<Label name="guadan_order_time" text="" width="300" height="40" padding="20,0,0,0"></Label>
+			<Control></Control>
+		</HorizontalLayout>
+		
+		<Control height="1" bkcolor="#FFEAEAEA" padding="15,0,15,0"></Control>
+		
+		<VerticalLayout name="guadan_foodlist_layout">
+		
+		</VerticalLayout>
+		
+		<Control height="1" bkcolor="#FFEAEAEA" padding="15,0,15,0"></Control>
+		
+		<HorizontalLayout height="70" valign="center" padding="15,0,0,0">
+			<Label name="guandan_order_zongjia" text="" width="200" height="70"></Label>
+			<Control></Control>
+			<Button name="guadan_order_delete" align="center" width="120" height="45" padding="0,13,0,0" text="删除此单" normalimage="file='Btn_White.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_White_Click.png' corner='5,5,5,5'" />
+			<Button name="guadan_order_queren" textcolor="#FFFFFFFF" align="center" width="120" height="45" padding="20,13,20,0" text="确认此单" normalimage="file='Btn_Green.png' corner='5,5,5,5'" hotimage="file='Btn_Green_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_Green_Click.png' corner='5,5,5,5'" />
+		</HorizontalLayout>
+	</VerticalLayout>
+</Window>

+ 1 - 1
bin/Win32/Debug/zhipuzi_pos_windows/skin/setting_page.xml

@@ -3,7 +3,7 @@
 	<SettingPage name="setting_page" bkcolor="#FFEFF6EE">
 		<HorizontalLayout>
 			<HorizontalLayout width="250" padding="20,20,20,0">
-				<VerticalLayout height="440" bkcolor="#FFFFFFFF" childpadding="15" inset="20,20,20,0">
+				<VerticalLayout height="540" bkcolor="#FFFFFFFF" childpadding="15" inset="20,20,20,0">
 					<Option name="setting_waimai_order_switch" selected="true" text="外卖接单设置" group="setting_switch" align="center" height="38" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Green_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
 					<Option name="setting_printer_switch" text="小票打印设置" group="setting_switch" align="center" height="38" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Green_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
 					<Option name="setting_biaoqian_printer_switch" text="标签打印设置" group="setting_switch" align="center" height="38" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Green_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />

+ 124 - 1
zhipuzi_pos_windows/page/CDiandanPageUI.cpp

@@ -23,6 +23,7 @@
 #include "../wnd/CFulikaShoukuanWnd.h"
 #include "../wnd/CZidingyiShoukuanWnd.h"
 #include "../wnd/CChengzhongWnd.h"
+#include "../wnd/CGuadanWnd.h"
 
 CDiandanPageUI::CDiandanPageUI()
 {
@@ -285,6 +286,9 @@ void CDiandanPageUI::InitJiesuanShow()
 	CButtonUI* pCanpaiEdit = static_cast<CButtonUI*>(this->FindSubControl(_T("btn_diandan_canpaihao")));
 	pCanpaiEdit->SetText(L"输入餐牌号");
 
+	//再初始化取单数量
+	RefreshGuadanNum();
+
 	//先初始化折扣值
 	CEditUI* pZhekouEdit = static_cast<CEditUI*>(this->FindSubControl(_T("diandan_jiesuan_zhekou_value")));
 	pZhekouEdit->SetText(L"100");
@@ -564,6 +568,24 @@ void CDiandanPageUI::ShowXuangouPage()
 	pJiacaiBtn->SetVisible(false);
 }
 
+//只是刷新取单数量
+void CDiandanPageUI::RefreshGuadanNum()
+{
+	size_t guadan_num = m_guadan_orders.size();
+	CLabelUI* pNum = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_qudan_num")));
+	if (guadan_num > 0)
+	{
+		//有挂单的
+		pNum->SetText(to_wstring(guadan_num).c_str());
+		pNum->SetVisible(true);
+	}
+	else
+	{
+		//没有挂单的
+		pNum->SetVisible(false);
+	}
+}
+
 //处理按钮点击类事件
 void CDiandanPageUI::HandleClickMsg(TNotifyUI& msg)
 {
@@ -701,6 +723,14 @@ void CDiandanPageUI::HandleClickMsg(TNotifyUI& msg)
 
 		StopSerachFood();
 	}
+	else if (name == L"btn_diandan_cundan")
+	{
+		this->ClickCundan();
+	}
+	else if (name == L"btn_diandan_qudan")
+	{
+		this->ClickQudan();
+	}
 }
 
 //处理option切换事件
@@ -1899,6 +1929,89 @@ void CDiandanPageUI::ClickQingkong()
 	ShowXuangouPage();
 }
 
+//点击存单之后的逻辑
+void CDiandanPageUI::ClickCundan()
+{
+	if (m_cur_diandan_order.getItemNum() == 0)
+	{
+		//没有选任何商品
+		return;
+	}
+
+	m_cur_diandan_order.m_guadan_time = CLewaimaiTime::DatetimeToString(time(NULL));
+
+	m_guadan_orders.push_back(m_cur_diandan_order);
+
+	//挂单之后,刷新所有显示
+	RefreshShow();
+}
+
+//点击取单之后的逻辑
+void CDiandanPageUI::ClickQudan()
+{
+	if (m_guadan_orders.size() == 0)
+	{
+		return;
+	}
+
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	CGuadanWnd* pQudanDlg = new CGuadanWnd();
+
+	if (pQudanDlg != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pQudanDlg;
+
+		pQudanDlg->SetGuadanOrders(m_guadan_orders);
+		pQudanDlg->SetPageUI(this);
+
+		pQudanDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+		pQudanDlg->SetIcon(IDI_ICON_DUILIB);
+		pQudanDlg->CenterWindow();
+
+		pQudanDlg->SetTitle(L"取单");
+
+		UINT ret = pQudanDlg->ShowModal();
+
+		if (ret == IDOK)
+		{
+			//取单成功逻辑处理
+			int nQudanNum = pQudanDlg->m_nQudanNum;
+
+			//先对当前的数据进行清空
+			RefreshShow();
+
+			//然后保存取单的订单
+			m_cur_diandan_order = m_guadan_orders[nQudanNum];
+			m_guadan_orders.erase(m_guadan_orders.begin() + nQudanNum);
+
+			RefreshGuadanNum();
+
+			//然后展示购物车
+			for (int i = 0; i < m_cur_diandan_order.getItemNum(); i++)
+			{
+				this->AddDiandanOrderItemShow(i);
+			}
+
+			m_is_show_modal_wnd = false;
+			delete pQudanDlg;
+		}
+		else
+		{
+			RefreshGuadanNum();
+
+			m_is_show_modal_wnd = false;
+			delete pQudanDlg;
+
+			return;
+		}
+	}
+}
+
 void CDiandanPageUI::ClickZhengdanMemo()
 {
 	if (m_is_show_modal_wnd == true)
@@ -2981,11 +3094,18 @@ void CDiandanPageUI::StartSearchFood(std::string foodname)
 	CHorizontalLayoutUI* pFoodtype = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_fenlei_layout")));
 	pFoodtype->SetVisible(false);
 
-	m_type_id_before_sousuo = m_cur_type_id;
+	if (m_cur_type_id != "sousuo")
+	{
+		m_type_id_before_sousuo = m_cur_type_id;
+	}
+	
 	m_cur_type_id = "sousuo";
 
 	m_sousuo_foodname = foodname;
 
+	CLabelUI* pTishi = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_food_search_tishi")));
+	pTishi->SetVisible(false);
+
 	this->InitFoodShow();
 }
 
@@ -3002,5 +3122,8 @@ void CDiandanPageUI::StopSerachFood()
 
 	m_cur_type_id = m_type_id_before_sousuo;
 
+	CLabelUI* pTishi = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_food_search_tishi")));
+	pTishi->SetVisible(true);
+
 	this->InitFoodShow();
 }

+ 13 - 0
zhipuzi_pos_windows/page/CDiandanPageUI.h

@@ -39,6 +39,9 @@ public:
 	//展示选购页面,隐藏结算页面
 	void ShowXuangouPage();
 
+	//只是刷新取单数量
+	void RefreshGuadanNum();
+
 	//处理按钮点击类事件
 	void HandleClickMsg(TNotifyUI& msg);
 
@@ -90,6 +93,12 @@ public:
 	//点击清空之后的逻辑
 	void ClickQingkong();
 
+	//点击存单之后的逻辑
+	void ClickCundan();
+
+	//点击取单之后的逻辑
+	void ClickQudan();
+
 	//点击整单备注之后的逻辑
 	void ClickZhengdanMemo();
 
@@ -184,6 +193,9 @@ private:
 	//当前购物车的订单,根据这个来进行渲染显示
 	CDiandanOrder m_cur_diandan_order;
 
+	//当前挂单的订单
+	std::vector<CDiandanOrder> m_guadan_orders;
+
 	//下面是结算相关信息
 
 	//总的优惠
@@ -265,6 +277,7 @@ private:
 	//餐牌
 	std::string m_canpai;
 
+	//模态对话框有关的
 	bool m_is_show_modal_wnd = false;
 	CModalWnd* m_curModalWnd;
 };

+ 250 - 0
zhipuzi_pos_windows/wnd/CGuadanWnd.cpp

@@ -0,0 +1,250 @@
+#include "../pch/pch.h"
+#include "CGuadanWnd.h"
+
+#include "../page/CDiandanPageUI.h"
+
+LRESULT CGuadanWnd::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	POINT pt;
+	pt.x = GET_X_LPARAM(lParam);
+	pt.y = GET_Y_LPARAM(lParam);
+	::ScreenToClient(*this, &pt);
+
+	RECT rcClient;
+	::GetClientRect(*this, &rcClient);
+
+	RECT rcCaption = m_pm.GetCaptionRect();
+	if (pt.x >= rcClient.left + rcCaption.left && pt.x < rcClient.right - rcCaption.right \
+		&& pt.y >= rcCaption.top && pt.y < rcCaption.bottom)
+	{
+		CControlUI* pControl = static_cast<CControlUI*>(m_pm.FindControl(pt));
+		if (pControl && _tcscmp(pControl->GetClass(), DUI_CTR_BUTTON) != 0)
+		{
+			return HTCAPTION;
+		}
+	}
+
+	return HTCLIENT;
+}
+
+LRESULT CGuadanWnd::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	SIZE szRoundCorner = m_pm.GetRoundCorner();
+	if (!::IsIconic(*this) && (szRoundCorner.cx != 0 || szRoundCorner.cy != 0))
+	{
+		CDuiRect rcWnd;
+		::GetWindowRect(*this, &rcWnd);
+		rcWnd.Offset(-rcWnd.left, -rcWnd.top);
+		rcWnd.right++;
+		rcWnd.bottom++;
+		HRGN hRgn = ::CreateRoundRectRgn(rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom, szRoundCorner.cx, szRoundCorner.cy);
+		::SetWindowRgn(*this, hRgn, TRUE);
+		::DeleteObject(hRgn);
+	}
+
+	bHandled = FALSE;
+	return 0;
+}
+
+LRESULT CGuadanWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+	LRESULT lRes = 0;
+	BOOL bHandled = TRUE;
+	switch (uMsg)
+	{
+	case WM_CREATE:
+		lRes = OnCreate(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_NCACTIVATE:
+		lRes = OnNcActivate(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_NCCALCSIZE:
+		lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_NCPAINT:
+		lRes = OnNcPaint(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_NCHITTEST:
+		lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_SIZE:
+		lRes = OnSize(uMsg, wParam, lParam, bHandled);
+		break;
+	default:
+		bHandled = FALSE;
+	}
+	if (bHandled)
+	{
+		return lRes;
+	}
+	if (m_pm.MessageHandler(uMsg, wParam, lParam, lRes))
+	{
+		return lRes;
+	}
+	return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
+}
+
+LRESULT CGuadanWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled)
+{
+	if (uMsg == WM_KEYDOWN)
+	{
+		if (wParam == VK_RETURN)
+		{
+			return true;
+		}
+		else if (wParam == VK_ESCAPE)
+		{
+			return true;
+		}
+	}
+
+	return false;
+}
+
+LRESULT CGuadanWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);
+	styleValue &= ~WS_CAPTION;
+	::SetWindowLong(*this, GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
+
+	// 把自己的窗口句柄与窗口绘制管理器挂接在一起
+	m_pm.Init(m_hWnd);
+
+	m_pm.AddPreMessageFilter(this);
+
+	CDialogBuilder builder;
+
+	CControlUI* pRoot = builder.Create(_T("guadan_wnd.xml"), (UINT)0, NULL, &m_pm);
+	ASSERT(pRoot && "Failed to parse XML");
+
+	// 把这些控件绘制到本窗口上
+	m_pm.AttachDialog(pRoot);
+
+	// 把自己加入到CPaintManagerUI的m_aNotifiers数组中,用于处理Notify函数
+	m_pm.AddNotifier(this);
+
+	Init();
+
+	return 0;
+}
+
+void CGuadanWnd::Notify(TNotifyUI& msg)
+{
+	if (msg.sType == _T("click"))
+	{
+		DuiLib::CDuiString senderName = msg.pSender->GetName();
+
+		if (senderName == _T("quit"))
+		{
+			Close(IDCANCEL);
+			return;
+		}
+		else if (senderName == _T("save"))
+		{
+			
+		}
+		else if (senderName == _T("guadan_order_delete"))
+		{
+			std::wstring ws_order_num = msg.pSender->GetCustomAttribute(L"order_num");
+
+			int order_num = atoi(CLewaimaiString::UnicodeToUTF8(ws_order_num).c_str());
+
+			//把这个删掉
+			m_guadan_orders->erase(m_guadan_orders->begin() + order_num);
+
+			RefreshOrder();
+
+			m_pageUI->RefreshGuadanNum();
+		}
+		else if (senderName == _T("guadan_order_queren"))
+		{
+			std::wstring ws_order_num = msg.pSender->GetCustomAttribute(L"order_num");
+
+			m_nQudanNum = atoi(CLewaimaiString::UnicodeToUTF8(ws_order_num).c_str());
+
+			Close(IDOK);
+		}
+	}
+	else if (msg.sType == _T("textchanged"))
+	{
+		
+	}
+}
+
+void CGuadanWnd::Init()
+{
+	RefreshOrder();
+}
+
+void CGuadanWnd::RefreshOrder()
+{
+	//这个是用来展示所有订单的区域
+	CVerticalLayoutUI* pOrderLayout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("guadan_wnd_layout")));
+	pOrderLayout->RemoveAll();
+
+	int order_num = 0;
+	for (std::vector<CDiandanOrder>::iterator it = m_guadan_orders->begin(); it != m_guadan_orders->end(); it++)
+	{
+		CDiandanOrder curOrder = *it;
+
+		CDialogBuilder builder;
+
+		//一个pEle就是一个订单的区域
+		CHorizontalLayoutUI* pEle = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("guadan_wnd_order_item.xml"), (UINT)0, NULL, &m_pm));
+
+		pOrderLayout->Add(pEle);
+
+		//这个是订单内部的展示商品的区域
+		CVerticalLayoutUI* pFoodLayout = static_cast<CVerticalLayoutUI*>(pEle->FindSubControl(_T("guadan_foodlist_layout")));
+		pFoodLayout->SetFixedHeight(curOrder.getItemNum() * 40);
+
+		pEle->SetFixedHeight(curOrder.getItemNum() * 40 + 112);
+
+		for (int i = 0; i < curOrder.getItemNum(); i++)
+		{
+			CDiandanOrderItem curItem = curOrder.m_items[i];
+
+			CDialogBuilder builder1;
+
+			//这个是某一行商品
+			CHorizontalLayoutUI* pFoodEle = static_cast<CHorizontalLayoutUI*>(builder1.Create(_T("guadan_wnd_food_item.xml"), (UINT)0, NULL, &m_pm));
+			pFoodLayout->Add(pFoodEle);
+
+			std::string nameShow = curItem.getNameShow();
+			pFoodEle->FindSubControl(L"food_name")->SetText(CLewaimaiString::UTF8ToUnicode(nameShow).c_str());
+
+			pFoodEle->FindSubControl(L"food_num")->SetText(CLewaimaiString::UTF8ToUnicode(curItem.num).c_str());
+
+			pFoodEle->FindSubControl(L"food_price")->SetText(CLewaimaiString::UTF8ToUnicode(curItem.show_price).c_str());
+		}
+
+		CLabelUI* pPrice = static_cast<CLabelUI*>(pEle->FindSubControl(_T("guandan_order_zongjia")));
+		pPrice->SetText((L"商品总价:" + CLewaimaiString::UTF8ToUnicode(curOrder.getTotalPriceShow())).c_str());
+
+		CLabelUI* pNum = static_cast<CLabelUI*>(pEle->FindSubControl(_T("guadan_order_num")));
+		pNum->SetText((L"#" + to_wstring(order_num + 1)).c_str());
+
+		CLabelUI* pTime = static_cast<CLabelUI*>(pEle->FindSubControl(_T("guadan_order_time")));
+		pTime->SetText(CLewaimaiString::UTF8ToUnicode(curOrder.m_guadan_time).c_str());
+
+		//给按钮加属性,点击的时候好判断并且处理
+		CButtonUI* pDelete = static_cast<CButtonUI*>(pEle->FindSubControl(_T("guadan_order_delete")));
+		pDelete->AddCustomAttribute(L"order_num", to_wstring(order_num).c_str());
+
+		CButtonUI* pQueren = static_cast<CButtonUI*>(pEle->FindSubControl(_T("guadan_order_queren")));
+		pQueren->AddCustomAttribute(L"order_num", to_wstring(order_num).c_str());
+
+		order_num++;
+	}
+}
+
+std::string CGuadanWnd::getContent()
+{
+	return m_content;
+}
+
+void CGuadanWnd::SetTitle(std::wstring title)
+{
+	CLabelUI* pLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("memo_dlg_title")));
+	pLabel->SetText(title.c_str());
+}

+ 98 - 0
zhipuzi_pos_windows/wnd/CGuadanWnd.h

@@ -0,0 +1,98 @@
+#pragma once
+
+#include "../pch/pch.h"
+#include "CMainWnd.h"
+#include "CModalWnd.h"
+
+#include "../zhipuzi/CDiandanOrder.h"
+
+class CDiandanPageUI;
+class CGuadanWnd : public CModalWnd
+{
+public:
+	LPCTSTR GetWindowClassName() const
+	{
+		return _T("UIMemoWndFrame");
+	};
+
+	UINT GetClassStyle() const
+	{
+		return UI_CLASSSTYLE_DIALOG;
+	};
+
+	void OnFinalMessage(HWND /*hWnd*/)
+	{
+		//WindowImplBase::OnFinalMessage(hWnd);
+		m_pm.RemovePreMessageFilter(this);
+
+		//delete this;
+	};
+
+	void Init();
+
+	void RefreshOrder();
+
+	std::string getContent();
+
+	void SetPageUI(CDiandanPageUI* page)
+	{
+		m_pageUI = page;
+	}
+
+	void SetTitle(std::wstring title);
+
+	void SetGuadanOrders(std::vector<CDiandanOrder>& guadan_orders)
+	{
+		m_guadan_orders = &guadan_orders;
+	}
+
+	void Notify(TNotifyUI& msg);
+
+	LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT OnNcActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+	{
+		if (::IsIconic(*this))
+		{
+			bHandled = FALSE;
+		}
+		return (wParam == 0) ? TRUE : FALSE;
+	}
+
+	LRESULT OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+	{
+		return 0;
+	}
+
+	LRESULT OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+	{
+		return 0;
+	}
+
+	LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
+
+	LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled);
+
+	//处理键盘捕捉结果
+	void HandleTextCapture(std::string content)
+	{
+
+	}
+
+public:
+	CPaintManagerUI m_pm;
+
+	std::string m_content;
+
+	//当前挂单的订单
+	std::vector<CDiandanOrder>* m_guadan_orders;
+
+	CDiandanPageUI* m_pageUI;
+
+	int m_nQudanNum;
+};
+

+ 35 - 0
zhipuzi_pos_windows/wnd/CLoginWnd.cpp

@@ -738,6 +738,41 @@ bool CLoginWnd::GetShopinfo()
 		return false;
 	}
 
+	if (!document.HasMember("data"))
+	{
+		m_wsLoginErrMsg = _T("服务器返回数据格式错误");
+		PostMessage(WM_LOGIN_ERROR);
+
+		return false;
+	}	
+	
+	if (document.HasMember("error_code"))
+	{
+		rapidjson::Value& v_errcode = document["error_code"];
+		int errcode = v_errcode.GetInt();
+		if (errcode != 0)
+		{
+			std::string errmsg = "response failed! message:" + string(document["error_msg"].GetString());
+			m_wsLoginErrMsg = CLewaimaiString::UTF8ToUnicode(errmsg);
+			PostMessage(WM_LOGIN_ERROR);
+
+			return false;
+		}
+	}
+	else
+	{
+		rapidjson::Value& v_errcode = document["errcode"];
+		int errcode = v_errcode.GetInt();
+		if (errcode != 0)
+		{
+			std::string errmsg = "response failed! message:" + string(document["errmsg"].GetString());
+			m_wsLoginErrMsg = CLewaimaiString::UTF8ToUnicode(errmsg);
+			PostMessage(WM_LOGIN_ERROR);
+
+			return false;
+		}
+	}
+
 	//获得数据成功
 	rapidjson::Value& data = document["data"];
 

+ 3 - 0
zhipuzi_pos_windows/wnd/CMainWnd.cpp

@@ -382,6 +382,9 @@ LRESULT CMainWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
 		lRes = OnKeydown(uMsg, wParam, lParam, bHandled);
 		break;
 
+	case WM_KILLFOCUS:
+		break;
+
     default:
         bHandled = FALSE;
     }

+ 2 - 0
zhipuzi_pos_windows/wnd/CSaomaYouhuiquanWnd.cpp

@@ -7,6 +7,8 @@ LRESULT CSaomaYouhuiquanWnd::OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam,
 
 	pFukuanEdit->SetFocus();
 
+	pFukuanEdit->Invalidate();
+
 	return 0;
 }
 

+ 2 - 0
zhipuzi_pos_windows/zhipuzi/CDiandanOrder.h

@@ -21,6 +21,8 @@ public:
 
 	std::string m_total_price_show;
 
+	std::string m_guadan_time;
+
 private:
 	//¶©µ¥µÄÕûµ¥±¸×¢
 	std::string m_memo;

+ 2 - 0
zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj

@@ -225,6 +225,7 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     </PostBuildEvent>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClInclude Include="wnd\CGuadanWnd.h" />
     <ClInclude Include="wnd\CModalWnd.h" />
     <ClInclude Include="wnd\CChengzhongWnd.h" />
     <ClInclude Include="tool\CSerialPort.h" />
@@ -293,6 +294,7 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClInclude Include="helper\CSystem.h" />
   </ItemGroup>
   <ItemGroup>
+    <ClCompile Include="wnd\CGuadanWnd.cpp" />
     <ClCompile Include="wnd\CModalWnd.cpp" />
     <ClCompile Include="wnd\CChengzhongWnd.cpp" />
     <ClCompile Include="tool\CSerialPort.cpp" />

+ 6 - 0
zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj.filters

@@ -213,6 +213,9 @@
     <ClInclude Include="wnd\CModalWnd.h">
       <Filter>头文件</Filter>
     </ClInclude>
+    <ClInclude Include="wnd\CGuadanWnd.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="pch\pch.cpp">
@@ -389,6 +392,9 @@
     <ClCompile Include="wnd\CModalWnd.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
+    <ClCompile Include="wnd\CGuadanWnd.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <Image Include="resource\zhipuzi.ico">