优化微信上传代码

This commit is contained in:
wule committed 2026-01-15 22:24:00 +08:00
1 parent 9e1a354ee5
commit f71cb1bba8
13 files changed
+749 -159

No files matched your search

@@ -43,6 +43,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DbProductListForm));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.数据回档 = new DevComponents.DotNetBar.PanelEx();
this.btnBatchSelect = new DevComponents.DotNetBar.PanelEx();
this.btnSearch = new DevComponents.DotNetBar.PanelEx();
this.btnSelect = new DevComponents.DotNetBar.PanelEx();
@@ -139,6 +140,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.数据回档);
this.splitContainer1.Panel1.Controls.Add(this.btnBatchSelect);
this.splitContainer1.Panel1.Controls.Add(this.btnSearch);
this.splitContainer1.Panel1.Controls.Add(this.btnSelect);
@@ -168,6 +170,31 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.splitContainer1.SplitterDistance = 70;
this.splitContainer1.TabIndex = 1;
//
// 数据回档
//
this.数据回档.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.数据回档.Cursor = System.Windows.Forms.Cursors.Hand;
this.数据回档.DisabledBackColor = System.Drawing.Color.Empty;
this.数据回档.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.数据回档.Location = new System.Drawing.Point(996, 9);
this.数据回档.Name = "数据回档";
this.数据回档.Size = new System.Drawing.Size(109, 23);
this.数据回档.Style.Alignment = System.Drawing.StringAlignment.Center;
this.数据回档.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.数据回档.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.数据回档.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.数据回档.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.数据回档.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.数据回档.Style.ForeColor.Color = System.Drawing.Color.White;
this.数据回档.Style.GradientAngle = 90;
this.数据回档.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.数据回档.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.数据回档.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.数据回档.TabIndex = 529;
this.数据回档.Text = "数据回档";
this.数据回档.Visible = false;
this.数据回档.Click += new System.EventHandler(this.库存数据回档_Click);
//
// btnBatchSelect
//
this.btnBatchSelect.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
@@ -977,12 +1004,12 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.ucSplitPage1.CurrentPage = 1;
this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right;
this.ucSplitPage1.IsShowPageSize = false;
this.ucSplitPage1.Location = new System.Drawing.Point(916, 0);
this.ucSplitPage1.Location = new System.Drawing.Point(880, 0);
this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0);
this.ucSplitPage1.Name = "ucSplitPage1";
this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0);
this.ucSplitPage1.PageSize = 50;
this.ucSplitPage1.Size = new System.Drawing.Size(362, 25);
this.ucSplitPage1.PageSize = 200;
this.ucSplitPage1.Size = new System.Drawing.Size(398, 25);
this.ucSplitPage1.TabIndex = 6;
this.ucSplitPage1.TotalPage = 1;
//
@@ -1102,5 +1129,6 @@ namespace TemuKJD.KJDForms.ProductSelectForms
private System.Windows.Forms.DataGridViewLinkColumn col_edit;
private System.Windows.Forms.DataGridViewLinkColumn col_delete;
private System.Windows.Forms.DataGridViewLinkColumn col_select_product;
private DevComponents.DotNetBar.PanelEx 数据回档;
}
}
@@ -83,6 +83,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.cmbGroup.Visible = true; // 分组
this.btnImportHtml.Visible = true; // 导入前端直采商品
this.btnBatchSelect.Visible = true; // 批量直传
this.ucSplitPage1.IsShowPageSize = true;
}
else if (BaseClass.SaLevel > 1 && shop == null && !IsClientJit)
{
@@ -166,7 +167,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
{
int pageCount;
decimal seconds;
var list = GetProductList(out pageCount, out seconds, page);
var list = GetProductList(out pageCount, out seconds, page, ucSplitPage1.PageSize);
lstTemuDbProduct.AddRange(list);
this.ucSplitPage1.TotalPage = pageCount;
@@ -273,6 +274,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
seconds = 0;
var url = BaseClass.BuildObjString("product/get_product_list");
//var url = BaseClass.BuildObjString("product_third/get_product_empty_product_json_for_bak");
var data = "";
Invoke(new Action(() =>
@@ -1339,5 +1341,78 @@ namespace TemuKJD.KJDForms.ProductSelectForms
foreach(var dbProd in dbProductLst)
lbxProdName.Items.Add(dbProd.product_name);
}
private void 库存数据回档_Click(object sender, EventArgs e)
{
var lstProdId = dgvDbProduct.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["col_spu_id"]?.Value.ToString()).ToList();
var prodList = this.lstTemuDbProduct.Where(p => lstProdId.Contains(p.spu_id)).ToList();
Task.Run(() =>
{
//get_product_detail_list
foreach (var prod in prodList)
{
Invoke(new Action(() =>
{
数据回档.Text = "数据回档 " + prodList.IndexOf(prod) + "/" + prodList.Count;
}));
var url = BaseClass.BuildObjString("product_third/get_product_detail_list_bak");
var data = "";
data = UserLogin.GetSignaturex() +
"&page=" + 1 +
"&page_size=" + 1;
data += "&search_spu=" + prod?.spu_id;
long bakId = 0;
var 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"))
{
bakId = BaseRegex.GetIntJson(ref html, "id");
}
if (bakId <= 0)
continue;
KJDDBProduct dbProd = null;
try
{
var dbJson = JsonHelper.SerializeObject(JObject.Parse(html)["data"]);
dbProd = JsonHelper.DeserializeJsonToList<KJDDBProduct>(dbJson).FirstOrDefault();
}
catch (Exception ex)
{
continue;
}
if (dbProd == null)
continue;
url = BaseClass.BuildObjString("product_third/mdy_db_product");
data = UserLogin.GetSignaturex() +
"&db_id=" + prod.id;
data += "&product_json=" + HttpUtility.UrlEncode(dbProd.product_json, Encoding.UTF8);
data += "&size_json=" + HttpUtility.UrlEncode(dbProd.size_json, 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"))
{
continue;
}
}
Invoke(new Action(() =>
{
BaseMsgForm.ShowInfo("完成");
}));
});
}
}
}