|
|
@@ -94,6 +94,11 @@ LRESULT CZhengcanSaomadiancanWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARA
|
|
|
}
|
|
|
else if (wParam == VK_ESCAPE)
|
|
|
{
|
|
|
+ if (m_is_wangluoqingqiu == true)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
Close(IDCANCEL);
|
|
|
return true;
|
|
|
}
|
|
|
@@ -137,6 +142,11 @@ void CZhengcanSaomadiancanWnd::Notify(TNotifyUI& msg)
|
|
|
|
|
|
if (senderName == _T("closebtn"))
|
|
|
{
|
|
|
+ if (m_is_wangluoqingqiu == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
Close(IDCANCEL);
|
|
|
return;
|
|
|
}
|
|
|
@@ -146,13 +156,17 @@ void CZhengcanSaomadiancanWnd::Notify(TNotifyUI& msg)
|
|
|
}
|
|
|
else if (senderName == _T("zhengcan_saomadiancanorder_delete"))
|
|
|
{
|
|
|
-
|
|
|
+ std::wstring order_id = msg.pSender->GetCustomAttribute(L"order_id");
|
|
|
+ std::wstring jiacai_no = msg.pSender->GetCustomAttribute(L"jiacai_no");
|
|
|
+
|
|
|
+ this->JujueOrder(CLewaimaiString::UnicodeToUTF8(order_id), CLewaimaiString::UnicodeToUTF8(jiacai_no));
|
|
|
}
|
|
|
else if (senderName == _T("zhengcan_saomadiancanorder_queren"))
|
|
|
{
|
|
|
-
|
|
|
+ std::wstring order_id = msg.pSender->GetCustomAttribute(L"order_id");
|
|
|
+ std::wstring jiacai_no = msg.pSender->GetCustomAttribute(L"jiacai_no");
|
|
|
|
|
|
- Close(IDOK);
|
|
|
+ this->QuerenOrder(CLewaimaiString::UnicodeToUTF8(order_id), CLewaimaiString::UnicodeToUTF8(jiacai_no));
|
|
|
}
|
|
|
}
|
|
|
else if (msg.sType == _T("textchanged"))
|
|
|
@@ -168,6 +182,14 @@ void CZhengcanSaomadiancanWnd::Init()
|
|
|
|
|
|
void CZhengcanSaomadiancanWnd::RefreshOrder()
|
|
|
{
|
|
|
+ std::thread t(&CZhengcanSaomadiancanWnd::DoRefreshOrder, this);
|
|
|
+ t.detach();
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanSaomadiancanWnd::DoRefreshOrder()
|
|
|
+{
|
|
|
+ m_is_wangluoqingqiu = true;
|
|
|
+
|
|
|
//请求服务器获取所有未处理的订单信息
|
|
|
std::map<string, string> params;
|
|
|
|
|
|
@@ -179,6 +201,8 @@ void CZhengcanSaomadiancanWnd::RefreshOrder()
|
|
|
bool ret = CZhipuziHttpClient::GetInstance()->Request(url.c_str(), params, response);
|
|
|
if (ret == false)
|
|
|
{
|
|
|
+ m_is_wangluoqingqiu = false;
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -187,12 +211,14 @@ void CZhengcanSaomadiancanWnd::RefreshOrder()
|
|
|
|
|
|
if (document.HasParseError())
|
|
|
{
|
|
|
+ m_is_wangluoqingqiu = false;
|
|
|
LOG_INFO("parse response error!");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (!document.HasMember("errcode") || !document.HasMember("errmsg"))
|
|
|
{
|
|
|
+ m_is_wangluoqingqiu = false;
|
|
|
LOG_INFO("json error!");
|
|
|
return;
|
|
|
}
|
|
|
@@ -201,11 +227,13 @@ void CZhengcanSaomadiancanWnd::RefreshOrder()
|
|
|
int errcode = v_errcode.GetInt();
|
|
|
if (errcode != 0)
|
|
|
{
|
|
|
+ m_is_wangluoqingqiu = false;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (!document.HasMember("data"))
|
|
|
{
|
|
|
+ m_is_wangluoqingqiu = false;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -232,6 +260,12 @@ void CZhengcanSaomadiancanWnd::RefreshOrder()
|
|
|
CHorizontalLayoutUI* pEle = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("zhengcan_saomadiancan_wnd_order_item.xml"), (UINT)0, NULL, &m_pm));
|
|
|
pOrderLayout->Add(pEle);
|
|
|
|
|
|
+ CLabelUI* pTableName = static_cast<CLabelUI*>(pEle->FindSubControl(_T("zhengcan_saomadiancanorder_tablename")));
|
|
|
+ pTableName->SetText(CLewaimaiString::UTF8ToUnicode(table_name).c_str());
|
|
|
+
|
|
|
+ CLabelUI* pTime = static_cast<CLabelUI*>(pEle->FindSubControl(_T("zhengcan_saomadiancanorder_time")));
|
|
|
+ pTime->SetText(CLewaimaiString::UTF8ToUnicode(init_time).c_str());
|
|
|
+
|
|
|
rapidjson::Value& food_list = orderinfo["item"]["food_list"];
|
|
|
rapidjson::Value& foodpackage_array = orderinfo["item"]["foodpackage_array"];
|
|
|
|
|
|
@@ -242,7 +276,7 @@ void CZhengcanSaomadiancanWnd::RefreshOrder()
|
|
|
pEle->SetFixedHeight((food_list.Size() + foodpackage_array.Size()) * 40 + 112);
|
|
|
|
|
|
//先添加普通商品的详情
|
|
|
- for (rapidjson::SizeType i = 0; i < food_list.Size(); ++j)
|
|
|
+ for (rapidjson::SizeType i = 0; i < food_list.Size(); ++i)
|
|
|
{
|
|
|
rapidjson::Value& food_list_item = food_list[i];
|
|
|
|
|
|
@@ -262,9 +296,9 @@ void CZhengcanSaomadiancanWnd::RefreshOrder()
|
|
|
}
|
|
|
|
|
|
//再添加套餐的详情
|
|
|
- for (rapidjson::SizeType i = 0; i < foodpackage_array.Size(); ++j)
|
|
|
+ for (rapidjson::SizeType i = 0; i < foodpackage_array.Size(); ++i)
|
|
|
{
|
|
|
- rapidjson::Value& food_list_item = food_list[i];
|
|
|
+ rapidjson::Value& foodpackage_array_item = foodpackage_array[i];
|
|
|
|
|
|
CDialogBuilder builder1;
|
|
|
|
|
|
@@ -272,18 +306,15 @@ void CZhengcanSaomadiancanWnd::RefreshOrder()
|
|
|
CHorizontalLayoutUI* pFoodEle = static_cast<CHorizontalLayoutUI*>(builder1.Create(_T("zhengcan_saomadiancan_wnd_food_item.xml"), (UINT)0, NULL, &m_pm));
|
|
|
pFoodLayout->Add(pFoodEle);
|
|
|
|
|
|
- std::string food_name = CLewaimaiJson::ToString(food_list_item["food_name"]);
|
|
|
- std::string num = CLewaimaiJson::ToString(food_list_item["quantity"]);
|
|
|
- std::string price = CLewaimaiString::DoubleToString(atof(CLewaimaiJson::ToString(food_list_item["single_price"]).c_str()) * atof(num.c_str()), 2);
|
|
|
+ std::string food_name = CLewaimaiJson::ToString(foodpackage_array_item["food_name"]);
|
|
|
+ std::string num = CLewaimaiJson::ToString(foodpackage_array_item["quantity"]);
|
|
|
+ std::string price = CLewaimaiString::DoubleToString(atof(CLewaimaiJson::ToString(foodpackage_array_item["single_price"]).c_str()) * atof(num.c_str()), 2);
|
|
|
|
|
|
pFoodEle->FindSubControl(L"food_name")->SetText(CLewaimaiString::UTF8ToUnicode(food_name).c_str());
|
|
|
pFoodEle->FindSubControl(L"food_num")->SetText(CLewaimaiString::UTF8ToUnicode(num).c_str());
|
|
|
pFoodEle->FindSubControl(L"food_price")->SetText(CLewaimaiString::UTF8ToUnicode(price).c_str());
|
|
|
}
|
|
|
|
|
|
- CLabelUI* pTime = static_cast<CLabelUI*>(pEle->FindSubControl(_T("zhengcan_saomadiancanorder_time")));
|
|
|
- pTime->SetText(CLewaimaiString::UTF8ToUnicode(init_time).c_str());
|
|
|
-
|
|
|
//给按钮加属性,点击的时候好判断并且处理
|
|
|
CButtonUI* pDelete = static_cast<CButtonUI*>(pEle->FindSubControl(_T("zhengcan_saomadiancanorder_delete")));
|
|
|
pDelete->AddCustomAttribute(L"order_id", CLewaimaiString::UTF8ToUnicode(order_id).c_str());
|
|
|
@@ -293,10 +324,22 @@ void CZhengcanSaomadiancanWnd::RefreshOrder()
|
|
|
pQueren->AddCustomAttribute(L"order_id", CLewaimaiString::UTF8ToUnicode(order_id).c_str());
|
|
|
pQueren->AddCustomAttribute(L"jiacai_no", CLewaimaiString::UTF8ToUnicode(jiacai_no).c_str());
|
|
|
}
|
|
|
+
|
|
|
+ m_is_wangluoqingqiu = false;
|
|
|
}
|
|
|
|
|
|
void CZhengcanSaomadiancanWnd::SetTitle(std::wstring title)
|
|
|
{
|
|
|
CLabelUI* pLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("memo_dlg_title")));
|
|
|
pLabel->SetText(title.c_str());
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanSaomadiancanWnd::QuerenOrder(std::string order_id, std::string jiacai_no)
|
|
|
+{
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanSaomadiancanWnd::JujueOrder(std::string order_id, std::string jiacai_no)
|
|
|
+{
|
|
|
+
|
|
|
}
|