using AllBase; using AllBase.Extension; using NaiBa.Util.Extension; using AllBase.Helper; using AllBase.Model.Config; using AllBase.Model.DBModel; using AllBase.Model.Param.WXParam; using AllBase.Model.Result; using AllBase.Model.Result.PDDResult; using AllBase.Model.Result.WXResult; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Store.Product.Models.PublishParameters.Wx; using Store.Product.Publish; using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Drawing2D; using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using Work; namespace Store.Product.Publish.Steps.Wx; /// /// 由 WXDBProdUploadForm.UploadProduct 的“设置商品货号”区段迁移。 /// TODO(迁移): 原区段中的 TEMUKJD/WXUpload/窗体服务引用需按 Store.Product 运行时适配逐项核对。 /// public sealed class SetProductExtCodeStep : WxProductPublishStepBase { public override string Description => "设置商品货号"; protected override Task ExecuteProvider(WXPublishContext context, CancellationToken cancellationToken) { context.Product.ExtCode = context.Product.ExtCode.IsNullOrEmpty() ? context.Parameters.ProdInfo.detail.out_goods_sn : context.Product.ExtCode; if (context.Product.ExtCode.IsNullOrEmpty() || context.Product.ExtCode.Length <= 10) { //extCode = "EC" + Randomx.GetId(1000).ToString().PadLeft(3, '0') + context.Product.SpuId + "C"; context.Product.ExtCode = GetEC1ExtCode(context.Product.SpuId); } context.Parameters.ProductParameter.product.info.spuCode = context.Product.ExtCode; context.Parameters.ProductParameter.product.info.outProductId = context.Product.ExtCode; context.Parameters.ProductParameter.product.info.out_product_id = context.Product.ExtCode; context.Parameters.ProductParameter.product.productKey.outProductId = context.Product.ExtCode; return Task.CompletedTask; } }