选品上传翻译商品标题 库存上传逻辑优化提高直接上传成功率 拼多多优化限时限量优惠结束逻辑

This commit is contained in:
wule committed 2025-10-24 18:15:17 +08:00
1 parent 73f9fcd8bc
commit ab33a9c0c0
19 files changed
+856 -320

No files matched your search

@@ -1396,29 +1396,33 @@ namespace TemuKJD.KJDForms.AdminForms
return filterProdName != RestoreProductName(filterProdName);
}
string RestoreProductName(string pName)
public static string RestoreProductName(string pName)
{
string checkChineseName = pName.Replace("适合不同的搭配风格", "").Replace("个", "").Replace("适合不同的搭配场景", "");
bool containsChinese = Regex.IsMatch(checkChineseName, @"[\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF]");
string newPName = pName;
if (pName.EndsWith("适合不同的搭配风格") && pName.IndexOf("个") < 4 && pName.IndexOf("个") > 0)
if ((pName.EndsWith("适合不同的搭配风格") || pName.EndsWith("适合不同的搭配场景")) && pName.IndexOf("个") < 4 && pName.IndexOf("个") > 0)
{
var headword = pName.Substring(0, pName.IndexOf("个") + 1);
newPName = pName.Substring(pName.IndexOf("个") + "个".Length);
if (containsChinese)
newPName = newPName.Replace("适合不同的搭配风格", "适合" + headword + "不同的搭配风格");
newPName = newPName.Replace("适合不同的搭配风格", "适合" + headword + "不同的搭配风格")
.Replace("适合不同的搭配场景", "适合" + headword + "不同的搭配场景");
else
newPName = newPName.Replace("适合不同的搭配风格", "Suitable for " + headword + " different matching styles").Trim();
newPName = newPName.Replace("适合不同的搭配风格", "Suitable for " + headword + " different matching styles").Trim()
.Replace("适合不同的搭配场景", "Suitable for " + headword + " different matching scenarios").Trim();
}
if (pName.EndsWith("适合不同的搭配风格") && pName.IndexOf("pcs") < 4 && pName.IndexOf("pcs") > 0)
if ((pName.EndsWith("适合不同的搭配风格") || 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);
if (containsChinese)
newPName = newPName.Replace("适合不同的搭配风格", "适合" + headword + "不同的搭配风格");
newPName = newPName.Replace("适合不同的搭配风格", "适合" + headword + "不同的搭配风格")
.Replace("适合不同的搭配场景", "适合" + headword + "不同的搭配场景");
else
newPName = newPName.Replace("适合不同的搭配风格", "Suitable for " + headword + " different matching styles").Trim();
newPName = newPName.Replace("适合不同的搭配风格", "Suitable for " + headword + " different matching styles").Trim()
.Replace("适合不同的搭配场景", "Suitable for " + headword + " different matching scenarios").Trim();
}
return newPName;
}
@@ -110,6 +110,7 @@
this.chkNoSubSa = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chkUploadProd = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chkAddPrice = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chkEnglishProdName = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.pbLoading = new System.Windows.Forms.PictureBox();
this.lblCustomImgNum = new System.Windows.Forms.Label();
@@ -146,6 +147,8 @@
this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.pnlError = new System.Windows.Forms.Panel();
this.lblError = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -172,6 +175,7 @@
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numSeconds)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dgvSelectProduct)).BeginInit();
this.pnlError.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
@@ -216,6 +220,7 @@
this.splitContainer1.Panel1.Controls.Add(this.btnDel);
this.splitContainer1.Panel1.Controls.Add(this.tableLayoutPanel1);
this.splitContainer1.Panel1.Controls.Add(this.chkAddPrice);
this.splitContainer1.Panel1.Controls.Add(this.chkEnglishProdName);
//
// splitContainer1.Panel2
//
@@ -228,7 +233,7 @@
//
this.chkLongTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.chkLongTitle.AutoSize = true;
this.chkLongTitle.Location = new System.Drawing.Point(1276, 71);
this.chkLongTitle.Location = new System.Drawing.Point(1276, 73);
this.chkLongTitle.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.chkLongTitle.Name = "chkLongTitle";
this.chkLongTitle.Size = new System.Drawing.Size(96, 21);
@@ -240,7 +245,7 @@
//
this.chkSameExtcodeRandomMainImg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.chkSameExtcodeRandomMainImg.AutoSize = true;
this.chkSameExtcodeRandomMainImg.Location = new System.Drawing.Point(1372, 71);
this.chkSameExtcodeRandomMainImg.Location = new System.Drawing.Point(1372, 73);
this.chkSameExtcodeRandomMainImg.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.chkSameExtcodeRandomMainImg.Name = "chkSameExtcodeRandomMainImg";
this.chkSameExtcodeRandomMainImg.Size = new System.Drawing.Size(188, 21);
@@ -251,11 +256,12 @@
// lblSkuRandomLetterNotes
//
this.lblSkuRandomLetterNotes.AutoSize = true;
this.lblSkuRandomLetterNotes.Font = new System.Drawing.Font("微软雅黑", 8F);
this.lblSkuRandomLetterNotes.ForeColor = System.Drawing.SystemColors.MenuHighlight;
this.lblSkuRandomLetterNotes.Location = new System.Drawing.Point(974, 75);
this.lblSkuRandomLetterNotes.Location = new System.Drawing.Point(959, 75);
this.lblSkuRandomLetterNotes.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.lblSkuRandomLetterNotes.Name = "lblSkuRandomLetterNotes";
this.lblSkuRandomLetterNotes.Size = new System.Drawing.Size(150, 17);
this.lblSkuRandomLetterNotes.Size = new System.Drawing.Size(138, 16);
this.lblSkuRandomLetterNotes.TabIndex = 641;
this.lblSkuRandomLetterNotes.Text = "备注:当前特殊字符包括--";
//
@@ -1292,6 +1298,20 @@
this.chkAddPrice.Text = "加价";
this.chkAddPrice.UseVisualStyleBackColor = true;
//
// chkEnglishProdName
//
this.chkEnglishProdName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.chkEnglishProdName.AutoSize = true;
this.chkEnglishProdName.Checked = true;
this.chkEnglishProdName.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkEnglishProdName.Location = new System.Drawing.Point(1179, 73);
this.chkEnglishProdName.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.chkEnglishProdName.Name = "chkEnglishProdName";
this.chkEnglishProdName.Size = new System.Drawing.Size(99, 21);
this.chkEnglishProdName.TabIndex = 679;
this.chkEnglishProdName.Text = "英文标题翻译";
this.chkEnglishProdName.UseVisualStyleBackColor = true;
//
// splitContainer2
//
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -1302,6 +1322,7 @@
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.pnlError);
this.splitContainer2.Panel1.Controls.Add(this.pbLoading);
this.splitContainer2.Panel1.Controls.Add(this.lblCustomImgNum);
this.splitContainer2.Panel1.Controls.Add(this.numSeconds);
@@ -1697,6 +1718,26 @@
this.statusBar.Size = new System.Drawing.Size(1558, 25);
this.statusBar.TabIndex = 5;
//
// pnlError
//
this.pnlError.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.pnlError.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(244)))), ((int)(((byte)(224)))));
this.pnlError.Controls.Add(this.lblError);
this.pnlError.Location = new System.Drawing.Point(650, 95);
this.pnlError.Name = "pnlError";
this.pnlError.Size = new System.Drawing.Size(259, 120);
this.pnlError.TabIndex = 488;
this.pnlError.Visible = false;
//
// lblError
//
this.lblError.ForeColor = System.Drawing.Color.Red;
this.lblError.Location = new System.Drawing.Point(32, 26);
this.lblError.Name = "lblError";
this.lblError.Size = new System.Drawing.Size(200, 69);
this.lblError.TabIndex = 0;
this.lblError.Text = "错误tip";
//
// DbProductSelectListManageForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -1740,6 +1781,7 @@
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numSeconds)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dgvSelectProduct)).EndInit();
this.pnlError.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -1854,5 +1896,8 @@
private System.Windows.Forms.Label lblSkuRandomLetterNotes;
private UserComponent.UcCheckBox chkSameExtcodeRandomMainImg;
private UserComponent.UcCheckBox chkLongTitle;
private UserComponent.UcCheckBox chkEnglishProdName;
private System.Windows.Forms.Panel pnlError;
private System.Windows.Forms.Label lblError;
}
}
@@ -1297,6 +1297,10 @@ namespace TemuKJD.KJDForms.ProductSelectForms
region2Id = prodInfo.productWhExtAttr.productOrigin.region2Id,
},
};
if (prodParam.productWhExtAttrReq.productOrigin.countryShortName == "CN" && prodParam.productWhExtAttrReq.productOrigin.region2Id == null)
{
prodParam.productWhExtAttrReq.productOrigin.region2Id = 43000000000006; //广东省
}
prodParam.sensitiveTransNormalFileReqs = prodInfo.productWhExtAttr.sensitiveTransNormalFiles;
prodParam.showSizeTemplateIds = prodInfo.showSizeTemplateIds != null ? prodInfo.showSizeTemplateIds : new List<long?>();
prodParam.sizeTemplateIds = prodInfo.sizeTemplateIds != null ? prodInfo.sizeTemplateIds : new List<long?>();
@@ -1411,28 +1415,37 @@ namespace TemuKJD.KJDForms.ProductSelectForms
skuItem.extCode = skuInfo.extCode;
skuItem.productSkuAccessoriesReq = new ProductSkuAccessoriesReq()
{
productSkuAccessories = skuInfo.productSkuSaleExtAttr.productSkuAccessories?.productSkuAccessories,
productSkuAccessories = skuInfo.productSkuSaleExtAttr.productSkuAccessories?.productSkuAccessories == null ?
new List<object>() : skuInfo.productSkuSaleExtAttr.productSkuAccessories?.productSkuAccessories,
};
skuItem.productSkuId = 0;
skuItem.productSkuMultiPackReq = new ProductSkuMultiPackReq()
//skuItem.productSkuMultiPackReq = new ProductSkuMultiPackReq()
//{
// skuClassification = skuInfo.productSkuMultiPack.skuClassification,
// numberOfPieces = skuInfo.productSkuMultiPack.numberOfPieces,
// pieceUnitCode = skuInfo.productSkuMultiPack.pieceUnitCode,
// productSkuNetContentReq = JsonHelper.DeserializeJsonToObject<ProductSkuNetContentReq>(
// JsonHelper.SerializeObject(skuInfo.productSkuMultiPack.productSkuNetContent)),
//};
skuItem.productSkuMultiPackReq = new ProductSkuMultiPackReq2()
{
skuClassification = skuInfo.productSkuMultiPack.skuClassification,
numberOfPieces = skuInfo.productSkuMultiPack.numberOfPieces,
pieceUnitCode = skuInfo.productSkuMultiPack.pieceUnitCode,
productSkuNetContentReq = JsonHelper.DeserializeJsonToObject<ProductSkuNetContentReq>(
JsonHelper.SerializeObject(skuInfo.productSkuMultiPack.productSkuNetContent)),
mixedType = skuInfo.productSkuMultiPack.mixedType,
numberOfPiecesNew = skuInfo.productSkuMultiPack.numberOfPiecesNew,
pieceNewUnitCode = skuInfo.productSkuMultiPack.pieceNewUnitCode,
totalNetContent = JsonHelper.DeserializeJsonToObject<ProductSkuNetContentReq>(
JsonHelper.SerializeObject(skuInfo.productSkuMultiPack.totalNetContent)),
individuallyPacked = skuInfo.productSkuMultiPack.individuallyPacked,
};
if (skuInfo.productSkuMultiPack.individuallyPacked != null)
// 如果母店为多件但没有指定是否独立包装,强制指定非独立包装
var packReq = skuItem.productSkuMultiPackReq as ProductSkuMultiPackReq2;
if (packReq.skuClassification > 1 && packReq.individuallyPacked == null)
{
skuItem.productSkuMultiPackReq = new ProductSkuMultiPackReq2()
{
skuClassification = skuInfo.productSkuMultiPack.skuClassification,
numberOfPieces = skuInfo.productSkuMultiPack.numberOfPieces,
pieceUnitCode = skuInfo.productSkuMultiPack.pieceUnitCode,
productSkuNetContentReq = JsonHelper.DeserializeJsonToObject<ProductSkuNetContentReq>(
JsonHelper.SerializeObject(skuInfo.productSkuMultiPack.productSkuNetContent)),
individuallyPacked = skuInfo.productSkuMultiPack.individuallyPacked.ParseToInt(),
};
packReq.individuallyPacked = 0;
}
if (chkChangeSizeAndNumber.Checked)
{
@@ -1497,13 +1510,16 @@ namespace TemuKJD.KJDForms.ProductSelectForms
skuItem.productSkuThumbUrlI18nReqs = skuInfo.productSkuThumbUrlI18nVOList;
skuItem.productSkuUsSuggestedPriceReq = JsonHelper.DeserializeJsonToObject<ProductSkuUsSuggestedPriceReq>(
JsonHelper.SerializeObject(skuInfo.productSkuUsSuggestedPrice));
//敏感属性
skuItem.productSkuWhExtAttrReq = new ProductSkuWhExtAttrReq()
{
productSkuBarCodeReqs = skuInfo.productSkuWhExtAttr.productSkuBarCodes,
productSkuBarCodeReqs = skuInfo.productSkuWhExtAttr.productSkuBarCodes == null ? new List<object>() : skuInfo.productSkuWhExtAttr.productSkuBarCodes,
productSkuSensitiveAttrReq = new ProductSkuSensitiveAttrReq()
{
isSensitive = skuInfo.productSkuWhExtAttr.productSkuSensitiveAttr.isSensitive,
sensitiveList = skuInfo.productSkuWhExtAttr.productSkuSensitiveAttr.sensitiveList,
//isSensitive = skuInfo.productSkuWhExtAttr.productSkuSensitiveAttr.isSensitive,
//sensitiveList = skuInfo.productSkuWhExtAttr.productSkuSensitiveAttr.sensitiveList,
isSensitive = 0,
sensitiveList = new List<object>(),
},
productSkuSensitiveLimitReq = JsonHelper.DeserializeJsonToObject<ProductSkuSensitiveLimitReq>(
JsonHelper.SerializeObject(skuInfo.productSkuWhExtAttr.productSkuSensitiveLimit)),
@@ -1512,6 +1528,21 @@ namespace TemuKJD.KJDForms.ProductSelectForms
productSkuWeightReq = JsonHelper.DeserializeJsonToObject<ProductSkuWeightReq>(
JsonHelper.SerializeObject(skuInfo.productSkuWhExtAttr.productSkuWeight)),
};
if (skuItem.productSkuWhExtAttrReq.productSkuSensitiveAttrReq.sensitiveList == null)
skuItem.productSkuWhExtAttrReq.productSkuSensitiveAttrReq.sensitiveList = new List<object>();
// 如果是液体,赋默认值1毫升(暂时注释)
//if (skuItem.productSkuWhExtAttrReq.productSkuSensitiveAttrReq.sensitiveList.Any(s => s.ParseToInt() == 140001))
//{
// if (skuItem.productSkuWhExtAttrReq.productSkuSensitiveLimitReq == null)
// {
// skuItem.productSkuWhExtAttrReq.productSkuSensitiveLimitReq = new ProductSkuSensitiveLimitReq();
// }
// if (skuItem.productSkuWhExtAttrReq.productSkuSensitiveLimitReq.maxLiquidCapacityHp == null)
// {
// skuItem.productSkuWhExtAttrReq.productSkuSensitiveLimitReq.maxLiquidCapacityHp = 1000;
// }
//}
if (chkChangeSizeAndNumber.Checked) // 修改包装尺寸和单品数量
{
skuItem.productSkuWhExtAttrReq.productSkuVolumeReq.len = len * 10;
@@ -1670,6 +1701,85 @@ namespace TemuKJD.KJDForms.ProductSelectForms
//var length = prodParam.productName.Length;
//var length2 = Encoding.GetEncoding("gb2312").GetBytes(prodParam.productName).Length;
//string data = "{'text':'" + prodParam.productName + "','lan':'ch'}";
//data = "{'text':Hello,'lan':'en'}";
//本地翻译库,速度慢翻译不够准
//try
//{
// var client = new System.Net.Http.HttpClient();
// var content = new System.Net.Http.FormUrlEncodedContent(new[]
// {
// new KeyValuePair<string, string>("text", prodParam.productName),
// //new KeyValuePair<string, string>("lan", "en")
// new KeyValuePair<string, string>("lan", "ch")
// });
// var t = client.PostAsync("http://127.0.0.1:5690/report", content);
// t.Wait();
// var t1 = t.Result.Content.ReadAsStringAsync();
// t1.Wait();
// var rstText = t1.Result;
// prodParam.productI18nReqs = new List<productI18nParam>();
// productI18nParam productI18nEn = new productI18nParam
// {
// language = "en",
// productName = rstText,
// };
// ////测试得到英文标题最多可输入500个字符
// //while (productI18nEn.productName.Length < 501)
// // productI18nEn.productName += "a";
// //var length = prodParam.productName.Length;
// //prodParam.productI18nReqs.Add(productI18nEn);
//}
//catch (Exception ex)
//{
//}
//翻译英文标题
if (chkEnglishProdName.Checked)
{
var realName = AdminProductPriceCheckForm.RestoreProductName(prodParam.productName);
var transRst = translate(shop, realName);
var transRstTxt = BaseRegex.GetStringJson(ref transRst, "dst");
if (!string.IsNullOrEmpty(transRstTxt))
{
var transEndWords = "";
if (realName.EndsWith("不同的搭配场景") || realName.EndsWith("不同的搭配风格") ||
realName.EndsWith("different matching scenarios") || realName.EndsWith("different matching styles"))
{
transEndWords = transRstTxt.Substring(Math.Max(0, transRstTxt.LastIndexOf(',')));
}
while ((transRstTxt.Replace(transEndWords, "") + transEndWords).Length > 500)
{
transRstTxt = transRstTxt.Substring(0, Math.Max(1, transRstTxt.LastIndexOf(',')));
}
if (!string.IsNullOrEmpty(transEndWords))
transRstTxt = (transRstTxt.Replace(transEndWords, "") + transEndWords);
prodParam.productI18nReqs = new List<productI18nParam>();
productI18nParam productI18nEn = new productI18nParam
{
language = "en",
productName = transRstTxt,
};
prodParam.productI18nReqs.Add(productI18nEn);
}
else
{
Invoke(new Action(() =>
{
this.pnlError.Visible = true;
this.lblError.Text = "调用翻译功能失败……";
}));
Task.Run(() =>
{
Thread.Sleep(5000);
this.pnlError.Visible = false;
});
}
}
html = SaveDraft(shop, prodParam.productDraftId.ToString(), prodParam);
if (html.Contains("\"success\":true"))
{
@@ -2036,6 +2146,18 @@ Content-Disposition: form-data; name=""upload_sign""
return HttpResponseBLL.PostResponseUpload(shop, url, body, refere, boundary);
}
private string translate(ShopLoginInfo shop, string text)
{
string url = "https://fanyi.baidu.com/ait/text/translate";
string tick = BaseClass.DateTimeToTimestampSeconds(DateTime.Now).ToString();
string body = "{\"isAi\":false,\"sseStartTime\":" + tick + ",\"query\":\"" + text + "\"," +
"\"from\":\"zh\",\"to\":\"en\",\"reference\":\"\",\"corpusIds\":[],\"needPhonetic\":true,\"domain\":\"common\",\"detectLang\":\"\"," +
"\"isIncognitoAI\":false,\"milliTimestamp\":" + tick + "}";
string refere = "";
return HttpResponseBLL.BaiduPostResponse(shop, url, body, refere);
}
private void btnSetSubSa_Click(object sender, EventArgs e)
{
@@ -231,11 +231,12 @@
// label14
//
this.label14.AutoSize = true;
this.label14.Font = new System.Drawing.Font("微软雅黑", 8F);
this.label14.ForeColor = System.Drawing.SystemColors.MenuHighlight;
this.label14.Location = new System.Drawing.Point(974, 75);
this.label14.Location = new System.Drawing.Point(959, 75);
this.label14.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(307, 17);
this.label14.Size = new System.Drawing.Size(277, 16);
this.label14.TabIndex = 640;
this.label14.Text = "备注:新的商品上传货号为固定前缀 EC + 上家商品SKC";
//
@@ -217,16 +217,17 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
if (!string.IsNullOrEmpty(getImgError))
BaseMsgForm.ShowError("图片加载失败" + getImgError);
try
Invoke(new Action(() =>
{
Invoke(new Action(() =>
try
{
row.Cells["colProductSkcPic"].Value = image;
}));
}
catch
{
}
}
catch
{
}
}));
}
});
}
@@ -1165,6 +1166,10 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
region2Id = prodInfo.productWhExtAttr.productOrigin.region2Id,
},
};
if (prodParam.productWhExtAttrReq.productOrigin.countryShortName == "CN" && prodParam.productWhExtAttrReq.productOrigin.region2Id == null)
{
prodParam.productWhExtAttrReq.productOrigin.region2Id = 43000000000006; //广东省
}
prodParam.sensitiveTransNormalFileReqs = prodInfo.productWhExtAttr.sensitiveTransNormalFiles;
prodParam.showSizeTemplateIds = prodInfo.showSizeTemplateIds != null ? prodInfo.showSizeTemplateIds : new List<long?>();
prodParam.sizeTemplateIds = prodInfo.sizeTemplateIds != null ? prodInfo.sizeTemplateIds : new List<long?>();
@@ -1281,28 +1286,37 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
skuItem.extCode = skuInfo.extCode;
skuItem.productSkuAccessoriesReq = new ProductSkuAccessoriesReq()
{
productSkuAccessories = skuInfo.productSkuSaleExtAttr.productSkuAccessories?.productSkuAccessories,
productSkuAccessories = skuInfo.productSkuSaleExtAttr.productSkuAccessories?.productSkuAccessories == null ?
new List<object>() : skuInfo.productSkuSaleExtAttr.productSkuAccessories?.productSkuAccessories,
};
skuItem.productSkuId = 0;
skuItem.productSkuMultiPackReq = new ProductSkuMultiPackReq()
//skuItem.productSkuMultiPackReq = new ProductSkuMultiPackReq()
//{
// skuClassification = skuInfo.productSkuMultiPack.skuClassification,
// numberOfPieces = skuInfo.productSkuMultiPack.numberOfPieces,
// pieceUnitCode = skuInfo.productSkuMultiPack.pieceUnitCode,
// productSkuNetContentReq = JsonHelper.DeserializeJsonToObject<ProductSkuNetContentReq>(
// JsonHelper.SerializeObject(skuInfo.productSkuMultiPack.productSkuNetContent)),
//};
skuItem.productSkuMultiPackReq = new ProductSkuMultiPackReq2()
{
skuClassification = skuInfo.productSkuMultiPack.skuClassification,
numberOfPieces = skuInfo.productSkuMultiPack.numberOfPieces,
pieceUnitCode = skuInfo.productSkuMultiPack.pieceUnitCode,
productSkuNetContentReq = JsonHelper.DeserializeJsonToObject<ProductSkuNetContentReq>(
JsonHelper.SerializeObject(skuInfo.productSkuMultiPack.productSkuNetContent)),
skuClassification = skuInfo.productSkuMultiPack.skuClassification,
mixedType = skuInfo.productSkuMultiPack.mixedType,
numberOfPiecesNew = skuInfo.productSkuMultiPack.numberOfPiecesNew,
pieceNewUnitCode = skuInfo.productSkuMultiPack.pieceNewUnitCode,
totalNetContent = JsonHelper.DeserializeJsonToObject<ProductSkuNetContentReq>(
JsonHelper.SerializeObject(skuInfo.productSkuMultiPack.totalNetContent)),
individuallyPacked = skuInfo.productSkuMultiPack.individuallyPacked,
};
if (skuInfo.productSkuMultiPack.individuallyPacked != null)
// 如果母店为多件但没有指定是否独立包装,强制指定非独立包装
var packReq = skuItem.productSkuMultiPackReq as ProductSkuMultiPackReq2;
if (packReq.skuClassification > 1 && packReq.individuallyPacked == null)
{
skuItem.productSkuMultiPackReq = new ProductSkuMultiPackReq2()
{
skuClassification = skuInfo.productSkuMultiPack.skuClassification,
numberOfPieces = skuInfo.productSkuMultiPack.numberOfPieces,
pieceUnitCode = skuInfo.productSkuMultiPack.pieceUnitCode,
productSkuNetContentReq = JsonHelper.DeserializeJsonToObject<ProductSkuNetContentReq>(
JsonHelper.SerializeObject(skuInfo.productSkuMultiPack.productSkuNetContent)),
individuallyPacked = skuInfo.productSkuMultiPack.individuallyPacked.ParseToInt(),
};
packReq.individuallyPacked = 0;
}
if (chkChangeSizeAndNumber.Checked)
{
@@ -1368,13 +1382,16 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
skuItem.productSkuThumbUrlI18nReqs = skuInfo.productSkuThumbUrlI18nVOList;
skuItem.productSkuUsSuggestedPriceReq = JsonHelper.DeserializeJsonToObject<ProductSkuUsSuggestedPriceReq>(
JsonHelper.SerializeObject(skuInfo.productSkuUsSuggestedPrice));
//敏感属性
skuItem.productSkuWhExtAttrReq = new ProductSkuWhExtAttrReq()
{
productSkuBarCodeReqs = skuInfo.productSkuWhExtAttr.productSkuBarCodes,
productSkuBarCodeReqs = skuInfo.productSkuWhExtAttr.productSkuBarCodes == null ? new List<object>() : skuInfo.productSkuWhExtAttr.productSkuBarCodes,
productSkuSensitiveAttrReq = new ProductSkuSensitiveAttrReq()
{
isSensitive = skuInfo.productSkuWhExtAttr.productSkuSensitiveAttr.isSensitive,
sensitiveList = skuInfo.productSkuWhExtAttr.productSkuSensitiveAttr.sensitiveList,
//isSensitive = skuInfo.productSkuWhExtAttr.productSkuSensitiveAttr.isSensitive,
//sensitiveList = skuInfo.productSkuWhExtAttr.productSkuSensitiveAttr.sensitiveList,
isSensitive = 0,
sensitiveList = new List<object>(),
},
productSkuSensitiveLimitReq = JsonHelper.DeserializeJsonToObject<ProductSkuSensitiveLimitReq>(
JsonHelper.SerializeObject(skuInfo.productSkuWhExtAttr.productSkuSensitiveLimit)),
@@ -1383,6 +1400,20 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
productSkuWeightReq = JsonHelper.DeserializeJsonToObject<ProductSkuWeightReq>(
JsonHelper.SerializeObject(skuInfo.productSkuWhExtAttr.productSkuWeight)),
};
if (skuItem.productSkuWhExtAttrReq.productSkuSensitiveAttrReq.sensitiveList == null)
skuItem.productSkuWhExtAttrReq.productSkuSensitiveAttrReq.sensitiveList = new List<object>();
// 如果是液体,赋默认值1毫升(暂时注释)
//if (skuItem.productSkuWhExtAttrReq.productSkuSensitiveAttrReq.sensitiveList.Any(s => s.ParseToInt() == 140001))
//{
// if (skuItem.productSkuWhExtAttrReq.productSkuSensitiveLimitReq == null)
// {
// skuItem.productSkuWhExtAttrReq.productSkuSensitiveLimitReq = new ProductSkuSensitiveLimitReq();
// }
// if (skuItem.productSkuWhExtAttrReq.productSkuSensitiveLimitReq.maxLiquidCapacityHp == null)
// {
// skuItem.productSkuWhExtAttrReq.productSkuSensitiveLimitReq.maxLiquidCapacityHp = 1000;
// }
//}
if (chkChangeSizeAndNumber.Checked) // 修改包装尺寸和单品数量
{
skuItem.productSkuWhExtAttrReq.productSkuVolumeReq.len = len * 10;