diff --git a/BBWY.Client/APIServices/BaseApiService.cs b/BBWY.Client/APIServices/BaseApiService.cs index 0c920df7..2c8f72ae 100644 --- a/BBWY.Client/APIServices/BaseApiService.cs +++ b/BBWY.Client/APIServices/BaseApiService.cs @@ -36,7 +36,7 @@ namespace BBWY.Client.APIServices headers.Add("ClientCode", "BBWY"); if (!headers.ContainsKey("ClientVersion")) headers.Add("ClientVersion", "1.0.0.0"); - if (!headers.ContainsKey("Authorization") && !string.IsNullOrEmpty(globalContext.User?.Token)) + if (!headers.ContainsKey("Authorization") && !string.IsNullOrEmpty(globalContext.UserToken)) headers.Add("Authorization", $"Bearer {globalContext.User.Token}"); if (!headers.ContainsKey("qy")) headers.Add("qy", "qy"); diff --git a/BBWY.Client/APIServices/LogisticsService.cs b/BBWY.Client/APIServices/LogisticsService.cs new file mode 100644 index 00000000..347484ad --- /dev/null +++ b/BBWY.Client/APIServices/LogisticsService.cs @@ -0,0 +1,24 @@ +using BBWY.Client.Models; +using BBWY.Common.Http; +using BBWY.Common.Models; +using System.Collections.Generic; +using System.Net.Http; + +namespace BBWY.Client.APIServices +{ + public class LogisticsService : BaseApiService, IDenpendency + { + public LogisticsService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) { } + + public ApiResponse> GetLogisticsList() + { + return SendRequest>(globalContext.BBYWApiHost, "api/vender/GetLogisticsList", new + { + globalContext.User.Shop.Platform, + globalContext.User.Shop.AppKey, + globalContext.User.Shop.AppSecret, + globalContext.User.Shop.AppToken + }, null, HttpMethod.Post); + } + } +} diff --git a/BBWY.Client/APIServices/OrderService.cs b/BBWY.Client/APIServices/OrderService.cs index f6c20e06..a170b632 100644 --- a/BBWY.Client/APIServices/OrderService.cs +++ b/BBWY.Client/APIServices/OrderService.cs @@ -148,5 +148,19 @@ namespace BBWY.Client.APIServices relationPurchaseOrderSkuList }, null, HttpMethod.Post); } + + public ApiResponse OutStock(string orderId, string waybillNo, string logisticsId) + { + return SendRequest(globalContext.BBYWApiHost, "api/order/outstock", new + { + orderId, + waybillNo, + logisticsId, + Platform = globalContext.User.Shop.Platform, + AppKey = globalContext.User.Shop.AppKey, + AppSecret = globalContext.User.Shop.AppSecret, + AppToken = globalContext.User.Shop.AppToken + }, null, HttpMethod.Post); + } } } diff --git a/BBWY.Client/App.xaml.cs b/BBWY.Client/App.xaml.cs index 6f33d3a5..02448089 100644 --- a/BBWY.Client/App.xaml.cs +++ b/BBWY.Client/App.xaml.cs @@ -24,6 +24,13 @@ namespace BBWY.Client protected override void OnStartup(StartupEventArgs e) { var gl = new GlobalContext(); + string userToken = string.Empty; +#if DEBUG + userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNDA1MTUxNjE5NTk0NTg4MTYwIiwidGVhbUlkIjoiMTQzOTg5OTEyMzk1NTI3MzcyOCIsImV4cCI6MTY3MTkwMTU1NH0.UaUubqP442qxVc6ppQt7FO0jcFs3w6KR6q1OeBuL1i8"; //齐越小一 +#else + +#endif + gl.UserToken = userToken; #region 注册全局异常 this.DispatcherUnhandledException += App_DispatcherUnhandledException; ; @@ -66,5 +73,6 @@ namespace BBWY.Client { Console.WriteLine(e.Exception); } + } } diff --git a/BBWY.Client/GlobalContext.cs b/BBWY.Client/GlobalContext.cs index ef5b9832..f4a4c6bf 100644 --- a/BBWY.Client/GlobalContext.cs +++ b/BBWY.Client/GlobalContext.cs @@ -10,18 +10,11 @@ namespace BBWY.Client { private User user; - public User User { get => user; set { Set(ref user, value); } } - /// - /// 用户名 - /// - public string UserName { get; set; } + public string UserToken { get; set; } - /// - /// 密码 - /// - public string Pwd { get; set; } + public IList LogisticsResponseList { get; set; } /// /// JD客户端 diff --git a/BBWY.Client/Models/APIModel/Response/Logistics/LogisticsResponse.cs b/BBWY.Client/Models/APIModel/Response/Logistics/LogisticsResponse.cs new file mode 100644 index 00000000..848604a4 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/Logistics/LogisticsResponse.cs @@ -0,0 +1,9 @@ +namespace BBWY.Client.Models +{ + public class LogisticsResponse + { + public string Id { get; set; } + + public string Name { get; set; } + } +} diff --git a/BBWY.Client/Models/Order/Order.cs b/BBWY.Client/Models/Order/Order.cs index ab902ed3..8a289fd0 100644 --- a/BBWY.Client/Models/Order/Order.cs +++ b/BBWY.Client/Models/Order/Order.cs @@ -12,6 +12,8 @@ namespace BBWY.Client.Models } private StorageType? storageType; + private OrderState orderState; + private string waybillNo; public string Id { get; set; } @@ -50,10 +52,6 @@ namespace BBWY.Client.Models /// public PayType PayType { get; set; } - /// - /// 订单状态 - /// - public OrderState OrderState { get; set; } /// /// 订单状态中文说明 @@ -96,11 +94,6 @@ namespace BBWY.Client.Models public string VenderRemark { get; set; } - /// - /// 运单号 - /// - public string WaybillNo { get; set; } - /// /// 仓储类型 @@ -161,6 +154,13 @@ namespace BBWY.Client.Models /// public OrderDropShipping OrderDropShipping { get; set; } + /// + /// 订单状态 + /// + public OrderState OrderState { get => orderState; set { Set(ref orderState, value); } } + + public string WaybillNo { get => waybillNo; set { Set(ref waybillNo, value); } } + public void ConvertOrderCostDetailToGroup() { if (OrderCostDetailList == null || OrderCostDetailList.Count() == 0) diff --git a/BBWY.Client/ViewModels/MainViewModel.cs b/BBWY.Client/ViewModels/MainViewModel.cs index 5439ffb0..c1685673 100644 --- a/BBWY.Client/ViewModels/MainViewModel.cs +++ b/BBWY.Client/ViewModels/MainViewModel.cs @@ -19,6 +19,7 @@ namespace BBWY.Client.ViewModels { #region Properties private MdsApiService mdsApiService; + private LogisticsService logisticsService; private MenuModel selectedMenuModel; private bool showShopChoosePanel; @@ -59,9 +60,10 @@ namespace BBWY.Client.ViewModels #endregion #region Methods - public MainViewModel(GlobalContext globalContext, MdsApiService mdsApiService) + public MainViewModel(GlobalContext globalContext, MdsApiService mdsApiService, LogisticsService logisticsService) { this.mdsApiService = mdsApiService; + this.logisticsService = logisticsService; ClosingCommand = new RelayCommand(Exit); ChooseShopCommand = new RelayCommand((s) => ChooseShop(s)); this.GlobalContext = globalContext; @@ -73,8 +75,6 @@ namespace BBWY.Client.ViewModels Name="订单管理",ChildList=new List() { new MenuModel(){ Name="最近订单",Url="/Views/Order/OrderList.xaml" }, - //new MenuModel(){ Name="等待采购",Url="/Views/Order/OrderList.xaml" }, - //new MenuModel(){ Name="待出库",Url="/Views/Order/OrderList.xaml" }, new MenuModel(){ Name="售后管理",Url="/Views/Order/OrderList.xaml" } } }, @@ -102,17 +102,11 @@ namespace BBWY.Client.ViewModels { Thread.Sleep(1000); - //从磨刀石获取用户Token - var userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNDA1MTUxNjE5NTk0NTg4MTYwIiwidGVhbUlkIjoiMTQzOTg5OTEyMzk1NTI3MzcyOCIsImV4cCI6MTY3MTkwMTU1NH0.UaUubqP442qxVc6ppQt7FO0jcFs3w6KR6q1OeBuL1i8"; //齐越小一 - - //var userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNDE1OTMxMjU4NjEzMDEwNDMyIiwidGVhbUlkIjoiMTQxNDkzNTcwNDQ2MjQzMDIwOCIsImV4cCI6MTY3MjgzMTE3N30.gOlJav6J1bSrLvIzUCmc3zfTYcW_8hAlUpJxc02kyos"; //齐越文魁 - - var mdsUserResponse = mdsApiService.GetUserInfo(userToken); + var mdsUserResponse = mdsApiService.GetUserInfo(GlobalContext.UserToken); if (!mdsUserResponse.Success) throw new Exception($"获取磨刀石用户信息失败 {mdsUserResponse.Msg}"); GlobalContext.User = mdsUserResponse.Data.Map(); - GlobalContext.User.Token = userToken; //请求用户信息接口 //GlobalContext.User = new User() @@ -178,6 +172,18 @@ namespace BBWY.Client.ViewModels GlobalContext.User.Shop = shop; ShowShopChoosePanel = false; + Task.Factory.StartNew(GetLogisticsList); + } + + private void GetLogisticsList() + { + var response = logisticsService.GetLogisticsList(); + if (!response.Success) + { + App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "获取物流公司")); + return; + } + GlobalContext.LogisticsResponseList = response.Data; } #endregion } diff --git a/BBWY.Client/ViewModels/Order/OrderListViewModel.cs b/BBWY.Client/ViewModels/Order/OrderListViewModel.cs index 6738fc4e..c5428995 100644 --- a/BBWY.Client/ViewModels/Order/OrderListViewModel.cs +++ b/BBWY.Client/ViewModels/Order/OrderListViewModel.cs @@ -89,6 +89,8 @@ namespace BBWY.Client.ViewModels public ICommand EditCostCommand { get; set; } + public ICommand OutStockCommand { get; set; } + public OrderListViewModel(OrderService orderService, StatisticsService statisticsService, GlobalContext globalContext) { random = new Random(); @@ -124,6 +126,7 @@ namespace BBWY.Client.ViewModels DecodeConsigneeCommand = new RelayCommand(DecodeConsignee); ChooseStorageTypeCommand = new RelayCommand(ChooseStorageType); EditCostCommand = new RelayCommand(EditCost); + OutStockCommand = new RelayCommand((o) => OutStock(o)); SearchOrderCommand.Execute(null); } @@ -396,5 +399,42 @@ namespace BBWY.Client.ViewModels LoadOrder(PageIndex); //手动计算成功刷新订单列表 }); } + + private void OutStock(Order o) + { + var outStock = new OutStock(o.Id, globalContext.LogisticsResponseList); + outStock.Closed += OutStock_Closed; + outStock.ShowDialog(); + } + + private void OutStock_Closed(object sender, EventArgs e) + { + var outStock = sender as OutStock; + if (outStock.DialogResult != true) + return; + var orderId = outStock.OrderId; + var waybillNo = outStock.WaybillNo; + var logistics = outStock.SelectedLogistics; + var order = OrderList.FirstOrDefault(o => o.Id == orderId); + IsLoading = true; + Task.Factory.StartNew(() => orderService.OutStock(orderId, waybillNo, logistics.Id)) + .ContinueWith(r => + { + IsLoading = false; + var response = r.Result; + if (!response.Success) + { + App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "出库")); + return; + } + if (order != null) + { + order.OrderState = Models.OrderState.待收货; + order.WaybillNo = waybillNo; + } + + //LoadOrder(PageIndex); + }); + } } } diff --git a/BBWY.Client/Views/Order/OrderList.xaml b/BBWY.Client/Views/Order/OrderList.xaml index 0cdf1425..19c74f06 100644 --- a/BBWY.Client/Views/Order/OrderList.xaml +++ b/BBWY.Client/Views/Order/OrderList.xaml @@ -677,7 +677,9 @@ Background="White" Margin="0,0,1,0" Height="25" - Visibility="Collapsed"/> + Visibility="Collapsed" + Command="{Binding DataContext.OutStockCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}" + CommandParameter="{Binding }"/> diff --git a/BBWY.Client/Views/Order/OutStock.xaml b/BBWY.Client/Views/Order/OutStock.xaml new file mode 100644 index 00000000..2733329c --- /dev/null +++ b/BBWY.Client/Views/Order/OutStock.xaml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/Order/OutStock.xaml.cs b/BBWY.Client/Views/Order/OutStock.xaml.cs new file mode 100644 index 00000000..63881e2f --- /dev/null +++ b/BBWY.Client/Views/Order/OutStock.xaml.cs @@ -0,0 +1,48 @@ +using BBWY.Client.Models; +using BBWY.Controls; +using System.Collections.Generic; +using System.Windows; + +namespace BBWY.Client.Views.Order +{ + /// + /// OutStock.xaml 的交互逻辑 + /// + public partial class OutStock : BWindow + { + public string OrderId { get; private set; } + public IList LogisticsResponseList { get; private set; } + + public string WaybillNo { get; private set; } + + public LogisticsResponse SelectedLogistics { get; private set; } + + + public OutStock(string orderId, IList logisticsResponseList) + { + InitializeComponent(); + this.OrderId = orderId; + this.LogisticsResponseList = logisticsResponseList; + this.DataContext = this; + } + + private void btn_Save_Click(object sender, RoutedEventArgs e) + { + if (cbx_Logistics.SelectedItem == null) + { + MessageBox.Show("请选择快递公司", "出库"); + return; + } + + SelectedLogistics = cbx_Logistics.SelectedItem as LogisticsResponse; + if (string.IsNullOrEmpty(txt_waybill.Text) && SelectedLogistics.Name != "厂家自送") + { + MessageBox.Show("非厂家自送需要填写快递单号", "出库"); + return; + } + WaybillNo = txt_waybill.Text; + this.DialogResult = true; + this.Close(); + } + } +} diff --git a/BBWY.JDSDK/JdResponse.cs b/BBWY.JDSDK/JdResponse.cs index aa6103df..25b9da6c 100644 --- a/BBWY.JDSDK/JdResponse.cs +++ b/BBWY.JDSDK/JdResponse.cs @@ -45,6 +45,17 @@ namespace Jd.Api [JsonProperty("en_desc")] public String EnErrMsg { get; set; } + public string RealErrorMsg + { + get + { + if (IsError) + return string.IsNullOrEmpty(ErrorMsg) ? ErrMsg : ErrorMsg; + else + return string.Empty; + } + } + /// /// 响应原始内容 /// diff --git a/BBWY.Server.API/Controllers/OrderController.cs b/BBWY.Server.API/Controllers/OrderController.cs index 31219f70..b98e4203 100644 --- a/BBWY.Server.API/Controllers/OrderController.cs +++ b/BBWY.Server.API/Controllers/OrderController.cs @@ -78,6 +78,16 @@ namespace BBWY.Server.API.Controllers orderBusiness.RelationPurchaseOrder(relationPurchaseOrderRequest); } + /// + /// 出库 + /// + /// + [HttpPost] + public void OutStock([FromBody] OutStockRequest outStockRequest) + { + orderBusiness.OutStock(outStockRequest); + } + /// /// 订单同步 /// diff --git a/BBWY.Server.API/Controllers/PlatformSDKController.cs b/BBWY.Server.API/Controllers/PlatformSDKController.cs index b583bc28..3caea906 100644 --- a/BBWY.Server.API/Controllers/PlatformSDKController.cs +++ b/BBWY.Server.API/Controllers/PlatformSDKController.cs @@ -98,5 +98,26 @@ namespace BBWY.Server.API.Controllers { platformSDKBusinessList.FirstOrDefault(p => p.Platform == editVenderRemarkRequest.Platform).EditVenderRemark(editVenderRemarkRequest); } + + /// + /// 获取物流公司列表 + /// + /// + /// + [HttpPost] + public IList GetLogisticsList([FromBody] PlatformRequest platformRequest) + { + return platformSDKBusinessList.FirstOrDefault(p => p.Platform == platformRequest.Platform).GetLogisticsList(platformRequest); + } + + /// + /// 出库发货 + /// + /// + [HttpPost] + public void OutStock(OutStockRequest outStockRequest) + { + platformSDKBusinessList.FirstOrDefault(p => p.Platform == outStockRequest.Platform).OutStock(outStockRequest); + } } } diff --git a/BBWY.Server.API/Controllers/VenderController.cs b/BBWY.Server.API/Controllers/VenderController.cs index f06ca1f0..177280b7 100644 --- a/BBWY.Server.API/Controllers/VenderController.cs +++ b/BBWY.Server.API/Controllers/VenderController.cs @@ -2,6 +2,7 @@ using BBWY.Server.Model.Dto; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using System.Collections.Generic; namespace BBWY.Server.API.Controllers { @@ -21,9 +22,20 @@ namespace BBWY.Server.API.Controllers /// /// [HttpPost] - public VenderResponse GetVenderInfo([FromBody]PlatformRequest platformRequest) + public VenderResponse GetVenderInfo([FromBody] PlatformRequest platformRequest) { return venderBusiness.GetVenderInfo(platformRequest); } + + /// + /// 获取物流公司 + /// + /// + /// + [HttpPost] + public IList GetLogisticsList(PlatformRequest platformRequest) + { + return venderBusiness.GetLogisticsList(platformRequest); + } } } diff --git a/BBWY.Server.Business/Order/OrderBusiness.cs b/BBWY.Server.Business/Order/OrderBusiness.cs index ba7eef44..c3cc13d0 100644 --- a/BBWY.Server.Business/Order/OrderBusiness.cs +++ b/BBWY.Server.Business/Order/OrderBusiness.cs @@ -629,6 +629,27 @@ namespace BBWY.Server.Business }); } + public void OutStock(OutStockRequest outStockRequest) + { + var dbOrder = fsql.Select(outStockRequest.OrderId).ToOne(); + if (dbOrder == null) + throw new BusinessException($"订单{outStockRequest.OrderId}不存在"); + if (dbOrder.OrderState != Enums.OrderState.待出库) + throw new BusinessException($"订单{outStockRequest.OrderId} 只有在待出库时才允许出库"); + + var relayAPIHost = GetPlatformRelayAPIHost(outStockRequest.Platform); + var sendResult = restApiService.SendRequest(relayAPIHost, "api/PlatformSDK/OutStock", outStockRequest, null, HttpMethod.Post); + if (sendResult.StatusCode != System.Net.HttpStatusCode.OK) + throw new BusinessException(sendResult.Content) { Code = (int)sendResult.StatusCode }; + var response = JsonConvert.DeserializeObject>(sendResult.Content); + if (!response.Success) + throw new BusinessException(response.Msg) { Code = response.Code }; + + fsql.Update(outStockRequest.OrderId).Set(o => o.OrderState, Enums.OrderState.待收货) + .Set(o => o.WaybillNo, outStockRequest.WayBillNo) + .ExecuteAffrows(); + } + public void SyncOrder(long shopId, string orderId) { #region 获取店铺信息; diff --git a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs index 84d3b2a1..45dd056e 100644 --- a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs +++ b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs @@ -379,14 +379,60 @@ namespace BBWY.Server.Business public override void EditVenderRemark(EditVenderRemarkRequest editVenderRemarkRequest) { var jdClient = GetJdClient(editVenderRemarkRequest.AppKey, editVenderRemarkRequest.AppSecret); - PopOrderModifyVenderRemarkRequest req = new PopOrderModifyVenderRemarkRequest(); - req.orderId = long.Parse(editVenderRemarkRequest.OrderId); - req.flag = flagDictionary.ContainsKey(editVenderRemarkRequest.Flag) ? flagDictionary[editVenderRemarkRequest.Flag] : editVenderRemarkRequest.Flag; - req.remark = editVenderRemarkRequest.VenderRemark; + PopOrderModifyVenderRemarkRequest req = new PopOrderModifyVenderRemarkRequest + { + orderId = long.Parse(editVenderRemarkRequest.OrderId), + flag = flagDictionary.ContainsKey(editVenderRemarkRequest.Flag) ? flagDictionary[editVenderRemarkRequest.Flag] : editVenderRemarkRequest.Flag, + remark = editVenderRemarkRequest.VenderRemark + }; var response = jdClient.Execute(req, editVenderRemarkRequest.AppToken, DateTime.Now.ToLocalTime()); if (response.IsError) throw new BusinessException($"修改商家备注失败 {(string.IsNullOrEmpty(response.ErrorMsg) ? response.ErrMsg : response.ErrorMsg)}"); } + + public override IList GetLogisticsList(PlatformRequest platformRequest) + { + var jdClient = GetJdClient(platformRequest.AppKey, platformRequest.AppSecret); + var response = jdClient.Execute(new FceAlphaGetVenderCarrierRequest(), platformRequest.AppToken, DateTime.Now.ToLocalTime()); + if (response.IsError) + throw new BusinessException($"{response.RealErrorMsg}"); + if (response.Json == null) + response.Json = JObject.Parse(response.Body); + if (platformRequest.SaveResponseLog) + logger.Info(response.Body); + var jarray = (JArray)(response.Json["jingdong_fce_alpha_getVenderCarrier_responce"]["StandardGenericResponse"]["result"]["carrierList"]); + return jarray.Select(j => new LogisticsResponse() + { + Id = j.Value("id"), + Name = j.Value("name"), + }).ToList(); + } + + public override void OutStock(OutStockRequest outStockRequest) + { + var jdClient = GetJdClient(outStockRequest.AppKey, outStockRequest.AppSecret); + PopOrderShipmentRequest req = new PopOrderShipmentRequest + { + orderId = outStockRequest.OrderId, + logiCoprId = outStockRequest.LogisticsId, + logiNo = outStockRequest.WayBillNo + }; + + var response = jdClient.Execute(req, outStockRequest.AppToken, DateTime.Now.ToLocalTime()); + if (outStockRequest.SaveResponseLog) + logger.Info($"出库发货 {response.Body}"); + + if (response.IsError) + throw new BusinessException($"{response.RealErrorMsg}"); + + if (response.Json == null) + response.Json = JObject.Parse(response.Body); + + if (!response.Json["jingdong_pop_order_shipment_responce"]["sopjosshipment_result"].Value("success")) + { + throw new BusinessException($"{response.Json["jingdong_pop_order_shipment_responce"]["sopjosshipment_result"].Value("chineseErrCode")}"); + } + } } } diff --git a/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs b/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs index 0ae19b08..8c969ddb 100644 --- a/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs +++ b/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs @@ -57,5 +57,15 @@ namespace BBWY.Server.Business { throw new NotImplementedException(); } + + public virtual IList GetLogisticsList(PlatformRequest platformRequest) + { + throw new NotImplementedException(); + } + + public virtual void OutStock(OutStockRequest outStockRequest) + { + throw new NotImplementedException(); + } } } diff --git a/BBWY.Server.Business/Vender/VenderBusiness.cs b/BBWY.Server.Business/Vender/VenderBusiness.cs index ef462d9c..f3f151c1 100644 --- a/BBWY.Server.Business/Vender/VenderBusiness.cs +++ b/BBWY.Server.Business/Vender/VenderBusiness.cs @@ -3,9 +3,9 @@ using BBWY.Common.Http; using BBWY.Common.Models; using BBWY.Server.Model; using BBWY.Server.Model.Dto; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Options; using Newtonsoft.Json; +using System.Collections.Generic; namespace BBWY.Server.Business { @@ -24,7 +24,19 @@ namespace BBWY.Server.Business throw new BusinessException(sendResult.Content) { Code = (int)sendResult.StatusCode }; var response = JsonConvert.DeserializeObject>(sendResult.Content); if (!response.Success) - throw new BusinessException(sendResult.Content) { Code = response.Code }; + throw new BusinessException(response.Msg) { Code = response.Code }; + return response.Data; + } + + public IList GetLogisticsList(PlatformRequest platformRequest) + { + var relayAPIHost = GetPlatformRelayAPIHost(platformRequest.Platform); + var sendResult = restApiService.SendRequest(relayAPIHost, "api/PlatformSDK/GetLogisticsList", platformRequest, null, System.Net.Http.HttpMethod.Post); + if (sendResult.StatusCode != System.Net.HttpStatusCode.OK) + throw new BusinessException(sendResult.Content) { Code = (int)sendResult.StatusCode }; + var response = JsonConvert.DeserializeObject>>(sendResult.Content); + if (!response.Success) + throw new BusinessException(response.Msg) { Code = response.Code }; return response.Data; } } diff --git a/BBWY.Server.Model/Dto/Request/Order/OutStockRequest.cs b/BBWY.Server.Model/Dto/Request/Order/OutStockRequest.cs new file mode 100644 index 00000000..942a1343 --- /dev/null +++ b/BBWY.Server.Model/Dto/Request/Order/OutStockRequest.cs @@ -0,0 +1,15 @@ +namespace BBWY.Server.Model.Dto +{ + public class OutStockRequest : PlatformRequest + { + public string OrderId { get; set; } + /// + /// 运单号 + /// + public string WayBillNo { get; set; } + /// + /// 物流公司Id + /// + public string LogisticsId { get; set; } + } +} diff --git a/BBWY.Server.Model/Dto/Response/Logistics/LogisticsResponse.cs b/BBWY.Server.Model/Dto/Response/Logistics/LogisticsResponse.cs new file mode 100644 index 00000000..6beb6f66 --- /dev/null +++ b/BBWY.Server.Model/Dto/Response/Logistics/LogisticsResponse.cs @@ -0,0 +1,9 @@ +namespace BBWY.Server.Model.Dto +{ + public class LogisticsResponse + { + public string Id { get; set; } + + public string Name { get; set; } + } +}