|
|
@@ -614,6 +614,67 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
|
|
|
|
|
|
CSetting::SetParam("setting_biaoqian_printer_wangkou_ip", CLewaimaiString::UnicodeToUTF8(ip));
|
|
|
}
|
|
|
+ else if (name == _T("setting_biaoqian_printer_is_type"))
|
|
|
+ {
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_biaoqian_printer_is_type")));
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_biaoqian_printer_is_type", "0");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSetting::SetParam("setting_biaoqian_printer_is_type", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (name == L"biaoqian_setting_fenleli_xuanze_checkbox")
|
|
|
+ {
|
|
|
+ std::wstring ws_type_id = msg.pSender->GetCustomAttribute(L"type_id");
|
|
|
+ std::string type_id = CLewaimaiString::UnicodeToUTF8(ws_type_id);
|
|
|
+
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(msg.pSender);
|
|
|
+
|
|
|
+ if (box->IsSelected())
|
|
|
+ {
|
|
|
+ //这里是从选中变为不选中,那么就删掉这个type_id
|
|
|
+ std::string type_ids = CSetting::GetParam("setting_biaoqian_printer_type_ids");
|
|
|
+ std::vector<string> type_vector = CLewaimaiString::Split(type_ids, ",");
|
|
|
+
|
|
|
+ int num = 0;
|
|
|
+ for (std::vector<string>::iterator it = type_vector.begin(); it != type_vector.end(); it++)
|
|
|
+ {
|
|
|
+ if (*it == type_id)
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ type_vector.erase(type_vector.begin() + num);
|
|
|
+
|
|
|
+ std::string new_type_ids = CLewaimaiString::Merge(type_vector, ",");
|
|
|
+
|
|
|
+ CSetting::SetParam("setting_biaoqian_printer_type_ids", new_type_ids);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //这是从不选中变为选中
|
|
|
+ std::string type_ids = CSetting::GetParam("setting_biaoqian_printer_type_ids");
|
|
|
+
|
|
|
+ std::string new_type_ids;
|
|
|
+ if (type_ids == "")
|
|
|
+ {
|
|
|
+ new_type_ids = type_id;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ new_type_ids = type_ids + "," + type_id;
|
|
|
+ }
|
|
|
+
|
|
|
+ CSetting::SetParam("setting_biaoqian_printer_type_ids", new_type_ids);
|
|
|
+ }
|
|
|
+ }
|
|
|
else if(name == _T("setting_is_new_waimai_chufang_printer"))
|
|
|
{
|
|
|
CCheckBoxUI* box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_new_waimai_chufang_printer")));
|
|
|
@@ -2095,13 +2156,20 @@ void CMainWnd::InitSettingStatus()
|
|
|
com->SetText(L"反方向");
|
|
|
}
|
|
|
|
|
|
- //这里开始,初始化厨房打印机的设置
|
|
|
- CListUI* pPrinterList = static_cast<CListUI*>(m_pm.FindControl(_T("setting_chufang_printer_list")));
|
|
|
+ box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_biaoqian_printer_is_type")));
|
|
|
+ if (CSetting::GetParam("setting_biaoqian_printer_is_type") == "1")
|
|
|
+ {
|
|
|
+ box->Selected(true, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ box->Selected(false, false);
|
|
|
+ }
|
|
|
|
|
|
- //获取当前店铺的商品分类信息,用于设置厨房打印机的分类打印
|
|
|
+ //获取当前店铺的商品分类信息,用于设置标签打印机和厨房打印机的分类打印
|
|
|
|
|
|
- //先清空一次分类(主要考虑退出登陆重新登录的情况)
|
|
|
- CSetting::ClearFoodtype();
|
|
|
+ //先清空一次分类(主要考虑退出登陆重新登录的情况)
|
|
|
+ CSetting::ClearFoodtype();
|
|
|
|
|
|
std::string shop_id = CLewaimaiHttpClient::getShopIdS();
|
|
|
if (shop_id != "0")
|
|
|
@@ -2156,6 +2224,68 @@ void CMainWnd::InitSettingStatus()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ std::string type_ids = CSetting::GetParam("setting_biaoqian_printer_type_ids");
|
|
|
+ std::vector<string> type_vector = CLewaimaiString::Split(type_ids, ",");
|
|
|
+
|
|
|
+ //删除已经不存在的type_ids
|
|
|
+ std::string new_foodtype_ids;
|
|
|
+ CSqlite3 sqlite;
|
|
|
+ for (std::vector<string>::iterator it = type_vector.begin(); it != type_vector.end(); it++)
|
|
|
+ {
|
|
|
+ std::string name = CSetting::getFoodtypeName((*it));
|
|
|
+
|
|
|
+ if (name == "zhipuzi_not_found_xxx")
|
|
|
+ {
|
|
|
+ //这种情况是以前保存的分类后来被删掉了
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ new_foodtype_ids += (*it) + ",";
|
|
|
+ }
|
|
|
+
|
|
|
+ //删掉不存在的type_id,更新内存和数据库
|
|
|
+ new_foodtype_ids = new_foodtype_ids.substr(0, new_foodtype_ids.length() - 1);
|
|
|
+ CSetting::SetParam("setting_biaoqian_printer_type_ids", new_foodtype_ids);
|
|
|
+
|
|
|
+ //重新赋值
|
|
|
+ type_ids = new_foodtype_ids;
|
|
|
+ type_vector = CLewaimaiString::Split(type_ids, ",");
|
|
|
+
|
|
|
+ std::map<string, int> type_map;
|
|
|
+ for (std::vector<string>::iterator it = type_vector.begin(); it != type_vector.end(); it++)
|
|
|
+ {
|
|
|
+ type_map[*it] = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ //把所有分类显示出来
|
|
|
+ CVerticalLayoutUI* pFenleiLayout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("setting_biaoqian_printer_type_layout")));
|
|
|
+ pFenleiLayout->RemoveAll();
|
|
|
+
|
|
|
+ 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("biaoqian_printer_setting_fenlei_select.xml"), (UINT)0, NULL, &m_pm));
|
|
|
+
|
|
|
+ CCheckBoxUI* pCheck = static_cast<CCheckBoxUI*>(pEle->FindSubControl(_T("biaoqian_setting_fenleli_xuanze_checkbox")));
|
|
|
+ pCheck->AddCustomAttribute(L"type_id", CLewaimaiString::UTF8ToUnicode((*it).type_id).c_str());
|
|
|
+
|
|
|
+ if (type_map.find((*it).type_id) != type_map.end())
|
|
|
+ {
|
|
|
+ pCheck->Selected(true, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ CLabelUI* pName = static_cast<CLabelUI*>(pEle->FindSubControl(_T("biaoqian_setting_fenleli_xuanze_name")));
|
|
|
+ pName->SetText(CLewaimaiString::UTF8ToUnicode((*it).name).c_str());
|
|
|
+
|
|
|
+ pFenleiLayout->Add(pEle);
|
|
|
+ }
|
|
|
+
|
|
|
+ pFenleiLayout->SetFixedHeight(foodtypes.size() * 30);
|
|
|
+
|
|
|
+ //这里开始,初始化厨房打印机的设置
|
|
|
+ CListUI* pPrinterList = static_cast<CListUI*>(m_pm.FindControl(_T("setting_chufang_printer_list")));
|
|
|
+
|
|
|
//获取厨房打印机的集合
|
|
|
std::vector<ChufangPrinter> printers = CSetting::getChufangPrints();
|
|
|
|