终端一体化运控平台
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 

212 рядки
7.9 KiB

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