diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs
index dc3377f..84c613c 100644
--- a/AllBase/BaseClass.cs
+++ b/AllBase/BaseClass.cs
@@ -27,7 +27,7 @@ namespace AllBase
///
/// 版本ID
///
- public static int VersionCount = 953;
+ public static int VersionCount = 955;
//public static int VersionCount = 613;
///
diff --git a/TEMUKJD/Extension/DataGridViewExtension.cs b/TEMUKJD/Extension/DataGridViewExtension.cs
index 18b3d8a..1db717b 100644
--- a/TEMUKJD/Extension/DataGridViewExtension.cs
+++ b/TEMUKJD/Extension/DataGridViewExtension.cs
@@ -736,7 +736,7 @@ namespace TemuKJD.Extension
public static void AddImgColumn(this DataGridView dgv, string imgColumn, string imgPathColumn, bool isSetHttpsHttp = true)
{
- bool isScroll = false;
+ //bool isScroll = false;
CancellationTokenSource cancelToken = new CancellationTokenSource();
dgv.Scroll += (s, e) =>
@@ -782,7 +782,10 @@ namespace TemuKJD.Extension
//while (isScroll && 1 == 1)
// Thread.Sleep(1);
//isScroll = true;
- ShowDgvImg(cancelToken, dgv, new List { dgv.Rows[e.RowIndex] }, imgColumn, imgPathColumn, isSetHttpsHttp);
+ if (e.RowIndex < (dgv.FirstDisplayedScrollingRowIndex + dgv.DisplayedRowCount(true)))
+ ShowDgvImg(cancelToken, dgv, dgv.Rows.Cast().ToList(), imgColumn, imgPathColumn, isSetHttpsHttp);
+ else
+ ShowDgvImg(cancelToken, dgv, new List { dgv.Rows[e.RowIndex] }, imgColumn, imgPathColumn, isSetHttpsHttp);
//isScroll = false;
}, cancelToken.Token);
};
diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs
index d9d9f80..292260d 100644
--- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs
+++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs
@@ -593,60 +593,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
}
- //Bitmap defaultBitmap = new Bitmap(80, 80);
- void ShowDgvImg()
- {
- //Task.Run(() =>
- //{
- // foreach (DataGridViewRow row in this.dgvSelectProduct.Rows)
- // {
- // if (row.Index > 0 && row.Cells["colProductSkcPic"].Displayed == false)
- // {
- // try
- // {
- // Invoke(new Action(() =>
- // {
- // row.Cells["colProductSkcPic"].Value = defaultBitmap;
- // }));
- // }
- // catch
- // {
- // }
- // continue;
- // }
-
- // if (row.Index >= 0 && row.Cells["colProductSkcPic"].Value != null && row.Cells["colProductSkcPic"].Value != defaultBitmap)
- // continue;
-
- // Image image = null;
- // if (row.Index >= 0)
- // {
- // string imgUrl = row.Cells["colImgUrl"]?.Value.ParseToString();
- // string getImgError = "";
- // if (!string.IsNullOrWhiteSpace(imgUrl))
- // image = GetHtml.GetUrlImg(imgUrl, out getImgError);
- // if (!string.IsNullOrEmpty(getImgError))
- // //BaseMsgForm.ShowError("图片加载失败 " + getImgError);
- // image = TemuKJD.Properties.Resources.errpic;
- // }
-
- // try
- // {
- // Invoke(new Action(() =>
- // {
- // if (row.Index >= 0)
- // {
- // row.Cells["colProductSkcPic"].Value = image;
- // }
- // }));
- // }
- // catch
- // {
- // }
- // }
- //});
- }
-
private void dgvSelectProduct_Scroll(object sender, ScrollEventArgs e)
{
//ShowDgvImg();
@@ -6110,7 +6056,7 @@ Content-Type: image/jpeg
{
Invoke(new Action(() =>
{
- BaseMsgForm.ShowError("获取商品失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg"));
+ //BaseMsgForm.ShowError("获取商品失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg"));
}));
return new List();
}
@@ -6807,10 +6753,11 @@ Content-Type: image/jpeg
{
Thread.Sleep(500);
continue;
- }
+ }
// 选出一个勾选且空闲的店铺
- var selectShopLst = GlobalConfig.ShopLoginList.Where(s => shopIdLst.Contains(s.ShopId));
+ NaiBa.Util.ConcurrentList selectShopLst = new NaiBa.Util.ConcurrentList();
+ selectShopLst.AddRange(GlobalConfig.ShopLoginList.Where(s => shopIdLst.Contains(s.ShopId)));
var canUpShop = selectShopLst.OrderBy(x => Randomx.GetId(int.MaxValue)).FirstOrDefault(s => !currentUpShopLst.Contains(s));
if (canUpShop == null)
{
@@ -6844,9 +6791,17 @@ Content-Type: image/jpeg
}
}
selectProd = CompanyProdLst.FirstOrDefault();
- selectProd.shop_id = canUpShop.ShopId;
- selectProd.shop_account = canUpShop.ShopAccount;
- CompanyProdLst.Remove(selectProd);
+ if (selectProd != null)
+ {
+ selectProd.shop_id = canUpShop.ShopId;
+ selectProd.shop_account = canUpShop.ShopAccount;
+ CompanyProdLst.Remove(selectProd);
+ }
+ else
+ {
+ Thread.Sleep(500);
+ continue;
+ }
}
else
{
@@ -6871,39 +6826,46 @@ Content-Type: image/jpeg
Invoke(new Action(() =>
{
int rowIndex = 0;
- this.dgvSelectProduct.Rows.Insert(rowIndex,
- true,
- selectProd.id,
- selectProd.shop_id,
- selectProd.shop_account,
- "登录",
- "进店",
- //prod.spu_id,
- BaseClass.SaLevel > 0 ? selectProd.spu_id : selectProd.spu_id.ParseToString().GetHashCode().ParseToString().Trim('-'),
- selectProd.skc_id,
- selectProd.main_img,
- null,
- "",
- null,
- selectProd.product_name, // 用户端显示商品原名
- selectProd.cat_name,
- //prod.secret_spu_id == null ? prod.ext_code : prod.secret_spu_id,
- BaseClass.SaLevel > 0 ? selectProd.ext_code : selectProd.ext_code.ParseToString().GetHashCode().ParseToString().Trim('-'),
- selectProd.status,
- selectProd.draft_id,
- selectProd.notes,
- (selectProd.user_notes + " 编辑").Trim(),
- "删除",
- "",
- "");
- row = dgvSelectProduct.Rows[rowIndex];
- row.Height = 60;
-
- int maxRowCount = 10000;
- while (dgvSelectProduct.Rows.Count > maxRowCount)
+ try
{
- dgvSelectProduct.Rows.RemoveAt(maxRowCount);
+ this.dgvSelectProduct.Rows.Insert(rowIndex,
+ true,
+ selectProd.id,
+ selectProd.shop_id,
+ selectProd.shop_account,
+ "登录",
+ "进店",
+ //prod.spu_id,
+ BaseClass.SaLevel > 0 ? selectProd.spu_id : selectProd.spu_id.ParseToString().GetHashCode().ParseToString().Trim('-'),
+ selectProd.skc_id,
+ selectProd.main_img,
+ DataGridViewExtension.defaultBitmap,
+ "",
+ DataGridViewExtension.defaultBitmap,
+ selectProd.product_name, // 用户端显示商品原名
+ selectProd.cat_name,
+ //prod.secret_spu_id == null ? prod.ext_code : prod.secret_spu_id,
+ BaseClass.SaLevel > 0 ? selectProd.ext_code : selectProd.ext_code.ParseToString().GetHashCode().ParseToString().Trim('-'),
+ selectProd.status,
+ selectProd.draft_id,
+ selectProd.notes,
+ (selectProd.user_notes + " 编辑").Trim(),
+ "删除",
+ "",
+ "");
+ row = dgvSelectProduct.Rows[rowIndex];
+ row.Height = 60;
+
+ int maxRowCount = 10000;
+ while (dgvSelectProduct.Rows.Count > maxRowCount)
+ {
+ dgvSelectProduct.Rows.RemoveAt(maxRowCount);
+ }
}
+ catch
+ {
+ }
+
}));
// 接口上传
@@ -6979,7 +6941,8 @@ Content-Type: image/jpeg
DataGridViewCell cell = row.Cells["colOpResult"];
Invoke(new Action(() =>
{
- cell.Value = "正在初始化商品";
+ if (cell != null)
+ cell.Value = "正在初始化商品";
}));
// 模拟多线程一起上货
@@ -6991,14 +6954,22 @@ Content-Type: image/jpeg
dbProd = GetProductDetail(selectProd.out_product_Id.ToString());
if (!string.IsNullOrEmpty(dbProd.secret_spu_id))
{
- Invoke(new Action(() => { row.Cells["colExtCode"].Value = dbProd.secret_spu_id; }));
+ Invoke(new Action(() =>
+ {
+ if (row != null && row.Index >= 0)
+ row.Cells["colExtCode"].Value = dbProd.secret_spu_id;
+ }));
}
if (dbProd == null || dbProd.id == 0)
{
if (selectProd?.id == 0)
{
- Invoke(new Action(() => { row.Cells["colStatus"].Value = "已清除"; }));
selectProd.status = "已清除";
+ Invoke(new Action(() =>
+ {
+ if (row != null && row.Index >= 0)
+ row.Cells["colStatus"].Value = "已清除";
+ }));
}
return "数据库商品获取失败";
}
@@ -7006,10 +6977,17 @@ Content-Type: image/jpeg
#region 将聚水潭产品数据格式进行转换成pdd格式统一上传,匹配加密的spuCode和skuCoke
if (dbProd.product_get_type_text == "厂商直采" && dbProd.sku_secret_json != null && dbProd.sku_secret_json.Contains("goodsId"))
{
- string convertRst = "";
- var pProd = new PDDProdFormConverter().JstPddProdToPddConvert(out convertRst, dbProd);
- if (!string.IsNullOrEmpty(convertRst))
- return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"商品查询错误 " + convertRst + "\"}";
+ try
+ {
+ string convertRst = "";
+ var pProd = new PDDProdFormConverter().JstPddProdToPddConvert(out convertRst, dbProd);
+ if (!string.IsNullOrEmpty(convertRst))
+ return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"源商品查询错误 " + convertRst + "\"}";
+ }
+ catch (Exception ex)
+ {
+ return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"源商品格式转换错误 " + ex.Message + "\"}";
+ }
}
#endregion
@@ -7026,7 +7004,8 @@ Content-Type: image/jpeg
cnt++;
Invoke(new Action(() =>
{
- cell.Value = "正在上传主图 " + cnt + "/" + prodInfo.detail.galleries.Where(g => g.type == 1).ToList().Count;
+ if (cell != null)
+ cell.Value = "正在上传主图 " + cnt + "/" + prodInfo.detail?.galleries?.Where(g => g.type == 1).ToList().Count;
}));
string errMsg = "";
@@ -7054,7 +7033,8 @@ Content-Type: image/jpeg
Invoke(new Action(() =>
{
- cell.Value = "正在选取运费模板";
+ if (cell != null)
+ cell.Value = "正在选取运费模板";
}));
// 运费模板
var pddAddressApi = new PddApi(shop);
@@ -7085,7 +7065,8 @@ Content-Type: image/jpeg
cnt++;
Invoke(new Action(() =>
{
- cell.Value = "正在上传详情图 " + cnt + "/" + prodInfo.detail.galleries.Where(g => g.type == 2).ToList().Count;
+ if (cell != null)
+ cell.Value = "正在上传详情图 " + cnt + "/" + prodInfo.detail?.galleries?.Where(g => g.type == 2).ToList().Count;
}));
string errMsg = "";
@@ -7115,7 +7096,8 @@ Content-Type: image/jpeg
Invoke(new Action(() =>
{
- cell.Value = "正在生成属性";
+ if (cell != null)
+ cell.Value = "正在生成属性";
}));
// 获取类目属性模板
var pddApiCatRule = new PddApi(shop);
@@ -7247,11 +7229,13 @@ Content-Type: image/jpeg
#region 厂商直采获取推单运费模板,计算运费加价。
//Invoke(new Action(() =>
//{
- // cell.Value = "正在选取运费模板";
+ // if (cell != null)
+ // cell.Value = "正在选取运费模板";
//}));
Invoke(new Action(() =>
{
- cell.Value = "正在计算加价";
+ if (cell != null)
+ cell.Value = "正在计算加价";
}));
var shippingTemplateJson = "";
@@ -7432,7 +7416,8 @@ Content-Type: image/jpeg
{
Invoke(new Action(() =>
{
- cell.Value = "正在生成Sku规格 " + (i + 1) + "/" + addPriceSkuInfoLst.Count;
+ if (cell != null)
+ cell.Value = "正在生成Sku规格 " + (i + 1) + "/" + addPriceSkuInfoLst.Count;
}));
for (int j = 0; j < addPriceSkuInfoLst[i].spec.Count; j++)
@@ -7480,7 +7465,8 @@ Content-Type: image/jpeg
{
Invoke(new Action(() =>
{
- cell.Value = "正在拼接Sku " + (i + 1) + "/" + addPriceSkuInfoLst.Count;
+ if (cell != null)
+ cell.Value = "正在拼接Sku " + (i + 1) + "/" + addPriceSkuInfoLst.Count;
}));
string spec = "";
@@ -7640,9 +7626,7 @@ Content-Type: image/jpeg
Invoke(new Action(() =>
{
if (cell != null)
- {
cell.Value = "正在编辑商品属性";
- }
}));
List goods_property_param_lst = new List();
goods_property_param_lst.Add(prop);
diff --git a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs
index d53dbbb..1f845c4 100644
--- a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs
+++ b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs
@@ -2789,7 +2789,7 @@ namespace TemuKJD.WXForms.ProductForms
{
foreach (var propInfo in prodInfo.property.goods_properties)
{
- if (propInfo.name == "单件净含量")
+ if (propInfo.name == "容量")
{
}
@@ -2984,8 +2984,19 @@ namespace TemuKJD.WXForms.ProductForms
// attrValue = "20 cm";
//else if (attr.value.Contains("岁以上") && attr.value.Contains("个月以上"))
// attrValue = "7 岁以上";
- //else if (attr.value == "只;个")
- // attrValue = "1 个";
+ else if (attr.value == "只;个")
+ {
+ if ((propInfo.values.FirstOrDefault()?.value).ParseToString().EndsWith("只") || (propInfo.values.FirstOrDefault()?.value).ParseToString().EndsWith("个"))
+ {
+ attrValue = propInfo.values.FirstOrDefault()?.value;
+ if (attrValue.TrimEnd('只', '个').ParseToInt() == 0)
+ attrValue = BaseRegex.GetMatchMaxRegexString(ref attrValue, "(\\d{1,6})") + (attrValue.Contains("只") ? " 只" : " 个");
+ if (attrValue.TrimEnd('只', '个').ParseToInt() == 0)
+ attrValue = "1 个";
+ }
+ else
+ attrValue = "1 个";
+ }
else if (attr.value == "ml")
{
if ((propInfo.values.FirstOrDefault()?.value).ParseToString().EndsWith(attr.value))
@@ -2996,9 +3007,15 @@ namespace TemuKJD.WXForms.ProductForms
else if (attr.value == "L")
{
if ((propInfo.values.FirstOrDefault()?.value).ParseToString().EndsWith(attr.value))
+ {
attrValue = propInfo.values.FirstOrDefault()?.value;
+ if (attrValue.TrimEnd('L').ParseToInt() == 0)
+ attrValue = BaseRegex.GetMatchMaxRegexString(ref attrValue, "(\\d{1,6})") + " L";
+ if (attrValue.TrimEnd('L').ParseToInt() == 0)
+ attrValue = "1 L";
+ }
else
- attr.value = "100 ml";
+ attr.value = "1 L";
}
else if (attr.value == "g;kg;ml;L")
{
@@ -3158,6 +3175,8 @@ namespace TemuKJD.WXForms.ProductForms
attrValue = "1 个";
else if (attr.value == "ml")
attrValue = "100 ml";
+ else if (attr.value == "L")
+ attrValue = "1 L";
}
var wxPropParam = new wxPropParam();