修复导入数据 缺少SKU spec
This commit is contained in:
1 parent
8b89d13573
commit
628e2d3786
4 files changed
+20
-19
No files matched your search
@@ -344,7 +344,7 @@ namespace TemuKJD.BLL.ImportConverters
|
||||
/// <summary>
|
||||
/// 获取SKU和规格信息
|
||||
/// </summary>
|
||||
private Tuple<List<SkuItem> ,List<SpecItem>> GetSkusAndSpecs()
|
||||
private Tuple<List<SkuItem>, List<SpecItem>> GetSkusAndSpecs()
|
||||
{
|
||||
var skuList = new List<SkuItem>();
|
||||
var specList = new List<SpecItem>();
|
||||
@@ -360,6 +360,7 @@ namespace TemuKJD.BLL.ImportConverters
|
||||
{
|
||||
var skuId = spec["skuId"]?.Value<string>();
|
||||
var specText = spec["spec"]?.Value<string>();
|
||||
specText = specText.Replace('+', ';');
|
||||
if (!string.IsNullOrEmpty(skuId) && !string.IsNullOrEmpty(specText))
|
||||
{
|
||||
skuSpecDict[skuId] = specText;
|
||||
@@ -386,7 +387,7 @@ namespace TemuKJD.BLL.ImportConverters
|
||||
{
|
||||
specText = cachedSpec;
|
||||
// 解析 "颜色分类:牛油果/尺码:S" 格式
|
||||
foreach (var part in cachedSpec.Split('/'))
|
||||
foreach (var part in cachedSpec.Split(new char[] { '/', '+', ';' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
var kv = part.Split(':');
|
||||
if (kv.Length == 2)
|
||||
|
||||
@@ -1959,8 +1959,8 @@ namespace TemuKJD.BLL
|
||||
var specList = skuItem.Spec.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
foreach (var spec in specList)
|
||||
{
|
||||
string specKey = spec.Split(':')[0];
|
||||
string specValue = spec.Split(':')[1];
|
||||
string specKey = spec.Split(':')[0].Trim();
|
||||
string specValue = spec.Split(':')[1].Trim();
|
||||
var specItem = frontProdInfo.Specs.FirstOrDefault(a => a.SpecKey == specKey && a.SpecValue == specValue);
|
||||
if (specItem == null) continue;
|
||||
skuInfo.spec.Add(new spec_item()
|
||||
|
||||
@@ -94,6 +94,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
this.chkTime = new TemuKJD.UserComponent.UcCheckBox(this.components);
|
||||
this.dtpStart = new System.Windows.Forms.DateTimePicker();
|
||||
this.dtpEnd = new System.Windows.Forms.DateTimePicker();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||
this.lblRelation = new System.Windows.Forms.Label();
|
||||
@@ -153,7 +154,6 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
this.col_select_product = new System.Windows.Forms.DataGridViewLinkColumn();
|
||||
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
|
||||
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.txt_listing_time = new System.Windows.Forms.TextBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
@@ -977,6 +977,18 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
this.dtpEnd.Size = new System.Drawing.Size(99, 23);
|
||||
this.dtpEnd.TabIndex = 982;
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(832, 77);
|
||||
this.label10.Margin = new System.Windows.Forms.Padding(3, 7, 0, 0);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(56, 17);
|
||||
this.label10.TabIndex = 983;
|
||||
this.label10.Text = "上架日期";
|
||||
this.toolTip1.SetToolTip(this.label10, "导入数据时超出时间(天)范围的不导入");
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
@@ -1643,18 +1655,6 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
this.statusBar.Size = new System.Drawing.Size(1438, 25);
|
||||
this.statusBar.TabIndex = 5;
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(832, 77);
|
||||
this.label10.Margin = new System.Windows.Forms.Padding(3, 7, 0, 0);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(56, 17);
|
||||
this.label10.TabIndex = 983;
|
||||
this.label10.Text = "上架日期";
|
||||
this.toolTip1.SetToolTip(this.label10, "导入数据时超出时间(天)范围的不导入");
|
||||
//
|
||||
// txt_listing_time
|
||||
//
|
||||
this.txt_listing_time.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
@@ -1666,7 +1666,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
this.txt_listing_time.Name = "txt_listing_time";
|
||||
this.txt_listing_time.Size = new System.Drawing.Size(101, 25);
|
||||
this.txt_listing_time.TabIndex = 984;
|
||||
this.txt_listing_time.Text = "30";
|
||||
this.txt_listing_time.Text = "365";
|
||||
//
|
||||
// WXUserCollectAuthProdListForm
|
||||
//
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace KJD.Test
|
||||
[Test]
|
||||
public void TestWXToPDDV4()
|
||||
{
|
||||
string filePath = @"C:\Users\chaih\Documents\xwechat_files\hongfei357_a567\msg\file\2026-10\导入失败数据包\10000023711970.txt";
|
||||
string filePath = @"C:\Users\chaih\Documents\xwechat_files\hongfei357_a567\msg\file\2026-10\10001443620622.json";
|
||||
var frontProdInfo = ConverterToPddFactory.Convert(filePath);
|
||||
var isMatch = frontProdInfo != null;
|
||||
Console.WriteLine(frontProdInfo.Skus.Count);
|
||||
|
||||
Reference in new issue
Block a user