优化微信上传代码
This commit is contained in:
1 parent
9e1a354ee5
commit
f71cb1bba8
13 files changed
+749
-159
No files matched your search
@@ -27,7 +27,7 @@ namespace AllBase
|
||||
/// <summary>
|
||||
/// 版本ID
|
||||
/// </summary>
|
||||
public static int VersionCount = 787;
|
||||
public static int VersionCount = 788;
|
||||
//public static int VersionCount = 613;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -391,16 +391,19 @@ namespace KJD_Web.BLL
|
||||
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
|
||||
var product_name = RegexUtils.GetStringQuery(ref inputData, "product_name")?.Replace("'", "\\'");
|
||||
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"))?.Replace("'", "\\'");
|
||||
string group = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "group"))?.Replace("'", "\\'");
|
||||
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code"))?.Replace("'", "\\'");
|
||||
|
||||
string group = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "group"))?.Replace("'", "\\'");
|
||||
string fission_words = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "fission_words"))?.Replace("'", "\\'");
|
||||
string head_words = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "head_words"))?.Replace("'", "\\'");
|
||||
string end_words = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "end_words"))?.Replace("'", "\\'");
|
||||
string cost_price = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cost_price"))?.Replace("'", "\\'");
|
||||
string delivery_fee = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "delivery_fee"))?.Replace("'", "\\'");
|
||||
string mark_fee = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "mark_fee"))?.Replace("'", "\\'");
|
||||
|
||||
string product_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_json"))?.Replace("'", "\\'");
|
||||
string size_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "size_json"))?.Replace("'", "\\'");
|
||||
|
||||
string original_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "original_json"))?.Replace("'", "\\'");
|
||||
|
||||
if (string.IsNullOrEmpty(id))
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace KJD_Web.BLL
|
||||
{
|
||||
public class ProductThirdManage
|
||||
{
|
||||
public string AddOrMdyProduct(string inputData)
|
||||
public string AddProduct(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
@@ -197,7 +197,245 @@ namespace KJD_Web.BLL
|
||||
}
|
||||
var data = JsonUtils.SerializerObjectToString(productLst);
|
||||
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
|
||||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + seconds + ",\"count\":" + seconds + "}";
|
||||
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\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
|
||||
public string GetProductListEmptyProductJsonForBak(string inputData, bool isDetail = false)
|
||||
{
|
||||
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 user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
|
||||
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
|
||||
var search_spu = RegexUtils.GetStringQuery(ref inputData, "search_spu")?.Replace("'", "\\'");
|
||||
var search_skc = RegexUtils.GetStringQuery(ref inputData, "search_skc")?.Replace("'", "\\'");
|
||||
var search_cat = RegexUtils.GetStringQuery(ref inputData, "search_cat")?.Replace("'", "\\'");
|
||||
var search_ext_code = RegexUtils.GetStringQuery(ref inputData, "search_ext_code")?.Replace("'", "\\'");
|
||||
var search_prod_name = RegexUtils.GetStringQuery(ref inputData, "search_prod_name")?.Replace("'", "\\'");
|
||||
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes")?.Replace("'", "\\'");
|
||||
var search_db_ids = RegexUtils.GetStringQuery(ref inputData, "search_db_ids")?.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 kjd.third_product where 1=1";
|
||||
|
||||
string where = "";
|
||||
if (!string.IsNullOrWhiteSpace(search_spu))
|
||||
where += " and spu_id like '%" + search_spu + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_skc))
|
||||
where += " and skc_id like '%" + search_skc + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_cat))
|
||||
where += " and cat_name like '%" + search_cat + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_ext_code))
|
||||
where += " and ext_code like '%" + search_ext_code + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_prod_name))
|
||||
where += " and product_name like '%" + search_prod_name + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_notes))
|
||||
where += " and notes like '%" + search_notes + "%'";
|
||||
if (!string.IsNullOrEmpty(search_db_ids))
|
||||
where += " and id in (" + search_db_ids + ")";
|
||||
where += " AND add_time BETWEEN '26-1-11 17:33:35' and '26-1-15 9:30:00' and product_json='{}'";
|
||||
//where += " and product_json='{}' ";
|
||||
sql += where;
|
||||
|
||||
var count = mySql.ExecuteRowCount(sql);
|
||||
|
||||
DataTable dt;
|
||||
if (count == 0)
|
||||
{
|
||||
dt = new DataTable();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isDetail)
|
||||
sql = "select * from kjd.third_product where 1=1";
|
||||
else
|
||||
sql = "select id,spu_id,skc_id,cat_id,cat_name,change_cat_id,change_cat_name,ext_code,product_name,main_img,notes," +
|
||||
"add_time,mdy_time from kjd.third_product where 1=1";
|
||||
|
||||
sql += where;
|
||||
|
||||
//sql += " order by id desc";
|
||||
sql += " order by id";
|
||||
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"]),
|
||||
skc_id = row["skc_id"].ToString(),
|
||||
spu_id = row["spu_id"].ToString(),
|
||||
cat_id = row["cat_id"].ToString(),
|
||||
cat_name = row["cat_name"].ToString(),
|
||||
change_cat_id = row["change_cat_id"].ToString(),
|
||||
change_cat_name = row["change_cat_name"].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(),
|
||||
};
|
||||
if (isDetail)
|
||||
{
|
||||
prod.product_json = row["product_json"].ToString();
|
||||
prod.size_json = row["size_json"].ToString();
|
||||
}
|
||||
productLst.Add(prod);
|
||||
}
|
||||
var data = JsonUtils.SerializerObjectToString(productLst);
|
||||
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\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string GetProductListBak(string inputData, bool isDetail = false)
|
||||
{
|
||||
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 user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
|
||||
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
|
||||
var search_spu = RegexUtils.GetStringQuery(ref inputData, "search_spu")?.Replace("'", "\\'");
|
||||
var search_skc = RegexUtils.GetStringQuery(ref inputData, "search_skc")?.Replace("'", "\\'");
|
||||
var search_cat = RegexUtils.GetStringQuery(ref inputData, "search_cat")?.Replace("'", "\\'");
|
||||
var search_ext_code = RegexUtils.GetStringQuery(ref inputData, "search_ext_code")?.Replace("'", "\\'");
|
||||
var search_prod_name = RegexUtils.GetStringQuery(ref inputData, "search_prod_name")?.Replace("'", "\\'");
|
||||
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes")?.Replace("'", "\\'");
|
||||
var search_db_ids = RegexUtils.GetStringQuery(ref inputData, "search_db_ids")?.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["ConnKJDBAK"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = "select count(id) from kjd.third_product where 1=1";
|
||||
|
||||
string where = "";
|
||||
if (!string.IsNullOrWhiteSpace(search_spu))
|
||||
where += " and spu_id = '" + search_spu + "'";
|
||||
if (!string.IsNullOrWhiteSpace(search_skc))
|
||||
where += " and skc_id = '" + search_skc + "'";
|
||||
if (!string.IsNullOrWhiteSpace(search_cat))
|
||||
where += " and cat_name like '%" + search_cat + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_ext_code))
|
||||
where += " and ext_code like '%" + search_ext_code + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_prod_name))
|
||||
where += " and product_name like '%" + search_prod_name + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_notes))
|
||||
where += " and notes like '%" + search_notes + "%'";
|
||||
if (!string.IsNullOrEmpty(search_db_ids))
|
||||
where += " and id in (" + search_db_ids + ")";
|
||||
sql += where;
|
||||
|
||||
var count = mySql.ExecuteRowCount(sql);
|
||||
|
||||
DataTable dt;
|
||||
if (count == 0)
|
||||
{
|
||||
dt = new DataTable();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isDetail)
|
||||
sql = "select * from kjd.third_product where 1=1";
|
||||
else
|
||||
sql = "select id,spu_id,skc_id,cat_id,cat_name,change_cat_id,change_cat_name,ext_code,product_name,main_img,notes," +
|
||||
"add_time,mdy_time from kjd.third_product where 1=1";
|
||||
|
||||
sql += where;
|
||||
|
||||
sql += " order by id desc";
|
||||
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"]),
|
||||
skc_id = row["skc_id"].ToString(),
|
||||
spu_id = row["spu_id"].ToString(),
|
||||
cat_id = row["cat_id"].ToString(),
|
||||
cat_name = row["cat_name"].ToString(),
|
||||
change_cat_id = row["change_cat_id"].ToString(),
|
||||
change_cat_name = row["change_cat_name"].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(),
|
||||
};
|
||||
if (isDetail)
|
||||
{
|
||||
prod.product_json = row["product_json"].ToString();
|
||||
prod.size_json = row["size_json"].ToString();
|
||||
}
|
||||
productLst.Add(prod);
|
||||
}
|
||||
var data = JsonUtils.SerializerObjectToString(productLst);
|
||||
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
|
||||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + ",\"seconds\":" + seconds + "}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -335,11 +573,11 @@ namespace KJD_Web.BLL
|
||||
|
||||
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
|
||||
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
|
||||
var product_name = RegexUtils.GetStringQuery(ref inputData, "product_name")?.Replace("'", "\\'");
|
||||
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"))?.Replace("'", "\\'");
|
||||
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code"))?.Replace("'", "\\'");
|
||||
string product_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_json"))?.Replace("'", "\\'");
|
||||
string size_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "size_json"))?.Replace("'", "\\'");
|
||||
string product_name = RegexUtils.GetStringQuery(ref inputData, "product_name");
|
||||
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"));
|
||||
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code"));
|
||||
string product_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_json"));
|
||||
string size_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "size_json"));
|
||||
|
||||
if (string.IsNullOrEmpty(id))
|
||||
{
|
||||
@@ -354,19 +592,32 @@ namespace KJD_Web.BLL
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "update kjd.third_product set";
|
||||
if (product_name != null)
|
||||
sql += " product_name='" + product_name + "',";
|
||||
sql += " product_name=@product_name,";
|
||||
if (notes != null)
|
||||
sql += " notes='" + notes + "',";
|
||||
sql += " notes=@notes,";
|
||||
if (ext_code != null)
|
||||
sql += " ext_code='" + ext_code + "',";
|
||||
sql += " ext_code=@ext_code,";
|
||||
if (product_json != null)
|
||||
sql += " product_json='" + product_json + "',";
|
||||
sql += " product_json=@product_json,";
|
||||
if (size_json != null)
|
||||
sql += " size_json='" + size_json + "',";
|
||||
sql += " size_json=@size_json,";
|
||||
sql = sql.TrimEnd(',');
|
||||
sql += " where id=" + id + ";";
|
||||
|
||||
var rst = mySql.ExecuteNonQuery(sql);
|
||||
|
||||
|
||||
|
||||
|
||||
List<MySqlParameter> paramLst = new List<MySqlParameter>();
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@product_name", Value = product_name, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@ext_code", Value = ext_code, });
|
||||
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, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@notes", Value = notes, });
|
||||
|
||||
|
||||
|
||||
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
|
||||
mySql.Close();
|
||||
if (rst)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
<UseGlobalApplicationHostFile />
|
||||
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
|
||||
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
<ProjectExtensions>
|
||||
|
||||
@@ -72,13 +72,37 @@ namespace KJD_Web
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void get_product_empty_product_json_for_bak()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new ProductThirdManage().GetProductListEmptyProductJsonForBak(jsontext, true);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void get_product_detail_list_bak()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new ProductThirdManage().GetProductListBak(jsontext, true);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public void add_product()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new ProductThirdManage().AddOrMdyProduct(jsontext);
|
||||
result = new ProductThirdManage().AddProduct(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<configuration>
|
||||
<connectionStrings>
|
||||
<add name="ConnKJD" connectionString="Max Pool Size=512;Database='kjd';Data Source='nj-cynosdbmysql-grp-hl51pkfr.sql.tencentcdb.com';Port=27660;User Id='kjd';Password='Temukjd0625';Charset=utf8mb4;"/>
|
||||
<add name="ConnKJDBAK" connectionString="Max Pool Size=512;Database='kjd';Data Source='nj-cynosdbmysql-grp-9s7x16mt.sql.tencentcdb.com';Port=24049;User Id='kjdbak';Password='Temukjd0126';Charset=utf8mb4;"/>
|
||||
<add name="UpdateVersion" connectionString="525"/>
|
||||
<add name="LowVersion" connectionString="523"/>
|
||||
<add name="UpdateExe" connectionString="http://1.13.195.131:9000/Download/Update.exe"/>
|
||||
|
||||
@@ -244,43 +244,87 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
}
|
||||
|
||||
List<ShopLoginInfo> shopLst = new List<ShopLoginInfo>();
|
||||
bool IsOnlyUpdateDBProduct = false;
|
||||
ShopListForm.Instance.Invoke(new Action(() =>
|
||||
{
|
||||
ProductThirdSelectAddShopForm shopForm = new ProductThirdSelectAddShopForm();
|
||||
shopForm.ShowDialog();
|
||||
IsOnlyUpdateDBProduct = shopForm.IsOnlyUpdateDBProduct;
|
||||
shopLst.AddRange(shopForm.lstSelectShop);
|
||||
}));
|
||||
if (shopLst.Count == 0 && IsOnlyUpdateDBProduct != true)
|
||||
return;
|
||||
|
||||
var url = BaseClass.BuildObjString("product_third/add_product");
|
||||
var data = UserLogin.GetSignaturex() +
|
||||
"&spu_id=" + product?.productId +
|
||||
"&skc_id=" + product?.productSkcList?.FirstOrDefault()?.productSkcId +
|
||||
"&cat_id=" + GetCat(product).catId +
|
||||
"&cat_name=" + HttpUtility.UrlEncode(GetCat(product).catName, Encoding.UTF8) +
|
||||
"&ext_code=" + HttpUtility.UrlEncode(product?.productSkcList?.FirstOrDefault()?.extCode, Encoding.UTF8) +
|
||||
"&product_name=" + HttpUtility.UrlEncode(product?.productName, Encoding.UTF8) +
|
||||
"&product_json=" + HttpUtility.UrlEncode(result, Encoding.UTF8) +
|
||||
"&size_json=" + HttpUtility.UrlEncode(sizeRst, Encoding.UTF8) +
|
||||
"&main_img=" + HttpUtility.UrlEncode(product?.carouselImageUrls?.FirstOrDefault(), Encoding.UTF8);
|
||||
// 读取数据库是否有相同商品
|
||||
var url = BaseClass.BuildObjString("product_third/get_product_list");
|
||||
var data = "";
|
||||
|
||||
data = UserLogin.GetSignaturex() +
|
||||
"&page=" + 1 +
|
||||
"&page_size=" + 1;
|
||||
data += "&search_spu=" + product?.productId;
|
||||
|
||||
long dbId = 0;
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
if (!string.IsNullOrEmpty(html) && html.Contains("\"code\":200"))
|
||||
{
|
||||
errorMsg = "选品商品保存失败!请检查网络连接:" +
|
||||
BaseRegex.GetStringJson(ref html, "msg").Replace("'", "\\'").Replace("\"", "\\\"");
|
||||
dbId = BaseRegex.GetIntJson(ref html, "id");
|
||||
}
|
||||
var id = BaseRegex.GetLongJson(ref html, "id");
|
||||
if (id == 0)
|
||||
|
||||
if (dbId > 0 && (1==1 || BaseMsgForm.ShowConfirm("数据库已存在相同 Spu Id 的商品,是否覆盖?(选择 取消 将新增一条数据)").DialogResult == DialogResult.OK))
|
||||
{
|
||||
url = BaseClass.BuildObjString("product_third/mdy_db_product");
|
||||
data = UserLogin.GetSignaturex() +
|
||||
"&db_id=" + dbId;
|
||||
data += "&product_json=" + HttpUtility.UrlEncode(result, Encoding.UTF8);
|
||||
data += "&size_json=" + HttpUtility.UrlEncode(sizeRst, Encoding.UTF8);
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
{
|
||||
errorMsg = "库存商品更新保存失败!请检查网络连接:" + BaseRegex.GetStringJson(ref html, "msg");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
url = BaseClass.BuildObjString("product_third/add_product");
|
||||
data = UserLogin.GetSignaturex() +
|
||||
"&spu_id=" + product?.productId +
|
||||
"&skc_id=" + product?.productSkcList?.FirstOrDefault()?.productSkcId +
|
||||
"&cat_id=" + GetCat(product).catId +
|
||||
"&cat_name=" + HttpUtility.UrlEncode(GetCat(product).catName, Encoding.UTF8) +
|
||||
"&ext_code=" + HttpUtility.UrlEncode(product?.productSkcList?.FirstOrDefault()?.extCode, Encoding.UTF8) +
|
||||
"&product_name=" + HttpUtility.UrlEncode(product?.productName, Encoding.UTF8) +
|
||||
"&product_json=" + HttpUtility.UrlEncode(result, Encoding.UTF8) +
|
||||
"&size_json=" + HttpUtility.UrlEncode(sizeRst, Encoding.UTF8) +
|
||||
"&main_img=" + HttpUtility.UrlEncode(product?.carouselImageUrls?.FirstOrDefault(), Encoding.UTF8);
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
{
|
||||
errorMsg = "选品商品保存失败!请检查网络连接:" +
|
||||
BaseRegex.GetStringJson(ref html, "msg").Replace("'", "\\'").Replace("\"", "\\\"");
|
||||
}
|
||||
dbId = BaseRegex.GetLongJson(ref html, "id");
|
||||
}
|
||||
|
||||
if (dbId == 0)
|
||||
goto end;
|
||||
|
||||
foreach (var addProdShop in shopLst)
|
||||
{
|
||||
url = BaseClass.BuildObjString("product_third/add_user_select_product");
|
||||
data = UserLogin.GetSignaturex() +
|
||||
"&out_product_id=" + id +
|
||||
"&out_product_id=" + dbId +
|
||||
"&shop_id=" + addProdShop.ShopId +
|
||||
"&shop_account=" + addProdShop.ShopAccount +
|
||||
"&main_user_name=" + addProdShop.UserName +
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DbProductListForm));
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.数据回档 = new DevComponents.DotNetBar.PanelEx();
|
||||
this.btnBatchSelect = new DevComponents.DotNetBar.PanelEx();
|
||||
this.btnSearch = new DevComponents.DotNetBar.PanelEx();
|
||||
this.btnSelect = new DevComponents.DotNetBar.PanelEx();
|
||||
@@ -139,6 +140,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.数据回档);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.btnBatchSelect);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.btnSearch);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.btnSelect);
|
||||
@@ -168,6 +170,31 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
this.splitContainer1.SplitterDistance = 70;
|
||||
this.splitContainer1.TabIndex = 1;
|
||||
//
|
||||
// 数据回档
|
||||
//
|
||||
this.数据回档.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.数据回档.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.数据回档.DisabledBackColor = System.Drawing.Color.Empty;
|
||||
this.数据回档.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.数据回档.Location = new System.Drawing.Point(996, 9);
|
||||
this.数据回档.Name = "数据回档";
|
||||
this.数据回档.Size = new System.Drawing.Size(109, 23);
|
||||
this.数据回档.Style.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.数据回档.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.数据回档.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.数据回档.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
|
||||
this.数据回档.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
|
||||
this.数据回档.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
|
||||
this.数据回档.Style.ForeColor.Color = System.Drawing.Color.White;
|
||||
this.数据回档.Style.GradientAngle = 90;
|
||||
this.数据回档.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.数据回档.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.数据回档.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.数据回档.TabIndex = 529;
|
||||
this.数据回档.Text = "数据回档";
|
||||
this.数据回档.Visible = false;
|
||||
this.数据回档.Click += new System.EventHandler(this.库存数据回档_Click);
|
||||
//
|
||||
// btnBatchSelect
|
||||
//
|
||||
this.btnBatchSelect.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
@@ -977,12 +1004,12 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
this.ucSplitPage1.CurrentPage = 1;
|
||||
this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.ucSplitPage1.IsShowPageSize = false;
|
||||
this.ucSplitPage1.Location = new System.Drawing.Point(916, 0);
|
||||
this.ucSplitPage1.Location = new System.Drawing.Point(880, 0);
|
||||
this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.ucSplitPage1.Name = "ucSplitPage1";
|
||||
this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0);
|
||||
this.ucSplitPage1.PageSize = 50;
|
||||
this.ucSplitPage1.Size = new System.Drawing.Size(362, 25);
|
||||
this.ucSplitPage1.PageSize = 200;
|
||||
this.ucSplitPage1.Size = new System.Drawing.Size(398, 25);
|
||||
this.ucSplitPage1.TabIndex = 6;
|
||||
this.ucSplitPage1.TotalPage = 1;
|
||||
//
|
||||
@@ -1102,5 +1129,6 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
private System.Windows.Forms.DataGridViewLinkColumn col_edit;
|
||||
private System.Windows.Forms.DataGridViewLinkColumn col_delete;
|
||||
private System.Windows.Forms.DataGridViewLinkColumn col_select_product;
|
||||
private DevComponents.DotNetBar.PanelEx 数据回档;
|
||||
}
|
||||
}
|
||||
@@ -83,6 +83,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
this.cmbGroup.Visible = true; // 分组
|
||||
this.btnImportHtml.Visible = true; // 导入前端直采商品
|
||||
this.btnBatchSelect.Visible = true; // 批量直传
|
||||
this.ucSplitPage1.IsShowPageSize = true;
|
||||
}
|
||||
else if (BaseClass.SaLevel > 1 && shop == null && !IsClientJit)
|
||||
{
|
||||
@@ -166,7 +167,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
{
|
||||
int pageCount;
|
||||
decimal seconds;
|
||||
var list = GetProductList(out pageCount, out seconds, page);
|
||||
var list = GetProductList(out pageCount, out seconds, page, ucSplitPage1.PageSize);
|
||||
lstTemuDbProduct.AddRange(list);
|
||||
this.ucSplitPage1.TotalPage = pageCount;
|
||||
|
||||
@@ -273,6 +274,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
seconds = 0;
|
||||
|
||||
var url = BaseClass.BuildObjString("product/get_product_list");
|
||||
//var url = BaseClass.BuildObjString("product_third/get_product_empty_product_json_for_bak");
|
||||
var data = "";
|
||||
|
||||
Invoke(new Action(() =>
|
||||
@@ -1339,5 +1341,78 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
foreach(var dbProd in dbProductLst)
|
||||
lbxProdName.Items.Add(dbProd.product_name);
|
||||
}
|
||||
|
||||
private void 库存数据回档_Click(object sender, EventArgs e)
|
||||
{
|
||||
var lstProdId = dgvDbProduct.Rows.Cast<DataGridViewRow>().Where(row
|
||||
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["col_spu_id"]?.Value.ToString()).ToList();
|
||||
var prodList = this.lstTemuDbProduct.Where(p => lstProdId.Contains(p.spu_id)).ToList();
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
//get_product_detail_list
|
||||
foreach (var prod in prodList)
|
||||
{
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
数据回档.Text = "数据回档 " + prodList.IndexOf(prod) + "/" + prodList.Count;
|
||||
}));
|
||||
|
||||
|
||||
var url = BaseClass.BuildObjString("product_third/get_product_detail_list_bak");
|
||||
var data = "";
|
||||
|
||||
data = UserLogin.GetSignaturex() +
|
||||
"&page=" + 1 +
|
||||
"&page_size=" + 1;
|
||||
data += "&search_spu=" + prod?.spu_id;
|
||||
long bakId = 0;
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (!string.IsNullOrEmpty(html) && html.Contains("\"code\":200"))
|
||||
{
|
||||
bakId = BaseRegex.GetIntJson(ref html, "id");
|
||||
}
|
||||
if (bakId <= 0)
|
||||
continue;
|
||||
|
||||
KJDDBProduct dbProd = null;
|
||||
try
|
||||
{
|
||||
var dbJson = JsonHelper.SerializeObject(JObject.Parse(html)["data"]);
|
||||
dbProd = JsonHelper.DeserializeJsonToList<KJDDBProduct>(dbJson).FirstOrDefault();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (dbProd == null)
|
||||
continue;
|
||||
|
||||
|
||||
|
||||
url = BaseClass.BuildObjString("product_third/mdy_db_product");
|
||||
data = UserLogin.GetSignaturex() +
|
||||
"&db_id=" + prod.id;
|
||||
data += "&product_json=" + HttpUtility.UrlEncode(dbProd.product_json, Encoding.UTF8);
|
||||
data += "&size_json=" + HttpUtility.UrlEncode(dbProd.size_json, Encoding.UTF8);
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
BaseMsgForm.ShowInfo("完成");
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
+41
-20
@@ -35,13 +35,14 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.dgvSelectShop = new TemuKJD.UserComponent.DataGridViewEx();
|
||||
this.btnOk = new TemuKJD.UserControls.ButtonEx();
|
||||
this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.colUserName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colSubUserName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colShopName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colShopNotes = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.btnOk = new TemuKJD.UserControls.ButtonEx();
|
||||
this.btnUpdateProduct = new TemuKJD.UserControls.ButtonEx();
|
||||
this.panel2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
@@ -74,6 +75,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.btnUpdateProduct);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.btnOk);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(391, 506);
|
||||
this.splitContainer1.SplitterDistance = 464;
|
||||
@@ -85,6 +87,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
this.dgvSelectShop.AllowUserToDeleteRows = false;
|
||||
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.dgvSelectShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
|
||||
this.dgvSelectShop.AutoRowNumber = true;
|
||||
this.dgvSelectShop.BackgroundColor = System.Drawing.Color.White;
|
||||
this.dgvSelectShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
@@ -113,23 +116,6 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
this.dgvSelectShop.TabIndex = 189;
|
||||
this.dgvSelectShop.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvSaUser_CellContentClick);
|
||||
//
|
||||
// btnOk
|
||||
//
|
||||
this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnOk.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.btnOk.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnOk.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnOk.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.btnOk.ForeColor = System.Drawing.Color.White;
|
||||
this.btnOk.Location = new System.Drawing.Point(321, 1);
|
||||
this.btnOk.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btnOk.Name = "btnOk";
|
||||
this.btnOk.Size = new System.Drawing.Size(66, 26);
|
||||
this.btnOk.TabIndex = 374;
|
||||
this.btnOk.Text = "确定";
|
||||
this.btnOk.UseVisualStyleBackColor = false;
|
||||
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
|
||||
//
|
||||
// colSelect
|
||||
//
|
||||
this.colSelect.HeaderText = "选择";
|
||||
@@ -175,14 +161,48 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
this.colShopNotes.Name = "colShopNotes";
|
||||
this.colShopNotes.ReadOnly = true;
|
||||
//
|
||||
// ProductSelectAddShopForm
|
||||
// btnOk
|
||||
//
|
||||
this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnOk.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.btnOk.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnOk.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnOk.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.btnOk.ForeColor = System.Drawing.Color.White;
|
||||
this.btnOk.Location = new System.Drawing.Point(321, 1);
|
||||
this.btnOk.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btnOk.Name = "btnOk";
|
||||
this.btnOk.Size = new System.Drawing.Size(66, 26);
|
||||
this.btnOk.TabIndex = 374;
|
||||
this.btnOk.Text = "确定";
|
||||
this.btnOk.UseVisualStyleBackColor = false;
|
||||
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
|
||||
//
|
||||
// btnUpdateProduct
|
||||
//
|
||||
this.btnUpdateProduct.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnUpdateProduct.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.btnUpdateProduct.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnUpdateProduct.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnUpdateProduct.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.btnUpdateProduct.ForeColor = System.Drawing.Color.White;
|
||||
this.btnUpdateProduct.Location = new System.Drawing.Point(5, 1);
|
||||
this.btnUpdateProduct.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btnUpdateProduct.Name = "btnUpdateProduct";
|
||||
this.btnUpdateProduct.Size = new System.Drawing.Size(110, 26);
|
||||
this.btnUpdateProduct.TabIndex = 375;
|
||||
this.btnUpdateProduct.Text = "仅更新库存商品";
|
||||
this.btnUpdateProduct.UseVisualStyleBackColor = false;
|
||||
this.btnUpdateProduct.Click += new System.EventHandler(this.btnUpdateProduct_Click);
|
||||
//
|
||||
// ProductThirdSelectAddShopForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(393, 540);
|
||||
this.Controls.Add(this.panel2);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "ProductSelectAddShopForm";
|
||||
this.Name = "ProductThirdSelectAddShopForm";
|
||||
this.Text = "选择目标店铺";
|
||||
this.TitleText = "选择目标店铺";
|
||||
this.Load += new System.EventHandler(this.ProductSelectAddShopForm_Load);
|
||||
@@ -209,5 +229,6 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colShopId;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colShopName;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colShopNotes;
|
||||
private UserControls.ButtonEx btnUpdateProduct;
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
{
|
||||
public partial class ProductThirdSelectAddShopForm : LRBaseForm
|
||||
{
|
||||
public bool IsOnlyUpdateDBProduct { get; set; } = false;
|
||||
public List<ShopLoginInfo> lstSelectShop = new List<ShopLoginInfo>();
|
||||
List<ShopLoginInfo> lstShop = new List<ShopLoginInfo>();
|
||||
public ProductThirdSelectAddShopForm()
|
||||
@@ -89,5 +90,12 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
// break;
|
||||
//}
|
||||
}
|
||||
|
||||
private void btnUpdateProduct_Click(object sender, EventArgs e)
|
||||
{
|
||||
IsOnlyUpdateDBProduct = true;
|
||||
lstSelectShop.Clear();
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
+142
-100
@@ -40,6 +40,8 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
|
||||
this.chkUpDraft = new TemuKJD.UserComponent.UcCheckBox(this.components);
|
||||
this.并发上传 = new DevComponents.DotNetBar.PanelEx();
|
||||
this.chkSkipUploaded = new TemuKJD.UserComponent.UcCheckBox(this.components);
|
||||
this.chkSameSpecPrice = new TemuKJD.UserComponent.UcCheckBox(this.components);
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
@@ -94,6 +96,17 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
this.splitContainer3 = new System.Windows.Forms.SplitContainer();
|
||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||
this.dgvShop = new TemuKJD.UserComponent.DataGridViewEx();
|
||||
this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.colShopLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colShopName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colShopNotes = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colSelectProduct = new System.Windows.Forms.DataGridViewLinkColumn();
|
||||
this.colLoginStatus = new System.Windows.Forms.DataGridViewLinkColumn();
|
||||
this.colCanUse = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.colUploadCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colRemaining = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.txtTest20981 = new System.Windows.Forms.TextBox();
|
||||
this.btnTest20981 = new DevComponents.DotNetBar.PanelEx();
|
||||
this.pbLoading = new System.Windows.Forms.PictureBox();
|
||||
@@ -127,17 +140,6 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
this.btnClear = new DevComponents.DotNetBar.PanelEx();
|
||||
this.panelEx1 = new DevComponents.DotNetBar.PanelEx();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.colShopLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colShopName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colShopNotes = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colSelectProduct = new System.Windows.Forms.DataGridViewLinkColumn();
|
||||
this.colLoginStatus = new System.Windows.Forms.DataGridViewLinkColumn();
|
||||
this.colCanUse = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.colUploadCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colRemaining = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
@@ -192,6 +194,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ucGroupBoxEx2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.ucGroupBoxEx2.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND;
|
||||
this.ucGroupBoxEx2.Controls.Add(this.并发上传);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.chkSkipUploaded);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.chkSameSpecPrice);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.label5);
|
||||
@@ -218,6 +221,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
this.ucGroupBoxEx2.Controls.Add(this.label4);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.label9);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.chkStepAddPrice);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.chkUpDraft);
|
||||
this.ucGroupBoxEx2.Location = new System.Drawing.Point(459, 2);
|
||||
this.ucGroupBoxEx2.Name = "ucGroupBoxEx2";
|
||||
this.ucGroupBoxEx2.Size = new System.Drawing.Size(1062, 140);
|
||||
@@ -225,6 +229,42 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
this.ucGroupBoxEx2.TabStop = false;
|
||||
this.ucGroupBoxEx2.Text = "商品上传";
|
||||
//
|
||||
// chkUpDraft
|
||||
//
|
||||
this.chkUpDraft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.chkUpDraft.AutoSize = true;
|
||||
this.chkUpDraft.Location = new System.Drawing.Point(770, 105);
|
||||
this.chkUpDraft.Name = "chkUpDraft";
|
||||
this.chkUpDraft.Size = new System.Drawing.Size(99, 21);
|
||||
this.chkUpDraft.TabIndex = 769;
|
||||
this.chkUpDraft.Text = "上传到草稿箱";
|
||||
this.chkUpDraft.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// 并发上传
|
||||
//
|
||||
this.并发上传.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.并发上传.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.并发上传.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.并发上传.DisabledBackColor = System.Drawing.Color.Empty;
|
||||
this.并发上传.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.并发上传.Location = new System.Drawing.Point(865, 104);
|
||||
this.并发上传.Name = "并发上传";
|
||||
this.并发上传.Size = new System.Drawing.Size(84, 23);
|
||||
this.并发上传.Style.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.并发上传.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.并发上传.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.并发上传.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
|
||||
this.并发上传.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
|
||||
this.并发上传.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
|
||||
this.并发上传.Style.ForeColor.Color = System.Drawing.Color.White;
|
||||
this.并发上传.Style.GradientAngle = 90;
|
||||
this.并发上传.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.并发上传.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.并发上传.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.并发上传.TabIndex = 768;
|
||||
this.并发上传.Text = "并发上传";
|
||||
this.并发上传.Click += new System.EventHandler(this.并发上传_Click);
|
||||
//
|
||||
// chkSkipUploaded
|
||||
//
|
||||
this.chkSkipUploaded.AutoSize = true;
|
||||
@@ -1031,6 +1071,95 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
this.dgvShop.TabIndex = 6;
|
||||
this.dgvShop.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvShop_CellContentClick);
|
||||
//
|
||||
// colSelect
|
||||
//
|
||||
this.colSelect.HeaderText = "全选";
|
||||
this.colSelect.Name = "colSelect";
|
||||
this.colSelect.ReadOnly = true;
|
||||
this.colSelect.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colSelect.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||
this.colSelect.Width = 28;
|
||||
//
|
||||
// colShopLoginName
|
||||
//
|
||||
this.colShopLoginName.HeaderText = "店铺登录名";
|
||||
this.colShopLoginName.Name = "colShopLoginName";
|
||||
this.colShopLoginName.ReadOnly = true;
|
||||
this.colShopLoginName.Visible = false;
|
||||
//
|
||||
// colShopId
|
||||
//
|
||||
this.colShopId.HeaderText = "店铺Id";
|
||||
this.colShopId.Name = "colShopId";
|
||||
this.colShopId.ReadOnly = true;
|
||||
this.colShopId.Visible = false;
|
||||
this.colShopId.Width = 55;
|
||||
//
|
||||
// colShopName
|
||||
//
|
||||
this.colShopName.FillWeight = 150F;
|
||||
this.colShopName.HeaderText = "店铺名称";
|
||||
this.colShopName.Name = "colShopName";
|
||||
this.colShopName.ReadOnly = true;
|
||||
this.colShopName.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colShopName.Width = 66;
|
||||
//
|
||||
// colShopNotes
|
||||
//
|
||||
this.colShopNotes.HeaderText = "分组";
|
||||
this.colShopNotes.Name = "colShopNotes";
|
||||
this.colShopNotes.ReadOnly = true;
|
||||
this.colShopNotes.Width = 66;
|
||||
//
|
||||
// colSelectProduct
|
||||
//
|
||||
this.colSelectProduct.HeaderText = "选择商品";
|
||||
this.colSelectProduct.Name = "colSelectProduct";
|
||||
this.colSelectProduct.ReadOnly = true;
|
||||
this.colSelectProduct.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colSelectProduct.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||
this.colSelectProduct.Visible = false;
|
||||
this.colSelectProduct.Width = 62;
|
||||
//
|
||||
// colLoginStatus
|
||||
//
|
||||
this.colLoginStatus.HeaderText = "状态";
|
||||
this.colLoginStatus.Name = "colLoginStatus";
|
||||
this.colLoginStatus.ReadOnly = true;
|
||||
this.colLoginStatus.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colLoginStatus.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||
this.colLoginStatus.Width = 38;
|
||||
//
|
||||
// colCanUse
|
||||
//
|
||||
this.colCanUse.HeaderText = "可用";
|
||||
this.colCanUse.Name = "colCanUse";
|
||||
this.colCanUse.ReadOnly = true;
|
||||
this.colCanUse.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colCanUse.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||
this.colCanUse.Visible = false;
|
||||
this.colCanUse.Width = 28;
|
||||
//
|
||||
// colUploadCount
|
||||
//
|
||||
this.colUploadCount.HeaderText = "已传";
|
||||
this.colUploadCount.Name = "colUploadCount";
|
||||
this.colUploadCount.ReadOnly = true;
|
||||
this.colUploadCount.Width = 38;
|
||||
//
|
||||
// colRemaining
|
||||
//
|
||||
this.colRemaining.HeaderText = "月限额";
|
||||
this.colRemaining.Name = "colRemaining";
|
||||
this.colRemaining.ReadOnly = true;
|
||||
this.colRemaining.Visible = false;
|
||||
//
|
||||
// colMessage
|
||||
//
|
||||
this.colMessage.HeaderText = "消息";
|
||||
this.colMessage.Name = "colMessage";
|
||||
this.colMessage.ReadOnly = true;
|
||||
//
|
||||
// txtTest20981
|
||||
//
|
||||
this.txtTest20981.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
@@ -1422,95 +1551,6 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
this.panel1.TabIndex = 189;
|
||||
this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
|
||||
//
|
||||
// colSelect
|
||||
//
|
||||
this.colSelect.HeaderText = "全选";
|
||||
this.colSelect.Name = "colSelect";
|
||||
this.colSelect.ReadOnly = true;
|
||||
this.colSelect.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colSelect.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||
this.colSelect.Width = 28;
|
||||
//
|
||||
// colShopLoginName
|
||||
//
|
||||
this.colShopLoginName.HeaderText = "店铺登录名";
|
||||
this.colShopLoginName.Name = "colShopLoginName";
|
||||
this.colShopLoginName.ReadOnly = true;
|
||||
this.colShopLoginName.Visible = false;
|
||||
//
|
||||
// colShopId
|
||||
//
|
||||
this.colShopId.HeaderText = "店铺Id";
|
||||
this.colShopId.Name = "colShopId";
|
||||
this.colShopId.ReadOnly = true;
|
||||
this.colShopId.Visible = false;
|
||||
this.colShopId.Width = 55;
|
||||
//
|
||||
// colShopName
|
||||
//
|
||||
this.colShopName.FillWeight = 150F;
|
||||
this.colShopName.HeaderText = "店铺名称";
|
||||
this.colShopName.Name = "colShopName";
|
||||
this.colShopName.ReadOnly = true;
|
||||
this.colShopName.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colShopName.Width = 66;
|
||||
//
|
||||
// colShopNotes
|
||||
//
|
||||
this.colShopNotes.HeaderText = "分组";
|
||||
this.colShopNotes.Name = "colShopNotes";
|
||||
this.colShopNotes.ReadOnly = true;
|
||||
this.colShopNotes.Width = 66;
|
||||
//
|
||||
// colSelectProduct
|
||||
//
|
||||
this.colSelectProduct.HeaderText = "选择商品";
|
||||
this.colSelectProduct.Name = "colSelectProduct";
|
||||
this.colSelectProduct.ReadOnly = true;
|
||||
this.colSelectProduct.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colSelectProduct.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||
this.colSelectProduct.Visible = false;
|
||||
this.colSelectProduct.Width = 62;
|
||||
//
|
||||
// colLoginStatus
|
||||
//
|
||||
this.colLoginStatus.HeaderText = "状态";
|
||||
this.colLoginStatus.Name = "colLoginStatus";
|
||||
this.colLoginStatus.ReadOnly = true;
|
||||
this.colLoginStatus.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colLoginStatus.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||
this.colLoginStatus.Width = 38;
|
||||
//
|
||||
// colCanUse
|
||||
//
|
||||
this.colCanUse.HeaderText = "可用";
|
||||
this.colCanUse.Name = "colCanUse";
|
||||
this.colCanUse.ReadOnly = true;
|
||||
this.colCanUse.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colCanUse.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||
this.colCanUse.Visible = false;
|
||||
this.colCanUse.Width = 28;
|
||||
//
|
||||
// colUploadCount
|
||||
//
|
||||
this.colUploadCount.HeaderText = "已传";
|
||||
this.colUploadCount.Name = "colUploadCount";
|
||||
this.colUploadCount.ReadOnly = true;
|
||||
this.colUploadCount.Width = 38;
|
||||
//
|
||||
// colRemaining
|
||||
//
|
||||
this.colRemaining.HeaderText = "月限额";
|
||||
this.colRemaining.Name = "colRemaining";
|
||||
this.colRemaining.ReadOnly = true;
|
||||
this.colRemaining.Visible = false;
|
||||
//
|
||||
// colMessage
|
||||
//
|
||||
this.colMessage.HeaderText = "消息";
|
||||
this.colMessage.Name = "colMessage";
|
||||
this.colMessage.ReadOnly = true;
|
||||
//
|
||||
// WXDBProdUploadForm
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
@@ -1659,5 +1699,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colUploadCount;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colRemaining;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colMessage;
|
||||
private DevComponents.DotNetBar.PanelEx 并发上传;
|
||||
private UserComponent.UcCheckBox chkUpDraft;
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ using AllBase.Model.Result.PDDResult;
|
||||
using AllBase.Model.Param.WXParam;
|
||||
using AllBase.Model.Result.WXResult;
|
||||
using Newtonsoft.Json;
|
||||
using NaiBa.Util;
|
||||
|
||||
namespace TemuKJD.WXForms.ProductForms
|
||||
{
|
||||
@@ -403,6 +404,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void btnUpload_Click(object sender, EventArgs e)
|
||||
{
|
||||
var shopIdLst = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
|
||||
@@ -1679,13 +1681,18 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
}
|
||||
|
||||
upProdParam.product.productKey.productId = BaseRegex.GetLongJson(ref uploadDraftRst, "productId").ParseToString();
|
||||
upload_draft_products.Add(upProdParam);
|
||||
if (chkUpDraft.Checked)
|
||||
return "{\"success\":true,\"draftId\":" + upProdParam.product.productKey.productId + ",\"status\":\"草稿箱\",\"errMsg\":\"上架到草稿箱\"}";
|
||||
|
||||
// 提交商品上架
|
||||
var uploadProdRst = WXUpload.upProductV2(shop, upProdParam);
|
||||
if (!uploadProdRst.Contains("\"code\":0") && !uploadProdRst.Contains("\"success\":true"))
|
||||
{
|
||||
var error = BaseRegex.GetStringJson(ref uploadProdRst, "msg");
|
||||
if (string.IsNullOrEmpty(error))
|
||||
error = uploadProdRst;
|
||||
return "{\"success\":false,\"draftId\":0,\"status\":\"草稿箱\",\"errMsg\":\"上架失败 " + error + "\"}";
|
||||
return "{\"success\":false,\"draftId\":" + upProdParam.product.productKey.productId + ",\"status\":\"草稿箱\",\"errMsg\":\"上架失败 " + error + "\"}";
|
||||
}
|
||||
if (cell != null)
|
||||
{
|
||||
@@ -2038,6 +2045,92 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
GetRandomProductList(out prodCount, 1, 1);
|
||||
lblGoodsCount.Text = "产品库 " + prodCount + " 件";
|
||||
}
|
||||
|
||||
private void 并发上传_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
var draftIdLst = dgvSelectProduct.Rows.Cast<DataGridViewRow>().Where(row
|
||||
=> row.Cells["colCheck"]?.Value.ParseToBool() == true).Select(r => r.Cells["colDraftId"]?.Value.ToString()).ToList();
|
||||
|
||||
// var lst = NaiBa.Util.Helper.ConfigHelper.LoadConfig<NaiBa.Util.ConcurrentList<WXUploadProductParam>>("wx_upload_draft_products");
|
||||
// if (lst == null)
|
||||
// lst = new ConcurrentList<WXUploadProductParam>();
|
||||
|
||||
var lst = upload_draft_products;
|
||||
|
||||
var upLst = lst.Where(l => draftIdLst.Contains(l.product.productKey.productId)).ToList();
|
||||
DateTime startTime = DateTime.Now;
|
||||
Task.Run(() =>
|
||||
{
|
||||
List<Task> tLst = new List<Task>();
|
||||
foreach (var prodParam in upLst)
|
||||
{
|
||||
var row = this.dgvSelectProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colDraftId"].Value.ParseToString() == prodParam.product.productKey.productId);
|
||||
if (row == null)
|
||||
continue;
|
||||
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == row.Cells["colSupplierId"].Value.ParseToString());
|
||||
if (shop == null)
|
||||
continue;
|
||||
var t =Task.Run(() =>
|
||||
{
|
||||
UploadSameTime(shop, prodParam, row.Cells["colOpResult"]);
|
||||
});
|
||||
tLst.Add(t);
|
||||
}
|
||||
Task.WaitAll(tLst.ToArray());
|
||||
var duration = DateTime.Now - startTime;
|
||||
Invoke(new Action(() => { BaseMsgForm.ShowInfo("并发上传完成,耗时:" + duration.TotalSeconds + " 秒"); }));
|
||||
});
|
||||
}
|
||||
|
||||
public ConcurrentList<WXUploadProductParam> upload_draft_products = new ConcurrentList<WXUploadProductParam>();
|
||||
void UploadSameTime(ShopLoginInfo shop, WXUploadProductParam upProdParam, DataGridViewCell cell)
|
||||
{
|
||||
|
||||
var uploadProdRst = WXUpload.upProductV2(shop, upProdParam);
|
||||
int retryTimes = 0;
|
||||
while (!uploadProdRst.Contains("\"code\":0") && !uploadProdRst.Contains("\"success\":true"))
|
||||
{
|
||||
retryTimes++;
|
||||
uploadProdRst = WXUpload.upProductV2(shop, upProdParam);
|
||||
if (retryTimes >= 5)
|
||||
break;
|
||||
}
|
||||
if (!uploadProdRst.Contains("\"code\":0") && !uploadProdRst.Contains("\"success\":true"))
|
||||
{
|
||||
var error = BaseRegex.GetStringJson(ref uploadProdRst, "msg");
|
||||
if (string.IsNullOrEmpty(error))
|
||||
error = uploadProdRst;
|
||||
|
||||
if (cell != null)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
cell.Value = "商品上传失败 " + error;
|
||||
}));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cell != null)
|
||||
{
|
||||
upload_draft_products.Remove(upProdParam);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
cell.Value = "商品已上传,重试次数 " + retryTimes;
|
||||
}));
|
||||
}
|
||||
|
||||
var dgvShopRow = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(row => row.Cells["colShopId"]?.Value.ParseToString() == shop.ShopId);
|
||||
if (dgvShopRow != null)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
dgvShopRow.Cells["colUploadCount"].Value = dgvShopRow.Cells["colUploadCount"].Value.ParseToInt() + 1;
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class WXUpload
|
||||
|
||||
Reference in new issue
Block a user