From 8ae8398e130f0bbd488df2240196dfee6e652606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=AD=E8=81=AA?= Date: Thu, 12 Oct 2023 14:31:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=8A=E6=9E=B6?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Request/SkuWriteUpdateSkusRequest.cs | 4 + .../PlatformSDK/JDBusiness.cs | 122 ++++++++++++------ 2 files changed, 85 insertions(+), 41 deletions(-) diff --git a/BBWY.JDSDK/Request/SkuWriteUpdateSkusRequest.cs b/BBWY.JDSDK/Request/SkuWriteUpdateSkusRequest.cs index 96cf0300..10ff3bef 100644 --- a/BBWY.JDSDK/Request/SkuWriteUpdateSkusRequest.cs +++ b/BBWY.JDSDK/Request/SkuWriteUpdateSkusRequest.cs @@ -43,6 +43,8 @@ namespace Jd.Api.Request public List multiCateProps { get; set; } public int? promiseId { get; set; } + + public string saleAttrTemplateId { get; set; } } public class SkuWriteUpdateSkusItemSaleAttrs @@ -57,5 +59,7 @@ namespace Jd.Api.Request public List attrValueAlias { get; set; } public int index { get; set; } + + public List attrValuesSeqNo { get; set; } } } diff --git a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs index 7593f9eb..983a350a 100644 --- a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs +++ b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs @@ -999,7 +999,7 @@ namespace BBWY.Server.Business for (var i = 0; i < request.GiftTemplateSkuList.Count(); i++) { var giftSku = request.GiftTemplateSkuList[i]; - var colorProperty = colorSaleAttrs[takeColorIndex]; + var colorPropertyValue = colorSaleAttrs[takeColorIndex]; var p = new SkuWriteUpdateSkusItem() { @@ -1012,14 +1012,26 @@ namespace BBWY.Server.Business outerId = $"{request.OuterId}{(i + 1).ToString().PadLeft(3, '0')}", saleAttrs = new List() { - new SkuWriteUpdateSkusItemSaleAttrs() + //new SkuWriteUpdateSkusItemSaleAttrs() + //{ + // type = "com.jd.pop.ware.ic.api.domain.Prop", + // attrId = colorProperty.Value("attId"), + // attrValues = new List() { colorProperty.Value("id") }, + // index = takeColorIndex, + // attrValuesSeqNo = new List(){ takeColorIndex } + //} + + new SkuWriteUpdateSkusItemSaleAttrs() { type = "com.jd.pop.ware.ic.api.domain.Prop", - attrId = colorProperty.Value("attId"), - attrValues = new List() { colorProperty.Value("id") }, - index = takeColorIndex + attrId = colorPropertyValue.Value("attId"), + //attrValues = new List() { colorPropertyValue.Value("id") }, + attrValueAlias = new List(){ giftSku.Title }, // colorPropertyValue.Value("name") + index = takeColorIndex, + attrValuesSeqNo = new List(){ takeColorIndex } } - } + }, + saleAttrTemplateId = "POP_MODEL" //promiseId = 30603710 //固定时效模板Id 48小时发货 }; @@ -1036,26 +1048,26 @@ namespace BBWY.Server.Business } } - //修改标题参数 - updateSkuTitleParamList.Add(new WareWriteUpdateWareSaleAttrvalueAliasRequestItem() - { - attrId = p.saleAttrs[0].attrId, - attrValues = p.saleAttrs[0].attrValues, - attrValueAlias = new List() { giftSku.Title } - }); - - //修改商品细节图参数 - var imgUrlBuilder = new StringBuilder(); - var imgIndexBuilder = new StringBuilder(); - imgUrlBuilder.Append($"{giftSku.Logo.Substring(giftSku.Logo.IndexOf("jfs"))},"); - imgIndexBuilder.Append("1,"); - imageWriteUpdateRequestList.Add(new ImageWriteUpdateRequest() - { - wareId = wareId, - colorId = colorProperty.Value("id"), - imgUrl = imgUrlBuilder.ToString().Trim(','), - imgIndex = imgIndexBuilder.ToString().Trim(',') - }); + ////修改标题参数 + //updateSkuTitleParamList.Add(new WareWriteUpdateWareSaleAttrvalueAliasRequestItem() + //{ + // attrId = p.saleAttrs[0].attrId, + // attrValues = p.saleAttrs[0].attrValues, + // attrValueAlias = new List() { giftSku.Title } + //}); + + ////修改商品细节图参数 + //var imgUrlBuilder = new StringBuilder(); + //var imgIndexBuilder = new StringBuilder(); + //imgUrlBuilder.Append($"{giftSku.Logo.Substring(giftSku.Logo.IndexOf("jfs"))},"); + //imgIndexBuilder.Append("1,"); + //imageWriteUpdateRequestList.Add(new ImageWriteUpdateRequest() + //{ + // wareId = wareId, + // colorId = colorProperty.Value("id"), + // imgUrl = imgUrlBuilder.ToString().Trim(','), + // imgIndex = imgIndexBuilder.ToString().Trim(',') + //}); takeColorIndex--; skusParamList.Add(p); @@ -1126,27 +1138,55 @@ namespace BBWY.Server.Business } } - var newSkuList = res.Json["jingdong_sku_write_updateSkus_responce"]["skuList"].ToList().Select(x => x.Value("skuId")).ToList(); - giftSkuIdList.AddRange(newSkuList); - } - #endregion + var newSkuIdList = res.Json["jingdong_sku_write_updateSkus_responce"]["skuList"].ToList().Select(x => x.Value("skuId")).ToList(); + giftSkuIdList.AddRange(newSkuIdList); - #region sku改名 - { - stepText = "sku改名"; - var req = new WareWriteUpdateWareSaleAttrvalueAliasRequest() + + var newSkuList = res.Json["jingdong_sku_write_updateSkus_responce"]["skuList"].ToList(); + var imgIndex = 1; + StringBuilder colorBuilder = new StringBuilder(); + StringBuilder imgUrlBuilder = new StringBuilder(); + StringBuilder imgIndexBuilder = new StringBuilder(); + foreach (var skuJToken in newSkuList) + { + var skuTitle = skuJToken["saleAttrs"][0]["attrValueAlias"][0].ToString(); + var colorId = skuJToken["saleAttrs"][0]["attrValues"][0].ToString(); + var currentImgIndex = imgIndex; + imgIndex++; + var giftSku = request.GiftTemplateSkuList.FirstOrDefault(x => x.Title == skuTitle); + var imgUrl = giftSku.Logo.Substring(giftSku.Logo.IndexOf("jfs")); + + colorBuilder.Append($"{colorId},"); + imgUrlBuilder.Append($"{imgUrl},"); + imgIndexBuilder.Append($"{currentImgIndex},"); + } + + imageWriteUpdateRequestList.Add(new ImageWriteUpdateRequest() { wareId = wareId, - props = updateSkuTitleParamList - }; - var res = jdClient.Execute(req, request.AppToken, DateTime.Now.ToLocalTime()); - if (res.Json == null) - res.Json = JObject.Parse(res.Body); - if (res.IsError) - throw new BusinessException($"sku改名失败-{(string.IsNullOrEmpty(res.ErrorMsg) ? res.ErrMsg : res.ErrorMsg)}"); + colorId = colorBuilder.ToString().TrimEnd(','), + imgUrl = imgUrlBuilder.ToString().TrimEnd(','), + imgIndex = imgIndexBuilder.ToString().TrimEnd(',') + }); } #endregion + //#region sku改名 + //{ + // stepText = "sku改名"; + // var req = new WareWriteUpdateWareSaleAttrvalueAliasRequest() + // { + // wareId = wareId, + // props = updateSkuTitleParamList + // }; + // var res = jdClient.Execute(req, request.AppToken, DateTime.Now.ToLocalTime()); + // if (res.Json == null) + // res.Json = JObject.Parse(res.Body); + // if (res.IsError) + // throw new BusinessException($"sku改名失败-{(string.IsNullOrEmpty(res.ErrorMsg) ? res.ErrMsg : res.ErrorMsg)}"); + //} + //#endregion + #region sku修改细节图 stepText = "sku修改细节图"; foreach (var imageWriteUpdateRequest in imageWriteUpdateRequestList) From 63c72ac4eb9af3e165a5ffbdd3eba1bd04b87c75 Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Thu, 12 Oct 2023 14:50:52 +0800 Subject: [PATCH 2/2] =?UTF-8?q?jdsku=E4=BB=93=E5=BA=93=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8F=AF=E9=80=89=E4=BB=93=E5=BA=93=E6=98=8E?= =?UTF-8?q?=E7=BB=86,bbwy=E5=B1=95=E7=A4=BA=E5=AF=B9=E6=8E=A5=E4=BA=BA?= =?UTF-8?q?=E5=92=8C=E6=89=93=E5=8C=85=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BBWY.Client/BBWYAppSettings.json | 4 ++-- BBWY.Client/GlobalContext.cs | 2 +- .../Views/PackTask/WaitPackageControl.xaml | 21 ++++++++++++++++--- .../SealBox/SealBoxPolicyDetailsWindow.xaml | 3 +++ .../SealBoxPolicyDetailsWindow.xaml.cs | 6 +++++- .../SealBox/SealBoxPrintDetailsWindow.xaml.cs | 3 ++- .../PlatformSDK/JDBusiness.cs | 5 +++-- .../PlatformSDK/PlatformSDKBusiness.cs | 3 ++- .../Dto/Request/JD/GetStockNumBySkuRequest.cs | 16 ++++++++++++++ .../Product/SearchProductSkuRequest.cs | 2 ++ JD.API/Controllers/PlatformSDKController.cs | 3 ++- 11 files changed, 56 insertions(+), 12 deletions(-) create mode 100644 BBWY.Server.Model/Dto/Request/JD/GetStockNumBySkuRequest.cs diff --git a/BBWY.Client/BBWYAppSettings.json b/BBWY.Client/BBWYAppSettings.json index a46121ab..b8c053dc 100644 --- a/BBWY.Client/BBWYAppSettings.json +++ b/BBWY.Client/BBWYAppSettings.json @@ -4,6 +4,6 @@ "MDSApiHost": "http://mdsapi.qiyue666.com", "JOSApiHost": "", "1688ApiHost": "", - //"QKApiHost": "http://localhost:8080" - "QKApiHost": "http://qiku.qiyue666.com" + "QKApiHost": "http://localhost:8080" + // "QKApiHost": "http://qiku.qiyue666.com" } \ No newline at end of file diff --git a/BBWY.Client/GlobalContext.cs b/BBWY.Client/GlobalContext.cs index 0ea996ca..2f3b9059 100644 --- a/BBWY.Client/GlobalContext.cs +++ b/BBWY.Client/GlobalContext.cs @@ -13,7 +13,7 @@ namespace BBWY.Client { ShopServiceGroupList = new List(); ShopServiceGroupLowerList = new List(); - ClientVersion = "10187"; + ClientVersion = "10188"; } private User user; diff --git a/BBWY.Client/Views/PackTask/WaitPackageControl.xaml b/BBWY.Client/Views/PackTask/WaitPackageControl.xaml index 7deb7223..174f5965 100644 --- a/BBWY.Client/Views/PackTask/WaitPackageControl.xaml +++ b/BBWY.Client/Views/PackTask/WaitPackageControl.xaml @@ -249,7 +249,7 @@ Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}" CommandParameter="{Binding ShopName}" Margin=" 5,0,0,0"/> - + @@ -480,7 +480,7 @@ --> - + - + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/SealBox/SealBoxPolicyDetailsWindow.xaml b/BBWY.Client/Views/SealBox/SealBoxPolicyDetailsWindow.xaml index 7e2062d4..bf2c5a37 100644 --- a/BBWY.Client/Views/SealBox/SealBoxPolicyDetailsWindow.xaml +++ b/BBWY.Client/Views/SealBox/SealBoxPolicyDetailsWindow.xaml @@ -40,6 +40,9 @@ + + + diff --git a/BBWY.Client/Views/SealBox/SealBoxPolicyDetailsWindow.xaml.cs b/BBWY.Client/Views/SealBox/SealBoxPolicyDetailsWindow.xaml.cs index 9b068701..f4b0818a 100644 --- a/BBWY.Client/Views/SealBox/SealBoxPolicyDetailsWindow.xaml.cs +++ b/BBWY.Client/Views/SealBox/SealBoxPolicyDetailsWindow.xaml.cs @@ -24,13 +24,14 @@ namespace BBWY.Client.Views.SealBox /// public partial class SealBoxPolicyDetailsWindow : BWindow { - public SealBoxPolicyDetailsWindow(List sealBoxSkus, string shopName, string wareName, long sealBoxId) + public SealBoxPolicyDetailsWindow(List sealBoxSkus, string shopName, string wareName, long sealBoxId,string acceptUserName) { InitializeComponent(); this.DataContext = this; SealBoxSkus = sealBoxSkus; ShopName = shopName; WareName = wareName; + AcceptUserName = acceptUserName; SealBoxId = sealBoxId; this.UpdateLayout(); } @@ -43,6 +44,9 @@ namespace BBWY.Client.Views.SealBox public string ShopName { get; set; } public string WareName { get; set; } + + public string AcceptUserName { get; set; } + public long SealBoxId { get; set; } public void PrintBox(string printName) diff --git a/BBWY.Client/Views/SealBox/SealBoxPrintDetailsWindow.xaml.cs b/BBWY.Client/Views/SealBox/SealBoxPrintDetailsWindow.xaml.cs index 55286c08..60536936 100644 --- a/BBWY.Client/Views/SealBox/SealBoxPrintDetailsWindow.xaml.cs +++ b/BBWY.Client/Views/SealBox/SealBoxPrintDetailsWindow.xaml.cs @@ -149,7 +149,8 @@ namespace BBWY.Client.Views.SealBox { App.Current.Dispatcher.Invoke(new Action(() => { - SealBoxPolicyDetailsWindow policyDetailsWindow = new SealBoxPolicyDetailsWindow(sealBoxSkus, SealBoxModel.ShopName, SealBoxModel.WareName, SealBoxModel.SealBoxId); + SealBoxPolicyDetailsWindow policyDetailsWindow = new SealBoxPolicyDetailsWindow(sealBoxSkus, SealBoxModel.ShopName, SealBoxModel.WareName, SealBoxModel.SealBoxId, SealBoxModel.AcceptUserName); + //policyDetailsWindow.Show(); policyDetailsWindow.PrintBox(PrintName); })); diff --git a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs index 7593f9eb..8f1bd0b2 100644 --- a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs +++ b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs @@ -3,6 +3,7 @@ using BBWY.Common.Models; using BBWY.JDSDK.Request; using BBWY.Server.Model; using BBWY.Server.Model.Dto; +using BBWY.Server.Model.Dto.Request.JD; using Jd.ACES; using Jd.ACES.Common; using Jd.Api; @@ -725,12 +726,12 @@ namespace BBWY.Server.Business return (JArray)res.Json["jingdong_eclp_master_queryWarehouse_responce"]["querywarehouse_result"]; } - public override JArray GetStockNumBySku(SearchProductSkuRequest request) + public override JArray GetStockNumBySku(GetStockNumBySkuRequest request) { var jdClient = GetJdClient(request.AppKey, request.AppSecret); var req = new StockReadFindSkuStockRequest(); - + req.field = string.Join(",", request.Field); req.skuId = long.Parse(request.Sku); // 10036238533172; //京仓sku var res = jdClient.Execute(req, request.AppToken, DateTime.Now.ToLocalTime()); diff --git a/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs b/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs index 7755fffc..3cf2d1f6 100644 --- a/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs +++ b/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs @@ -1,5 +1,6 @@ using BBWY.Server.Model; using BBWY.Server.Model.Dto; +using BBWY.Server.Model.Dto.Request.JD; using Microsoft.Extensions.Caching.Memory; using Newtonsoft.Json.Linq; using NLog; @@ -163,7 +164,7 @@ namespace BBWY.Server.Business throw new NotImplementedException(); } - public virtual JArray GetStockNumBySku(SearchProductSkuRequest request) + public virtual JArray GetStockNumBySku(GetStockNumBySkuRequest request) { throw new NotImplementedException(); } diff --git a/BBWY.Server.Model/Dto/Request/JD/GetStockNumBySkuRequest.cs b/BBWY.Server.Model/Dto/Request/JD/GetStockNumBySkuRequest.cs new file mode 100644 index 00000000..67580cf1 --- /dev/null +++ b/BBWY.Server.Model/Dto/Request/JD/GetStockNumBySkuRequest.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Server.Model.Dto.Request.JD +{ + public class GetStockNumBySkuRequest : PlatformRequest + { + /// + /// 多个Sku逗号间隔 + /// + public string Sku { get; set; } + + public string[] Field { get; set; } + } +} diff --git a/BBWY.Server.Model/Dto/Request/Product/SearchProductSkuRequest.cs b/BBWY.Server.Model/Dto/Request/Product/SearchProductSkuRequest.cs index 6e644ba1..3eda099f 100644 --- a/BBWY.Server.Model/Dto/Request/Product/SearchProductSkuRequest.cs +++ b/BBWY.Server.Model/Dto/Request/Product/SearchProductSkuRequest.cs @@ -28,5 +28,7 @@ namespace BBWY.Server.Model.Dto /// 检查环节 /// public string CheckStep { get; set; } + + public string[] Field { get; set; } } } diff --git a/JD.API/Controllers/PlatformSDKController.cs b/JD.API/Controllers/PlatformSDKController.cs index fc180222..797b044f 100644 --- a/JD.API/Controllers/PlatformSDKController.cs +++ b/JD.API/Controllers/PlatformSDKController.cs @@ -1,6 +1,7 @@ using BBWY.Server.Business; using BBWY.Server.Model; using BBWY.Server.Model.Dto; +using BBWY.Server.Model.Dto.Request.JD; using JD.API.Filters; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json.Linq; @@ -293,7 +294,7 @@ namespace JD.API.API.Controllers /// /// [HttpPost] - public JArray GetStockNumBySku([FromBody] SearchProductSkuRequest request) + public JArray GetStockNumBySku([FromBody] GetStockNumBySkuRequest request) { return platformSDKBusinessList.FirstOrDefault(p => p.Platform == request.Platform).GetStockNumBySku(request); }