ソースを参照

厨房打印机的设置弄完了

zhangyang 6 年 前
コミット
2969395979

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


+ 39 - 31
bin/Win32/Debug/zhipuzi_pos_windows/skin/chufang_printer_setting.xml

@@ -1,44 +1,52 @@
 <?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">
+<Window size="800,600" caption="0,0,0,36" roundcorner="4,4" >
+	<VerticalLayout bkimage="file='Dialog_BG1.png' corner='4,50,4,4'">
+		<HorizontalLayout height="40" inset="10,2,10,0">
 			<Label name="chufang_setting_title" 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>
+		<VerticalLayout inset="15,0,15,15" vscrollbar="true" >
+			<Control height="20" />
 
-		<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">
-			<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'" />
-			<Label name="chufang_setting_ip_error" text="IP地址格式不正确" padding="20,0,0,0" textcolor="#FFFF0000" />
-		</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'" />
+				<Label name="chufang_setting_ip_error" text="IP地址格式不正确" padding="20,0,0,0" textcolor="#FFFF0000" />
+			</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" />
+				<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">
+				<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" padding="0,30,0,0">
+			<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>
+			
+			<VerticalLayout name="chufang_setting_fenlei_xuanze">
+				<Label text="请在下面勾选需要打印的商品分类" height="30"/>
+				<VerticalLayout name="chufang_setting_fenlei_xuanze_area">
+					
+				</VerticalLayout>
+			</VerticalLayout>
+		</VerticalLayout>
+		
+		<HorizontalLayout height="56" valign="center" padding="0,30,0,20">
 			<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 />

+ 8 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/chufang_printer_setting_fenlei_select.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<Window> 
+	<HorizontalLayout height="30">
+		<CheckBox name="chufang_setting_fenleli_xuanze_checkbox" padding="0,7,0,7" width="16" height="16" normalimage="file='Setting_CheckBox_Normal.png'" hotimage="file='Setting_CheckBox_Hover.png'" selectedimage="file='Setting_CheckBox_Click.png'"/>
+		<Label name="chufang_setting_fenleli_xuanze_name" text="" width="300" padding="10,0,0,0"/>
+	</HorizontalLayout>
+</Window>

+ 5 - 3
bin/Win32/Debug/zhipuzi_pos_windows/skin/setting_chufang_printer_item.xml

@@ -1,14 +1,16 @@
 <?xml version="1.0" encoding="utf-8"?>
 
 <Window> 
-	<ListContainerElement name="setting_chufang_printer_item" height="30" minheight="30"> 
-		<HorizontalLayout height="38"> 
+	<ListContainerElement name="setting_chufang_printer_item" height="80"> 
+		<HorizontalLayout> 
 			<Label name="setting_chufang_printer_item_name" width="200" align="center"/> 
 			<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"/> 
+			<HorizontalLayout height="80" valign="center">
+				<Label name="setting_chufang_printer_item_fenlei_ids" width="300" multiline="true" align="center" valign="center"/> 
+			</HorizontalLayout>
 			<HorizontalLayout name="setting_chufang_printer_caozuo" align="center">
 				<Button name="setting_chufang_printer_item_update_btn" align="center" width="26" height="27" normalimage="file='Setting_Btn.png'" hotimage="file='Setting_Btn_Hover.png'" pushedimage="file='Setting_Btn_Active.png'" />
 				<Button name="setting_chufang_printer_item_delete_btn" align="center" width="18" height="18" padding="20,4,0,0" normalimage="file='Delete_Members_Icon.png'" hotimage="file='Delete_Members_Icon_Hover.png'" pushedimage="file='Delete_Members_Icon_Click.png'" />

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


BIN
bin/Win32/Debug/zhipuzi_pos_windows_server/zhipuzi_pos_windows_server.exe


+ 22 - 0
lewaimai_dispatch/helper/CLewaimaiString.cpp

@@ -300,4 +300,26 @@ bool CLewaimaiString::isIPAddressValid(const char* pszIPAddr)
         return false;
     }
     return true;
+}
+
+vector<string> CLewaimaiString::Split(const string& in, const string& delim)
+{
+	vector<string> ret;
+
+	try
+	{
+		regex re{ delim };
+		return vector<string>
+		{
+			sregex_token_iterator(in.begin(), in.end(), re, -1),
+				sregex_token_iterator()
+		};
+	}
+
+	catch (const std::exception& e)
+	{
+		cout << "error:" << e.what() << std::endl;
+	}
+
+	return ret;
 }

+ 7 - 2
lewaimai_dispatch/helper/CLewaimaiString.h

@@ -3,6 +3,10 @@
 #include <codecvt>
 #include <iostream>
 #include <sstream>
+#include <regex>
+#include <string>
+
+using namespace std;
 
 class CLewaimaiString
 {
@@ -26,12 +30,13 @@ public:
 	static std::string UTF8ToANSI(const std::string & str);
 
 	static std::string ANSIToUTF8(const std::string & str);
-	
+
 	static std::string DoubleToString(const double value, unsigned int precisionAfterPoint);
 
 	static std::string UrlEncode(const std::string& str);
 	static std::string UrlDecode(const std::string& str);
 
 	static bool isIPAddressValid(const char* pszIPAddr);
-};
 
+	static vector<string> Split(const string& in, const string& delim);
+};

+ 0 - 1
lewaimai_dispatch/network/CZhipuziHttpClient.h

@@ -14,7 +14,6 @@ public:
 	static bool Login(std::string& errmsg);
 
 	static bool RequestOld(std::string url, std::map<string, string> params, std::string& response);
-
 	static bool RequestNew(std::string url, std::map<string, string> params, std::string& response);
 
 public:

+ 1 - 0
lewaimai_dispatch/pch/pch.h

@@ -30,6 +30,7 @@
 #include <iostream>
 #include <fstream>
 #include <iomanip>
+#include <regex>
 
 using namespace std;
 

+ 2 - 0
lewaimai_dispatch/tool/CSetting.cpp

@@ -6,6 +6,8 @@
 std::map<std::string, std::string> CSetting::m_paramsMap;
 std::vector<ChufangPrinter> CSetting::m_chufang_printers;
 std::mutex CSetting::m_mutex;
+std::vector<FoodType> CSetting::m_foodtypes;
+std::map<std::string, std::string> CSetting::m_foodtype_id_name;
 
 CSetting::CSetting()
 {

+ 39 - 0
lewaimai_dispatch/tool/CSetting.h

@@ -14,6 +14,13 @@ public:
 	std::string fenlei_ids;
 };
 
+class FoodType
+{
+public:
+	std::string name;
+	std::string type_id;
+};
+
 class CSetting
 {
 public:
@@ -49,6 +56,33 @@ public:
 		return m_chufang_printers;
 	}
 
+	static void AddFoodtype(std::string name, std::string type_id)
+	{
+		FoodType newFoodType;
+		newFoodType.name = name;
+		newFoodType.type_id = type_id;
+
+		m_foodtypes.push_back(newFoodType);
+
+		m_foodtype_id_name[type_id] = name;
+	}
+
+	static std::vector<FoodType>& GetFoodtype()
+	{
+		return m_foodtypes;
+	}
+
+	static std::string getFoodtypeName(std::string type_id)
+	{
+		if (m_foodtype_id_name.find(type_id) != m_foodtype_id_name.end())
+		{
+			return m_foodtype_id_name[type_id];
+		}
+
+		//返回这个表示没找到这个分类
+		return "zhipuzi_not_found_xxx";
+	}
+
 	/*
 	 *把内存中的参数,写到数据库中
 	 **/
@@ -64,5 +98,10 @@ private:
 	static std::vector<ChufangPrinter> m_chufang_printers;
 
 	static std::mutex m_mutex;
+
+	static std::vector<FoodType> m_foodtypes;
+
+	//从商品分类的id到name的映射
+	static std::map<std::string, std::string> m_foodtype_id_name;
 };
 

+ 4 - 3
lewaimai_dispatch/tool/CSqlite3.cpp

@@ -54,7 +54,7 @@ bool CSqlite3::InitConfig()
                 if(sqlite3_prepare_v2(m_db, sql.c_str(), -1, &stmt, NULL) == SQLITE_OK)
                 {
                     //Ö´ÐиÃÓï¾ä
-                    if(sqlite3_step(stmt) != SQLITE_OK)
+                    if(sqlite3_step(stmt) != SQLITE_DONE)
                     {
                         LOG_INFO("create table fail: " << sqlite3_errmsg(m_db));
 
@@ -152,9 +152,10 @@ bool CSqlite3::InitConfig()
                 if(sqlite3_prepare_v2(m_db, sql.c_str(), -1, &stmt, NULL) == SQLITE_OK)
                 {
                     //Ö´ÐиÃÓï¾ä
-                    if(sqlite3_step(stmt) != SQLITE_OK)
+                    if(sqlite3_step(stmt) != SQLITE_DONE)
                     {
-                        LOG_INFO("create table fail: " << sqlite3_errmsg(m_db));
+						std::string err = sqlite3_errmsg(m_db);
+                        LOG_INFO("create table fail: " << err.c_str());
 
                         sqlite3_finalize(stmt);
                         return false;

+ 67 - 3
lewaimai_dispatch/wnd/CChufangSettingWnd.h

@@ -91,8 +91,7 @@ public:
 				com->SetInternVisible(true);
 				com->SelectItem(1, false, false);
 			}
-		}
-		
+		}		
 
 		CCheckBoxUI* fendan = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("chufang_setting_fendan")));
 		if (m_mode == 1)
@@ -129,6 +128,52 @@ public:
 				fenlei->Selected(false, false);
 			}
 		}
+
+		//把所有分类显示出来
+		CVerticalLayoutUI* pLayout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("chufang_setting_fenlei_xuanze_area")));
+		pLayout->RemoveAll();
+
+		ChufangPrinter updatePrinter;
+
+		//这个map用于后面判断每个分类ID是否被选中
+		std::map<string, bool> ids_map;
+
+		if (m_mode == 2)
+		{
+			updatePrinter = CSetting::GetChufangPrinter(m_printer_date);
+			std::string foodtype_ids = updatePrinter.fenlei_ids;
+			std::vector<string> ids = CLewaimaiString::Split(foodtype_ids, ",");
+			for (std::vector<string>::iterator it = ids.begin(); it != ids.end(); it++)
+			{
+				ids_map[(*it)] = true;
+			}
+		}
+
+		std::vector<FoodType> foodtypes = CSetting::GetFoodtype();
+		for (std::vector<FoodType>::iterator it = foodtypes.begin(); it != foodtypes.end(); it++)
+		{
+			CDialogBuilder builder;
+			CListContainerElementUI* pEle = static_cast<CListContainerElementUI*>(builder.Create(_T("chufang_printer_setting_fenlei_select.xml"), (UINT)0, NULL, &m_pm));
+
+			CCheckBoxUI* pCheck = static_cast<CCheckBoxUI*>(pEle->FindSubControl(_T("chufang_setting_fenleli_xuanze_checkbox")));
+			pCheck->AddCustomAttribute(L"type_id", CLewaimaiString::UTF8ToUnicode((*it).type_id).c_str());
+
+			if (m_mode == 2)
+			{
+				if (ids_map.find((*it).type_id) != ids_map.end())
+				{
+					pCheck->Selected(true, false);
+				}
+			}
+
+			CLabelUI* pName = static_cast<CLabelUI*>(pEle->FindSubControl(_T("chufang_setting_fenleli_xuanze_name")));
+			pName->SetText(CLewaimaiString::UTF8ToUnicode((*it).name).c_str());
+
+			pLayout->Add(pEle);
+		}
+
+		CVerticalLayoutUI* pOutLayout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("chufang_setting_fenlei_xuanze")));
+		pOutLayout->SetFixedHeight(foodtypes.size() * 30 + 30);
     }
 
     void Notify(TNotifyUI& msg)
@@ -194,6 +239,26 @@ public:
                     wsFenlei = L"0";
                 }
 
+				std::string fenlei_ids = "";
+
+				CVerticalLayoutUI* pLayout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("chufang_setting_fenlei_xuanze_area")));
+				CDuiPtrArray* pArray = m_pm.FindSubControlsByClass(pLayout, _T("CheckBox"));
+				int size = pArray->GetSize();
+				for (int i = 0; i < size; i++)
+				{
+					CCheckBoxUI* pBox = static_cast<CCheckBoxUI*>(pArray->GetAt(i));
+
+					if (pBox->IsSelected())
+					{
+						std::wstring ws_type_id = pBox->GetCustomAttribute(_T("type_id"));
+						std::string type_id = CLewaimaiString::UnicodeToUTF8(ws_type_id);
+
+						fenlei_ids += type_id + ",";
+					}
+				}
+
+				fenlei_ids = fenlei_ids.substr(0, fenlei_ids.size() - 1);
+
                 //保存数据到数据库
 
 				std::string date = to_string(time(NULL));
@@ -203,7 +268,6 @@ public:
 				std::string guige = CLewaimaiString::UnicodeToUTF8(wsGuige);
 				std::string fendan = CLewaimaiString::UnicodeToUTF8(wsFendan);
 				std::string fenlei = CLewaimaiString::UnicodeToUTF8(wsFenlei);
-				std::string fenlei_ids = "";
 
 				if (m_mode == 1)
 				{

+ 113 - 8
lewaimai_dispatch/wnd/CMainWnd.cpp

@@ -14,6 +14,12 @@ void CMainWnd::Init()
     m_pMaxBtn = static_cast<CButtonUI*>(m_pm.FindControl(_T("maxbtn")));
     m_pRestoreBtn = static_cast<CButtonUI*>(m_pm.FindControl(_T("restorebtn")));
     m_pMinBtn = static_cast<CButtonUI*>(m_pm.FindControl(_T("minbtn")));
+
+	OrderListUI* orderlist = static_cast<OrderListUI*>(m_pm.FindControl(_T("orderlist")));
+	orderlist->Refresh();
+
+	//初始化设置中心的状态
+	InitSettingStatus();
 }
 
 LRESULT CMainWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
@@ -34,12 +40,6 @@ LRESULT CMainWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandl
 
     Init();
 
-    OrderListUI* orderlist = static_cast<OrderListUI*>(m_pm.FindControl(_T("orderlist")));
-    orderlist->Refresh();
-
-    //初始化设置中心的状态
-    InitSettingStatus();
-
     return 0;
 }
 
@@ -614,7 +614,6 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
 				//这个时候是点击保存返回了,厨房打印机的数据已经建立好了,这个时候刷新表格的显示
 				CListUI* pPrinterList = static_cast<CListUI*>(m_pm.FindControl(_T("setting_chufang_printer_list")));
 
-				//把最后一个厨房打印机取出来
 				ChufangPrinter newPrinter = CSetting::GetChufangPrinter(CLewaimaiString::UnicodeToUTF8(date));
 
 				CLabelUI* pName = static_cast<CLabelUI*>(pEle->FindSubControl(_T("setting_chufang_printer_item_name")));
@@ -655,6 +654,30 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
 				{
 					pFenlei->SetText(L"否");
 				}
+
+				std::string foodtypeNames = "";
+
+				std::string foodtype_ids = newPrinter.fenlei_ids;
+				std::vector<string> ids = CLewaimaiString::Split(foodtype_ids, ",");
+				for (std::vector<string>::iterator it = ids.begin(); it != ids.end(); it++)
+				{
+					std::string name = CSetting::getFoodtypeName((*it));
+					std::wstring ws_name = CLewaimaiString::UTF8ToUnicode(name);
+					if (name == "zhipuzi_not_found_xxx")
+					{
+						//这种情况是以前保存的分类后来被删掉了
+					}
+					else
+					{
+						foodtypeNames += name + "  ";
+					}
+				}
+
+				foodtypeNames = foodtypeNames.substr(0, foodtypeNames.size() - 1);
+				std::wstring ws_foodtypeNames = CLewaimaiString::UTF8ToUnicode(foodtypeNames);
+
+				CLabelUI* pFenleiIds = static_cast<CLabelUI*>(pEle->FindSubControl(_T("setting_chufang_printer_item_fenlei_ids")));
+				pFenleiIds->SetText(ws_foodtypeNames.c_str());
 			}
 		}
 	}
@@ -1218,6 +1241,52 @@ void CMainWnd::InitSettingStatus()
     //这里开始,初始化厨房打印机的设置
     CListUI* pPrinterList = static_cast<CListUI*>(m_pm.FindControl(_T("setting_chufang_printer_list")));
 
+	//获取当前店铺的商品分类信息,用于设置厨房打印机的分类打印
+	std::map<string, string> params;
+	std::string response;
+
+	std::string url = "/goodstype/getgoodstypelist";
+
+	CZhipuziHttpClient::RequestOld(url.c_str(), params, response);
+
+	rapidjson::Document document;
+	document.Parse(response.c_str());
+
+	if (document.HasParseError())
+	{
+		LOG_INFO("parse response error!");
+		return;
+	}
+
+	if (!document.HasMember("errcode") || !document.HasMember("errmsg") || !document.HasMember("data"))
+	{
+		LOG_INFO("json error!");
+		return;
+	}
+
+	rapidjson::Value& v_errcode = document["errcode"];
+	int errcode = v_errcode.GetInt();
+	if (errcode != 0)
+	{
+		LOG_INFO("response failed! message:" << document["errmsg"].GetString());
+		return;
+	}
+
+	//获得数据成功,把分类信息保存起来
+	rapidjson::Value& data = document["data"];
+
+	rapidjson::Value& v_rows = data["goods_types"];
+
+	for (rapidjson::SizeType i = 0; i < v_rows.Size(); ++i)
+	{
+		rapidjson::Value& v_row_i = v_rows[i];
+
+		std::string type_id = v_row_i["type_id"].GetString();
+		std::string name = v_row_i["name"].GetString();
+
+		CSetting::AddFoodtype(name, type_id);
+	}
+
     //获取厨房打印机的集合
     std::vector<ChufangPrinter> printers = CSetting::getChufangPrints();
 
@@ -1267,10 +1336,46 @@ void CMainWnd::InitSettingStatus()
             pFenlei->SetText(L"否");
         }
 
+		std::string foodtypeNames = "";
+
+		std::string foodtype_ids = newPrinter.fenlei_ids;
+
+		//这个是删除掉不存在的type_id之后的
+		std::string new_foodtype_ids = "";
+
+		std::vector<string> ids = CLewaimaiString::Split(foodtype_ids, ",");
+		for (std::vector<string>::iterator it = ids.begin(); it != ids.end(); it++)
+		{
+			std::string name = CSetting::getFoodtypeName((*it));
+			if (name == "zhipuzi_not_found_xxx")
+			{
+				//这种情况是以前保存的分类后来被删掉了
+			}
+			else
+			{
+				foodtypeNames += name + "  ";
+
+				new_foodtype_ids += (*it) + ",";
+			}
+		}
+
+		//删掉不存在的type_id,更新内存和数据库
+		new_foodtype_ids = new_foodtype_ids.substr(0, new_foodtype_ids.length() - 1);
+		if (new_foodtype_ids.compare(foodtype_ids) != 0)
+		{
+			CSetting::UpdateChufangPrinter(newPrinter.date, newPrinter.name, newPrinter.ip, newPrinter.guige, newPrinter.fendan, newPrinter.fenlei, new_foodtype_ids, true);
+		}
+
+		foodtypeNames = foodtypeNames.substr(0, foodtypeNames.size() - 1);		
+		std::wstring ws_foodtypeNames = CLewaimaiString::UTF8ToUnicode(foodtypeNames);
+
+		CLabelUI* pFenleiIds = static_cast<CLabelUI*>(pEle->FindSubControl(_T("setting_chufang_printer_item_fenlei_ids")));
+		pFenleiIds->SetText(ws_foodtypeNames.c_str());
+
+		//设置标记属性,用于修改时候匹配
 		pEle->AddCustomAttribute(L"date", CLewaimaiString::UTF8ToUnicode(newPrinter.date).c_str());
 
         pPrinterList->Add(pEle);
     }
-
 }