微信商品上传货号extcode优化 产品数据库查询逻辑优化
This commit is contained in:
1 parent
4fdcc94a91
commit
5ade769d7d
5 files changed
+131
-11
No files matched your search
@@ -1545,7 +1545,24 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
}
|
||||
}
|
||||
|
||||
string UploadProduct(ShopLoginInfo shop, KJDDBProduct dbProd, TemuDBProductSelect selectProd, DataGridViewCell cell, DateTime startTime)
|
||||
public static string GetEC1ExtCode(string spu_id)
|
||||
{
|
||||
if (spu_id.IsNullOrEmpty())
|
||||
throw new Exception("货号指定失败,值不能为空!");
|
||||
if (!spu_id.StartsWith("EC1") && !spu_id.EndsWith("A"))
|
||||
return "EC1" + spu_id + "A";
|
||||
return spu_id;
|
||||
}
|
||||
public static string GetNewExtCode(string spu_id)
|
||||
{
|
||||
if (spu_id.IsNullOrEmpty())
|
||||
throw new Exception("货号指定失败,值不能为空!");
|
||||
if (!spu_id.StartsWith("P1-"))
|
||||
return "P1-" + spu_id;
|
||||
return spu_id;
|
||||
}
|
||||
|
||||
string UploadProduct(ShopLoginInfo shop, KJDDBProduct dbProd, TemuDBProductSelect selectProd, DataGridViewCell cell, DateTime startTime)
|
||||
{
|
||||
#region 初始化上传商品对象
|
||||
// 生成初始化上传商品对象
|
||||
@@ -1627,7 +1644,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
{
|
||||
var searchExtCode = dbProd.ext_code;
|
||||
if (searchExtCode.ParseToString().Length < 10)
|
||||
searchExtCode = "EC1" + dbProd.spu_id + "A";
|
||||
searchExtCode = GetEC1ExtCode(dbProd.spu_id);
|
||||
if (dbProd.sku_secret_json != null && dbProd.sku_secret_json.Contains("goodsId"))
|
||||
{
|
||||
var sku_secret_json = dbProd.sku_secret_json;
|
||||
@@ -2371,7 +2388,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
if (extCode.IsNullOrEmpty() || extCode.Length <= 10)
|
||||
{
|
||||
//extCode = "EC" + Randomx.GetId(1000).ToString().PadLeft(3, '0') + dbProd.spu_id + "C";
|
||||
extCode = "EC1" + dbProd.spu_id + "A";
|
||||
extCode = GetEC1ExtCode(dbProd.spu_id);
|
||||
}
|
||||
upProdParam.product.info.spuCode = extCode;
|
||||
upProdParam.product.info.outProductId = extCode;
|
||||
|
||||
@@ -189,15 +189,24 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
isNotCount = false;
|
||||
}
|
||||
|
||||
if (cancellationTokenSource != null)
|
||||
cancellationTokenSource.Cancel();
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
Task.Run(() =>
|
||||
{
|
||||
int pageCount;
|
||||
var cancelToken = cancellationTokenSource.Token;
|
||||
|
||||
int pageCount;
|
||||
int totalCount;
|
||||
int pageSize = 100;
|
||||
decimal seconds;
|
||||
Invoke(new Action(() => { pageSize = this.ucSplitPage1.PageSize; }));
|
||||
var list = GetProductList(out pageCount, out totalCount, out seconds, page, pageSize, isNotCount);
|
||||
lstTemuDbProduct.AddRange(list);
|
||||
|
||||
if (cancelToken.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
lstTemuDbProduct.AddRange(list);
|
||||
this.ucSplitPage1.TotalPage = pageCount;
|
||||
this.ucSplitPage1.TotalCount = totalCount;
|
||||
|
||||
@@ -211,6 +220,9 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
}
|
||||
foreach (var prod in lstTemuDbProduct.Reverse().ToList())
|
||||
{
|
||||
if (cancelToken.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
var catName = GetProdCateName(prod);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
@@ -270,7 +282,9 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
}));
|
||||
}
|
||||
|
||||
Invoke(new Action(() =>
|
||||
if (cancelToken.IsCancellationRequested)
|
||||
return;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
ShowDgvImg();
|
||||
this.pbLoading.Visible = false;
|
||||
@@ -280,7 +294,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
#endif
|
||||
this.statusBar.lblTaskStatus.Text += needKeepStatusText;
|
||||
}));
|
||||
});
|
||||
}, cancellationTokenSource.Token);
|
||||
}
|
||||
|
||||
public static string GetProdCateName(KJDDBProduct prod)
|
||||
|
||||
Reference in new issue
Block a user