You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

177 lines
5.0 KiB

using CommunityToolkit.Mvvm.ComponentModel;
using System;
namespace BBWYB.Client.Models
{
public class PurchaseOrder : ObservableObject
{
public long Id { get; set; }
public DateTime? CreateTime { get; set; }
public string ProductId { get; set; }
public PurchaseMethod? PurchaseMethod { get; set; }
public string PurchaseOrderId { get; set; }
public Platform? PurchasePlatform { get; set; }
public string SkuId { get; set; }
public StorageType? StorageType { get; set; }
public long? UserId { get; set; }
public bool IsEdit { get => isEdit; set { SetProperty(ref isEdit, value); } }
/// <summary>
/// 单件均摊成本
/// </summary>
public decimal UnitCost { get => unitCost; private set { SetProperty(ref unitCost, value); } }
public int PurchaseQuantity
{
get => purchaseQuantity; set
{
SetProperty(ref purchaseQuantity, value);
RefreshUnitCost();
if (IsEdit)
RemainingQuantity = value;
}
}
public int RemainingQuantity { get => remainingQuantity; set { SetProperty(ref remainingQuantity, value); } }
public long ShopId { get; set; }
/// <summary>
/// 单件发货预估运费(不参与单件均摊成本计算)
/// </summary>
public decimal SingleDeliveryFreight
{
get => singleDeliveryFreight; set { SetProperty(ref singleDeliveryFreight, value); }
}
///// <summary>
///// 单间操作成本
///// </summary>
//public decimal SingleOperationAmount
//{
// get => singleOperationAmount;
// set
// {
// if (SetProperty(ref singleOperationAmount, value))
// RefreshUnitCost();
// }
//}
/// <summary>
/// 单件耗材成本
/// </summary>
public decimal SingleConsumableAmount
{
get => singleConsumableAmount;
set
{
if (SetProperty(ref singleConsumableAmount, value))
RefreshUnitCost();
}
}
/// <summary>
/// 单件SKU成本
/// </summary>
public decimal SingleSkuAmount
{
get => singleSkuAmount;
set
{
if (SetProperty(ref singleSkuAmount, value))
RefreshUnitCost();
}
}
/// <summary>
/// 单件采购运费
/// </summary>
public decimal SingleFreight
{
get => singleFreight;
set
{
if (SetProperty(ref singleFreight, value))
RefreshUnitCost();
}
}
/// <summary>
/// 单件头程费
/// </summary>
public decimal SingleFirstFreight
{
get => singleFirstFreight;
set
{
if (SetProperty(ref singleFirstFreight, value))
RefreshUnitCost();
}
}
/// <summary>
/// 单件仓储费
/// </summary>
public decimal SingleStorageAmount
{
get => singleStorageAmount;
set
{
if (SetProperty(ref singleStorageAmount, value))
RefreshUnitCost();
}
}
public decimal SingleInStorageAmount
{
get => singleInStorageAmount;
set
{
if (SetProperty(ref singleInStorageAmount, value))
RefreshUnitCost();
}
}
public decimal SingleOutStorageAmount
{
get => singleOutStorageAmount;
set
{
if (SetProperty(ref singleOutStorageAmount, value))
RefreshUnitCost();
}
}
public decimal SingleRefundInStorageAmount { get => singleRefundInStorageAmount; set { SetProperty(ref singleRefundInStorageAmount, value); } }
public void RefreshUnitCost()
{
UnitCost = SingleSkuAmount + SingleFreight + SingleFirstFreight + SingleInStorageAmount + SingleOutStorageAmount + SingleConsumableAmount + SingleStorageAmount;
}
private bool isEdit;
private decimal unitCost;
private int purchaseQuantity;
private int remainingQuantity;
private decimal singleSkuAmount;
private decimal singleFreight;
private decimal singleFirstFreight;
private decimal singleDeliveryFreight;
//private decimal singleOperationAmount;
private decimal singleConsumableAmount;
private decimal singleStorageAmount;
private decimal singleInStorageAmount;
private decimal singleOutStorageAmount;
private decimal singleRefundInStorageAmount;
}
}