1部分废弃功能注释 2数据库商品车队费、贴单费等设置 3账户授权金额设置 4jit核价商品还原逻辑调整

This commit is contained in:
wule committed 2025-12-03 11:04:58 +08:00
1 parent 480d8c2cd4
commit 165df61234
52 files changed
+2019 -1023

No files matched your search

@@ -33,6 +33,7 @@ namespace TemuKJD.KJDForms.AdminForms
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
public List<ShopLoginInfo> lstAdminShopInfo { get; set; } = new List<ShopLoginInfo>();
public List<TemuForChainProductInfo> lstCheckPriceInfo = new List<TemuForChainProductInfo>();
public List<CateSizeWeightConfig> lstCateSizeWeightConfig = new List<CateSizeWeightConfig>();
public AdminProductPriceCheckForm()
{
@@ -56,11 +57,6 @@ namespace TemuKJD.KJDForms.AdminForms
this.dgvPriceCheck.AddImgColumn("colProductSkcPic", "colImgUrl");
this.colJitStatus.Visible = false;
if (!IsClientJit)
ucSplitPage1.Visible = true;
else
ucSplitPage1.Visible = false;
this.dtpEndTime.Value = DateTime.Now.Date.AddDays(1).AddMilliseconds(-1);
this.dtpStartTime.Value = DateTime.Now.Date.AddDays(-7);
@@ -72,9 +68,28 @@ namespace TemuKJD.KJDForms.AdminForms
}
if (IsClientJit)
{
ucSplitPage1.Visible = false;
chkSearchAllShop.Visible = false;
ucSplitPage1.Visible = false;
this.colJitStatus.Visible = true;
lblJudgeLen.Text = "列表中仅显示需要还原商品";
numJudgeLen.Visible = false;
lblJudgeWeight.Visible = false;
numJudgeWeight.Visible = false;
pnlRestoreSizeAndNumber.Visible = false;
btnRestoreSizeAndNumber.Text = "还原核价设置";
this.numJudgeLen.Value = 15;
this.numJudgeWeight.Value = 150;
this.numLen1.Value = 8;
this.numLen2.Value = 8;
this.numWidth1.Value = 7;
this.numWidth2.Value = 7;
this.numHeight1.Value = 6;
this.numHeight2.Value = 6;
this.numWeight1.Value = 6;
this.numWeight2.Value = 6;
}
if (IsClientJit)
@@ -387,7 +402,7 @@ namespace TemuKJD.KJDForms.AdminForms
//shopLoginForm.ShowDialog();
if (!IsClientJit)
{
CheckShopLogin(new ShopLoginInfo[] { shop }, false);
this.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
if (shop.LoginStatus2 == "国际版在线")
{
AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop);
@@ -406,7 +421,7 @@ namespace TemuKJD.KJDForms.AdminForms
}
else
{
CheckShopLogin(new ShopLoginInfo[] { shop }, false);
this.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
if (shop.LoginStatus2 == "国际版在线")
{
ShopLoginForm loginForm = new ShopLoginForm(shop);
@@ -475,6 +490,7 @@ namespace TemuKJD.KJDForms.AdminForms
switch (headerText)
{
case "规格名称":
if (!IsClientJit)
{
var priceInfo = lstCheckPriceInfo.FirstOrDefault(p => p.productId.ParseToString() == prodId);
if (priceInfo != null)
@@ -567,7 +583,7 @@ namespace TemuKJD.KJDForms.AdminForms
var rst = applyPrice(shop, orderId, data);
if (rst.Contains("登录过期") || rst.Contains("Invalid Login State"))
{
CheckShopLogin(new ShopLoginInfo[] { shop }, false);
this.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
Invoke(new Action(() =>
{
displayShopStatus(shop);
@@ -616,7 +632,7 @@ namespace TemuKJD.KJDForms.AdminForms
var rst = rePrice(shop, orderId, data);
if (rst.Contains("登录过期") || rst.Contains("Invalid Login State"))
{
CheckShopLogin(new ShopLoginInfo[] { shop }, false);
this.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
Invoke(new Action(() =>
{
displayShopStatus(shop);
@@ -682,7 +698,7 @@ namespace TemuKJD.KJDForms.AdminForms
var rst = priceAdjust(shop, data);
if (rst.Contains("登录过期") || rst.Contains("Invalid Login State"))
{
CheckShopLogin(new ShopLoginInfo[] { shop }, false);
this.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
Invoke(new Action(() =>
{
displayShopStatus(shop);
@@ -708,7 +724,7 @@ namespace TemuKJD.KJDForms.AdminForms
var rst = this.cancelPrice(shop, orderId);
if (rst.Contains("登录过期") || rst.Contains("Invalid Login State"))
{
CheckShopLogin(new ShopLoginInfo[] { shop }, false);
this.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
Invoke(new Action(() =>
{
displayShopStatus(shop);
@@ -791,7 +807,7 @@ namespace TemuKJD.KJDForms.AdminForms
if (shop == null)
continue;
CheckShopLogin(new ShopLoginInfo[] { shop }, false);
this.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
if (shop.LoginStatus2 != "国际版在线")
{
Invoke(new Action(() =>
@@ -817,7 +833,7 @@ namespace TemuKJD.KJDForms.AdminForms
commonSleep();
if (searchRst.Contains("登录过期") || searchRst.Contains("Invalid Login State"))
{
CheckShopLogin(new ShopLoginInfo[] { shop }, false);
this.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
Invoke(new Action(() =>
{
displayShopStatus(shop);
@@ -836,6 +852,7 @@ namespace TemuKJD.KJDForms.AdminForms
jArr = new JArray();
List<string> extCodeTmpLst = new List<string>();
List<string> spuIdLst = new List<string>();
List<TemuForChainProductInfo> checkPriceInfoTmpLst = new List<TemuForChainProductInfo>();
foreach (var item in jArr)
{
@@ -844,16 +861,12 @@ namespace TemuKJD.KJDForms.AdminForms
lstCheckPriceInfo.Add(priceInfo);
checkPriceInfoTmpLst.Add(priceInfo);
extCodeTmpLst.Add(priceInfo.skcList.FirstOrDefault()?.extCode);
spuIdLst.Add(priceInfo.productId.ParseToString());
}
List<TemuDBExtCodePriceInfo> extCodePriceList = new List<TemuDBExtCodePriceInfo>();
try
{
extCodePriceList = GetServerExtCodePriceLst(extCodeTmpLst.Distinct().ToList());
}
catch (Exception ex)
{
BaseMsgForm.ShowError("获取货号价格失败 " + ex.Message);
}
// 获取货号价格
List<TemuDBExtCodePriceInfo> extCodePriceList = GetServerExtCodePriceLst(extCodeTmpLst.Distinct().ToList());
// 获取产品数据库中的成本价格
List<DBProdDraftIdMapUpSpuIdInfo> upProdList = GetUpSpuIdLst(spuIdLst);
foreach (var priceInfo in checkPriceInfoTmpLst)
{
if (cancellationTokenSource.IsCancellationRequested)
@@ -906,7 +919,7 @@ namespace TemuKJD.KJDForms.AdminForms
//Thread.Sleep(Randomx.GetId(20, 50));
//if (orderPriceRst.Contains("登录过期") || orderPriceRst.Contains("Invalid Login State"))
//{
// CheckShopLogin(new ShopLoginInfo[] { shop }, false);
// this.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
//}
//reviewInfo.suggestSupplyPrice = BaseRegex.GetIntJson(ref orderPriceRst, "suggestSupplyPrice");
//reviewInfo.supplyPrice = BaseRegex.GetIntJson(ref orderPriceRst, "supplyPrice");
@@ -918,8 +931,13 @@ namespace TemuKJD.KJDForms.AdminForms
suggestSupplyPrice = "¥" + (reviewInfo.suggestSupplyPrice.ParseToDecimal() / 100).ToString("0.00");
}
// 计算商品进价
var reviewExtCode = priceInfo.skcList.FirstOrDefault()?.extCode;
var extCodePrice = extCodePriceList.FirstOrDefault(p => reviewExtCode == p.ext_code);
var upSpuIdPrice = upProdList.FirstOrDefault(p => priceInfo.productId == p.draft_id);
var original_price = extCodePrice?.original_price / 100m;
if (upSpuIdPrice?.cost_price > 0)
original_price = upSpuIdPrice?.cost_price;
Invoke(new Action(() =>
{
@@ -936,7 +954,7 @@ namespace TemuKJD.KJDForms.AdminForms
priceInfo.productName,
skuName,
reviewExtCode,
extCodePrice?.original_price / 100m, //extCodePrice == null ? "-" : (extCodePrice.original_price / 100m).ParseToString(),
original_price, //extCodePrice == null ? "-" : (extCodePrice.original_price / 100m).ParseToString(),
reviewInfo.productSkuList.FirstOrDefault()?.supplierPriceValue / 100m, //reviewInfo.supplyPrice / 100m,(这个数值temu接口返回的是错的,改价不会改变) //priceInfo.supplierPrice // sku不同价的会被分成多个review,priceInfo此时为价格范围
reviewInfo.suggestSupplyPrice / 100m, //suggestSupplyPrice.ParseToDecimal(),//核价 //reviewInfo.suggestSupplyPrice == null ? "-" : reviewInfo.suggestSupplyPrice.ParseToString(),
"", //新报价
@@ -1151,6 +1169,13 @@ namespace TemuKJD.KJDForms.AdminForms
return HttpResponseBLL.PostResponse2(shop, url, body, refere);
}
private string queryProductSizeAndWeightConfig(ShopLoginInfo shop, string taskUid, string productId)
{
string url = "https://agentseller.temu.com/anniston-agent-seller/product/check/common/queryConfig";
string body = "{}";
string referer = "https://agentseller.temu.com/goods/edit?from=platform&productId=" + productId + "&taskUid=" + taskUid;
return HttpResponseBLL.PostResponse2(shop, url, body, referer);
}
private string editPriceProductSizeAndNumber(ShopLoginInfo shop, string taskUid, string productId, string data)
{
string url = "https://agentseller.temu.com/visage-agent-seller/product/edit/task/reply";
@@ -1224,7 +1249,7 @@ namespace TemuKJD.KJDForms.AdminForms
{
if (html.Contains("登录过期") || html.Contains("Invalid Login State"))
{
CheckShopLogin(new ShopLoginInfo[] { shop }, false);
this.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
Invoke(new Action(() =>
{
displayShopStatus(shop);
@@ -1272,7 +1297,7 @@ namespace TemuKJD.KJDForms.AdminForms
{
if (html.Contains("登录过期") || html.Contains("Invalid Login State"))
{
CheckShopLogin(new ShopLoginInfo[] { shop }, false);
this.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
Invoke(new Action(() =>
{
displayShopStatus(shop);
@@ -1422,7 +1447,7 @@ namespace TemuKJD.KJDForms.AdminForms
{
List<TemuDBExtCodePriceInfo> list = new List<TemuDBExtCodePriceInfo>();
for(int i = 0; i< extCodeList.Count; i++)
for (int i = 0; i < extCodeList.Count; i++)
{
extCodeList[i] = extCodeList[i].Replace(",", "").Replace("'", "").Replace("\"", "");
}
@@ -1444,13 +1469,62 @@ namespace TemuKJD.KJDForms.AdminForms
if (!html.Contains("data"))
return list;
var jArr = JObject.Parse(html)["data"];
if (jArr.Count() == 0)
try
{
var jArr = JObject.Parse(html)["data"];
if (jArr.Count() == 0)
return list;
return JsonHelper.DeserializeJsonToList<TemuDBExtCodePriceInfo>(jArr.ToString());
}
catch (Exception ex)
{
BaseMsgForm.ShowError("获取货号价格失败 " + ex.Message);
return list;
}
}
public static List<DBProdDraftIdMapUpSpuIdInfo> GetUpSpuIdLst(List<string> draftIdList)
{
List<DBProdDraftIdMapUpSpuIdInfo> list = new List<DBProdDraftIdMapUpSpuIdInfo>();
if (draftIdList.Count == 0)
return list;
return JsonHelper.DeserializeJsonToList<TemuDBExtCodePriceInfo>(jArr.ToString());
for (int i = 0; i < draftIdList.Count; i++)
{
draftIdList[i] = draftIdList[i].Replace(",", "").Replace("'", "").Replace("\"", "");
}
var url = BaseClass.BuildObjString("product/get_select_prod_map_up_spu_id_list");
var data = UserLogin.GetSignaturex();
data += "&page=1";
data += "&page_size=200";
data += "&in_draft_ids=" + string.Join(",", draftIdList);
var html = GetHtml.PostUtf8(url, data);
Thread.Sleep(100);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
return list;
}
if (!html.Contains("data"))
return list;
try
{
var jArr = JObject.Parse(html)["data"];
if (jArr.Count() == 0)
return list;
return JsonHelper.DeserializeJsonToList<DBProdDraftIdMapUpSpuIdInfo>(jArr.ToString());
}
catch (Exception ex)
{
BaseMsgForm.ShowError("获取商品成本价失败 " + ex.Message);
return list;
}
}
private void pnlMutliCancelWithTitleWrong_Click(object sender, EventArgs e)
{
var rows = this.dgvPriceCheck.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true).ToList();
@@ -1638,6 +1712,8 @@ namespace TemuKJD.KJDForms.AdminForms
{
var t = Task.Run(() =>
{
//----------------------------------------------------------------------------------------
// 查询是否有修改记录,如果没有申请新的修改,获取taskId
var rows = this.dgvPriceCheck.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colProductId"].Value.ParseToString() == price.productId.ParseToString()).ToList();
var shop = lstAdminShopInfo.FirstOrDefault(s => s.ShopId == price.supplierId.ParseToString());
if (IsClientJit)
@@ -1689,7 +1765,7 @@ namespace TemuKJD.KJDForms.AdminForms
{
if (html.Contains("登录过期") || html.Contains("Invalid Login State"))
{
CheckShopLogin(new ShopLoginInfo[] { shop }, false);
this.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
Invoke(new Action(() =>
{
displayShopStatus(shop);
@@ -1725,7 +1801,6 @@ namespace TemuKJD.KJDForms.AdminForms
return; // continue;
}
html = editPriceProductQuery(shop, price.productId.ParseToString(), taskUid).ParseToString();
if (html.Contains("This product has pending or in-progress modification tasks"))
{
@@ -1740,7 +1815,7 @@ namespace TemuKJD.KJDForms.AdminForms
{
if (html.Contains("登录过期") || html.Contains("Invalid Login State"))
{
CheckShopLogin(new ShopLoginInfo[] { shop }, false);
this.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
Invoke(new Action(() =>
{
displayShopStatus(shop);
@@ -1766,15 +1841,116 @@ namespace TemuKJD.KJDForms.AdminForms
//int height = Randomx.GetId(5, 10); //100
//int weight = Randomx.GetId(100, 200); //500000
//int numberOfPieces = Randomx.GetId(450, 601);// 单品数量
int len = Randomx.GetId(numLen1.Value.ParseToInt(), numLen2.Value.ParseToInt() + 1);
int width = Randomx.GetId(numWidth1.Value.ParseToInt(), Math.Min(len, numWidth2.Value.ParseToInt() + 1));
int height = Randomx.GetId(numHeight1.Value.ParseToInt(), Math.Min(width, numHeight2.Value.ParseToInt() + 1));
int weight = Randomx.GetId(numWeight1.Value.ParseToInt(), numWeight2.Value.ParseToInt() + 1);
int numberOfPieces = 1;
int len = Randomx.GetId(numLen1.Value.ParseToInt(), numLen2.Value.ParseToInt() + 1) * 10;
int width = Randomx.GetId(numWidth1.Value.ParseToInt(), Math.Min(len, numWidth2.Value.ParseToInt() + 1)) * 10;
int height = Randomx.GetId(numHeight1.Value.ParseToInt(), Math.Min(width, numHeight2.Value.ParseToInt() + 1)) * 10;
int weight = Randomx.GetId(numWeight1.Value.ParseToInt(), numWeight2.Value.ParseToInt() + 1) * 1000;
int numberOfPieces = Math.Max(1, numPieces.Value.ParseToInt());
JObject obj = JObject.Parse(html);
var result = JsonHelper.SerializeObject(obj["result"]);
TemuDetailProductInfo prodInfo = JsonHelper.DeserializeJsonToObject<TemuDetailProductInfo>(result);
var catId = Math.Max(0, prodInfo.categories.cat1.catId.ParseToInt());
catId = Math.Max(catId, prodInfo.categories.cat2.catId.ParseToInt());
catId = Math.Max(catId, prodInfo.categories.cat3.catId.ParseToInt());
catId = Math.Max(catId, prodInfo.categories.cat4.catId.ParseToInt());
catId = Math.Max(catId, prodInfo.categories.cat5.catId.ParseToInt());
catId = Math.Max(catId, prodInfo.categories.cat6.catId.ParseToInt());
catId = Math.Max(catId, prodInfo.categories.cat7.catId.ParseToInt());
catId = Math.Max(catId, prodInfo.categories.cat8.catId.ParseToInt());
catId = Math.Max(catId, prodInfo.categories.cat9.catId.ParseToInt());
catId = Math.Max(catId, prodInfo.categories.cat10.catId.ParseToInt());
var cateSizeWeightConfig = lstCateSizeWeightConfig.FirstOrDefault(c => c.catId == catId.ToString());
if (cateSizeWeightConfig == null)
{
var url = BaseClass.BuildObjString("product/get_cate_size_weight_config");
var data = UserLogin.GetSignaturex() +
"&cat_id=" + catId;
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (!string.IsNullOrEmpty(html) && html.Contains("\"code\":200"))
{
try
{
var jArr = JObject.Parse(html)["data"];
cateSizeWeightConfig = JsonHelper.DeserializeJsonToObject<CateSizeWeightConfig>(jArr.ToString());
if (lstCateSizeWeightConfig != null)
lstCateSizeWeightConfig.Add(cateSizeWeightConfig);
}
catch { }
}
}
if (cateSizeWeightConfig == null)
{
//查询接口尺寸重量限制
html = queryProductSizeAndWeightConfig(shop, taskUid.ParseToString(), price.productId.ParseToString());
//{"success":true,"errorCode":1000000,"errorMsg":null,"result":{"common":{"operatorId":null,"operatorName":null,"operatorType":null,"checkSideRelation":false,"noticeSideEquation":false,"length":{"min":10,"max":2999},"width":{"min":5,"max":2999},"height":{"min":2,"max":2999},"weight":{"min":2000,"max":99999000}}}}
Thread.Sleep(Randomx.GetId(25, 75));
commonSleep();
if (html.Contains("\"success\":true"))
{
JObject jObj = JObject.Parse(html);
cateSizeWeightConfig = new CateSizeWeightConfig() { catId = catId.ToString() };
cateSizeWeightConfig.minLen = jObj["result"]["common"]["length"]["min"].ParseToInt();
cateSizeWeightConfig.maxLen = jObj["result"]["common"]["length"]["max"].ParseToInt();
cateSizeWeightConfig.minWidth = jObj["result"]["common"]["width"]["min"].ParseToInt();
cateSizeWeightConfig.maxWidth = jObj["result"]["common"]["width"]["max"].ParseToInt();
cateSizeWeightConfig.minHeight = jObj["result"]["common"]["height"]["min"].ParseToInt();
cateSizeWeightConfig.maxHeight = jObj["result"]["common"]["height"]["max"].ParseToInt();
cateSizeWeightConfig.minWeight = jObj["result"]["common"]["weight"]["min"].ParseToInt();
cateSizeWeightConfig.maxWeight = jObj["result"]["common"]["weight"]["max"].ParseToInt();
lstCateSizeWeightConfig.Add(cateSizeWeightConfig);
var url = BaseClass.BuildObjString("product/add_cate_size_weight_config");
var data = UserLogin.GetSignaturex();
data += "&cat_id=" + catId;
data += "&minLen=" + cateSizeWeightConfig.minLen;
data += "&maxLen=" + cateSizeWeightConfig.maxLen;
data += "&minWidth=" + cateSizeWeightConfig.minWidth;
data += "&maxWidth=" + cateSizeWeightConfig.maxWidth;
data += "&minHeight=" + cateSizeWeightConfig.minHeight;
data += "&maxHeight=" + cateSizeWeightConfig.maxHeight;
data += "&minWeight=" + cateSizeWeightConfig.minWeight;
data += "&maxWeight=" + cateSizeWeightConfig.maxWeight;
html = GetHtml.PostUtf8(url, data);
}
else
{
if (html.Contains("登录过期") || html.Contains("Invalid Login State"))
{
this.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
Invoke(new Action(() =>
{
displayShopStatus(shop);
}));
}
string sErrMsg = BaseRegex.GetStringJson(ref html, "errorMsg").ParseToString();
if (string.IsNullOrEmpty(sErrMsg))
sErrMsg = BaseRegex.GetStringJson(ref html, "error_msg").ParseToString();
if (string.IsNullOrEmpty(sErrMsg))
sErrMsg = html;
Invoke(new Action(() =>
{
foreach (var row in rows)
row.Cells["colMsg"].Value = "修改请求失败 " + sErrMsg;
}));
return; //continue;
}
}
// 设置长宽高
if (len < cateSizeWeightConfig.minLen) len = cateSizeWeightConfig.minLen;
if (len > cateSizeWeightConfig.maxLen) len = cateSizeWeightConfig.maxLen;
if (width < cateSizeWeightConfig.minWidth) width = cateSizeWeightConfig.minWidth;
if (width > cateSizeWeightConfig.maxWidth) width = cateSizeWeightConfig.maxWidth;
if (height < cateSizeWeightConfig.minHeight) height = cateSizeWeightConfig.minHeight;
if (height > cateSizeWeightConfig.maxHeight) height = cateSizeWeightConfig.maxHeight;
if (weight < cateSizeWeightConfig.minWeight) weight = cateSizeWeightConfig.minWeight;
if (weight > cateSizeWeightConfig.maxWeight) weight = cateSizeWeightConfig.maxWeight;
//JObject jPost = new JObject();
@@ -1837,18 +2013,18 @@ namespace TemuKJD.KJDForms.AdminForms
//productSkuWhExtAttrReq
jStr += "\"productSkuWhExtAttrReq\":{";
jStr += " \"productSkuWeightReq\":{\"value\":" + (weight * 1000) + "},";
jStr += " \"productSkuWeightReq\":{\"value\":" + weight + "},";
jStr += " \"productSkuVolumeReq\":{";
jStr += " \"len\":" + (len * 10) + ",";
jStr += " \"width\":" + (width * 10) + ",";
jStr += " \"height\":" + (height * 10);
jStr += " \"len\":" + len + ",";
jStr += " \"width\":" + width + ",";
jStr += " \"height\":" + height;
jStr += " }";
jStr += "},";
//productSkuMultiPackReq
jStr += "\"productSkuMultiPackReq\":{";
jStr += " \"skuClassification\":1,";
jStr += " \"numberOfPieces\":1,";
jStr += " \"numberOfPieces\":" + numberOfPieces + ",";
jStr += " \"pieceUnitCode\":" + Math.Max(1, sku.productSkuMultiPack.pieceUnitCode.ParseToInt()) + ",";
jStr += " \"productSkuNetContentReq\":{";
jStr += " },";
@@ -1887,7 +2063,7 @@ namespace TemuKJD.KJDForms.AdminForms
{
if (html.Contains("登录过期") || html.Contains("Invalid Login State"))
{
CheckShopLogin(new ShopLoginInfo[] { shop }, false);
this.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
Invoke(new Action(() =>
{
displayShopStatus(shop);
@@ -1980,82 +2156,106 @@ namespace TemuKJD.KJDForms.AdminForms
var filterExtCodeLst = dgvExtCode.Rows.Cast<DataGridViewRow>()
.Where(r => r.Cells["colSelectExtCode"].Value.ParseToBool() == true)
.Select(r => r.Cells["colFilterExtCode"].Value.ParseToString()).Distinct().ToList();
foreach (DataGridViewRow row in dgvPriceCheck.Rows)
pbLoading.Visible = true;
Task.Run(() =>
{
row.Visible = true;
row.Cells["colCheck"].Value = false;
//continue;
foreach (DataGridViewRow row in dgvPriceCheck.Rows)
{
Invoke(new Action(() =>
{
var prodId = row.Cells["colProductId"].Value.ParseToString();
var rowExtCode = row.Cells["colExtCode"].Value.ParseToString();
var rowAdjustPrice = row.Cells["colAdjustPrice"].Value.ParseToDecimal();
// 过滤价格
// 只有有选中数据时才过滤,全不选时不过滤
if (filterExtCodeLst != null && filterExtCodeLst.Count > 0)
{
var filterExtCode = filterExtCodeLst.FirstOrDefault(e => e == rowExtCode);
var filterExtCodeConfig = lstPriceCheckFilterConfig.FirstOrDefault(c => c.ExtCode == rowExtCode);
if (string.IsNullOrWhiteSpace(filterExtCode))
{
row.Cells["colCheck"].Value = false;
row.Visible = false;
}
else if (filterExtCodeConfig != null)
{
if (filterExtCodeConfig.Symbol == "≥" && rowAdjustPrice < filterExtCodeConfig.Price1)
{
row.Cells["colCheck"].Value = false;
row.Visible = false;
}
if (filterExtCodeConfig.Symbol == "≤" && rowAdjustPrice > filterExtCodeConfig.Price1)
{
row.Cells["colCheck"].Value = false;
row.Visible = false;
}
if (filterExtCodeConfig.Symbol.StartsWith("≤") && filterExtCodeConfig.Symbol.EndsWith("≥") &&
rowAdjustPrice > filterExtCodeConfig.Price1 && rowAdjustPrice < filterExtCodeConfig.Price2)
{
row.Cells["colCheck"].Value = false;
row.Visible = false;
}
if (filterExtCodeConfig.Symbol.StartsWith("≥") && filterExtCodeConfig.Symbol.EndsWith("≤") &&
(rowAdjustPrice < filterExtCodeConfig.Price1 || rowAdjustPrice > filterExtCodeConfig.Price2))
{
row.Cells["colCheck"].Value = false;
row.Visible = false;
}
}
}
//row.Visible = true;
//row.Cells["colCheck"].Value = false;
// 过滤保留未还原的标题
if (chkFilterTitle.Checked)
{
var pName = row.Cells["colProdName"].Value.ParseToString();
if (!CheckRestoreTitleWords(pName))
{
row.Cells["colCheck"].Value = false;
row.Visible = false;
}
else
{
}
}
if (chkFilterSize.Checked)
{
var priceInfo = lstCheckPriceInfo.FirstOrDefault(p => p.productId.ParseToString() == prodId);
if (priceInfo != null)
{
if (!checkRestoreSizeAndNumber(priceInfo))
bool isVisible = true;
var prodId = row.Cells["colProductId"].Value.ParseToString();
var rowExtCode = row.Cells["colExtCode"].Value.ParseToString();
var rowAdjustPrice = row.Cells["colAdjustPrice"].Value.ParseToDecimal();
// 过滤价格
// 只有有选中数据时才过滤,全不选时不过滤
if (filterExtCodeLst != null && filterExtCodeLst.Count > 0)
{
row.Cells["colCheck"].Value = false;
row.Visible = false;
var filterExtCode = filterExtCodeLst.FirstOrDefault(e => e == rowExtCode);
var filterExtCodeConfig = lstPriceCheckFilterConfig.FirstOrDefault(c => c.ExtCode == rowExtCode);
if (string.IsNullOrWhiteSpace(filterExtCode))
{
row.Cells["colCheck"].Value = false;
row.Visible = false;
isVisible = false;
}
else if (filterExtCodeConfig != null)
{
if (filterExtCodeConfig.Symbol == "≥" && rowAdjustPrice < filterExtCodeConfig.Price1)
{
row.Cells["colCheck"].Value = false;
row.Visible = false;
isVisible = false;
}
if (filterExtCodeConfig.Symbol == "≤" && rowAdjustPrice > filterExtCodeConfig.Price1)
{
row.Cells["colCheck"].Value = false;
row.Visible = false;
isVisible = false;
}
if (filterExtCodeConfig.Symbol.StartsWith("≤") && filterExtCodeConfig.Symbol.EndsWith("≥") &&
rowAdjustPrice > filterExtCodeConfig.Price1 && rowAdjustPrice < filterExtCodeConfig.Price2)
{
row.Cells["colCheck"].Value = false;
row.Visible = false;
isVisible = false;
}
if (filterExtCodeConfig.Symbol.StartsWith("≥") && filterExtCodeConfig.Symbol.EndsWith("≤") &&
(rowAdjustPrice < filterExtCodeConfig.Price1 || rowAdjustPrice > filterExtCodeConfig.Price2))
{
row.Cells["colCheck"].Value = false;
row.Visible = false;
isVisible = false;
}
}
}
else
// 过滤保留未还原的标题
if (chkFilterTitle.Checked)
{
var pName = row.Cells["colProdName"].Value.ParseToString();
if (!CheckRestoreTitleWords(pName))
{
row.Cells["colCheck"].Value = false;
row.Visible = false;
isVisible = false;
}
else
{
}
}
}
if (chkFilterSize.Checked)
{
var priceInfo = lstCheckPriceInfo.FirstOrDefault(p => p.productId.ParseToString() == prodId);
if (priceInfo != null)
{
if (!checkRestoreSizeAndNumber(priceInfo))
{
row.Cells["colCheck"].Value = false;
row.Visible = false;
isVisible = false;
}
else
{
}
}
}
if (row.Visible != isVisible)
{
row.Visible = isVisible;
//row.Cells["colCheck"].Value = isVisible;
}
}));
}
}
Invoke(new Action(() => { pbLoading.Visible = false; }));
});
}
private void btnSaveFilterParams_Click(object sender, EventArgs e)
@@ -2191,6 +2391,11 @@ namespace TemuKJD.KJDForms.AdminForms
else
ShopListForm.Instance.CheckShopLogin(shops, isShowProgress);
}
private void lblJudgeLen_Click(object sender, EventArgs e)
{
chkFilterSize.Checked = !chkFilterSize.Checked;
}
}
public class PriceCheckConfig
@@ -2212,4 +2417,17 @@ namespace TemuKJD.KJDForms.AdminForms
public decimal Price1 { get; set; }
public decimal Price2 { get; set; }
}
public class CateSizeWeightConfig
{
public string catId { get; set; }
public int minLen { get; set; }
public int maxLen { get; set; }
public int minWidth { get; set; }
public int maxWidth { get; set; }
public int minHeight { get; set; }
public int maxHeight { get; set; }
public int minWeight { get; set; }
public int maxWeight { get; set; }
}
}