产品库手动更新sku下架情况

This commit is contained in:
wule committed 2026-02-26 11:56:00 +08:00
1 parent 1b2b6bb553
commit 30efe8fccb
25 files changed
+2214 -490

No files matched your search

@@ -163,6 +163,7 @@ namespace TemuKJD.WXForms.ProductForms
this.chkSkipUploaded.CheckedChanged -= chkSkipUploaded_CheckedChanged;
this.chkUpDraft.CheckedChanged -= chkUpDraft_CheckedChanged;
this.chkPreSale.CheckedChanged -= chkPreSale_CheckedChanged;
this.txtTitleHeadWord.TextChanged -= txtTitleHeadWord_TextChanged;
this.txtPreDays.Text = wxUploadRule.PreSaleDays.ParseToString();
this.txtReplaceText.Text = wxUploadRule.FilterWords.ParseToString();
@@ -173,6 +174,7 @@ namespace TemuKJD.WXForms.ProductForms
this.chkSkipUploaded.Checked = wxUploadRule.SkipUploaded.ParseToBool();
this.chkUpDraft.Checked = wxUploadRule.UpDraft.ParseToBool();
this.chkPreSale.Checked = wxUploadRule.IsPreSale.ParseToBool();
this.txtTitleHeadWord.Text = wxUploadRule.TitleHeadWords.ParseToString();
this.txtPreDays.TextChanged += txtPreDays_TextChanged;
this.txtReplaceText.TextChanged += txtReplaceText_TextChanged;
@@ -183,6 +185,7 @@ namespace TemuKJD.WXForms.ProductForms
this.chkSkipUploaded.CheckedChanged += chkSkipUploaded_CheckedChanged;
this.chkUpDraft.CheckedChanged += chkUpDraft_CheckedChanged;
this.chkPreSale.CheckedChanged += chkPreSale_CheckedChanged;
this.txtTitleHeadWord.TextChanged += txtTitleHeadWord_TextChanged;
this.lblWaitToUp.Text = "待上传 " + lstTemuDBProductSelect.Count + " 件";
@@ -963,8 +966,9 @@ namespace TemuKJD.WXForms.ProductForms
}
KJDDBProduct kjdDbProd = selectProd.kjdDbProduct;
string errStr = "";
if (kjdDbProd == null)
kjdDbProd = GetProductDetail(selectProd.out_product_Id.ToString());
kjdDbProd = GetProductDetail(selectProd.out_product_Id.ToString(), out errStr);
if (kjdDbProd == null || kjdDbProd.id == 0)
{
if (kjdDbProd?.id == 0)
@@ -1135,10 +1139,15 @@ namespace TemuKJD.WXForms.ProductForms
}));
}
public static KJDDBProduct GetProductDetail(string prodDbId)
public static KJDDBProduct GetProductDetail(string prodDbId, out string errMsg)
{
errMsg = "";
if (string.IsNullOrEmpty(prodDbId))
{
errMsg = "产品编号为空";
return new KJDDBProduct();
}
List<KJDDBProduct> list = new List<KJDDBProduct>();
@@ -1148,6 +1157,8 @@ namespace TemuKJD.WXForms.ProductForms
data = UserLogin.GetSignaturex() + "&search_db_ids=" + prodDbId;
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"))
@@ -1556,8 +1567,13 @@ namespace TemuKJD.WXForms.ProductForms
token = new WxApiBLL().GetRandomWxToken();
#region 设置标题
upProdInitParam.product.info.title = dbProd.product_name.IsNullOrEmpty() ? prodInfo.detail.goods_name : dbProd.product_name;
upProdParam.product.info.title = dbProd.product_name.IsNullOrEmpty() ? prodInfo.detail.goods_name : dbProd.product_name;
string prodTitle = dbProd.product_name.IsNullOrEmpty() ? prodInfo.detail.goods_name : dbProd.product_name;
upProdInitParam.product.info.title = prodTitle;
//标题前缀
if (!string.IsNullOrEmpty(wxUploadRule.TitleHeadWords))
upProdInitParam.product.info.title = wxUploadRule.TitleHeadWords + upProdInitParam.product.info.title;
upProdParam.product.info.title = upProdInitParam.product.info.title;
upProdParam.sessionInfo.sessionId = upProdInitParam.product.sessionId;
#endregion
@@ -1928,8 +1944,10 @@ namespace TemuKJD.WXForms.ProductForms
var bound = GlobalConfig.WxCatBoundList.FirstOrDefault(b => b.leaf_id == leafCatId);
if (bound == null)
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"获取类目保证金失败\"}";
if (bound.cat_bound > txtFilterBound.Text.Trim().ParseToInt())
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目保证金(" + bound.cat_bound + ")超过过滤限制(" + txtFilterBound.Text.Trim().ParseToInt() + ")\"}";
var maxBount = txtFilterBoundMax.Text.Trim().ParseToInt();
var minBount = txtFilterBoundMin.Text.Trim().ParseToInt();
if (bound.cat_bound < minBount || bound.cat_bound > maxBount )
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目保证金(" + bound.cat_bound + ")超过过滤限制(" + minBount + "-" + maxBount + ")\"}";
// 检测是否有类目上传权限
var cateUpCheckRst = WXUpload.batchCheckCategoryRelation(shop, leafCatId);
@@ -2611,7 +2629,7 @@ namespace TemuKJD.WXForms.ProductForms
//if (attr.name == "ISBN版号/CN刊号")
// attrValue = "9787922575016";
if (attr.name == "书名")
attrValue = upProdParam.product.info.title;
attrValue = prodTitle;
if (attr.name == "是否为单一书号丛书")
attrValue = "是";
if (attr.name == "图书册数")
@@ -2626,7 +2644,7 @@ namespace TemuKJD.WXForms.ProductForms
if (upProdParam.product.info.category.FirstOrDefault()?.name == "食品饮料" || prodInfo.detail.cats.FirstOrDefault() == "食品饮料")
{
if (attr.name == "食品名称")
attrValue = upProdParam.product.info.title;
attrValue = prodTitle;
if (attr.name == "生产企业名称")
attrValue = "见包装";
if (attr.name == "食品生产许可证编号")
@@ -2981,6 +2999,8 @@ namespace TemuKJD.WXForms.ProductForms
skuParam.skuKey.productKey.outProductId = upProdParam.product.info.spuCode;
// 库存
skuParam.productSkuInfo.stockInfo = new stockInfoParam() { stockNum = defaultAddPriceRule.StockNum };
if (skuInfo.quantity.ParseToInt() == 0)
skuParam.productSkuInfo.stockInfo.stockNum = 0;
skuParam.productSkuInfo.saleParam = new List<saleParamParam>();
foreach (var specInfo in skuInfo.spec)
{
@@ -3016,6 +3036,8 @@ namespace TemuKJD.WXForms.ProductForms
}
skuParam.productSkuInfo.skuDeliverInfo = new skuDeliverInfoParam();
skuParam.productSkuInfo.stockDiff = new stockDiffParam() { diffType = 1, num = defaultAddPriceRule.StockNum };
if (skuInfo.quantity.ParseToInt() == 0)
skuParam.productSkuInfo.stockDiff.num = 0;
skuParam.status = 5;
}
#endregion
@@ -3122,8 +3144,8 @@ namespace TemuKJD.WXForms.ProductForms
}
string foodName = "食品名称:";
string companyName = "生产企业名称:见包装";
string foodName = "食品名称:" + prodTitle;
string companyName = "生产商名称:中国地区食品厂";
string SCID = "食品生产许可证编号:SC10241162100670";
string GBID = "产品标准号:GB 2726";
string ExpDate = "保质期:30天";
@@ -3139,11 +3161,11 @@ namespace TemuKJD.WXForms.ProductForms
{
if (propParam.categorys[0].name.Contains("食品名称"))
foodName = "食品名称:" + propParam.categorys[1].name;
else if (propParam.categorys[0].name.Contains("生产企业名称"))
companyName = "生产企业名称:" + propParam.categorys[1].name;
else if (propParam.categorys[0].name.Contains("食品生产许可证编号") && propParam.categorys[1].name != "见包装")
else if (propParam.categorys[0].name.Contains("生产企业名称") && !propParam.categorys[1].name.Contains("见包装") && !propParam.categorys[1].name.Contains("见外包装"))
companyName = "生产商名称:" + propParam.categorys[1].name;
else if (propParam.categorys[0].name.Contains("食品生产许可证编号") && !propParam.categorys[1].name.Contains("见包装") && !propParam.categorys[1].name.Contains("见外包装"))
SCID = "食品生产许可证编号:" + propParam.categorys[1].name;
else if (propParam.categorys[0].name.Contains("产品标准号") && propParam.categorys[1].name != "见包装")
else if (propParam.categorys[0].name.Contains("产品标准号") && !propParam.categorys[1].name.Contains("见包装") && !propParam.categorys[1].name.Contains("见外包装"))
GBID = "产品标准号:" + propParam.categorys[1].name;
else if (propParam.categorys[0].name.Contains("保质期"))
ExpDate = "保质期:" + propParam.categorys[1].name;
@@ -3704,6 +3726,7 @@ namespace TemuKJD.WXForms.ProductForms
data += "&product_get_type=" + cmbSourceType.Text.Trim();
data += "&wx_safe_status=" + cmbWxSafe.Text.Trim().Replace("安全+未校验", "安全商品,未校验");
data += "&is_supplier_prod_ok=" + cmbJstInitSet.Text.Trim();
data += "&product_name=" + txtSearchGoodsName.Text.Trim();
}));
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
@@ -3855,6 +3878,7 @@ namespace TemuKJD.WXForms.ProductForms
{
txtIdFilter.Text = "";
txtExtCodeFilter.Text = "";
txtSearchGoodsName.Text = "";
cmbGroupFilter.Text = "";
cmbCateFilter1.Text = "";
cmbWxSafe.Text = "安全+未校验";
@@ -4088,8 +4112,9 @@ namespace TemuKJD.WXForms.ProductForms
private void btnFilterBound_Click(object sender, EventArgs e)
{
var bound = txtFilterBound.Text.Trim().ParseToInt();
var cates = GlobalConfig.WxCatBoundList.Where(b => b.cat_bound <= bound);
var boundMax = txtFilterBoundMax.Text.Trim().ParseToInt();
var boundMin = txtFilterBoundMin.Text.Trim().ParseToInt();
var cates = GlobalConfig.WxCatBoundList.Where(b => b.cat_bound <= boundMax && b.cat_bound >= boundMin);
lstTemuDBProductSelect.RemoveAll(p => !cates.Any(c => c.leaf_id.ParseToString() == p.wx_cat_leaf));
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_db_prod_upload_list", this.lstTemuDBProductSelect);
@@ -4213,6 +4238,10 @@ namespace TemuKJD.WXForms.ProductForms
}
}
private void txtTitleHeadWord_TextChanged(object sender, EventArgs e)
{
wxUploadRule.TitleHeadWords = txtTitleHeadWord.Text.Trim();
}
}
public class WXUpload
@@ -4597,5 +4626,6 @@ Content-Type: application/octet-stream
public bool SkipUploaded { get; set; } = true;
public bool UpDraft { get; set; } = false;
public bool IsPreSale { get; set; } = false;
public string TitleHeadWords { get; set; } = "";
}
}