|
@@ -6,6 +6,7 @@
|
|
|
#include "../tool/CSqlite3.h"
|
|
#include "../tool/CSqlite3.h"
|
|
|
|
|
|
|
|
#include "../wnd/CZhengcanKaitaiWnd.h"
|
|
#include "../wnd/CZhengcanKaitaiWnd.h"
|
|
|
|
|
+#include "../wnd/CAttentionWnd.h"
|
|
|
|
|
|
|
|
CZhengcanPageUI::CZhengcanPageUI()
|
|
CZhengcanPageUI::CZhengcanPageUI()
|
|
|
{
|
|
{
|
|
@@ -250,13 +251,6 @@ void CZhengcanPageUI::RefreshTableShow()
|
|
|
|
|
|
|
|
void CZhengcanPageUI::DoRefreshTable()
|
|
void CZhengcanPageUI::DoRefreshTable()
|
|
|
{
|
|
{
|
|
|
- m_table_mutex.lock();
|
|
|
|
|
-
|
|
|
|
|
- m_tableLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("zhengcan_tablelist")));
|
|
|
|
|
- m_tableLayout->RemoveAll();
|
|
|
|
|
-
|
|
|
|
|
- m_table_items.clear();
|
|
|
|
|
-
|
|
|
|
|
std::map<string, string> params;
|
|
std::map<string, string> params;
|
|
|
|
|
|
|
|
if (m_cur_type_id == "all")
|
|
if (m_cur_type_id == "all")
|
|
@@ -274,7 +268,6 @@ void CZhengcanPageUI::DoRefreshTable()
|
|
|
bool ret = CZhipuziHttpClient::GetInstance()->Request(url.c_str(), params, response);
|
|
bool ret = CZhipuziHttpClient::GetInstance()->Request(url.c_str(), params, response);
|
|
|
if (ret == false)
|
|
if (ret == false)
|
|
|
{
|
|
{
|
|
|
- m_table_mutex.unlock();
|
|
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -284,14 +277,12 @@ void CZhengcanPageUI::DoRefreshTable()
|
|
|
if (document.HasParseError())
|
|
if (document.HasParseError())
|
|
|
{
|
|
{
|
|
|
LOG_INFO("parse response error!");
|
|
LOG_INFO("parse response error!");
|
|
|
- m_table_mutex.unlock();
|
|
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (!document.HasMember("errcode") || !document.HasMember("errmsg"))
|
|
if (!document.HasMember("errcode") || !document.HasMember("errmsg"))
|
|
|
{
|
|
{
|
|
|
LOG_INFO("json error!");
|
|
LOG_INFO("json error!");
|
|
|
- m_table_mutex.unlock();
|
|
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -299,16 +290,22 @@ void CZhengcanPageUI::DoRefreshTable()
|
|
|
int errcode = v_errcode.GetInt();
|
|
int errcode = v_errcode.GetInt();
|
|
|
if (errcode != 0)
|
|
if (errcode != 0)
|
|
|
{
|
|
{
|
|
|
- m_table_mutex.unlock();
|
|
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (!document.HasMember("data"))
|
|
if (!document.HasMember("data"))
|
|
|
{
|
|
{
|
|
|
- m_table_mutex.unlock();
|
|
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //网络请求结束,要进行处理了,加锁
|
|
|
|
|
+ m_table_mutex.lock();
|
|
|
|
|
+
|
|
|
|
|
+ m_tableLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("zhengcan_tablelist")));
|
|
|
|
|
+ m_tableLayout->RemoveAll();
|
|
|
|
|
+
|
|
|
|
|
+ m_table_items.clear();
|
|
|
|
|
+
|
|
|
rapidjson::Value& data = document["data"];
|
|
rapidjson::Value& data = document["data"];
|
|
|
rapidjson::Value& table = data["table"];
|
|
rapidjson::Value& table = data["table"];
|
|
|
|
|
|
|
@@ -430,6 +427,7 @@ void CZhengcanPageUI::ClickTableAction()
|
|
|
std::string status = m_cur_click_table_item->GetStatus();
|
|
std::string status = m_cur_click_table_item->GetStatus();
|
|
|
std::string order_id = m_cur_click_table_item->GetOrderId();
|
|
std::string order_id = m_cur_click_table_item->GetOrderId();
|
|
|
std::string table_name = m_cur_click_table_item->GetTableName();
|
|
std::string table_name = m_cur_click_table_item->GetTableName();
|
|
|
|
|
+ std::string order_status = m_cur_click_table_item->GetOrderStatus();
|
|
|
|
|
|
|
|
if (m_nModel == 1)
|
|
if (m_nModel == 1)
|
|
|
{
|
|
{
|
|
@@ -481,8 +479,42 @@ void CZhengcanPageUI::ClickTableAction()
|
|
|
}
|
|
}
|
|
|
else if (status == "2")
|
|
else if (status == "2")
|
|
|
{
|
|
{
|
|
|
- //已开台
|
|
|
|
|
- this->EnterTable(table_id);
|
|
|
|
|
|
|
+ if (order_status == "SUCCESS")
|
|
|
|
|
+ {
|
|
|
|
|
+ //表示已支付待清台
|
|
|
|
|
+ CAttentionWnd* pKaitaiDlg = new CAttentionWnd();
|
|
|
|
|
+
|
|
|
|
|
+ if (pKaitaiDlg != NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ pKaitaiDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
|
|
|
|
|
+ pKaitaiDlg->SetIcon(IDI_ICON_DUILIB);
|
|
|
|
|
+ pKaitaiDlg->CenterWindow();
|
|
|
|
|
+
|
|
|
|
|
+ pKaitaiDlg->SetTitle(CLewaimaiString::UTF8ToUnicode(table_name));
|
|
|
|
|
+ pKaitaiDlg->SetContent(L"该桌子已结账,确定要对该桌子进行清台吗?");
|
|
|
|
|
+
|
|
|
|
|
+ UINT ret = pKaitaiDlg->ShowModal();
|
|
|
|
|
+
|
|
|
|
|
+ if (ret == IDOK)
|
|
|
|
|
+ {
|
|
|
|
|
+ //开始对桌子进行清台
|
|
|
|
|
+ this->StartQingtai();
|
|
|
|
|
+
|
|
|
|
|
+ delete pKaitaiDlg;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ delete pKaitaiDlg;
|
|
|
|
|
+
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ //已开台
|
|
|
|
|
+ this->EnterTable(table_id);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else if (m_nModel == 2)
|
|
else if (m_nModel == 2)
|
|
@@ -704,4 +736,64 @@ void CZhengcanPageUI::QurenZhuantai()
|
|
|
pZhuantaiLayout->SetVisible(false);
|
|
pZhuantaiLayout->SetVisible(false);
|
|
|
|
|
|
|
|
InitShow();
|
|
InitShow();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void CZhengcanPageUI::StartQingtai()
|
|
|
|
|
+{
|
|
|
|
|
+ //开始转菊花
|
|
|
|
|
+ CVerticalLayoutUI* pTableLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("zhengcan_tablelist")));
|
|
|
|
|
+ pTableLayout->SetVisible(false);
|
|
|
|
|
+
|
|
|
|
|
+ this->FindSubControl(_T("loading"))->SetVisible(true);
|
|
|
|
|
+
|
|
|
|
|
+ //启动一个线程,进行网络请求操作
|
|
|
|
|
+
|
|
|
|
|
+ std::thread t(&CZhengcanPageUI::DoQingtai, this);
|
|
|
|
|
+ t.detach();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void CZhengcanPageUI::DoQingtai()
|
|
|
|
|
+{
|
|
|
|
|
+ std::map<string, string> params;
|
|
|
|
|
+
|
|
|
|
|
+ params["order_id"] = m_cur_click_table_item->GetOrderId();
|
|
|
|
|
+
|
|
|
|
|
+ std::string response;
|
|
|
|
|
+
|
|
|
|
|
+ std::string url = "/dinnercash/cleartable";
|
|
|
|
|
+ bool ret = CZhipuziHttpClient::GetInstance()->Request(url.c_str(), params, response);
|
|
|
|
|
+ if (ret == false)
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ rapidjson::Document document;
|
|
|
|
|
+ document.Parse(response.c_str());
|
|
|
|
|
+
|
|
|
|
|
+ if (document.HasParseError())
|
|
|
|
|
+ {
|
|
|
|
|
+ LOG_INFO("parse response error!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!document.HasMember("errcode") || !document.HasMember("errmsg"))
|
|
|
|
|
+ {
|
|
|
|
|
+ LOG_INFO("json error!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ rapidjson::Value& v_errcode = document["errcode"];
|
|
|
|
|
+ int errcode = v_errcode.GetInt();
|
|
|
|
|
+ if (errcode != 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!document.HasMember("data"))
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //清台成功,这时候要刷新桌子
|
|
|
|
|
+ DoRefreshTable();
|
|
|
}
|
|
}
|