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.
169 lines
4.2 KiB
C#
169 lines
4.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace POSV.Bean
|
|
{
|
|
[Serializable]
|
|
[JsonObject(MemberSerialization.OptIn)]
|
|
public class PrinterItem : IEquatable<PrinterItem>
|
|
{
|
|
/// <summary>
|
|
/// 打印机ID
|
|
/// </summary>
|
|
[JsonProperty(PropertyName = "id")]
|
|
public string Id { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// 打印机名称
|
|
/// </summary>
|
|
[JsonProperty(PropertyName = "name")]
|
|
public string Name { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// 打印机可用端口
|
|
/// </summary>
|
|
[JsonProperty(PropertyName = "port")]
|
|
public string Port { get; set; }
|
|
|
|
/**
|
|
* 打印机动态库支持
|
|
*/
|
|
[JsonProperty(PropertyName = "dynamic")]
|
|
public string DynamicLibrary { get; set; }
|
|
|
|
/**
|
|
* 打印机类型
|
|
*/
|
|
[JsonProperty(PropertyName = "type")]
|
|
public int Type { get; set; }
|
|
|
|
/**
|
|
* 打印机分辨率
|
|
*/
|
|
[JsonProperty(PropertyName = "dpi")]
|
|
public int Dpi { get; set; }
|
|
|
|
/**
|
|
* 页宽
|
|
*/
|
|
[JsonProperty(PropertyName = "width")]
|
|
public int PageWidth { get; set; }
|
|
|
|
/// <summary>
|
|
/// 打印机参数配置
|
|
/// </summary>
|
|
[JsonProperty(PropertyName = "data")]
|
|
public Dictionary<string, string> Data { get; set; }
|
|
|
|
|
|
/**
|
|
* 初始化指令
|
|
*/
|
|
[JsonProperty(PropertyName = "ic")]
|
|
public string InitCommand { get; set; }
|
|
|
|
/**
|
|
* 倍宽字体指令
|
|
*/
|
|
[JsonProperty(PropertyName = "dwc")]
|
|
public string DoubleWidthCommand { get; set; }
|
|
|
|
|
|
/**
|
|
* 切纸指令
|
|
*/
|
|
[JsonProperty(PropertyName = "cc")]
|
|
public string CutPageCommand { get; set; }
|
|
|
|
/**
|
|
* 字体倍高指令
|
|
*/
|
|
[JsonProperty(PropertyName = "dhc")]
|
|
public string DoubleHeightCommand { get; set; }
|
|
|
|
/**
|
|
* 普通字体指令
|
|
*/
|
|
[JsonProperty(PropertyName = "nc")]
|
|
public string NormalCommand { get; set; }
|
|
|
|
/**
|
|
* 倍宽倍高指令
|
|
*/
|
|
[JsonProperty(PropertyName = "dwhc")]
|
|
public string DoubleWidthHeightCommand { get; set; }
|
|
|
|
/**
|
|
* 钱箱指令
|
|
*/
|
|
[JsonProperty(PropertyName = "cashbox")]
|
|
public string CashboxCommand { get; set; }
|
|
|
|
/**
|
|
* 是否顾客自己添加
|
|
*/
|
|
[JsonProperty(PropertyName = "custom")]
|
|
public int UserDefined { get; set; }
|
|
|
|
/// <summary>
|
|
/// 左对齐
|
|
/// </summary>
|
|
[JsonProperty(PropertyName = "left")]
|
|
public string AlignLeftCommand { get; set; } = "27,97,48";
|
|
|
|
/// <summary>
|
|
/// 右对齐
|
|
/// </summary>
|
|
[JsonProperty(PropertyName = "center")]
|
|
public string AlignCenterCommand { get; set; } = "27,97,49";
|
|
|
|
/// <summary>
|
|
/// 右对齐
|
|
/// </summary>
|
|
[JsonProperty(PropertyName = "right")]
|
|
public string AlignRightCommand { get; set; } = "27,97,50";
|
|
|
|
/// <summary>
|
|
/// 回退纸张
|
|
/// </summary>
|
|
[JsonProperty(PropertyName = "feedBack")]
|
|
public string FeedBackCommand { get; set; } = "27,101,n";
|
|
|
|
/// <summary>
|
|
/// 蜂鸣
|
|
/// </summary>
|
|
[JsonProperty(PropertyName = "beep")]
|
|
public string BeepCommand { get; set; } = "27,66";
|
|
|
|
public bool Equals(PrinterItem other)
|
|
{
|
|
if (other == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if (this.Data.Keys.Count != other.Data.Keys.Count)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
foreach (var key in this.Data.Keys)
|
|
{
|
|
if (!(this.Data[key].Equals(other.Data[key])))
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
return this.Port == other.Port && this.Name == other.Name && this.Id == other.Id;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return this.Name;
|
|
}
|
|
}
|
|
}
|