|
|
@@ -758,6 +758,10 @@ bool CZhengcanOrder::InitData(std::string order_id)
|
|
|
newItem.is_dabao = false;
|
|
|
}
|
|
|
|
|
|
+ newItem.is_jiacai = CLewaimaiJson::ToString(cur_foodpackage["is_jiacai"]);
|
|
|
+ newItem.jiacai_no = CLewaimaiJson::ToString(cur_foodpackage["jiacai_no"]);
|
|
|
+ newItem.is_tuicai = CLewaimaiJson::ToString(cur_foodpackage["is_tuicai"]);
|
|
|
+
|
|
|
//从数据库读取套餐的打包费信息
|
|
|
CFoodpackage foodpackageinfo;
|
|
|
CSqlite3 sqlite;
|
|
|
@@ -802,6 +806,10 @@ bool CZhengcanOrder::InitData(std::string order_id)
|
|
|
taocanItem.is_dabao = false;
|
|
|
}
|
|
|
|
|
|
+ newItem.is_jiacai = CLewaimaiJson::ToString(food_item_info["is_jiacai"]);
|
|
|
+ newItem.jiacai_no = CLewaimaiJson::ToString(food_item_info["jiacai_no"]);
|
|
|
+ newItem.is_tuicai = CLewaimaiJson::ToString(food_item_info["is_tuicai"]);
|
|
|
+
|
|
|
//目前服务器返回的dabao_money一直为0,是不对的,暂时不用这个,下面从数据库里读取
|
|
|
//newItem.dabao_money = CLewaimaiJson::ToString(foodinfo["dabao_money"]);
|
|
|
|
|
|
@@ -858,4 +866,78 @@ bool CZhengcanOrder::Refund(std::string order_id)
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanOrder::UpdateItemPrint(std::string jiacai_no)
|
|
|
+{
|
|
|
+ //清空之前的打印记录
|
|
|
+ m_items_print.clear();
|
|
|
+
|
|
|
+ for (std::vector<CZhengcanOrderHistoryXiadan>::iterator it = m_order_history_array.begin(); it != m_order_history_array.end(); it++)
|
|
|
+ {
|
|
|
+ for (std::vector<CZhengcanOrderItem>::iterator it1 = it->m_items.begin(); it1 != it->m_items.end(); it1++)
|
|
|
+ {
|
|
|
+ if (jiacai_no != "-1")
|
|
|
+ {
|
|
|
+ if (it1->jiacai_no != jiacai_no)
|
|
|
+ {
|
|
|
+ //如果jiacai_no不想等,就直接忽略
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ CZhengcanOrderItemPrint itemPrint;
|
|
|
+
|
|
|
+ CZhengcanOrderItem tuicaiItem = *it1;
|
|
|
+
|
|
|
+ itemPrint.m_quantity = tuicaiItem.num;
|
|
|
+ itemPrint.m_item_price = tuicaiItem.price;
|
|
|
+ itemPrint.m_type_id = tuicaiItem.type_id;
|
|
|
+
|
|
|
+ if (tuicaiItem.m_is_taocan == true)
|
|
|
+ {
|
|
|
+ itemPrint.is_taocan = true;
|
|
|
+
|
|
|
+ itemPrint.m_food_name = tuicaiItem.foodpackage_name; //不带属性商品
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ itemPrint.m_food_name = tuicaiItem.food_name; //带属性值
|
|
|
+ }
|
|
|
+
|
|
|
+ m_items_print.push_back(itemPrint);
|
|
|
+
|
|
|
+ if (tuicaiItem.m_is_taocan == true)
|
|
|
+ {
|
|
|
+ //开始保存套餐里面的商品详情,主要用于厨房打印
|
|
|
+
|
|
|
+ //接下来要把这个套餐的详情也保存下来
|
|
|
+ for (std::vector<CZhengcanOrderItem>::iterator it = tuicaiItem.m_taocan_items.begin(); it != tuicaiItem.m_taocan_items.end(); it++)
|
|
|
+ {
|
|
|
+ std::string food_id = it->food_id;
|
|
|
+
|
|
|
+ //要根据商品ID找出商品的名字
|
|
|
+ CFood foodinfo;
|
|
|
+ CSqlite3 sqlite;
|
|
|
+ bool is_found = sqlite.GetFoodById(food_id, foodinfo);
|
|
|
+ if (!is_found)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ CZhengcanOrderItemPrint foodpackageitemPrint;
|
|
|
+
|
|
|
+ foodpackageitemPrint.m_food_name = foodinfo.name;
|
|
|
+ foodpackageitemPrint.m_quantity = tuicaiItem.num;
|
|
|
+ foodpackageitemPrint.m_item_price = foodinfo.price;
|
|
|
+ foodpackageitemPrint.m_type_id = foodinfo.type_id;
|
|
|
+
|
|
|
+ foodpackageitemPrint.is_taocan = false;
|
|
|
+ foodpackageitemPrint.is_taocan_item = true;
|
|
|
+
|
|
|
+ m_items_print.push_back(foodpackageitemPrint);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|