diff --git a/BBWY.Client/APIServices/ShopService.cs b/BBWY.Client/APIServices/ShopService.cs index 234f969e..78082e38 100644 --- a/BBWY.Client/APIServices/ShopService.cs +++ b/BBWY.Client/APIServices/ShopService.cs @@ -27,5 +27,15 @@ namespace BBWY.Client.APIServices purchaseAccount.PurchasePlatformId }, null, HttpMethod.Post); } + + /// + /// 根据订单Id查询归属店铺 + /// + /// + /// + public ApiResponse> GetOrderBelongShop(IList orderIdList) + { + return SendRequest>(globalContext.BBYWApiHost, "api/order/GetOrderBelongShop", orderIdList, null, HttpMethod.Post); + } } } diff --git a/BBWY.Client/Models/APIModel/Response/OrderBelongShopResponse.cs b/BBWY.Client/Models/APIModel/Response/OrderBelongShopResponse.cs new file mode 100644 index 00000000..f3952443 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/OrderBelongShopResponse.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +namespace BBWY.Client.Models +{ + public class OrderBelongShopResponse + { + public long ShopId { get; set; } + + public string ShopName { get; set; } + + public IList OrderIdList { get; set; } + } +} diff --git a/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs b/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs index 089cbd38..af6d353b 100644 --- a/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs +++ b/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs @@ -1,4 +1,5 @@ -using BBWY.Client.Extensions; +using BBWY.Client.APIServices; +using BBWY.Client.Extensions; using BBWY.Client.Models; using BBWY.Common.Models; using GalaSoft.MvvmLight.Command; @@ -25,6 +26,7 @@ namespace BBWY.Client.ViewModels private bool isShowPurchaseOrderPanel; private bool isShowShopOrderPanel; private bool onlyException; + private ShopService shopService; public IList AuditFileList { get; set; } @@ -114,12 +116,13 @@ namespace BBWY.Client.ViewModels public ICommand ImportJDShopOrderCommand { get; set; } - public ProcurementAuditViewModel() + public ProcurementAuditViewModel(ShopService shopService) { AuditFileList = new ObservableCollection(); AuditCommand = new RelayCommand(Audit); ClearAuditCommand = new RelayCommand(ClearAudit); ImportAliPayBillCommand = new RelayCommand(ImportAliPayBill); + this.shopService = shopService; Import1688PurchaseOrderCommand = new RelayCommand(Import1688PurchaseOrder); @@ -214,6 +217,20 @@ namespace BBWY.Client.ViewModels payBill.RelationShopOrderId = relationShopOrder.OrderId; #endregion } + + var relationShoporderIds = AuditPayBillList.Where(p => !string.IsNullOrEmpty(p.RelationShopOrderId)).Select(p => p.RelationShopOrderId).ToList(); + var belongResponse = shopService.GetOrderBelongShop(relationShoporderIds); + if (!belongResponse.Success || belongResponse.Data.Count() == 0) + return; + + foreach (var payBill in AuditPayBillList) + { + if (string.IsNullOrEmpty(payBill.RelationShopOrderId)) + continue; + var belongShop = belongResponse.Data.FirstOrDefault(x => x.OrderIdList.Contains(payBill.RelationShopOrderId)); + if (belongShop != null) + payBill.BelongShop = belongShop.ShopName; + } } catch (Exception ex) { @@ -262,6 +279,19 @@ namespace BBWY.Client.ViewModels purchaseOrder.RelationShopOrderId = relationShopOrder.OrderId; #endregion } + + var relationShopOrderIds = AuditPurchaseOrderList.Where(p => !string.IsNullOrEmpty(p.RelationShopOrderId)).Select(p => p.RelationShopOrderId).ToList(); + var belongResponse = shopService.GetOrderBelongShop(relationShopOrderIds); + if (!belongResponse.Success || belongResponse.Data.Count() == 0) + return; + foreach (var purchaseOrder in AuditPurchaseOrderList) + { + if (string.IsNullOrEmpty(purchaseOrder.RelationShopOrderId)) + continue; + var belongShop = belongResponse.Data.FirstOrDefault(x => x.OrderIdList.Contains(purchaseOrder.RelationShopOrderId)); + if (belongShop != null) + purchaseOrder.BelongShop = belongShop.ShopName; + } } catch (Exception ex) { diff --git a/BBWY.Server.Business/Order/OrderBusiness.cs b/BBWY.Server.Business/Order/OrderBusiness.cs index 4ffe5d82..cf818e82 100644 --- a/BBWY.Server.Business/Order/OrderBusiness.cs +++ b/BBWY.Server.Business/Order/OrderBusiness.cs @@ -348,7 +348,7 @@ namespace BBWY.Server.Business var orderBelongShop = new OrderBelongShopResponse() { ShopId = orderGroup.Key, - ShpName = shop.ShopName, + ShopName = shop.ShopName, OrderIdList = orderGroup.Select(x => x.OrderId).ToList() }; list.Add(orderBelongShop); diff --git a/BBWY.Server.Model/Dto/Response/Vender/OrderBelongShopResponse.cs b/BBWY.Server.Model/Dto/Response/Vender/OrderBelongShopResponse.cs index f7cc99f3..04395cf5 100644 --- a/BBWY.Server.Model/Dto/Response/Vender/OrderBelongShopResponse.cs +++ b/BBWY.Server.Model/Dto/Response/Vender/OrderBelongShopResponse.cs @@ -6,7 +6,7 @@ namespace BBWY.Server.Model.Dto { public long ShopId { get; set; } - public string ShpName { get; set; } + public string ShopName { get; set; } public IList OrderIdList { get; set; } }