优化核价相关功能
This commit is contained in:
1 parent
01ba8cba6b
commit
12ea9bebe5
9 files changed
+457
-177
No files matched your search
@@ -15,6 +15,7 @@ using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using TemuKJD.KJDForms.BaseForms;
|
||||
using TemuKJD.KJDForms.ShopForms;
|
||||
using TemuKJD.KJDForms.ToolForms;
|
||||
using Work;
|
||||
|
||||
namespace TemuKJD.KJDForms.AdminForms
|
||||
@@ -22,6 +23,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
public partial class AdminProductPriceCheckForm : Form
|
||||
{
|
||||
PriceCheckConfig priceCheckConfig = null;
|
||||
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
|
||||
public List<ShopLoginInfo> lstAdminShopInfo { get; set; } = new List<ShopLoginInfo>();
|
||||
public List<TemuCheckPriceInfo> lstCheckPriceInfo = new List<TemuCheckPriceInfo>();
|
||||
|
||||
@@ -33,7 +35,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
private void AdminProductPriceCheckForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.dgvShop.AddSelectorColumn("colSelect");
|
||||
this.dgvAdjust.AddSelectorColumn("colCheck");
|
||||
this.dgvPriceCheck.AddSelectorColumn("colCheck");
|
||||
|
||||
if (BaseClass.SaLevel != 1)
|
||||
{
|
||||
@@ -70,12 +72,12 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("price_check_config", priceCheckConfig);
|
||||
}
|
||||
|
||||
bool firstLoad = true;
|
||||
//bool firstLoad = true;
|
||||
private void AdminProductPriceCheckForm_VisibleChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (this.Visible && this.firstLoad)
|
||||
if (this.Visible /*&& this.firstLoad*/)
|
||||
{
|
||||
firstLoad = false;
|
||||
//firstLoad = false;
|
||||
this.pbShopLoading.Visible = true;
|
||||
SearchShop(this.ucSplitPage1.CurrentPage);
|
||||
}
|
||||
@@ -96,7 +98,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
|
||||
public void SearchShop(int page)
|
||||
{
|
||||
List<string> shopIdList = GetCheckedShopIdList();
|
||||
List<string> shopIdSelectList = GetCheckedShopIdList();
|
||||
if (InvokeRequired)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
@@ -125,7 +127,8 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
int rowIndex = this.dgvShop.Rows.Add(
|
||||
shopIdList.Contains(shop.ShopId + shop.UserName),
|
||||
shopIdSelectList.Contains(shop.ShopId + shop.UserName),
|
||||
shop.UserName,
|
||||
shop.LoginName,
|
||||
shop.ShopId,
|
||||
shop.ShopAccount,
|
||||
@@ -134,11 +137,12 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
canUse,
|
||||
string.Empty
|
||||
);
|
||||
var row = dgvShop.Rows[rowIndex];
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).Style.ForeColor = canUse ? Color.Green : Color.Red;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).LinkColor = canUse ? Color.Green : Color.Red;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).ActiveLinkColor = canUse ? Color.LightGreen : Color.OrangeRed;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).VisitedLinkColor = canUse ? Color.DarkGreen : Color.DarkRed;
|
||||
displayShopStatus(shop);
|
||||
//var row = dgvShop.Rows[rowIndex];
|
||||
//(row.Cells["colLoginStatus"] as DataGridViewLinkCell).Style.ForeColor = canUse ? Color.Green : Color.Red;
|
||||
//(row.Cells["colLoginStatus"] as DataGridViewLinkCell).LinkColor = canUse ? Color.Green : Color.Red;
|
||||
//(row.Cells["colLoginStatus"] as DataGridViewLinkCell).ActiveLinkColor = canUse ? Color.LightGreen : Color.OrangeRed;
|
||||
//(row.Cells["colLoginStatus"] as DataGridViewLinkCell).VisitedLinkColor = canUse ? Color.DarkGreen : Color.DarkRed;
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -157,7 +161,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
if (dgvShop.Rows[i].Cells["colSelect"].Value.ParseToBool())
|
||||
{
|
||||
string shopName = dgvShop.Rows[i].Cells["colShopId"].Value.ParseToString();
|
||||
//shopName += dgvShop.Rows[i].Cells["colUser"].Value.ParseToString();
|
||||
shopName += dgvShop.Rows[i].Cells["colUser"].Value.ParseToString();
|
||||
shopNameList.Add(shopName);
|
||||
}
|
||||
}
|
||||
@@ -175,9 +179,9 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
var data = UserLogin.GetSignaturex() +
|
||||
"&page=" + page +
|
||||
"&page_size=" + pageSize +
|
||||
"&shop_ids=" + txtShopId.Text.Trim() +
|
||||
"&shop_names=" + txtShopName.Text.Trim() +
|
||||
"&search_notes=" + txtNotes.Text.Trim();
|
||||
"&shop_ids=" + txtShopId.Text.Trim().Trim(',') +
|
||||
"&shop_names=" + txtShopName.Text.Trim().Trim(',') +
|
||||
"&search_notes=" + txtNotes.Text.Trim().Trim(',');
|
||||
if (BaseClass.SaLevel > 1 && !chkSearchAllShop.Checked)
|
||||
data += "&operate_sub_sa_name=" + BaseClass.UserName;
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
@@ -235,6 +239,11 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
if (shop == null)
|
||||
return;
|
||||
|
||||
displayShopStatus(shop);
|
||||
}
|
||||
|
||||
void displayShopStatus(ShopLoginInfo shop)
|
||||
{
|
||||
bool canUse = shop.LoginStatus2 == "国际版在线";
|
||||
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colLoginName"].Value.ParseToString() == shop?.LoginName);
|
||||
foreach (var row in rows)
|
||||
@@ -245,32 +254,38 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).LinkColor = canUse ? Color.Green : Color.Red;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).ActiveLinkColor = canUse ? Color.LightGreen : Color.OrangeRed;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).VisitedLinkColor = canUse ? Color.DarkGreen : Color.DarkRed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void dgvAdjust_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
||||
return;
|
||||
string headerText = dgvAdjust.Columns[e.ColumnIndex].HeaderText;
|
||||
string orderId = dgvAdjust.Rows[e.RowIndex].Cells["colOrderId"].Value.ParseToString();
|
||||
string accountId = dgvAdjust.Rows[e.RowIndex].Cells["colSupplierId"].Value.ParseToString();
|
||||
string headerText = dgvPriceCheck.Columns[e.ColumnIndex].HeaderText;
|
||||
string orderId = dgvPriceCheck.Rows[e.RowIndex].Cells["colOrderId"].Value.ParseToString();
|
||||
string accountId = dgvPriceCheck.Rows[e.RowIndex].Cells["colSupplierId"].Value.ParseToString();
|
||||
var shop = lstAdminShopInfo.FirstOrDefault(v => v.ShopId == accountId);
|
||||
|
||||
switch (headerText)
|
||||
{
|
||||
case "同意报价":
|
||||
{
|
||||
applyHighPrice(shop, orderId, dgvAdjust.Rows[e.RowIndex]);
|
||||
applyHighPrice(shop, orderId, dgvPriceCheck.Rows[e.RowIndex]);
|
||||
}
|
||||
break;
|
||||
case "拒绝报价":
|
||||
{
|
||||
cancelLowPrice(shop, orderId, dgvAdjust.Rows[e.RowIndex]);
|
||||
cancelLowPrice(shop, orderId, dgvPriceCheck.Rows[e.RowIndex]);
|
||||
}
|
||||
break;
|
||||
case "Skc图片":
|
||||
string url = dgvPriceCheck.Rows[e.RowIndex].Cells["colImgUrl"].Value.ParseToString().Replace("img.kwcdn.com", "img.cdnfe.com");
|
||||
url = url.IndexOf("?") < 0 ? url : url.Substring(0, url.IndexOf("?"));
|
||||
ShowImgForm imgFrom = new ShowImgForm(url);
|
||||
imgFrom.ShowDialog();
|
||||
break;
|
||||
default:
|
||||
dgvAdjust.Rows[e.RowIndex].Cells["colCheck"].Value = !(bool)dgvAdjust.Rows[e.RowIndex].Cells["colCheck"].Value;
|
||||
dgvPriceCheck.Rows[e.RowIndex].Cells["colCheck"].Value = !(bool)dgvPriceCheck.Rows[e.RowIndex].Cells["colCheck"].Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -307,6 +322,14 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
data = data.TrimEnd(',');
|
||||
data += "],\"bargainReasonList\":[]}";
|
||||
var rst = applyPrice(shop, orderId, data);
|
||||
if (rst.Contains("登录过期") || rst.Contains("Invalid Login State"))
|
||||
{
|
||||
AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
displayShopStatus(shop);
|
||||
}));
|
||||
}
|
||||
if (row != null)
|
||||
{
|
||||
if (rst.Contains("\"success\":true"))
|
||||
@@ -348,10 +371,21 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
data = data.TrimEnd(',');
|
||||
data += "],\"bargainReasonList\":[]}";
|
||||
var rst = rePrice(shop, orderId, data);
|
||||
if (rst.Contains("登录过期") || rst.Contains("Invalid Login State"))
|
||||
{
|
||||
AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
displayShopStatus(shop);
|
||||
}));
|
||||
}
|
||||
if (row != null)
|
||||
{
|
||||
if (rst.Contains("\"success\":true"))
|
||||
{
|
||||
row.Cells["colMsg"].Value = "已重新申请价格";
|
||||
row.Cells["colNewPrice"].Value = (priceReview.supplyPrice - priceDown) / 100.0;
|
||||
}
|
||||
else
|
||||
row.Cells["colMsg"].Value = "重新申请价格失败" + rst;
|
||||
}
|
||||
@@ -363,6 +397,14 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
return;
|
||||
|
||||
var rst = this.cancelPrice(shop, orderId);
|
||||
if (rst.Contains("登录过期") || rst.Contains("Invalid Login State"))
|
||||
{
|
||||
AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
displayShopStatus(shop);
|
||||
}));
|
||||
}
|
||||
if (row != null)
|
||||
{
|
||||
if (rst.Contains("\"success\":true"))
|
||||
@@ -373,6 +415,16 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
}
|
||||
|
||||
private void btnSearchPrice_Click(object sender, EventArgs e)
|
||||
{
|
||||
SearchPrice("待卖家确认");
|
||||
}
|
||||
|
||||
private void btnSearchPrice2_Click(object sender, EventArgs e)
|
||||
{
|
||||
SearchPrice("待创建首单");
|
||||
}
|
||||
|
||||
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();
|
||||
@@ -383,9 +435,10 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
return;
|
||||
}
|
||||
|
||||
this.dgvAdjust.Rows.Clear();
|
||||
this.dgvPriceCheck.Rows.Clear();
|
||||
this.lstCheckPriceInfo.Clear();
|
||||
this.pbLoading.Visible = true;
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
Task.Run(() =>
|
||||
{
|
||||
foreach (var shopId in selectShopIdLst)
|
||||
@@ -397,49 +450,73 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
|
||||
if (shop.LoginStatus2 != "国际版在线")
|
||||
{
|
||||
var canUse = false;
|
||||
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colLoginName"].Value.ParseToString() == shop?.LoginName);
|
||||
foreach (var row in rows)
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
row.Cells["colCanUse"].Value = canUse;
|
||||
row.Cells["colLoginStatus"].Value = canUse ? "在线" : "掉线";
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).Style.ForeColor = canUse ? Color.Green : Color.Red;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).LinkColor = canUse ? Color.Green : Color.Red;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).ActiveLinkColor = canUse ? Color.LightGreen : Color.OrangeRed;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).VisitedLinkColor = canUse ? Color.DarkGreen : Color.DarkRed;
|
||||
}
|
||||
displayShopStatus(shop);
|
||||
}));
|
||||
}
|
||||
int page = 0;
|
||||
int totalPage = 1;
|
||||
int prodIndex = 0;
|
||||
while (page < totalPage)
|
||||
{
|
||||
if (cancellationTokenSource.IsCancellationRequested)
|
||||
break;
|
||||
page++;
|
||||
var searchRst = this.SearchForChainSupplier(shop, page, txtSkcId.Text.Trim());
|
||||
var searchRst = this.SearchForChainSupplier(shop, page, txtSkcId.Text.Trim().Trim(','), type);
|
||||
if (searchRst.Contains("登录过期") || searchRst.Contains("Invalid Login State"))
|
||||
{
|
||||
AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
displayShopStatus(shop);
|
||||
}));
|
||||
}
|
||||
if (searchRst.Contains("\"success\":true"))
|
||||
{
|
||||
try
|
||||
{
|
||||
int total = BaseRegex.GetStringJson(ref searchRst, "total").ParseToInt();
|
||||
totalPage = Math.Ceiling(total / 100.0).ParseToInt();
|
||||
|
||||
var jObj = JObject.Parse(searchRst);
|
||||
var jArr = jObj["result"]["dataList"] as JArray;
|
||||
if (jArr == null)
|
||||
jArr = new JArray();
|
||||
|
||||
List<string> extCodeLst = new List<string>();
|
||||
List<TemuCheckPriceInfo> checkPriceInfoTmpLst = new List<TemuCheckPriceInfo>();
|
||||
foreach (var item in jArr)
|
||||
{
|
||||
|
||||
var jStr = JsonHelper.SerializeObject(item);
|
||||
TemuCheckPriceInfo priceInfo = JsonHelper.DeserializeJsonToObject<TemuCheckPriceInfo>(jStr);
|
||||
lstCheckPriceInfo.Add(priceInfo);
|
||||
checkPriceInfoTmpLst.Add(priceInfo);
|
||||
extCodeLst.Add(priceInfo.skcList.FirstOrDefault()?.extCode);
|
||||
}
|
||||
var extCodePriceList = GetServerExtCodePriceLst(extCodeLst.Distinct().ToList());
|
||||
foreach (var priceInfo in checkPriceInfoTmpLst)
|
||||
{
|
||||
prodIndex++;
|
||||
Invoke(new Action(() => {
|
||||
this.statusBar.lblTaskStatus.Text = "正在查询" + type + ",共有 " + total + " 件商品";
|
||||
this.statusBar.pgbTaskProgress.Maximum = total;
|
||||
this.statusBar.UpdateProgressBar(prodIndex);
|
||||
}));
|
||||
|
||||
|
||||
string imgUrl = priceInfo.skcList.FirstOrDefault()?.previewImgUrlList.FirstOrDefault();
|
||||
if (imgUrl == null)
|
||||
imgUrl = "";
|
||||
imgUrl = imgUrl.Replace("https://", "http://") + "?imageMogr2/thumbnail/60x";
|
||||
//string getImgError = "";
|
||||
//var img = GetHtml.GetUrlImg(imgUrl + "?imageMogr2/thumbnail/60x", out getImgError);
|
||||
imgUrl = imgUrl.Replace("https://", "http://").Replace("img.kwcdn.com", "img.cdnfe.com") + "?imageMogr2/thumbnail/60x";
|
||||
//string getImgError = "";
|
||||
//var img = GetHtml.GetUrlImg(imgUrl + "?imageMogr2/thumbnail/60x", out getImgError);
|
||||
|
||||
foreach (var reviewInfo in priceInfo.skcList.FirstOrDefault().supplierPriceReviewInfoList)
|
||||
{
|
||||
if (cancellationTokenSource.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
if (reviewInfo.status == 3) //放弃调整报价,报价显示已作废
|
||||
continue;
|
||||
|
||||
@@ -457,20 +534,33 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
skuName += "\r\n";
|
||||
}
|
||||
}
|
||||
var orderPriceRst = GetCheckPrice(shop, reviewInfo.priceOrderId.ParseToString());
|
||||
reviewInfo.suggestSupplyPrice = BaseRegex.GetIntJson(ref orderPriceRst, "suggestSupplyPrice");
|
||||
reviewInfo.supplyPrice = BaseRegex.GetIntJson(ref orderPriceRst, "supplyPrice");
|
||||
var suggestSupplyPrice = (reviewInfo.suggestSupplyPrice / 100.0).ToString();
|
||||
if (suggestSupplyPrice == "0")
|
||||
suggestSupplyPrice = "获取推荐价格失败,请重试";
|
||||
else
|
||||
suggestSupplyPrice += "¥";
|
||||
var suggestSupplyPrice = "-";
|
||||
if (type == "待卖家确认")
|
||||
{
|
||||
var orderPriceRst = "店铺掉线";
|
||||
if (shop.LoginStatus2 == "国际版在线")
|
||||
orderPriceRst = GetCheckPrice(shop, reviewInfo.priceOrderId.ParseToString());
|
||||
if (orderPriceRst.Contains("登录过期") || orderPriceRst.Contains("Invalid Login State"))
|
||||
{
|
||||
AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
|
||||
}
|
||||
reviewInfo.suggestSupplyPrice = BaseRegex.GetIntJson(ref orderPriceRst, "suggestSupplyPrice");
|
||||
reviewInfo.supplyPrice = BaseRegex.GetIntJson(ref orderPriceRst, "supplyPrice");
|
||||
suggestSupplyPrice = (reviewInfo.suggestSupplyPrice / 100.0).ToString();
|
||||
if (suggestSupplyPrice == "0")
|
||||
suggestSupplyPrice = "获取推荐价格失败,请重试" + orderPriceRst;
|
||||
else
|
||||
suggestSupplyPrice += "¥";
|
||||
}
|
||||
var reviewExtCode = priceInfo.skcList.FirstOrDefault()?.extCode;
|
||||
var extCodePrice = extCodePriceList.FirstOrDefault(p => reviewExtCode == p.ext_code);
|
||||
Thread.Sleep(Randomx.GetId(20, 50));
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
int rowId = this.dgvAdjust.Rows.Add(
|
||||
int rowId = this.dgvPriceCheck.Rows.Add(
|
||||
false,
|
||||
prodIndex,
|
||||
reviewInfo.priceOrderId,
|
||||
priceInfo.supplierId,
|
||||
priceInfo.supplierName,
|
||||
@@ -480,7 +570,10 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
priceInfo.skcList.FirstOrDefault()?.skcId,
|
||||
priceInfo.productName,
|
||||
skuName,
|
||||
reviewInfo.productSkuList.FirstOrDefault()?.supplierPrice, //priceInfo.supplierPrice,
|
||||
reviewExtCode,
|
||||
extCodePrice == null ? "-" : (extCodePrice.original_price / 100.0).ParseToString(),
|
||||
// sku不同价的会被分成多个review,priceInfo此时为价格范围
|
||||
reviewInfo.productSkuList.FirstOrDefault()?.supplierPrice, //priceInfo.supplierPrice
|
||||
suggestSupplyPrice,//核价
|
||||
"", //新报价
|
||||
reviewInfo.times, // 修改报价次数
|
||||
@@ -488,7 +581,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
"拒绝",
|
||||
""
|
||||
);
|
||||
dgvAdjust.Rows[rowId].Height = 60;
|
||||
dgvPriceCheck.Rows[rowId].Height = 60;
|
||||
}));
|
||||
}
|
||||
this.ShowDgvImg();
|
||||
@@ -501,24 +594,37 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
}
|
||||
}
|
||||
|
||||
int total = BaseRegex.GetStringJson(ref searchRst, "total").ParseToInt();
|
||||
totalPage = Math.Ceiling(total / 100.0).ParseToInt();
|
||||
}
|
||||
|
||||
}
|
||||
Invoke(new Action(() => {
|
||||
this.pbLoading.Visible = false;
|
||||
string sRst = type + " 查询结束!";
|
||||
if (cancellationTokenSource.IsCancellationRequested)
|
||||
sRst = type + " 已取消查询!";
|
||||
BaseMsgForm.ShowInfo(sRst);
|
||||
this.statusBar.lblTaskStatus.Text = sRst;
|
||||
}));
|
||||
});
|
||||
}, cancellationTokenSource.Token);
|
||||
}
|
||||
|
||||
|
||||
private string SearchForChainSupplier (ShopLoginInfo shop, int page, string prodSkcIds = null)
|
||||
private string SearchForChainSupplier (ShopLoginInfo shop, int page, string prodSkcIds = null, string type = "待卖家确认")
|
||||
{
|
||||
string url = "https://agentseller.temu.com/api/kiana/mms/robin/searchForChainSupplier";
|
||||
string body = @"{""pageSize"":100,""pageNum"":" + page + @",""priceReviewStatusList"":[1],""secondarySelectStatusList"":[7],""supplierTodoTypeList"":[]}";
|
||||
if (!string.IsNullOrEmpty(prodSkcIds))
|
||||
body = @"{""pageSize"":50,""pageNum"":" + page + @",""priceReviewStatusList"":[1],""secondarySelectStatusList"":[7],""supplierTodoTypeList"":[],""productSkcIdList"":["+ prodSkcIds + "]}";
|
||||
string body = "";
|
||||
if (type == "待卖家确认")
|
||||
{
|
||||
body = @"{""pageSize"":100,""pageNum"":" + page + @",""priceReviewStatusList"":[1],""secondarySelectStatusList"":[7],""supplierTodoTypeList"":[]}";
|
||||
if (!string.IsNullOrEmpty(prodSkcIds))
|
||||
body = @"{""pageSize"":100,""pageNum"":" + page + @",""priceReviewStatusList"":[1],""secondarySelectStatusList"":[7],""supplierTodoTypeList"":[],""productSkcIdList"":["+ prodSkcIds + "]}";
|
||||
}
|
||||
if (type == "待创建首单")
|
||||
{
|
||||
body = @"{""pageSize"":100,""pageNum"":" + page + @",""secondarySelectStatusList"":[10],""supplierTodoTypeList"":[]}";
|
||||
if (!string.IsNullOrEmpty(prodSkcIds))
|
||||
body = @"{""pageSize"":100,""pageNum"":" + page + @",""secondarySelectStatusList"":[10],""supplierTodoTypeList"":[],""productSkcIdList"":[" + prodSkcIds + "]}";
|
||||
}
|
||||
string referer = "https://agentseller.temu.com/newon/product-select";
|
||||
return KJDHttpResponse.PostResponse2(shop, url, body, referer);
|
||||
}
|
||||
@@ -577,7 +683,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
foreach (DataGridViewRow row in this.dgvAdjust.Rows)
|
||||
foreach (DataGridViewRow row in this.dgvPriceCheck.Rows)
|
||||
{
|
||||
if (row.Index > 0 && row.Cells["colProductSkcPic"].Displayed == false)
|
||||
{
|
||||
@@ -609,7 +715,8 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
row.Cells["colProductSkcPic"].Value = image;
|
||||
if (dgvPriceCheck.Rows.Contains(row))
|
||||
row.Cells["colProductSkcPic"].Value = image;
|
||||
}));
|
||||
}
|
||||
catch
|
||||
@@ -626,7 +733,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
|
||||
private void btnReturnProdName_Click(object sender, EventArgs e)
|
||||
{
|
||||
var products = this.dgvAdjust.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true)
|
||||
var products = this.dgvPriceCheck.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true)
|
||||
.Select(r => r.Cells["colProductId"].Value.ParseToString());
|
||||
var prices = this.lstCheckPriceInfo.Where(p => products.Contains(p.productId.ParseToString())).ToList();
|
||||
|
||||
@@ -641,10 +748,21 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
{
|
||||
foreach (var price in prices)
|
||||
{
|
||||
var rows = this.dgvAdjust.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colProductId"].Value.ParseToString() == price.productId.ParseToString()).ToList();
|
||||
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());
|
||||
var html = editPriceProductNameBatchAdd(shop, price.productId.ParseToString());
|
||||
|
||||
if (shop == null)
|
||||
continue;
|
||||
if (shop.LoginStatus2 != "国际版在线")
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
foreach (var row in rows)
|
||||
row.Cells["colMsg"].Value = "店铺掉线";
|
||||
}));
|
||||
continue;
|
||||
}
|
||||
|
||||
var pName = price.productName;
|
||||
if ((pName.EndsWith("适合不同的搭配风格") && pName.IndexOf("个") < 4 && pName.IndexOf("个") > 0) ||
|
||||
@@ -673,6 +791,14 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
}
|
||||
if (!html.Contains("\"success\":true"))
|
||||
{
|
||||
if (html.Contains("登录过期") || html.Contains("Invalid Login State"))
|
||||
{
|
||||
AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
displayShopStatus(shop);
|
||||
}));
|
||||
}
|
||||
string sErrMsg = BaseRegex.GetStringJson(ref html, "errorMsg").ParseToString();
|
||||
if (string.IsNullOrEmpty(sErrMsg))
|
||||
{
|
||||
@@ -717,6 +843,14 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
}
|
||||
else
|
||||
{
|
||||
if (html.Contains("登录过期") || html.Contains("Invalid Login State"))
|
||||
{
|
||||
AdminShopListForm.Instance.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();
|
||||
@@ -750,7 +884,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
|
||||
private void btnRePrice_Click(object sender, EventArgs e)
|
||||
{
|
||||
var rows = this.dgvAdjust.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true).ToList();
|
||||
var rows = this.dgvPriceCheck.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true).ToList();
|
||||
if (rows.Count == 0)
|
||||
{
|
||||
BaseMsgForm.ShowError("未选择要重新报价的商品!");
|
||||
@@ -779,7 +913,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
|
||||
private void btnMutliOk_Click(object sender, EventArgs e)
|
||||
{
|
||||
var rows = this.dgvAdjust.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true).ToList();
|
||||
var rows = this.dgvPriceCheck.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true).ToList();
|
||||
if (rows.Count == 0)
|
||||
{
|
||||
BaseMsgForm.ShowError("未选择要重新报价的商品!");
|
||||
@@ -808,7 +942,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
|
||||
private void btnMutliCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
var rows = this.dgvAdjust.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true).ToList();
|
||||
var rows = this.dgvPriceCheck.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true).ToList();
|
||||
if (rows.Count == 0)
|
||||
{
|
||||
BaseMsgForm.ShowError("未选择要重新报价的商品!");
|
||||
@@ -834,6 +968,45 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
private void btnStop_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (cancellationTokenSource != null)
|
||||
cancellationTokenSource.Cancel();
|
||||
}
|
||||
|
||||
public List<TemuDBExtCodePriceInfo> GetServerExtCodePriceLst(List<string> extCodeList)
|
||||
{
|
||||
List<TemuDBExtCodePriceInfo> list = new List<TemuDBExtCodePriceInfo>();
|
||||
|
||||
for(int i = 0; i< extCodeList.Count; i++)
|
||||
{
|
||||
extCodeList[i] = extCodeList[i].Replace(",", "").Replace("'", "").Replace("\"", "");
|
||||
}
|
||||
var url = BaseClass.BuildObjString("price/get_price_list");
|
||||
var data = UserLogin.GetSignaturex();
|
||||
data += "&page=1";
|
||||
data += "&page_size=200";
|
||||
data += "&in_ext_code=" + string.Join(",", extCodeList);
|
||||
var 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"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
{
|
||||
return list;
|
||||
}
|
||||
|
||||
if (!html.Contains("data"))
|
||||
return list;
|
||||
|
||||
var jArr = JObject.Parse(html)["data"];
|
||||
if (jArr.Count() == 0)
|
||||
return list;
|
||||
|
||||
return JsonHelper.DeserializeJsonToList<TemuDBExtCodePriceInfo>(jArr.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public class PriceCheckConfig
|
||||
|
||||
Reference in new issue
Block a user