using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; using NPoco; using POSV.Entity; using Newtonsoft.Json.Converters; namespace POSV.ShoppingCart { /// /// 订单对象,包含整个订单的全部信息 /// [Serializable] [JsonObject(MemberSerialization.OptIn)] [TableName("pos_order")] [PrimaryKey(new string[] { "id" } , AutoIncrement = false)] public class BusinessTicket : BaseEntity { public BusinessTicket() { this.CreateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); this.CreateUser = DEFAULT_SYNC_USER; this.ModifyDate = this.CreateDate; this.ModifyUser = this.CreateUser; } /// /// 租户ID /// [JsonProperty(PropertyName = "tenantId")] [Column("tenantId")] public string TenantId { get; set; } /// /// 订单内部标识 /// [JsonProperty(PropertyName = "objectId")] [Column("objectId")] public string ObjectId { get; set; } /// /// 单据编号 /// [JsonProperty(PropertyName = "no")] [Column("tradeNo")] public string TradeNo { get; set; } /// /// 流水号 /// [JsonProperty(PropertyName = "voucherNo")] [Column("voucherNo")] public string VoucherNo { get; set; } /// /// 批次号 /// [JsonProperty(PropertyName = "batchNo")] [Column("batchNo")] public string BatchNo { get; set; } /// /// 订单序号 /// [JsonProperty(PropertyName = "orderNo")] [Column("orderNo")] public string OrderNo { get; set; } = "1"; /// /// 门店ID /// [JsonProperty(PropertyName = "storeId")] [Column("storeId")] public string StoreId { get; set; } /// /// 门店编号 /// [JsonProperty(PropertyName = "storeNo")] [Column("storeNo")] public string StoreNo { get; set; } /// /// 门店名称 /// [JsonProperty(PropertyName = "storeName")] [Column("storeName")] public string StoreName { get; set; } /// /// 操作员工号 /// [JsonProperty(PropertyName = "workNo")] [Column("workerNo")] public string WorkerNo { get; set; } /// /// 操作员名称 /// [JsonProperty(PropertyName = "workName")] [Column("workerName")] public string WorkerName { get; set; } /// /// POS /// [JsonProperty(PropertyName = "posNo")] [Column("posNo")] public string PosNo { get; set; } /// /// 收银设备名称 /// [JsonProperty(PropertyName = "deviceName")] [Column("deviceName")] public string DeviceName { get; set; } /// /// 收银设备Mac地址 /// [JsonProperty(PropertyName = "deviceMac")] [Column("macAddress")] public string MacAddress { get; set; } /// /// 收银设备IP地址 /// [JsonProperty(PropertyName = "deviceIp")] [Column("ipAddress")] public string IpAddress { get; set; } /// /// 营业员编码 /// [JsonProperty(PropertyName = "salesCode")] [Column("salesCode")] public string SalesCode { get; set; } /// /// 营业员名称 /// [JsonProperty(PropertyName = "salesName")] [Column("salesName")] public string SalesName { get; set; } /// /// 餐桌号 /// [JsonProperty(PropertyName = "tableNo")] [Column("tableNo")] public string TableNo { get; set; } = string.Empty; /// /// 餐桌号 /// [JsonProperty(PropertyName = "tableName")] [Column("tableName")] public string TableName { get; set; } = string.Empty; /// /// 人数 /// [JsonProperty(PropertyName = "people")] [Column("people")] public int People { get; set; } = 1; /// /// 班次 /// [JsonProperty(PropertyName = "shiftNo")] [Column("shiftNo")] public string ShiftNo { get; set; } /// /// 班次名称 /// [JsonProperty(PropertyName = "shiftName")] [Column("shiftName")] public string ShiftName { get; set; } /// /// 销售订单创建时间 /// [JsonProperty(PropertyName = "saleDate")] [Column("saleDate")] public string SaleDate { get; set; } =DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); /// /// 购物车中总行数 /// [JsonProperty(PropertyName = "orderCount")] [Column("orderCount")] public int OrderCount { get; set; } /// /// 购物车中总行数 /// [JsonProperty(PropertyName = "payCount")] [Column("payCount")] public int PayCount { get; set; } /// /// 整单的数量合计 /// [JsonProperty(PropertyName = "totalQuantity")] [Column("totalQuantity")] public decimal TotalQuantity { get; set; } /// /// 消费金额 /// [JsonProperty(PropertyName = "amount")] [Column("amount")] public decimal Amount { get; set; } /// /// 优惠金额 /// [JsonProperty(PropertyName = "discountTotal")] [Column("discountAmount")] public decimal DiscountAmount { get; set; } /// /// 总优惠率,包含商品+加价 /// [JsonProperty(PropertyName = "discount")] [Column("discountRate")] public decimal DiscountRate { get; set; } /// /// 应收金额 = 消费金额 - 优惠金额 - 抹零金额 /// [JsonProperty(PropertyName = "receivable")] [Column("receivableAmount")] public decimal ReceivableAmount { get; set; } /// /// 实收金额,收银员实际录入的金额 /// [JsonProperty(PropertyName = "paid")] [Column("paidAmount")] public decimal PaidAmount { get; set; } /// /// 已收金额,各种支付明细的实收金额合计 /// [JsonProperty(PropertyName = "received")] [Column("receivedAmount")] public decimal ReceivedAmount { get; set; } /// /// 抹零金额 /// [JsonProperty(PropertyName = "maling")] [Column("malingAmount")] public decimal MalingAmount { get; set; } /// /// 找零金额 /// [JsonProperty(PropertyName = "change")] [Column("changeAmount")] public decimal ChangeAmount { get; set; } /// /// 开票金额 /// [JsonProperty(PropertyName = "invoiced")] [Column("invoicedAmount")] public decimal InvoicedAmount { get; set; } /// /// 订单同步状态 0-新增,1-已同步,2-问题单 /// [JsonProperty(PropertyName = "sync")] [Column("syncStatus")] public int SyncStatus { get; set; } = 0; /// /// 上传错误次数,错误次数越多,优先级越低 /// [JsonProperty(PropertyName = "uploadErrors")] [Column("uploadErrors")] public int UploadErrors { get; set; } /// /// 订单状态 /// [JsonProperty(PropertyName = "status")] [Column("orderStatus")] public int OrderStatus { get; set; } /// /// 订单类型 /// [JsonProperty(PropertyName = "type")] [Column("orderType")] public int OrderType { get; set; } /// /// 支付状态,PARTIALLY_PAID:部分付款; PAID:已付款;NOT_PAID:未付款; /// [JsonProperty(PropertyName = "paymentStatus")] [Column("paymentStatus")] public int PaymentStatus { get; set; } /// /// 打印状态,WAIT:等待打印; FINISHED:打印完成;NONE:不打印款; /// [JsonProperty(PropertyName = "printStatus")] [Column("printStatus")] public int PrintStatus { get; set; } /// /// 打印次数 /// [JsonProperty(PropertyName = "printTimes")] [Column("printTimes")] public int PrintTimes { get; set; } /// /// 原单号 /// [JsonProperty(PropertyName = "noOrg")] [Column("orgTradeNo")] public string OrgTradeNo { get; set; } = string.Empty; /// /// 退单原因 /// [JsonProperty(PropertyName = "backCause")] [Column("refundCause")] public string RefundCause { get; set; } /// /// 是否使用会员卡(0否1是) /// [JsonProperty(PropertyName = "isMember")] [Column("isMember")] public int IsMember { get; set; } /// /// 会员卡号 /// [JsonProperty(PropertyName = "memberNo")] [Column("memberNo")] public string MemberNo { get; set; } /// /// 本单积分 /// [JsonProperty(PropertyName = "memberJifen")] [Column("addPoint")] public decimal AddPoint { get; set; } /// /// 完成时间 /// [JsonProperty(PropertyName = "finishDate")] [Column("finishDate")] public string FinishDate { get; set; } private string orderTypeDesc; [Ignore] public string OrderTypeDesc { get { switch (this.OrderType) { case 0: orderTypeDesc = "堂食"; break; case 1: orderTypeDesc = "外带"; break; case 2: orderTypeDesc = "电话外卖"; break; case 3: orderTypeDesc = "餐桌"; break; case 4: orderTypeDesc = "美团外卖"; break; case 5: orderTypeDesc = "饿了么"; break; case 6: orderTypeDesc = "百度外卖"; break; case 7: orderTypeDesc = "微信点餐"; break; default: orderTypeDesc = "其他"; break; } return orderTypeDesc; } }// 营业模式 private string statusDesc; [Ignore] public string StatusDesc { get { switch (this.OrderStatus) { case 0: statusDesc = "等待付款"; break; case 1: statusDesc = "已支付"; break; case 2: statusDesc = "已退单"; break; case 3: statusDesc = "已取消"; break; case 4: statusDesc = "已完成"; break; case 5: statusDesc = "部分退款"; break; default: statusDesc = "其他状态"; break; } return statusDesc; } }// 单据状态 } }