|
|
@@ -0,0 +1,1281 @@
|
|
|
+#include "../pch/pch.h"
|
|
|
+#include "CSettingPageUI.h"
|
|
|
+
|
|
|
+#include "../wnd/CChufangSettingWnd.h"
|
|
|
+
|
|
|
+CSettingPageUI::CSettingPageUI()
|
|
|
+{
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+CSettingPageUI::~CSettingPageUI()
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
+//初始化当前页面的展示,处理默认展示效果,在页面被加载的时候调用
|
|
|
+void CSettingPageUI::InitShow()
|
|
|
+{
|
|
|
+ CLabelUI* version = static_cast<CLabelUI*>(this->FindSubControl(_T("setting_version")));
|
|
|
+ version->SetText((L"版本号:" + CLewaimaiString::UTF8ToUnicode(CSystem::GetVersion())).c_str());
|
|
|
+
|
|
|
+ CCheckBoxUI* box = NULL;
|
|
|
+ CComboUI* com = NULL;
|
|
|
+ box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_new_waimai_voice")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_is_new_waimai_voice") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_new_waimai_autoconfirm")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_is_new_waimai_autoconfirm") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_new_waimai_dialog")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_is_new_waimai_dialog") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_new_waimai_printer")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_is_new_waimai_printer") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_printer_guige")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_printer_guige") == "58")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(0, false, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(1, false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_printer_lianshu")));
|
|
|
+ std::string setting_printer_lianshu = CSetting::GetParam("setting_printer_lianshu");
|
|
|
+
|
|
|
+ if (setting_printer_lianshu == "1")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(0, false, false);
|
|
|
+ com->SetText(L"1联");
|
|
|
+ }
|
|
|
+ else if (setting_printer_lianshu == "2")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(1, false, false);
|
|
|
+ com->SetText(L"2联");
|
|
|
+ }
|
|
|
+ else if (setting_printer_lianshu == "3")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(2, false, false);
|
|
|
+ com->SetText(L"3联");
|
|
|
+ }
|
|
|
+ else if (setting_printer_lianshu == "4")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(3, false, false);
|
|
|
+ com->SetText(L"4联");
|
|
|
+ }
|
|
|
+
|
|
|
+ com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_printer_leixing")));
|
|
|
+ std::string setting_printer_leixing = CSetting::GetParam("setting_printer_leixing");
|
|
|
+
|
|
|
+ CHorizontalLayoutUI* usb_layout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("setting_printer_usb_layout")));
|
|
|
+ CHorizontalLayoutUI* wangkou_layout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("setting_printer_wangkou_layout")));
|
|
|
+
|
|
|
+ if (setting_printer_leixing == "auto")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(0, false, false);
|
|
|
+ com->SetText(L"智能识别模式");
|
|
|
+
|
|
|
+ //智能识别模式隐藏这2个
|
|
|
+ usb_layout->SetVisible(false);
|
|
|
+ wangkou_layout->SetVisible(false);
|
|
|
+ }
|
|
|
+ else if (setting_printer_leixing == "usb")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(1, false, false);
|
|
|
+ com->SetText(L"usb");
|
|
|
+
|
|
|
+ //显示usb布局
|
|
|
+ usb_layout->SetVisible(true);
|
|
|
+ wangkou_layout->SetVisible(false);
|
|
|
+
|
|
|
+ //usb下拉框默认选中
|
|
|
+ CComboUI* com_usb = static_cast<CComboUI*>(this->FindSubControl(_T("setting_printer_usb")));
|
|
|
+ com_usb->RemoveAll();
|
|
|
+
|
|
|
+ //数据库中保存的之前的设置
|
|
|
+ std::string setting_printer_usb = CSetting::GetParam("setting_printer_usb");
|
|
|
+ std::wstring ws_setting_printer_usb = CLewaimaiString::UTF8ToUnicode(setting_printer_usb);
|
|
|
+
|
|
|
+ CPosPrinter printer;
|
|
|
+ printer.InitUsb();
|
|
|
+ std::vector<std::wstring> usb_devices = printer.getUsbDevices();
|
|
|
+
|
|
|
+ int i = 0;
|
|
|
+ int nSelect = -1;
|
|
|
+
|
|
|
+ for (std::vector<std::wstring>::iterator it = usb_devices.begin(); it != usb_devices.end(); it++)
|
|
|
+ {
|
|
|
+ CListLabelElementUI* elem = new CListLabelElementUI();
|
|
|
+ elem->SetText((*it).c_str());
|
|
|
+ com_usb->Add(elem);
|
|
|
+
|
|
|
+ if (*it == ws_setting_printer_usb)
|
|
|
+ {
|
|
|
+ nSelect = i;
|
|
|
+ }
|
|
|
+
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ com_usb->SetInternVisible(true);
|
|
|
+ com_usb->SelectItem(nSelect, false, false);
|
|
|
+ com_usb->SetText(CLewaimaiString::UTF8ToUnicode(setting_printer_usb).c_str());
|
|
|
+ }
|
|
|
+ else if (setting_printer_leixing == "bingkou")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(2, false, false);
|
|
|
+ com->SetText(L"并口");
|
|
|
+
|
|
|
+ usb_layout->SetVisible(false);
|
|
|
+ wangkou_layout->SetVisible(false);
|
|
|
+ }
|
|
|
+ else if (setting_printer_leixing == "chuankou")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(3, false, false);
|
|
|
+ com->SetText(L"串口");
|
|
|
+
|
|
|
+ usb_layout->SetVisible(false);
|
|
|
+ wangkou_layout->SetVisible(false);
|
|
|
+ }
|
|
|
+ else if (setting_printer_leixing == "wangkou")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(4, false, false);
|
|
|
+ com->SetText(L"网口");
|
|
|
+
|
|
|
+ usb_layout->SetVisible(false);
|
|
|
+ wangkou_layout->SetVisible(true);
|
|
|
+
|
|
|
+ std::string setting_printer_wangkou_ip = CSetting::GetParam("setting_printer_wangkou_ip");
|
|
|
+
|
|
|
+ CEditUI* ip_edit = static_cast<CEditUI*>(this->FindSubControl(_T("setting_printer_wangkou_ip")));
|
|
|
+ ip_edit->SetText(CLewaimaiString::UTF8ToUnicode(setting_printer_wangkou_ip).c_str());
|
|
|
+ }
|
|
|
+
|
|
|
+ box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_quhuo_big")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_printer_quhuo_big") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_dingdanhao_big")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_printer_dingdanhao_big") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_xiadanshijian_big")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_printer_xiadanshijian_big") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_peisongshijian_big")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_printer_peisongshijian_big") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_name_big")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_printer_name_big") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_phone_big")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_printer_phone_big") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_address_big")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_printer_address_big") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_shangpin_big")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_printer_shangpin_big") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_memo_big")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_printer_memo_big") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_price_big")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_printer_price_big") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_pay_big")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_printer_pay_big") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ //厨房打印机设置
|
|
|
+ box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_new_waimai_chufang_printer")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_is_new_waimai_chufang_printer") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_auto_start")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_is_auto_start") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_auto_login")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_is_auto_login") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_close_min")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_is_close_min") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ //初始化标签打印机的设置
|
|
|
+ box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_new_waimai_biaoqian_printer")));
|
|
|
+
|
|
|
+ if (CSetting::GetParam("setting_is_new_waimai_biaoqian_printer") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ //usb下拉框默认选中
|
|
|
+ CComboUI* com_usb = static_cast<CComboUI*>(this->FindSubControl(_T("setting_biaoqian_printer_usb")));
|
|
|
+ com_usb->RemoveAll();
|
|
|
+
|
|
|
+ //数据库中保存的之前的设置
|
|
|
+ std::string setting_biaoqian_printer_usb = CSetting::GetParam("setting_biaoqian_printer_usb");
|
|
|
+ std::wstring ws_setting_biaoqian_printer_usb = CLewaimaiString::UTF8ToUnicode(setting_biaoqian_printer_usb);
|
|
|
+
|
|
|
+ CPosPrinter printer;
|
|
|
+ printer.InitUsb(2);
|
|
|
+ std::vector<std::wstring> usb_devices = printer.getUsbDevices();
|
|
|
+
|
|
|
+ int i = 0;
|
|
|
+ int nSelect = -1;
|
|
|
+
|
|
|
+ for (std::vector<std::wstring>::iterator it = usb_devices.begin(); it != usb_devices.end(); it++)
|
|
|
+ {
|
|
|
+ CListLabelElementUI* elem = new CListLabelElementUI();
|
|
|
+ elem->SetText((*it).c_str());
|
|
|
+ com_usb->Add(elem);
|
|
|
+
|
|
|
+ if (*it == ws_setting_biaoqian_printer_usb)
|
|
|
+ {
|
|
|
+ nSelect = i;
|
|
|
+ }
|
|
|
+
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ com_usb->SetInternVisible(true);
|
|
|
+ com_usb->SelectItem(nSelect, false, false);
|
|
|
+ com_usb->SetText(CLewaimaiString::UTF8ToUnicode(setting_biaoqian_printer_usb).c_str());
|
|
|
+
|
|
|
+ com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_biaoqian_printer_guige")));
|
|
|
+ std::string setting_biaoqian_printer_guige = CSetting::GetParam("setting_biaoqian_printer_guige");
|
|
|
+
|
|
|
+ if (setting_biaoqian_printer_guige == "40*30mm")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(0, false, false);
|
|
|
+ com->SetText(L"40*30mm");
|
|
|
+ }
|
|
|
+ else if (setting_biaoqian_printer_guige == "35*25mm")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(1, false, false);
|
|
|
+ com->SetText(L"35*25mm");
|
|
|
+ }
|
|
|
+ else if (setting_biaoqian_printer_guige == "30*25mm")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(2, false, false);
|
|
|
+ com->SetText(L"30*25mm");
|
|
|
+ }
|
|
|
+ else if (setting_biaoqian_printer_guige == "30*20mm")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(3, false, false);
|
|
|
+ com->SetText(L"30*20mm");
|
|
|
+ }
|
|
|
+
|
|
|
+ com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_biaoqian_printer_fangxiang")));
|
|
|
+ std::string setting_biaoqian_printer_fangxiang = CSetting::GetParam("setting_biaoqian_printer_fangxiang");
|
|
|
+
|
|
|
+ if (setting_biaoqian_printer_fangxiang == "1")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(0, false, false);
|
|
|
+ com->SetText(L"正方向");
|
|
|
+ }
|
|
|
+ else if (setting_biaoqian_printer_fangxiang == "0")
|
|
|
+ {
|
|
|
+ com->SetInternVisible(true);
|
|
|
+ com->SelectItem(1, false, false);
|
|
|
+ com->SetText(L"反方向");
|
|
|
+ }
|
|
|
+
|
|
|
+ //这里开始,初始化厨房打印机的设置
|
|
|
+ CListUI* pPrinterList = static_cast<CListUI*>(this->FindSubControl(_T("setting_chufang_printer_list")));
|
|
|
+
|
|
|
+ //获取当前店铺的商品分类信息,用于设置厨房打印机的分类打印
|
|
|
+
|
|
|
+ //先清空一次分类(主要考虑退出登陆重新登录的情况)
|
|
|
+ CSetting::ClearFoodtype();
|
|
|
+
|
|
|
+ std::string shop_id = CZhipuziHttpClient::getShopId();
|
|
|
+ if (shop_id != "0")
|
|
|
+ {
|
|
|
+ std::map<string, string> params;
|
|
|
+ params["shop_id"] = shop_id;
|
|
|
+
|
|
|
+ std::string response;
|
|
|
+
|
|
|
+ std::string url = "/goodstype/getlist";
|
|
|
+
|
|
|
+ CZhipuziHttpClient::Request(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();
|
|
|
+
|
|
|
+ for (std::vector<ChufangPrinter>::iterator it = printers.begin(); it != printers.end(); it++)
|
|
|
+ {
|
|
|
+ ChufangPrinter newPrinter = *it;
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CListContainerElementUI* pEle = static_cast<CListContainerElementUI*>(builder.Create(_T("setting_chufang_printer_item.xml"), (UINT)0, NULL, m_pManager));
|
|
|
+
|
|
|
+ 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* pGuige = static_cast<CLabelUI*>(pEle->FindSubControl(_T("setting_chufang_printer_guige")));
|
|
|
+
|
|
|
+ if (newPrinter.guige == "58")
|
|
|
+ {
|
|
|
+ pGuige->SetText(L"58mm");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pGuige->SetText(L"80mm");
|
|
|
+ }
|
|
|
+
|
|
|
+ CLabelUI* pFendan = static_cast<CLabelUI*>(pEle->FindSubControl(_T("setting_chufang_printer_fendan")));
|
|
|
+
|
|
|
+ if (newPrinter.fendan == "1")
|
|
|
+ {
|
|
|
+ pFendan->SetText(L"是");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pFendan->SetText(L"否");
|
|
|
+ }
|
|
|
+
|
|
|
+ CLabelUI* pFenlei = static_cast<CLabelUI*>(pEle->FindSubControl(_T("setting_chufang_printer_item_fenlei")));
|
|
|
+
|
|
|
+ if (newPrinter.fenlei == "1")
|
|
|
+ {
|
|
|
+ pFenlei->SetText(L"是");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//处理按钮点击类事件
|
|
|
+void CSettingPageUI::HandleClickMsg(TNotifyUI& msg)
|
|
|
+{
|
|
|
+ CDuiString name = msg.pSender->GetName();
|
|
|
+
|
|
|
+ //开始处理设置页面的
|
|
|
+ if (name == _T("setting_is_new_waimai_voice"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_new_waimai_voice")));
|
|
|
+
|
|
|
+ //注意这里的IsSelected如果为true,表示的是点击前为true,而不是点击后为true,所以这里设置状态要反过来
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_is_new_waimai_voice", "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_is_new_waimai_voice", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_is_new_waimai_autoconfirm"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_new_waimai_autoconfirm")));
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_is_new_waimai_autoconfirm", "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_is_new_waimai_autoconfirm", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_is_new_waimai_dialog"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_new_waimai_dialog")));
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_is_new_waimai_dialog", "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_is_new_waimai_dialog", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_is_new_waimai_printer"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_new_waimai_printer")));
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_is_new_waimai_printer", "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_is_new_waimai_printer", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_printer_wangkouk_save_btn"))
|
|
|
+ {
|
|
|
+ CEditUI* wangkou_ip = static_cast<CEditUI*>(this->FindSubControl(_T("setting_printer_wangkou_ip")));
|
|
|
+ wstring ip = wangkou_ip->GetText();
|
|
|
+
|
|
|
+ CSetting::SetParam("setting_printer_wangkou_ip", CLewaimaiString::UnicodeToUTF8(ip));
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_printer_quhuo_big"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_quhuo_big")));
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_quhuo_big", "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_quhuo_big", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_printer_dingdanhao_big"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_dingdanhao_big")));
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_dingdanhao_big", "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_dingdanhao_big", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_printer_xiadanshijian_big"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_xiadanshijian_big")));
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_xiadanshijian_big", "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_xiadanshijian_big", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_printer_peisongshijian_big"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_peisongshijian_big")));
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_peisongshijian_big", "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_peisongshijian_big", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_printer_name_big"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_name_big")));
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_name_big", "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_name_big", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_printer_phone_big"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_phone_big")));
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_phone_big", "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_phone_big", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_printer_address_big"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_address_big")));
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_address_big", "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_address_big", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_printer_shangpin_big"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_shangpin_big")));
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_shangpin_big", "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_shangpin_big", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_printer_memo_big"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_memo_big")));
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_memo_big", "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_memo_big", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_printer_price_big"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_price_big")));
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_price_big", "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_price_big", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_printer_pay_big"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_printer_pay_big")));
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_pay_big", "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_pay_big", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_is_new_waimai_biaoqian_printer"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_new_waimai_biaoqian_printer")));
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_is_new_waimai_biaoqian_printer", "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_is_new_waimai_biaoqian_printer", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_is_new_waimai_chufang_printer"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_new_waimai_chufang_printer")));
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_is_new_waimai_chufang_printer", "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_is_new_waimai_chufang_printer", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_new_chufang_printer_btn"))
|
|
|
+ {
|
|
|
+ CChufangSettingWnd* pChufangFrame = new CChufangSettingWnd(1);
|
|
|
+
|
|
|
+ if (pChufangFrame != NULL)
|
|
|
+ {
|
|
|
+ pChufangFrame->Create(m_pManager->GetPaintWindow(), _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*>(this->FindSubControl(_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_pManager));
|
|
|
+
|
|
|
+ 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* pGuige = static_cast<CLabelUI*>(pEle->FindSubControl(_T("setting_chufang_printer_guige")));
|
|
|
+
|
|
|
+ if (newPrinter.guige == "58")
|
|
|
+ {
|
|
|
+ pGuige->SetText(L"58mm");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pGuige->SetText(L"80mm");
|
|
|
+ }
|
|
|
+
|
|
|
+ CLabelUI* pFendan = static_cast<CLabelUI*>(pEle->FindSubControl(_T("setting_chufang_printer_fendan")));
|
|
|
+
|
|
|
+ if (newPrinter.fendan == "1")
|
|
|
+ {
|
|
|
+ pFendan->SetText(L"是");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pFendan->SetText(L"否");
|
|
|
+ }
|
|
|
+
|
|
|
+ CLabelUI* pFenlei = static_cast<CLabelUI*>(pEle->FindSubControl(_T("setting_chufang_printer_item_fenlei")));
|
|
|
+
|
|
|
+ if (newPrinter.fenlei == "1")
|
|
|
+ {
|
|
|
+ pFenlei->SetText(L"是");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ 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());
|
|
|
+
|
|
|
+ pEle->AddCustomAttribute(L"date", CLewaimaiString::UTF8ToUnicode(newPrinter.date).c_str());
|
|
|
+ pPrinterList->Add(pEle);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_is_auto_start"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_auto_start")));
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_is_auto_start", "0");
|
|
|
+ CSystem::cancelAutoStart();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_is_auto_start", "1");
|
|
|
+ CSystem::autostart();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_is_auto_login"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_auto_login")));
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_is_auto_login", "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_is_auto_login", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_is_close_min"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_close_min")));
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_is_close_min", "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_is_close_min", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_chufang_printer_item_update_btn"))
|
|
|
+ {
|
|
|
+ CListUI* pPrinterList = static_cast<CListUI*>(this->FindSubControl(_T("setting_chufang_printer_list")));
|
|
|
+ CListContainerElementUI* pEle = static_cast<CListContainerElementUI*>(msg.pSender->GetParent()->GetParent()->GetParent());
|
|
|
+ wstring date = pEle->GetCustomAttribute(L"date");
|
|
|
+ CChufangSettingWnd* pChufangFrame = new CChufangSettingWnd(2);
|
|
|
+ pChufangFrame->SetPrinterDate(CLewaimaiString::UnicodeToUTF8(date));
|
|
|
+
|
|
|
+ if (pChufangFrame != NULL)
|
|
|
+ {
|
|
|
+ pChufangFrame->Create(m_pManager->GetPaintWindow(), _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*>(this->FindSubControl(_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")));
|
|
|
+ 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* pGuige = static_cast<CLabelUI*>(pEle->FindSubControl(_T("setting_chufang_printer_guige")));
|
|
|
+
|
|
|
+ if (newPrinter.guige == "58")
|
|
|
+ {
|
|
|
+ pGuige->SetText(L"58mm");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pGuige->SetText(L"80mm");
|
|
|
+ }
|
|
|
+
|
|
|
+ CLabelUI* pFendan = static_cast<CLabelUI*>(pEle->FindSubControl(_T("setting_chufang_printer_fendan")));
|
|
|
+
|
|
|
+ if (newPrinter.fendan == "1")
|
|
|
+ {
|
|
|
+ pFendan->SetText(L"是");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pFendan->SetText(L"否");
|
|
|
+ }
|
|
|
+
|
|
|
+ CLabelUI* pFenlei = static_cast<CLabelUI*>(pEle->FindSubControl(_T("setting_chufang_printer_item_fenlei")));
|
|
|
+
|
|
|
+ if (newPrinter.fenlei == "1")
|
|
|
+ {
|
|
|
+ pFenlei->SetText(L"是");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ 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());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_chufang_printer_item_delete_btn"))
|
|
|
+ {
|
|
|
+ CListUI* pPrinterList = static_cast<CListUI*>(this->FindSubControl(_T("setting_chufang_printer_list")));
|
|
|
+ CListContainerElementUI* pEle = static_cast<CListContainerElementUI*>(msg.pSender->GetParent()->GetParent()->GetParent());
|
|
|
+ wstring date = pEle->GetCustomAttribute(L"date");
|
|
|
+ //获得了ID,这个时候从内存和数据库中分别删除对应的记录
|
|
|
+ CSetting::DelChufangPrinter(CLewaimaiString::UnicodeToUTF8(date));
|
|
|
+ pPrinterList->Remove(pEle);
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_logout"))
|
|
|
+ {
|
|
|
+ //退出登录
|
|
|
+ m_pMainWnd->LoginOut(1);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//处理option切换事件
|
|
|
+void CSettingPageUI::HandleSelectChangeMsg(TNotifyUI& msg)
|
|
|
+{
|
|
|
+ CDuiString name = msg.pSender->GetName();
|
|
|
+
|
|
|
+ //判断设置中心的tab
|
|
|
+ if (name == _T("setting_waimai_order_switch"))
|
|
|
+ {
|
|
|
+ CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(this->FindSubControl(_T("setting_switch")));
|
|
|
+ pControl->SelectItem(0);
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_printer_switch"))
|
|
|
+ {
|
|
|
+ CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(this->FindSubControl(_T("setting_switch")));
|
|
|
+ pControl->SelectItem(1);
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_biaoqian_printer_switch"))
|
|
|
+ {
|
|
|
+ CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(this->FindSubControl(_T("setting_switch")));
|
|
|
+ pControl->SelectItem(2);
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_chufang_printer_switch"))
|
|
|
+ {
|
|
|
+ CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(this->FindSubControl(_T("setting_switch")));
|
|
|
+ pControl->SelectItem(3);
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_system_switch"))
|
|
|
+ {
|
|
|
+ CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(this->FindSubControl(_T("setting_switch")));
|
|
|
+ pControl->SelectItem(4);
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_system_about"))
|
|
|
+ {
|
|
|
+ CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(this->FindSubControl(_T("setting_switch")));
|
|
|
+ pControl->SelectItem(5);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//处理下拉框、radio的切换事件
|
|
|
+void CSettingPageUI::HandleItemSelectMsg(TNotifyUI& msg)
|
|
|
+{
|
|
|
+ CDuiString name = msg.pSender->GetName();
|
|
|
+
|
|
|
+ if (name == _T("setting_printer_guige"))
|
|
|
+ {
|
|
|
+ CComboUI* com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_printer_guige")));
|
|
|
+
|
|
|
+ if (com->GetCurSel() == 0)
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_guige", "58");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_guige", "80");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_printer_lianshu"))
|
|
|
+ {
|
|
|
+ CComboUI* com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_printer_lianshu")));
|
|
|
+
|
|
|
+ if (com->GetCurSel() == 0)
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_lianshu", "1");
|
|
|
+ }
|
|
|
+ else if (com->GetCurSel() == 1)
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_lianshu", "2");
|
|
|
+ }
|
|
|
+ else if (com->GetCurSel() == 2)
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_lianshu", "3");
|
|
|
+ }
|
|
|
+ else if (com->GetCurSel() == 3)
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_lianshu", "4");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_printer_leixing"))
|
|
|
+ {
|
|
|
+ CComboUI* com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_printer_leixing")));
|
|
|
+
|
|
|
+ CHorizontalLayoutUI* usb_layout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("setting_printer_usb_layout")));
|
|
|
+ CHorizontalLayoutUI* wangkou_layout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("setting_printer_wangkou_layout")));
|
|
|
+
|
|
|
+ if (com->GetCurSel() == 0)
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_leixing", "auto");
|
|
|
+
|
|
|
+ usb_layout->SetVisible(false);
|
|
|
+ wangkou_layout->SetVisible(false);
|
|
|
+ }
|
|
|
+ else if (com->GetCurSel() == 1)
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_leixing", "usb");
|
|
|
+
|
|
|
+ //显示usb布局
|
|
|
+ usb_layout->SetVisible(true);
|
|
|
+ wangkou_layout->SetVisible(false);
|
|
|
+
|
|
|
+ //usb下拉框默认选中
|
|
|
+ CComboUI* com_usb = static_cast<CComboUI*>(this->FindSubControl(_T("setting_printer_usb")));
|
|
|
+ com_usb->RemoveAll();
|
|
|
+
|
|
|
+ //数据库中保存的之前的设置
|
|
|
+ std::string setting_printer_usb = CSetting::GetParam("setting_printer_usb");
|
|
|
+ std::wstring ws_setting_printer_usb = CLewaimaiString::UTF8ToUnicode(setting_printer_usb);
|
|
|
+
|
|
|
+ CPosPrinter printer;
|
|
|
+ printer.InitUsb();
|
|
|
+ std::vector<std::wstring> usb_devices = printer.getUsbDevices();
|
|
|
+
|
|
|
+ int i = 0;
|
|
|
+ int nSelect = -1;
|
|
|
+
|
|
|
+ for (std::vector<std::wstring>::iterator it = usb_devices.begin(); it != usb_devices.end(); it++)
|
|
|
+ {
|
|
|
+ CListLabelElementUI* elem = new CListLabelElementUI();
|
|
|
+ elem->SetText((*it).c_str());
|
|
|
+ com_usb->Add(elem);
|
|
|
+
|
|
|
+ if (*it == ws_setting_printer_usb)
|
|
|
+ {
|
|
|
+ nSelect = i;
|
|
|
+ }
|
|
|
+
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ com_usb->SetInternVisible(true);
|
|
|
+ com_usb->SelectItem(nSelect, false, false);
|
|
|
+ com_usb->SetText(CLewaimaiString::UTF8ToUnicode(setting_printer_usb).c_str());
|
|
|
+ }
|
|
|
+ else if (com->GetCurSel() == 2)
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_leixing", "bingkou");
|
|
|
+
|
|
|
+ usb_layout->SetVisible(false);
|
|
|
+ wangkou_layout->SetVisible(false);
|
|
|
+ }
|
|
|
+ else if (com->GetCurSel() == 3)
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_leixing", "chuankou");
|
|
|
+
|
|
|
+ usb_layout->SetVisible(false);
|
|
|
+ wangkou_layout->SetVisible(false);
|
|
|
+ }
|
|
|
+ else if (com->GetCurSel() == 4)
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_printer_leixing", "wangkou");
|
|
|
+
|
|
|
+ usb_layout->SetVisible(false);
|
|
|
+ wangkou_layout->SetVisible(true);
|
|
|
+
|
|
|
+ std::string setting_printer_wangkou_ip = CSetting::GetParam("setting_printer_wangkou_ip");
|
|
|
+
|
|
|
+ CEditUI* ip_edit = static_cast<CEditUI*>(this->FindSubControl(_T("setting_printer_wangkou_ip")));
|
|
|
+ ip_edit->SetText(CLewaimaiString::UTF8ToUnicode(setting_printer_wangkou_ip).c_str());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_printer_usb"))
|
|
|
+ {
|
|
|
+ CComboUI* com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_printer_usb")));
|
|
|
+ wstring usb_device = com->GetText();
|
|
|
+
|
|
|
+ CSetting::SetParam("setting_printer_usb", CLewaimaiString::UnicodeToUTF8(usb_device));
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_biaoqian_printer_usb"))
|
|
|
+ {
|
|
|
+ CComboUI* com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_biaoqian_printer_usb")));
|
|
|
+ wstring usb_device = com->GetText();;
|
|
|
+
|
|
|
+ CSetting::SetParam("setting_biaoqian_printer_usb", CLewaimaiString::UnicodeToUTF8(usb_device));
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_biaoqian_printer_guige"))
|
|
|
+ {
|
|
|
+ CComboUI* com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_biaoqian_printer_guige")));
|
|
|
+
|
|
|
+ if (com->GetCurSel() == 0)
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_biaoqian_printer_guige", "40*30mm");
|
|
|
+ }
|
|
|
+ else if (com->GetCurSel() == 1)
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_biaoqian_printer_guige", "35*25mm");
|
|
|
+ }
|
|
|
+ else if (com->GetCurSel() == 2)
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_biaoqian_printer_guige", "30*25mm");
|
|
|
+ }
|
|
|
+ else if (com->GetCurSel() == 3)
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_biaoqian_printer_guige", "30*20mm");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == _T("setting_biaoqian_printer_fangxiang"))
|
|
|
+ {
|
|
|
+ CComboUI* com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_biaoqian_printer_fangxiang")));
|
|
|
+
|
|
|
+ if (com->GetCurSel() == 0)
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_biaoqian_printer_fangxiang", "1");
|
|
|
+ }
|
|
|
+ else if (com->GetCurSel() == 1)
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_biaoqian_printer_fangxiang", "0");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|