终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

211 lines
7.8 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace BPASmartClient.KLMCoffee.Protocal
  7. {
  8. /// <summary>
  9. /// 获取枚举字符串变量
  10. /// </summary>
  11. public static class K95commandEnumExtensions
  12. {
  13. /// <summary>
  14. /// 获取K95命令枚举
  15. /// </summary>
  16. /// <param name="me"></param>
  17. /// <returns></returns>
  18. public static string GetString(this K95CommandEnum me)
  19. {
  20. switch (me)
  21. {
  22. case K95CommandEnum.咖啡制作:
  23. return "01";
  24. case K95CommandEnum.配方咖啡制作:
  25. return "02";
  26. case K95CommandEnum.取消制作:
  27. return "03";
  28. case K95CommandEnum.清洗:
  29. return "04";
  30. case K95CommandEnum.状态查询:
  31. return "05";
  32. case K95CommandEnum.确认:
  33. return "06";
  34. default:
  35. return "01";
  36. }
  37. }
  38. /// <summary>
  39. /// 获取默认20多种咖啡值
  40. /// </summary>
  41. /// <param name="me"></param>
  42. /// <returns></returns>
  43. public static string GetString(this K95deFaultCoffeeEnum me)
  44. {
  45. switch (me)
  46. {
  47. case K95deFaultCoffeeEnum.意式咖啡: return "0001";
  48. case K95deFaultCoffeeEnum.美式咖啡: return "0002";
  49. case K95deFaultCoffeeEnum.咖啡意式咖啡: return "0009";
  50. case K95deFaultCoffeeEnum.卡布奇诺: return "0004";
  51. case K95deFaultCoffeeEnum.玛琪雅朵: return "0005";
  52. case K95deFaultCoffeeEnum.拿铁: return "0006";
  53. case K95deFaultCoffeeEnum.白咖啡: return "000e";
  54. case K95deFaultCoffeeEnum.芮斯崔朵: return "000a";
  55. case K95deFaultCoffeeEnum.意式玛奇朵: return "000d";
  56. case K95deFaultCoffeeEnum.奶油咖啡: return "000c";
  57. case K95deFaultCoffeeEnum.双杯意式咖啡: return "0033";
  58. case K95deFaultCoffeeEnum.双杯卡布奇诺: return "0037";
  59. case K95deFaultCoffeeEnum.双杯拿铁: return "0039";
  60. case K95deFaultCoffeeEnum.双杯玛琪雅朵: return "0038";
  61. case K95deFaultCoffeeEnum.双杯白咖啡: return "003b";
  62. case K95deFaultCoffeeEnum.双杯咖啡: return "0034";
  63. case K95deFaultCoffeeEnum.双杯芮斯崔朵: return "0035";
  64. case K95deFaultCoffeeEnum.双杯意式玛奇朵: return "003a";
  65. case K95deFaultCoffeeEnum.双杯奶油咖啡: return "0036";
  66. case K95deFaultCoffeeEnum.热水: return "0003";
  67. case K95deFaultCoffeeEnum.牛奶: return "0064";
  68. case K95deFaultCoffeeEnum.奶沫: return "0065";
  69. case K95deFaultCoffeeEnum.大壶咖啡: return "000b";
  70. case K95deFaultCoffeeEnum.取消制作: return "0001000C";
  71. case K95deFaultCoffeeEnum.放杯确认: return "0001";
  72. case K95deFaultCoffeeEnum.清洗冲泡器: return "0001010A";
  73. case K95deFaultCoffeeEnum.清洗奶沫器: return "0001040A";
  74. case K95deFaultCoffeeEnum.清洗奶沫器确认: return "0001000C";
  75. case K95deFaultCoffeeEnum.状态查询: return "0000000D";
  76. default: return "0001";
  77. }
  78. }
  79. /// <summary>
  80. /// 获取饮品类型值
  81. /// </summary>
  82. /// <param name="me"></param>
  83. /// <returns></returns>
  84. public static string GetString(this DrinkType me)
  85. {
  86. switch (me)
  87. {
  88. case DrinkType.意式: return "01";
  89. case DrinkType.美式: return "02";
  90. case DrinkType.热水: return "03";
  91. case DrinkType.卡布: return "04";
  92. case DrinkType.玛奇朵: return "05";
  93. case DrinkType.拿铁: return "06";
  94. case DrinkType.热牛奶: return "07";
  95. case DrinkType.热奶沫: return "08";
  96. default: return "01";
  97. }
  98. }
  99. /// <summary>
  100. /// 获取咖啡温度值
  101. /// </summary>
  102. /// <param name="me"></param>
  103. /// <returns></returns>
  104. public static string GetString(this TempEnum me)
  105. {
  106. switch (me)
  107. {
  108. case TempEnum.低: return "00";
  109. case TempEnum.中: return "01";
  110. case TempEnum.高: return "02";
  111. default: return "01";
  112. }
  113. }
  114. /// <summary>
  115. /// 获取咖啡浓度值
  116. /// </summary>
  117. /// <param name="me"></param>
  118. /// <returns></returns>
  119. public static string GetString(this CoffeeConcentration me)
  120. {
  121. switch (me)
  122. {
  123. case CoffeeConcentration.清淡: return "00";
  124. case CoffeeConcentration.适中: return "01";
  125. case CoffeeConcentration.浓郁: return "02";
  126. default: return "01";
  127. }
  128. }
  129. /// <summary>
  130. /// 获取确认或者取消枚举值
  131. /// </summary>
  132. /// <param name="me"></param>
  133. /// <returns></returns>
  134. public static string GetString(this CancelOrOkEnum me)
  135. {
  136. switch (me)
  137. {
  138. case CancelOrOkEnum.是: return "01";
  139. case CancelOrOkEnum.否: return "00";
  140. default: return "00";
  141. }
  142. }
  143. /// <summary>
  144. /// 获取系统状态枚举值
  145. /// </summary>
  146. /// <param name="me"></param>
  147. /// <returns></returns>
  148. public static string GetString(this K95SysTemStatus me)
  149. {
  150. switch (me)
  151. {
  152. case K95SysTemStatus.初始化状态: return "0";
  153. case K95SysTemStatus.空闲状态: return "1";
  154. case K95SysTemStatus.运行状态: return "2";
  155. case K95SysTemStatus.关机状态: return "3";
  156. case K95SysTemStatus.正在制作咖啡: return "8";
  157. case K95SysTemStatus.冲泡器清洗和奶沫器清洗: return "9";
  158. case K95SysTemStatus.冲泡器药片清洗: return "A";
  159. case K95SysTemStatus.奶沫器药片清洗: return "B";
  160. case K95SysTemStatus.除垢清洗: return "C";
  161. case K95SysTemStatus.清空管路: return "D";
  162. default: return "0";
  163. }
  164. }
  165. /// <summary>
  166. /// 获取饮品制作状态值
  167. /// </summary>
  168. /// <param name="me"></param>
  169. /// <returns></returns>
  170. public static string GetString(this MakeStatus me)
  171. {
  172. switch (me)
  173. {
  174. case MakeStatus.正在制作: return "0";
  175. case MakeStatus.暂停: return "1";
  176. case MakeStatus.取消: return "2";
  177. case MakeStatus.完成: return "3";
  178. default: return "0";
  179. }
  180. }
  181. /// <summary>
  182. /// 获取饮品制作状态值
  183. /// </summary>
  184. /// <param name="me"></param>
  185. /// <returns></returns>
  186. public static string GetString(this TaskIndex me)
  187. {
  188. switch (me)
  189. {
  190. case TaskIndex.无任务: return "0";
  191. case TaskIndex.出咖啡: return "1";
  192. case TaskIndex.出热水: return "2";
  193. case TaskIndex.出牛奶: return "3";
  194. case TaskIndex.出奶沫: return "4";
  195. case TaskIndex.同时出: return "5";
  196. case TaskIndex.磨豆: return "6";
  197. default: return "0";
  198. }
  199. }
  200. }
  201. }