From fbb2756c87b141cb161a050914a674433c859fcf Mon Sep 17 00:00:00 2001 From: shanj <18996038927@163.com> Date: Thu, 21 Apr 2022 11:17:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E8=81=94=E8=AE=A2=E5=8D=95=20?= =?UTF-8?q?=E9=82=AE=E8=B4=B9=E6=94=B9=E4=B8=BA=E9=87=87=E8=B4=AD=E8=BF=90?= =?UTF-8?q?=E8=B4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Order/OrderDropShippingResponse.cs | 9 ++++ BBWY.Client/Models/Order/OrderDropShipping.cs | 43 ++++++++++++++++++- BBWY.Client/Views/MainWindow.xaml | 2 +- .../Views/Order/RelationPurchaseOrder.xaml | 19 +++++--- .../Views/Order/RelationPurchaseOrder.xaml.cs | 5 ++- BBWY.Server.Business/Order/OrderBusiness.cs | 10 +++-- BBWY.Server.Model/Db/Order/Order.cs | 6 +++ .../Db/Order/OrderDropShipping.cs | 14 ++++++ BBWY.Server.Model/MappingProfiles.cs | 4 +- 9 files changed, 99 insertions(+), 13 deletions(-) diff --git a/BBWY.Client/Models/APIModel/Response/Order/OrderDropShippingResponse.cs b/BBWY.Client/Models/APIModel/Response/Order/OrderDropShippingResponse.cs index cda733ee..7c7ea1b7 100644 --- a/BBWY.Client/Models/APIModel/Response/Order/OrderDropShippingResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/Order/OrderDropShippingResponse.cs @@ -15,5 +15,14 @@ public Platform? PurchasePlatform { get; set; } public string SellerAccount { get; set; } + + public decimal SkuAmount + { + get; set; + } + public decimal PurchaseFreight + { + get; set; + } } } diff --git a/BBWY.Client/Models/Order/OrderDropShipping.cs b/BBWY.Client/Models/Order/OrderDropShipping.cs index cc552b2a..20fa298f 100644 --- a/BBWY.Client/Models/Order/OrderDropShipping.cs +++ b/BBWY.Client/Models/Order/OrderDropShipping.cs @@ -2,6 +2,12 @@ { public class OrderDropShipping : NotifyObject { + public OrderDropShipping() + { + if (PurchaseFreight != 0M) + PurchaseFreightStr = PurchaseFreight.ToString(); + } + public string OrderId { get; set; } public string BuyerAccount { get => buyerAccount; set { Set(ref buyerAccount, value); } } public string SellerAccount { get => sellerAccount; set { Set(ref sellerAccount, value); } } @@ -10,13 +16,48 @@ public Platform PurchasePlatform { get => purchasePlatform; set { Set(ref purchasePlatform, value); } } public decimal PurchaseAmount { get => purchaseAmount; set { Set(ref purchaseAmount, value); } } + public decimal SkuAmount + { + get => skuAmount; set + { + if (Set(ref skuAmount, value)) + OnAmountChanged(); + } + } + public decimal PurchaseFreight + { + get => purchaseFreight; set + { + if (Set(ref purchaseFreight, value)) + OnAmountChanged(); + } + } + + public string PurchaseFreightStr + { + get => purchaseFreightStr; set + { + if (Set(ref purchaseFreightStr, value)) + { + if (decimal.TryParse(purchaseFreightStr, out decimal d)) + PurchaseFreight = d; + } + } + } + private string buyerAccount; private string sellerAccount; private decimal deliveryFreight; private string purchaseOrderId; private Platform purchasePlatform; private decimal purchaseAmount; + private decimal skuAmount; + private decimal purchaseFreight; + private string purchaseFreightStr; - + private void OnAmountChanged() + { + PurchaseAmount = SkuAmount + PurchaseFreight; + } } } diff --git a/BBWY.Client/Views/MainWindow.xaml b/BBWY.Client/Views/MainWindow.xaml index 9a8f5952..d2f23c7a 100644 --- a/BBWY.Client/Views/MainWindow.xaml +++ b/BBWY.Client/Views/MainWindow.xaml @@ -26,7 +26,7 @@ - + diff --git a/BBWY.Client/Views/Order/RelationPurchaseOrder.xaml b/BBWY.Client/Views/Order/RelationPurchaseOrder.xaml index a236d24c..f477bcf1 100644 --- a/BBWY.Client/Views/Order/RelationPurchaseOrder.xaml +++ b/BBWY.Client/Views/Order/RelationPurchaseOrder.xaml @@ -65,11 +65,11 @@ - - + + - - + + @@ -134,8 +134,15 @@ - - + + + + + + + diff --git a/BBWY.Client/Views/Order/RelationPurchaseOrder.xaml.cs b/BBWY.Client/Views/Order/RelationPurchaseOrder.xaml.cs index ef534cb2..07082abf 100644 --- a/BBWY.Client/Views/Order/RelationPurchaseOrder.xaml.cs +++ b/BBWY.Client/Views/Order/RelationPurchaseOrder.xaml.cs @@ -28,6 +28,9 @@ namespace BBWY.Client.Views.Order OrderDropShipping.DeliveryFreight = orderDropShipping.DeliveryFreight; OrderDropShipping.PurchasePlatform = orderDropShipping.PurchasePlatform; OrderDropShipping.SellerAccount = orderDropShipping.SellerAccount; + OrderDropShipping.SkuAmount = orderDropShipping.SkuAmount; + OrderDropShipping.PurchaseFreight = orderDropShipping.PurchaseFreight; + OrderDropShipping.PurchaseFreightStr = orderDropShipping.PurchaseFreight.ToString(); } this.RelationPurchaseOrderSkuList = relationPurchaseOrderSkuList; foreach (var sku in RelationPurchaseOrderSkuList) @@ -36,7 +39,7 @@ namespace BBWY.Client.Views.Order private void OnSkuAmountChanged() { - OrderDropShipping.PurchaseAmount = RelationPurchaseOrderSkuList.Sum(sku => sku.SkuAmount); + OrderDropShipping.SkuAmount = RelationPurchaseOrderSkuList.Sum(sku => sku.SkuAmount); } private void btn_Save_Click(object sender, System.Windows.RoutedEventArgs e) diff --git a/BBWY.Server.Business/Order/OrderBusiness.cs b/BBWY.Server.Business/Order/OrderBusiness.cs index 0c80e400..729a015f 100644 --- a/BBWY.Server.Business/Order/OrderBusiness.cs +++ b/BBWY.Server.Business/Order/OrderBusiness.cs @@ -129,6 +129,8 @@ namespace BBWY.Server.Business PurchaseOrderId = ods.PurchaseOrderId, PurchasePlatform = ods.PurchasePlatform, SellerAccount = ods.SellerAccount, + OrderDropShippingSkuAmount = ods.SkuAmount, + OrderDropShippingPurchaseFreight = ods.PurchaseFreight, }); var orderList = orderSourceList.Map>(); @@ -301,6 +303,8 @@ namespace BBWY.Server.Business PurchaseOrderId = ods.PurchaseOrderId, PurchasePlatform = ods.PurchasePlatform, SellerAccount = ods.SellerAccount, + OrderDropShippingSkuAmount = ods.SkuAmount, + OrderDropShippingPurchaseFreight = ods.PurchaseFreight, }); if (order == null) throw new BusinessException("订单不存在"); @@ -686,7 +690,7 @@ namespace BBWY.Server.Business SkuId = x.SkuId, SingleConsumableAmount = 0, SingleFirstFreight = 0, - SingleFreight = 0, + SingleFreight = relationPurchaseOrderRequest.OrderDropShipping.PurchaseFreight / relationPurchaseOrderRequest.RelationPurchaseOrderSkuList.Count() / x.Quantity, SingleOperationAmount = 0, SingleStorageAmount = 0, SingleSkuAmount = x.SingleSkuAmount, @@ -754,11 +758,11 @@ namespace BBWY.Server.Business OperationAmount = 0, OrderId = relationPurchaseOrderRequest.OrderDropShipping.OrderId, ProductId = x.ProductId, - PurchaseFreight = 0, + PurchaseFreight = relationPurchaseOrderRequest.OrderDropShipping.PurchaseFreight / relationPurchaseOrderRequest.RelationPurchaseOrderSkuList.Count(), SkuAmount = x.SingleSkuAmount * x.Quantity, SkuId = x.SkuId, StorageAmount = 0, - TotalCost = x.SingleSkuAmount * x.Quantity, + TotalCost = x.SingleSkuAmount * x.Quantity + relationPurchaseOrderRequest.OrderDropShipping.PurchaseFreight / relationPurchaseOrderRequest.RelationPurchaseOrderSkuList.Count(), UnitCost = x.SingleSkuAmount, PurchaseOrderPKId = insertPurchaseOrderList.FirstOrDefault(po => po.SkuId == x.SkuId).Id })); diff --git a/BBWY.Server.Model/Db/Order/Order.cs b/BBWY.Server.Model/Db/Order/Order.cs index 5e5f8f9e..1f39c77d 100644 --- a/BBWY.Server.Model/Db/Order/Order.cs +++ b/BBWY.Server.Model/Db/Order/Order.cs @@ -246,6 +246,12 @@ namespace BBWY.Server.Model.Db /// [Column(IsIgnore = true)] public string SellerAccount { get; set; } + + [Column(IsIgnore = true)] + public decimal OrderDropShippingSkuAmount { get; set; } + + [Column(IsIgnore = true)] + public decimal OrderDropShippingPurchaseFreight { get; set; } #endregion } diff --git a/BBWY.Server.Model/Db/Order/OrderDropShipping.cs b/BBWY.Server.Model/Db/Order/OrderDropShipping.cs index b9d10993..79d66140 100644 --- a/BBWY.Server.Model/Db/Order/OrderDropShipping.cs +++ b/BBWY.Server.Model/Db/Order/OrderDropShipping.cs @@ -40,6 +40,18 @@ namespace BBWY.Server.Model.Db [Column(DbType = "decimal(20,2)")] public decimal PurchaseAmount { get; set; } = 0.00M; + /// + ///货款 + /// + [Column(DbType = "decimal(20,2)")] + public decimal SkuAmount { get; set; } + + /// + /// 采购运费 + /// + [Column(DbType = "decimal(20,2)")] + public decimal PurchaseFreight { get; set; } + /// /// 采购单号 /// @@ -58,6 +70,8 @@ namespace BBWY.Server.Model.Db [Column(StringLength = 200)] public string SellerAccount { get; set; } + + } } diff --git a/BBWY.Server.Model/MappingProfiles.cs b/BBWY.Server.Model/MappingProfiles.cs index 19834532..58d291c2 100644 --- a/BBWY.Server.Model/MappingProfiles.cs +++ b/BBWY.Server.Model/MappingProfiles.cs @@ -57,7 +57,9 @@ namespace BBWY.Server.Model .ForPath(t => t.OrderDropShipping.DeliveryFreight, opt => opt.MapFrom(f => f.DeliveryFreight)) .ForPath(t => t.OrderDropShipping.PurchasePlatform, opt => opt.MapFrom(f => f.PurchasePlatform)) .ForPath(t => t.OrderDropShipping.BuyerAccount, opt => opt.MapFrom(f => f.BuyerAccount)) - .ForPath(t => t.OrderDropShipping.SellerAccount, opt => opt.MapFrom(f => f.SellerAccount)); + .ForPath(t => t.OrderDropShipping.SellerAccount, opt => opt.MapFrom(f => f.SellerAccount)) + .ForPath(t => t.OrderDropShipping.SkuAmount, opt => opt.MapFrom(f => f.OrderDropShippingSkuAmount)) + .ForPath(t => t.OrderDropShipping.PurchaseFreight, opt => opt.MapFrom(f => f.OrderDropShippingPurchaseFreight)); } }