|
@@ -966,6 +966,86 @@ bool CSqlite3::InitFoodpackageData(rapidjson::Value& foodpackagerows)
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+bool CSqlite3::UpdateOneFood(rapidjson::Value& foodrows)
|
|
|
|
|
+{
|
|
|
|
|
+ this->ExeSQl("begin;");
|
|
|
|
|
+
|
|
|
|
|
+ rapidjson::Value& foodinfo = foodrows;
|
|
|
|
|
+
|
|
|
|
|
+ std::string id = foodinfo["goods_id"].GetString();
|
|
|
|
|
+ std::string shop_id = foodinfo["shop_id"].GetString();
|
|
|
|
|
+ std::string name = foodinfo["goods_name"].GetString();
|
|
|
|
|
+ std::string price = foodinfo["goods_price"].GetString();
|
|
|
|
|
+ std::string tag = foodinfo["goods_tag"].GetString();
|
|
|
|
|
+ std::string status = foodinfo["goods_status"].GetString();
|
|
|
|
|
+ std::string type_id = foodinfo["type_lv1_id"].GetString();
|
|
|
|
|
+ std::string is_dabao = foodinfo["is_dabao"].GetString();
|
|
|
|
|
+ std::string dabao_money = foodinfo["dabao_money"].GetString();
|
|
|
|
|
+ std::string is_nature = foodinfo["is_nature"].GetString();
|
|
|
|
|
+
|
|
|
|
|
+ std::string nature;
|
|
|
|
|
+ if (is_nature == "1")
|
|
|
|
|
+ {
|
|
|
|
|
+ nature = CLewaimaiJson::JsonToString(foodinfo["nature"]);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ nature = "";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ std::string autostocknum = foodinfo["autostocknum"].GetString();
|
|
|
|
|
+ std::string goods_img = foodinfo["goods_img"].GetString();
|
|
|
|
|
+ std::string unit = foodinfo["unit"].GetString();
|
|
|
|
|
+ std::string barcode = foodinfo["barcode"].GetString();
|
|
|
|
|
+ std::string member_price_used = foodinfo["member_price_used"].GetString();
|
|
|
|
|
+ std::string member_price = foodinfo["member_price"].GetString();
|
|
|
|
|
+ std::string buying_price = foodinfo["buying_price"].GetString();
|
|
|
|
|
+ std::string stock = to_string(foodinfo["stock"].GetDouble());
|
|
|
|
|
+ std::string stockvalid = "1";
|
|
|
|
|
+ std::string stock_warning = foodinfo["stock_warning"].GetString();
|
|
|
|
|
+ std::string is_shouyinji_show = foodinfo["is_shouyinji_show"].GetString();
|
|
|
|
|
+ std::string expiration_date = foodinfo["expiration_date"].GetString();
|
|
|
|
|
+ std::string is_weight = foodinfo["is_weight"].GetString();
|
|
|
|
|
+ std::string member_price_json = foodinfo["member_price_json"].GetString();
|
|
|
|
|
+
|
|
|
|
|
+ std::string weight_plu_code;
|
|
|
|
|
+ if (foodinfo["weight_plu_code"].IsString())
|
|
|
|
|
+ {
|
|
|
|
|
+ weight_plu_code = foodinfo["weight_plu_code"].GetString();
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ weight_plu_code = "";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ std::string weight_food_code;
|
|
|
|
|
+ if (foodinfo["weight_food_code"].IsString())
|
|
|
|
|
+ {
|
|
|
|
|
+ weight_food_code = foodinfo["weight_food_code"].GetString();
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ weight_food_code = "";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //²åÈëÒ»¸öÉÌÆ·Êý¾Ý
|
|
|
|
|
+ std::string sql = "INSERT INTO pos_food (id,shop_id,name,price,tag,status,type_id,is_dabao,dabao_money,is_nature,nature,autostocknum,goods_img,unit,barcode,member_price_used,member_price, \
|
|
|
|
|
+ buying_price,stock,stockvalid,stock_warning,is_shouyinji_show,expiration_date,is_weight,member_price_json,weight_plu_code,weight_food_code) VALUES ('" + id + "' ,'" + shop_id + "','" \
|
|
|
|
|
+ + name + "', '" + price + "', '" + tag + "', '" + status + "', '" + type_id + "', '" + is_dabao + "', '" + dabao_money + "', '" + is_nature + "', '" + nature + "', '" \
|
|
|
|
|
+ + autostocknum + "', '" + goods_img + "', '" + unit + "', '" + barcode + "', '" + member_price_used + "', '" + member_price + "', '" + buying_price + "', '" + stock + "', '" \
|
|
|
|
|
+ + stockvalid + "', '" + stock_warning + "', '" + is_shouyinji_show + "', '" + expiration_date + "','" + is_weight + "','" + member_price_json + "','" + weight_plu_code + "','" + weight_food_code + "')";
|
|
|
|
|
+
|
|
|
|
|
+ bool ret = this->ExeSQl(sql);
|
|
|
|
|
+ if (!ret)
|
|
|
|
|
+ {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this->ExeSQl("commit;");
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
bool CSqlite3::ExeSQl(std::string sql)
|
|
bool CSqlite3::ExeSQl(std::string sql)
|
|
|
{
|
|
{
|
|
|
char *zErrMsg = 0;
|
|
char *zErrMsg = 0;
|