using Newtonsoft.Json; using POSV.Utils; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace POSV.Bean { [Serializable] [JsonObject(MemberSerialization.OptIn)] public class GuestShowItem : IEquatable { /// /// 客显名称 /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// 客显端口 /// [JsonProperty(PropertyName = "port")] public string Port { get; set; } /// /// 客显参数 /// [JsonProperty(PropertyName = "parameter")] public GuestShowParameter Parameter { get; set; } public bool Equals(GuestShowItem other) { if (other == null) { return false; } return JsonUtils.Serialize(this).Equals(JsonUtils.Serialize(other)); } } [Serializable] [JsonObject(MemberSerialization.OptIn)] public class GuestShowParameter { /// /// 名称 /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } private int _baud = 2400; /// /// 波特率 /// [JsonProperty(PropertyName = "baud")] public int Baud { get { return _baud; } set { this._baud = value; } } private SerialPortCheckType _checkNum = SerialPortCheckType.无校验; /// /// 校验位 /// [JsonProperty(PropertyName = "checkNum")] public SerialPortCheckType CheckNum { get { return _checkNum; } set { _checkNum = value; } } private int _dataNum = 8; /// /// 数据位 /// [JsonProperty(PropertyName = "dataNum")] public int DataNum { get { return _dataNum; } set { this._dataNum = DataNum; } } private int _stopNum = 1; /// /// 停止位 /// [JsonProperty(PropertyName = "stopNum")] public int StopNum { get { return _stopNum; } set { _stopNum = value; } } private string _displayType = "数字客显"; /// /// 客显类型 /// [JsonProperty(PropertyName = "displayType")] public string DisplayType { get { return _displayType; } set { _displayType = value; } } private int _columnNum = 12; /// /// 每行显示字符数 /// [JsonProperty(PropertyName = "columnNum")] public int ColumnNum { get { return _columnNum; } set { _columnNum = value; } } private int _rowNum = 1; /// /// 行数 /// [JsonProperty(PropertyName = "rowNum")] public int RowNum { get { return _rowNum; } set { _rowNum = value; } } private string _initCmd = string.Empty; /// /// 初始化指令 /// [JsonProperty(PropertyName = "initCmd")] public string InitCmd { get { return _initCmd; } set { _initCmd = value; } } /// /// 第一行显示准备 /// [JsonProperty(PropertyName = "r1ReadyCmd")] public string R1ReadyCmd { get; set; } /// /// 第一行送显指令 /// [JsonProperty(PropertyName = "r1DisplayCmd")] public string R1DisplayCmd { get; set; } /// /// 第一行显示结束指令 /// [JsonProperty(PropertyName = "r1EndCmd")] public string R1EndCmd { get; set; } /// /// 第二行显示准备 /// [JsonProperty(PropertyName = "r2ReadyCmd")] public string R2ReadyCmd { get; set; } /// /// 第二行送显指令 /// [JsonProperty(PropertyName = "r2DisplayCmd")] public string R2DisplayCmd { get; set; } /// /// 第二行显示结束指令 /// [JsonProperty(PropertyName = "r2EndCmd")] public string R2EndCmd { get; set; } private bool _oneRowExistLight = false; /// /// 单行且有状态灯 /// [JsonProperty(PropertyName = "oneRowExistLight")] public bool OneRowExistLight { get { return _oneRowExistLight; } set { _oneRowExistLight = value; } } /// /// 熄灯指令 /// [JsonProperty(PropertyName = "offLightCmd")] public string OffLightCmd { get; set; } /// /// 单价状态灯指令 /// [JsonProperty(PropertyName = "priceLightCmd")] public string PriceLightCmd { get; set; } /// /// 应付(合计)状态灯指令 /// [JsonProperty(PropertyName = "totalLightCmd")] public string TotalLightCmd { get; set; } /// /// 已付状态灯指令 /// [JsonProperty(PropertyName = "paidLightCmd")] public string PaidLightCmd { get; set; } /// /// 找零状态灯指令 /// [JsonProperty(PropertyName = "changeLightCmd")] public string ChangeLightCmd { get; set; } } public enum SerialPortCheckType { 无校验, 奇校验, 偶校验 } }