修复上传问题
This commit is contained in:
1 parent
c0b7c2d986
commit
b62deb2e99
4 files changed
+121
-115
No files matched your search
@@ -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<KJDDBProduct>();
|
||||
}
|
||||
@@ -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<ShopLoginInfo> selectShopLst = new NaiBa.Util.ConcurrentList<ShopLoginInfo>();
|
||||
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> goods_property_param_lst = new List<goods_property_param>();
|
||||
goods_property_param_lst.Add(prop);
|
||||
|
||||
Reference in new issue
Block a user