diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs
index fd3cc5c..f5e4347 100644
--- a/AllBase/BaseClass.cs
+++ b/AllBase/BaseClass.cs
@@ -27,7 +27,7 @@ namespace AllBase
///
/// 版本ID
///
- public static int VersionCount = 689;
+ public static int VersionCount = 691;
//public static int VersionCount = 613;
///
diff --git a/TEMUKJD/KJDForms/AdminForms/ShopBrowserObject.cs b/TEMUKJD/KJDForms/AdminForms/ShopBrowserObject.cs
index 8a1bca0..94f28f1 100644
--- a/TEMUKJD/KJDForms/AdminForms/ShopBrowserObject.cs
+++ b/TEMUKJD/KJDForms/AdminForms/ShopBrowserObject.cs
@@ -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() +
- // "&page=" + 1 +
- // "&page_size=" + 1;
- //data += "&search_spu=" + product?.productId;
- ////data += "&search_skc=" + product?.productSkcList?.FirstOrDefault()?.productSkcId;
-
- //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
+ data = UserLogin.GetSignaturex() +
+ "&page=" + 1 +
+ "&page_size=" + 1;
+ data += "&search_spu=" + product?.productId;
+ if (BaseClass.SaLevel == 1) // 店铺非空管理状态允许查看 后台采集 和 前端采集 的所有商品
{
- var url = BaseClass.BuildObjString("product/add_product");
- var data = Work.UserLogin.GetSignaturex() +
+ data += "&product_get_type=all";
+ }
+ //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 +
"&skc_id=" + product?.productSkcList?.FirstOrDefault()?.productSkcId +
"&cat_id=" + GetCat(product).catId +
@@ -119,8 +141,7 @@ namespace TemuKJD.KJDForms.AdminForms
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
- string msg = "选品商品保存失败!请检查网络连接:" +
- BaseRegex.GetStringJson(ref html, "msg");
+ string msg = "选品商品保存失败!请检查网络连接:" + BaseRegex.GetStringJson(ref html, "msg");
OnInfoReceived(msg);
}
else
diff --git a/TEMUKJD/KJDForms/ProductSelectForms/DbProductListForm.cs b/TEMUKJD/KJDForms/ProductSelectForms/DbProductListForm.cs
index e85c33c..9970591 100644
--- a/TEMUKJD/KJDForms/ProductSelectForms/DbProductListForm.cs
+++ b/TEMUKJD/KJDForms/ProductSelectForms/DbProductListForm.cs
@@ -1056,7 +1056,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
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");
data = UserLogin.GetSignaturex() +
@@ -1069,12 +1069,12 @@ namespace TemuKJD.KJDForms.ProductSelectForms
html = GetHtml.PostUtf8(url, data);
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);
}
else
{
- BaseMsgForm.ShowInfo("选品商品保存成功!");
+ BaseMsgForm.ShowInfo("选品商品更新保存成功!");
}
}
else
@@ -1099,7 +1099,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
html = GetHtml.PostUtf8(url, data);
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);
}
else
diff --git a/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.Designer.cs b/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.Designer.cs
index d45ffc0..95a8353 100644
--- a/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.Designer.cs
+++ b/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.Designer.cs
@@ -40,6 +40,7 @@
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DbProductSelectListManageForm));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+ this.btnForceEnable = new DevComponents.DotNetBar.PanelEx();
this.txtNotChangeMainImg = new System.Windows.Forms.TextBox();
this.chkNotChangeMainImg = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chkAiSkuAndMainImg = new TemuKJD.UserComponent.UcCheckBox(this.components);
@@ -194,6 +195,7 @@
//
// splitContainer1.Panel1
//
+ this.splitContainer1.Panel1.Controls.Add(this.btnForceEnable);
this.splitContainer1.Panel1.Controls.Add(this.txtNotChangeMainImg);
this.splitContainer1.Panel1.Controls.Add(this.chkNotChangeMainImg);
this.splitContainer1.Panel1.Controls.Add(this.chkAiSkuAndMainImg);
@@ -237,6 +239,32 @@
this.splitContainer1.SplitterDistance = 125;
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
//
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 colDelete;
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
+ private DevComponents.DotNetBar.PanelEx btnForceEnable;
}
}
\ No newline at end of file
diff --git a/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.cs b/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.cs
index d33a411..ab865a0 100644
--- a/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.cs
+++ b/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.cs
@@ -37,7 +37,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
List skuRandomLetterArr = new List { "~", "#", "¥", "%", "&", "*", "(", ")", "(", ")", "+", "-", "_", "=", "【", "】", "·", "|", "《", "》" };
- List lstAdminTemuDBProductSelect = new List();
+ NaiBa.Util.ConcurrentList lstAdminTemuDBProductSelect = new NaiBa.Util.ConcurrentList();
List shopLst = new List();
List lstDbPrice = new List();
List lstCustomImg = new List();
@@ -245,6 +245,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
"");
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();
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 == "国际版在线" ? "在线" : "登录";
+ displayLoginStatusColor(row.Cells["colLogin"], row.Cells["colLogin"].Value.ParseToString());
}
}
}
@@ -540,6 +542,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
//throw new NotImplementedException();
}
+ Task AddProd = null;
private void btnAdd_Click(object sender, EventArgs e)
{
if (chkCustomPic.Checked && lstCustomImg.Count <= 0)
@@ -557,23 +560,43 @@ namespace TemuKJD.KJDForms.ProductSelectForms
lstDbPrice.Clear();
lstDbPrice.AddRange(GetServerPriceLst(extCodes));
- 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
+ if (prodList.Count() == 0)
{
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)
@@ -643,6 +666,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
foreach (var r in rows)
{
r.Cells["colLogin"].Value = "登录";
+ displayLoginStatusColor(r.Cells["colLogin"], r.Cells["colLogin"].Value.ParseToString());
}
}));
continue;
@@ -657,6 +681,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
foreach (var r in rows)
{
r.Cells["colLogin"].Value = "登录";
+ displayLoginStatusColor(r.Cells["colLogin"], r.Cells["colLogin"].Value.ParseToString());
}
}));
continue;
@@ -1482,310 +1507,324 @@ namespace TemuKJD.KJDForms.ProductSelectForms
int skuCount = 0;
//foreach (var skuInfo in skcInfo.productSkuList)
- List skuListTmp = new List();
+ NaiBa.Util.ConcurrentList skuListTmp = new NaiBa.Util.ConcurrentList();
skuListTmp.AddRange(skcInfo.productSkuList);
- while (skuListTmp.Count > 0)
+ int loopCount = 0;
+
+ try
{
- if (cancellationTokenSource.IsCancellationRequested)
+ //throw new Exception();
+ while (skuListTmp.Count > 0)
{
- return "{\"success\":false,\"status\":\"未上传\"," +
- "\"productDraftId\":\"" + prodParam.productDraftId.ParseToString() + "\"," +
- "\"errMsg\":\"上传停止\"}";
- }
-
- skuCount++;
- if (cell != null)
- {
- Invoke(new Action(() =>
+ loopCount++;
+ if (cancellationTokenSource.IsCancellationRequested)
{
- cell.Value = "正在生成sku " + skuCount + "/" + skcInfo.productSkuList.Count;
- }));
- }
+ return "{\"success\":false,\"status\":\"未上传\"," +
+ "\"productDraftId\":\"" + prodParam.productDraftId.ParseToString() + "\"," +
+ "\"errMsg\":\"上传停止\"}";
+ }
- #region 按顺序抽取sku或抽取随机打乱顺序的sku
- int id = 0;
- if (chkRandomSkuOrder.Checked)
- id = Randomx.GetId(0, skuListTmp.Count);
- var skuInfo = skuListTmp[id];
- if (skuInfo != null)
+ skuCount++;
+ if (cell != null)
+ {
+ Invoke(new Action(() =>
+ {
+ cell.Value = "正在生成sku " + skuCount + "/" + skcInfo.productSkuList.Count + " -loop:" + loopCount;
+ }));
+ }
+
+ #region 按顺序抽取sku或抽取随机打乱顺序的sku
+ int id = 0;
+ if (chkRandomSkuOrder.Checked)
+ id = Randomx.GetId(0, skuListTmp.Count);
+ var skuInfo = skuListTmp[id];
skuListTmp.RemoveAt(id);
- #endregion
+ if (skuInfo == null)
+ continue;
+ #endregion
- ProductSkuReqsItem skuItem = new ProductSkuReqsItem();
- skuItem.currencyType = skuInfo.currencyType;
- skuItem.extCode = skuInfo.extCode;
- skuItem.productSkuAccessoriesReq = new ProductSkuAccessoriesReq()
- {
- productSkuAccessories = skuInfo.productSkuSaleExtAttr.productSkuAccessories?.productSkuAccessories == null ?
- new List