张洋 1 month ago
parent
commit
fd9ad8127d

BIN
bin/Win32/Debug/zhipuzi_pos_windows/skin/main_yubaozhuangbiaoqian.png


BIN
bin/Win32/Debug/zhipuzi_pos_windows/skin/main_yubaozhuangbiaoqian_select.png


+ 59 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/yubaozhuangbiaoqian_page.xml

@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Window>
+	<Font id="140" name="微软雅黑" size="40" bold="true" />
+
+	<YubaozhuangbiaoqianPage>
+		<HorizontalLayout>
+			<Control width="1" bkcolor="#FFD1D1D1"></Control>
+				
+			<VerticalLayout width="380" bkcolor="#FFFFFFFF" padding="0,0,0,0">
+				<HorizontalLayout name="diandan_page_chengzhong_layout" height="100">
+					<VerticalLayout width="80">
+						<Control name="diandan_page_status_chengzhong_wending" bkimage="deng_off.png" width="8" height="8" float="true" pos="15,28,23,36" mouse="false"></Control>
+						<Label name="diandan_page_label_chengzhong_wending" text="稳定" height="20" padding="30,20,0,0" font="14"></Label>
+
+						<Control name="diandan_page_status_chengzhong_jingzhong" bkimage="deng_off.png" width="8" height="8" float="true" pos="15,68,23,76" mouse="false"></Control>
+						<Label name="diandan_page_label_chengzhong_jingzhong" text="净重" height="20" padding="30,20,0,0" font="14"></Label>
+					</VerticalLayout>							
+
+					<HorizontalLayout width="200">
+						<Label name="diandan_page_label_chengzhong_value" text="0.000" align="right" width="135" height="40" padding="0,35,0,0" textcolor="#FF3CB371" font="140"></Label>
+						<Label name="diandan_page_label_chengzhong_unit" text="公斤" height="30" padding="15,40,0,0" font="16"></Label>
+					</HorizontalLayout>
+
+					<VerticalLayout>
+						<Button name="diandan_page_chengzhong_zhiling" visible="false" width="80" height="32" padding="10,10,10,0" text="置零" textcolor="#FFFFFFFF" normalimage="file='btn_green_zhengchang.png' corner='5,5,5,5'" hotimage="file='btn_green_xuanfu.png' corner='5,5,5,5'" pushedimage="file='btn_green_dianji.png' corner='5,5,5,5'" />
+						<Button name="diandan_page_chengzhong_qupi" visible="false" width="80" height="32" padding="10,15,10,0" text="去皮" textcolor="#FFFFFFFF" normalimage="file='btn_green_zhengchang.png' corner='5,5,5,5'" hotimage="file='btn_green_xuanfu.png' corner='5,5,5,5'" pushedimage="file='btn_green_dianji.png' corner='5,5,5,5'" />
+
+					</VerticalLayout>
+				</HorizontalLayout>
+
+				<Control height="1" bkcolor="#FFEBE8E8"></Control>	
+			</VerticalLayout>
+			
+			<Control width="1" bkcolor="#FFEBE8E8"></Control>
+			
+			<VerticalLayout name="diandan_food_layout">
+				<VerticalLayout name="diandan_fenlei_layout_scrolllayout" vscrollbar="true">
+					<Container name="diandan_fenlei_layout" padding="0,0,0,0" bkcolor="#FFFFFFFF">
+
+					</Container>
+				</VerticalLayout>
+				
+				<TileLayout name="diandan_foodlist" padding="0,0,0,0" inset="10,10,0,10" childpadding="10" vscrollbar="true" hscrollbar="false">
+				
+				</TileLayout>
+				
+				<HorizontalLayout height="70" padding="0,0,0,0" bkcolor="#FFFFFFFF">
+					<Edit name="diandan_food_search_edit" tooltip="请输入商品名字搜索" width="380" 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="16" 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" width="23" height="23" pos="365,23,388,46" float="true" normalimage="search_clear.png" hotimage="search_clear.png" pushedimage="search_clear.png" bkimage="search_clear.png"></Button>
+				</HorizontalLayout>
+			</VerticalLayout>
+		</HorizontalLayout>
+	</YubaozhuangbiaoqianPage>
+</Window>

+ 5 - 0
zhipuzi_pos_windows/control/ControlEx.h

@@ -26,6 +26,7 @@
 #include "../page/CShoukuanOrderListPageUI.h"
 #include "../page/CShoukuanOrderListPageUI.h"
 #include "../page/CShoukuanOrderInfoPageUI.h"
 #include "../page/CShoukuanOrderInfoPageUI.h"
 #include "../page/CAIxuexiPageUI.h"
 #include "../page/CAIxuexiPageUI.h"
+#include "../page/CYubaozhuangbiaoqianPageUI.h"
 
 
 #include "CWaimaiOrderItemUI.h"
 #include "CWaimaiOrderItemUI.h"
 #include "CDianneiOrderItemUI.h"
 #include "CDianneiOrderItemUI.h"
@@ -140,6 +141,10 @@ public:
 		{
 		{
 			return new CAIxuexiPageUI;
 			return new CAIxuexiPageUI;
 		}
 		}
+		else if (_tcscmp(pstrClass, _T("YubaozhuangbiaoqianPage")) == 0)
+		{
+			return new CYubaozhuangbiaoqianPageUI;
+		}
 
 
 		//控件相关的
 		//控件相关的
 		else if (_tcscmp(pstrClass, _T("WaimaiOrderItem")) == 0)
 		else if (_tcscmp(pstrClass, _T("WaimaiOrderItem")) == 0)

+ 18 - 0
zhipuzi_pos_windows/page/CGengduoPageUI.cpp

@@ -197,6 +197,12 @@ void CGengduoPageUI::Refresh()
 			pImage->SetBkImage(L"main_shoukuan.png");
 			pImage->SetBkImage(L"main_shoukuan.png");
 			pItem->SetName(L"shoukuan");
 			pItem->SetName(L"shoukuan");
 		}
 		}
+		else if (*it == "yubaozhuangbiaoqian")
+		{
+			pTitle->SetText(L"预包装标签");
+			pImage->SetBkImage(L"main_yubaozhuangbiaoqian.png");
+			pItem->SetName(L"yubaozhuangbiaoqian");
+		}
 		else
 		else
 		{
 		{
 			continue;
 			continue;
@@ -370,6 +376,18 @@ void CGengduoPageUI::Refresh()
 			pBack->SetName(L"gengduo_back");
 			pBack->SetName(L"gengduo_back");
 			pExchange->SetName(L"gengduo_exchange");
 			pExchange->SetName(L"gengduo_exchange");
 		}
 		}
+		else if (*it == "yubaozhuangbiaoqian")
+		{
+			pTitle->SetText(L"预包装标签");
+			pImage->SetBkImage(L"main_yubaozhuangbiaoqian.png");
+			pItem->SetName(L"yubaozhuangbiaoqian");
+
+			pExchange->SetText(L"上移");
+
+			pFront->SetName(L"gengduo_front");
+			pBack->SetName(L"gengduo_back");
+			pExchange->SetName(L"gengduo_exchange");
+			}
 		else
 		else
 		{
 		{
 			continue;
 			continue;

+ 1282 - 0
zhipuzi_pos_windows/page/CYubaozhuangbiaoqianPageUI.cpp

@@ -0,0 +1,1282 @@
+#include "../pch/pch.h"
+#include "CYubaozhuangbiaoqianPageUI.h"
+
+#include "../control/ControlEx.h"
+#include "../tool/CSqlite3.h"
+
+#include "../wnd/CDiandanNatureWnd.h"
+#include "../wnd/CMemoWnd.h"
+#include "../wnd/CYouhuiShowWnd.h"
+#include "../wnd/CMemberLoginWnd.h"
+#include "../wnd/CSaomaYouhuiquanWnd.h"
+#include "../wnd/CSaomaShangpinquanWnd.h"
+#include "../wnd/CSaomaCikaWnd.h"
+#include "../wnd/CSaomaQuanyikaWnd.h"
+#include "../wnd/CCanpaiWnd.h"
+#include "../wnd/CWeixinzhifuShoukuanWnd.h"
+#include "../wnd/CHuiyuanShoukuanWnd.h"
+#include "../wnd/CXianjinShoukuanWnd.h"
+#include "../wnd/CFulikaShoukuanWnd.h"
+#include "../wnd/CZidingyiShoukuanWnd.h"
+#include "../wnd/CChengzhongWnd.h"
+#include "../wnd/CGuadanWnd.h"
+#include "../wnd/CNumInputWnd.h"
+#include "../wnd/CHuiyuanInfoShowWnd.h"
+
+#include "../print/CPosPrinter.h"
+
+#include "../tool/CShuangpingTool.h"
+
+#include "../worker/CChengzhongWorker.h"
+#include "../worker/CDiandanAIShibieWorker.h"
+
+CYubaozhuangbiaoqianPageUI::CYubaozhuangbiaoqianPageUI()
+{
+}
+
+
+CYubaozhuangbiaoqianPageUI::~CYubaozhuangbiaoqianPageUI()
+{
+}
+
+void CYubaozhuangbiaoqianPageUI::InitControl()
+{
+
+}
+
+//初始化当前页面的展示,处理默认展示效果,在页面被加载的时候调用
+void CYubaozhuangbiaoqianPageUI::InitShow()
+{
+	//先初始化商品分类
+	this->InitFoodtypeShow();
+
+	//再初始化商品显示
+	this->InitFoodShow();
+
+	CHorizontalLayoutUI* chegnzhongLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_page_chengzhong_layout")));
+	if (CSetting::GetInstance()->GetParam("setting_dianzicheng_is_lianjie") == "0")
+	{
+		chegnzhongLayout->SetVisible(false);
+
+		m_is_dianzicheng_lianjie = false;
+	}
+	else
+	{
+		chegnzhongLayout->SetVisible(true);
+
+		m_is_dianzicheng_lianjie = true;
+
+		//刷新一下重量显示
+		this->HandleChengzhongValueChange();
+	}
+}
+
+void CYubaozhuangbiaoqianPageUI::RefreshShow()
+{
+	//初始化商品显示(因为这里要刷新商品库存状态)
+	this->InitFoodShow();
+}
+
+void CYubaozhuangbiaoqianPageUI::InitFoodtypeShow()
+{
+	//初始化商品渲染相关的信息
+	m_foodtypeLayout = static_cast<CContainerUI*>(this->FindSubControl(_T("diandan_fenlei_layout")));
+	m_foodtypeLayout->RemoveAll();
+
+	std::string is_ai_shibie = CSetting::GetInstance()->GetParam("setting_is_ai_recognition_open");
+	if (is_ai_shibie == "1")
+	{
+		m_is_ai_shibie = true;
+	}
+	else
+	{
+		m_is_ai_shibie = false;
+	}
+
+	CSqlite3 sqlite;
+	m_nFoodpackageNum = sqlite.GetFoodpackageNum();
+	m_types = sqlite.GetFoodtypes(); //只包含收银机显示的分类
+
+	if (m_is_ai_shibie == true)
+	{
+		m_cur_type_id = "ai";
+	}
+	else if (m_nFoodpackageNum > 0)
+	{
+		//默认选中的分类是商品套餐
+		m_cur_type_id = "taocan";
+	}
+	else
+	{
+		//没有套餐,默认选中第一个商品分类
+		if (m_types.size() > 0)
+		{
+			m_cur_type_id = m_types[0].id;
+		}
+	}
+
+	m_curFoodtypeOption = NULL;
+
+	if (is_ai_shibie == "1")
+	{
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+
+		CFoodtypeOptionUI* pItem = static_cast<CFoodtypeOptionUI*>(builder.Create(_T("foodtype_option.xml"), (UINT)0, &cb, m_pManager));
+
+		pItem->SetName(L"AI识别结果");
+		pItem->SetTypeId("ai");
+		pItem->SetGroup(L"diandan_foodtype");
+
+		m_foodtypeLayout->Add(pItem);
+
+		if (m_cur_type_id == "ai")
+		{
+			m_curFoodtypeOption = pItem;
+		}
+	}
+
+	//先判断有没有套餐分类
+	if (m_nFoodpackageNum > 0)
+	{
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+
+		CFoodtypeOptionUI* pItem = static_cast<CFoodtypeOptionUI*>(builder.Create(_T("foodtype_option.xml"), (UINT)0, &cb, m_pManager));
+
+		pItem->SetName(L"商品套餐");
+		pItem->SetTypeId("taocan");
+		pItem->SetTaocan();
+		pItem->SetGroup(L"diandan_foodtype");
+
+		m_foodtypeLayout->Add(pItem);
+
+		if (m_cur_type_id == "taocan")
+		{
+			m_curFoodtypeOption = pItem;
+		}
+	}
+
+	//接下来开始处理商品分类
+	for (std::vector<CFoodType>::iterator it = m_types.begin(); it != m_types.end(); it++)
+	{
+		CFoodType type = *it;
+		
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+
+		CFoodtypeOptionUI* pItem = static_cast<CFoodtypeOptionUI*>(builder.Create(_T("foodtype_option.xml"), (UINT)0, &cb, m_pManager));
+
+		pItem->SetName(CLewaimaiString::UTF8ToUnicode(type.name));
+		pItem->SetTypeId(type.id);
+		pItem->SetGroup(L"diandan_foodtype");
+
+		m_foodtypeLayout->Add(pItem);
+
+		if (m_cur_type_id == type.id)
+		{
+			m_curFoodtypeOption = pItem;
+		}
+	}
+
+	if (m_curFoodtypeOption != NULL)
+	{
+		m_curFoodtypeOption->Selected(true, true);
+	}
+
+	UpdateFoodtypePos();
+}
+
+void CYubaozhuangbiaoqianPageUI::UpdateFoodtypePos()
+{
+	int nFoodtypeNum = m_types.size();
+
+	if (m_is_ai_shibie == true)
+	{
+		nFoodtypeNum++;
+	}
+
+	if (m_nFoodpackageNum > 0)
+	{
+		nFoodtypeNum++;
+	}
+
+	//添加支付方式
+	int nWidth = m_nPageWidth;
+	if (nWidth == 0)
+	{
+		return;
+	}
+
+	//根据宽度计算每行显示的数量
+	int nMeihangNum = (nWidth - 381) / 140;
+
+	int num = 0;
+
+	CContainerUI* pFenleiLayout = static_cast<CContainerUI*>(this->FindSubControl(_T("diandan_fenlei_layout")));
+
+	for (int i = 0; i < nFoodtypeNum; i++)
+	{
+		CFoodtypeOptionUI* curItem = static_cast<CFoodtypeOptionUI*>(pFenleiLayout->GetItemAt(i));
+
+		int curRow = num / nMeihangNum + 1;
+		int curCol = num % nMeihangNum + 1;
+
+		RECT rect;
+		rect.left = (curCol - 1) * 140 + 10;
+		rect.right = rect.left + 130;
+		rect.top = (curRow - 1) * 52 + 10;
+		rect.bottom = rect.top + 42;
+
+		// 强制设置固定大小和位置
+		SIZE size;
+		size.cx = rect.left;
+		size.cy = rect.top;
+
+		curItem->SetFixedXY(size);
+		curItem->SetFixedWidth(rect.right - rect.left);
+		curItem->SetFixedHeight(rect.bottom - rect.top);
+
+		num++;
+	}
+
+	//调整区域高度
+	int lastRow = (num - 1) / nMeihangNum + 1;
+	pFenleiLayout->SetFixedHeight(lastRow * 52 + 10);
+
+	//处理滚动条问题
+	CVerticalLayoutUI* pFenleiScrollLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("diandan_fenlei_layout_scrolllayout")));
+	if (lastRow > 2)
+	{
+		lastRow = 2;
+	}
+
+	pFenleiScrollLayout->SetFixedHeight(lastRow * 52 + 10);
+
+	SIZE size;
+	size.cx = 0;
+	size.cy = 0;
+	pFenleiScrollLayout->SetScrollPos(size);
+}
+
+void CYubaozhuangbiaoqianPageUI::InitFoodShow()
+{
+	std::string setting_xianshi_is_youtu = CSetting::GetInstance()->GetParam("setting_xianshi_is_youtu");
+
+	m_foodLayout = static_cast<CTileLayoutUI*>(this->FindSubControl(_T("diandan_foodlist")));
+	m_foodLayout->RemoveAll();
+
+	std::wstring xml_name;
+
+	if (setting_xianshi_is_youtu == "1")
+	{
+		SIZE itemsize;
+		itemsize.cx = 130;
+		itemsize.cy = 200;
+		m_foodLayout->SetItemSize(itemsize);
+
+		xml_name = _T("diandan_fooditem_youtu.xml");
+	}
+	else if (setting_xianshi_is_youtu == "2")
+	{
+		SIZE itemsize;
+		itemsize.cx = 230;
+		itemsize.cy = 90;
+		m_foodLayout->SetItemSize(itemsize);
+
+		xml_name = _T("diandan_fooditem_youtu_2.xml");
+	}
+	else if (setting_xianshi_is_youtu == "3")
+	{
+		SIZE itemsize;
+		itemsize.cx = 140;
+		itemsize.cy = 120;
+		m_foodLayout->SetItemSize(itemsize);
+
+		xml_name = _T("diandan_fooditem_youtu_3.xml");
+	}
+	else
+	{
+		SIZE itemsize;
+		itemsize.cx = 140;
+		itemsize.cy = 100;
+		m_foodLayout->SetItemSize(itemsize);
+
+		xml_name = _T("diandan_fooditem_wutu.xml");
+	}
+
+	//如果当前一个分类都没有,那么就不处理了
+	if (m_cur_type_id == "")
+	{
+		return;
+	}
+	else if (m_cur_type_id == "ai")
+	{
+		//把AI识别的结果展示出来
+		std::string ai_name = CDiandanAIShibieWorker::GetInstance()->GetShibieFoodname();
+		if (ai_name == "Unknown" || ai_name == "")
+		{
+			return;
+		}
+
+		CSqlite3 sqlite;
+		std::vector<CFood> foodlist = sqlite.GetFoodByFoodname(ai_name);
+
+		for (std::vector<CFood>::iterator it = foodlist.begin(); it != foodlist.end(); it++)
+		{
+			CFood food = *it;
+
+			CDialogBuilder builder;
+			CDialogBuilderCallbackEx cb;
+
+			CDiandanFoodItemUI* pItem = static_cast<CDiandanFoodItemUI*>(builder.Create(xml_name.c_str(), (UINT)0, &cb, m_pManager));
+
+			m_foodLayout->Add(pItem);
+
+			pItem->SetYoutuModel(setting_xianshi_is_youtu);
+			pItem->SetFoodInfo(food);
+			pItem->UpdateShow();
+		}
+	}
+	else if (m_cur_type_id == "taocan")
+	{
+		//选择的是套餐分类
+		CSqlite3 sqlite;
+		std::vector<CFoodpackage> foodlist = sqlite.GetFoodpackages(true);
+
+		for (std::vector<CFoodpackage>::iterator it = foodlist.begin(); it != foodlist.end(); it++)
+		{
+			CFoodpackage food = *it;
+
+			CDialogBuilder builder;
+			CDialogBuilderCallbackEx cb;
+
+			CDiandanFoodItemUI* pItem = static_cast<CDiandanFoodItemUI*>(builder.Create(xml_name.c_str(), (UINT)0, &cb, m_pManager));
+
+			m_foodLayout->Add(pItem);
+
+			pItem->SetYoutuModel(setting_xianshi_is_youtu);
+			pItem->SetFoodpackageInfo(food);
+			pItem->UpdateShow();
+		}
+	}
+	else if (m_cur_type_id == "sousuo")
+	{
+		if (CLewaimaiString::is_only_number(m_sousuo_foodname))
+		{
+			//说明是纯数字,按商品条码来搜索
+			CSqlite3 sqlite;
+			CFood food;
+
+			bool ret = sqlite.GetFoodByBarcode(m_sousuo_foodname, food);
+
+			if (ret)
+			{
+				CDialogBuilder builder;
+				CDialogBuilderCallbackEx cb;
+
+				CDiandanFoodItemUI* pItem = static_cast<CDiandanFoodItemUI*>(builder.Create(xml_name.c_str(), (UINT)0, &cb, m_pManager));
+
+				m_foodLayout->Add(pItem);
+
+				pItem->SetYoutuModel(setting_xianshi_is_youtu);
+				pItem->SetFoodInfo(food);
+				pItem->UpdateShow();
+			}
+		}
+		else
+		{
+			//当商品名字来搜索
+			CSqlite3 sqlite;
+			std::vector<CFood> foodlist = sqlite.GetFoodByFoodname(m_sousuo_foodname);
+
+			for (std::vector<CFood>::iterator it = foodlist.begin(); it != foodlist.end(); it++)
+			{
+				CFood food = *it;
+
+				CDialogBuilder builder;
+				CDialogBuilderCallbackEx cb;
+
+				CDiandanFoodItemUI* pItem = static_cast<CDiandanFoodItemUI*>(builder.Create(xml_name.c_str(), (UINT)0, &cb, m_pManager));
+
+				m_foodLayout->Add(pItem);
+
+				pItem->SetYoutuModel(setting_xianshi_is_youtu);
+				pItem->SetFoodInfo(food);
+				pItem->UpdateShow();
+			}
+		}
+	}
+	else
+	{
+		//选择的是普通商品分类
+		CSqlite3 sqlite;
+		std::vector<CFood> foodlist = sqlite.GetFoodByTypeid(m_cur_type_id);
+
+		for (std::vector<CFood>::iterator it = foodlist.begin(); it != foodlist.end(); it++)
+		{
+			CFood food = *it;
+
+			CDialogBuilder builder;
+			CDialogBuilderCallbackEx cb;
+
+			CDiandanFoodItemUI* pItem = static_cast<CDiandanFoodItemUI*>(builder.Create(xml_name.c_str(), (UINT)0, &cb, m_pManager));
+
+			m_foodLayout->Add(pItem);
+
+			pItem->SetYoutuModel(setting_xianshi_is_youtu);
+			pItem->SetFoodInfo(food);
+			pItem->UpdateShow();
+		}
+	}
+}
+
+//处理按钮点击类事件
+void CYubaozhuangbiaoqianPageUI::HandleClickMsg(TNotifyUI& msg)
+{
+	CDuiString name = msg.pSender->GetName();
+
+	if (name == L"diandan_fooditem")
+	{
+		CDiandanFoodItemUI* fooditemUI = static_cast<CDiandanFoodItemUI*>(msg.pSender);
+
+		m_cur_click_food_item = fooditemUI;
+
+		this->ClickFoodAction();
+	}
+	else if (name == L"diandan_food_search_clear")
+	{
+		CEditUI* m_pEdit = static_cast<CEditUI*>(m_pManager->FindControl(_T("diandan_food_search_edit")));
+		m_pEdit->SetText(L"");
+
+		StopSerachFood();
+	}
+	else if (name == L"btn_diandan_qianxiang")
+	{
+		CPosPrinter printer;
+		printer.OpenQianxiang();
+	}
+	else if (name == L"diandan_page_chengzhong_zhiling")
+	{
+		this->ZhiLing();
+	}
+	else if (name == L"diandan_page_chengzhong_qupi")
+	{
+		this->Qupi();
+	}
+}
+
+//处理option切换事件
+void CYubaozhuangbiaoqianPageUI::HandleSelectChangeMsg(TNotifyUI& msg)
+{
+	CDuiString name = msg.pSender->GetName();
+
+	COptionUI* curOption = static_cast<COptionUI*>(msg.pSender);
+	std::wstring groupname = curOption->GetGroup();
+
+	if (groupname == L"diandan_foodtype")
+	{
+		//商品分类切换
+		CFoodtypeOptionUI* typeUI = static_cast<CFoodtypeOptionUI*>(curOption);
+		std::string id = typeUI->GetTypeId();
+
+		if (m_cur_type_id != id)
+		{
+			//切换了商品分类
+			m_curFoodtypeOption = static_cast<CFoodtypeOptionUI*>(msg.pSender);
+			m_cur_type_id = id;
+
+			this->InitFoodShow();
+
+			return;
+		}
+	}
+}
+
+//处理下拉框、radio的切换事件
+void CYubaozhuangbiaoqianPageUI::HandleItemSelectMsg(TNotifyUI& msg)
+{
+
+}
+
+//处理编辑框输入内容改变事件
+void CYubaozhuangbiaoqianPageUI::HandleTextChangedMsg(TNotifyUI& msg)
+{
+	CDuiString name = msg.pSender->GetName();
+
+	if (name == L"diandan_food_search_edit")
+	{
+		//商品搜索框的输入事件
+		CEditUI* m_pEdit = static_cast<CEditUI*>(m_pManager->FindControl(_T("diandan_food_search_edit")));
+		std::wstring ws_Value = m_pEdit->GetText();
+		std::string strValue = CLewaimaiString::UnicodeToUTF8(ws_Value);
+
+		if (strValue.length() == 0)
+		{
+			//搜索词被清空了,退出搜索
+			this->StopSerachFood();
+		}
+		else
+		{
+			//搜索词没清空,进入搜索
+			this->StartSearchFood(strValue);
+		}
+	}
+}
+
+//处理扫码枪捕捉到的扫码信息
+void CYubaozhuangbiaoqianPageUI::HandleTextCapture(std::string content)
+{
+	if (content == "")
+	{
+		return;
+	}
+
+	if (m_is_show_modal_wnd == true)
+	{
+		m_curModalWnd->HandleTextCapture(content);
+
+		return;
+	}
+
+	//没有任何弹框,那么就是按扫描商品条码来处理
+	bool ret = this->SaomiaoBarcode(content);
+	if (ret == true)
+	{
+		//已经找到了条码,那么就处理完了
+		return;
+	}
+
+	if (content.length() != 12 && content.length() != 13 && content.length() != 17 && content.length() != 18)
+	{
+		//位数不对,那肯定不是称重条码
+	}
+	else
+	{
+		//如果没有找到条码,就找一下是不是称重的标签秤的码,这个时候要对码进行各种分析了
+		ret = this->BiaoqianchengSaomaBarcode(content);
+		if (ret == true)
+		{
+			return;
+		}
+	}
+}
+
+bool CYubaozhuangbiaoqianPageUI::HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+	if (uMsg == WM_AI_RECOGNITION_SUCCESS)
+	{
+		HandleDiandanAIShibieResult();
+
+		return true;
+	}
+	else if (uMsg == WM_CHENGZHONG_SUCCESS)
+	{
+		HandleChengzhongValueChange();
+
+		return true;
+	}
+
+	return false;
+}
+
+void CYubaozhuangbiaoqianPageUI::ClickFoodAction()
+{
+	bool is_taocan = m_cur_click_food_item->GetIsTaocan();
+
+	if (is_taocan)
+	{
+		//点击套餐之后的处理逻辑
+		CFoodpackage foodpackageinfo = m_cur_click_food_item->GetFoodpackageInfo();
+
+		CDiandanOrderItem clickItem;
+
+		clickItem.foodpackage_id = foodpackageinfo.id;
+		clickItem.foodpackage_name = foodpackageinfo.name;
+		clickItem.price = foodpackageinfo.price;
+		clickItem.is_dabao = false;
+		clickItem.dabao_money = foodpackageinfo.dabao_money;
+		clickItem.num = "1";
+
+		//把当前点击商品的信息,保存到orderitem里面,方便后面修改规格的时候使用
+		clickItem.SetFoodpackageInfo(m_cur_click_food_item->GetFoodpackageInfo());
+		clickItem.SetIsTaocan(true);
+
+		if (m_is_show_modal_wnd == true)
+		{
+			return;
+		}
+
+		//先弹框进行选择属性
+		CDiandanNatureWnd* pNatureFrame = new CDiandanNatureWnd(1);
+		pNatureFrame->SetFoodItemUI(m_cur_click_food_item);
+
+		if (pNatureFrame != NULL)
+		{
+			m_is_show_modal_wnd = true;
+			m_curModalWnd = pNatureFrame;
+
+			pNatureFrame->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+			pNatureFrame->SetIcon(IDI_ICON_DUILIB);
+			pNatureFrame->CenterWindow();
+			UINT ret = pNatureFrame->ShowModal();
+
+			if (ret == IDOK)
+			{
+				//保存选择的属性
+				std::vector<FoodNatureSelectValue> natureSelectedArray = pNatureFrame->GetNatureSelectedArray();
+				clickItem.natureSelectedArray = natureSelectedArray;
+
+				m_is_show_modal_wnd = false;
+				delete pNatureFrame;
+			}
+			else
+			{
+				m_is_show_modal_wnd = false;
+				delete pNatureFrame;
+
+				return;
+			}
+		}
+
+		//商品没有商品属性
+		bool is_add_new = false;
+
+		
+	}
+	else
+	{
+		//点击普通商品之后的处理逻辑
+		CFood foodinfo = m_cur_click_food_item->GetFoodInfo();
+
+		if (foodinfo.stockvalid == "1" && atof(foodinfo.stock.c_str()) < 0.001)
+		{
+			//库存为0了,不做任何处理
+			m_pMainWnd->ShowToast(L"该商品已售完");
+			return;
+		}
+
+		CDiandanOrderItem clickItem;
+
+		clickItem.food_id = foodinfo.id;
+		clickItem.food_name = foodinfo.name;
+		clickItem.type_id = foodinfo.type_id;
+		clickItem.price = foodinfo.price;
+		clickItem.is_dabao = false;
+		clickItem.dabao_money = foodinfo.dabao_money;
+		clickItem.num = "1";
+
+		if (foodinfo.member_price_used == "1")
+		{
+			clickItem.is_member_price_used = true;
+		}
+		else
+		{
+			clickItem.is_member_price_used = false;
+		}
+
+		//处理会员价的json
+		std::string member_price_json = foodinfo.member_price_json;
+
+		rapidjson::Document document;
+		document.Parse(member_price_json.c_str());
+
+		rapidjson::Value& member_price = document;
+		for (rapidjson::SizeType i = 0; i < member_price.Size(); ++i)
+		{
+			rapidjson::Value& member_price_info = member_price[i];
+
+			MemberPrice newPirce;
+			newPirce.id = CLewaimaiJson::ToString(member_price_info["id"]);
+			newPirce.level = CLewaimaiJson::ToString(member_price_info["level"]);
+			newPirce.price = CLewaimaiJson::ToString(member_price_info["price"]);
+
+			clickItem.m_member_price.push_back(newPirce);
+		}
+
+		//把当前点击商品的信息,保存到orderitem里面,方便后面修改规格的时候使用
+		clickItem.SetFoodInfo(m_cur_click_food_item->GetFoodInfo());
+		clickItem.SetIsTaocan(false);
+
+		if (foodinfo.is_weight == "1")
+		{
+			if (m_is_dianzicheng_lianjie == false)
+			{
+				//设置中心未连接电子秤
+				m_pMainWnd->ShowToast(L"未连接电子秤,请检查连接设置");
+				return;
+			}
+
+			clickItem.is_weight = true;
+
+			//这里要判断是直接区域称重,还是先弹框再称重
+			CLabelUI* pLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_label_chengzhong_value")));
+			std::wstring ws_weight_value = pLabel->GetText();
+			std::string s_weight_value = CLewaimaiString::UnicodeToUTF8(ws_weight_value);
+			if (atof(s_weight_value.c_str()) < 0.001)
+			{
+				//如果重量为0了,说明还没有称重,这时候要弹出称重框进行称重
+				if (m_is_show_modal_wnd == true)
+				{
+					return;
+				}
+
+				//这里要弹出称重框,不弹属性框
+				CChengzhongWnd* pChengzhongFrame = new CChengzhongWnd();
+
+				if (pChengzhongFrame != NULL)
+				{
+					m_is_show_modal_wnd = true;
+					m_curModalWnd = pChengzhongFrame;
+
+					pChengzhongFrame->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+					pChengzhongFrame->SetIcon(IDI_ICON_DUILIB);
+					pChengzhongFrame->CenterWindow();
+
+					pChengzhongFrame->SetTitle(CLewaimaiString::UTF8ToUnicode(foodinfo.name));
+
+					UINT ret = pChengzhongFrame->ShowModal();
+
+					if (ret == IDOK)
+					{
+						std::string weight = pChengzhongFrame->m_weight;
+						if (atof(weight.c_str()) < 0.001)
+						{
+							return;
+						}
+
+						clickItem.num = weight;
+
+						m_is_show_modal_wnd = false;
+						delete pChengzhongFrame;
+					}
+					else
+					{
+						m_is_show_modal_wnd = false;
+						delete pChengzhongFrame;
+
+						return;
+					}
+				}
+			}
+			else
+			{
+				//如果重量不为0了,说明已经称重了,这时候直接使用这个重量
+				clickItem.num = s_weight_value;
+			}
+
+		}
+		else
+		{
+			clickItem.is_weight = false;
+
+			if (foodinfo.is_nature == "1")
+			{
+				//商品有商品属性
+				clickItem.is_nature = true;
+
+				if (m_is_show_modal_wnd == true)
+				{
+					return;
+				}
+
+				//先弹框进行选择属性
+				CDiandanNatureWnd* pNatureFrame = new CDiandanNatureWnd(1);
+				pNatureFrame->SetFoodItemUI(m_cur_click_food_item);
+
+				if (pNatureFrame != NULL)
+				{
+					m_is_show_modal_wnd = true;
+					m_curModalWnd = pNatureFrame;
+
+					pNatureFrame->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+					pNatureFrame->SetIcon(IDI_ICON_DUILIB);
+					pNatureFrame->CenterWindow();
+					UINT ret = pNatureFrame->ShowModal();
+
+					if (ret == IDOK)
+					{
+						//保存选择的属性
+						std::vector<FoodNatureSelectValue> natureSelectedArray = pNatureFrame->GetNatureSelectedArray();
+						clickItem.natureSelectedArray = natureSelectedArray;
+
+						m_is_show_modal_wnd = false;
+						delete pNatureFrame;
+					}
+					else
+					{
+						m_is_show_modal_wnd = false;
+						delete pNatureFrame;
+
+						return;
+					}
+				}
+			}
+		}
+
+		//商品没有商品属性
+		bool is_add_new = false;
+
+		
+	}
+}
+
+//扫描了商品条码的逻辑处理
+bool CYubaozhuangbiaoqianPageUI::SaomiaoBarcode(std::string barcode)
+{
+	CSqlite3 sqlite;
+
+	CFood foodinfo;
+	bool ret = sqlite.GetFoodByBarcode(barcode, foodinfo);
+
+	if (ret == false)
+	{
+		//说明没找到对应的商品条码
+		return false;
+	}
+
+	//这里说明找到了,那么处理添加购物车逻辑,扫码的情况下,这里不管有没有属性,都按没属性处理,不管有没有称重都按没称重处理(以后标签秤可能会修改)
+
+	if (foodinfo.stockvalid == "1" && atof(foodinfo.stock.c_str()) < 1)
+	{
+		//库存为0了,不做任何处理
+		m_pMainWnd->ShowToast(L"该商品已售完");
+
+		//只要找到了就返回true
+		return true;
+	}
+
+	CDiandanOrderItem clickItem;
+
+	clickItem.food_id = foodinfo.id;
+	clickItem.food_name = foodinfo.name;
+	clickItem.type_id = foodinfo.type_id;
+	clickItem.price = foodinfo.price;
+	clickItem.is_dabao = false;
+	clickItem.dabao_money = foodinfo.dabao_money;
+	clickItem.num = "1";
+
+	if (foodinfo.member_price_used == "1")
+	{
+		clickItem.is_member_price_used = true;
+	}
+	else
+	{
+		clickItem.is_member_price_used = false;
+	}
+
+	//处理会员价的json
+	std::string member_price_json = foodinfo.member_price_json;
+
+	rapidjson::Document document;
+	document.Parse(member_price_json.c_str());
+
+	rapidjson::Value& member_price = document;
+	for (rapidjson::SizeType i = 0; i < member_price.Size(); ++i)
+	{
+		rapidjson::Value& member_price_info = member_price[i];
+
+		MemberPrice newPirce;
+		newPirce.id = CLewaimaiJson::ToString(member_price_info["id"]);
+		newPirce.level = CLewaimaiJson::ToString(member_price_info["level"]);
+		newPirce.price = CLewaimaiJson::ToString(member_price_info["price"]);
+
+		clickItem.m_member_price.push_back(newPirce);
+	}
+
+	//把当前点击商品的信息,保存到orderitem里面,方便后面修改规格的时候使用
+	clickItem.SetFoodInfo(foodinfo);
+	clickItem.SetIsTaocan(false);
+
+	clickItem.is_weight = false;
+	clickItem.is_nature = false;
+
+	//商品没有商品属性
+	bool is_add_new = false;
+
+	
+
+	return true;
+}
+
+bool CYubaozhuangbiaoqianPageUI::BiaoqianchengSaomaBarcode(std::string barcode)
+{
+	//先根据设置,分辨条码格式
+	std::string bianma;
+	std::string money;
+	std::string weight;
+	std::string jiaoyan;
+
+	std::string setting_tiaomacheng_geshi = CSetting::GetInstance()->GetParam("setting_tiaomacheng_geshi");
+	if (setting_tiaomacheng_geshi == "1")
+	{
+		if (barcode.length() != 12 && barcode.length() != 13)
+		{
+			//与该模式长度不匹配
+			return false;
+		}
+
+		if (barcode.length() == 12)
+		{
+			barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
+		}
+
+		//13位【FWWWWWWEEEEEC】
+		bianma = barcode.substr(1, 6);
+		money = barcode.substr(7, 5);
+		jiaoyan = barcode.substr(12, 1);
+	}
+	else if (setting_tiaomacheng_geshi == "2")
+	{
+		if (barcode.length() != 12 && barcode.length() != 13)
+		{
+			//与该模式长度不匹配
+			return false;
+		}
+
+		if (barcode.length() == 12)
+		{
+			barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
+		}
+
+		//13位【FWWWWWWNNNNNC】
+		bianma = barcode.substr(1, 6);
+		weight = barcode.substr(7, 5);
+		jiaoyan = barcode.substr(12, 1);
+	}
+	else if (setting_tiaomacheng_geshi == "3")
+	{
+		if (barcode.length() != 12 && barcode.length() != 13)
+		{
+			//与该模式长度不匹配
+			return false;
+		}
+
+		if (barcode.length() == 12)
+		{
+			barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
+		}
+
+		//13位【FFWWWWWEEEEEC】
+		bianma = barcode.substr(2, 5);
+		money = barcode.substr(7, 5);
+		jiaoyan = barcode.substr(12, 1);
+	}
+	else if (setting_tiaomacheng_geshi == "4")
+	{
+		if (barcode.length() != 12 && barcode.length() != 13)
+		{
+			//与该模式长度不匹配
+			return false;
+		}
+
+		if (barcode.length() == 12)
+		{
+			barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
+		}
+
+		//13位【FFWWWWWNNNNNC】
+		bianma = barcode.substr(2, 5);
+		weight = barcode.substr(7, 5);
+		jiaoyan = barcode.substr(12, 1);
+	}
+	else if (setting_tiaomacheng_geshi == "5")
+	{
+		if (barcode.length() != 17 && barcode.length() != 18)
+		{
+			//与该模式长度不匹配
+			return false;
+		}
+
+		if (barcode.length() == 17)
+		{
+			barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
+		}
+
+		//18位【FWWWWWWEEEEENNNNNC】
+		bianma = barcode.substr(1, 6);
+		money = barcode.substr(7, 5);
+		weight = barcode.substr(12, 5);
+		jiaoyan = barcode.substr(17, 1);
+	}
+	else if (setting_tiaomacheng_geshi == "6")
+	{
+		if (barcode.length() != 17 && barcode.length() != 18)
+		{
+			//与该模式长度不匹配
+			return false;
+		}
+
+		if (barcode.length() == 17)
+		{
+			barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
+		}
+
+		//18位【FWWWWWWNNNNNEEEEEC】
+		bianma = barcode.substr(1, 6);
+		weight = barcode.substr(7, 5);
+		money = barcode.substr(12, 5);
+		jiaoyan = barcode.substr(17, 1);
+	}
+	else if (setting_tiaomacheng_geshi == "7")
+	{
+		if (barcode.length() != 17 && barcode.length() != 18)
+		{
+			//与该模式长度不匹配
+			return false;
+		}
+
+		if (barcode.length() == 17)
+		{
+			barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
+		}
+
+		//18位【FFWWWWWEEEEENNNNNC】
+		bianma = barcode.substr(2, 5);
+		money = barcode.substr(7, 5);
+		weight = barcode.substr(12, 5);
+		jiaoyan = barcode.substr(17, 1);
+	}
+	else if (setting_tiaomacheng_geshi == "8")
+	{
+		if (barcode.length() != 17 && barcode.length() != 18)
+		{
+			//与该模式长度不匹配
+			return false;
+		}
+
+		if (barcode.length() == 17)
+		{
+			barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
+		}
+
+		//18位【FFWWWWWNNNNNEEEEEC】
+		bianma = barcode.substr(2, 5);
+		weight = barcode.substr(7, 5);
+		money = barcode.substr(12, 5);
+		jiaoyan = barcode.substr(17, 1);
+	}
+
+	//先检查编码是否存在,如果编码不存在直接返回false
+	int i_bianma = atoi(bianma.c_str());
+	if (i_bianma < 1)
+	{
+		return false;
+	}
+
+	CFood foodinfo;
+
+	CSqlite3 sqlite;
+	bool ret = sqlite.GetFoodByPluBianma(std::to_string(i_bianma), foodinfo);
+	if (ret == false)
+	{
+		//没找到这个商品
+		return false;
+	}
+
+	//走到这里是找到商品了,那么就开始计算价格和重量
+	double d_money = 0;
+	double d_weight = 0;
+
+	//如果有价格,优先用价格
+	if (money.length() > 0)
+	{
+		//这个出来的单位是分,要把单位转成元
+		d_money = atof(money.c_str());
+
+		d_money = d_money / 100;
+
+		//根据价格计算重量
+		d_weight = d_money / atof(foodinfo.price.c_str());
+	}
+	else if (weight.length() > 0)
+	{
+		//这个单位是克,要转化成千克
+		d_weight = atof(weight.c_str());
+
+		d_weight = d_weight / 1000;
+
+		//有重量了,其实不需要计算价格,价格加到购物车的时候会自己计算
+	}
+	else
+	{
+		//价格和重量都没有,这是异常情况
+		return false;
+	}
+
+	if (foodinfo.stockvalid == "1" && atof(foodinfo.stock.c_str()) < d_weight)
+	{
+		//库存为0了,不做任何处理
+		m_pMainWnd->ShowToast(L"该商品已售完");
+
+		//只要找到了就返回true
+		return true;
+	}
+
+	CDiandanOrderItem clickItem;
+
+	clickItem.food_id = foodinfo.id;
+	clickItem.food_name = foodinfo.name;
+	clickItem.type_id = foodinfo.type_id;
+	clickItem.price = foodinfo.price;
+	clickItem.is_dabao = false;
+	clickItem.dabao_money = foodinfo.dabao_money;
+	clickItem.num = CLewaimaiString::DoubleToString(d_weight, 3); //重量保留3位小数
+
+	if (foodinfo.member_price_used == "1")
+	{
+		clickItem.is_member_price_used = true;
+	}
+	else
+	{
+		clickItem.is_member_price_used = false;
+	}
+
+	//处理会员价的json
+	std::string member_price_json = foodinfo.member_price_json;
+
+	rapidjson::Document document;
+	document.Parse(member_price_json.c_str());
+
+	rapidjson::Value& member_price = document;
+	for (rapidjson::SizeType i = 0; i < member_price.Size(); ++i)
+	{
+		rapidjson::Value& member_price_info = member_price[i];
+
+		MemberPrice newPirce;
+		newPirce.id = member_price_info["id"].GetString();
+		newPirce.level = member_price_info["level"].GetString();
+		newPirce.price = member_price_info["price"].GetString();
+
+		clickItem.m_member_price.push_back(newPirce);
+	}
+
+	//把当前点击商品的信息,保存到orderitem里面,方便后面修改规格的时候使用
+	clickItem.SetFoodInfo(foodinfo);
+	clickItem.SetIsTaocan(false);
+
+	clickItem.is_weight = true;
+	clickItem.is_nature = false;
+
+	//商品没有商品属性
+	bool is_add_new = false;
+
+	
+
+	return true;
+}
+
+//开始搜索某个商品名字
+void CYubaozhuangbiaoqianPageUI::StartSearchFood(std::string foodname)
+{
+	//展示删除按钮
+	CButtonUI* pClear = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_food_search_clear")));
+	pClear->SetVisible(true);
+
+	//隐藏商品分类展示
+	CVerticalLayoutUI* pFoodtype = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("diandan_fenlei_layout_scrolllayout")));
+	pFoodtype->SetVisible(false);
+
+	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();
+}
+
+//停止搜索商品
+void CYubaozhuangbiaoqianPageUI::StopSerachFood()
+{
+	//隐藏删除按钮
+	CButtonUI* pClear = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_food_search_clear")));
+	pClear->SetVisible(false);
+
+	//展示商品分类展示
+	CVerticalLayoutUI* pFoodtype = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("diandan_fenlei_layout_scrolllayout")));
+	pFoodtype->SetVisible(true);
+
+	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();
+}
+
+void CYubaozhuangbiaoqianPageUI::SetPos(RECT rc, bool bNeedInvalidate)
+{
+	m_nPageWidth = rc.right - rc.left;
+
+	if (m_nPageWidth + 91 < 1260)
+	{
+		//小屏幕上,默认隐藏优惠区域
+		
+	}
+	else
+	{
+		//this->XianshiYouhui();
+	}
+
+	//更新分类位置
+	UpdateFoodtypePos();
+
+	CContainerUI::SetPos(rc, bNeedInvalidate);
+}
+
+void CYubaozhuangbiaoqianPageUI::HandleDiandanAIShibieResult()
+{
+	if (m_cur_type_id == "ai")
+	{
+		this->InitFoodShow();
+	}
+}
+
+void CYubaozhuangbiaoqianPageUI::HandleChengzhongValueChange()
+{
+	std::string weight = CChengzhongWorker::GetInstance()->GetWeight();
+
+	CControlUI* pWendingStatus = static_cast<CControlUI*>(this->FindSubControl(_T("diandan_page_status_chengzhong_wending")));
+	if (CChengzhongWorker::GetInstance()->GetIsWending() == true)
+	{
+		pWendingStatus->SetBkImage(L"deng_on.png");
+	}
+	else
+	{
+		pWendingStatus->SetBkImage(L"deng_off.png");
+	}
+
+	CLabelUI* pLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_label_chengzhong_value")));
+	pLabel->SetText(CLewaimaiString::UTF8ToUnicode(weight).c_str());
+}
+
+void CYubaozhuangbiaoqianPageUI::ZhiLing()
+{
+	std::string setting_dianzicheng_xinghao = CSetting::GetInstance()->GetParam("setting_dianzicheng_xinghao");
+	if (setting_dianzicheng_xinghao == "dahua_acs")
+	{
+		m_pMainWnd->ShowToast(L"大华ACS电子秤不支持置零操作,请在秤上操作");
+		return;
+	}
+
+	CChengzhongWorker::GetInstance()->Zhiling();
+}
+
+void CYubaozhuangbiaoqianPageUI::Qupi()
+{
+	std::string setting_dianzicheng_xinghao = CSetting::GetInstance()->GetParam("setting_dianzicheng_xinghao");
+	if (setting_dianzicheng_xinghao == "dahua_acs")
+	{
+		m_pMainWnd->ShowToast(L"大华ACS电子秤不支持去皮操作,请在秤上操作");
+		return;
+	}
+
+	CChengzhongWorker::GetInstance()->Qupi();
+}

+ 117 - 0
zhipuzi_pos_windows/page/CYubaozhuangbiaoqianPageUI.h

@@ -0,0 +1,117 @@
+#pragma once
+
+#include "../pch/pch.h"
+#include "../ui/CBasePageUI.h"
+
+#include "../zhipuzi/CFood.h"
+#include "../zhipuzi/CFoodtype.h"
+#include "../zhipuzi/CFoodpackage.h"
+
+#include "../control/CDiandanFoodItemUI.h"
+#include "../control/CFoodtypeOptionUI.h"
+#include "../zhipuzi/CDiandanOrder.h"
+
+class CYubaozhuangbiaoqianPageUI : public CBasePageUI
+{
+public:
+	CYubaozhuangbiaoqianPageUI();
+	~CYubaozhuangbiaoqianPageUI();
+
+	//初始化页面控件,页面创建构造的时候调用一次,注意和InitShow的区别,这个不触发控件的任何事件
+	void InitControl();
+
+	//初始化当前页面的展示,处理默认展示效果,在页面每次被选中加载(注意不是页面创建构造)的时候调用,如果多次选中会多次调用,这里要避免数据重复处理
+	void InitShow();
+
+	//收款一个订单成功,准备开始收款第2个订单的时候调用(会多次调度用)
+	void RefreshShow();
+
+	//初始化商品分类的显示
+	void InitFoodtypeShow();
+
+	void UpdateFoodtypePos();
+
+	//根据当前选择的分类,刷新商品展示
+	void InitFoodShow();
+
+	//处理按钮点击类事件
+	void HandleClickMsg(TNotifyUI& msg);
+
+	//处理option切换事件
+	void HandleSelectChangeMsg(TNotifyUI& msg);
+
+	//处理下拉框、radio的切换事件
+	void HandleItemSelectMsg(TNotifyUI& msg);
+
+	//处理编辑框输入内容改变事件
+	void HandleTextChangedMsg(TNotifyUI& msg);
+
+	//处理扫码枪捕捉到的扫码信息
+	void HandleTextCapture(std::string content);
+
+	//处理自定义消息,各个页面处理各个页面自己的(是自己处理的消息返回true,不是自己处理的消息返回false)
+	bool HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
+
+	//点击某一个商品的item之后的处理逻辑
+	void ClickFoodAction();
+
+	//扫描了商品条码的逻辑处理,如果找到了这个条码的商品就返回true,如果没找到就返回false
+	bool SaomiaoBarcode(std::string barcode);
+
+	//判断是不是标签秤的条码,并进行处理,返回true表示是标签秤的条码,返回false表示不是
+	bool BiaoqianchengSaomaBarcode(std::string barcode);
+
+	//开始搜索某个商品名字
+	void StartSearchFood(std::string foodname);
+
+	//停止搜索商品
+	void StopSerachFood();
+
+	void SetPos(RECT rc, bool bNeedInvalidate = true);
+
+private:
+
+	//处理AI识别结果
+	void HandleDiandanAIShibieResult();
+
+	//处理称重数值变化
+	void HandleChengzhongValueChange();
+
+	//点击置零按钮
+	void ZhiLing();
+
+	//点击去皮按钮
+	void Qupi();
+
+private:
+	CTileLayoutUI* m_foodLayout;
+	CContainerUI* m_foodtypeLayout;
+
+	bool m_is_ai_shibie = false;
+
+	//套餐商品数量
+	int m_nFoodpackageNum;
+
+	//所有商品分类(只包含收银机显示的分类)
+	std::vector<CFoodType> m_types;
+
+	//当前选中的商品分类ID,为空表示没选中任何分类,为taocan表示选中套餐分类,如果选中普通商品分类就是分类ID
+	std::string m_cur_type_id = "";
+	CFoodtypeOptionUI* m_curFoodtypeOption;
+
+	//商品搜索相关
+	std::string m_type_id_before_sousuo;
+	std::string m_sousuo_foodname;
+
+	//当前点击的哪个商品
+	CDiandanFoodItemUI* m_cur_click_food_item;
+
+	//模态对话框有关的
+	bool m_is_show_modal_wnd = false;
+
+	//当前控件的实际宽度
+	int m_nPageWidth;
+
+	//与称重显示相关的
+	bool m_is_dianzicheng_lianjie = false;
+};

+ 32 - 3
zhipuzi_pos_windows/wnd/CMainWnd.cpp

@@ -351,7 +351,7 @@ void CMainWnd::HandleSelectChangeMsg(TNotifyUI& msg)
 	std::wstring ws_name = name;
 	std::wstring ws_name = name;
 
 
 	if (ws_name == _T("main_diandan") || ws_name == _T("main_dingdan") || ws_name == _T("main_huiyuan") || ws_name == _T("main_baobiao") || ws_name == _T("main_jiaoban") || ws_name == _T("main_setting") || ws_name == _T("main_gengduo") \
 	if (ws_name == _T("main_diandan") || ws_name == _T("main_dingdan") || ws_name == _T("main_huiyuan") || ws_name == _T("main_baobiao") || ws_name == _T("main_jiaoban") || ws_name == _T("main_setting") || ws_name == _T("main_gengduo") \
-		|| ws_name == _T("main_shangpin") || ws_name == _T("main_kucun") || ws_name == _T("main_caigou") || ws_name == _T("main_zhengcan") || ws_name == _T("main_saomashouyin") || ws_name == _T("main_shoukuan"))
+		|| ws_name == _T("main_shangpin") || ws_name == _T("main_kucun") || ws_name == _T("main_caigou") || ws_name == _T("main_zhengcan") || ws_name == _T("main_saomashouyin") || ws_name == _T("main_shoukuan") || ws_name == _T("main_yubaozhuangbiaoqian"))
 	{
 	{
 		SwitchPageByName(ws_name);
 		SwitchPageByName(ws_name);
 	}
 	}
@@ -1252,6 +1252,21 @@ void CMainWnd::UpdateGongnengDaohang()
 			newOption->SetNormalImage(L"file='main_shoukuan.png' source='0,0,50,50' dest='18,13,75,63'");
 			newOption->SetNormalImage(L"file='main_shoukuan.png' source='0,0,50,50' dest='18,13,75,63'");
 			newOption->SetSelectedImage(L"file='main_shoukuan_select.png' source='0,0,50,50' dest='18,13,75,63'");
 			newOption->SetSelectedImage(L"file='main_shoukuan_select.png' source='0,0,50,50' dest='18,13,75,63'");
 		}
 		}
+		else if (curName == "yubaozhuangbiaoqian")
+		{
+			newOption->SetName(L"main_yubaozhuangbiaoqian");
+			newOption->SetText(L"预包装标签");
+
+			RECT padding;
+			padding.left = 10;
+			padding.top = 55;
+			padding.right = 0;
+			padding.bottom = 0;
+			newOption->SetTextPadding(padding);
+
+			newOption->SetNormalImage(L"file='main_yubaozhuangbiaoqian.png' source='0,0,50,50' dest='18,13,75,63'");
+			newOption->SetSelectedImage(L"file='main_yubaozhuangbiaoqian_select.png' source='0,0,50,50' dest='18,13,75,63'");
+		}
 
 
 		layout->Add(newOption);
 		layout->Add(newOption);
 	}
 	}
@@ -1368,6 +1383,10 @@ void CMainWnd::SwitchPageByName(std::wstring name)
 	{
 	{
 		this->SwitchPage(CAIGOU);
 		this->SwitchPage(CAIGOU);
 	}
 	}
+	else if (name == L"main_yubaozhuangbiaoqian")
+	{
+		this->SwitchPage(YUBAOZHUANGBIAOQIAN);
+	}
 	else
 	else
 	{
 	{
 		//没开通的页面暂时不跳转
 		//没开通的页面暂时不跳转
@@ -1621,6 +1640,13 @@ void CMainWnd::CreatePages()
 		m_pages[AIXUEXI] = pChildContainer;
 		m_pages[AIXUEXI] = pChildContainer;
 	}
 	}
 
 
+	{
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+		pChildContainer = static_cast<CBasePageUI*>(builder.Create(_T("yubaozhuangbiaoqian_page.xml"), (UINT)0, &cb, &m_pm));
+		m_pages[YUBAOZHUANGBIAOQIAN] = pChildContainer;
+	}
+
 	//对所有页面进行初始化构造控件
 	//对所有页面进行初始化构造控件
 	for (std::map<int, CBasePageUI*>::iterator it = m_pages.begin(); it != m_pages.end(); it++)
 	for (std::map<int, CBasePageUI*>::iterator it = m_pages.begin(); it != m_pages.end(); it++)
 	{
 	{
@@ -1757,8 +1783,6 @@ void CMainWnd::UpdateGongnengString()
 		TmpgengduoVector.push_back("zhengcan");
 		TmpgengduoVector.push_back("zhengcan");
 	}
 	}
 
 
-	//如果以后有其他餐饮版专属的,要在这里继续添加
-
 	if (TmpMap.find("saomashouyin") == TmpMap.end())
 	if (TmpMap.find("saomashouyin") == TmpMap.end())
 	{
 	{
 		//零售版这时候没有saomashouyin,说明切换过餐饮版被删除了,这里要加上
 		//零售版这时候没有saomashouyin,说明切换过餐饮版被删除了,这里要加上
@@ -1773,6 +1797,11 @@ void CMainWnd::UpdateGongnengString()
 		TmpgengduoVector.push_back("shoukuan");
 		TmpgengduoVector.push_back("shoukuan");
 	}
 	}
 
 
+	if (TmpMap.find("yubaozhuangbiaoqian") == TmpMap.end())
+	{
+		TmpgengduoVector.push_back("yubaozhuangbiaoqian");
+	}
+
 	//这个时候已经过滤掉了不需要的,加上了被删除的,可以保存数据库了
 	//这个时候已经过滤掉了不需要的,加上了被删除的,可以保存数据库了
 	gengduoVector = TmpgengduoVector;
 	gengduoVector = TmpgengduoVector;
 
 

+ 1 - 0
zhipuzi_pos_windows/wnd/CMainWnd.h

@@ -41,6 +41,7 @@ public:
 		SHOUKUANDINGDAN, //收款订单列表
 		SHOUKUANDINGDAN, //收款订单列表
 		SHOUKUANINFO, //收款订单详情
 		SHOUKUANINFO, //收款订单详情
 		AIXUEXI, //AI学习
 		AIXUEXI, //AI学习
+		YUBAOZHUANGBIAOQIAN, //预包装标签
 	};
 	};
 
 
     LPCTSTR GetWindowClassName() const
     LPCTSTR GetWindowClassName() const

+ 2 - 0
zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj

@@ -245,6 +245,7 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClInclude Include="ai\YoloClassName.h" />
     <ClInclude Include="ai\YoloClassName.h" />
     <ClInclude Include="ai\YoloFeatureManager.h" />
     <ClInclude Include="ai\YoloFeatureManager.h" />
     <ClInclude Include="control\CFoodXuexiImageItemUI.h" />
     <ClInclude Include="control\CFoodXuexiImageItemUI.h" />
+    <ClInclude Include="page\CYubaozhuangbiaoqianPageUI.h" />
     <ClInclude Include="page\CAIxuexiPageUI.h" />
     <ClInclude Include="page\CAIxuexiPageUI.h" />
     <ClInclude Include="ui\CTouchWindowBase.h" />
     <ClInclude Include="ui\CTouchWindowBase.h" />
     <ClInclude Include="worker\CDiandanAIShibieWorker.h" />
     <ClInclude Include="worker\CDiandanAIShibieWorker.h" />
@@ -374,6 +375,7 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClCompile Include="ai\SQLiteVecManager.cpp" />
     <ClCompile Include="ai\SQLiteVecManager.cpp" />
     <ClCompile Include="ai\YoloFeatureManager.cpp" />
     <ClCompile Include="ai\YoloFeatureManager.cpp" />
     <ClCompile Include="control\CFoodXuexiImageItemUI.cpp" />
     <ClCompile Include="control\CFoodXuexiImageItemUI.cpp" />
+    <ClCompile Include="page\CYubaozhuangbiaoqianPageUI.cpp" />
     <ClCompile Include="sqlite3\shell.c" />
     <ClCompile Include="sqlite3\shell.c" />
     <ClCompile Include="page\CAIxuexiPageUI.cpp" />
     <ClCompile Include="page\CAIxuexiPageUI.cpp" />
     <ClCompile Include="ui\CTouchWindowBase.cpp" />
     <ClCompile Include="ui\CTouchWindowBase.cpp" />

+ 6 - 0
zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj.filters

@@ -399,6 +399,9 @@
     <ClInclude Include="control\CFoodXuexiImageItemUI.h">
     <ClInclude Include="control\CFoodXuexiImageItemUI.h">
       <Filter>头文件</Filter>
       <Filter>头文件</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="page\CYubaozhuangbiaoqianPageUI.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="pch\pch.cpp">
     <ClCompile Include="pch\pch.cpp">
@@ -755,6 +758,9 @@
     <ClCompile Include="sqlite3\shell.c">
     <ClCompile Include="sqlite3\shell.c">
       <Filter>源文件</Filter>
       <Filter>源文件</Filter>
     </ClCompile>
     </ClCompile>
+    <ClCompile Include="page\CYubaozhuangbiaoqianPageUI.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <Image Include="resource\zhipuzi.ico">
     <Image Include="resource\zhipuzi.ico">