ソースを参照

厨房打印机设置

zhangyang 6 年 前
コミット
068b520974

BIN
bin/Win32/Debug/zhipuzi_pos_windows/db/pos.db


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


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


+ 46 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/chufang_printer_setting.xml

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Window size="520,460" caption="0,0,0,36" roundcorner="4,4" >
+	<VerticalLayout inset="15,0,15,15" bkimage="file='Dialog_BG1.png' corner='4,50,4,4'" >
+		<HorizontalLayout height="32" inset="2,2,2,0">
+			<Label text="新建厨房打印机" width="100" />
+			<Control />
+			<Button name="chufang_setting_closebtn" padding="0,4,0,0" width="22" height="22" tooltip="关闭" normalimage="file='Login_TopBar_Close_Btn.png'" hotimage="file='Login_TopBar_Close_Btn_Hover.png'" pushedimage="file='Login_TopBar_Close_Btn_Click.png'"/>
+		</HorizontalLayout>
+
+		<Control height="20" />
+
+		<HorizontalLayout height="56">
+			<Label text="厨房打印机名字" width="160"/>
+			<Edit name="chufang_setting_name" width="150" height="32" padding="0,12,0,12" normalimage="file='Chat_InputBox_BG.png' corner='4,4,4,4'" hotimage="file='Chat_InputBox_BG_Hover.png' corner='4,4,4,4'" />
+		</HorizontalLayout>
+
+		<HorizontalLayout height="56" valign="center">
+			<Label text="IP地址" width="160" />
+			<Edit name="chufang_setting_ip" width="150" height="32" padding="0,12,0,12" normalimage="file='Chat_InputBox_BG.png' corner='4,4,4,4'" hotimage="file='Chat_InputBox_BG_Hover.png' corner='4,4,4,4'" />
+		</HorizontalLayout>
+
+		<HorizontalLayout height="56" valign="center">
+			<Label text="打印机规格" width="160" />
+			<Combo name="chufang_setting_guige" padding="0,12,0,12" width="140" height="32" tooltip="请点击这里选择您的打印机纸张宽度规格" normalimage="file='Setting_Combox_Normal.png' corner='2,2,24,2'" hotimage="file='Setting_Combox_Hover.png' corner='2,2,24,2'" pushedimage="Setting_Combox_Click.png' corner='2,2,24,2'" textpadding="10,1,1,1" >
+				<ListLabelElement text="58mm" selected="true" />
+				<ListLabelElement text="80mm" />
+			</Combo>
+		</HorizontalLayout>
+
+		<HorizontalLayout height="56" valign="center">
+			<Label text="分单打印" width="160" />
+			<CheckBox name="chufang_setting_fendan" padding="0,5,0,5" width="72" height="45" normalimage="file='switchbutton.png' source='0,0,143,91'" selectedimage="file='switchbutton.png' source='0,182,143,273'"/>
+		</HorizontalLayout>
+
+		<HorizontalLayout height="56" valign="center">
+			<Label text="分类打印" width="160" />
+			<CheckBox name="chufang_setting_fenlei" padding="0,5,0,5" width="72" height="45" normalimage="file='switchbutton.png' source='0,0,143,91'" selectedimage="file='switchbutton.png' source='0,182,143,273'"/>
+		</HorizontalLayout>
+
+		<HorizontalLayout height="56" valign="center" padding="0,30,0,0">
+			<Control />
+			<Button name="chufang_setting_save" align="center" width="280" height="44" 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 />
+		</HorizontalLayout>
+	</VerticalLayout>
+</Window>

+ 19 - 13
bin/Win32/Debug/zhipuzi_pos_windows/skin/setting.xml

@@ -9,11 +9,11 @@
 					<Option name="setting_chufang_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_system_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_system_update" 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" />
-					
+
 					<Button name="waimai_order_info_page_disagree" padding="0,50,0,0" width="300" height="38" text="退出登陆" textcolor="#FFFFFFFF" normalimage="file='Btn_Red.png' corner='5,5,5,5'" hotimage="file='Btn_Red_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_Green_Click.png' corner='5,5,5,5'" />
 				</VerticalLayout>
 			</HorizontalLayout>
-			
+
 			<TabLayout name="setting_switch">
 				<VerticalLayout bkcolor="#FFFFFFFF" padding="0,20,20,20" inset="15,15,15,15">
 					<HorizontalLayout height="44">
@@ -24,12 +24,12 @@
 						<Label text="新订单自动接单" width="260"/>
 						<CheckBox name="setting_is_new_waimai_autoconfirm" width="72" height="45" normalimage="file='switchbutton.png' source='0,0,143,91'" selectedimage="file='switchbutton.png' source='0,182,143,273'"/>
 					</HorizontalLayout>
-					<HorizontalLayout height="44">
+					<HorizontalLayout height="44" visible="false">
 						<Label text="新订单右下角弹框提醒" width="260"/>
 						<CheckBox name="setting_is_new_waimai_dialog" width="72" height="45" normalimage="file='switchbutton.png' source='0,0,143,91'" selectedimage="file='switchbutton.png' source='0,182,143,273'"/>
 					</HorizontalLayout>
 				</VerticalLayout>
-				
+
 				<VerticalLayout bkcolor="#FFFFFFFF" padding="0,20,20,20" inset="15,15,15,15">
 					<HorizontalLayout height="44">
 						<Label text="新订单自动打印" width="260" />
@@ -52,21 +52,27 @@
 						</Combo>
 					</HorizontalLayout>
 				</VerticalLayout>
-				
+
 				<VerticalLayout bkcolor="#FFFFFFFF" padding="0,20,20,20" inset="15,15,15,15">
 					<HorizontalLayout height="44">
 						<Label text="新订单自动厨房打印" width="260" />
 						<CheckBox name="setting_is_new_waimai_chufang_printer" width="72" height="45" normalimage="file='switchbutton.png' source='0,0,143,91'" selectedimage="file='switchbutton.png' source='0,182,143,273'"/>
 					</HorizontalLayout>
-					<HorizontalLayout height="44">
-						<Label text="厨房打印机规格" width="260"/>
-						<Combo name="setting_chufang_printer_guige" padding="0,9,0,0" width="140" height="26" tooltip="请点击这里选择您的厨房打印机纸张宽度规格" normalimage="file='Setting_Combox_Normal.png' corner='2,2,24,2'" hotimage="file='Setting_Combox_Hover.png' corner='2,2,24,2'" pushedimage="Setting_Combox_Click.png' corner='2,2,24,2'" textpadding="10,1,1,1" >
-							<ListLabelElement text="58mm" selected="true" />
-							<ListLabelElement text="80mm" />
-						</Combo>
+					<HorizontalLayout height="44" padding="0,30,0,0">
+						<Button name="setting_new_chufang_printer_btn" align="center" width="200" height="38" padding="0,3,0,3" 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'" />
 					</HorizontalLayout>
+					<List name="setting_chufang_printer_list">
+						<ListHeader />
+						<ListHeaderItem text="打印机名称" width="200" align="left" />
+						<ListHeaderItem text="IP地址" width="200" align="left" />
+						<ListHeaderItem text="打印机规格" width="100" align="center" />
+						<ListHeaderItem text="是否分单" width="100" align="center" />
+						<ListHeaderItem text="是否按商品分类打印" width="200" align="center" />
+						<ListHeaderItem text="关联商品分类" width="200" align="center" />
+						<ListHeaderItem text="操作" align="center" />
+					</List> 
 				</VerticalLayout>
-				
+
 				<VerticalLayout bkcolor="#FFFFFFFF" padding="0,20,20,20" inset="15,15,15,15">
 					<HorizontalLayout height="44">
 						<Label text="开机自动启动" width="260" />
@@ -81,7 +87,7 @@
 						<CheckBox name="setting_is_close_min" width="72" height="45" normalimage="file='switchbutton.png' source='0,0,143,91'" selectedimage="file='switchbutton.png' source='0,182,143,273'"/>
 					</HorizontalLayout>
 				</VerticalLayout>
-				
+
 				<VerticalLayout bkcolor="#FFFFFFFF" padding="0,20,20,20" inset="15,15,15,15">
 					<Control height="300" />
 					<Label text="智铺子收银软件" align="center">

+ 15 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/setting_chufang_printer_item.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<Window> 
+	<ListContainerElement name="setting_chufang_printer_item" height="30" minheight="30"> 
+		<HorizontalLayout height="38"> 
+			<Label name="setting_chufang_printer_item_name" width="200" /> 
+			<Label name="setting_chufang_printer_item_ip" width="200" align="center"/> 
+			<Label name="setting_chufang_printer_guige" width="100" align="center"/>
+			<Label name="setting_chufang_printer_fendan" width="100" align="center"/> 
+			<Label name="setting_chufang_printer_item_fenlei" width="200" align="center"/> 
+			<Label name="setting_chufang_printer_item_fenlei_ids" width="200" align="center"/> 
+			<Label name="setting_chufang_printer_caozuo" align="center"/> 
+		</HorizontalLayout> 
+	</ListContainerElement> 
+</Window>

+ 7 - 7
bin/Win32/Debug/zhipuzi_pos_windows/skin/waimai_order_info_page_listitem.xml

@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="utf-8"?>
 
 <Window> 
-  <ListContainerElement name="waimai_order_info_page_listitem" height="30" minheight="30"> 
-    <HorizontalLayout height="38"> 
-      <Label name="waimai_order_info_page_listitem_foodname" /> 
-      <Label name="waimai_order_info_page_listitem_quantity" width="200" align="center"/> 
-      <Label name="waimai_order_info_page_listitem_price" width="200" align="center"/> 
-    </HorizontalLayout> 
-  </ListContainerElement> 
+	<ListContainerElement name="waimai_order_info_page_listitem" height="30" minheight="30"> 
+		<HorizontalLayout height="38"> 
+			<Label name="waimai_order_info_page_listitem_foodname" /> 
+			<Label name="waimai_order_info_page_listitem_quantity" width="200" align="center"/> 
+			<Label name="waimai_order_info_page_listitem_price" width="200" align="center"/> 
+		</HorizontalLayout> 
+	</ListContainerElement> 
 </Window>

BIN
bin/Win32/Debug/zhipuzi_pos_windows/zhipuzi_pos_windows.exe


+ 0 - 40
lewaimai_dispatch/conf/config.ini

@@ -1,40 +0,0 @@
-#这个是调度中心的配置文件,“#"用来注释当前行
-
-#模式,debug或者release
-mode = release
-
-#release环境路径规划服务器参数
-release_pathplanning_host = 172.16.1.71:50051
-
-#debug环境路径规划服务器参数
-debug_pathplanning_host = 172.16.1.71:50051
-
-#release环境的数据库参数
-release_host = rdsqnuyurqnuyur505.mysql.rds.aliyuncs.com
-release_port = 3306
-release_username = liantongxue
-release_password = LewaimaiLongtailiDB200
-release_dbname = dispatch
-
-#release环境的队列参数
-release_dispatch_task_queue = prod-dispather-task
-release_dispatch_result_queue = prod-lwmWorker-dispatchResult
-
-#debug环境的数据库参数
-debug_host = rm-bp113vj32hrp7wpws.mysql.rds.aliyuncs.com
-debug_port = 3306
-debug_username = weixin
-debug_password = hhyz122131
-debug_dbname = dispatch
-
-#debug环境的队列参数
-debug_dispatch_task_queue = dev-dispather-task
-debug_dispatch_result_queue = dev-lwmWorker-dispatchResult
-
-#连接阿里云的mns需要用到的参数
-mns.accountendpoint = https://1111769578085953.mns.cn-hangzhou.aliyuncs.com/
-mns.accesskeyid = 2HUnzc9XJV92PjvW
-mns.accesskeysecret = 20mMc8wuzlfC0r323b6oJqxlBPEyjW
-
-#配送员最大可接单数量,最大不能超过10
-deliveryman_max_order_num = 8

+ 0 - 214
lewaimai_dispatch/helper/CConfigReader.cpp

@@ -1,214 +0,0 @@
-#include "../pch/pch.h"
-#include "CConfigReader.h"
-
-std::map<string, string> CConfigReader::m_mapConfigInfo;
-
-CConfigReader::CConfigReader()
-{
-}
-
-
-CConfigReader::~CConfigReader()
-{
-}
-
-/*
- *读取配置文件内容,以#注释的忽略掉
- **/
-void CConfigReader::ReadConfigFile()
-{
-	ifstream configFile;
-
-	string path = "conf/config.ini";
-
-	configFile.open(path.c_str());
-	string str_line;
-	if (configFile.is_open())
-	{
-		while (!configFile.eof())
-		{
-			getline(configFile, str_line);
-
-			//过滤掉注释信息,即如果首个字符为#就过滤掉这一行
-			if (str_line.find('#') == 0)
-			{
-				continue;
-			}
-
-			size_t pos = str_line.find('=');
-			string str_key = str_line.substr(0, pos);
-			string str_value = str_line.substr(pos + 1);
-
-			//去掉首尾的空格
-			CLewaimaiString::trim(str_key);
-			CLewaimaiString::trim(str_value);
-
-			CConfigReader::m_mapConfigInfo[str_key] = str_value;
-		}
-	}
-	else
-	{
-		cout << "找不到配置文件,启动失败!";
-		LOG_INFO("找不到配置文件,启动失败!");
-		
-		exit(-1);
-	}
-}
-
-std::string CConfigReader::getConfigValue(std::string key)
-{
-	if (CConfigReader::m_mapConfigInfo.find(key) == CConfigReader::m_mapConfigInfo.end())
-	{
-		cout << "找不到配置文件参数:"<<key.c_str()<<endl;
-		LOG_INFO("找不到配置文件参数:"<<key.c_str());
-
-		//找不到就返回空字符串
-		return "";
-	}
-
-	return CConfigReader::m_mapConfigInfo[key];
-}
-
-bool CConfigReader::IsDebugMode()
-{
-	std::string mode = CConfigReader::getConfigValue("mode");
-
-	if (mode == "debug")
-	{
-		return true;
-	}
-
-	return false;
-}
-
-std::string CConfigReader::getPathPlanningHost()
-{
-	std::string mode = CConfigReader::getConfigValue("mode");
-
-	if (mode == "debug")
-	{
-		return CConfigReader::getConfigValue("debug_pathplanning_host");
-	}
-	else
-	{
-		return CConfigReader::getConfigValue("release_pathplanning_host");
-	}
-}
-
-std::string CConfigReader::getMysqlHost()
-{
-	std::string mode = CConfigReader::getConfigValue("mode");
-
-	if (mode == "debug")
-	{
-		return CConfigReader::getConfigValue("debug_host");
-	}
-	else
-	{
-		return CConfigReader::getConfigValue("release_host");
-	}
-}
-
-std::string CConfigReader::getMysqlPort()
-{
-	std::string mode = CConfigReader::getConfigValue("mode");
-
-	if (mode == "debug")
-	{
-		return CConfigReader::getConfigValue("debug_port");
-	}
-	else
-	{
-		return CConfigReader::getConfigValue("release_port");
-	}
-}
-
-std::string CConfigReader::getMysqlUsername()
-{
-	std::string mode = CConfigReader::getConfigValue("mode");
-
-	if (mode == "debug")
-	{
-		return CConfigReader::getConfigValue("debug_username");
-	}
-	else
-	{
-		return CConfigReader::getConfigValue("release_username");
-	}
-}
-
-std::string CConfigReader::getMysqlPassword()
-{
-	std::string mode = CConfigReader::getConfigValue("mode");
-
-	if (mode == "debug")
-	{
-		return CConfigReader::getConfigValue("debug_password");
-	}
-	else
-	{
-		return CConfigReader::getConfigValue("release_password");
-	}
-}
-
-std::string CConfigReader::getDBName()
-{
-	std::string mode = CConfigReader::getConfigValue("mode");
-
-	if (mode == "debug")
-	{
-		return CConfigReader::getConfigValue("debug_dbname");
-	}
-	else
-	{
-		return CConfigReader::getConfigValue("release_dbname");
-	}
-}
-
-std::string CConfigReader::getTaskQueue()
-{
-	std::string mode = CConfigReader::getConfigValue("mode");
-
-	if (mode == "debug")
-	{
-		return CConfigReader::getConfigValue("debug_dispatch_task_queue");
-	}
-	else
-	{
-		return CConfigReader::getConfigValue("release_dispatch_task_queue");
-	}
-}
-
-std::string CConfigReader::getResultQueue()
-{
-	std::string mode = CConfigReader::getConfigValue("mode");
-
-	if (mode == "debug")
-	{
-		return CConfigReader::getConfigValue("debug_dispatch_result_queue");
-	}
-	else
-	{
-		return CConfigReader::getConfigValue("release_dispatch_result_queue");
-	}
-}
-
-int CConfigReader::getDeliverymanMaxOrderNum()
-{
-	std::string deliveryman_max_order_num = CConfigReader::getConfigValue("deliveryman_max_order_num");
-
-	int n_deliveryman_max_order_num = stoi(deliveryman_max_order_num);
-
-	//最大不能超过10
-	if (n_deliveryman_max_order_num > 10)
-	{
-		n_deliveryman_max_order_num = 10;
-	}
-
-	if (n_deliveryman_max_order_num < 1)
-	{
-		n_deliveryman_max_order_num = 1;
-	}
-
-	return n_deliveryman_max_order_num;
-}

+ 0 - 33
lewaimai_dispatch/helper/CConfigReader.h

@@ -1,33 +0,0 @@
-#pragma once
-
-/*
- *这个类用来读取配置文件
- **/
-class CConfigReader
-{
-public:
-	CConfigReader();
-	~CConfigReader();
-
-	static void ReadConfigFile();
-
-	static std::string getConfigValue(std::string key);
-
-	static bool IsDebugMode();
-
-	static std::string getPathPlanningHost();
-
-	static std::string getMysqlHost();
-	static std::string getMysqlPort();
-	static std::string getMysqlUsername();
-	static std::string getMysqlPassword();
-	static std::string getDBName();
-
-	static std::string getTaskQueue();
-	static std::string getResultQueue();
-
-	static int getDeliverymanMaxOrderNum();
-public:
-	static std::map<string,string> m_mapConfigInfo;
-};
-

+ 3 - 8
lewaimai_dispatch/lewaimai_dispatch_windows.vcxproj

@@ -142,10 +142,8 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     </Link>
     <PostBuildEvent>
       <Command>mkdir $(SolutionDir)bin\$(Platform)\$(Configuration)\$(ProjectName)\
-mkdir $(SolutionDir)bin\$(Platform)\$(Configuration)\$(ProjectName)\conf\
 copy $(TargetPath) $(SolutionDir)bin\$(Platform)\$(Configuration)\$(ProjectName)\
-copy $(SolutionDir)dll\debug\ $(SolutionDir)bin\$(Platform)\$(Configuration)\$(ProjectName)\
-copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\$(ProjectName)\conf\</Command>
+copy $(SolutionDir)dll\debug\ $(SolutionDir)bin\$(Platform)\$(Configuration)\$(ProjectName)\</Command>
     </PostBuildEvent>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -198,6 +196,7 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     </PostBuildEvent>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClInclude Include="wnd\CChufangSettingWnd.h" />
     <ClInclude Include="control\CWaimaiOrderInfoUI.h" />
     <ClInclude Include="control\CSettingUI.h" />
     <ClInclude Include="tool\CSetting.h" />
@@ -210,7 +209,6 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClInclude Include="wnd\CLoginWnd.h" />
     <ClInclude Include="helper\MD5.h" />
     <ClInclude Include="network\CZhipuziHttpClient.h" />
-    <ClInclude Include="helper\CConfigReader.h" />
     <ClInclude Include="helper\CLewaimaiString.h" />
     <ClInclude Include="helper\CRandomHelper.h" />
     <ClInclude Include="helper\define.h" />
@@ -224,6 +222,7 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClInclude Include="control\OrderListUI.h" />
   </ItemGroup>
   <ItemGroup>
+    <ClCompile Include="wnd\CChufangSettingWnd.cpp" />
     <ClCompile Include="control\CWaimaiOrderInfoUI.cpp" />
     <ClCompile Include="control\CSettingUI.cpp" />
     <ClCompile Include="tool\CSetting.cpp" />
@@ -236,7 +235,6 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClCompile Include="wnd\CLoginWnd.cpp" />
     <ClCompile Include="helper\MD5.cpp" />
     <ClCompile Include="network\CZhipuziHttpClient.cpp" />
-    <ClCompile Include="helper\CConfigReader.cpp" />
     <ClCompile Include="helper\CLewaimaiString.cpp" />
     <ClCompile Include="helper\CRandomHelper.cpp" />
     <ClCompile Include="helper\CSystem.cpp" />
@@ -253,9 +251,6 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
   <ItemGroup>
     <Image Include="resource\duilib.ico" />
   </ItemGroup>
-  <ItemGroup>
-    <None Include="conf\config.ini" />
-  </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>

+ 6 - 9
lewaimai_dispatch/lewaimai_dispatch_windows.vcxproj.filters

@@ -33,9 +33,6 @@
     <ClInclude Include="helper\CRandomHelper.h">
       <Filter>头文件</Filter>
     </ClInclude>
-    <ClInclude Include="helper\CConfigReader.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
     <ClInclude Include="helper\define.h">
       <Filter>头文件</Filter>
     </ClInclude>
@@ -87,6 +84,9 @@
     <ClInclude Include="tool\CSetting.h">
       <Filter>头文件</Filter>
     </ClInclude>
+    <ClInclude Include="wnd\CChufangSettingWnd.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="pch\pch.cpp">
@@ -104,9 +104,6 @@
     <ClCompile Include="helper\CRandomHelper.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
-    <ClCompile Include="helper\CConfigReader.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
     <ClCompile Include="helper\CSystem.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
@@ -155,6 +152,9 @@
     <ClCompile Include="tool\CSetting.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
+    <ClCompile Include="wnd\CChufangSettingWnd.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <Image Include="resource\duilib.ico">
@@ -166,7 +166,4 @@
       <Filter>资源文件</Filter>
     </ResourceCompile>
   </ItemGroup>
-  <ItemGroup>
-    <None Include="conf\config.ini" />
-  </ItemGroup>
 </Project>

+ 5 - 17
lewaimai_dispatch/network/CMessagePush.cpp

@@ -123,24 +123,12 @@ void CMessagePush::HandleMessage(std::string msg)
 			if (CSetting::GetParam("setting_is_new_waimai_printer") == "1")
 			{
 				CPosPrinter printer;
-
-				//判断打印规格和联数
-				std::string guige = CSetting::GetParam("setting_printer_guige");
-				std::string lianshu = CSetting::GetParam("setting_printer_lianshu");
-
-				int n_lianshu = atoi(lianshu.c_str());
-				for (int i = 0; i < n_lianshu; i++)
-				{
-					if (guige == "58")
-					{
-						printer.PrintWaimaiOrder(order_id, order_no, 1);
-					}
-					else
-					{
-						printer.PrintWaimaiOrder(order_id, order_no, 2);
-					}
-				}
+				printer.PrintWaimaiOrder(order_id, order_no);
 			}
+
+			CPosPrinter printer(2);
+
+			printer.PrintWaimaiOrder(order_id, order_no);
 		}
 	}
 	catch (std::exception& e)

+ 0 - 1
lewaimai_dispatch/pch/pch.h

@@ -78,7 +78,6 @@ using namespace rapidjson;
 #include "../helper/CRandomHelper.h"
 #include "../helper/CSystem.h"
 #include "../helper/CLewaimaiString.h"
-#include "../helper/CConfigReader.h"
 
 #include "../tool/CLewaimaiLog.h"
 #include "../tool/CLewaimaiTime.h"

ファイルの差分が大きいため隠しています
+ 550 - 316
lewaimai_dispatch/tool/CPosPrinter.cpp


+ 17 - 7
lewaimai_dispatch/tool/CPosPrinter.h

@@ -15,17 +15,21 @@ const GUID USB_GUID = {0xa5dcbf10, 0x6530, 0x11d2, {0x90, 0x1f, 0x00, 0xc0, 0x4f
 class CPosPrinter
 {
 public:
-    CPosPrinter();
+	//print_type为1表示收银打印,为2表示厨房打印
+    CPosPrinter(int print_type = 1);
     ~CPosPrinter();
 
 	bool Init();
 
+	bool InitChufang();
+
 	//type为1表示58mmm,为2表示80mmm
-	void PrintWaimaiOrder(string order_id, string order_no, int type = 1);
-    void PrintWaimaiOrder(CWaimaiOrder& order, int type = 1);
+	void PrintWaimaiOrder(std::string order_id, std::string order_no);
+    void PrintWaimaiOrder(CWaimaiOrder& order);
 
 private:
 	int GetDevicePath(LPGUID lpGuid, LPTSTR* pszDevicePath);
+
 	int WriteData(string meg);
 	int WriteBuf(char *buf, int len);
 
@@ -49,10 +53,16 @@ private:
 	void CalWord(string s,  int& nHanzi, int& nZimu);
 
 	//对名字进行换行处理
-	std::vector<std::string> HandleFoodname(std::string oldname);
-	std::string HandleFoodItemPrice(std::string oldprice);
-	std::string HandleFoodQuantity(std::string oldquantity);
-	std::string HandleFoodTotalPrice(std::string oldprice);
+	std::vector<std::string> HandleFoodname(std::string oldname, int guige = 1);
+	std::string HandleFoodItemPrice(std::string oldprice, int guige = 1);
+	std::string HandleFoodQuantity(std::string oldquantity, int guige = 1);
+	std::string HandleFoodTotalPrice(std::string oldprice, int guige = 1);
+
 private:
+	int m_type;
+
 	HANDLE m_hPort = NULL;
+
+	boost::asio::io_service m_io;
+	boost::asio::ip::tcp::socket m_socket;
 };

+ 53 - 6
lewaimai_dispatch/tool/CSetting.cpp

@@ -4,6 +4,7 @@
 #include "CSqlite3.h"
 
 std::map<std::string, std::string> CSetting::m_paramsMap;
+std::vector<ChufangPrinter> CSetting::m_chufang_printers;
 std::mutex CSetting::m_mutex;
 
 CSetting::CSetting()
@@ -15,6 +16,50 @@ CSetting::~CSetting()
 {
 }
 
+void CSetting::SetParam(std::string name, std::string value, bool isSave)
+{
+	m_mutex.lock();
+
+	m_paramsMap[name] = value;
+
+	m_mutex.unlock();
+
+	if (isSave)
+	{
+		SaveParams();
+	}
+}
+
+std::string CSetting::GetParam(std::string name)
+{
+	m_mutex.lock();
+
+	std::string value = m_paramsMap[name];
+
+	m_mutex.unlock();
+
+	return value;
+}
+
+void CSetting::AddChufangPrinter(std::string name, std::string ip, std::string guige, std::string fendan, std::string fenlei, std::string fenlei_ids, bool isSave)
+{
+	ChufangPrinter newPrinter;
+
+	newPrinter.name = name;
+	newPrinter.ip = ip;
+	newPrinter.guige = guige;
+	newPrinter.fendan = fendan;
+	newPrinter.fenlei = fenlei;
+	newPrinter.fenlei_ids = fenlei_ids;
+
+	m_chufang_printers.push_back(newPrinter);
+
+	if (isSave)
+	{
+		SaveChufangPrinter();
+	}
+}
+
 void CSetting::Init()
 {
 	m_mutex.lock();
@@ -66,12 +111,6 @@ void CSetting::Init()
 		m_paramsMap[setting_is_new_waimai_chufang_printer] = "1";
 	}
 
-	std::string setting_chufang_printer_guige = "setting_chufang_printer_guige";
-	if (m_paramsMap.find(setting_chufang_printer_guige) == m_paramsMap.end())
-	{
-		m_paramsMap[setting_chufang_printer_guige] = "58";
-	}
-
 	//系统设置的参数
 	std::string setting_is_auto_start = "setting_is_auto_start";
 	if (m_paramsMap.find(setting_is_auto_start) == m_paramsMap.end())
@@ -95,6 +134,8 @@ void CSetting::Init()
 
 	//设置好默认参数之后,将默认参数写回到数据库
 	SaveParams();
+
+	//厨房打印机没有默认的,这里不需要处理
 }
 
 void CSetting::SaveParams()
@@ -102,3 +143,9 @@ void CSetting::SaveParams()
 	CSqlite3 sqllite;
 	sqllite.SaveParams(m_paramsMap);
 }
+
+void CSetting::SaveChufangPrinter()
+{
+	CSqlite3 sqllite;
+	sqllite.SaveChufangPrinter(m_chufang_printers);
+}

+ 26 - 23
lewaimai_dispatch/tool/CSetting.h

@@ -2,6 +2,17 @@
 
 #include "../pch/pch.h"
 
+class ChufangPrinter
+{
+public:
+	std::string name;
+	std::string ip;
+	std::string guige;
+	std::string fendan;
+	std::string fenlei;
+	std::string fenlei_ids;
+};
+
 class CSetting
 {
 public:
@@ -9,30 +20,11 @@ public:
 	~CSetting();
 
 	//修改内存中的参数设置
-	static void SetParam(std::string name, std::string value, bool isSave = true)
-	{
-		m_mutex.lock();
-
-		m_paramsMap[name] = value;
-
-		m_mutex.unlock();
-
-		if (isSave)
-		{
-			SaveParams();
-		}
-	}
-
-	static std::string GetParam(std::string name)
-	{
-		m_mutex.lock();
-
-		std::string value = m_paramsMap[name];
+	static void SetParam(std::string name, std::string value, bool isSave = true);
+	static std::string GetParam(std::string name);
 
-		m_mutex.unlock();
-
-		return value;
-	}
+	//厨房打印机相关的参数配置
+	static void AddChufangPrinter(std::string name, std::string ip, std::string guige, std::string fendan, std::string fenlei, std::string fenlei_ids, bool isSave = true);
 
 	//刚打开程序的时候,根据数据库初始化内存,并且添加默认参数
 	static void Init();
@@ -42,13 +34,24 @@ public:
 		return m_paramsMap[name];
 	}
 
+	static ChufangPrinter getLastChufangPrinter()
+	{
+		return m_chufang_printers.back();
+	}
+
 	/*
 	 *把内存中的参数,写到数据库中
 	 **/
 	static void SaveParams();
 
+	/*
+	 *把内存中的厨房打印机信息,存到数据库
+	 **/
+	static void SaveChufangPrinter();
+
 private:
 	static std::map<std::string, std::string> m_paramsMap;
+	static std::vector<ChufangPrinter> m_chufang_printers;
 
 	static std::mutex m_mutex;
 };

+ 122 - 4
lewaimai_dispatch/tool/CSqlite3.cpp

@@ -23,10 +23,10 @@ CSqlite3::CSqlite3()
 
 CSqlite3::~CSqlite3()
 {
-	if (m_db != NULL)
-	{
-		sqlite3_close(m_db);
-	}
+    if(m_db != NULL)
+    {
+        sqlite3_close(m_db);
+    }
 }
 
 bool CSqlite3::InitConfig()
@@ -124,6 +124,92 @@ bool CSqlite3::InitConfig()
         return false;
     }
 
+    sql = "SELECT COUNT(*) FROM sqlite_master where type = 'table' and name = 'pos_chufang_printer';";
+
+    //读取厨房打印机的参数
+    if(sqlite3_prepare_v2(m_db, sql.c_str(), -1, &stmt, NULL) == SQLITE_OK)
+    {
+        if(sqlite3_step(stmt) == SQLITE_ROW)
+        {
+            int count = sqlite3_column_int(stmt, 0);
+
+            if(count == 0)
+            {
+                //说明没找到这个表,那么这个时候新建这个表,先释放前面的stmt
+                sqlite3_finalize(stmt);
+                stmt = NULL;
+
+                sql = "CREATE TABLE pos_chufang_printer("  \
+					  "id         INTEGER          PRIMARY KEY AUTOINCREMENT,"\
+                      "name       CHAR(100)        NOT NULL," \
+                      "ip         CHAR(100)        NOT NULL," \
+                      "guige      CHAR(100)        NOT NULL," \
+                      "fendan     CHAR(100)        NOT NULL," \
+                      "fenlei     CHAR(100)        NOT NULL," \
+                      "fenlei_ids CHAR(2000)              );";
+
+                if(sqlite3_prepare_v2(m_db, sql.c_str(), -1, &stmt, NULL) == SQLITE_OK)
+                {
+                    //执行该语句
+                    if(sqlite3_step(stmt) != SQLITE_OK)
+                    {
+                        LOG_INFO("create table fail: " << sqlite3_errmsg(m_db));
+
+                        sqlite3_finalize(stmt);
+                        return false;
+                    }
+
+                    //走到这里就是表创建成功了
+                    LOG_INFO("create table success");
+                    sqlite3_finalize(stmt);
+                }
+
+                else
+                {
+                    LOG_INFO("create table prepare fail: " << sqlite3_errmsg(m_db));
+
+                    sqlite3_finalize(stmt);
+
+                    return false;
+                }
+            }
+
+            else
+            {
+                //说明已经有这个表了,就不用再创建了
+                sqlite3_finalize(stmt);
+            }
+
+            std::string sql = "SELECT * FROM pos_chufang_printer;";
+            sqlite3_stmt * stmt = NULL;
+
+            if(sqlite3_prepare_v2(m_db, sql.c_str(), -1, &stmt, NULL) == SQLITE_OK)
+            {
+                while(sqlite3_step(stmt) == SQLITE_ROW)
+                {
+                    std::string name = (char*)sqlite3_column_text(stmt, 0);
+                    std::string ip = (char*)sqlite3_column_text(stmt, 1);
+                    std::string guige = (char*)sqlite3_column_text(stmt, 2);
+                    std::string fendan = (char*)sqlite3_column_text(stmt, 3);
+                    std::string fenlei = (char*)sqlite3_column_text(stmt, 4);
+                    std::string fenlei_ids = (char*)sqlite3_column_text(stmt, 5);
+
+					//这里仅仅是把数据库内容读到内存,所以之类用false
+                    CSetting::AddChufangPrinter(name, ip, guige, fendan, fenlei, fenlei_ids, false);
+                }
+
+                sqlite3_finalize(stmt);
+            }
+
+            else
+            {
+                //异常情况
+                sqlite3_finalize(stmt);
+                return false;
+            }
+        }
+    }
+
     return true;
 }
 
@@ -154,3 +240,35 @@ bool CSqlite3::SaveParams(std::map<std::string, std::string>& params)
     LOG_INFO("save params fail");
     return false;
 }
+
+bool CSqlite3::SaveChufangPrinter(std::vector<ChufangPrinter>& printers)
+{
+	int result = sqlite3_exec(m_db, "BEGIN;", 0, 0, 0);
+
+	std::string sql = "delete from pos_chufang_printer;";
+	result = sqlite3_exec(m_db, sql.c_str(), 0, 0, 0);
+
+	for (std::vector<ChufangPrinter>::iterator it = printers.begin(); it != printers.end(); it++)
+	{
+		std::string name = (*it).name;
+		std::string ip = (*it).ip;
+		std::string guige = (*it).guige;
+		std::string fendan = (*it).fendan;
+		std::string fenlei = (*it).fenlei;
+		std::string fenlei_ids = (*it).fenlei_ids;
+
+		sql = "INSERT INTO pos_chufang_printer (name, ip, guige, fendan, fenlei, fenlei_ids) VALUES ('" + name + "','" + ip + "','" + guige + "','" + fendan + "','" + fenlei + "','" + fenlei_ids + "')";
+		result = sqlite3_exec(m_db, sql.c_str(), 0, 0, 0);
+	}
+
+	result = sqlite3_exec(m_db, "COMMIT;", 0, 0, 0);
+
+	if (result == SQLITE_OK)
+	{
+		LOG_INFO("save params success");
+		return true;
+	}
+
+	LOG_INFO("save params fail");
+	return false;
+}

+ 3 - 0
lewaimai_dispatch/tool/CSqlite3.h

@@ -1,6 +1,7 @@
 #pragma once
 
 #include <sqlite3/sqlite3.h>
+#include "CSetting.h"
 
 class CSqlite3
 {
@@ -13,6 +14,8 @@ public:
 
 	bool SaveParams(std::map<std::string, std::string>& params);
 
+	bool SaveChufangPrinter(std::vector<ChufangPrinter>& printers);
+
 	void Close()
 	{
 		if (m_db != NULL)

+ 58 - 0
lewaimai_dispatch/wnd/CChufangSettingWnd.cpp

@@ -0,0 +1,58 @@
+#include "../pch/pch.h"
+#include "CChufangSettingWnd.h"
+
+void CChufangSettingWnd::HandleLogin()
+{
+	//判断账号密码是否正确
+	std::wstring account, password;
+	CEditUI* pAccountEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("accountedit")));
+	if (pAccountEdit)
+	{
+		account = pAccountEdit->GetText().GetData();
+	}
+
+	CEditUI* pPasswordEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("pwdedit")));
+	if (pPasswordEdit)
+	{
+		password = pPasswordEdit->GetText().GetData();
+	}
+
+	LOG_INFO("account:" << account.c_str() << ", password:" << password.c_str());
+
+	string s_account = CLewaimaiString::UnicodeToUTF8(account);
+	string s_password = CLewaimaiString::UnicodeToUTF8(password);
+
+	CZhipuziHttpClient::Init(s_account, s_password);
+
+	std::string errmsg;
+	bool res = CZhipuziHttpClient::Login(errmsg);
+
+	if (res)
+	{
+		CMainWnd* pFrame = new CMainWnd();
+		if (pFrame == NULL)
+		{
+			return;
+		}
+
+		pFrame->SetIcon(IDI_ICON_DUILIB);
+		pFrame->Create(NULL, _T("游戏中心"), UI_WNDSTYLE_FRAME, 0L, 0, 0, 1024, 738);
+		pFrame->CenterWindow();
+
+		::ShowWindow(*pFrame, SW_SHOWMAXIMIZED);
+
+		Close();
+	}
+	else
+	{
+		//登录失败了
+		CLabelUI* pLoginResultLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("loginresult")));
+
+		pLoginResultLabel->SetText(std::wstring(_T("登录失败:") + CLewaimaiString::UTF8ToUnicode(errmsg)).c_str());
+		pLoginResultLabel->SetVisible(true);
+	}
+}
+
+
+
+

+ 272 - 0
lewaimai_dispatch/wnd/CChufangSettingWnd.h

@@ -0,0 +1,272 @@
+#pragma once
+
+#include "../pch/pch.h"
+#include "CMainWnd.h"
+
+class CChufangSettingWnd : public CWindowWnd, public INotifyUI, public IMessageFilterUI
+{
+public:
+	CChufangSettingWnd()
+	{
+
+	}
+
+	LPCTSTR GetWindowClassName() const
+	{
+		return _T("UILoginFrame");
+	};
+
+	UINT GetClassStyle() const
+	{
+		return UI_CLASSSTYLE_DIALOG;
+	};
+
+	void OnFinalMessage(HWND /*hWnd*/)
+	{
+		//WindowImplBase::OnFinalMessage(hWnd);
+		m_pm.RemovePreMessageFilter(this);
+		delete this;
+	};
+
+	void Init()
+	{
+		
+	}
+
+	void Notify(TNotifyUI& msg)
+	{
+		if (msg.sType == _T("click"))
+		{
+			DuiLib::CDuiString senderName = msg.pSender->GetName();
+
+			if (senderName == _T("chufang_setting_closebtn"))
+			{
+				Close(IDCANCEL);
+				return;
+			}
+			else if (senderName == _T("chufang_setting_save"))
+			{
+				//开始保存厨房打印机的数据
+				CEditUI* pName = static_cast<CEditUI*>(m_pm.FindControl(_T("chufang_setting_name")));
+				wstring wsName = pName->GetText();
+
+				CEditUI* pIP = static_cast<CEditUI*>(m_pm.FindControl(_T("chufang_setting_ip")));
+				wstring wsIP = pIP->GetText();
+
+				CComboUI* com = static_cast<CComboUI*>(m_pm.FindControl(_T("chufang_setting_guige")));
+				wstring wsGuige;
+				if (com->GetCurSel() == 0)
+				{
+					wsGuige = L"58";
+				}
+				else
+				{
+					wsGuige = L"80";
+				}
+
+				CCheckBoxUI* pFendan = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("chufang_setting_fendan")));
+				wstring wsFendan;
+				if (pFendan->IsSelected())
+				{
+					wsFendan = L"1";
+				}
+				else
+				{
+					wsFendan = L"0";
+				}
+
+				CCheckBoxUI* pFenlei = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("chufang_setting_fenlei")));
+				wstring wsFenlei;
+				if (pFenlei->IsSelected())
+				{
+					wsFenlei = L"1";
+				}
+				else
+				{
+					wsFenlei = L"0";
+				}
+
+				//保存数据到数据库
+				std::string name = CLewaimaiString::UnicodeToUTF8(wsName);
+				std::string ip = CLewaimaiString::UnicodeToUTF8(wsIP);
+				std::string guige = CLewaimaiString::UnicodeToUTF8(wsGuige);
+				std::string fendan = CLewaimaiString::UnicodeToUTF8(wsFendan);
+				std::string fenlei = CLewaimaiString::UnicodeToUTF8(wsFenlei);
+				std::string fenlei_ids = "";
+
+				CSetting::AddChufangPrinter(name, ip, guige, fendan, fenlei, fenlei_ids, true);
+
+				Close(IDOK);
+				return;
+			}
+		}
+	}
+
+	LRESULT 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("chufang_printer_setting.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;
+	}
+
+	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)
+	{
+		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 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 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 MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled)
+	{
+		if (uMsg == WM_KEYDOWN)
+		{
+			if (wParam == VK_RETURN)
+			{
+				CEditUI* pEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("accountedit")));
+				if (pEdit->GetText().IsEmpty())
+				{
+					pEdit->SetFocus();
+				}
+				else
+				{
+					pEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("pwdedit")));
+					if (pEdit->GetText().IsEmpty())
+					{
+						pEdit->SetFocus();
+					}
+					else
+					{
+						this->HandleLogin();
+					}
+				}
+				return true;
+			}
+			else if (wParam == VK_ESCAPE)
+			{
+				PostQuitMessage(0);
+				return true;
+			}
+
+		}
+		return false;
+	}
+
+	void HandleLogin();
+
+public:
+	CPaintManagerUI m_pm;
+};
+

+ 53 - 37
lewaimai_dispatch/wnd/CMainWnd.cpp

@@ -1,6 +1,8 @@
 #include "../pch/pch.h"
 #include "CMainWnd.h"
 
+#include "CChufangSettingWnd.h"
+
 #include "../control/ControlEx.h"
 #include "../control/CWaimaiOrderInfoUI.h"
 
@@ -405,8 +407,8 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
     else if(name == _T("setting_is_new_waimai_voice"))
     {
         CCheckBoxUI* box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_new_waimai_voice")));
-		
-		//注意这里的IsSelected如果为true,表示的是点击前为true,而不是点击后为true,所以这里设置状态要反过来
+
+        //注意这里的IsSelected如果为true,表示的是点击前为true,而不是点击后为true,所以这里设置状态要反过来
         if(box->IsSelected())
         {
             CSetting::SetParam("setting_is_new_waimai_voice", "0");
@@ -478,6 +480,48 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
         }
     }
 
+    else if(name == _T("setting_new_chufang_printer_btn"))
+    {
+        CChufangSettingWnd* pChufangFrame = new CChufangSettingWnd;
+
+        if(pChufangFrame != NULL)
+        {
+            pChufangFrame->Create(this->GetHWND(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+            pChufangFrame->SetIcon(IDI_ICON_DUILIB);
+            pChufangFrame->CenterWindow();
+            UINT ret = pChufangFrame->ShowModal();
+
+            if(ret == IDOK)
+            {
+                //这个时候是点击保存返回了,厨房打印机的数据已经建立好了,这个时候刷新表格的显示
+                CListUI* pPrinterList = static_cast<CListUI*>(m_pm.FindControl(_T("setting_chufang_printer_list")));
+
+                //把最后一个厨房打印机取出来
+                ChufangPrinter newPrinter = CSetting::getLastChufangPrinter();
+
+                CDialogBuilder builder;
+                CListContainerElementUI* pEle = static_cast<CListContainerElementUI *>(builder.Create(_T("setting_chufang_printer_item.xml"), (UINT)0, NULL, &m_pm));
+
+                CLabelUI *pName = static_cast<CLabelUI *>(pEle->FindSubControl(_T("setting_chufang_printer_item_name")));
+                pName->SetText(CLewaimaiString::UTF8ToUnicode(newPrinter.name).c_str());
+
+                CLabelUI *pIP = static_cast<CLabelUI *>(pEle->FindSubControl(_T("setting_chufang_printer_item_ip")));
+                pIP->SetText(CLewaimaiString::UTF8ToUnicode(newPrinter.ip).c_str());
+
+                /*CLabelUI *pName = static_cast<CLabelUI *>(pEle->FindSubControl(_T("setting_chufang_printer_item_name")));
+                pName->SetText(CLewaimaiString::UTF8ToUnicode(newPrinter.name).c_str());
+
+                CLabelUI *pName = static_cast<CLabelUI *>(pEle->FindSubControl(_T("setting_chufang_printer_item_name")));
+                pName->SetText(CLewaimaiString::UTF8ToUnicode(newPrinter.name).c_str());
+
+                CLabelUI *pName = static_cast<CLabelUI *>(pEle->FindSubControl(_T("setting_chufang_printer_item_name")));
+                pName->SetText(CLewaimaiString::UTF8ToUnicode(newPrinter.name).c_str());*/
+
+                pPrinterList->Add(pEle);
+            }
+        }
+    }
+
     else if(name == _T("setting_is_auto_start"))
     {
         CCheckBoxUI* box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_auto_start")));
@@ -680,21 +724,6 @@ void CMainWnd::HandleItemSelectMsg(TNotifyUI& msg)
             CSetting::SetParam("setting_printer_lianshu", "4");
         }
     }
-
-    else if(name == _T("setting_chufang_printer_guige"))
-    {
-        CComboUI* com = static_cast<CComboUI*>(m_pm.FindControl(_T("setting_chufang_printer_guige")));
-
-        if(com->GetCurSel() == 0)
-        {
-            CSetting::SetParam("setting_chufang_printer_guige", "58");
-        }
-
-        else
-        {
-            CSetting::SetParam("setting_chufang_printer_guige", "80");
-        }
-    }
 }
 
 LRESULT CMainWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
@@ -990,15 +1019,16 @@ void CMainWnd::InitSettingStatus()
     }
 
     com = static_cast<CComboUI*>(m_pm.FindControl(_T("setting_printer_guige")));
+
     if(CSetting::GetParam("setting_printer_guige") == "58")
     {
-		com->SetInternVisible(true);
+        com->SetInternVisible(true);
         com->SelectItem(0, false, false);
     }
 
     else
     {
-		com->SetInternVisible(true);
+        com->SetInternVisible(true);
         com->SelectItem(1, false, false);
     }
 
@@ -1007,28 +1037,28 @@ void CMainWnd::InitSettingStatus()
 
     if(setting_printer_lianshu == "1")
     {
-		com->SetInternVisible(true);
+        com->SetInternVisible(true);
         com->SelectItem(0, false, false);
         com->SetText(L"1联");
     }
 
     else if(setting_printer_lianshu == "2")
     {
-		com->SetInternVisible(true);
+        com->SetInternVisible(true);
         com->SelectItem(1, false, false);
         com->SetText(L"2联");
     }
 
     else if(setting_printer_lianshu == "3")
     {
-		com->SetInternVisible(true);
+        com->SetInternVisible(true);
         com->SelectItem(2, false, false);
         com->SetText(L"3联");
     }
 
     else if(setting_printer_lianshu == "4")
     {
-		com->SetInternVisible(true);
+        com->SetInternVisible(true);
         com->SelectItem(3, false, false);
         com->SetText(L"4联");
     }
@@ -1045,20 +1075,6 @@ void CMainWnd::InitSettingStatus()
         box->Selected(false, false);
     }
 
-    com = static_cast<CComboUI*>(m_pm.FindControl(_T("setting_chufang_printer_guige")));
-
-    if(CSetting::GetParam("setting_chufang_printer_guige") == "58")
-    {
-		com->SetInternVisible(true);
-        com->SelectItem(0, false, false);
-    }
-
-    else
-    {
-		com->SetInternVisible(true);
-        com->SelectItem(1, false, false);
-    }
-
     box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_auto_start")));
 
     if(CSetting::GetParam("setting_is_auto_start") == "1")

+ 0 - 3
lewaimai_dispatch/zhipuzi_pos_windows.cpp

@@ -12,9 +12,6 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
     CLewaimaiLog log;
     log.Init();
 
-    //读取配置文件
-    CConfigReader::ReadConfigFile();
-
     //读取sqlite里面的设置信息
 	CSqlite3 sqllite;
 	sqllite.InitConfig();