上传限制最大店铺商品数量

This commit is contained in:
wule committed 2026-10-11 21:16:32 +08:00
1 parent 43a7bd3a48
commit d3ecc4046f
2 files changed
+150 -29

No files matched your search

+84 -28
View File
@@ -42,6 +42,7 @@ namespace TemuKJD.WXForms.ProductForms
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.btnClearAll = new DevComponents.DotNetBar.PanelEx();
this.txtWaitSeconds = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.chkRemoveSpecialChar = new TemuKJD.UserComponent.UcCheckBox(this.components);
@@ -71,6 +72,9 @@ namespace TemuKJD.WXForms.ProductForms
this.chkStepAddPrice = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.ucTabControlMetro1 = new TemuKJD.UserControls.UcTabControlMetro();
this.上传参数1 = new System.Windows.Forms.TabPage();
this.label43 = new System.Windows.Forms.Label();
this.numNotUploadShopProdMoreThan = new System.Windows.Forms.NumericUpDown();
this.chkNotUploadShopProdMoreThan = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.numJumpCnt = new System.Windows.Forms.NumericUpDown();
this.label40 = new System.Windows.Forms.Label();
this.chkFreightInsurance = new TemuKJD.UserComponent.UcCheckBox(this.components);
@@ -264,7 +268,6 @@ namespace TemuKJD.WXForms.ProductForms
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.btnClear = new DevComponents.DotNetBar.PanelEx();
this.panelEx1 = new DevComponents.DotNetBar.PanelEx();
this.btnClearAll = new DevComponents.DotNetBar.PanelEx();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -275,6 +278,7 @@ namespace TemuKJD.WXForms.ProductForms
this.fPnlPriceRule.SuspendLayout();
this.ucTabControlMetro1.SuspendLayout();
this.上传参数1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numNotUploadShopProdMoreThan)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numJumpCnt)).BeginInit();
this.特殊参数.SuspendLayout();
this.佣金上货.SuspendLayout();
@@ -366,6 +370,32 @@ namespace TemuKJD.WXForms.ProductForms
this.ucGroupBoxEx2.TabStop = false;
this.ucGroupBoxEx2.Text = "商品上传";
//
// btnClearAll
//
this.btnClearAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnClearAll.CanvasColor = System.Drawing.SystemColors.Control;
this.btnClearAll.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnClearAll.DisabledBackColor = System.Drawing.Color.Empty;
this.btnClearAll.Location = new System.Drawing.Point(1032, 121);
this.btnClearAll.Margin = new System.Windows.Forms.Padding(4, 2, 2, 2);
this.btnClearAll.Name = "btnClearAll";
this.btnClearAll.Size = new System.Drawing.Size(60, 23);
this.btnClearAll.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnClearAll.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnClearAll.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnClearAll.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.btnClearAll.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnClearAll.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.btnClearAll.Style.GradientAngle = 90;
this.btnClearAll.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center;
this.btnClearAll.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnClearAll.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnClearAll.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnClearAll.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.btnClearAll.TabIndex = 929;
this.btnClearAll.Text = "清空全部";
this.btnClearAll.Click += new System.EventHandler(this.btnClearAll_Click);
//
// txtWaitSeconds
//
this.txtWaitSeconds.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -797,6 +827,9 @@ namespace TemuKJD.WXForms.ProductForms
//
// 上传参数1
//
this.上传参数1.Controls.Add(this.label43);
this.上传参数1.Controls.Add(this.numNotUploadShopProdMoreThan);
this.上传参数1.Controls.Add(this.chkNotUploadShopProdMoreThan);
this.上传参数1.Controls.Add(this.numJumpCnt);
this.上传参数1.Controls.Add(this.label40);
this.上传参数1.Controls.Add(this.chkFreightInsurance);
@@ -840,6 +873,51 @@ namespace TemuKJD.WXForms.ProductForms
this.上传参数1.Text = "上传参数";
this.上传参数1.UseVisualStyleBackColor = true;
//
// label43
//
this.label43.AutoSize = true;
this.label43.Location = new System.Drawing.Point(343, 121);
this.label43.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.label43.Name = "label43";
this.label43.Size = new System.Drawing.Size(32, 17);
this.label43.TabIndex = 938;
this.label43.Text = "店铺";
//
// numNotUploadShopProdMoreThan
//
this.numNotUploadShopProdMoreThan.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.numNotUploadShopProdMoreThan.Location = new System.Drawing.Point(302, 119);
this.numNotUploadShopProdMoreThan.Maximum = new decimal(new int[] {
100000,
0,
0,
0});
this.numNotUploadShopProdMoreThan.Minimum = new decimal(new int[] {
3,
0,
0,
0});
this.numNotUploadShopProdMoreThan.Name = "numNotUploadShopProdMoreThan";
this.numNotUploadShopProdMoreThan.Size = new System.Drawing.Size(41, 21);
this.numNotUploadShopProdMoreThan.TabIndex = 937;
this.numNotUploadShopProdMoreThan.Value = new decimal(new int[] {
500,
0,
0,
0});
this.numNotUploadShopProdMoreThan.ValueChanged += new System.EventHandler(this.numNotUploadShopProdMoreThan_ValueChanged);
//
// chkNotUploadShopProdMoreThan
//
this.chkNotUploadShopProdMoreThan.AutoSize = true;
this.chkNotUploadShopProdMoreThan.Location = new System.Drawing.Point(202, 119);
this.chkNotUploadShopProdMoreThan.Name = "chkNotUploadShopProdMoreThan";
this.chkNotUploadShopProdMoreThan.Size = new System.Drawing.Size(108, 21);
this.chkNotUploadShopProdMoreThan.TabIndex = 936;
this.chkNotUploadShopProdMoreThan.Text = "跳过上架商品>";
this.chkNotUploadShopProdMoreThan.UseVisualStyleBackColor = true;
this.chkNotUploadShopProdMoreThan.CheckedChanged += new System.EventHandler(this.chkNotUploadShopProdMoreThan_CheckedChanged);
//
// numJumpCnt
//
this.numJumpCnt.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@@ -3389,32 +3467,6 @@ namespace TemuKJD.WXForms.ProductForms
this.panelEx1.Text = "停止当前操作";
this.panelEx1.Visible = false;
//
// btnClearAll
//
this.btnClearAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnClearAll.CanvasColor = System.Drawing.SystemColors.Control;
this.btnClearAll.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnClearAll.DisabledBackColor = System.Drawing.Color.Empty;
this.btnClearAll.Location = new System.Drawing.Point(1032, 121);
this.btnClearAll.Margin = new System.Windows.Forms.Padding(4, 2, 2, 2);
this.btnClearAll.Name = "btnClearAll";
this.btnClearAll.Size = new System.Drawing.Size(60, 23);
this.btnClearAll.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnClearAll.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnClearAll.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnClearAll.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.btnClearAll.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnClearAll.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.btnClearAll.Style.GradientAngle = 90;
this.btnClearAll.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center;
this.btnClearAll.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnClearAll.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnClearAll.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnClearAll.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.btnClearAll.TabIndex = 929;
this.btnClearAll.Text = "清空全部";
this.btnClearAll.Click += new System.EventHandler(this.btnClearAll_Click);
//
// WXDBProdUploadForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -3441,6 +3493,7 @@ namespace TemuKJD.WXForms.ProductForms
this.ucTabControlMetro1.ResumeLayout(false);
this.上传参数1.ResumeLayout(false);
this.上传参数1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numNotUploadShopProdMoreThan)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numJumpCnt)).EndInit();
this.特殊参数.ResumeLayout(false);
this.特殊参数.PerformLayout();
@@ -3708,5 +3761,8 @@ namespace TemuKJD.WXForms.ProductForms
private System.Windows.Forms.NumericUpDown numFilterSaleCountNum;
private UserComponent.UcCheckBox chkFilterSaleCountNum;
private DevComponents.DotNetBar.PanelEx btnClearAll;
}
private System.Windows.Forms.Label label43;
private System.Windows.Forms.NumericUpDown numNotUploadShopProdMoreThan;
private UserComponent.UcCheckBox chkNotUploadShopProdMoreThan;
}
}
@@ -18,9 +18,11 @@ using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Printing;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Runtime.Remoting.Metadata.W3cXsd2001;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
@@ -286,6 +288,9 @@ namespace TemuKJD.WXForms.ProductForms
this.txtFilterBoundMin.Text = wxUploadRule.FilterBoundMinSave.ParseToString();
this.txtFilterBoundMax.Text = wxUploadRule.FilterBoundMaxSave.ParseToString();
}
chkNotUploadShopProdMoreThan.Checked = wxUploadRule.IsNotUploadShopProdMoreThan;
numNotUploadShopProdMoreThan.Value = wxUploadRule.NotUploadShopProdMoreThan;
colOnSaleNum.Visible = wxUploadRule.IsNotUploadShopProdMoreThan;
this.txtPreDays.TextChanged += txtPreDays_TextChanged;
this.txtReplaceText.TextChanged += txtReplaceText_TextChanged;
@@ -814,7 +819,7 @@ namespace TemuKJD.WXForms.ProductForms
GlobalConfig.lstWxShopAuthInfo.FirstOrDefault(sa => sa.ShopId == shopEntity.ShopId)?.ExpiresTime > DateTime.Now.AddMinutes(5) ? "可用" : "过期",
canUse,
GlobalConfig.dicWxShopUploadInfo.ContainsKey(shopEntity.ShopId) ? GlobalConfig.dicWxShopUploadInfo[shopEntity.ShopId].DicDayUploadCount[day] : 0,
GlobalConfig.dicWxShopUploadInfo.ContainsKey(shopEntity.ShopId) ? GlobalConfig.dicWxShopUploadInfo[shopEntity.ShopId].OnSaleCount : 0,
GlobalConfig.dicWxShopUploadInfo.ContainsKey(shopEntity.ShopId) ? GlobalConfig.dicWxShopUploadInfo[shopEntity.ShopId].OnSaleCount.ParseToString() : "-",
shopEntity.AddProductRemaining,
msg
);
@@ -1324,6 +1329,44 @@ namespace TemuKJD.WXForms.ProductForms
if (cancellationTokenSource.IsCancellationRequested)
break;
// 店铺上架数超过一定数量
if (wxUploadRule.IsNotUploadShopProdMoreThan)
{
string nextKey = "";
int pageSize = 20, page = 1, onSaleStatusCode = 5;
var getProdOnSaleRst = WXProdNoCheckEditHelper.scanProductPreview(shop, page, nextKey, pageSize, onSaleStatusCode);
if (!getProdOnSaleRst.Contains("\"success\":true"))
{
var shopRow = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ParseToString() == shop.ShopId);
if (shopRow != null)
Invoke(new Action(() => { shopRow.Cells["colSelect"].Value = false; }));
result = "{\"success\":false,\"status\":\"未上传\",\"errMsg\":\"商品初始化失败:" + BaseRegex.GetStringJson(ref getProdOnSaleRst, "msg") + "\"}";
goto endUploadProduct;
}
var totalNum = JsonHelper.JObjectParse(getProdOnSaleRst)["totalNum"].ParseToInt();
GlobalConfig.dicWxShopUploadInfo[shop.ShopId].OnSaleCount = totalNum;
GlobalConfig.dicWxShopUploadInfo[shop.ShopId].OnSaleRefreshDay = DateTime.Now.ToString("yyyyMMdd").ParseToInt();
// 删除45天前的记录
var removeKeys = GlobalConfig.dicWxShopUploadInfo[shop.ShopId].DicDayUploadCount.Keys.Where(s => s < DateTime.Now.AddDays(-45).ToString("yyyyMMdd").ParseToInt()).ToList();
foreach (var key in removeKeys)
{
GlobalConfig.dicWxShopUploadInfo[shop.ShopId].DicDayUploadCount.Remove(key);
}
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_shop_upload_info", GlobalConfig.dicWxShopUploadInfo);
BindShop(shop, new List<string>() { shop.ShopId });
if (totalNum > wxUploadRule.NotUploadShopProdMoreThan)
{
var shopRow = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ParseToString() == shop.ShopId);
if (shopRow != null)
Invoke(new Action(() => { shopRow.Cells["colSelect"].Value = false; }));
result = "{\"success\":false,\"status\":\"未上传\",\"errMsg\":\"超过设定的店铺最大在售商品数,设定:" +
wxUploadRule.NotUploadShopProdMoreThan + " 已上架:" + totalNum + "\"}";
goto endUploadProduct;
}
}
//将商品上传
KJDDBProduct kjdDbProdTmp = null;
try
@@ -7521,6 +7564,25 @@ namespace TemuKJD.WXForms.ProductForms
}
private void chkNotUploadShopProdMoreThan_CheckedChanged(object sender, EventArgs e)
{
if (IsFormLoad)
{
wxUploadRule.IsNotUploadShopProdMoreThan = chkNotUploadShopProdMoreThan.Checked;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_upload_rule", wxUploadRule);
colOnSaleNum.Visible = wxUploadRule.IsNotUploadShopProdMoreThan;
}
}
private void numNotUploadShopProdMoreThan_ValueChanged(object sender, EventArgs e)
{
if (IsFormLoad)
{
wxUploadRule.NotUploadShopProdMoreThan = numNotUploadShopProdMoreThan.Value.ParseToInt();
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_upload_rule", wxUploadRule);
}
}
}
public class WXUpload
@@ -8025,6 +8087,9 @@ Content-Type: application/octet-stream
/// 上海仓退货
/// </summary>
public bool IsUseShanghaiReturnOrderAddress { get; set; } = false;
public bool IsNotUploadShopProdMoreThan { get; set; } = false;
public int NotUploadShopProdMoreThan { get; set; } = 500;
}
class ImageCache