优化类目识别图片保存失败问题
This commit is contained in:
1 parent
c75a49a0b1
commit
1b79fe7ffa
4 files changed
+135
-9
No files matched your search
@@ -51,6 +51,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.ucTabControlMetro1 = new TemuKJD.UserControls.UcTabControlMetro();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.plRealDel = new DevComponents.DotNetBar.PanelEx();
|
||||
this.btnUpdateSaleCountNum = new DevComponents.DotNetBar.PanelEx();
|
||||
this.chkGetSaleCountLess0 = new TemuKJD.UserComponent.UcCheckBox(this.components);
|
||||
this.btnEditGroup = new DevComponents.DotNetBar.PanelEx();
|
||||
@@ -61,6 +62,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.cmbGroup = new System.Windows.Forms.ComboBox();
|
||||
this.cmbSetWxSafe = new System.Windows.Forms.ComboBox();
|
||||
this.btnSetWxSafe = new DevComponents.DotNetBar.PanelEx();
|
||||
this.chkShowDelProd = new TemuKJD.UserComponent.UcCheckBox(this.components);
|
||||
this.tabPage4 = new System.Windows.Forms.TabPage();
|
||||
this.btnOutProdSaveDb = new DevComponents.DotNetBar.PanelEx();
|
||||
this.btnImport = new DevComponents.DotNetBar.PanelEx();
|
||||
@@ -181,6 +183,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.colWxSafe = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colAddTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colMdyTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colDelStatus = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.col_edit = new System.Windows.Forms.DataGridViewLinkColumn();
|
||||
this.col_delete = new System.Windows.Forms.DataGridViewLinkColumn();
|
||||
this.col_select_product = new System.Windows.Forms.DataGridViewLinkColumn();
|
||||
@@ -258,6 +261,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
this.tabPage1.Controls.Add(this.plRealDel);
|
||||
this.tabPage1.Controls.Add(this.btnUpdateSaleCountNum);
|
||||
this.tabPage1.Controls.Add(this.chkGetSaleCountLess0);
|
||||
this.tabPage1.Controls.Add(this.btnEditGroup);
|
||||
@@ -268,6 +272,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.tabPage1.Controls.Add(this.cmbGroup);
|
||||
this.tabPage1.Controls.Add(this.cmbSetWxSafe);
|
||||
this.tabPage1.Controls.Add(this.btnSetWxSafe);
|
||||
this.tabPage1.Controls.Add(this.chkShowDelProd);
|
||||
this.tabPage1.Location = new System.Drawing.Point(4, 26);
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
|
||||
@@ -276,6 +281,32 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.tabPage1.Text = "数据操作";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// plRealDel
|
||||
//
|
||||
this.plRealDel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.plRealDel.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.plRealDel.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.plRealDel.DisabledBackColor = System.Drawing.Color.Empty;
|
||||
this.plRealDel.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.plRealDel.Location = new System.Drawing.Point(271, 97);
|
||||
this.plRealDel.Name = "plRealDel";
|
||||
this.plRealDel.Size = new System.Drawing.Size(130, 25);
|
||||
this.plRealDel.Style.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.plRealDel.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.plRealDel.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.plRealDel.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
|
||||
this.plRealDel.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
|
||||
this.plRealDel.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
|
||||
this.plRealDel.Style.ForeColor.Color = System.Drawing.Color.White;
|
||||
this.plRealDel.Style.GradientAngle = 90;
|
||||
this.plRealDel.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.plRealDel.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.plRealDel.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.plRealDel.TabIndex = 1024;
|
||||
this.plRealDel.Text = "彻底删除已删除商品";
|
||||
this.plRealDel.Visible = false;
|
||||
this.plRealDel.Click += new System.EventHandler(this.pnlRealDel_Click);
|
||||
//
|
||||
// btnUpdateSaleCountNum
|
||||
//
|
||||
this.btnUpdateSaleCountNum.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
@@ -486,6 +517,19 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.btnSetWxSafe.Text = "设置微信安检";
|
||||
this.btnSetWxSafe.Click += new System.EventHandler(this.btnSetWxSafe_Click);
|
||||
//
|
||||
// chkShowDelProd
|
||||
//
|
||||
this.chkShowDelProd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.chkShowDelProd.AutoSize = true;
|
||||
this.chkShowDelProd.Location = new System.Drawing.Point(189, 99);
|
||||
this.chkShowDelProd.Name = "chkShowDelProd";
|
||||
this.chkShowDelProd.Size = new System.Drawing.Size(87, 21);
|
||||
this.chkShowDelProd.TabIndex = 1020;
|
||||
this.chkShowDelProd.Text = "已删除数据";
|
||||
this.chkShowDelProd.UseVisualStyleBackColor = true;
|
||||
this.chkShowDelProd.Visible = false;
|
||||
this.chkShowDelProd.CheckedChanged += new System.EventHandler(this.chkShowDelProd_CheckedChanged);
|
||||
//
|
||||
// tabPage4
|
||||
//
|
||||
this.tabPage4.Controls.Add(this.btnOutProdSaveDb);
|
||||
@@ -1860,6 +1904,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.colWxSafe,
|
||||
this.colAddTime,
|
||||
this.colMdyTime,
|
||||
this.colDelStatus,
|
||||
this.col_edit,
|
||||
this.col_delete,
|
||||
this.col_select_product});
|
||||
@@ -2056,14 +2101,14 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
//
|
||||
// colSaleCount
|
||||
//
|
||||
this.colSaleCount.FillWeight = 60F;
|
||||
this.colSaleCount.FillWeight = 50F;
|
||||
this.colSaleCount.HeaderText = "销量";
|
||||
this.colSaleCount.Name = "colSaleCount";
|
||||
this.colSaleCount.ReadOnly = true;
|
||||
//
|
||||
// colSaleCountNum
|
||||
//
|
||||
this.colSaleCountNum.FillWeight = 60F;
|
||||
this.colSaleCountNum.FillWeight = 50F;
|
||||
this.colSaleCountNum.HeaderText = "销量数";
|
||||
this.colSaleCountNum.Name = "colSaleCountNum";
|
||||
this.colSaleCountNum.ReadOnly = true;
|
||||
@@ -2144,6 +2189,14 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.colMdyTime.Name = "colMdyTime";
|
||||
this.colMdyTime.ReadOnly = true;
|
||||
//
|
||||
// colDelStatus
|
||||
//
|
||||
this.colDelStatus.FillWeight = 50F;
|
||||
this.colDelStatus.HeaderText = "已删除";
|
||||
this.colDelStatus.Name = "colDelStatus";
|
||||
this.colDelStatus.ReadOnly = true;
|
||||
this.colDelStatus.Visible = false;
|
||||
//
|
||||
// col_edit
|
||||
//
|
||||
this.col_edit.FillWeight = 40F;
|
||||
@@ -2217,6 +2270,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.ucTabControlMetro1.ResumeLayout(false);
|
||||
this.tabPage1.ResumeLayout(false);
|
||||
this.tabPage1.PerformLayout();
|
||||
this.tabPage4.ResumeLayout(false);
|
||||
this.tabPage3.ResumeLayout(false);
|
||||
this.tabPage3.PerformLayout();
|
||||
@@ -2344,6 +2398,10 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
private System.Windows.Forms.ComboBox cmbTime;
|
||||
private DevComponents.DotNetBar.PanelEx btnUpdateSaleCountNum;
|
||||
private UserComponent.UcCheckBox chkGetSaleCountLess0;
|
||||
private System.Windows.Forms.NumericUpDown numFilterSaleCountNum;
|
||||
private UserComponent.UcCheckBox chkFilterSaleCountNum;
|
||||
private System.Windows.Forms.NumericUpDown numFilterViewUv;
|
||||
private UserComponent.UcCheckBox chkShowDelProd;
|
||||
private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn col_db_id;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colFromShopId;
|
||||
@@ -2377,11 +2435,10 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colWxSafe;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colAddTime;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colMdyTime;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colDelStatus;
|
||||
private System.Windows.Forms.DataGridViewLinkColumn col_edit;
|
||||
private System.Windows.Forms.DataGridViewLinkColumn col_delete;
|
||||
private System.Windows.Forms.DataGridViewLinkColumn col_select_product;
|
||||
private System.Windows.Forms.NumericUpDown numFilterSaleCountNum;
|
||||
private UserComponent.UcCheckBox chkFilterSaleCountNum;
|
||||
private System.Windows.Forms.NumericUpDown numFilterViewUv;
|
||||
private DevComponents.DotNetBar.PanelEx plRealDel;
|
||||
}
|
||||
}
|
||||
@@ -137,6 +137,12 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
WXDBProdUploadForm.lstWXShopTokenInfo = NaiBa.Util.Helper.ConfigHelper.LoadConfig<NaiBa.Util.ConcurrentList<WXShopTokenInfo>>("wx_shop_token_list");
|
||||
if (WXDBProdUploadForm.lstWXShopTokenInfo == null)
|
||||
WXDBProdUploadForm.lstWXShopTokenInfo = new ConcurrentList<WXShopTokenInfo>();
|
||||
|
||||
if (BaseClass.UserName == "15288888888")
|
||||
{
|
||||
chkShowDelProd.Visible = true;
|
||||
plRealDel.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnSearch_Click(object sender, EventArgs e)
|
||||
@@ -262,6 +268,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
prod.wx_safe_status,
|
||||
prod.add_time.ToString("yy-MM-dd HH:mm"),
|
||||
prod.mdy_time.ToString("yy-MM-dd HH:mm"),
|
||||
prod.is_del == 1 ? "是" : "否",
|
||||
"编辑",
|
||||
"删除",
|
||||
"认领");
|
||||
@@ -488,6 +495,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
|
||||
if (chkGetSaleCountLess0.Checked)
|
||||
data += "&sale_count_num_less=-1";
|
||||
if (chkShowDelProd.Checked)
|
||||
data += "&is_del=1";
|
||||
}));
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
@@ -726,11 +735,11 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteProduct(string dbId, bool isUpdate = true)
|
||||
private void DeleteProduct(string dbId, bool isRealDel = false, bool isUpdate = true)
|
||||
{
|
||||
var url = BaseClass.BuildPDDObjString("product/del_db_product");
|
||||
var data = UserLogin.GetSignaturex() +
|
||||
"&db_id=" + dbId;
|
||||
"&db_id=" + dbId + "&is_real_del=" + isRealDel;
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
@@ -768,7 +777,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
{
|
||||
foreach (var prod in prodList)
|
||||
{
|
||||
DeleteProduct(prod.id.ToString(), false);
|
||||
DeleteProduct(prod.id.ToString(), false, false);
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
@@ -2837,5 +2846,45 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
|
||||
SearchDbProd(this.ucSplitPage1.CurrentPage);
|
||||
}
|
||||
|
||||
private void pnlRealDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
var lstProdId = dgvDbProduct.Rows.Cast<DataGridViewRow>().Where(row
|
||||
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["col_spu_id"]?.Value.ToString()).ToList();
|
||||
var prodList = this.lstTemuDbProduct.Where(p => lstProdId.Contains(p.spu_id)).ToArray();
|
||||
|
||||
if (BaseMsgForm.ShowConfirm("确定删除商品吗?删除后不可恢复!").DialogResult == DialogResult.Cancel)
|
||||
return;
|
||||
this.pbLoading.Visible = true;
|
||||
this.statusBar.pgbTaskProgress.Maximum = lstProdId.Count;
|
||||
this.statusBar.UpdateProgressBar(0);
|
||||
Task.Run(() =>
|
||||
{
|
||||
foreach (var prod in prodList)
|
||||
{
|
||||
if (prod.is_del > 0)
|
||||
{
|
||||
DeleteProduct(prod.id.ToString(), prod.is_del > 0, false);
|
||||
}
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1);
|
||||
this.statusBar.lblTaskStatus.Text = "正在彻底删除(跳过未删除) " + this.statusBar.pgbTaskProgress.Value + "/" + lstProdId.Count;
|
||||
}));
|
||||
}
|
||||
SearchDbProd(this.ucSplitPage1.CurrentPage);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
pbLoading.Visible = false;
|
||||
BaseMsgForm.ShowInfo("彻底删除(跳过未删除)完成!");
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
private void chkShowDelProd_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
dgvDbProduct.Columns["colDelStatus"].Visible = chkShowDelProd.Checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -216,6 +216,9 @@
|
||||
<metadata name="colMdyTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colDelStatus.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="col_edit.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
||||
@@ -2677,7 +2677,24 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
string imgFullPath = tempImgPath + "\\图片" + imgId + ".jpg";
|
||||
tempImgFullPathLst.Add(imgFullPath);
|
||||
if (imgId == 1)
|
||||
image.Save(imgFullPath, System.Drawing.Imaging.ImageFormat.Jpeg);
|
||||
{
|
||||
try
|
||||
{
|
||||
image.Save(imgFullPath, System.Drawing.Imaging.ImageFormat.Jpeg);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 只需要传一张真实图像即可
|
||||
int fileSize = Randomx.GetId(1024, 10240);
|
||||
using (BinaryWriter writer = new BinaryWriter(File.Create(imgFullPath)))
|
||||
{
|
||||
for (int i = 0; i < fileSize; i++)
|
||||
{
|
||||
writer.Write((byte)Randomx.GetId(256)); // 生成0到255之间的随机字节
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 只需要传一张真实图像即可
|
||||
|
||||
Reference in new issue
Block a user