上货商品不存在不提示且上传停止问题修复

This commit is contained in:
wule committed 2026-10-28 15:22:41 +08:00
1 parent 1ab0fc96ac
commit 652fcd1336
3 files changed
+97 -87

No files matched your search

@@ -9,6 +9,7 @@ using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TemuKJD.BaseForms;
@@ -17,97 +18,105 @@ using TemuKJD.ToolForms;
namespace TemuKJD.PDDForms.ProductSelectForms
{
public partial class PDDDBProdUploadSelectCacheForm : BaseGeneralForm
{
NaiBa.Util.ConcurrentList<TemuDBProductSelect> lstTemuDBProductSelect;
public PDDDBProdUploadSelectCacheForm(NaiBa.Util.ConcurrentList<TemuDBProductSelect> _lstTemuDBProductSelect)
{
InitializeComponent();
public partial class PDDDBProdUploadSelectCacheForm : BaseGeneralForm
{
NaiBa.Util.ConcurrentList<TemuDBProductSelect> lstTemuDBProductSelect;
public PDDDBProdUploadSelectCacheForm(NaiBa.Util.ConcurrentList<TemuDBProductSelect> _lstTemuDBProductSelect)
{
InitializeComponent();
lstTemuDBProductSelect = _lstTemuDBProductSelect;
}
lstTemuDBProductSelect = _lstTemuDBProductSelect;
}
private void PDDDBProdUserSelectCacheForm_Load(object sender, EventArgs e)
{
if (BaseClass.UserName == "15288888888")
{
dgvSelectProduct.Columns["colGetType"].Visible = true;
dgvSelectProduct.Columns["colDbType"].Visible = true;
}
if (BaseClass.MainPath == "29pdd")
{
dgvSelectProduct.Columns["colBound"].Visible = false;
}
private async void PDDDBProdUserSelectCacheForm_Load(object sender, EventArgs e)
{
if (BaseClass.UserName == "15288888888")
{
dgvSelectProduct.Columns["colGetType"].Visible = true;
dgvSelectProduct.Columns["colDbType"].Visible = true;
}
if (BaseClass.MainPath == "29pdd")
{
dgvSelectProduct.Columns["colBound"].Visible = false;
}
dgvSelectProduct.AddSelectorColumn("colCheck");
dgvSelectProduct.AddImgColumn("colProductSkcPic", "colImgUrl");
dgvSelectProduct.AddSelectorColumn("colCheck");
dgvSelectProduct.AddImgColumn("colProductSkcPic", "colImgUrl");
if (lstTemuDBProductSelect != null && lstTemuDBProductSelect.Count > 0)
{
foreach (var prodSelect in lstTemuDBProductSelect)
{
var catBound = GlobalConfig.WxCatBoundList.FirstOrDefault(b => b.leaf_id.ParseToString() == prodSelect.wx_cat_leaf);
int rowIndex = this.dgvSelectProduct.Rows.Add(
false,
prodSelect.id,
prodSelect.product_get_type_text,
prodSelect.db_type,
BaseClass.SaLevel > 0 ? prodSelect.spu_id : prodSelect.spu_id.ParseToString().GetHashCode().ParseToString().Trim('-'),
prodSelect.main_img,
DataGridViewExtension.defaultBitmap,
prodSelect.product_name, // 商品名称
prodSelect.cat_name,
catBound?.cat_bound,
BaseClass.SaLevel > 0 ? prodSelect.spu_id : prodSelect.ext_code.ParseToString().GetHashCode().ParseToString().Trim('-'),
prodSelect.notes,
"删除"
);
if (lstTemuDBProductSelect != null && lstTemuDBProductSelect.Count > 0)
{
await Task.Run(() =>
{
foreach (var prodSelect in lstTemuDBProductSelect)
{
if (lstTemuDBProductSelect.IndexOf(prodSelect) % 1000 == 0)
Thread.Sleep(1);
dgvSelectProduct.Rows[rowIndex].Height = 60;
}
}
}
var catBound = GlobalConfig.WxCatBoundList.FirstOrDefault(b => b.leaf_id.ParseToString() == prodSelect.wx_cat_leaf);
Invoke(new Action(() =>
{
int rowIndex = this.dgvSelectProduct.Rows.Add(
false,
prodSelect.id,
prodSelect.product_get_type_text,
prodSelect.db_type,
BaseClass.SaLevel > 0 ? prodSelect.spu_id : prodSelect.spu_id.ParseToString().GetHashCode().ParseToString().Trim('-'),
prodSelect.main_img,
DataGridViewExtension.defaultBitmap,
prodSelect.product_name, // 商品名称
prodSelect.cat_name,
catBound?.cat_bound,
BaseClass.SaLevel > 0 ? prodSelect.spu_id : prodSelect.ext_code.ParseToString().GetHashCode().ParseToString().Trim('-'),
prodSelect.notes,
"删除"
);
dgvSelectProduct.Rows[rowIndex].Height = 60;
}));
}
});
}
}
private void dgvSelectProduct_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex < 0 || e.RowIndex < 0)
return;
string headerText = dgvSelectProduct.Columns[e.ColumnIndex].HeaderText;
var id = dgvSelectProduct.Rows[e.RowIndex].Cells["colId"].Value.ParseToString();
var dbProduct = lstTemuDBProductSelect.FirstOrDefault(p => p.id.ToString() == id);
var row = dgvSelectProduct.Rows[e.RowIndex];
private void dgvSelectProduct_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex < 0 || e.RowIndex < 0)
return;
string headerText = dgvSelectProduct.Columns[e.ColumnIndex].HeaderText;
var id = dgvSelectProduct.Rows[e.RowIndex].Cells["colId"].Value.ParseToString();
var dbProduct = lstTemuDBProductSelect.FirstOrDefault(p => p.id.ToString() == id);
var row = dgvSelectProduct.Rows[e.RowIndex];
switch (headerText)
{
case "删除":
if (BaseMsgForm.ShowConfirm("确定删除商品吗?删除后不可恢复!").DialogResult == DialogResult.Cancel)
return;
lstTemuDBProductSelect.RemoveAll(s => s.id == row.Cells["colId"].Value.ParseToInt());
this.dgvSelectProduct.Rows.Remove(row);
break;
case "图片":
ShowImgForm imgFrom = new ShowImgForm(dgvSelectProduct.Rows[e.RowIndex].Cells["colImgUrl"].Value.ParseToString());
imgFrom.ShowDialog();
break;
case "":
dgvSelectProduct.Rows[e.RowIndex].Cells["colCheck"].Value = !(bool)dgvSelectProduct.Rows[e.RowIndex].Cells["colCheck"].Value;
break;
default:
break;
}
}
switch (headerText)
{
case "删除":
if (BaseMsgForm.ShowConfirm("确定删除商品吗?删除后不可恢复!").DialogResult == DialogResult.Cancel)
return;
lstTemuDBProductSelect.RemoveAll(s => s.id == row.Cells["colId"].Value.ParseToInt());
this.dgvSelectProduct.Rows.Remove(row);
break;
case "图片":
ShowImgForm imgFrom = new ShowImgForm(dgvSelectProduct.Rows[e.RowIndex].Cells["colImgUrl"].Value.ParseToString());
imgFrom.ShowDialog();
break;
case "":
dgvSelectProduct.Rows[e.RowIndex].Cells["colCheck"].Value = !(bool)dgvSelectProduct.Rows[e.RowIndex].Cells["colCheck"].Value;
break;
default:
break;
}
}
private void btnClearDgv_Click(object sender, EventArgs e)
{
var rows = this.dgvSelectProduct.Rows.Cast<DataGridViewRow>().ToList(); //Cast后Rows做foreach循环时仍会夹花跳过,所以要ToList转一个新的数组。
foreach (var row in rows)
{
if (row.Cells["colCheck"].Value.ParseToBool() == true)
{
lstTemuDBProductSelect.RemoveAll(s => s.id == row.Cells["colId"].Value.ParseToInt());
this.dgvSelectProduct.Rows.Remove(row);
}
}
}
}
private void btnClearDgv_Click(object sender, EventArgs e)
{
var rows = this.dgvSelectProduct.Rows.Cast<DataGridViewRow>().ToList(); //Cast后Rows做foreach循环时仍会夹花跳过,所以要ToList转一个新的数组。
foreach (var row in rows)
{
if (row.Cells["colCheck"].Value.ParseToBool() == true)
{
lstTemuDBProductSelect.RemoveAll(s => s.id == row.Cells["colId"].Value.ParseToInt());
this.dgvSelectProduct.Rows.Remove(row);
}
}
}
}
}
@@ -1144,7 +1144,7 @@ namespace TemuKJD.WXForms.ProductForms
Invoke(new Action(() =>
{
this.pbLoading.Visible = true;
this.statusBar.lblTaskStatus.Text = "正在报名活动" + "...".Substring(0, DateTime.Now.Second % 4);
this.statusBar.lblTaskStatus.Text = "正在取消报名活动" + "...".Substring(0, DateTime.Now.Second % 4);
this.statusBar.pgbTaskProgress.Maximum = rowLst.Count;
this.statusBar.UpdateProgressBar(0);
}));
@@ -1300,7 +1300,8 @@ namespace TemuKJD.WXForms.ProductForms
kjdDbProd = GetCloudProductDetail(selectProd, out errStr, true, true);
else
kjdDbProd = GetProductDetail(selectProd.out_product_Id.ToString(), out errStr, true, true);
kjdDbProd.db_type = selectProd.db_type;
if (kjdDbProd != null)
kjdDbProd.db_type = selectProd?.db_type;
}
if (kjdDbProd == null || kjdDbProd.id == 0)
{