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); } } /// /// 单件均摊成本 /// 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; } /// /// 单件发货预估运费(不参与单件均摊成本计算) /// public decimal SingleDeliveryFreight { get => singleDeliveryFreight; set { SetProperty(ref singleDeliveryFreight, value); } } ///// ///// 单间操作成本 ///// //public decimal SingleOperationAmount //{ // get => singleOperationAmount; // set // { // if (SetProperty(ref singleOperationAmount, value)) // RefreshUnitCost(); // } //} /// /// 单件耗材成本 /// public decimal SingleConsumableAmount { get => singleConsumableAmount; set { if (SetProperty(ref singleConsumableAmount, value)) RefreshUnitCost(); } } /// /// 单件SKU成本 /// public decimal SingleSkuAmount { get => singleSkuAmount; set { if (SetProperty(ref singleSkuAmount, value)) RefreshUnitCost(); } } /// /// 单件采购运费 /// public decimal SingleFreight { get => singleFreight; set { if (SetProperty(ref singleFreight, value)) RefreshUnitCost(); } } /// /// 单件头程费 /// public decimal SingleFirstFreight { get => singleFirstFreight; set { if (SetProperty(ref singleFirstFreight, value)) RefreshUnitCost(); } } /// /// 单件仓储费 /// 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; } }