1优化商品核价相关功能 2店铺工作数据统计功能

This commit is contained in:
wule committed 2025-08-27 19:08:30 +08:00
1 parent c70b78aff3
commit 6b6d63dd41
11 files changed
+775 -313

No files matched your search

@@ -1,7 +1,6 @@
using AllBase;
using AllBase.Model.Result;
using NaiBa.Util.Extension;
using NaiBa.Util.Winform.Extension;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
@@ -13,6 +12,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TemuKJD.Extension;
using TemuKJD.KJDForms.BaseForms;
using TemuKJD.KJDForms.ShopForms;
using TemuKJD.KJDForms.ToolForms;
@@ -293,9 +293,9 @@ namespace TemuKJD.KJDForms.AdminForms
ShowImgForm imgFrom = new ShowImgForm(url);
imgFrom.ShowDialog();
break;
case "":
dgvPriceCheck.Rows[e.RowIndex].Cells["colCheck"].Value = !(bool)dgvPriceCheck.Rows[e.RowIndex].Cells["colCheck"].Value;
break;
//case "":
// dgvPriceCheck.Rows[e.RowIndex].Cells["colCheck"].Value = !(bool)dgvPriceCheck.Rows[e.RowIndex].Cells["colCheck"].Value;
// break;
default:
break;
}
@@ -460,8 +460,8 @@ namespace TemuKJD.KJDForms.AdminForms
{
if (rst.Contains("\"success\":true"))
{
row.Cells["colMsg"].Value = "已作废商品-价格0.01";
row.Cells["colNewPrice"].Value = 1 / 100.0;
row.Cells["colMsg"].Value = "已作废商品-价格0.1";
row.Cells["colNewPrice"].Value = 10 / 100.0;
}
else
row.Cells["colMsg"].Value = "作废商品失败" + rst;
@@ -495,7 +495,7 @@ namespace TemuKJD.KJDForms.AdminForms
{
this.pnlDetailOperate1.Visible = true;
this.pnlDetailOperate2.Visible = false;
this.dgvPriceCheck.Columns["colOk"].Visible = false;
this.dgvPriceCheck.Columns["colOk"].Visible = true;
this.dgvPriceCheck.Columns["colCancel"].Visible = true;
this.dgvPriceCheck.Columns["colCancelWithTitleWrong"].Visible = false;
SearchPrice("待卖家确认");
@@ -515,7 +515,7 @@ namespace TemuKJD.KJDForms.AdminForms
private void SearchPrice(string type = "待卖家确认")
{
var selectShopIdLst = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colSelect"].Value.ParseToBool() == true)
.Select(r => r.Cells["colShopId"].Value.ParseToString()).ToList();
.Select(r => r.Cells["colShopId"].Value.ParseToString()).Distinct().ToList();
var shops = this.lstAdminShopInfo.Where(s => selectShopIdLst.Contains(s.ShopId)).ToList();
if (shops.Count == 0)
{
@@ -531,14 +531,18 @@ namespace TemuKJD.KJDForms.AdminForms
}
}
this.chkFilter.Checked = false;
this.dgvPriceCheck.Rows.Clear();
this.lstCheckPriceInfo.Clear();
this.pbLoading.Visible = true;
cancellationTokenSource = new CancellationTokenSource();
Task.Run(() =>
{
int shopIndex = 0;
int totalProdIndex = 0;
foreach (var shopId in selectShopIdLst)
{
shopIndex++;
var shop = this.lstAdminShopInfo.Where(s => shopId == s.ShopId).ToList().FirstOrDefault();
if (shop == null)
continue;
@@ -607,11 +611,15 @@ namespace TemuKJD.KJDForms.AdminForms
}
foreach (var priceInfo in checkPriceInfoTmpLst)
{
if (cancellationTokenSource.IsCancellationRequested)
break;
prodIndex++;
totalProdIndex++;
Invoke(new Action(() => {
this.statusBar.lblTaskStatus.Text = "正在查询" + type + ",共有 " + total + " 件商品";
this.statusBar.pgbTaskProgress.Maximum = total;
this.statusBar.UpdateProgressBar(prodIndex);
this.statusBar.lblTaskStatus.Text = "正在查询" + type + ",店铺:" + shop.ShopAccount + " " + prodIndex + "/" + total + " 件商品";
this.statusBar.pgbTaskProgress.Maximum = selectShopIdLst.Count;
this.statusBar.UpdateProgressBar(shopIndex);
}));
string imgUrl = priceInfo.skcList.FirstOrDefault()?.previewImgUrlList.FirstOrDefault();
@@ -637,9 +645,9 @@ namespace TemuKJD.KJDForms.AdminForms
{
foreach (var prop in sku.productPropertyList)
{
skuName += prop.value + ";";
skuName += prop.value + ",";
}
//skuName = skuName.TrimEnd(';');
skuName = skuName.TrimEnd(',') + ";";
skuName += "\r\n";
}
}
@@ -669,7 +677,7 @@ namespace TemuKJD.KJDForms.AdminForms
{
int rowId = this.dgvPriceCheck.Rows.Add(
false,
prodIndex,
totalProdIndex,
reviewInfo.priceOrderId,
priceInfo.supplierId,
priceInfo.supplierName,
@@ -693,6 +701,10 @@ namespace TemuKJD.KJDForms.AdminForms
""
);
dgvPriceCheck.Rows[rowId].Height = 60;
if (chkFilter.Checked && !CheckContainsWords(priceInfo.productName))
{
dgvPriceCheck.Rows[rowId].Visible = false;
}
}));
}
this.ShowDgvImg();
@@ -868,6 +880,7 @@ namespace TemuKJD.KJDForms.AdminForms
return;
}
this.statusBar.lblTaskStatus.Text = "正在批量还原标题";
this.pbLoading.Visible = true;
Task.Run(() =>
{
@@ -890,8 +903,7 @@ namespace TemuKJD.KJDForms.AdminForms
}
var pName = price.productName;
if ((pName.EndsWith("适合不同的搭配风格") && pName.IndexOf("个") < 4 && pName.IndexOf("个") > 0) ||
(pName.EndsWith("适合不同的搭配风格") && pName.IndexOf("pcs") < 4 && pName.IndexOf("pcs") > 0))
if (CheckContainsWords(pName))
{
}
else
@@ -942,19 +954,8 @@ namespace TemuKJD.KJDForms.AdminForms
JObject jObj = JObject.Parse(html);
var item = jObj["result"]["successBizId2TaskUidMap"].LastOrDefault().LastOrDefault();
var newPName = pName;
if (pName.EndsWith("适合不同的搭配风格") && pName.IndexOf("个") < 4 && pName.IndexOf("个") > 0)
{
var headword = pName.Substring(0, pName.IndexOf("个") + 1);
newPName = pName.Substring(pName.IndexOf("个") + "个".Length);
newPName = newPName.Replace("适合不同的搭配风格", "适合" + headword + "不同的搭配风格");
}
if (pName.EndsWith("适合不同的搭配风格") && pName.IndexOf("pcs") < 4 && pName.IndexOf("pcs") >0)
{
var headword = pName.Substring(0, pName.IndexOf("pcs"));
newPName = pName.Substring(pName.IndexOf("pcs") + "pcs".Length);
newPName = newPName.Replace("适合不同的搭配风格", "适合" + headword + "个不同的搭配风格").Trim();
}
// 还原原始标题
var newPName = RestoreProductName(pName);
html = editPriceProductName(shop, item.ParseToString(), price.productId.ParseToString(), newPName);
Thread.Sleep(Randomx.GetId(25, 75));
@@ -1002,6 +1003,7 @@ namespace TemuKJD.KJDForms.AdminForms
Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "批量还原标题完成";
this.pbLoading.Visible = false;
}));
});
@@ -1016,6 +1018,7 @@ namespace TemuKJD.KJDForms.AdminForms
return;
}
this.statusBar.lblTaskStatus.Text = "正在批量再次报价";
this.pbLoading.Visible = true;
Task.Run(() =>
{
@@ -1031,6 +1034,7 @@ namespace TemuKJD.KJDForms.AdminForms
Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "批量再次报价完成";
this.pbLoading.Visible = false;
}));
});
@@ -1045,6 +1049,7 @@ namespace TemuKJD.KJDForms.AdminForms
return;
}
this.statusBar.lblTaskStatus.Text = "正在批量同意报价";
this.pbLoading.Visible = true;
Task.Run(() =>
{
@@ -1060,6 +1065,7 @@ namespace TemuKJD.KJDForms.AdminForms
Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "批量同意报价完成";
this.pbLoading.Visible = false;
}));
});
@@ -1074,6 +1080,7 @@ namespace TemuKJD.KJDForms.AdminForms
return;
}
this.statusBar.lblTaskStatus.Text = "正在批量拒绝报价";
this.pbLoading.Visible = true;
Task.Run(() =>
{
@@ -1089,6 +1096,7 @@ namespace TemuKJD.KJDForms.AdminForms
Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "批量拒绝报价完成";
this.pbLoading.Visible = false;
}));
});
@@ -1143,6 +1151,7 @@ namespace TemuKJD.KJDForms.AdminForms
}
var productIds = rows.Select(r => r.Cells["colProductId"].Value.ParseToString()).Distinct().ToList();
this.statusBar.lblTaskStatus.Text = "正在批量作废";
this.pbLoading.Visible = true;
Task.Run(() =>
{
@@ -1160,10 +1169,150 @@ namespace TemuKJD.KJDForms.AdminForms
Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "批量作废完成";
this.pbLoading.Visible = false;
}));
});
}
private void chkFilter_CheckedChanged(object sender, EventArgs e)
{
if (chkFilter.Checked == false)
{
foreach (DataGridViewRow row in dgvPriceCheck.Rows)
{
row.Visible = true;
}
}
else
{
foreach (DataGridViewRow row in dgvPriceCheck.Rows)
{
var pName = row.Cells["colProdName"].Value.ParseToString();
if (CheckContainsWords(pName))
{
}
else
{
row.Cells["colCheck"].Value = false;
row.Visible = false;
}
}
}
}
bool MouseLeftButtonDown = false;
bool MouseLeftButtonDownCheck = false;
private void dgvPriceCheck_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
MouseLeftButtonDown = false;
}
}
private void dgvPriceCheck_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (e.ColumnIndex < 0 || e.RowIndex < 0)
return;
MouseLeftButtonDown = true;
string headerText = dgvPriceCheck.Columns[e.ColumnIndex].HeaderText;
switch (headerText)
{
case "":
dgvPriceCheck.Rows[e.RowIndex].Cells["colCheck"].Value = MouseLeftButtonDownCheck =
!(bool)dgvPriceCheck.Rows[e.RowIndex].Cells["colCheck"].Value;
break;
default:
break;
}
}
}
private void dgvPriceCheck_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
MouseLeftButtonDown = false;
}
}
private void dgvPriceCheck_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex < 0 || e.RowIndex < 0)
return;
if (MouseLeftButtonDown)
{
if (dgvPriceCheck.Columns[e.ColumnIndex].Name == "colCheck") // 选择框文字为空
{
dgvPriceCheck.Rows[e.RowIndex].Cells["colCheck"].Value = MouseLeftButtonDownCheck;
}
}
}
private void dgvPriceCheck_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e)
{
if (IsShiftDown && e.Row.Visible)
{
e.Row.Cells["colCheck"].Value = e.Row.Selected;
}
}
bool IsShiftDown = false;
private void AdminProductPriceCheckForm_KeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.Shift:
case Keys.ShiftKey:
case Keys.LShiftKey:
case Keys.RShiftKey:
IsShiftDown = true;
break;
}
}
private void AdminProductPriceCheckForm_KeyUp(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.Shift:
case Keys.ShiftKey:
case Keys.LShiftKey:
case Keys.RShiftKey:
IsShiftDown = false;
break;
}
}
bool CheckContainsWords(string filterProdName)
{
return filterProdName != RestoreProductName(filterProdName);
}
string RestoreProductName(string pName)
{
string newPName = pName;
if (pName.EndsWith("适合不同的搭配风格") && pName.IndexOf("个") < 4 && pName.IndexOf("个") > 0)
{
var headword = pName.Substring(0, pName.IndexOf("个") + 1);
newPName = pName.Substring(pName.IndexOf("个") + "个".Length);
newPName = newPName.Replace("适合不同的搭配风格", "适合" + headword + "不同的搭配风格");
}
if (pName.EndsWith("适合不同的搭配风格") && pName.IndexOf("pcs") < 4 && pName.IndexOf("pcs") > 0)
{
var headword = pName.Substring(0, pName.IndexOf("pcs"));
newPName = pName.Substring(pName.IndexOf("pcs") + "pcs".Length);
newPName = newPName.Replace("适合不同的搭配风格", "适合" + headword + "个不同的搭配风格").Trim();
}
return newPName;
}
}
public class PriceCheckConfig