导入微信格式数据 增加上架时间判断,如果大于指定时间则不上传

This commit is contained in:
chfei committed 2026-10-09 17:52:02 +08:00
1 parent 967f1488fd
commit c75735db0c
7 files changed
+123 -50

No files matched your search

@@ -153,6 +153,9 @@ namespace TemuKJD.WXForms.ProductForms
this.col_select_product = new System.Windows.Forms.DataGridViewLinkColumn();
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.label10 = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.txt_listing_time = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -606,6 +609,8 @@ namespace TemuKJD.WXForms.ProductForms
this.tableLayoutPanel1.Controls.Add(this.chkTime, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.dtpStart, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.dtpEnd, 3, 2);
this.tableLayoutPanel1.Controls.Add(this.label10, 10, 2);
this.tableLayoutPanel1.Controls.Add(this.txt_listing_time, 11, 2);
this.tableLayoutPanel1.Location = new System.Drawing.Point(4, 6);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 3;
@@ -1615,13 +1620,16 @@ namespace TemuKJD.WXForms.ProductForms
this.ucSplitPage1.CurrentPage = 1;
this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right;
this.ucSplitPage1.IsShowPageSize = true;
this.ucSplitPage1.IsShowTotalCount = false;
this.ucSplitPage1.Location = new System.Drawing.Point(985, 0);
this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0);
this.ucSplitPage1.MaxPageSizeValue = 5000;
this.ucSplitPage1.Name = "ucSplitPage1";
this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0);
this.ucSplitPage1.PageSize = 100;
this.ucSplitPage1.Size = new System.Drawing.Size(453, 25);
this.ucSplitPage1.TabIndex = 6;
this.ucSplitPage1.TotalCount = ((long)(0));
this.ucSplitPage1.TotalPage = 1;
//
// statusBar
@@ -1635,6 +1643,31 @@ namespace TemuKJD.WXForms.ProductForms
this.statusBar.Size = new System.Drawing.Size(1438, 25);
this.statusBar.TabIndex = 5;
//
// label10
//
this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(832, 77);
this.label10.Margin = new System.Windows.Forms.Padding(3, 7, 0, 0);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(56, 17);
this.label10.TabIndex = 983;
this.label10.Text = "上架日期";
this.toolTip1.SetToolTip(this.label10, "导入数据时超出时间(天)范围的不导入");
//
// txt_listing_time
//
this.txt_listing_time.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txt_listing_time.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txt_listing_time.Font = new System.Drawing.Font("微软雅黑", 10F);
this.txt_listing_time.Location = new System.Drawing.Point(888, 73);
this.txt_listing_time.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.txt_listing_time.Name = "txt_listing_time";
this.txt_listing_time.Size = new System.Drawing.Size(101, 25);
this.txt_listing_time.TabIndex = 984;
this.txt_listing_time.Text = "30";
//
// WXUserCollectAuthProdListForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -1777,5 +1810,8 @@ namespace TemuKJD.WXForms.ProductForms
public System.Windows.Forms.ComboBox cmbBatchEditNotes;
private DevComponents.DotNetBar.PanelEx btnBatchEditCate;
private DevComponents.DotNetBar.PanelEx btn_import_wx;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.TextBox txt_listing_time;
}
}
@@ -149,9 +149,9 @@ namespace TemuKJD.WXForms.ProductForms
btnGetProdWxCate.Visible = false;
btnStopStop.Visible = false;
btnImportPddOutData.Visible = false;
btnOut1688ProdSaveDb.Visible = false;
btn_import_wx.Visible = false;
btnAITitleFission.Visible = false;
btnOut1688ProdSaveDb.Visible = false;
btn_import_wx.Visible = false;
btnAITitleFission.Visible = false;
this.dgvDbProduct.Columns["col_edit"].Visible = false;
}
}
@@ -196,21 +196,21 @@ namespace TemuKJD.WXForms.ProductForms
{
var cancelToken = cancellationTokenSource.Token;
int pageCount;
int pageCount;
int totalCount;
int pageSize = 100;
decimal seconds;
Invoke(new Action(() => { pageSize = this.ucSplitPage1.PageSize; }));
var list = GetProductList(out pageCount, out totalCount, out seconds, page, pageSize, isNotCount);
if (cancelToken.IsCancellationRequested)
return;
if (cancelToken.IsCancellationRequested)
return;
lstTemuDbProduct.AddRange(list);
this.ucSplitPage1.TotalPage = pageCount;
this.ucSplitPage1.TotalCount = totalCount;
lstTemuDbProduct.AddRange(list);
this.ucSplitPage1.TotalPage = pageCount;
this.ucSplitPage1.TotalCount = totalCount;
if (defaultBitmap == null)
if (defaultBitmap == null)
defaultBitmap = new Bitmap(80, 80);
// 获取Bitmap的Graphics对象
using (Graphics g = Graphics.FromImage(defaultBitmap))
@@ -282,9 +282,9 @@ namespace TemuKJD.WXForms.ProductForms
}));
}
if (cancelToken.IsCancellationRequested)
return;
Invoke(new Action(() =>
if (cancelToken.IsCancellationRequested)
return;
Invoke(new Action(() =>
{
ShowDgvImg();
this.pbLoading.Visible = false;
@@ -388,7 +388,7 @@ namespace TemuKJD.WXForms.ProductForms
List<KJDDBProduct> list = new List<KJDDBProduct>();
pageCount = 1;
totalNum = 0;
seconds = 0;
seconds = 0;
var url = BaseClass.BuildPDDObjString("product/get_product_list");
if (shop != null && shop.DbId.ParseToInt() != 0)
@@ -497,7 +497,7 @@ namespace TemuKJD.WXForms.ProductForms
// 采集来源判断
data += "&product_get_type=" + cmbSourceType.Text.Trim().Replace("已采集数据", "1688外部数据")
.Replace("多多商品", "机会商品,多多外部数据").Replace("1688商品", "1688厂家,1688外部数据").Replace("微信商品", "微信店采,微信外部数据");
}
}
if (shop != null && !string.IsNullOrEmpty(shop.ShopId))
{
@@ -1217,14 +1217,17 @@ namespace TemuKJD.WXForms.ProductForms
var filePathLst = openFileDialog.FileNames.ToList();
int successNum = 0;
int failedNum = 0;
var pddtoWxFactory = new PDDProdFormConverter();
foreach (var filePath in filePathLst)
{
string sourceContent = "";
string content = "";
string rst = "商品未识别";
int day = txt_listing_time.Text.ParseToInt(0) * -1;
try
{
rst = new PDDProdFormConverter().PddFrontToPddBackConvertFactory(filePath, true, null, true);
rst = pddtoWxFactory.PddFrontToPddBackConvertFactory(filePath, true, null, true, listingTime: DateTime.Now.AddDays(day));
}
catch (Exception ex)
{
@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="colSelect.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>