部分功能优化,选品上传卡死可以强制解锁按钮再传

This commit is contained in:
wule committed 2025-11-24 19:39:27 +08:00
1 parent ec170f4285
commit 5cc74f36f6
7 files changed
+193 -58

No files matched your search

+1 -1
View File
@@ -27,7 +27,7 @@ namespace AllBase
/// <summary> /// <summary>
/// 版本ID /// 版本ID
/// </summary> /// </summary>
public static int VersionCount = 689; public static int VersionCount = 691;
//public static int VersionCount = 613; //public static int VersionCount = 613;
/// <summary> /// <summary>
@@ -75,34 +75,56 @@ namespace TemuKJD.KJDForms.AdminForms
} }
} }
//var url = BaseClass.BuildObjString("product/get_product_list"); // 读取数据库是否有相同商品
//var data = ""; var url = BaseClass.BuildObjString("product/get_product_list");
var data = "";
//data = UserLogin.GetSignaturex() + data = UserLogin.GetSignaturex() +
// "&page=" + 1 + "&page=" + 1 +
// "&page_size=" + 1; "&page_size=" + 1;
//data += "&search_spu=" + product?.productId; data += "&search_spu=" + product?.productId;
////data += "&search_skc=" + product?.productSkcList?.FirstOrDefault()?.productSkcId; if (BaseClass.SaLevel == 1) // 店铺非空管理状态允许查看 后台采集 和 前端采集 的所有商品
//int count = 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"))
//{
// count = BaseRegex.GetIntJson(ref html, "count");
//}
//if (count > 0 && BaseMsgForm.ShowConfirm("数据库已存在相同 Spu Id 的商品,是否覆盖?(选择否新增一条数据)").DialogResult == DialogResult.OK)
//{
//}
//else
{ {
var url = BaseClass.BuildObjString("product/add_product"); data += "&product_get_type=all";
var data = Work.UserLogin.GetSignaturex() + }
//data += "&search_skc=" + product?.productSkcList?.FirstOrDefault()?.productSkcId;
int 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"))
{
dbId = BaseRegex.GetIntJson(ref html, "id");
}
if (dbId > 0 && BaseMsgForm.ShowConfirm("数据库已存在相同 Spu Id 的商品,是否覆盖?(选择 取消 将新增一条数据)").DialogResult == DialogResult.OK)
{
url = BaseClass.BuildObjString("product/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);
//data += "&original_json=" + HttpUtility.UrlEncode(JsonHelper.SerializeObject(clientProdInfo), 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"))
{
string msg = "选品商品更新保存失败!请检查网络连接:" + BaseRegex.GetStringJson(ref html, "msg");
OnInfoReceived(msg);
}
else
{
OnInfoReceived("选品商品更新保存成功!" + success_err_msg);
}
}
else
{
url = BaseClass.BuildObjString("product/add_product");
data = Work.UserLogin.GetSignaturex() +
"&spu_id=" + product?.productId + "&spu_id=" + product?.productId +
"&skc_id=" + product?.productSkcList?.FirstOrDefault()?.productSkcId + "&skc_id=" + product?.productSkcList?.FirstOrDefault()?.productSkcId +
"&cat_id=" + GetCat(product).catId + "&cat_id=" + GetCat(product).catId +
@@ -119,8 +141,7 @@ namespace TemuKJD.KJDForms.AdminForms
html = GetHtml.PostUtf8(url, data); html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{ {
string msg = "选品商品保存失败!请检查网络连接:" + string msg = "选品商品保存失败!请检查网络连接:" + BaseRegex.GetStringJson(ref html, "msg");
BaseRegex.GetStringJson(ref html, "msg");
OnInfoReceived(msg); OnInfoReceived(msg);
} }
else else
@@ -1056,7 +1056,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
dbId = BaseRegex.GetIntJson(ref html, "id"); dbId = BaseRegex.GetIntJson(ref html, "id");
} }
if (dbId > 0 && BaseMsgForm.ShowConfirm("数据库已存在相同ID的商品,是否覆盖?(选择否新增一条数据)").DialogResult == DialogResult.OK) if (dbId > 0 && BaseMsgForm.ShowConfirm("数据库已存在相同ID的商品,是否覆盖?(选择 取消 将新增一条数据)").DialogResult == DialogResult.OK)
{ {
url = BaseClass.BuildObjString("product/mdy_db_product"); url = BaseClass.BuildObjString("product/mdy_db_product");
data = UserLogin.GetSignaturex() + data = UserLogin.GetSignaturex() +
@@ -1069,12 +1069,12 @@ namespace TemuKJD.KJDForms.ProductSelectForms
html = GetHtml.PostUtf8(url, data); html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{ {
string msg = "商品保存失败!请检查html文件:" + BaseRegex.GetStringJson(ref html, "msg"); string msg = "前端直采商品更新保存失败!请检查html文件:" + BaseRegex.GetStringJson(ref html, "msg");
BaseMsgForm.ShowError(msg); BaseMsgForm.ShowError(msg);
} }
else else
{ {
BaseMsgForm.ShowInfo("选品商品保存成功!"); BaseMsgForm.ShowInfo("选品商品更新保存成功!");
} }
} }
else else
@@ -1099,7 +1099,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
html = GetHtml.PostUtf8(url, data); html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{ {
string msg = "商品保存失败!请检查html文件:" + BaseRegex.GetStringJson(ref html, "msg"); string msg = "前端直采商品保存失败!请检查html文件:" + BaseRegex.GetStringJson(ref html, "msg");
BaseMsgForm.ShowError(msg); BaseMsgForm.ShowError(msg);
} }
else else
@@ -40,6 +40,7 @@
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DbProductSelectListManageForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DbProductSelectListManageForm));
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.btnForceEnable = new DevComponents.DotNetBar.PanelEx();
this.txtNotChangeMainImg = new System.Windows.Forms.TextBox(); this.txtNotChangeMainImg = new System.Windows.Forms.TextBox();
this.chkNotChangeMainImg = new TemuKJD.UserComponent.UcCheckBox(this.components); this.chkNotChangeMainImg = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chkAiSkuAndMainImg = new TemuKJD.UserComponent.UcCheckBox(this.components); this.chkAiSkuAndMainImg = new TemuKJD.UserComponent.UcCheckBox(this.components);
@@ -194,6 +195,7 @@
// //
// splitContainer1.Panel1 // splitContainer1.Panel1
// //
this.splitContainer1.Panel1.Controls.Add(this.btnForceEnable);
this.splitContainer1.Panel1.Controls.Add(this.txtNotChangeMainImg); this.splitContainer1.Panel1.Controls.Add(this.txtNotChangeMainImg);
this.splitContainer1.Panel1.Controls.Add(this.chkNotChangeMainImg); this.splitContainer1.Panel1.Controls.Add(this.chkNotChangeMainImg);
this.splitContainer1.Panel1.Controls.Add(this.chkAiSkuAndMainImg); this.splitContainer1.Panel1.Controls.Add(this.chkAiSkuAndMainImg);
@@ -237,6 +239,32 @@
this.splitContainer1.SplitterDistance = 125; this.splitContainer1.SplitterDistance = 125;
this.splitContainer1.TabIndex = 2; this.splitContainer1.TabIndex = 2;
// //
// btnForceEnable
//
this.btnForceEnable.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnForceEnable.CanvasColor = System.Drawing.SystemColors.Control;
this.btnForceEnable.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnForceEnable.DisabledBackColor = System.Drawing.Color.Empty;
this.btnForceEnable.Location = new System.Drawing.Point(1372, 70);
this.btnForceEnable.Margin = new System.Windows.Forms.Padding(4, 2, 2, 2);
this.btnForceEnable.Name = "btnForceEnable";
this.btnForceEnable.Size = new System.Drawing.Size(182, 22);
this.btnForceEnable.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnForceEnable.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnForceEnable.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnForceEnable.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.btnForceEnable.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnForceEnable.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.btnForceEnable.Style.GradientAngle = 90;
this.btnForceEnable.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center;
this.btnForceEnable.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnForceEnable.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnForceEnable.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnForceEnable.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.btnForceEnable.TabIndex = 722;
this.btnForceEnable.Text = "强制解锁按钮(上传卡住时用)";
this.btnForceEnable.Click += new System.EventHandler(this.btnForceEnable_Click);
//
// txtNotChangeMainImg // txtNotChangeMainImg
// //
this.txtNotChangeMainImg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.txtNotChangeMainImg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -1965,5 +1993,6 @@
private System.Windows.Forms.DataGridViewLinkColumn colEditNotes; private System.Windows.Forms.DataGridViewLinkColumn colEditNotes;
private System.Windows.Forms.DataGridViewLinkColumn colDelete; private System.Windows.Forms.DataGridViewLinkColumn colDelete;
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult; private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
private DevComponents.DotNetBar.PanelEx btnForceEnable;
} }
} }
@@ -37,7 +37,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
List<string> skuRandomLetterArr = new List<string> { "~", "#", "¥", "%", "&", "*", "(", ")", "(", ")", "+", "-", "_", "=", "【", "】", "·", "|", "《", "》" }; List<string> skuRandomLetterArr = new List<string> { "~", "#", "¥", "%", "&", "*", "(", ")", "(", ")", "+", "-", "_", "=", "【", "】", "·", "|", "《", "》" };
List<TemuDBProductSelect> lstAdminTemuDBProductSelect = new List<TemuDBProductSelect>(); NaiBa.Util.ConcurrentList<TemuDBProductSelect> lstAdminTemuDBProductSelect = new NaiBa.Util.ConcurrentList<TemuDBProductSelect>();
List<ShopLoginInfo> shopLst = new List<ShopLoginInfo>(); List<ShopLoginInfo> shopLst = new List<ShopLoginInfo>();
List<TemuDBExtCodePriceInfo> lstDbPrice = new List<TemuDBExtCodePriceInfo>(); List<TemuDBExtCodePriceInfo> lstDbPrice = new List<TemuDBExtCodePriceInfo>();
List<string> lstCustomImg = new List<string>(); List<string> lstCustomImg = new List<string>();
@@ -245,6 +245,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
""); "");
dgvSelectProduct.Rows[rowIndex].Height = 60; dgvSelectProduct.Rows[rowIndex].Height = 60;
displayLoginStatusColor(dgvSelectProduct.Rows[rowIndex].Cells["colLogin"], dgvSelectProduct.Rows[rowIndex].Cells["colLogin"].Value.ParseToString());
})); }));
} }
@@ -419,9 +420,10 @@ namespace TemuKJD.KJDForms.ProductSelectForms
shopLoginForm.ShowDialog(); shopLoginForm.ShowDialog();
foreach (DataGridViewRow row in this.dgvSelectProduct.Rows) foreach (DataGridViewRow row in this.dgvSelectProduct.Rows)
{ {
if (row.Cells["colSelectId"].Value.ParseToString() == shop.ShopId) if (row.Cells["colSupplierId"].Value.ParseToString() == shop.ShopId)
{ {
row.Cells["colLogin"].Value = shop.LoginStatus2 == "国际版在线" ? "在线" : "登录"; row.Cells["colLogin"].Value = shop.LoginStatus2 == "国际版在线" ? "在线" : "登录";
displayLoginStatusColor(row.Cells["colLogin"], row.Cells["colLogin"].Value.ParseToString());
} }
} }
} }
@@ -540,6 +542,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
//throw new NotImplementedException(); //throw new NotImplementedException();
} }
Task AddProd = null;
private void btnAdd_Click(object sender, EventArgs e) private void btnAdd_Click(object sender, EventArgs e)
{ {
if (chkCustomPic.Checked && lstCustomImg.Count <= 0) if (chkCustomPic.Checked && lstCustomImg.Count <= 0)
@@ -557,23 +560,43 @@ namespace TemuKJD.KJDForms.ProductSelectForms
lstDbPrice.Clear(); lstDbPrice.Clear();
lstDbPrice.AddRange(GetServerPriceLst(extCodes)); lstDbPrice.AddRange(GetServerPriceLst(extCodes));
if (prodList.Count() > 0) if (prodList.Count() == 0)
{
this.btnAdd.Enabled = false;
cancellationTokenSource = new CancellationTokenSource();
Task.Run(() =>
{
AddProductDraft(prodList);
Invoke(new Action(() =>
{
this.btnAdd.Enabled = true;
}));
}, cancellationTokenSource.Token);
}
else
{ {
BaseMsgForm.ShowError("请选择要上传的商品!"); BaseMsgForm.ShowError("请选择要上传的商品!");
return;
} }
this.btnAdd.Enabled = false;
cancellationTokenSource = new CancellationTokenSource();
AddProd = Task.Run(() =>
{
AddProductDraft(prodList);
//Invoke(new Action(() =>
//{
// this.btnAdd.Enabled = true;
//}));
}, cancellationTokenSource.Token);
Task.Run(() =>
{
while (true)
{
Thread.Sleep(1000);
if (AddProd == null || AddProd.IsCompleted || AddProd.IsCanceled || AddProd.IsFaulted)
{
Invoke(new Action(() =>
{
this.pbLoading.Visible = false;
this.btnAdd.Enabled = true;
if (AddProd != null && AddProd.IsFaulted)
{
BaseMsgForm.ShowError(AddProd?.Exception?.Message + " 错误详情为:" + AddProd?.Exception?.InnerException?.Message);
}
}));
break;
}
}
});
} }
void AddProductDraft(TemuDBProductSelect[] prodSelect) void AddProductDraft(TemuDBProductSelect[] prodSelect)
@@ -643,6 +666,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
foreach (var r in rows) foreach (var r in rows)
{ {
r.Cells["colLogin"].Value = "登录"; r.Cells["colLogin"].Value = "登录";
displayLoginStatusColor(r.Cells["colLogin"], r.Cells["colLogin"].Value.ParseToString());
} }
})); }));
continue; continue;
@@ -657,6 +681,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
foreach (var r in rows) foreach (var r in rows)
{ {
r.Cells["colLogin"].Value = "登录"; r.Cells["colLogin"].Value = "登录";
displayLoginStatusColor(r.Cells["colLogin"], r.Cells["colLogin"].Value.ParseToString());
} }
})); }));
continue; continue;
@@ -1482,10 +1507,16 @@ namespace TemuKJD.KJDForms.ProductSelectForms
int skuCount = 0; int skuCount = 0;
//foreach (var skuInfo in skcInfo.productSkuList) //foreach (var skuInfo in skcInfo.productSkuList)
List<TemuProductSku> skuListTmp = new List<TemuProductSku>(); NaiBa.Util.ConcurrentList<TemuProductSku> skuListTmp = new NaiBa.Util.ConcurrentList<TemuProductSku>();
skuListTmp.AddRange(skcInfo.productSkuList); skuListTmp.AddRange(skcInfo.productSkuList);
int loopCount = 0;
try
{
//throw new Exception();
while (skuListTmp.Count > 0) while (skuListTmp.Count > 0)
{ {
loopCount++;
if (cancellationTokenSource.IsCancellationRequested) if (cancellationTokenSource.IsCancellationRequested)
{ {
return "{\"success\":false,\"status\":\"未上传\"," + return "{\"success\":false,\"status\":\"未上传\"," +
@@ -1498,7 +1529,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
{ {
Invoke(new Action(() => Invoke(new Action(() =>
{ {
cell.Value = "正在生成sku " + skuCount + "/" + skcInfo.productSkuList.Count; cell.Value = "正在生成sku " + skuCount + "/" + skcInfo.productSkuList.Count + " -loop:" + loopCount;
})); }));
} }
@@ -1507,8 +1538,9 @@ namespace TemuKJD.KJDForms.ProductSelectForms
if (chkRandomSkuOrder.Checked) if (chkRandomSkuOrder.Checked)
id = Randomx.GetId(0, skuListTmp.Count); id = Randomx.GetId(0, skuListTmp.Count);
var skuInfo = skuListTmp[id]; var skuInfo = skuListTmp[id];
if (skuInfo != null)
skuListTmp.RemoveAt(id); skuListTmp.RemoveAt(id);
if (skuInfo == null)
continue;
#endregion #endregion
ProductSkuReqsItem skuItem = new ProductSkuReqsItem(); ProductSkuReqsItem skuItem = new ProductSkuReqsItem();
@@ -1785,6 +1817,13 @@ namespace TemuKJD.KJDForms.ProductSelectForms
skcItem.productSkuReqs.Add(skuItem); skcItem.productSkuReqs.Add(skuItem);
} }
}
catch (Exception ex)
{
return "{\"success\":false,\"status\":\"未上传\"," +
"\"productDraftId\":\"" + prodParam.productDraftId.ParseToString() + "\"," +
"\"errMsg\":\"sku生成失败," + ex?.Message + "\"}";
}
prodParam.productSkcReqs.Add(skcItem); prodParam.productSkcReqs.Add(skcItem);
} }
@@ -2583,16 +2622,19 @@ namespace TemuKJD.KJDForms.ProductSelectForms
string imgName = "\\图片" + Randomx.GetId(1000, 9999) + ".jpg"; string imgName = "\\图片" + Randomx.GetId(1000, 9999) + ".jpg";
sImgPath += imgName; sImgPath += imgName;
// 使用MemoryStream创建图片对象 // 使用MemoryStream创建图片对象
byte[] imageBytes = Convert.FromBase64String(imgBase64); byte[] imageBytes = Convert.FromBase64String(imgBase64); try
{
using (MemoryStream ms = new MemoryStream(imageBytes)) using (MemoryStream ms = new MemoryStream(imageBytes))
{ {
Image image = Image.FromStream(ms); Image image = Image.FromStream(ms);
// 保存图片到文件系统 // 保存图片到文件系统
try
{
image.Save(sImgPath, System.Drawing.Imaging.ImageFormat.Jpeg); image.Save(sImgPath, System.Drawing.Imaging.ImageFormat.Jpeg);
} }
catch (Exception ex) { return "存图失败 " + ex.Message; } }
catch (Exception ex)
{
return "存图失败 " + ex.Message;
} }
var uploadImgRst = UploadImage(shop, productDraftId, sImgPath, signature); var uploadImgRst = UploadImage(shop, productDraftId, sImgPath, signature);
var imgUrl = BaseRegex.GetStringJson(ref uploadImgRst, "url"); var imgUrl = BaseRegex.GetStringJson(ref uploadImgRst, "url");
@@ -3212,6 +3254,18 @@ Content-Disposition: form-data; name=""sign""
} }
} }
void displayLoginStatusColor(DataGridViewCell cell, string loginStatus = "在线")
{
bool canUse = loginStatus == "在线";
if (cell is DataGridViewLinkCell)
{
(cell as DataGridViewLinkCell).Style.ForeColor = canUse ? Color.Green : Color.Red;
(cell as DataGridViewLinkCell).LinkColor = canUse ? Color.Green : Color.Red;
(cell as DataGridViewLinkCell).ActiveLinkColor = canUse ? Color.LightGreen : Color.OrangeRed;
(cell as DataGridViewLinkCell).VisitedLinkColor = canUse ? Color.DarkGreen : Color.DarkRed;
}
}
public static int CountChineseCharacters(string text) public static int CountChineseCharacters(string text)
{ {
// 使用正则表达式匹配中文字符 // 使用正则表达式匹配中文字符
@@ -3219,5 +3273,18 @@ Content-Disposition: form-data; name=""sign""
MatchCollection matches = Regex.Matches(text, pattern); MatchCollection matches = Regex.Matches(text, pattern);
return matches.Count; return matches.Count;
} }
private void btnForceEnable_Click(object sender, EventArgs e)
{
if(BaseMsgForm.ShowConfirm("确定解锁吗?可能造成性能损耗或重复上传。").DialogResult == DialogResult.OK)
{
//if (AddProd != null)
//AddProd.Dispose();
//AddProd.Wait(1000);
//if (cancellationTokenSource != null)
// cancellationTokenSource.Cancel();
this.btnAdd.Enabled = true;
}
}
} }
} }
@@ -40,7 +40,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
List<string> skuRandomLetterArr = new List<string> { "~", "#", "¥", "%", "&", "*", "(", ")", "(", ")", "+", "-", "_", "=", "【", "】", "·", "|", "《", "》" }; List<string> skuRandomLetterArr = new List<string> { "~", "#", "¥", "%", "&", "*", "(", ")", "(", ")", "+", "-", "_", "=", "【", "】", "·", "|", "《", "》" };
List<TemuDBProductSelect> lstAdminTemuDBProductSelect = new List<TemuDBProductSelect>(); NaiBa.Util.ConcurrentList<TemuDBProductSelect> lstAdminTemuDBProductSelect = new NaiBa.Util.ConcurrentList<TemuDBProductSelect>();
List<ShopLoginInfo> shopLst = new List<ShopLoginInfo>(); List<ShopLoginInfo> shopLst = new List<ShopLoginInfo>();
public ProductThirdSelectListManageForm() public ProductThirdSelectListManageForm()
@@ -173,6 +173,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
""); "");
dgvSelectProduct.Rows[rowIndex].Height = 60; dgvSelectProduct.Rows[rowIndex].Height = 60;
displayLoginStatusColor(dgvSelectProduct.Rows[rowIndex].Cells["colLogin"], dgvSelectProduct.Rows[rowIndex].Cells["colLogin"].Value.ParseToString());
})); }));
} }
@@ -405,9 +406,10 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
shopLoginForm.ShowDialog(); shopLoginForm.ShowDialog();
foreach (DataGridViewRow row in this.dgvSelectProduct.Rows) foreach (DataGridViewRow row in this.dgvSelectProduct.Rows)
{ {
if (row.Cells["colSelectId"].Value.ParseToString() == shop.ShopId) if (row.Cells["colSupplierId"].Value.ParseToString() == shop.ShopId)
{ {
row.Cells["colLogin"].Value = shop.LoginStatus2 == "国际版在线" ? "在线" : "登录"; row.Cells["colLogin"].Value = shop.LoginStatus2 == "国际版在线" ? "在线" : "登录";
displayLoginStatusColor(row.Cells["colLogin"], row.Cells["colLogin"].Value.ParseToString());
} }
} }
} }
@@ -620,6 +622,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
Invoke(new Action(() => Invoke(new Action(() =>
{ {
row.Cells["colOpResult"].Value = "店铺" + shop.LoginStatus; row.Cells["colOpResult"].Value = "店铺" + shop.LoginStatus;
displayLoginStatusColor(row.Cells["colLogin"], row.Cells["colLogin"].Value.ParseToString());
})); }));
continue; continue;
} }
@@ -629,6 +632,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
Invoke(new Action(() => Invoke(new Action(() =>
{ {
row.Cells["colOpResult"].Value = "店铺" + shop.LoginStatus2; row.Cells["colOpResult"].Value = "店铺" + shop.LoginStatus2;
displayLoginStatusColor(row.Cells["colLogin"], row.Cells["colLogin"].Value.ParseToString());
})); }));
continue; continue;
} }
@@ -1976,5 +1980,17 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
if (cancellationTokenSource != null) if (cancellationTokenSource != null)
cancellationTokenSource.Cancel(); cancellationTokenSource.Cancel();
} }
void displayLoginStatusColor(DataGridViewCell cell, string loginStatus = "在线")
{
bool canUse = loginStatus == "在线";
if (cell is DataGridViewLinkCell)
{
(cell as DataGridViewLinkCell).Style.ForeColor = canUse ? Color.Green : Color.Red;
(cell as DataGridViewLinkCell).LinkColor = canUse ? Color.Green : Color.Red;
(cell as DataGridViewLinkCell).ActiveLinkColor = canUse ? Color.LightGreen : Color.OrangeRed;
(cell as DataGridViewLinkCell).VisitedLinkColor = canUse ? Color.DarkGreen : Color.DarkRed;
}
}
} }
} }
+2
View File
@@ -76,6 +76,8 @@ namespace TemuKJD.ToolForms
var prodInfo = JsonHelper.DeserializeJsonToObject<TemuDetailProductInfo>(dbProd.product_json); var prodInfo = JsonHelper.DeserializeJsonToObject<TemuDetailProductInfo>(dbProd.product_json);
var ucImgChangeList = new List<UcSkuImgItem>(); var ucImgChangeList = new List<UcSkuImgItem>();
this.TitleText = "豆包生成SKU图 主店ID:" + prodInfo.supplierId.ParseToString() + " SKC:" + prodInfo.productSkcList.FirstOrDefault()?.productSkcId +
" SKU:" + prodInfo.productId + " 名称:" + prodInfo.productName;
foreach(var sku in prodInfo.productSkcList[0].productSkuList) foreach(var sku in prodInfo.productSkcList[0].productSkuList)
{ {
var imgUrl = sku.thumbUrl.Replace("https://", "http://"); var imgUrl = sku.thumbUrl.Replace("https://", "http://");