上货商品不存在不提示且上传停止问题修复
This commit is contained in:
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.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TemuKJD.BaseForms;
|
using TemuKJD.BaseForms;
|
||||||
@@ -17,97 +18,105 @@ using TemuKJD.ToolForms;
|
|||||||
|
|
||||||
namespace TemuKJD.PDDForms.ProductSelectForms
|
namespace TemuKJD.PDDForms.ProductSelectForms
|
||||||
{
|
{
|
||||||
public partial class PDDDBProdUploadSelectCacheForm : BaseGeneralForm
|
public partial class PDDDBProdUploadSelectCacheForm : BaseGeneralForm
|
||||||
{
|
{
|
||||||
NaiBa.Util.ConcurrentList<TemuDBProductSelect> lstTemuDBProductSelect;
|
NaiBa.Util.ConcurrentList<TemuDBProductSelect> lstTemuDBProductSelect;
|
||||||
public PDDDBProdUploadSelectCacheForm(NaiBa.Util.ConcurrentList<TemuDBProductSelect> _lstTemuDBProductSelect)
|
public PDDDBProdUploadSelectCacheForm(NaiBa.Util.ConcurrentList<TemuDBProductSelect> _lstTemuDBProductSelect)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
lstTemuDBProductSelect = _lstTemuDBProductSelect;
|
lstTemuDBProductSelect = _lstTemuDBProductSelect;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PDDDBProdUserSelectCacheForm_Load(object sender, EventArgs e)
|
private async void PDDDBProdUserSelectCacheForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (BaseClass.UserName == "15288888888")
|
if (BaseClass.UserName == "15288888888")
|
||||||
{
|
{
|
||||||
dgvSelectProduct.Columns["colGetType"].Visible = true;
|
dgvSelectProduct.Columns["colGetType"].Visible = true;
|
||||||
dgvSelectProduct.Columns["colDbType"].Visible = true;
|
dgvSelectProduct.Columns["colDbType"].Visible = true;
|
||||||
}
|
}
|
||||||
if (BaseClass.MainPath == "29pdd")
|
if (BaseClass.MainPath == "29pdd")
|
||||||
{
|
{
|
||||||
dgvSelectProduct.Columns["colBound"].Visible = false;
|
dgvSelectProduct.Columns["colBound"].Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dgvSelectProduct.AddSelectorColumn("colCheck");
|
dgvSelectProduct.AddSelectorColumn("colCheck");
|
||||||
dgvSelectProduct.AddImgColumn("colProductSkcPic", "colImgUrl");
|
dgvSelectProduct.AddImgColumn("colProductSkcPic", "colImgUrl");
|
||||||
|
|
||||||
if (lstTemuDBProductSelect != null && lstTemuDBProductSelect.Count > 0)
|
if (lstTemuDBProductSelect != null && lstTemuDBProductSelect.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (var prodSelect in lstTemuDBProductSelect)
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
var catBound = GlobalConfig.WxCatBoundList.FirstOrDefault(b => b.leaf_id.ParseToString() == prodSelect.wx_cat_leaf);
|
foreach (var prodSelect in lstTemuDBProductSelect)
|
||||||
int rowIndex = this.dgvSelectProduct.Rows.Add(
|
{
|
||||||
false,
|
if (lstTemuDBProductSelect.IndexOf(prodSelect) % 1000 == 0)
|
||||||
prodSelect.id,
|
Thread.Sleep(1);
|
||||||
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;
|
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)
|
private void dgvSelectProduct_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
||||||
return;
|
return;
|
||||||
string headerText = dgvSelectProduct.Columns[e.ColumnIndex].HeaderText;
|
string headerText = dgvSelectProduct.Columns[e.ColumnIndex].HeaderText;
|
||||||
var id = dgvSelectProduct.Rows[e.RowIndex].Cells["colId"].Value.ParseToString();
|
var id = dgvSelectProduct.Rows[e.RowIndex].Cells["colId"].Value.ParseToString();
|
||||||
var dbProduct = lstTemuDBProductSelect.FirstOrDefault(p => p.id.ToString() == id);
|
var dbProduct = lstTemuDBProductSelect.FirstOrDefault(p => p.id.ToString() == id);
|
||||||
var row = dgvSelectProduct.Rows[e.RowIndex];
|
var row = dgvSelectProduct.Rows[e.RowIndex];
|
||||||
|
|
||||||
switch (headerText)
|
switch (headerText)
|
||||||
{
|
{
|
||||||
case "删除":
|
case "删除":
|
||||||
if (BaseMsgForm.ShowConfirm("确定删除商品吗?删除后不可恢复!").DialogResult == DialogResult.Cancel)
|
if (BaseMsgForm.ShowConfirm("确定删除商品吗?删除后不可恢复!").DialogResult == DialogResult.Cancel)
|
||||||
return;
|
return;
|
||||||
lstTemuDBProductSelect.RemoveAll(s => s.id == row.Cells["colId"].Value.ParseToInt());
|
lstTemuDBProductSelect.RemoveAll(s => s.id == row.Cells["colId"].Value.ParseToInt());
|
||||||
this.dgvSelectProduct.Rows.Remove(row);
|
this.dgvSelectProduct.Rows.Remove(row);
|
||||||
break;
|
break;
|
||||||
case "图片":
|
case "图片":
|
||||||
ShowImgForm imgFrom = new ShowImgForm(dgvSelectProduct.Rows[e.RowIndex].Cells["colImgUrl"].Value.ParseToString());
|
ShowImgForm imgFrom = new ShowImgForm(dgvSelectProduct.Rows[e.RowIndex].Cells["colImgUrl"].Value.ParseToString());
|
||||||
imgFrom.ShowDialog();
|
imgFrom.ShowDialog();
|
||||||
break;
|
break;
|
||||||
case "":
|
case "":
|
||||||
dgvSelectProduct.Rows[e.RowIndex].Cells["colCheck"].Value = !(bool)dgvSelectProduct.Rows[e.RowIndex].Cells["colCheck"].Value;
|
dgvSelectProduct.Rows[e.RowIndex].Cells["colCheck"].Value = !(bool)dgvSelectProduct.Rows[e.RowIndex].Cells["colCheck"].Value;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnClearDgv_Click(object sender, EventArgs e)
|
private void btnClearDgv_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var rows = this.dgvSelectProduct.Rows.Cast<DataGridViewRow>().ToList(); //Cast后Rows做foreach循环时仍会夹花跳过,所以要ToList转一个新的数组。
|
var rows = this.dgvSelectProduct.Rows.Cast<DataGridViewRow>().ToList(); //Cast后Rows做foreach循环时仍会夹花跳过,所以要ToList转一个新的数组。
|
||||||
foreach (var row in rows)
|
foreach (var row in rows)
|
||||||
{
|
{
|
||||||
if (row.Cells["colCheck"].Value.ParseToBool() == true)
|
if (row.Cells["colCheck"].Value.ParseToBool() == true)
|
||||||
{
|
{
|
||||||
lstTemuDBProductSelect.RemoveAll(s => s.id == row.Cells["colId"].Value.ParseToInt());
|
lstTemuDBProductSelect.RemoveAll(s => s.id == row.Cells["colId"].Value.ParseToInt());
|
||||||
this.dgvSelectProduct.Rows.Remove(row);
|
this.dgvSelectProduct.Rows.Remove(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1144,7 +1144,7 @@ namespace TemuKJD.WXForms.ProductForms
|
|||||||
Invoke(new Action(() =>
|
Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
this.pbLoading.Visible = true;
|
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.pgbTaskProgress.Maximum = rowLst.Count;
|
||||||
this.statusBar.UpdateProgressBar(0);
|
this.statusBar.UpdateProgressBar(0);
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -1300,7 +1300,8 @@ namespace TemuKJD.WXForms.ProductForms
|
|||||||
kjdDbProd = GetCloudProductDetail(selectProd, out errStr, true, true);
|
kjdDbProd = GetCloudProductDetail(selectProd, out errStr, true, true);
|
||||||
else
|
else
|
||||||
kjdDbProd = GetProductDetail(selectProd.out_product_Id.ToString(), out errStr, true, true);
|
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)
|
if (kjdDbProd == null || kjdDbProd.id == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user