|
|
@@ -528,6 +528,8 @@ bool CSqlite3::InitPosFood()
|
|
|
"is_shouyinji_show CHAR(20) NOT NULL," \
|
|
|
"expiration_date CHAR(100) NOT NULL," \
|
|
|
"is_weight CHAR(20) NOT NULL," \
|
|
|
+ "weight_plu_code CHAR(20) NOT NULL," \
|
|
|
+ "weight_food_code CHAR(20) NOT NULL," \
|
|
|
"member_price_json CHAR(100) NOT NULL);";
|
|
|
|
|
|
if (sqlite3_prepare_v2(m_db, sql.c_str(), -1, &stmt, NULL) == SQLITE_OK)
|
|
|
@@ -855,12 +857,32 @@ bool CSqlite3::InitFoodData(rapidjson::Value& foodrows)
|
|
|
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) VALUES ('" + id + "' ,'" + shop_id + "','" \
|
|
|
+ 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 + "')";
|
|
|
+ + 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)
|
|
|
@@ -1119,7 +1141,67 @@ std::vector<CFood> CSqlite3::GetFoodByTypeid(std::string type_id, bool is_shouyi
|
|
|
newFood.is_shouyinji_show = (char*)sqlite3_column_text(stmt, 21);
|
|
|
newFood.expiration_date = (char*)sqlite3_column_text(stmt, 22);
|
|
|
newFood.is_weight = (char*)sqlite3_column_text(stmt, 23);
|
|
|
- newFood.member_price_json = (char*)sqlite3_column_text(stmt, 24);
|
|
|
+ newFood.weight_plu_code = (char*)sqlite3_column_text(stmt, 24);
|
|
|
+ newFood.weight_food_code = (char*)sqlite3_column_text(stmt, 25);
|
|
|
+ newFood.member_price_json = (char*)sqlite3_column_text(stmt, 26);
|
|
|
+
|
|
|
+ data.push_back(newFood);
|
|
|
+ }
|
|
|
+
|
|
|
+ sqlite3_finalize(stmt);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //异常情况
|
|
|
+ sqlite3_finalize(stmt);
|
|
|
+ }
|
|
|
+
|
|
|
+ return data;
|
|
|
+}
|
|
|
+
|
|
|
+std::vector<CFood> CSqlite3::GetFoodForTiaomacheng()
|
|
|
+{
|
|
|
+ std::vector<CFood> data;
|
|
|
+
|
|
|
+ std::string sql;
|
|
|
+
|
|
|
+ sql = "SELECT * FROM pos_food WHERE is_weight = '1' AND weight_plu_code != '' AND weight_food_code != ''";
|
|
|
+
|
|
|
+ sqlite3_stmt * stmt = NULL;
|
|
|
+
|
|
|
+ if (sqlite3_prepare_v2(m_db, sql.c_str(), -1, &stmt, NULL) == SQLITE_OK)
|
|
|
+ {
|
|
|
+ while (sqlite3_step(stmt) == SQLITE_ROW)
|
|
|
+ {
|
|
|
+ CFood newFood;
|
|
|
+
|
|
|
+ newFood.id = (char*)sqlite3_column_text(stmt, 0);
|
|
|
+ newFood.shop_id = (char*)sqlite3_column_text(stmt, 1);
|
|
|
+ newFood.name = (char*)sqlite3_column_text(stmt, 2);
|
|
|
+ newFood.price = (char*)sqlite3_column_text(stmt, 3);
|
|
|
+ newFood.tag = (char*)sqlite3_column_text(stmt, 4);
|
|
|
+ newFood.status = (char*)sqlite3_column_text(stmt, 5);
|
|
|
+ newFood.type_id = (char*)sqlite3_column_text(stmt, 6);
|
|
|
+ newFood.is_dabao = (char*)sqlite3_column_text(stmt, 7);
|
|
|
+ newFood.dabao_money = (char*)sqlite3_column_text(stmt, 8);
|
|
|
+ newFood.is_nature = (char*)sqlite3_column_text(stmt, 9);
|
|
|
+ newFood.nature = (char*)sqlite3_column_text(stmt, 10);
|
|
|
+ newFood.autostocknum = (char*)sqlite3_column_text(stmt, 11);
|
|
|
+ newFood.goods_img = (char*)sqlite3_column_text(stmt, 12);
|
|
|
+ newFood.unit = (char*)sqlite3_column_text(stmt, 13);
|
|
|
+ newFood.barcode = (char*)sqlite3_column_text(stmt, 14);
|
|
|
+ newFood.member_price_used = (char*)sqlite3_column_text(stmt, 15);
|
|
|
+ newFood.member_price = (char*)sqlite3_column_text(stmt, 16);
|
|
|
+ newFood.buying_price = (char*)sqlite3_column_text(stmt, 17);
|
|
|
+ newFood.stock = (char*)sqlite3_column_text(stmt, 18);
|
|
|
+ newFood.stockvalid = (char*)sqlite3_column_text(stmt, 19);
|
|
|
+ newFood.stock_warning = (char*)sqlite3_column_text(stmt, 20);
|
|
|
+ newFood.is_shouyinji_show = (char*)sqlite3_column_text(stmt, 21);
|
|
|
+ newFood.expiration_date = (char*)sqlite3_column_text(stmt, 22);
|
|
|
+ newFood.is_weight = (char*)sqlite3_column_text(stmt, 23);
|
|
|
+ newFood.weight_plu_code = (char*)sqlite3_column_text(stmt, 24);
|
|
|
+ newFood.weight_food_code = (char*)sqlite3_column_text(stmt, 25);
|
|
|
+ newFood.member_price_json = (char*)sqlite3_column_text(stmt, 26);
|
|
|
|
|
|
data.push_back(newFood);
|
|
|
}
|
|
|
@@ -1184,7 +1266,9 @@ std::vector<CFood> CSqlite3::GetFoodByFoodname(std::string foodname, bool is_sho
|
|
|
newFood.is_shouyinji_show = (char*)sqlite3_column_text(stmt, 21);
|
|
|
newFood.expiration_date = (char*)sqlite3_column_text(stmt, 22);
|
|
|
newFood.is_weight = (char*)sqlite3_column_text(stmt, 23);
|
|
|
- newFood.member_price_json = (char*)sqlite3_column_text(stmt, 24);
|
|
|
+ newFood.weight_plu_code = (char*)sqlite3_column_text(stmt, 24);
|
|
|
+ newFood.weight_food_code = (char*)sqlite3_column_text(stmt, 25);
|
|
|
+ newFood.member_price_json = (char*)sqlite3_column_text(stmt, 26);
|
|
|
|
|
|
data.push_back(newFood);
|
|
|
}
|
|
|
@@ -1290,7 +1374,9 @@ bool CSqlite3::GetFoodById(std::string food_id, CFood& newFood)
|
|
|
newFood.is_shouyinji_show = (char*)sqlite3_column_text(stmt, 21);
|
|
|
newFood.expiration_date = (char*)sqlite3_column_text(stmt, 22);
|
|
|
newFood.is_weight = (char*)sqlite3_column_text(stmt, 23);
|
|
|
- newFood.member_price_json = (char*)sqlite3_column_text(stmt, 24);
|
|
|
+ newFood.weight_plu_code = (char*)sqlite3_column_text(stmt, 24);
|
|
|
+ newFood.weight_food_code = (char*)sqlite3_column_text(stmt, 25);
|
|
|
+ newFood.member_price_json = (char*)sqlite3_column_text(stmt, 26);
|
|
|
}
|
|
|
|
|
|
sqlite3_finalize(stmt);
|
|
|
@@ -1342,7 +1428,9 @@ bool CSqlite3::GetFoodByBarcode(std::string barcode, CFood& newFood)
|
|
|
newFood.is_shouyinji_show = (char*)sqlite3_column_text(stmt, 21);
|
|
|
newFood.expiration_date = (char*)sqlite3_column_text(stmt, 22);
|
|
|
newFood.is_weight = (char*)sqlite3_column_text(stmt, 23);
|
|
|
- newFood.member_price_json = (char*)sqlite3_column_text(stmt, 24);
|
|
|
+ newFood.weight_plu_code = (char*)sqlite3_column_text(stmt, 24);
|
|
|
+ newFood.weight_food_code = (char*)sqlite3_column_text(stmt, 25);
|
|
|
+ newFood.member_price_json = (char*)sqlite3_column_text(stmt, 26);
|
|
|
}
|
|
|
|
|
|
sqlite3_finalize(stmt);
|