1活动逻辑调整 2拼多多买手号存储

This commit is contained in:
wule committed 2026-04-09 21:58:20 +08:00
1 parent 2df3769153
commit fa96cc1444
22 files changed
+3251 -1167

No files matched your search

@@ -30,13 +30,14 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle43 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle44 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle45 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle46 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle47 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle48 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle49 = 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();
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();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.chkChance = new TemuKJD.UserComponent.UcCheckBox(this.components);
@@ -109,7 +110,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.txtIdFilter = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.cmbCateFilter1 = new TemuKJD.UserComponent.UcComboBoxMutiSelect();
this.panelEx2 = new DevComponents.DotNetBar.PanelEx();
this.btnRandomAdd = new DevComponents.DotNetBar.PanelEx();
this.label2 = new System.Windows.Forms.Label();
this.cmbGroupFilter = new System.Windows.Forms.ComboBox();
this.label20 = new System.Windows.Forms.Label();
@@ -1041,7 +1042,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.ucGroupBoxEx4.Controls.Add(this.txtIdFilter);
this.ucGroupBoxEx4.Controls.Add(this.label1);
this.ucGroupBoxEx4.Controls.Add(this.cmbCateFilter1);
this.ucGroupBoxEx4.Controls.Add(this.panelEx2);
this.ucGroupBoxEx4.Controls.Add(this.btnRandomAdd);
this.ucGroupBoxEx4.Controls.Add(this.label2);
this.ucGroupBoxEx4.Controls.Add(this.cmbGroupFilter);
this.ucGroupBoxEx4.Controls.Add(this.label20);
@@ -1253,30 +1254,30 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.cmbCateFilter1.SelectedIndexChanged += new System.EventHandler(this.cmbCateFilter1_SelectedIndexChanged);
this.cmbCateFilter1.TextChanged += new System.EventHandler(this.cmbCateFilter1_TextChanged);
//
// panelEx2
// btnRandomAdd
//
this.panelEx2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.panelEx2.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.panelEx2.Cursor = System.Windows.Forms.Cursors.Hand;
this.panelEx2.DisabledBackColor = System.Drawing.Color.Empty;
this.panelEx2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.panelEx2.Location = new System.Drawing.Point(274, 105);
this.panelEx2.Name = "panelEx2";
this.panelEx2.Size = new System.Drawing.Size(62, 23);
this.panelEx2.Style.Alignment = System.Drawing.StringAlignment.Center;
this.panelEx2.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.panelEx2.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.panelEx2.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.panelEx2.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.panelEx2.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.panelEx2.Style.ForeColor.Color = System.Drawing.Color.White;
this.panelEx2.Style.GradientAngle = 90;
this.panelEx2.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.panelEx2.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.panelEx2.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.panelEx2.TabIndex = 431;
this.panelEx2.Text = "随机添加";
this.panelEx2.Click += new System.EventHandler(this.btnRandomAdd_Click);
this.btnRandomAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnRandomAdd.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnRandomAdd.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnRandomAdd.DisabledBackColor = System.Drawing.Color.Empty;
this.btnRandomAdd.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnRandomAdd.Location = new System.Drawing.Point(274, 105);
this.btnRandomAdd.Name = "btnRandomAdd";
this.btnRandomAdd.Size = new System.Drawing.Size(62, 23);
this.btnRandomAdd.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnRandomAdd.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnRandomAdd.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnRandomAdd.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnRandomAdd.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnRandomAdd.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnRandomAdd.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnRandomAdd.Style.GradientAngle = 90;
this.btnRandomAdd.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnRandomAdd.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnRandomAdd.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnRandomAdd.TabIndex = 431;
this.btnRandomAdd.Text = "随机添加";
this.btnRandomAdd.Click += new System.EventHandler(this.btnRandomAdd_Click);
//
// label2
//
@@ -1597,19 +1598,19 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.dgvShop.AllowUserToAddRows = false;
this.dgvShop.AllowUserToDeleteRows = false;
dataGridViewCellStyle43.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle43;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.dgvShop.AutoRowNumber = true;
this.dgvShop.BackgroundColor = System.Drawing.Color.White;
this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle44.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle44.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle44.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle44.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle44.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle44.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle44.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle44;
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.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colSelect,
@@ -1835,19 +1836,19 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.dgvSelectProduct.AllowUserToAddRows = false;
this.dgvSelectProduct.AllowUserToDeleteRows = false;
dataGridViewCellStyle45.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle45;
dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3;
this.dgvSelectProduct.AutoRowNumber = true;
this.dgvSelectProduct.BackgroundColor = System.Drawing.Color.White;
this.dgvSelectProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle46.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle46.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle46.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle46.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle46.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle46.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle46.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle46;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4;
this.dgvSelectProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvSelectProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheck,
@@ -1909,8 +1910,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colSupplierName
//
dataGridViewCellStyle47.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle47;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle5;
this.colSupplierName.Frozen = true;
this.colSupplierName.HeaderText = "店铺名称";
this.colSupplierName.Name = "colSupplierName";
@@ -1988,8 +1989,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colProductName
//
dataGridViewCellStyle48.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle48;
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle6;
this.colProductName.HeaderText = "商品标题";
this.colProductName.Name = "colProductName";
this.colProductName.ReadOnly = true;
@@ -2049,8 +2050,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colAddTime
//
dataGridViewCellStyle49.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colAddTime.DefaultCellStyle = dataGridViewCellStyle49;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colAddTime.DefaultCellStyle = dataGridViewCellStyle7;
this.colAddTime.FillWeight = 80F;
this.colAddTime.HeaderText = "上传时间";
this.colAddTime.Name = "colAddTime";
@@ -2058,6 +2059,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colOpResult
//
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colOpResult.DefaultCellStyle = dataGridViewCellStyle8;
this.colOpResult.HeaderText = "操作结果";
this.colOpResult.Name = "colOpResult";
this.colOpResult.ReadOnly = true;
@@ -2229,7 +2232,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private System.Windows.Forms.Label label4;
private DevComponents.DotNetBar.PanelEx btnStop;
private UserComponent.UcCheckBox chkChance;
private DevComponents.DotNetBar.PanelEx panelEx2;
private DevComponents.DotNetBar.PanelEx btnRandomAdd;
private System.Windows.Forms.TextBox txtAddCount;
private System.Windows.Forms.Label lblGoodsCount;
private DevComponents.DotNetBar.PanelEx btnClearUpload;
@@ -2293,28 +2296,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private UserComponent.UcCheckBox chkSkipQualification;
private DevComponents.DotNetBar.PanelEx btnApiUpload;
private DevComponents.DotNetBar.PanelEx btnRefreshApi;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
private System.Windows.Forms.DataGridViewTextBoxColumn colSelectId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName;
private System.Windows.Forms.DataGridViewLinkColumn colLogin;
private System.Windows.Forms.DataGridViewLinkColumn colInShop;
private System.Windows.Forms.DataGridViewLinkColumn colSpuId;
private System.Windows.Forms.DataGridViewLinkColumn colSkcId;
private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colProductSkcPic;
private System.Windows.Forms.DataGridViewTextBoxColumn colSkuFakeImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colSkuFakeImg;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductName;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductCat;
private System.Windows.Forms.DataGridViewTextBoxColumn colExtCode;
private System.Windows.Forms.DataGridViewTextBoxColumn colMsg;
private System.Windows.Forms.DataGridViewTextBoxColumn colDraftId;
private System.Windows.Forms.DataGridViewTextBoxColumn colNotes;
private System.Windows.Forms.DataGridViewLinkColumn colUserNotes;
private System.Windows.Forms.DataGridViewLinkColumn ColDelete;
private System.Windows.Forms.DataGridViewTextBoxColumn colAddTime;
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
private System.Windows.Forms.TextBox txtAddShippingFeeTimes;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.PictureBox pbShopLoading;
@@ -2349,5 +2330,27 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private UserComponent.UcComboBoxMutiSelect cmbCateFilter1;
private UserComponent.UcComboBoxMutiSelect cmbCateFilter3;
private UserComponent.UcComboBoxMutiSelect cmbCateFilter2;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
private System.Windows.Forms.DataGridViewTextBoxColumn colSelectId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName;
private System.Windows.Forms.DataGridViewLinkColumn colLogin;
private System.Windows.Forms.DataGridViewLinkColumn colInShop;
private System.Windows.Forms.DataGridViewLinkColumn colSpuId;
private System.Windows.Forms.DataGridViewLinkColumn colSkcId;
private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colProductSkcPic;
private System.Windows.Forms.DataGridViewTextBoxColumn colSkuFakeImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colSkuFakeImg;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductName;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductCat;
private System.Windows.Forms.DataGridViewTextBoxColumn colExtCode;
private System.Windows.Forms.DataGridViewTextBoxColumn colMsg;
private System.Windows.Forms.DataGridViewTextBoxColumn colDraftId;
private System.Windows.Forms.DataGridViewTextBoxColumn colNotes;
private System.Windows.Forms.DataGridViewLinkColumn colUserNotes;
private System.Windows.Forms.DataGridViewLinkColumn ColDelete;
private System.Windows.Forms.DataGridViewTextBoxColumn colAddTime;
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
}
}
@@ -46,7 +46,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
"跑步鞋", "棉鞋", "高帮休闲鞋", "网面鞋", "勃肯鞋/软木鞋", "包头拖", "足部磨砂", "老爹鞋", "工装鞋", "豆豆鞋", "汉服鞋", "雨鞋" };
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
public CancellationTokenSource cancelAddProd { get; set; } = null;
public CancellationTokenSource getProdTokenSource { get; set; } = null;
public bool IsLoadComplate { get; set; } = false;
bool isInit = false;
@@ -5912,38 +5912,66 @@ Content-Type: image/jpeg
private void btnRandomAdd_Click(object sender, EventArgs e)
{
int addCount = txtAddCount.Text.Trim().ParseToInt();
pictureBox1.Visible = true;
if (cancelAddProd != null)
cancelAddProd.Cancel();
cancelAddProd = new CancellationTokenSource();
btnRandomAdd.Enabled = false;
Task.Run(() =>
{
int prodCount = 0;
List<KJDDBProduct> list = new List<KJDDBProduct>();
Thread.Sleep(5000);
Invoke(new Action(() =>
{
btnRandomAdd.Enabled = true;
}));
});
pictureBox1.Visible = true;
int addCount = txtAddCount.Text.Trim().ParseToInt();
if (getProdTokenSource != null)
getProdTokenSource.Cancel();
getProdTokenSource = new CancellationTokenSource();
Task.Run(() =>
{
List<KJDDBProduct> prodLst = new List<KJDDBProduct>();
int index = 0;
int pageSize = 50;
int prodCount = 99999999;
while (addCount > 0)
{
if (cancelAddProd.IsCancellationRequested)
if (getProdTokenSource.IsCancellationRequested)
break;
// 等于50说明还有更多,不足50就不用再查了
if (list.Count == 0 || list.Count == 50)
index++;
// 如果产品数量在0到50之间,说明数据库商品数量不足,无需再重复筛选,直接随机打乱
if (prodLst.Count == 0 || prodCount > pageSize)
{
list = GetRandomProductList(out prodCount, 1, 50);
Thread.Sleep(Randomx.GetId(50,100));
if (prodCount != 99999999)
{
//不重复筛选
prodLst = GetRandomProductList(out prodCount, 1, Math.Min(pageSize, addCount), true, prodCount);
}
else
{
prodLst = GetRandomProductList(out prodCount, 1, Math.Min(pageSize, addCount));
}
//Thread.Sleep(Randomx.GetId(50, 100));
Thread.Sleep(Randomx.GetId(250, 500));
}
else
{
prodLst = prodLst.OrderBy(x => Guid.NewGuid()).ToList();
Thread.Sleep(Randomx.GetId(10, 30));
}
if (list.Count == 0) // 等于0要么库里没数据要么出错了,跳出
break;
Invoke(new Action(() =>
{
lblGoodsCount.Text = "产品库 " + prodCount + " 件";
}));
foreach (var prod in list)
if (prodLst.Count == 0) // 等于0要么库里没数据要么出错了,跳出
break;
foreach (var prod in prodLst)
{
var selectProd = JsonHelper.DeserializeJsonToObject<TemuDBProductSelect>(JsonHelper.SerializeObject(prod));
selectProd.out_product_Id = prod.id.ToString();
selectProd.id = 1;
if (lstTemuDBProductSelect.Count > 0)
selectProd.id = lstTemuDBProductSelect.Max(p => p.id).ParseToInt() + 1;
selectProd.id = lstTemuDBProductSelect.Max(p => p.id) + 1;
this.lstTemuDBProductSelect.Add(selectProd);
Invoke(new Action(() =>
@@ -5957,10 +5985,10 @@ Content-Type: image/jpeg
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_db_prod_upload_list", this.lstTemuDBProductSelect);
}
Invoke(new Action(() => { pictureBox1.Visible = false; }));
}, cancelAddProd.Token);
}, getProdTokenSource.Token);
}
public List<KJDDBProduct> GetRandomProductList(out int totalCount, int page = 1, int pageSize = 50)
public List<KJDDBProduct> GetRandomProductList(out int totalCount, int page = 1, int pageSize = 50, bool isNotCount = false, int totalProdCount = 0)
{
var lstShopId = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
@@ -5980,36 +6008,32 @@ Content-Type: image/jpeg
data += "&in_spu_ids=" + txtIdFilter.Text;
data += "&in_groups=" + cmbGroupFilter.Text;
var selectCate1 = GlobalConfig.WxCatList.Where(c => c.level == 1 && (";" + cmbCateFilter1.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
var cates2 = GlobalConfig.WxCatList.Where(c => selectCate1.Any(c1 => c.f_cat_id == c1.cat_id)).ToList();
var selectCate2 = cates2.Where(c => c.level == 2 && (";" + cmbCateFilter2.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
var cates3 = GlobalConfig.WxCatList.Where(c => selectCate2.Any(c2 => c.f_cat_id == c2.cat_id)).ToList();
var selectCate3 = cates3.Where(c => c.level == 3 && (";" + cmbCateFilter3.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
if (cmbSourceType.Text != "厂商直采" && cmbSourceType.Text != "1688厂家" && cmbSourceType.Text != "微信店采" && cmbSourceType.Text != "微信小店")
{
data += "&in_cates=" + (cmbCateFilter1.Text == "全部" ? "" : cmbCateFilter1.Text);
}
else
{
var selectCate1 = GlobalConfig.WxCatList.Where(c => c.level == 1 && (";" + cmbCateFilter1.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
var cates2 = GlobalConfig.WxCatList.Where(c => selectCate1.Any(c1 => c.f_cat_id == c1.cat_id)).ToList();
var selectCate2 = cates2.Where(c => c.level == 2 && (";" + cmbCateFilter2.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
var cates3 = GlobalConfig.WxCatList.Where(c => selectCate2.Any(c2 => c.f_cat_id == c2.cat_id)).ToList();
var selectCate3 = cates3.Where(c => c.level == 3 && (";" + cmbCateFilter3.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
if (selectCate1?.Count == 0 && chkSkipQualification.Checked)
{
// 厂商直采普通店铺不要随特殊商品
data += "&wx_cat_1=" + string.Join(",", GlobalConfig.WxCatList.Where(c => c.level == 1 && !(c.name == "图书" || c.name == "食品饮料" || c.name == "成人用品"))
.Select(c => c.cat_id));
}
if (!string.IsNullOrEmpty(cmbCateFilter1.Text) && selectCate1?.Count > 0)
data += "&wx_cat_1=" + string.Join(",", selectCate1.Select(c => c.cat_id).ToList());
//else if (chkSkipQualification.Checked)
//{
// // 厂商直采普通店铺不要随特殊商品
// data += "&wx_cat_1=" + string.Join(",", GlobalConfig.WxCatList.Where(c => c.level == 1 && !(c.name == "图书" || c.name == "食品饮料" || c.name == "成人用品"))
// .Select(c => c.cat_id));
//}
if (!string.IsNullOrEmpty(cmbCateFilter2.Text) && selectCate2?.Count > 0)
data += "&wx_cat_2=" + string.Join(",", selectCate2.Select(c => c.cat_id).ToList());
if (!string.IsNullOrEmpty(cmbCateFilter3.Text) && selectCate3?.Count > 0)
data += "&wx_cat_3=" + string.Join(",", selectCate3.Select(c => c.cat_id).ToList());
}
if (selectCate1.Count == 0 && cmbSourceType.Text == "厂商直采" && chkSkipQualification.Checked)
{
// 厂商直采普通店铺不要随特殊商品
data += "&wx_cat_1=" + string.Join(",", GlobalConfig.WxCatList.Where(c => c.level == 1 && !(c.name == "图书" || c.name == "食品饮料" || c.name == "成人用品"))
.Select(c => c.cat_id));
}
data += "&product_get_type=" + cmbSourceType.Text.Trim();
if (cmbSourceType.Text.Trim() == "厂商直采")
@@ -6438,8 +6462,8 @@ Content-Type: image/jpeg
private void pictureBox1_Click(object sender, EventArgs e)
{
if (cancelAddProd != null)
cancelAddProd.Cancel();
if (getProdTokenSource != null)
getProdTokenSource.Cancel();
}
private void btnTest20981_Click(object sender, EventArgs e)