调整备货逻辑不允许品质分过低的商品自动备货(完成但尚未测试) 注释无用的相关接口(原小奶狗,小奶兔)
This commit is contained in:
1 parent
fceead357f
commit
8445ec1828
19 files changed
+865
-540
No files matched your search
@@ -291,6 +291,7 @@ namespace TemuKJD.KJDForms.ProductForms
|
||||
if (jsonStr.Contains("当前操作人数太多,请稍后重试") && tryCount < 5)
|
||||
{
|
||||
tryCount++;
|
||||
Thread.Sleep(Randomx.GetId(500,1000));
|
||||
goto tryAgain;
|
||||
}
|
||||
if (jsonStr.Contains("当前操作人数太多,请稍后重试"))
|
||||
@@ -306,6 +307,7 @@ namespace TemuKJD.KJDForms.ProductForms
|
||||
continue;
|
||||
}
|
||||
|
||||
string snTag = BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now).ToString();
|
||||
if (jsonStr.Contains("\"success\":true"))
|
||||
{
|
||||
var jArr = new JArray();
|
||||
@@ -323,6 +325,7 @@ namespace TemuKJD.KJDForms.ProductForms
|
||||
TemuPriceAdjustInfo pInfo = JsonHelper.DeserializeJsonToObject<TemuPriceAdjustInfo>(sItem); // 反序列化得到类
|
||||
if (pInfo != null && !lstPriceAdjustInfo.Any(a=>a.priceOrderSn == pInfo.priceOrderSn))
|
||||
{
|
||||
pInfo.snTag = snTag;
|
||||
lstPriceAdjustInfo.Add(pInfo);
|
||||
|
||||
//string url = pInfo.image.Replace("https", "http");
|
||||
@@ -335,7 +338,8 @@ namespace TemuKJD.KJDForms.ProductForms
|
||||
pInfo.supplierId,
|
||||
shop.ShopAccount, // pInfo.supplierName, // 列表里取不到,这里取shop里的
|
||||
pInfo.priceOrderSn,
|
||||
null,//image, // skc图片
|
||||
pInfo.image.Replace("https", "http"),
|
||||
defaultBitmap,//image, // skc图片
|
||||
pInfo.productId,
|
||||
pInfo.skcId,
|
||||
pInfo.productName + "\r\n" + pInfo.skuSpecs, // 商品标题+sku名称
|
||||
@@ -353,6 +357,10 @@ namespace TemuKJD.KJDForms.ProductForms
|
||||
}));
|
||||
}
|
||||
}
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
ShowDgvImg();
|
||||
}));
|
||||
|
||||
int total = BaseRegex.GetStringJson(ref jsonStr, "total").ParseToInt();
|
||||
totalPage = Math.Ceiling(total / 10.0).ParseToInt();
|
||||
@@ -513,8 +521,13 @@ namespace TemuKJD.KJDForms.ProductForms
|
||||
Thread.Sleep(200 + Randomx.GetId(100));
|
||||
|
||||
//var adjustLst = lstPriceAdjustInfo.Where(a => a.skuIds == priceAdjust.skuIds && a.isRefuseAdjust == false).ToList();
|
||||
var adjustLst = lstPriceAdjustInfo.Where(a =>
|
||||
priceAdjust.skuInfoItemList.Any(sku => a.skuIds.Contains(sku.productSkuId.ToString())) && a.isRefuseAdjust == false).ToList();
|
||||
//var adjustLst = lstPriceAdjustInfo.Where(a =>
|
||||
// priceAdjust.skuInfoItemList.Any(sku => a.skuIds.Contains(sku.productSkuId.ToString())) && a.isRefuseAdjust == false).ToList();
|
||||
// 同一页的一起提交
|
||||
var adjustLst = lstPriceAdjustInfo.Where(a =>
|
||||
a.snTag == priceAdjust.snTag && // 选中商品的同页商品
|
||||
lstPriceAdjust.Any(s => s.skcId == a.skcId) && // 该商品也需要有同skc商品被选中
|
||||
a.isRefuseAdjust == false).ToList(); // 没有被取消调价过
|
||||
var adjustStrLst = adjustLst.Select(s => s.id.ParseToString()).ToList();
|
||||
|
||||
|
||||
@@ -526,6 +539,13 @@ namespace TemuKJD.KJDForms.ProductForms
|
||||
foreach(var adj in adjustLst)
|
||||
{
|
||||
adj.isRefuseAdjust = true;
|
||||
var rs = this.dgvAdjust.Rows.Cast<DataGridViewRow>().Where(r =>
|
||||
r.Cells["colPriceOrderSn"].Value.ToString() == adj.priceOrderSn.ParseToString());
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
foreach(var r in rs)
|
||||
r.Cells["colMsg"].Value = "已拒绝跟价";
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -598,5 +618,57 @@ namespace TemuKJD.KJDForms.ProductForms
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Bitmap defaultBitmap = new Bitmap(80, 80);
|
||||
void ShowDgvImg()
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
foreach (DataGridViewRow row in this.dgvAdjust.Rows)
|
||||
{
|
||||
if (row.Index > 0 && row.Cells["colProductSkcPic"].Displayed == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
row.Cells["colProductSkcPic"].Value = defaultBitmap;
|
||||
}));
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (row.Cells["colProductSkcPic"].Value != null && row.Cells["colProductSkcPic"].Value != defaultBitmap)
|
||||
continue;
|
||||
|
||||
Image image = null;
|
||||
string imgUrl = row.Cells["colImgUrl"]?.Value.ParseToString();
|
||||
string getImgError = "";
|
||||
if (!string.IsNullOrWhiteSpace(imgUrl))
|
||||
image = GetHtml.GetUrlImg(imgUrl, out getImgError);
|
||||
if (!string.IsNullOrEmpty(getImgError))
|
||||
BaseMsgForm.ShowError(getImgError);
|
||||
|
||||
try
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
row.Cells["colProductSkcPic"].Value = image;
|
||||
}));
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void dgvAdjust_Scroll(object sender, ScrollEventArgs e)
|
||||
{
|
||||
ShowDgvImg();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user