Browse Source

关联订单 邮费改为采购运费

qianyi
shanji 3 years ago
parent
commit
fbb2756c87
  1. 9
      BBWY.Client/Models/APIModel/Response/Order/OrderDropShippingResponse.cs
  2. 43
      BBWY.Client/Models/Order/OrderDropShipping.cs
  3. 2
      BBWY.Client/Views/MainWindow.xaml
  4. 19
      BBWY.Client/Views/Order/RelationPurchaseOrder.xaml
  5. 5
      BBWY.Client/Views/Order/RelationPurchaseOrder.xaml.cs
  6. 10
      BBWY.Server.Business/Order/OrderBusiness.cs
  7. 6
      BBWY.Server.Model/Db/Order/Order.cs
  8. 14
      BBWY.Server.Model/Db/Order/OrderDropShipping.cs
  9. 4
      BBWY.Server.Model/MappingProfiles.cs

9
BBWY.Client/Models/APIModel/Response/Order/OrderDropShippingResponse.cs

@ -15,5 +15,14 @@
public Platform? PurchasePlatform { get; set; } public Platform? PurchasePlatform { get; set; }
public string SellerAccount { get; set; } public string SellerAccount { get; set; }
public decimal SkuAmount
{
get; set;
}
public decimal PurchaseFreight
{
get; set;
}
} }
} }

43
BBWY.Client/Models/Order/OrderDropShipping.cs

@ -2,6 +2,12 @@
{ {
public class OrderDropShipping : NotifyObject public class OrderDropShipping : NotifyObject
{ {
public OrderDropShipping()
{
if (PurchaseFreight != 0M)
PurchaseFreightStr = PurchaseFreight.ToString();
}
public string OrderId { get; set; } public string OrderId { get; set; }
public string BuyerAccount { get => buyerAccount; set { Set(ref buyerAccount, value); } } public string BuyerAccount { get => buyerAccount; set { Set(ref buyerAccount, value); } }
public string SellerAccount { get => sellerAccount; set { Set(ref sellerAccount, 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 Platform PurchasePlatform { get => purchasePlatform; set { Set(ref purchasePlatform, value); } }
public decimal PurchaseAmount { get => purchaseAmount; set { Set(ref purchaseAmount, 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 buyerAccount;
private string sellerAccount; private string sellerAccount;
private decimal deliveryFreight; private decimal deliveryFreight;
private string purchaseOrderId; private string purchaseOrderId;
private Platform purchasePlatform; private Platform purchasePlatform;
private decimal purchaseAmount; private decimal purchaseAmount;
private decimal skuAmount;
private decimal purchaseFreight;
private string purchaseFreightStr;
private void OnAmountChanged()
{
PurchaseAmount = SkuAmount + PurchaseFreight;
}
} }
} }

2
BBWY.Client/Views/MainWindow.xaml

@ -26,7 +26,7 @@
<!--<TextBlock Text="{Binding GlobalContext.User.TeamName}" Margin="5,0,0,0"/> <!--<TextBlock Text="{Binding GlobalContext.User.TeamName}" Margin="5,0,0,0"/>
<TextBlock Text="{Binding GlobalContext.User.Shop.Platform}" Margin="5,0,0,0"/>--> <TextBlock Text="{Binding GlobalContext.User.Shop.Platform}" Margin="5,0,0,0"/>-->
<TextBlock Text="{Binding GlobalContext.User.Shop.Name}" Margin="5,0,0,0"/> <TextBlock Text="{Binding GlobalContext.User.Shop.Name}" Margin="5,0,0,0"/>
<TextBlock Text="v10007内测" Margin="5,0,0,0"/> <TextBlock Text="v10007" Margin="5,0,0,0"/>
</StackPanel> </StackPanel>
</Border> </Border>
<Grid Grid.Row="1"> <Grid Grid.Row="1">

19
BBWY.Client/Views/Order/RelationPurchaseOrder.xaml

@ -65,11 +65,11 @@
<TextBlock Text="卖家账号" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="2" Grid.Column="2"/> <TextBlock Text="卖家账号" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="2" Grid.Column="2"/>
<c:BTextBox Text="{Binding OrderDropShipping.SellerAccount}" Grid.Row="2" Grid.Column="3" Height="25" Margin="5,0,0,0"/> <c:BTextBox Text="{Binding OrderDropShipping.SellerAccount}" Grid.Row="2" Grid.Column="3" Height="25" Margin="5,0,0,0"/>
<TextBlock Text="采购金额" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="3"/> <TextBlock Text="货款金额" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="3"/>
<c:BTextBox Text="{Binding OrderDropShipping.PurchaseAmount,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}" Grid.Row="3" Grid.Column="1" Height="25" Margin="5,0,0,0" IsEnabled="false" DisableBgColor="{StaticResource TextBox.Disable.BgColor}"/> <c:BTextBox Text="{Binding OrderDropShipping.SkuAmount,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}" Grid.Row="3" Grid.Column="1" Height="25" Margin="5,0,0,0" IsEnabled="false" DisableBgColor="{StaticResource TextBox.Disable.BgColor}"/>
<TextBlock Text="费" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="3" Grid.Column="2"/> <TextBlock Text="采购运费" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="3" Grid.Column="2"/>
<c:BTextBox Text="{Binding OrderDropShipping.DeliveryFreight}" Grid.Row="3" Grid.Column="3" Height="25" Margin="5,0,0,0"/> <c:BTextBox Text="{Binding OrderDropShipping.PurchaseFreightStr,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Grid.Row="3" Grid.Column="3" Height="25" Margin="5,0,0,0"/>
</Grid> </Grid>
@ -134,8 +134,15 @@
</ListBox.ItemTemplate> </ListBox.ItemTemplate>
</ListBox> </ListBox>
</Grid> </Grid>
<c:BButton x:Name="btn_Save" Content="保存" Grid.Row="3" Width="60" HorizontalAlignment="Right" Margin="0,0,8,0" <StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Right">
<TextBlock VerticalAlignment="Center" Margin="0,0,8,0">
<Run Text="总计"/>
<Run Text="{Binding OrderDropShipping.PurchaseAmount}"/>
<Run Text="元"/>
</TextBlock>
<c:BButton x:Name="btn_Save" Content="保存" Width="60" Margin="0,0,8,0"
Click="btn_Save_Click"/> Click="btn_Save_Click"/>
</StackPanel>
</Grid> </Grid>
</c:BWindow> </c:BWindow>

5
BBWY.Client/Views/Order/RelationPurchaseOrder.xaml.cs

@ -28,6 +28,9 @@ namespace BBWY.Client.Views.Order
OrderDropShipping.DeliveryFreight = orderDropShipping.DeliveryFreight; OrderDropShipping.DeliveryFreight = orderDropShipping.DeliveryFreight;
OrderDropShipping.PurchasePlatform = orderDropShipping.PurchasePlatform; OrderDropShipping.PurchasePlatform = orderDropShipping.PurchasePlatform;
OrderDropShipping.SellerAccount = orderDropShipping.SellerAccount; OrderDropShipping.SellerAccount = orderDropShipping.SellerAccount;
OrderDropShipping.SkuAmount = orderDropShipping.SkuAmount;
OrderDropShipping.PurchaseFreight = orderDropShipping.PurchaseFreight;
OrderDropShipping.PurchaseFreightStr = orderDropShipping.PurchaseFreight.ToString();
} }
this.RelationPurchaseOrderSkuList = relationPurchaseOrderSkuList; this.RelationPurchaseOrderSkuList = relationPurchaseOrderSkuList;
foreach (var sku in RelationPurchaseOrderSkuList) foreach (var sku in RelationPurchaseOrderSkuList)
@ -36,7 +39,7 @@ namespace BBWY.Client.Views.Order
private void OnSkuAmountChanged() 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) private void btn_Save_Click(object sender, System.Windows.RoutedEventArgs e)

10
BBWY.Server.Business/Order/OrderBusiness.cs

@ -129,6 +129,8 @@ namespace BBWY.Server.Business
PurchaseOrderId = ods.PurchaseOrderId, PurchaseOrderId = ods.PurchaseOrderId,
PurchasePlatform = ods.PurchasePlatform, PurchasePlatform = ods.PurchasePlatform,
SellerAccount = ods.SellerAccount, SellerAccount = ods.SellerAccount,
OrderDropShippingSkuAmount = ods.SkuAmount,
OrderDropShippingPurchaseFreight = ods.PurchaseFreight,
}); });
var orderList = orderSourceList.Map<IList<OrderResponse>>(); var orderList = orderSourceList.Map<IList<OrderResponse>>();
@ -301,6 +303,8 @@ namespace BBWY.Server.Business
PurchaseOrderId = ods.PurchaseOrderId, PurchaseOrderId = ods.PurchaseOrderId,
PurchasePlatform = ods.PurchasePlatform, PurchasePlatform = ods.PurchasePlatform,
SellerAccount = ods.SellerAccount, SellerAccount = ods.SellerAccount,
OrderDropShippingSkuAmount = ods.SkuAmount,
OrderDropShippingPurchaseFreight = ods.PurchaseFreight,
}); });
if (order == null) if (order == null)
throw new BusinessException("订单不存在"); throw new BusinessException("订单不存在");
@ -686,7 +690,7 @@ namespace BBWY.Server.Business
SkuId = x.SkuId, SkuId = x.SkuId,
SingleConsumableAmount = 0, SingleConsumableAmount = 0,
SingleFirstFreight = 0, SingleFirstFreight = 0,
SingleFreight = 0, SingleFreight = relationPurchaseOrderRequest.OrderDropShipping.PurchaseFreight / relationPurchaseOrderRequest.RelationPurchaseOrderSkuList.Count() / x.Quantity,
SingleOperationAmount = 0, SingleOperationAmount = 0,
SingleStorageAmount = 0, SingleStorageAmount = 0,
SingleSkuAmount = x.SingleSkuAmount, SingleSkuAmount = x.SingleSkuAmount,
@ -754,11 +758,11 @@ namespace BBWY.Server.Business
OperationAmount = 0, OperationAmount = 0,
OrderId = relationPurchaseOrderRequest.OrderDropShipping.OrderId, OrderId = relationPurchaseOrderRequest.OrderDropShipping.OrderId,
ProductId = x.ProductId, ProductId = x.ProductId,
PurchaseFreight = 0, PurchaseFreight = relationPurchaseOrderRequest.OrderDropShipping.PurchaseFreight / relationPurchaseOrderRequest.RelationPurchaseOrderSkuList.Count(),
SkuAmount = x.SingleSkuAmount * x.Quantity, SkuAmount = x.SingleSkuAmount * x.Quantity,
SkuId = x.SkuId, SkuId = x.SkuId,
StorageAmount = 0, StorageAmount = 0,
TotalCost = x.SingleSkuAmount * x.Quantity, TotalCost = x.SingleSkuAmount * x.Quantity + relationPurchaseOrderRequest.OrderDropShipping.PurchaseFreight / relationPurchaseOrderRequest.RelationPurchaseOrderSkuList.Count(),
UnitCost = x.SingleSkuAmount, UnitCost = x.SingleSkuAmount,
PurchaseOrderPKId = insertPurchaseOrderList.FirstOrDefault(po => po.SkuId == x.SkuId).Id PurchaseOrderPKId = insertPurchaseOrderList.FirstOrDefault(po => po.SkuId == x.SkuId).Id
})); }));

6
BBWY.Server.Model/Db/Order/Order.cs

@ -246,6 +246,12 @@ namespace BBWY.Server.Model.Db
/// </summary> /// </summary>
[Column(IsIgnore = true)] [Column(IsIgnore = true)]
public string SellerAccount { get; set; } public string SellerAccount { get; set; }
[Column(IsIgnore = true)]
public decimal OrderDropShippingSkuAmount { get; set; }
[Column(IsIgnore = true)]
public decimal OrderDropShippingPurchaseFreight { get; set; }
#endregion #endregion
} }

14
BBWY.Server.Model/Db/Order/OrderDropShipping.cs

@ -40,6 +40,18 @@ namespace BBWY.Server.Model.Db
[Column(DbType = "decimal(20,2)")] [Column(DbType = "decimal(20,2)")]
public decimal PurchaseAmount { get; set; } = 0.00M; public decimal PurchaseAmount { get; set; } = 0.00M;
/// <summary>
///货款
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal SkuAmount { get; set; }
/// <summary>
/// 采购运费
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal PurchaseFreight { get; set; }
/// <summary> /// <summary>
/// 采购单号 /// 采购单号
/// </summary> /// </summary>
@ -58,6 +70,8 @@ namespace BBWY.Server.Model.Db
[Column(StringLength = 200)] [Column(StringLength = 200)]
public string SellerAccount { get; set; } public string SellerAccount { get; set; }
} }
} }

4
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.DeliveryFreight, opt => opt.MapFrom(f => f.DeliveryFreight))
.ForPath(t => t.OrderDropShipping.PurchasePlatform, opt => opt.MapFrom(f => f.PurchasePlatform)) .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.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));
} }
} }

Loading…
Cancel
Save