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

1113 lines
33 KiB
C#

9 months ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevComponents.DotNetBar.SuperGrid;
using Newtonsoft.Json;
using NPoco;
using POSV.Entity;
namespace POSV.ShoppingCart
{
[Serializable]
[JsonObject(MemberSerialization.OptIn)]
[TableName("pos_order_item")]
[PrimaryKey(new string[] { "id" }, AutoIncrement = false)]
public class OrderItem : BaseEntity, IEqualityComparer<OrderItem>
{
public OrderItem()
{
}
[Ignore]
public string clientId { get; set; }
/// <summary>
/// 租户ID
/// </summary>
[JsonProperty(PropertyName = "tenantId")]
[Column("tenantId")]
public string TenantId { get; set; }
/// <summary>
/// 订单ID
/// </summary>
[JsonProperty(PropertyName = "orderId")]
[Column("orderId")]
public string OrderId { get; set; }
/// <summary>
/// 订单号
/// </summary>
[JsonProperty(PropertyName = "tradeNo")]
[Column("tradeNo")]
public string TradeNo { get; set; }
/// <summary>
/// 明细ID
/// </summary>
[JsonProperty(PropertyName = "orgItemId")]
[Column("orgItemId")]
public string OrgItemId { get; set; }
[NonSerialized]
private GridRow _gridRow;
/// <summary>
/// Grid的唯一行索引这个对象无法序列化
/// </summary>
[JsonIgnore]
[Ignore]
public GridRow GridRow
{
get
{
return _gridRow;
}
set
{
_gridRow = value;
}
}
/// <summary>
/// 购物车-序号
/// </summary>
[JsonProperty(PropertyName = "orderNo")]
[Column("orderNo")]
public int OrderNo { get; set; }
/// <summary>
/// 购物车-名称
/// </summary>
[JsonProperty(PropertyName = "productName")]
[Column("productName")]
public string Name { get; set; }
/// <summary>
/// 简称
/// </summary>
[JsonProperty(PropertyName = "shortName")]
[Column("shortName")]
public string ShortName { get; set; }
/// <summary>
/// 规格名称
/// </summary>
[JsonProperty(PropertyName = "specName")]
[Column("specName")]
public string SpecName { get; set; }
private string _displayName = string.Empty;
/// <summary>
/// 界面品名显示
/// </summary>
[JsonProperty(PropertyName = "displayName")]
[Column("displayName")]
public string DisplayName
{
get
{
//判断参数配置中是否定义显示简称
bool showShortName = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CASHIER_SHOW_SHORTNAME, false);
//销售界面名称的显示
string showName = (showShortName && !string.IsNullOrEmpty(this.ShortName)) ? this.ShortName : this.Name;
//判断参数配置中是否定义显示规格
bool showSpecName = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CASHIER_SHOW_SPECNAME, true);
//销售界面规格的显示
string specName = showSpecName ? (string.IsNullOrEmpty(this.SpecName) ? "" : Global.Instance.Additional.Item1 + this.SpecName + Global.Instance.Additional.Item2) : "";
//附加规格到名称中
string result = showName + specName;
if (this.RowState == OrderRowState. || this.RowState == OrderRowState.)
{
if (this.Promotions != null)
{
//禁止收银前台赠送
bool notAllowShowGive = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CASHIER_NOT_ALLOW_SHOW_GIVE, true);
if (!notAllowShowGive && this.Promotions.Exists(x => x.PromotionType == PromotionType.))
{
result = Global.Instance.Additional.Item1 + "赠" + Global.Instance.Additional.Item2 + result;
}
//禁止收银前台折扣
bool notAllowShowDiscount = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CASHIER_NOT_ALLOW_SHOW_DISCOUNT, true);
if (!notAllowShowDiscount && this.Promotions.Exists(x => x.PromotionType == PromotionType. || x.PromotionType == PromotionType.))
{
result = Global.Instance.Additional.Item1 + "折" + Global.Instance.Additional.Item2 + result;
}
//禁止收银前台议价
bool notAllowShowBargain = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CASHIER_NOT_ALLOW_SHOW_BARGAIN, true);
if (!notAllowShowBargain && this.Promotions.Exists(x => x.PromotionType == PromotionType. || x.PromotionType == PromotionType.))
{
result = Global.Instance.Additional.Item1 + "议" + Global.Instance.Additional.Item2 + result;
}
//双数特价
if (this.Promotions.Exists(x => x.PromotionType == PromotionType. || x.PromotionType == PromotionType.))
{
result = Global.Instance.Additional.Item1 + "双" + Global.Instance.Additional.Item2 + result;
}
}
}
if (this.RowState == OrderRowState.)
{
result = Global.Instance.Additional.Item1 + "套" + Global.Instance.Additional.Item2 + result;
}
this._displayName = result;
return _displayName;
}
set
{
this._displayName = value;
}
}
private decimal _quantity;
/// <summary>
/// 购物车-数量
/// </summary>
[JsonProperty(PropertyName = "quantity")]
[Column("quantity")]
public decimal Quantity
{
get { return this._quantity; }
set
{
this._quantity = value;
//调整做法计价
if (this.Flavors != null)
{
this.Flavors.ForEach(x => x.OrderItemQuantity = this._quantity);
}
}
}
private decimal _refundQuantity = 0;
/// <summary>
/// 购物车-退数量
/// </summary>
[JsonProperty(PropertyName = "rquantity")]
[Column("rquantity")]
public decimal RefundQuantity
{
get { return this._refundQuantity; }
set
{
this._refundQuantity = value;
}
}
/// <summary>
/// 购物车-中途退数量
/// </summary>
[JsonProperty(PropertyName = "middleRefundQuantity")]
[Column("middleRefundQuantity")]
public decimal MiddleRefundQuantity { get; set; }
private decimal _usableRefundQuantity = decimal.Zero;
/// <summary>
/// 可退数量,显示用
/// </summary>
[JsonProperty(PropertyName = "usableRefundQuantity")]
[Ignore]
public decimal UsableRefundQuantity
{
get
{
if (this._usableRefundQuantity != decimal.Zero)
{
return this._usableRefundQuantity;
}
else
{
return this.Quantity - this.MiddleRefundQuantity;
}
}
set
{
_usableRefundQuantity = value;
}
}
/// <summary>
/// 售价
/// </summary>
[JsonProperty(PropertyName = "salePrice")]
[Column("salePrice")]
public decimal SalePrice { get; set; }
/// <summary>
/// 会员售价
/// </summary>
[Ignore]
public decimal MemberSalePrice { get; set; }
/// <summary>
/// 成本价
/// </summary>
[JsonProperty(PropertyName = "costPrice")]
[Column("costPrice")]
public decimal CostPrice { get; set; }
/// <summary>
/// 购物车-零售价
/// </summary>
[JsonProperty(PropertyName = "price")]
[Column("price")]
public decimal Price { get; set; }
/// <summary>
/// 折后单价
/// </summary>
[JsonProperty(PropertyName = "discountPrice")]
[Column("discountPrice")]
public decimal DiscountPrice { get; set; }
/// <summary>
/// 最低售价
/// </summary>
[JsonProperty(PropertyName = "minPrice")]
[Column("minPrice")]
public decimal MinPrice { get; set; }
/// <summary>
/// 会员价
/// </summary>
[JsonProperty(PropertyName = "memberPrice")]
[Column("memberPrice")]
public decimal MemberPrice { get; set; }
/// <summary>
/// 第三方价
/// </summary>
[JsonProperty(PropertyName = "otherPrice")]
[Column("otherPrice")]
public decimal OtherPrice { get; set; }
/// <summary>
/// 批发价
/// </summary>
[JsonProperty(PropertyName = "dispatchPrice")]
[Column("dispatchPrice")]
public decimal DispatchPrice { get; set; }
private decimal _amount = 0;
/// <summary>
/// 购物车金额小计 = 数量 * 销售单价
/// </summary>
[JsonProperty(PropertyName = "amount")]
[Column("amount")]
public decimal Amount
{
get
{
this._amount = OrderUtils.ToRound((this.Quantity - this.RefundQuantity) * this.Price);
return this._amount;
}
set
{
this._amount = value;
}
}
/// <summary>
/// 购物车显示-优惠
/// </summary>
[JsonProperty(PropertyName = "discount")]
[Column("discount")]
public decimal Discount { get; set; } = 0;
/// <summary>
/// 单品优惠率,不包含做法
/// </summary>
[JsonProperty(PropertyName = "discountRate")]
[Column("discountRate")]
public decimal DiscountRate
{
get
{
if (this.Amount == 0)
{
return 0;
}
return OrderUtils.ToRound(this.DiscountAmount / this.Amount);
}
}
/// <summary>
/// 购物车-行下划线
/// </summary>
[JsonProperty(PropertyName = "underline")]
[Column("underline")]
public int Underline { get; set; }
/// <summary>
/// 购物车-是否包含做法
/// </summary>
[JsonProperty(PropertyName = "flavor")]
[Column("flavor")]
public int Flavor { get; set; }
/// <summary>
/// 购物车-组标识
/// </summary>
[JsonProperty(PropertyName = "group")]
[Column("group")]
public string Group { get; set; }
/// <summary>
/// 购物车-父行
/// </summary>
[JsonProperty(PropertyName = "parentId")]
[Column("parentId")]
public string ParentId { get; set; }
/// <summary>
/// 购物车-加料方案
/// </summary>
[JsonProperty(PropertyName = "scheme")]
[Column("scheme")]
public string Scheme { get; set; }
/// <summary>
/// 行状态
/// </summary>
[JsonProperty(PropertyName = "rowState")]
[Column("isSuit")]
public OrderRowState RowState { get; set; }
/// <summary>
///道菜ID
/// </summary>
[JsonProperty(PropertyName = "suitId")]
[Column("suitId")]
public string SuitId { get; set; }
/// <summary>
/// 道菜基准数量
/// </summary>
[JsonProperty(PropertyName = "suitQuantity")]
[Column("suitQuantity")]
public decimal SuitQuantity { get; set; }
/// <summary>
/// 道菜基准加价
/// </summary>
[JsonProperty(PropertyName = "suitAddPrice")]
[Column("suitAddPrice")]
public decimal SuitAddPrice { get; set; }
/// <summary>
/// 道菜基准加价后的金额
/// </summary>
[JsonProperty(PropertyName = "suitAmount")]
[Column("suitAmount")]
public decimal SuitAmount { get; set; }
/// <summary>
/// 操作行为
/// </summary>
[JsonProperty(PropertyName = "action")]
[Column("action")]
public string Action { get; set; } = string.Empty;
/// <summary>
/// 行备注
/// </summary>
[JsonProperty(PropertyName = "remark")]
[Column("remark")]
public string Remark { get; set; } = string.Empty;
/// <summary>
/// 商品对应的详细信息,包含规格、价格信息
/// </summary>
[JsonProperty(PropertyName = "product")]
[Ignore]
public ProductExt ProductExt { get; set; }
/// <summary>
/// 单品享受的优惠列表
/// </summary>
[JsonProperty(PropertyName = "promotions")]
[Ignore]
public List<PromotionItem> Promotions { get; set; }
/// <summary>
/// 支付方式分摊明细
/// </summary>
[JsonProperty(PropertyName = "itemPayList")]
[Ignore]
public List<OrderItemPay> ItemPayList { get; set; }
/// <summary>
/// 做法/要求明细
/// </summary>
[JsonProperty(PropertyName = "flavors")]
[Ignore]
public List<FlavorItem> Flavors { get; set; } = new List<FlavorItem>();
private int _flavorCount = 0;
/// <summary>
/// 单品做法总数量
/// </summary>
[JsonProperty(PropertyName = "flavorCount")]
[Column("flavorCount")]
public int FlavorCount
{
get
{
if (this.RowState == OrderRowState.)
{
return this._flavorCount;
}
else
{
this._flavorCount = (int)(this.Flavors == null ? 0 : Flavors.Sum(x => x.Quantity));
return this._flavorCount;
}
}
set
{
this._flavorCount = value;
}
}
private decimal _flavorAmount = 0;
/// <summary>
/// 做法/要求加价合计金额
/// </summary>
[JsonProperty(PropertyName = "flavorAmount")]
[Column("flavorAmount")]
public decimal FlavorAmount
{
get
{
if (this.RowState == OrderRowState.)
{
return this._flavorAmount;
}
else
{
this._flavorAmount = (this.Flavors == null ? 0 : this.Flavors.Sum(x => x.Amount));
return this._flavorAmount;
}
}
set
{
this._flavorAmount = value;
}
}
private decimal _flavorDiscountAmount = 0;
/// <summary>
/// 做法/要求加价优惠金额
/// </summary>
[JsonProperty(PropertyName = "flavorDiscountAmount")]
[Column("flavorDiscountAmount")]
public decimal FlavorDiscountAmount
{
get
{
if (this.RowState == OrderRowState.)
{
return this._flavorDiscountAmount;
}
else
{
this._flavorDiscountAmount = (this.Flavors == null ? 0 : this.Flavors.Sum(x => x.DiscountAmount));
return this._flavorDiscountAmount;
}
}
set
{
this._flavorDiscountAmount = value;
}
}
private decimal _flavorReceivableAmount = 0;
/// <summary>
/// 做法/要求加价应收金额
/// </summary>
[JsonProperty(PropertyName = "flavorReceivableAmount")]
[Column("flavorReceivableAmount")]
public decimal FlavorReceivableAmount
{
get
{
if (this.RowState == OrderRowState.)
{
return this._flavorReceivableAmount;
}
else
{
this._flavorReceivableAmount = (this.Flavors == null ? 0 : this.Flavors.Sum(x => x.ReceivableAmount));
return this._flavorReceivableAmount;
}
}
set
{
this._flavorReceivableAmount = value;
}
}
/// <summary>
/// 做法/要求描述
/// </summary>
[JsonProperty(PropertyName = "flavorNames")]
[Column("flavorNames")]
public string FlavorNames
{
get
{
if (this.Flavors == null || this.Flavors.Count == 0)
{
return "";
}
return string.Join(",", this.Flavors.ConvertAll<string>(m => m.ToString()).ToArray());
}
}
/// <summary>
/// 标签打印名称
/// </summary>
[JsonIgnore]
[Ignore]
public string LabelFlavorNames
{
get
{
if (this.Flavors == null || this.Flavors.Count == 0)
{
return "";
}
return string.Join(",", this.Flavors.ConvertAll<string>(m => m.ToLabelString()).ToArray());
}
}
private decimal _totalAmount = 0;
/// <summary>
/// 总金额 = 商品小计+做法小计
/// </summary>
[JsonProperty(PropertyName = "totalAmount")]
[Column("totalAmount")]
public decimal TotalAmonut
{
get
{
this._totalAmount = this.Amount + this.FlavorAmount;
return this._totalAmount;
}
set
{
this._totalAmount = value;
}
}
/// <summary>
/// 优惠金额
/// </summary>
[JsonProperty(PropertyName = "discountAmount")]
[Column("discountAmount")]
public decimal DiscountAmount
{
get
{
decimal sum = 0;
if (this.Promotions != null && this.Promotions.Count > 0)
{
List<PromotionItem> tempPromotion = this.Promotions.FindAll(x => x.PromotionType != PromotionType.);
sum = tempPromotion.Sum(m => m.DiscountAmount);
}
return OrderUtils.ToRound(sum);
}
}
/// <summary>
/// 应收金额 = 小计 - 优惠
/// </summary>
[JsonProperty(PropertyName = "receivableAmount")]
[Column("receivableAmount")]
public decimal ReceivableAmount
{
get
{
return this.Amount - this.DiscountAmount;
}
}
/// <summary>
/// 总优惠金额 = 商品优惠小计+做法优惠小计
/// </summary>
[JsonProperty(PropertyName = "totalDiscountAmount")]
[Column("totalDiscountAmount")]
public decimal TotalDiscountAmount => this.DiscountAmount + this.FlavorDiscountAmount;
/// <summary>
/// 行记录的创建时间
/// </summary>
[JsonProperty(PropertyName = "saleDate")]
[Column("saleDate")]
public string SaleDate { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
/// <summary>
/// 总应收金额 = 商品应收小计+做法应收小计
/// </summary>
[JsonProperty(PropertyName = "totalReceivableAmount")]
[Column("totalReceivableAmount")]
public decimal TotalReceivableAmount => this.ReceivableAmount + this.FlavorReceivableAmount ;
private decimal _usableRefundAmount = decimal.Zero;
/// <summary>
/// 可退金额,显示用
/// </summary>
[JsonProperty(PropertyName = "usableRefundAmount")]
[Ignore]
public decimal UsableRefundAmount
{
get
{
if (this._usableRefundAmount != decimal.Zero)
{
return this._usableRefundAmount;
}
else
{
return this.TotalReceivableAmount;
}
}
set
{
this._usableRefundAmount = value;
}
}
/// <summary>
/// 菜品ID
/// </summary>
[JsonProperty(PropertyName = "productId")]
[Column("productId")]
public string ProductId { get; set; }
/// <summary>
/// 菜品编号
/// </summary>
[JsonProperty(PropertyName = "productNo")]
[Column("productNo")]
public string ProductNo { get; set; }
/// <summary>
/// 菜品单位ID
/// </summary>
[JsonProperty(PropertyName = "productUnitId")]
[Column("productUnitId")]
public string ProductUnitId { get; set; }
/// <summary>
/// 菜品单位名称
/// </summary>
[JsonProperty(PropertyName = "productUnitName")]
[Column("productUnitName")]
public string ProductUnitName { get; set; }
/// <summary>
/// 品类ID
/// </summary>
[JsonProperty(PropertyName = "typeId")]
[Column("typeId")]
public string TypeId { get; set; }
/// <summary>
/// 品类名称
/// </summary>
[JsonProperty(PropertyName = "typeName")]
[Column("typeName")]
public string TypeName { get; set; }
/// <summary>
/// 规格ID
/// </summary>
[JsonProperty(PropertyName = "specId")]
[Column("specId")]
public string SpecId { get; set; }
/// <summary>
/// 厨打方案
/// </summary>
[JsonProperty(PropertyName = "chuda")]
[Column("chuda")]
public string Chuda { get; set; }
/// <summary>
/// 厨打标识
/// </summary>
[JsonProperty(PropertyName = "chudaFlag")]
[Column("chudaFlag")]
public string ChudaFlag { get; set; }
/// <summary>
/// 已厨打数量
/// </summary>
[JsonProperty(PropertyName = "chudaQty")]
[Column("chudaQty")]
public decimal ChudaQty { get; set; }
/// <summary>
/// 出品方案
/// </summary>
[JsonProperty(PropertyName = "chupin")]
[Column("chupin")]
public string Chupin { get; set; }
/// <summary>
/// 出品标识
/// </summary>
[JsonProperty(PropertyName = "chupinFlag")]
[Column("chupinFlag")]
public string ChupinFlag { get; set; }
/// <summary>
/// 已出品数量
/// </summary>
[JsonProperty(PropertyName = "chupinQty")]
[Column("chupinQty")]
public decimal ChupinQty { get; set; }
/// <summary>
/// 厨打标签标识
/// </summary>
[JsonProperty(PropertyName = "chuDaLabelFlag")]
[Column("chuDaLabelFlag")]
public string ChuDaLabelFlag { get; set; }
/// <summary>
/// 厨打标签方案
/// </summary>
[JsonProperty(PropertyName = "chuDaLabel")]
[Column("chuDaLabel")]
public string ChuDaLabel { get; set; }
/// <summary>
/// 已厨打标签数量
/// </summary>
[JsonProperty(PropertyName = "chuDaLabelQty")]
[Column("chuDaLabelQty")]
public decimal ChuDaLabelQty { get; set; }
/// <summary>
/// 厨显方案
/// </summary>
[JsonProperty(PropertyName = "chuxian")]
[Column("chuxian")]
public string Chuxian { get; set; }
/// <summary>
/// 厨显标识
/// </summary>
[JsonProperty(PropertyName = "chuxianFlag")]
[Column("chuxianFlag")]
public string ChuxianFlag { get; set; }
/// <summary>
/// 已厨显数量
/// </summary>
[JsonProperty(PropertyName = "chuxianQty")]
[Column("chuxianQty")]
public decimal ChuxianQty { get; set; }
/// <summary>
/// 厨显超时(分钟)
/// </summary>
[JsonProperty(PropertyName = "chuxianTime")]
[Column("chuxianTime")]
public int ChuxianTime { get; set; }
/// <summary>
/// KDS出品方案
/// </summary>
[JsonProperty(PropertyName = "kdsChupin")]
[Column("kdsChupin")]
public string KdsChupin { get; set; }
/// <summary>
/// KDS出品标识
/// </summary>
[JsonProperty(PropertyName = "kdsChupinFlag")]
[Column("kdsChupinFlag")]
public string KdsChupinFlag { get; set; }
/// <summary>
/// KDS已出品数量
/// </summary>
[JsonProperty(PropertyName = "kdsChupinQty")]
[Column("kdsChupinQty")]
public decimal KdsChupinQty { get; set; }
/// <summary>
/// KDS出品超时(分钟)
/// </summary>
[JsonProperty(PropertyName = "kdsChupinTime")]
[Column("kdsChupinTime")]
public int KdsChupinTime { get; set; }
/// <summary>
/// 可折扣(0否-1是)
/// </summary>
[JsonProperty(PropertyName = "discountFlag")]
[Column("discountFlag")]
public int DiscountFlag { get; set; }
/// <summary>
/// 是否主食(0否-1是)
/// </summary>
[JsonProperty(PropertyName = "tapleFlag")]
[Column("tapleFlag")]
public int TapleFlag { get; set; }
/// <summary>
/// 是否需要称重(0否-1是)
/// </summary>
[JsonProperty(PropertyName = "weighFlag")]
[Column("weighFlag")]
public int WeighFlag { get; set; }
/// <summary>
/// 是否可议价(0否-1是)
/// </summary>
[JsonProperty(PropertyName = "currentFlag")]
[Column("currentFlag")]
public int CurrentFlag { get; set; }
/// <summary>
/// 会员折上折(0不允许-1允许)
/// </summary>
[JsonProperty(PropertyName = "mebDiscountFlag")]
[Column("mebDiscountFlag")]
public int MebDiscountFlag { get; set; }
/// <summary>
/// 允许赠送(0不允许-1允许)
/// </summary>
[JsonProperty(PropertyName = "giveFlag")]
[Column("giveFlag")]
public int GiveFlag { get; set; }
/// <summary>
/// 打印标签(0否-1是)
/// </summary>
[JsonProperty(PropertyName = "labelPrintFlag")]
[Column("labelPrintFlag")]
public int LabelPrintFlag { get; set; }
/// <summary>
/// 已打印标签数量
/// </summary>
[JsonProperty(PropertyName = "labelQty")]
[Column("labelQty")]
public decimal LabelQty { get; set; }
/// <summary>
/// 允许促销(0不允许-1允许)
/// </summary>
[JsonProperty(PropertyName = "promotionFlag")]
[Column("promotionFlag")]
public int PromotionFlag { get; set; }
/// <summary>
/// 管理库存(0否-1是)
/// </summary>
[JsonProperty(PropertyName = "stockFlag")]
[Column("stockFlag")]
public int StockFlag { get; set; }
/// <summary>
/// 订单完成时间(格式:yyyy-MM-dd HH:mm:ss)
/// </summary>
[JsonProperty(PropertyName = "finishDate")]
[Column("finishDate")]
public string FinishDate { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
private decimal _estimatedCost = 0;
/// <summary>
/// 预估成本
/// </summary>
[JsonProperty(PropertyName = "estimatedCost")]
[Column("estimatedCost")]
public decimal EstimatedCost
{
get
{
this._estimatedCost = OrderUtils.ToRound(this.CostPrice * (this.Quantity - this.RefundQuantity));
return this._estimatedCost;
}
set
{
this._estimatedCost = value;
}
}
private decimal _estimatedProfitAmount = 0;
/// <summary>
/// 预估毛利金额
/// </summary>
[JsonProperty(PropertyName = "estimatedProfitAmount")]
[Column("estimatedProfitAmount")]
public decimal EstimatedProfitAmount
{
get
{
this._estimatedProfitAmount = this.ReceivableAmount - this.EstimatedCost;
return this._estimatedProfitAmount;
}
set
{
this._estimatedProfitAmount = value;
}
}
private decimal _estimatedProfitMargin = 0;
/// <summary>
/// 预估毛利率
/// </summary>
[JsonProperty(PropertyName = "estimatedProfitMargin")]
[Column("estimatedProfitMargin")]
public decimal EstimatedProfitMargin
{
get
{
if (this.ReceivableAmount != 0)
{
this._estimatedProfitMargin = this.EstimatedProfitAmount / this.ReceivableAmount;
}
else
{
this._estimatedProfitMargin = 0;
}
return this._estimatedProfitMargin;
}
set
{
this._estimatedProfitMargin = value;
}
}
/// <summary>
/// 实际成本
/// </summary>
[JsonProperty(PropertyName = "totalCost")]
[Column("totalCost")]
public decimal TotalCost { get; set; } = 0.00M;
/// <summary>
/// 实际毛利金额
/// </summary>
[JsonProperty(PropertyName = "profitAmount")]
[Column("profitAmount")]
public decimal ProfitAmount { get; set; } = 0.00M;
/// <summary>
/// 实际毛利率
/// </summary>
[JsonProperty(PropertyName = "profitMargin")]
[Column("profitMargin")]
public decimal ProfitMargin { get; set; } = 0.00M;
private decimal _saleTax = 0M;
[Ignore]
public decimal SaleTaxMoney
{
get
{
if (this.ProductExt == null)
return 0;
//zhangy 2020-04-15 Add 添加门店销项税率
if(Global.Instance.Worker != null && Global.Instance.Worker.StoreInfo != null && Global.Instance.Worker.StoreInfo.StoreTaxRateFlag == 1)
{
var saleTax = Global.Instance.Worker.StoreInfo.SaleTax;
if(saleTax == 0)
{
return 0;
}
else
{
return (this.ReceivableAmount + this.FlavorReceivableAmount) / (1 + saleTax) * saleTax;
}
}
else
{
return (this.ReceivableAmount + this.FlavorReceivableAmount) / (1 + (this.ProductExt.SaleTax / 100.00M)) * ((this.ProductExt.SaleTax / 100.00M));
}
}
}
[Ignore]
public decimal SaleTax
{
get
{
if (this.ProductExt == null)
{
return 0;
}
else
{
return this.ProductExt.SaleTax;
}
}
}
public bool Equals(OrderItem x, OrderItem y)
{
return x.Id.Equals(y.Id);
}
public int GetHashCode(OrderItem obj)
{
return obj.GetHashCode();
}
[Ignore]
public string OtherWaimaiPrintName { get; set; }
[Ignore]
public string OtherWaimaiPrintMake { get; set; }
}
public enum OrderRowState
{
None = 0,
= 1,
= 2,
= 3,
= 4
}
}