|
|
@@ -554,17 +554,6 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
|
|
|
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"否");
|
|
|
- }
|
|
|
-
|
|
|
pEle->AddCustomAttribute(L"date", CLewaimaiString::UTF8ToUnicode(newPrinter.date).c_str());
|
|
|
|
|
|
pPrinterList->Add(pEle);
|
|
|
@@ -671,41 +660,6 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
|
|
|
{
|
|
|
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 == "lewaimai_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());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1399,52 +1353,6 @@ 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";
|
|
|
-
|
|
|
- CLewaimaiHttpClient::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();
|
|
|
|
|
|
@@ -1483,53 +1391,6 @@ void CMainWnd::InitSettingStatus()
|
|
|
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 == "lewaimai_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());
|
|
|
|