using BPASmartClient.Model.咖啡机.Enum; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BPASmartClient.KLMCoffee.Protocal { /// /// 获取枚举字符串变量 /// public static class K95commandEnumExtensions { /// /// 获取K95命令枚举 /// /// /// public static string GetString(this K95CommandEnum me) { switch (me) { case K95CommandEnum.咖啡制作: return "01"; case K95CommandEnum.配方咖啡制作: return "02"; case K95CommandEnum.取消制作: return "03"; case K95CommandEnum.清洗: return "04"; case K95CommandEnum.状态查询: return "05"; case K95CommandEnum.确认: return "06"; default: return "01"; } } /// /// 获取默认20多种咖啡值 /// /// /// public static string GetString(this K95deFaultCoffeeEnum me) { switch (me) { case K95deFaultCoffeeEnum.意式咖啡: return "0001"; case K95deFaultCoffeeEnum.美式咖啡: return "0002"; case K95deFaultCoffeeEnum.咖啡意式咖啡: return "0009"; case K95deFaultCoffeeEnum.卡布奇诺: return "0004"; case K95deFaultCoffeeEnum.玛琪雅朵: return "0005"; case K95deFaultCoffeeEnum.拿铁: return "0006"; case K95deFaultCoffeeEnum.白咖啡: return "000e"; case K95deFaultCoffeeEnum.芮斯崔朵: return "000a"; case K95deFaultCoffeeEnum.意式玛奇朵: return "000d"; case K95deFaultCoffeeEnum.奶油咖啡: return "000c"; case K95deFaultCoffeeEnum.双杯意式咖啡: return "0033"; case K95deFaultCoffeeEnum.双杯卡布奇诺: return "0037"; case K95deFaultCoffeeEnum.双杯拿铁: return "0039"; case K95deFaultCoffeeEnum.双杯玛琪雅朵: return "0038"; case K95deFaultCoffeeEnum.双杯白咖啡: return "003b"; case K95deFaultCoffeeEnum.双杯咖啡: return "0034"; case K95deFaultCoffeeEnum.双杯芮斯崔朵: return "0035"; case K95deFaultCoffeeEnum.双杯意式玛奇朵: return "003a"; case K95deFaultCoffeeEnum.双杯奶油咖啡: return "0036"; case K95deFaultCoffeeEnum.热水: return "0003"; case K95deFaultCoffeeEnum.牛奶: return "0064"; case K95deFaultCoffeeEnum.奶沫: return "0065"; case K95deFaultCoffeeEnum.大壶咖啡: return "000b"; case K95deFaultCoffeeEnum.取消制作: return "0001000C"; case K95deFaultCoffeeEnum.放杯确认: return "0001"; case K95deFaultCoffeeEnum.清洗冲泡器: return "0001010A"; case K95deFaultCoffeeEnum.清洗奶沫器: return "0001040A"; case K95deFaultCoffeeEnum.清洗奶沫器确认: return "0001000C"; case K95deFaultCoffeeEnum.状态查询: return "0000000D"; default: return "0001"; } } /// /// 获取饮品类型值 /// /// /// public static string GetString(this DrinkType me) { switch (me) { case DrinkType.意式咖啡: return "01"; case DrinkType.美式咖啡: return "02"; case DrinkType.热水: return "03"; case DrinkType.卡布奇诺: return "04"; case DrinkType.玛琪雅朵: return "05"; case DrinkType.拿铁咖啡: return "06"; case DrinkType.热牛奶: return "07"; case DrinkType.热奶沫: return "08"; default: return "01"; } } /// /// 获取咖啡温度值 /// /// /// public static string GetString(this TempEnum me) { switch (me) { case TempEnum.低: return "00"; case TempEnum.中: return "01"; case TempEnum.高: return "02"; default: return "01"; } } /// /// 获取咖啡浓度值 /// /// /// public static string GetString(this CoffeeConcentration me) { switch (me) { case CoffeeConcentration.清淡: return "00"; case CoffeeConcentration.适中: return "01"; case CoffeeConcentration.浓郁: return "02"; default: return "01"; } } /// /// 获取确认或者取消枚举值 /// /// /// public static string GetString(this CancelOrOkEnum me) { switch (me) { case CancelOrOkEnum.是: return "01"; case CancelOrOkEnum.否: return "00"; default: return "00"; } } /// /// 获取系统状态枚举值 /// /// /// public static string GetString(this K95SysTemStatus me) { switch (me) { case K95SysTemStatus.初始化状态: return "0"; case K95SysTemStatus.空闲状态: return "1"; case K95SysTemStatus.运行状态: return "2"; case K95SysTemStatus.关机状态: return "3"; case K95SysTemStatus.正在制作咖啡: return "8"; case K95SysTemStatus.冲泡器清洗和奶沫器清洗: return "9"; case K95SysTemStatus.冲泡器药片清洗: return "A"; case K95SysTemStatus.奶沫器药片清洗: return "B"; case K95SysTemStatus.除垢清洗: return "C"; case K95SysTemStatus.清空管路: return "D"; default: return "0"; } } /// /// 获取饮品制作状态值 /// /// /// public static string GetString(this MakeStatus me) { switch (me) { case MakeStatus.正在制作: return "0"; case MakeStatus.暂停: return "1"; case MakeStatus.取消: return "2"; case MakeStatus.完成: return "3"; default: return "0"; } } /// /// 获取饮品制作状态值 /// /// /// public static string GetString(this TaskIndex me) { switch (me) { case TaskIndex.无任务: return "0"; case TaskIndex.出咖啡: return "1"; case TaskIndex.出热水: return "2"; case TaskIndex.出牛奶: return "3"; case TaskIndex.出奶沫: return "4"; case TaskIndex.同时出: return "5"; case TaskIndex.磨豆: return "6"; default: return "0"; } } } }