聚水潭sku入库

This commit is contained in:
wule committed 2026-03-10 13:52:42 +08:00
1 parent 2d35f4b861
commit ccde645d98
17 files changed
+3090 -209

No files matched your search

@@ -369,6 +369,8 @@ namespace KJD_Web.BLL.BXX
var real_coid = RegexUtils.GetStringQuery(ref inputData, "real_coid")?.Replace("'", "\\'");
var has_wx_format = RegexUtils.GetStringQuery(ref inputData, "has_wx_format")?.Replace("'", "\\'");
var standby3 = RegexUtils.GetStringQuery(ref inputData, "standby3")?.Replace("'", "\\'");
var start_time = RegexUtils.GetStringQuery(ref inputData, "start_time")?.Replace("'", "\\'");
var end_time = RegexUtils.GetStringQuery(ref inputData, "end_time")?.Replace("'", "\\'");
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size= RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
@@ -471,9 +473,13 @@ namespace KJD_Web.BLL.BXX
if (!string.IsNullOrEmpty(standby3))
{
if (standby3.ToLower().Contains("is null"))
where += " and standby3 " + standby3;
where += " and p.standby3 " + standby3;
else
where += " and standby3='" + standby3 + "'";
where += " and p.standby3='" + standby3 + "'";
}
if (start_time != null && end_time != null)
{
where += " and p.mdy_time between '" + start_time + "' and '" + end_time + "'";
}
sql += where;
@@ -2466,6 +2472,298 @@ namespace KJD_Web.BLL.BXX
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddJSTSku(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
return "{\"code\":50000,\"msg\":\"用户不存在\"}";
string coid = RegexUtils.GetStringQuery(ref inputData, "coid")?.Replace("'", "\\'");
string supplierId = RegexUtils.GetStringQuery(ref inputData, "supplierId")?.Replace("'", "\\'");
string supplierName = RegexUtils.GetStringQuery(ref inputData, "supplierName");
string skuId = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "skuId"))?.Replace("'", "\\'");
string itemSpuId = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "itemSpuId"))?.Replace("'", "\\'");
string pic = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "pic"))?.Replace("'", "\\'");
string itemName = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "itemName"));
string styleCode = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "styleCode"));
string itemCode = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "itemCode"))?.Replace("'", "\\'");
string color = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "color"))?.Replace("'", "\\'");
string spec = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "spec"))?.Replace("'", "\\'");
string salePrice = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "salePrice"))?.Replace("'", "\\'");
string supplyPrice = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "supplyPrice"))?.Replace("'", "\\'");
string stock = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "stock"))?.Replace("'", "\\'");
string stockTime = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "stockTime"))?.Replace("'", "\\'");
string weight = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "weight"))?.Replace("'", "\\'");
string status = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "status"))?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "insert into ";
sql += "bxx.product_sku_restore ";
sql += "(coid,supplierId,supplierName,skuId,itemSpuId,pic,itemName,styleCode,itemCode,color,spec,stockTime," +
"salePrice,supplyPrice,stock,weight) " +
"values ('" + coid + "','" + supplierId + "','" + supplierName + "','" + skuId + "','" + itemSpuId + "','" +
pic + "','" + itemName + "','" + styleCode + "','" + itemCode + "','" + color + "','" + spec + "','" + stockTime + "'," +
(salePrice.IsNullOrEmpty() ? "null" : salePrice) + "," + supplyPrice + "," + stock + "," + weight + ");";
List<MySqlParameter> paramLst = new List<MySqlParameter>();
//paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "product_json", Value = product_json, });
//paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "size_json", Value = size_json, });
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string MdyJSTSku(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
return "{\"code\":50000,\"msg\":\"用户不存在\"}";
string coid = RegexUtils.GetStringQuery(ref inputData, "coid")?.Replace("'", "\\'");
string supplierId = RegexUtils.GetStringQuery(ref inputData, "supplierId")?.Replace("'", "\\'");
string supplierName = RegexUtils.GetStringQuery(ref inputData, "supplierName");
string skuId = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "skuId"))?.Replace("'", "\\'");
string itemSpuId = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "itemSpuId"))?.Replace("'", "\\'");
string pic = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "pic"))?.Replace("'", "\\'");
string itemName = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "itemName"));
string styleCode = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "styleCode"));
string itemCode = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "itemCode"))?.Replace("'", "\\'");
string color = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "color"))?.Replace("'", "\\'");
string spec = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "spec"))?.Replace("'", "\\'");
string salePrice = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "salePrice"))?.Replace("'", "\\'");
string supplyPrice = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "supplyPrice"))?.Replace("'", "\\'");
string stock = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "stock"))?.Replace("'", "\\'");
string stockTime = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "stockTime"))?.Replace("'", "\\'");
string weight = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "weight"))?.Replace("'", "\\'");
string status = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "status"))?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "update ";
sql += "bxx.product_sku_restore p set ";
if (coid != null)
sql += " p.coid='" + coid + "',";
if (supplierId != null)
sql += " p.supplierId='" + supplierId + "',";
if (supplierName != null)
sql += " p.supplierName='" + supplierName + "',";
if (pic != null)
sql += " p.pic='" + pic + "',";
if (itemName != null)
sql += " p.itemName='" + itemName + "',";
if (styleCode != null)
sql += " p.styleCode='" + styleCode + "',";
if (itemCode != null)
sql += " p.itemCode='" + itemCode + "',";
if (color != null)
sql += " p.color='" + color + "',";
if (spec != null)
sql += " p.spec='" + spec + "',";
if (salePrice != null)
sql += " p.salePrice=" + salePrice + ",";
if (supplyPrice != null)
sql += " p.supplyPrice=" + supplyPrice + ",";
if (stock != null)
sql += " p.stock=" + stock + ",";
if (stockTime != null)
sql += " p.stockTime='" + stockTime + "',";
if (salePrice != null)
sql += " p.salePrice=" + salePrice + ",";
if (weight != null)
sql += " p.weight='" + weight + "',";
sql = sql.TrimEnd(',');
sql += " where skuId='" + skuId + "' and itemSpuId='" + itemSpuId + "';";
List<MySqlParameter> paramLst = new List<MySqlParameter>();
//paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "product_json", Value = product_json, });
//paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "size_json", Value = size_json, });
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetJSTSkuList(string inputData)
{
var timeCalc = DateTime.Now;
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 version = RegexUtils.GetStringQuery(ref inputData, "version").ParseToInt();
if (version < (System.Configuration.ConfigurationManager.ConnectionStrings["LimitVersion"]?.ConnectionString).ParseToInt())
return "{\"code\":1,\"msg\":\"当前版本过于陈旧,请立即升级新版\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
return "{\"code\":50000,\"msg\":\"用户不存在\"}";
var search_coid = RegexUtils.GetStringQuery(ref inputData, "search_coid")?.Replace("'", "\\'");
var search_supplierId = RegexUtils.GetStringQuery(ref inputData, "search_supplierId")?.Replace("'", "\\'");
var search_supplierName = RegexUtils.GetStringQuery(ref inputData, "search_supplierName")?.Replace("'", "\\'");
var search_skuId = RegexUtils.GetStringQuery(ref inputData, "search_skuId")?.Replace("'", "\\'");
var search_itemSpuId = RegexUtils.GetStringQuery(ref inputData, "search_itemSpuId")?.Replace("'", "\\'");
var search_itemName = RegexUtils.GetStringQuery(ref inputData, "search_itemName")?.Replace("'", "\\'");
var search_styleCode = RegexUtils.GetStringQuery(ref inputData, "search_styleCode")?.Replace("'", "\\'");
var search_itemCode = RegexUtils.GetStringQuery(ref inputData, "search_itemCode")?.Replace("'", "\\'");
var search_color = RegexUtils.GetStringQuery(ref inputData, "search_color")?.Replace("'", "\\'");
var search_spec = RegexUtils.GetStringQuery(ref inputData, "search_spec")?.Replace("'", "\\'");
var search_status = RegexUtils.GetStringQuery(ref inputData, "search_status")?.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(*) from bxx.product_sku_restore p where 1=1";
string where = "";
if (!string.IsNullOrEmpty(search_coid))
where += " and p.coid ='" + search_coid + "'";
if (!string.IsNullOrEmpty(search_supplierId))
where += " and p.supplierId ='" + search_supplierId + "'";
if (!string.IsNullOrEmpty(search_supplierName))
where += " and p.supplierName ='" + search_supplierName + "'";
if (!string.IsNullOrEmpty(search_skuId))
where += " and p.skuId ='" + search_skuId + "'";
if (!string.IsNullOrEmpty(search_itemSpuId))
where += " and p.itemSpuId ='" + search_itemSpuId + "'";
if (!string.IsNullOrEmpty(search_itemName))
where += " and p.itemName like '%" + search_itemName + "%'";
if (!string.IsNullOrEmpty(search_styleCode))
where += " and p.styleCode ='" + search_styleCode + "'";
if (!string.IsNullOrEmpty(search_itemCode))
where += " and p.itemCode ='" + search_itemCode + "'";
if (!string.IsNullOrEmpty(search_color))
where += " and p.color ='" + search_color + "'";
if (!string.IsNullOrEmpty(search_spec))
where += " and p.spec ='" + search_spec + "'";
if (!string.IsNullOrEmpty(search_status))
where += " and p.status ='" + search_status + "'";
sql += where;
var count = 0;
count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = "select p.* from bxx.product_sku_restore p" +
" where 1=1";
//where子句
sql += where;
sql += " order by p.id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
try
{
List<JSTListProductSkuInfo> productLst = new List<JSTListProductSkuInfo>();
foreach (DataRow row in dt.Rows)
{
JSTListProductSkuInfo prod = new JSTListProductSkuInfo
{
id = Convert.ToInt32(row["id"]),
coid = row["coid"].ToString(),
color = row["color"].ToString(),
itemCode = row["itemCode"].ToString(),
itemName = row["itemName"].ToString(),
itemSpuId = row["itemSpuId"].ToString(),
pic = row["pic"].ToString(),
salePrice = row["salePrice"].ParseToDecimal(),
skuId = row["skuId"].ToString(),
spec = row["spec"].ToString(),
status = row["status"].ToString(),
stock = row["stock"].ParseToInt(),
styleCode = row["styleCode"].ParseToString(),
supplierId = row["supplierId"].ToString(),
supplierName = row["supplierName"].ToString(),
supplyPrice = row["supplyPrice"].ParseToDecimal(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
stockTime = row["stockTime"].ParseToString().ParseToDateTime(),
weight = row["weight"].ParseToDecimal(),
};
productLst.Add(prod);
}
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
var data = JsonUtils.SerializerObjectToString(productLst, jsonSetting);
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + ",\"seconds\":" + seconds + "}";
}
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\":\"输入为空\"}";
}
}
}
@@ -458,5 +458,40 @@ namespace KJD_Web
Context.Response.Write(result);
Context.Response.End();
}
//AddJSTSku
[WebMethod]
public void add_jst_sku()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().AddJSTSku(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void mdy_jst_sku()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().MdyJSTSku(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void get_jst_sku_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().GetJSTSkuList(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
}
}
@@ -116,6 +116,7 @@
<Compile Include="BLL\WXXD\WXShopManage.cs" />
<Compile Include="BLL\WXXD\WXUserManage.cs" />
<Compile Include="Model\JSTDownProdSkuInfo.cs" />
<Compile Include="Model\ShopModel\JSTListProductSkuInfo.cs" />
<Compile Include="Model\WxProdSecretSpuIdShopIdMapParam.cs" />
<Compile Include="Utils\HttpUtils.cs" />
<Compile Include="Utils\RandomUtils.cs" />
@@ -0,0 +1,47 @@
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace KJD_Web.Model.ShopModel
{
public class JSTListProductSkuInfo
{
public long id { get; set; }
public string skuId { get; set; } // "F51114C9251A4AC1A03D91256FB48EF5",
public string itemSpuId { get; set; } // "16306F9EA78643A6B8389036BFC6131B",
public string pic { get; set; } // "https://images.sursung.com/prod/item/11625838/20260213/7D4666188669485C95B31A53CE621EAB_s392918_h800_w800.jpg",
public string itemName { get; set; } // "汉服发带唐风发饰古风国风头饰女马面裙配饰",
/// <summary>
/// spu货号
/// </summary>
public string styleCode { get; set; } // "633881130581",
/// <summary>
/// sku货号
/// </summary>
public string itemCode { get; set; } // "sp01351C",
public string color { get; set; } // "葡萄花鸟复原蓝",
public string spec { get; set; } // "无规格",
public decimal? salePrice { get; set; } // 7,
//public object weight { get; set; } // null,
//public object stockLastTime { get; set; } // null,
//public object regulatePriceMin { get; set; } // null,
//public object regulatePriceMax { get; set; } // null
public decimal? supplyPrice { get; set; }
public int? stock { get; set; }
public decimal? weight { get; set; }
public DateTime stockTime { get; set; }
public string coid { get; set; }
public string supplierId { get; set; }
public string supplierName { get; set; }
public string status { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
}