店铺订单数据优化逻辑

This commit is contained in:
wule committed 2026-06-04 10:48:36 +08:00
1 parent 1b87ae3a28
commit 51fa4ca578
11 files changed
+912 -741

No files matched your search

+10 -3
View File
@@ -186,7 +186,7 @@ namespace TemuKJD.ToolForms
foreach (var row in rows)
{
var cell = row.Cells["colOpResult"];
Invoke(new Action(() => { cell.Value = ""; }));
Invoke(new Action(() => { cell.Value = "生成中..."; }));
var prodId = row.Cells["col_spu_id"].Value.ParseToString();
var prod = this.lstDbProd.FirstOrDefault(p => prodId == p.spu_id);
@@ -348,11 +348,18 @@ namespace TemuKJD.ToolForms
{
foreach (var row in rows)
{
Invoke(new Action(() => { row.Cells["colOpResult"].Value = "标题裂变成功"; }));
Invoke(new Action(() => {
row.Cells["colSelect"].Value = false;
row.Cells["colOpResult"].Value = "标题裂变成功";
}));
}
}
currentProd = null;
}
else
{
}
currentProd = null;
}
private void dgvDbProduct_CellContentClick(object sender, DataGridViewCellEventArgs e)
+29 -269
View File
@@ -30,16 +30,11 @@ namespace TemuKJD.ToolForms
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
this.line1 = new DevComponents.DotNetBar.Controls.Line();
this.label2 = new System.Windows.Forms.Label();
this.btnImportCookie = new DevComponents.DotNetBar.PanelEx();
@@ -95,23 +90,6 @@ namespace TemuKJD.ToolForms
this.colMsg = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.panel1 = new System.Windows.Forms.Panel();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.panel2 = new System.Windows.Forms.Panel();
this.dgvOut1688Prod = new TemuKJD.UserComponent.DataGridViewEx();
this.dataGridViewCheckBoxColumn1 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colFileName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colOutSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colOutSupplierName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colOutGoodsId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colOutGoodsName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colOutCat = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colOutImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colOutImg = new System.Windows.Forms.DataGridViewImageColumn();
this.colOutPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colOutStock = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewLinkColumn1 = new System.Windows.Forms.DataGridViewLinkColumn();
this.colOutMsg = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.btnOutProdSaveDb = new DevComponents.DotNetBar.PanelEx();
this.chkSkip = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.btnGetDetail = new DevComponents.DotNetBar.PanelEx();
this.pnlMultiLogin.SuspendLayout();
@@ -128,9 +106,6 @@ namespace TemuKJD.ToolForms
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dgvProduct)).BeginInit();
this.tabPage3.SuspendLayout();
this.tabPage4.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvOut1688Prod)).BeginInit();
this.SuspendLayout();
//
// line1
@@ -567,7 +542,6 @@ namespace TemuKJD.ToolForms
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.BackColor = System.Drawing.Color.White;
this.splitContainer1.Panel2.Controls.Add(this.btnOutProdSaveDb);
this.splitContainer1.Panel2.Controls.Add(this.chkSkip);
this.splitContainer1.Panel2.Controls.Add(this.btnGetDetail);
this.splitContainer1.Panel2.Controls.Add(this.btnStopStop);
@@ -593,7 +567,7 @@ namespace TemuKJD.ToolForms
this.splitContainer1.Panel2.Controls.Add(this.label2);
this.splitContainer1.Panel2.Controls.Add(this.line1);
this.splitContainer1.Size = new System.Drawing.Size(1404, 561);
this.splitContainer1.SplitterDistance = 463;
this.splitContainer1.SplitterDistance = 464;
this.splitContainer1.SplitterWidth = 3;
this.splitContainer1.TabIndex = 4;
//
@@ -604,14 +578,13 @@ namespace TemuKJD.ToolForms
this.ucTabControlMetro1.Controls.Add(this.tabPage1);
this.ucTabControlMetro1.Controls.Add(this.tabPage2);
this.ucTabControlMetro1.Controls.Add(this.tabPage3);
this.ucTabControlMetro1.Controls.Add(this.tabPage4);
this.ucTabControlMetro1.Dock = System.Windows.Forms.DockStyle.Fill;
this.ucTabControlMetro1.ItemSize = new System.Drawing.Size(72, 24);
this.ucTabControlMetro1.Location = new System.Drawing.Point(0, 0);
this.ucTabControlMetro1.Name = "ucTabControlMetro1";
this.ucTabControlMetro1.SelectedIndex = 0;
this.ucTabControlMetro1.ShowCloseButton = false;
this.ucTabControlMetro1.Size = new System.Drawing.Size(1404, 463);
this.ucTabControlMetro1.Size = new System.Drawing.Size(1404, 464);
this.ucTabControlMetro1.TabIndex = 462;
this.ucTabControlMetro1.TabSelectColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.ucTabControlMetro1.TabSelectTextColor = System.Drawing.Color.Gray;
@@ -625,7 +598,7 @@ namespace TemuKJD.ToolForms
this.tabPage1.Margin = new System.Windows.Forms.Padding(5);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(1396, 431);
this.tabPage1.Size = new System.Drawing.Size(1396, 432);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "商品页面";
this.tabPage1.UseVisualStyleBackColor = true;
@@ -644,7 +617,7 @@ namespace TemuKJD.ToolForms
this.splitContainer2.Panel1.Controls.Add(this.btnNext);
this.splitContainer2.Panel1.Controls.Add(this.btnPrev);
this.splitContainer2.Panel1.Controls.Add(this.txtAddress);
this.splitContainer2.Size = new System.Drawing.Size(1390, 425);
this.splitContainer2.Size = new System.Drawing.Size(1390, 426);
this.splitContainer2.SplitterDistance = 26;
this.splitContainer2.TabIndex = 6;
//
@@ -686,7 +659,7 @@ namespace TemuKJD.ToolForms
this.tabPage2.Location = new System.Drawing.Point(4, 28);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(1396, 430);
this.tabPage2.Size = new System.Drawing.Size(1396, 431);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "采集商品列表";
this.tabPage2.UseVisualStyleBackColor = true;
@@ -707,20 +680,20 @@ namespace TemuKJD.ToolForms
//
this.dgvProduct.AllowUserToAddRows = false;
this.dgvProduct.AllowUserToDeleteRows = false;
dataGridViewCellStyle11.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.dgvProduct.AutoRowNumber = true;
this.dgvProduct.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dgvProduct.BackgroundColor = System.Drawing.Color.White;
this.dgvProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.dgvProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheck,
@@ -746,7 +719,7 @@ namespace TemuKJD.ToolForms
this.dgvProduct.Name = "dgvProduct";
this.dgvProduct.ReadOnly = true;
this.dgvProduct.RowTemplate.Height = 23;
this.dgvProduct.Size = new System.Drawing.Size(1390, 424);
this.dgvProduct.Size = new System.Drawing.Size(1390, 425);
this.dgvProduct.TabIndex = 7;
this.dgvProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvProduct_CellContentClick);
//
@@ -782,8 +755,8 @@ namespace TemuKJD.ToolForms
//
// colGoodsName
//
dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colGoodsName.DefaultCellStyle = dataGridViewCellStyle13;
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colGoodsName.DefaultCellStyle = dataGridViewCellStyle3;
this.colGoodsName.HeaderText = "商品名称";
this.colGoodsName.Name = "colGoodsName";
this.colGoodsName.ReadOnly = true;
@@ -815,8 +788,8 @@ namespace TemuKJD.ToolForms
//
// colPrice
//
dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colPrice.DefaultCellStyle = dataGridViewCellStyle14;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colPrice.DefaultCellStyle = dataGridViewCellStyle4;
this.colPrice.FillWeight = 40F;
this.colPrice.HeaderText = "供货价";
this.colPrice.Name = "colPrice";
@@ -875,8 +848,8 @@ namespace TemuKJD.ToolForms
//
// colMsg
//
dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colMsg.DefaultCellStyle = dataGridViewCellStyle15;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colMsg.DefaultCellStyle = dataGridViewCellStyle5;
this.colMsg.FillWeight = 160F;
this.colMsg.HeaderText = "操作结果";
this.colMsg.Name = "colMsg";
@@ -888,7 +861,7 @@ namespace TemuKJD.ToolForms
this.tabPage3.Location = new System.Drawing.Point(4, 28);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(1396, 430);
this.tabPage3.Size = new System.Drawing.Size(1396, 431);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "1688地址管理";
this.tabPage3.UseVisualStyleBackColor = true;
@@ -898,202 +871,9 @@ namespace TemuKJD.ToolForms
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(3, 3);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1390, 424);
this.panel1.Size = new System.Drawing.Size(1390, 425);
this.panel1.TabIndex = 0;
//
// tabPage4
//
this.tabPage4.Controls.Add(this.panel2);
this.tabPage4.Location = new System.Drawing.Point(4, 28);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
this.tabPage4.Size = new System.Drawing.Size(1396, 430);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "已采集数据";
this.tabPage4.UseVisualStyleBackColor = true;
//
// panel2
//
this.panel2.Controls.Add(this.dgvOut1688Prod);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(3, 3);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(1390, 424);
this.panel2.TabIndex = 1;
//
// dgvOut1688Prod
//
this.dgvOut1688Prod.AllowUserToAddRows = false;
this.dgvOut1688Prod.AllowUserToDeleteRows = false;
dataGridViewCellStyle16.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvOut1688Prod.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle16;
this.dgvOut1688Prod.AutoRowNumber = true;
this.dgvOut1688Prod.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dgvOut1688Prod.BackgroundColor = System.Drawing.Color.White;
this.dgvOut1688Prod.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle17.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle17.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle17.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle17.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle17.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle17.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvOut1688Prod.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle17;
this.dgvOut1688Prod.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvOut1688Prod.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.dataGridViewCheckBoxColumn1,
this.colFileName,
this.colOutSupplierId,
this.colOutSupplierName,
this.colOutGoodsId,
this.colOutGoodsName,
this.colOutCat,
this.colOutImgUrl,
this.colOutImg,
this.colOutPrice,
this.colOutStock,
this.dataGridViewLinkColumn1,
this.colOutMsg});
this.dgvOut1688Prod.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvOut1688Prod.Location = new System.Drawing.Point(0, 0);
this.dgvOut1688Prod.MultiSelectCheckBox = true;
this.dgvOut1688Prod.Name = "dgvOut1688Prod";
this.dgvOut1688Prod.ReadOnly = true;
this.dgvOut1688Prod.RowTemplate.Height = 23;
this.dgvOut1688Prod.Size = new System.Drawing.Size(1390, 424);
this.dgvOut1688Prod.TabIndex = 839;
//
// dataGridViewCheckBoxColumn1
//
this.dataGridViewCheckBoxColumn1.FillWeight = 26F;
this.dataGridViewCheckBoxColumn1.HeaderText = "选";
this.dataGridViewCheckBoxColumn1.Name = "dataGridViewCheckBoxColumn1";
this.dataGridViewCheckBoxColumn1.ReadOnly = true;
this.dataGridViewCheckBoxColumn1.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridViewCheckBoxColumn1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
//
// colFileName
//
this.colFileName.FillWeight = 150F;
this.colFileName.HeaderText = "文件名称";
this.colFileName.Name = "colFileName";
this.colFileName.ReadOnly = true;
//
// colOutSupplierId
//
this.colOutSupplierId.FillWeight = 50F;
this.colOutSupplierId.HeaderText = "供应商Id";
this.colOutSupplierId.Name = "colOutSupplierId";
this.colOutSupplierId.ReadOnly = true;
//
// colOutSupplierName
//
this.colOutSupplierName.FillWeight = 90F;
this.colOutSupplierName.HeaderText = "供应商名称";
this.colOutSupplierName.Name = "colOutSupplierName";
this.colOutSupplierName.ReadOnly = true;
//
// colOutGoodsId
//
this.colOutGoodsId.FillWeight = 50F;
this.colOutGoodsId.HeaderText = "商品Id";
this.colOutGoodsId.Name = "colOutGoodsId";
this.colOutGoodsId.ReadOnly = true;
//
// colOutGoodsName
//
dataGridViewCellStyle18.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colOutGoodsName.DefaultCellStyle = dataGridViewCellStyle18;
this.colOutGoodsName.FillWeight = 150F;
this.colOutGoodsName.HeaderText = "商品名称";
this.colOutGoodsName.Name = "colOutGoodsName";
this.colOutGoodsName.ReadOnly = true;
//
// colOutCat
//
this.colOutCat.FillWeight = 40F;
this.colOutCat.HeaderText = "商品类目";
this.colOutCat.Name = "colOutCat";
this.colOutCat.ReadOnly = true;
//
// colOutImgUrl
//
this.colOutImgUrl.FillWeight = 300F;
this.colOutImgUrl.HeaderText = "图片路径";
this.colOutImgUrl.Name = "colOutImgUrl";
this.colOutImgUrl.ReadOnly = true;
this.colOutImgUrl.Visible = false;
//
// colOutImg
//
this.colOutImg.FillWeight = 40F;
this.colOutImg.HeaderText = "图片";
this.colOutImg.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom;
this.colOutImg.Name = "colOutImg";
this.colOutImg.ReadOnly = true;
this.colOutImg.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colOutImg.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
//
// colOutPrice
//
dataGridViewCellStyle19.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colOutPrice.DefaultCellStyle = dataGridViewCellStyle19;
this.colOutPrice.FillWeight = 40F;
this.colOutPrice.HeaderText = "供货价";
this.colOutPrice.Name = "colOutPrice";
this.colOutPrice.ReadOnly = true;
//
// colOutStock
//
this.colOutStock.FillWeight = 50F;
this.colOutStock.HeaderText = "库存";
this.colOutStock.Name = "colOutStock";
this.colOutStock.ReadOnly = true;
this.colOutStock.Visible = false;
//
// dataGridViewLinkColumn1
//
this.dataGridViewLinkColumn1.FillWeight = 35F;
this.dataGridViewLinkColumn1.HeaderText = "删除";
this.dataGridViewLinkColumn1.Name = "dataGridViewLinkColumn1";
this.dataGridViewLinkColumn1.ReadOnly = true;
this.dataGridViewLinkColumn1.Visible = false;
//
// colOutMsg
//
dataGridViewCellStyle20.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colOutMsg.DefaultCellStyle = dataGridViewCellStyle20;
this.colOutMsg.FillWeight = 160F;
this.colOutMsg.HeaderText = "操作结果";
this.colOutMsg.Name = "colOutMsg";
this.colOutMsg.ReadOnly = true;
//
// btnOutProdSaveDb
//
this.btnOutProdSaveDb.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnOutProdSaveDb.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnOutProdSaveDb.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnOutProdSaveDb.DisabledBackColor = System.Drawing.Color.Empty;
this.btnOutProdSaveDb.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOutProdSaveDb.Location = new System.Drawing.Point(929, 58);
this.btnOutProdSaveDb.Name = "btnOutProdSaveDb";
this.btnOutProdSaveDb.Size = new System.Drawing.Size(97, 23);
this.btnOutProdSaveDb.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnOutProdSaveDb.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnOutProdSaveDb.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnOutProdSaveDb.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnOutProdSaveDb.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnOutProdSaveDb.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnOutProdSaveDb.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnOutProdSaveDb.Style.GradientAngle = 90;
this.btnOutProdSaveDb.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnOutProdSaveDb.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnOutProdSaveDb.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnOutProdSaveDb.TabIndex = 1150;
this.btnOutProdSaveDb.Text = "已采集数据入库";
this.btnOutProdSaveDb.Visible = false;
this.btnOutProdSaveDb.Click += new System.EventHandler(this.btnOutProdSaveDb_Click);
//
// chkSkip
//
this.chkSkip.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -1158,9 +938,6 @@ namespace TemuKJD.ToolForms
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dgvProduct)).EndInit();
this.tabPage3.ResumeLayout(false);
this.tabPage4.ResumeLayout(false);
this.panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgvOut1688Prod)).EndInit();
this.ResumeLayout(false);
}
@@ -1224,22 +1001,5 @@ namespace TemuKJD.ToolForms
private System.Windows.Forms.DataGridViewTextBoxColumn colMsg;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.Panel panel2;
private UserComponent.DataGridViewEx dgvOut1688Prod;
private System.Windows.Forms.DataGridViewCheckBoxColumn dataGridViewCheckBoxColumn1;
private System.Windows.Forms.DataGridViewTextBoxColumn colFileName;
private System.Windows.Forms.DataGridViewTextBoxColumn colOutSupplierId;
private System.Windows.Forms.DataGridViewTextBoxColumn colOutSupplierName;
private System.Windows.Forms.DataGridViewTextBoxColumn colOutGoodsId;
private System.Windows.Forms.DataGridViewTextBoxColumn colOutGoodsName;
private System.Windows.Forms.DataGridViewTextBoxColumn colOutCat;
private System.Windows.Forms.DataGridViewTextBoxColumn colOutImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colOutImg;
private System.Windows.Forms.DataGridViewTextBoxColumn colOutPrice;
private System.Windows.Forms.DataGridViewTextBoxColumn colOutStock;
private System.Windows.Forms.DataGridViewLinkColumn dataGridViewLinkColumn1;
private System.Windows.Forms.DataGridViewTextBoxColumn colOutMsg;
private DevComponents.DotNetBar.PanelEx btnOutProdSaveDb;
}
}
+67 -108
View File
@@ -28,6 +28,7 @@ using TemuKJD.BLL;
using TemuKJD.Extension;
using TemuKJD.Helper;
using TemuKJD.PDDForms.ProductSelectForms;
using TemuKJD.UserControls;
using TemuKJD.WXForms.ProductForms;
using Work;
@@ -68,16 +69,13 @@ namespace TemuKJD.ToolForms
{
if(IsAuthorityUser)
{
tabPage2.Controls.Add(dgvOut1688Prod);
this.ucTabControlMetro1.TabPages.RemoveAt(3);
this.ucTabControlMetro1.TabPages.RemoveAt(2);
btnOutProdSaveDb.Visible = true;
}
this.splitContainer1.SplitterDistance = 472;
this.dgvProduct.AddSelectorColumn("colCheck");
this.dgvProduct.AddImgColumn("colImg", "colImgUrl");
this.dgvOut1688Prod.AddImgColumn("colOutImg", "colOutImgUrl");
lst1688cookie = NaiBa.Util.Helper.ConfigHelper.LoadConfig<List<Cookie>>("1688_cookies");
if (lst1688cookie == null)
@@ -987,10 +985,6 @@ namespace TemuKJD.ToolForms
}));
}, cancellationTokenSource.Token);
}
else if (btnSaveDb.Text == "外部商品入库" || btnSaveDb.Text == "已采集数据入库")
{
Out1688ProductImport();
}
}
@@ -1140,31 +1134,11 @@ namespace TemuKJD.ToolForms
BaseMsgForm.ShowInfo("复制成功");
}
private void btnStop_Click(object sender, EventArgs e)
{
if (CancelReturn != null)
CancelReturn.Cancel();
}
private void ucTabControlMetro1_SelectedIndexChanged(object sender, EventArgs e)
{
if (ucTabControlMetro1.SelectedTab.Text == "1688外部数据" || ucTabControlMetro1.SelectedTab.Text == "已采集数据")
{
btnSaveDb.Text = "外部商品入库";
btnSaveDb.Text = "已采集数据入库";
btnGetDetail.Visible = false;
btnGetGoods.Visible = false;
}
else
{
btnSaveDb.Text = "采集商品入库";
btnGetDetail.Visible = true;
btnGetGoods.Visible = true;
}
}
void Out1688ProductImport()
public static void Out1688ProductImport(bool isAuthorityUser, StatusBarUserControl statusBar, PictureBox pbLoading)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Multiselect = true;
@@ -1173,14 +1147,14 @@ namespace TemuKJD.ToolForms
// 显示对话框并获取结果
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
dgvOut1688Prod.BringToFront();
pbLoading.BringToFront();
//dgvOut1688Prod.BringToFront();
//pbLoading.BringToFront();
var filePathLst = openFileDialog.FileNames.ToList();
dgvOut1688Prod.Rows.Clear();
pbLoading.Visible = true;
this.statusBar.pgbTaskProgress.Maximum = filePathLst.Count;
this.statusBar.UpdateProgressBar(0);
//dgvOut1688Prod.Rows.Clear();
//pbLoading.Visible = true;
statusBar.pgbTaskProgress.Maximum = filePathLst.Count;
statusBar.UpdateProgressBar(0);
Task.Run(() =>
{
int successNum = 0;
@@ -1195,49 +1169,47 @@ namespace TemuKJD.ToolForms
{
content = sr.ReadToEnd();
}
rst = Out1688ProdImportOne(path, content);
rst = Out1688ProdImportOne(isAuthorityUser, path, content);
Thread.Sleep(100);
if (this.IsAuthorityUser)
if (isAuthorityUser)
Thread.Sleep(1000);
}
catch (Exception ex)
{
rst = ex.Message;
}
if (string.IsNullOrEmpty(rst))
if (string.IsNullOrEmpty(rst) || rst.Contains("成功"))
successNum++;
else
failedNum++;
Invoke(new Action(() =>
statusBar.Invoke(new Action(() =>
{
this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1);
this.statusBar.lblTaskStatus.Text = "正在导入";
statusBar.UpdateProgressBar(statusBar.pgbTaskProgress.Value + 1);
statusBar.lblTaskStatus.Text = "正在导入 成功" + successNum + " 失败" + failedNum;
}));
}
Invoke(new Action(() =>
statusBar.Invoke(new Action(() =>
{
pbLoading.Visible = false;
this.statusBar.lblTaskStatus.Text = "导入完成";
statusBar.lblTaskStatus.Text = "导入完成 成功" + successNum + " 失败" + failedNum;
BaseMsgForm.ShowInfo("导入完成!");
}));
});
}
}
string Out1688ProdImportOne(string filePath, string content)
public static string Out1688ProdImportOne(bool isAuthorityUser, string filePath, string content)
{
DataGridViewRow row = null;
Invoke(new Action(() =>
{
var index = dgvOut1688Prod.Rows.Add(false, filePath);
row = dgvOut1688Prod.Rows[index];
row.Height = 60;
}));
//DataGridViewRow row = null;
//Invoke(new Action(() =>
//{
// var index = dgvOut1688Prod.Rows.Add(false, filePath);
// row = dgvOut1688Prod.Rows[index];
// row.Height = 60;
//}));
try
{
if (string.IsNullOrEmpty(content) || content.Length < 10)
return "商品数据为空";
@@ -1252,12 +1224,10 @@ namespace TemuKJD.ToolForms
return convertRst;
Thread.Sleep(25);
//if (row.Index % 20 == 0)
// NaiBa.Util.Helper.ConfigHelper.SaveConfig("1688_product_list_" + MainForm.ProcessCount, lst1688OneProductListInfo);
// 商品采集权限用户采集的数据加上用户前缀(商品前缀显示给用户的时候隐藏)
string collectAuthorityTag = "";
if (IsAuthorityUser)
if (isAuthorityUser)
collectAuthorityTag = "-" + BaseClass.UserName;
bool isExist = false;
@@ -1268,10 +1238,10 @@ namespace TemuKJD.ToolForms
html = GetHtml.PostUtf8(existUrl, existData);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
Invoke(new Action(() =>
{
row.Cells["colOutMsg"].Value = "入库失败,产品数据库连接失败";
}));
//Invoke(new Action(() =>
//{
// row.Cells["colOutMsg"].Value = "入库失败,产品数据库连接失败";
//}));
return "入库失败,产品数据库连接失败";
}
else
@@ -1280,42 +1250,37 @@ namespace TemuKJD.ToolForms
isExist = true;
}
var priceMin = (prodInfo.detail.sku?.Min(x => x.multi_price)).ParseToInt() * 0.01m;
var priceMax = (prodInfo.detail.sku?.Max(x => x.multi_price)).ParseToInt() * 0.01m;
Invoke(new Action(() =>
{
row.Cells["colOutSupplierId"].Value = (string.IsNullOrEmpty(outProd.shopId) ? outProd.shopName : outProd.shopId);
row.Cells["colOutSupplierName"].Value = outProd.shopName;
row.Cells["colOutGoodsId"].Value = prodInfo.detail.goods_id.ParseToString();
row.Cells["colOutGoodsName"].Value = prodInfo.detail.goods_name;
row.Cells["colOutCat"].Value = outProd.categoryName;
row.Cells["colOutImgUrl"].Value = prodInfo.detail.image_url;
row.Cells["colOutPrice"].Value = priceMin + "-" + priceMax;
}));
//Invoke(new Action(() =>
//{
// row.Cells["colOutSupplierId"].Value = (string.IsNullOrEmpty(outProd.shopId) ? outProd.shopName : outProd.shopId);
// row.Cells["colOutSupplierName"].Value = outProd.shopName;
// row.Cells["colOutGoodsId"].Value = prodInfo.detail.goods_id.ParseToString();
// row.Cells["colOutGoodsName"].Value = prodInfo.detail.goods_name;
// row.Cells["colOutCat"].Value = outProd.categoryName;
// row.Cells["colOutImgUrl"].Value = prodInfo.detail.image_url;
// row.Cells["colOutPrice"].Value = priceMin + "-" + priceMax;
//}));
//var SetPartnerSpuRst = "";
var url = BaseClass.BuildPDDObjString("product/add_product");
if (isExist)
{
if (chkOverride.Checked)
{
//if (chkOverride.Checked)
//{
url = BaseClass.BuildPDDObjString("product/mdy_product");
}
else
{
//入库成功 已存在相同id商品
Invoke(new Action(() =>
{
row.Cells["colOutMsg"].Value = "已存在相同商品Id,跳过";
}));
return "";
}
//}
//else
//{
// //入库成功 已存在相同id商品
// Invoke(new Action(() =>
// {
// row.Cells["colOutMsg"].Value = "已存在相同商品Id,跳过";
// }));
// return "";
//}
}
if (outProd.minOrderQuaitity.ParseToInt() > 1)
@@ -1345,7 +1310,7 @@ namespace TemuKJD.ToolForms
"&main_img=" + HttpUtility.UrlEncode(prodInfo.detail.image_url, Encoding.UTF8) +
"&wx_safe_status=" + HttpUtility.UrlEncode("未校验", Encoding.UTF8) +
"&product_get_type=" + HttpUtility.UrlEncode("1688外部数据", Encoding.UTF8);
if (IsAuthorityUser)
if (isAuthorityUser)
{
data += "&add_user_name=" + BaseClass.UserName;
data += "&group=用户" + BaseClass.UserName;
@@ -1371,38 +1336,32 @@ namespace TemuKJD.ToolForms
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
string msg = "商品入库失败!请检查网络连接:" + BaseRegex.GetStringJson(ref html, "msg");
Invoke(new Action(() =>
{
row.Cells["colOutMsg"].Value = msg;
}));
//Invoke(new Action(() =>
//{
// row.Cells["colOutMsg"].Value = msg;
//}));
return msg;
}
else
{
var getProductMsg = "商品入库成功!";
if (url == BaseClass.BuildPDDObjString("product/mdy_product"))
getProductMsg = "商品覆盖成功!";
Invoke(new Action(() =>
{
row.Cells["colOutMsg"].Value = getProductMsg;
}));
//var getProductMsg = "商品入库成功!";
//if (url == BaseClass.BuildPDDObjString("product/mdy_product"))
// getProductMsg = "商品覆盖成功!";
//Invoke(new Action(() =>
//{
// row.Cells["colOutMsg"].Value = getProductMsg;
//}));
}
//NaiBa.Util.Helper.ConfigHelper.SaveConfig("1688_product_list_" + MainForm.ProcessCount, lst1688OneProductListInfo);
}
catch (Exception ex)
{
Invoke(new Action(() =>
{
row.Cells["colOutMsg"].Value = "商品入库失败" + ex.Message;
}));
//Invoke(new Action(() =>
//{
// row.Cells["colOutMsg"].Value = "商品入库失败" + ex.Message;
//}));
return "商品入库失败" + ex.Message;
}
return "";
}
private void btnOutProdSaveDb_Click(object sender, EventArgs e)
{
Out1688ProductImport();
}
}
}
-39
View File
@@ -168,43 +168,4 @@
<metadata name="colMsg.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewCheckBoxColumn1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colFileName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colOutSupplierId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colOutSupplierName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colOutGoodsId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colOutGoodsName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colOutCat.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colOutImgUrl.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colOutImg.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colOutPrice.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colOutStock.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewLinkColumn1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colOutMsg.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>