优化代码
This commit is contained in:
1 parent
ddc5f6490f
commit
625f4d9420
4 files changed
+44
-43
No files matched your search
@@ -27,7 +27,7 @@ namespace AllBase
|
||||
/// <summary>
|
||||
/// 版本ID
|
||||
/// </summary>
|
||||
public static int VersionCount = 806;
|
||||
public static int VersionCount = 807;
|
||||
//public static int VersionCount = 613;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -420,7 +420,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
"",
|
||||
"普通商品",
|
||||
"书籍"});
|
||||
this.cmbSpProdType.Location = new System.Drawing.Point(381, 40);
|
||||
this.cmbSpProdType.Location = new System.Drawing.Point(381, 43);
|
||||
this.cmbSpProdType.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
|
||||
this.cmbSpProdType.Name = "cmbSpProdType";
|
||||
this.cmbSpProdType.Size = new System.Drawing.Size(49, 25);
|
||||
@@ -447,7 +447,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
"厂商直采",
|
||||
"机会商品",
|
||||
"外部数据"});
|
||||
this.cmbSourceType.Location = new System.Drawing.Point(258, 40);
|
||||
this.cmbSourceType.Location = new System.Drawing.Point(258, 43);
|
||||
this.cmbSourceType.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
|
||||
this.cmbSourceType.Name = "cmbSourceType";
|
||||
this.cmbSourceType.Size = new System.Drawing.Size(49, 25);
|
||||
@@ -562,7 +562,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.cmbSort.Items.AddRange(new object[] {
|
||||
"入库时间",
|
||||
"认领总数"});
|
||||
this.cmbSort.Location = new System.Drawing.Point(507, 5);
|
||||
this.cmbSort.Location = new System.Drawing.Point(507, 7);
|
||||
this.cmbSort.Name = "cmbSort";
|
||||
this.cmbSort.Size = new System.Drawing.Size(46, 25);
|
||||
this.cmbSort.TabIndex = 448;
|
||||
@@ -628,7 +628,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
//
|
||||
this.cmbGroupFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cmbGroupFilter.FormattingEnabled = true;
|
||||
this.cmbGroupFilter.Location = new System.Drawing.Point(159, 40);
|
||||
this.cmbGroupFilter.Location = new System.Drawing.Point(159, 43);
|
||||
this.cmbGroupFilter.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
|
||||
this.cmbGroupFilter.Name = "cmbGroupFilter";
|
||||
this.cmbGroupFilter.Size = new System.Drawing.Size(49, 25);
|
||||
@@ -643,7 +643,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
"安全商品",
|
||||
"违规商品",
|
||||
"未校验"});
|
||||
this.cmbWxSafe.Location = new System.Drawing.Point(504, 40);
|
||||
this.cmbWxSafe.Location = new System.Drawing.Point(504, 43);
|
||||
this.cmbWxSafe.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
|
||||
this.cmbWxSafe.Name = "cmbWxSafe";
|
||||
this.cmbWxSafe.Size = new System.Drawing.Size(49, 25);
|
||||
|
||||
+28
-28
@@ -30,11 +30,11 @@ namespace TemuKJD.ToolForms
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
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();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||
@@ -107,7 +107,7 @@ namespace TemuKJD.ToolForms
|
||||
this.tabControl1.Multiline = true;
|
||||
this.tabControl1.Name = "tabControl1";
|
||||
this.tabControl1.SelectedIndex = 0;
|
||||
this.tabControl1.Size = new System.Drawing.Size(1404, 470);
|
||||
this.tabControl1.Size = new System.Drawing.Size(1404, 471);
|
||||
this.tabControl1.TabIndex = 0;
|
||||
//
|
||||
// tabPage1
|
||||
@@ -117,7 +117,7 @@ namespace TemuKJD.ToolForms
|
||||
this.tabPage1.Location = new System.Drawing.Point(4, 28);
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage1.Size = new System.Drawing.Size(1396, 438);
|
||||
this.tabPage1.Size = new System.Drawing.Size(1396, 439);
|
||||
this.tabPage1.TabIndex = 0;
|
||||
this.tabPage1.Text = " 商品页面 ";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
@@ -136,7 +136,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(1388, 430);
|
||||
this.splitContainer2.Size = new System.Drawing.Size(1388, 431);
|
||||
this.splitContainer2.SplitterDistance = 26;
|
||||
this.splitContainer2.TabIndex = 6;
|
||||
//
|
||||
@@ -178,7 +178,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(1896, 437);
|
||||
this.tabPage2.Size = new System.Drawing.Size(1396, 439);
|
||||
this.tabPage2.TabIndex = 1;
|
||||
this.tabPage2.Text = " 商品列表 ";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
@@ -187,7 +187,7 @@ namespace TemuKJD.ToolForms
|
||||
//
|
||||
this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue;
|
||||
this.pbLoading.Location = new System.Drawing.Point(923, 196);
|
||||
this.pbLoading.Location = new System.Drawing.Point(673, 197);
|
||||
this.pbLoading.Name = "pbLoading";
|
||||
this.pbLoading.Size = new System.Drawing.Size(50, 50);
|
||||
this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
@@ -199,20 +199,20 @@ namespace TemuKJD.ToolForms
|
||||
//
|
||||
this.dgvProduct.AllowUserToAddRows = false;
|
||||
this.dgvProduct.AllowUserToDeleteRows = false;
|
||||
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.dgvProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
|
||||
dataGridViewCellStyle6.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.dgvProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6;
|
||||
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)))));
|
||||
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;
|
||||
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle7.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dgvProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7;
|
||||
this.dgvProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.colCheck,
|
||||
@@ -231,7 +231,7 @@ namespace TemuKJD.ToolForms
|
||||
this.dgvProduct.Name = "dgvProduct";
|
||||
this.dgvProduct.ReadOnly = true;
|
||||
this.dgvProduct.RowTemplate.Height = 23;
|
||||
this.dgvProduct.Size = new System.Drawing.Size(1890, 431);
|
||||
this.dgvProduct.Size = new System.Drawing.Size(1390, 433);
|
||||
this.dgvProduct.TabIndex = 7;
|
||||
this.dgvProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvProduct_CellContentClick);
|
||||
//
|
||||
@@ -271,8 +271,8 @@ namespace TemuKJD.ToolForms
|
||||
//
|
||||
// colGoodsName
|
||||
//
|
||||
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colGoodsName.DefaultCellStyle = dataGridViewCellStyle3;
|
||||
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colGoodsName.DefaultCellStyle = dataGridViewCellStyle8;
|
||||
this.colGoodsName.FillWeight = 120F;
|
||||
this.colGoodsName.HeaderText = "商品名称";
|
||||
this.colGoodsName.Name = "colGoodsName";
|
||||
@@ -300,8 +300,8 @@ namespace TemuKJD.ToolForms
|
||||
//
|
||||
// colPrice
|
||||
//
|
||||
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colPrice.DefaultCellStyle = dataGridViewCellStyle4;
|
||||
dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colPrice.DefaultCellStyle = dataGridViewCellStyle9;
|
||||
this.colPrice.FillWeight = 70F;
|
||||
this.colPrice.HeaderText = "价格";
|
||||
this.colPrice.Name = "colPrice";
|
||||
@@ -316,8 +316,8 @@ namespace TemuKJD.ToolForms
|
||||
//
|
||||
// colMsg
|
||||
//
|
||||
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colMsg.DefaultCellStyle = dataGridViewCellStyle5;
|
||||
dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colMsg.DefaultCellStyle = dataGridViewCellStyle10;
|
||||
this.colMsg.FillWeight = 200F;
|
||||
this.colMsg.HeaderText = "操作结果";
|
||||
this.colMsg.Name = "colMsg";
|
||||
@@ -364,7 +364,7 @@ namespace TemuKJD.ToolForms
|
||||
this.splitContainer1.Panel2.Controls.Add(this.btnImportCookie);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.label2);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(1404, 561);
|
||||
this.splitContainer1.SplitterDistance = 470;
|
||||
this.splitContainer1.SplitterDistance = 471;
|
||||
this.splitContainer1.SplitterWidth = 3;
|
||||
this.splitContainer1.TabIndex = 4;
|
||||
//
|
||||
|
||||
@@ -493,7 +493,7 @@ namespace TemuKJD.ToolForms
|
||||
Task.Run(() => { });
|
||||
//"&product_get_type=" + HttpUtility.UrlEncode("厂商直采", Encoding.UTF8);
|
||||
|
||||
ConcurrentList<DataGridViewRow> rowLst = new ConcurrentList<DataGridViewRow>();
|
||||
List<DataGridViewRow> rowLst = new List<DataGridViewRow>();
|
||||
rowLst.AddRange(dgvProduct.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true));
|
||||
|
||||
if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested)
|
||||
@@ -667,17 +667,18 @@ namespace TemuKJD.ToolForms
|
||||
var shop = new ShopLoginInfo();
|
||||
shop.Cookies = JsonHelper.SerializeObject(cookieList);
|
||||
|
||||
ConcurrentList<DataGridViewRow> rowLst = new ConcurrentList<DataGridViewRow>();
|
||||
rowLst.AddRange(dgvProduct.Rows.Cast<DataGridViewRow>());
|
||||
foreach (DataGridViewRow row in rowLst)
|
||||
List<string> pIds = new List<string>();
|
||||
pIds.AddRange(dgvProduct.Rows.Cast<DataGridViewRow>().Select(r => r.Cells["colProductId"].Value.ParseToString()).ToList());
|
||||
foreach (var prodId in pIds)
|
||||
{
|
||||
if (cancellationTokenSource.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
if (row.Index < 0 || row.Cells["colCheck"].Value.ParseToBool() != true)
|
||||
var row = dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colProductId"].Value.ParseToString() == prodId);
|
||||
|
||||
if (row == null || row.Index < 0 || row.Cells["colCheck"].Value.ParseToBool() != true)
|
||||
continue;
|
||||
|
||||
var prodId = row.Cells["colProductId"].Value.ParseToString();
|
||||
var prod = lstJSTListProductInfo.FirstOrDefault(c => c.id == prodId);
|
||||
// 不存在或已经采集过
|
||||
if (prod == null || prod?.dbProduct?.product_json?.ParseToString().Length > 10)
|
||||
@@ -743,7 +744,7 @@ namespace TemuKJD.ToolForms
|
||||
prod.dbProduct.price_text = priceMin + "-" + priceMax;
|
||||
prod.getProductMsg = "采集成功";
|
||||
|
||||
Invoke(new Action(() =>
|
||||
MainForm.instance.Invoke(new Action(() =>
|
||||
{
|
||||
row.Cells["colMsg"].Value = prod.getProductMsg;
|
||||
row.Cells["colCate"].Value = prod.categoryName.IsNullOrEmpty() ? prod?.dbProduct?.cat_id : prod.categoryName;
|
||||
@@ -759,7 +760,7 @@ namespace TemuKJD.ToolForms
|
||||
}));
|
||||
}
|
||||
|
||||
if (rowLst.IndexOf(row) % 20 == 0 )
|
||||
if (pIds.IndexOf(prodId) % 20 == 0 )
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("supplier_product_list_" + MainForm.ProcessCount, lstJSTListProductInfo);
|
||||
}
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("supplier_product_list_" + MainForm.ProcessCount, lstJSTListProductInfo);
|
||||
@@ -783,7 +784,7 @@ namespace TemuKJD.ToolForms
|
||||
var shop = new ShopLoginInfo();
|
||||
shop.Cookies = JsonHelper.SerializeObject(cookieList);
|
||||
|
||||
ConcurrentList<DataGridViewRow> rowLst = new ConcurrentList<DataGridViewRow>();
|
||||
List<DataGridViewRow> rowLst = new List<DataGridViewRow>();
|
||||
rowLst.AddRange(dgvProduct.Rows.Cast<DataGridViewRow>());
|
||||
foreach (DataGridViewRow row in rowLst)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user