pxx上货功能 temu备货管理可以查询商品售后率并根据售后率处理备货

This commit is contained in:
wule committed 2025-09-19 09:31:34 +08:00
1 parent f4fedf1e2f
commit 0e6a034d5f
34 files changed
+3568 -893

No files matched your search

@@ -27,6 +27,9 @@ namespace KJD_Web.BLL.BXX
string from_shop_id = RegexUtils.GetStringQuery(ref inputData, "from_shop_id");
string spu_id = RegexUtils.GetStringQuery(ref inputData, "spu_id");
string skc_id = RegexUtils.GetStringQuery(ref inputData, "skc_id");
string price_text = RegexUtils.GetStringQuery(ref inputData, "price_text");
string main_cat_id = RegexUtils.GetStringQuery(ref inputData, "main_cat_id");
string main_cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "main_cat_name"))?.Replace("'", "\\'");
string cat_id = RegexUtils.GetStringQuery(ref inputData, "cat_id");
string cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_name"))?.Replace("'", "\\'");
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code"))?.Replace("'", "\\'");
@@ -45,9 +48,11 @@ namespace KJD_Web.BLL.BXX
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "insert into bxx.product (from_shop_id,spu_id,skc_id,cat_id,cat_name,product_name,ext_code,main_img,product_json,size_json,notes,add_time,mdy_time) " +
"values ('" + from_shop_id + "','" + spu_id + "','" + skc_id + "','" + cat_id + "','" + cat_name + "','" + product_name + "','" +
ext_code + "','" + main_img + "','" + product_json + "','" + size_json + "','" + notes + "','" +
sql = "insert into bxx.product (from_shop_id,spu_id,skc_id,main_cat_id,main_cat_name,cat_id,cat_name,price_text," +
"product_name,ext_code,main_img,product_json,size_json,notes,add_time,mdy_time) " +
"values ('" + from_shop_id + "','" + spu_id + "','" + skc_id + "','" + main_cat_id + "','" + main_cat_name + "','" +
cat_id + "','" + cat_name + "','" + price_text + "','" + product_name + "','" + ext_code + "','" + main_img + "','" +
product_json + "','" + size_json + "','" + notes + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
var rst = mySql.ExecuteNonQuery(sql);
@@ -78,6 +83,9 @@ namespace KJD_Web.BLL.BXX
string from_shop_id = RegexUtils.GetStringQuery(ref inputData, "from_shop_id");
string spu_id = RegexUtils.GetStringQuery(ref inputData, "spu_id");
string skc_id = RegexUtils.GetStringQuery(ref inputData, "skc_id");
string price_text = RegexUtils.GetStringQuery(ref inputData, "price_text");
string main_cat_id = RegexUtils.GetStringQuery(ref inputData, "main_cat_id");
string main_cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "main_cat_name"))?.Replace("'", "\\'");
string cat_id = RegexUtils.GetStringQuery(ref inputData, "cat_id");
string cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_name"))?.Replace("'", "\\'");
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code"))?.Replace("'", "\\'");
@@ -99,10 +107,16 @@ namespace KJD_Web.BLL.BXX
sql = "update bxx.product set";
if (from_shop_id != null)
sql += " from_shop_id='" + from_shop_id + "',";
if (main_cat_id != null)
sql += " main_cat_id='" + main_cat_id + "',";
if (main_cat_name != null)
sql += " main_cat_name='" + main_cat_name + "',";
if (cat_id != null)
sql += " cat_id='" + cat_id + "',";
if (cat_name != null)
sql += " cat_name='" + cat_name + "',";
if (price_text != null)
sql += " price_text='" + price_text + "',";
if (product_name != null)
sql += " product_name='" + product_name + "',";
if (ext_code != null)
@@ -191,10 +205,10 @@ namespace KJD_Web.BLL.BXX
if (isDetail)
sql = "select * from bxx.product p where 1=1";
else if (string.IsNullOrEmpty(get_select_count))
sql = "select p.id,p.from_shop_id,p.spu_id,p.skc_id,p.cat_id,p.cat_name,p.ext_code,p.product_name,p.main_img,p.notes," +
sql = "select p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code,p.product_name,p.main_img,p.notes," +
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words from bxx.product p where 1=1";
else
sql = "SELECT p.id,p.from_shop_id,p.spu_id,p.skc_id,p.cat_id,p.cat_name,p.ext_code,p.product_name,p.main_img,p.notes," +
sql = "SELECT p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code,p.product_name,p.main_img,p.notes," +
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,COUNT(s.id) AS select_count " +
"FROM bxx.product p LEFT JOIN bxx.product_select s ON p.id=s.out_product_id AND s.shop_id='" + select_shop_id + "' " +
"WHERE 1=1";
@@ -267,6 +281,108 @@ namespace KJD_Web.BLL.BXX
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetProductListRandom(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
var is_detail = RegexUtils.GetStringQuery(ref inputData, "is_detail")?.Replace("'", "\\'");
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(id) from bxx.product p where 1=1";
string where = "";
sql += where;
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
if (is_detail == "true")
sql = "select * from bxx.product p where 1=1";
else
sql = "select p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code,p.product_name,p.main_img,p.notes," +
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words from bxx.product p where 1=1";
//where子句
sql += where;
sql += " ORDER BY RAND()";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
try
{
List<DBProductResultParam> productLst = new List<DBProductResultParam>();
foreach (DataRow row in dt.Rows)
{
DBProductResultParam prod = new DBProductResultParam
{
id = Convert.ToInt32(row["id"]),
from_shop_id = row["from_shop_id"].ToString(),
skc_id = row["skc_id"].ToString(),
spu_id = row["spu_id"].ToString(),
cat_id = row["cat_id"].ToString(),
cat_name = row["cat_name"].ToString(),
main_cat_id = row["main_cat_id"].ToString(),
main_cat_name = row["main_cat_name"].ToString(),
price_text = row["price_text"].ToString(),
product_name = row["product_name"].ToString(),
main_img = row["main_img"].ToString(),
ext_code = row["ext_code"].ToString(),
//product_json = row["product_json"].ToString(),
//size_json = row["size_json"].ToString(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
notes = row["notes"].ToString(),
select_total_count = row["select_total_count"].ParseToInt(),
end_words = row["end_words"].ParseToString(),
fission_words = row["fission_words"].ParseToString(),
head_words = row["head_words"].ParseToString(),
};
if (is_detail == "true")
{
prod.product_json = row["product_json"].ToString();
prod.size_json = row["size_json"].ToString();
}
productLst.Add(prod);
}
var data = JsonUtils.SerializerObjectToString(productLst);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string DelDbProd(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
@@ -72,6 +72,18 @@ namespace KJD_Web
Context.Response.End();
}
[WebMethod]
public void get_product_list_random()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().GetProductListRandom(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void add_product()
{
@@ -14,8 +14,11 @@ namespace KJD_Web.Model
public string from_shop_id { get; set; } = "";
public string spu_id { get; set; }
public string skc_id { get; set; }
public string main_cat_id { get; set; }
public string cat_id { get; set; }
public string main_cat_name { get; set; }
public string cat_name { get; set; }
public string price_text { get; set; }
public string change_cat_id { get; set; }
public string change_cat_name { get; set; }
public string ext_code { get; set; }