终端一体化运控平台
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.

RecipeModel.cs 12 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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. /// 咖啡配方Model,控制内容
  11. /// </summary>
  12. public class RecipeModel
  13. {
  14. /// <summary>
  15. /// 饮品类型
  16. /// </summary>
  17. public DrinkType 饮品类型 { get; set; }
  18. /// <summary>
  19. /// 咖啡量:15-240
  20. /// </summary>
  21. public int 咖啡量 { get; set; }
  22. /// <summary>
  23. /// 咖啡温度:低/中/高
  24. /// </summary>
  25. public TempEnum 咖啡温度 { get; set; }
  26. /// <summary>
  27. /// 咖啡浓度:清淡/适中/浓郁
  28. /// </summary>
  29. public CoffeeConcentration 咖啡浓度 { get; set; }
  30. /// <summary>
  31. /// 热水量:25-450
  32. /// </summary>
  33. public int 热水量 { get; set; }
  34. /// <summary>
  35. /// 热水温度:低/中/高
  36. /// </summary>
  37. public TempEnum 热水温度 { get; set; }
  38. /// <summary>
  39. /// 牛奶时间:5-120/0
  40. /// </summary>
  41. public int 牛奶时间 { get; set; }
  42. /// <summary>
  43. /// 奶沫时间:5-120/0
  44. /// </summary>
  45. public int 奶沫时间 { get; set; }
  46. /// <summary>
  47. /// 预煮
  48. /// </summary>
  49. public CancelOrOkEnum 预煮 { get; set; }
  50. /// <summary>
  51. /// 咖啡增强
  52. /// </summary>
  53. public CancelOrOkEnum 咖啡增强 { get; set; }
  54. /// <summary>
  55. /// 咖啡牛奶同时出
  56. /// </summary>
  57. public CancelOrOkEnum 咖啡牛奶同时出 { get; set; }
  58. /// <summary>
  59. /// 出品顺序:否:先奶后咖啡 是:先咖啡后奶
  60. /// </summary>
  61. public CancelOrOkEnum 出品顺序 { get; set; }
  62. public RecipeModel()
  63. {
  64. 饮品类型 = DrinkType.意式咖啡;
  65. 咖啡量 = 0;
  66. 咖啡温度 = TempEnum.低;
  67. 咖啡浓度 = CoffeeConcentration.清淡;
  68. 热水量 = 0;
  69. 热水温度 = TempEnum.低;
  70. 牛奶时间 = 0;
  71. 奶沫时间 = 0;
  72. 预煮 = CancelOrOkEnum.否;
  73. 咖啡增强 = CancelOrOkEnum.否;
  74. 咖啡牛奶同时出 = CancelOrOkEnum.否;
  75. 出品顺序 = CancelOrOkEnum.否;
  76. }
  77. #region 获取配方字符串命令
  78. /// <summary>
  79. /// Int 转 16进制字符串 (保留几位)
  80. /// </summary>
  81. public string IntToHexString(int data,int length = 2)
  82. {
  83. try
  84. {
  85. return data.ToString("X").PadLeft(length,'0');
  86. }
  87. catch (Exception ex)
  88. {
  89. return string.Empty;
  90. }
  91. }
  92. /// <summary>
  93. /// 获取咖啡配方数据
  94. /// </summary>
  95. public string GetCoffeeRecipe()
  96. {
  97. string retdata = string.Empty;
  98. try
  99. {
  100. retdata = $"{饮品类型.GetString()}{IntToHexString(咖啡量,4)}" +
  101. $"{咖啡温度.GetString()}{咖啡浓度.GetString()}{IntToHexString(热水量,4)}{热水温度.GetString()}" +
  102. $"{IntToHexString(牛奶时间,2)}{IntToHexString(奶沫时间,2)}{预煮.GetString()}{咖啡增强.GetString()}" +
  103. $"{咖啡牛奶同时出.GetString()}{出品顺序.GetString()}";
  104. }
  105. catch (Exception ex)
  106. {
  107. }
  108. return retdata;
  109. }
  110. #endregion
  111. #region 8种配方测试示例
  112. /// <summary>
  113. /// 获取8中配方
  114. /// </summary>
  115. /// <param name="drink"></param>
  116. /// <returns></returns>
  117. public string Packe(DrinkType drink)
  118. {
  119. try
  120. {
  121. switch (drink)
  122. {
  123. case DrinkType.意式咖啡:
  124. return GetItalian(60);
  125. break;
  126. case DrinkType.美式咖啡:
  127. return GetAmerican(60,450);
  128. break;
  129. case DrinkType.热水:
  130. return GetHotWater(194);
  131. break;
  132. case DrinkType.卡布奇诺:
  133. return GetCabo(60,17);
  134. break;
  135. case DrinkType.玛琪雅朵:
  136. return GetMacChiato(60,8,17);
  137. break;
  138. case DrinkType.拿铁咖啡:
  139. return GetLatte(60,8,17);
  140. break;
  141. case DrinkType.热牛奶:
  142. return GetHotMilk(8);
  143. break;
  144. case DrinkType.热奶沫:
  145. return GetHotMilkFoam(17);
  146. break;
  147. }
  148. }
  149. catch (Exception ex)
  150. {
  151. return GetItalian(60);
  152. }
  153. return GetItalian(60);
  154. }
  155. #endregion
  156. #region 8种默认配方
  157. /// <summary>
  158. /// 意式:仅咖啡
  159. /// </summary>
  160. /// <param name="_咖啡量">15-240</param>
  161. public string GetItalian(int _咖啡量)
  162. {
  163. 饮品类型 = DrinkType.意式咖啡;
  164. 咖啡量 = _咖啡量;
  165. 咖啡温度 = TempEnum.中;
  166. 咖啡浓度 = CoffeeConcentration.适中;
  167. 热水量 = 0;
  168. 热水温度 = TempEnum.低;
  169. 牛奶时间 = 0;
  170. 奶沫时间 = 0;
  171. 预煮 = CancelOrOkEnum.是;
  172. 咖啡增强 = CancelOrOkEnum.否;
  173. 咖啡牛奶同时出 = CancelOrOkEnum.否;
  174. 出品顺序 = CancelOrOkEnum.是;
  175. return GetCoffeeRecipe();
  176. }
  177. /// <summary>
  178. /// 美式:咖啡+热水
  179. /// </summary>
  180. /// <param name="_咖啡量">15-240</param>
  181. /// <param name="_热水量">25-450</param>
  182. public string GetAmerican(int _咖啡量,int _热水量)
  183. {
  184. 饮品类型 = DrinkType.美式咖啡;
  185. 咖啡量 = _咖啡量;
  186. 咖啡温度 = TempEnum.中;
  187. 咖啡浓度 = CoffeeConcentration.适中;
  188. 热水量 = _热水量;
  189. 热水温度 = TempEnum.高;
  190. 牛奶时间 = 0;
  191. 奶沫时间 = 0;
  192. 预煮 = CancelOrOkEnum.是;
  193. 咖啡增强 = CancelOrOkEnum.否;
  194. 咖啡牛奶同时出 = CancelOrOkEnum.否;
  195. 出品顺序 = CancelOrOkEnum.是;
  196. return GetCoffeeRecipe();
  197. }
  198. /// <summary>
  199. /// 热水:仅热水
  200. /// </summary>
  201. /// <param name="_热水量">25-450</param>
  202. public string GetHotWater(int _热水量)
  203. {
  204. 饮品类型 = DrinkType.热水;
  205. 咖啡量 = 0;
  206. 咖啡温度 = TempEnum.低;
  207. 咖啡浓度 = CoffeeConcentration.清淡;
  208. 热水量 = _热水量;
  209. 热水温度 = TempEnum.高;
  210. 牛奶时间 = 0;
  211. 奶沫时间 = 0;
  212. 预煮 = CancelOrOkEnum.否;
  213. 咖啡增强 = CancelOrOkEnum.否;
  214. 咖啡牛奶同时出 = CancelOrOkEnum.否;
  215. 出品顺序 = CancelOrOkEnum.否;
  216. return GetCoffeeRecipe();
  217. }
  218. /// <summary>
  219. /// 卡布:热奶沫+咖啡
  220. /// </summary>
  221. /// <param name="_咖啡量">15-240</param>
  222. /// <param name="_奶沫时间">5-120</param>
  223. public string GetCabo(int _咖啡量,int _奶沫时间)
  224. {
  225. 饮品类型 = DrinkType.卡布奇诺;
  226. 咖啡量 = _咖啡量;
  227. 咖啡温度 = TempEnum.中;
  228. 咖啡浓度 = CoffeeConcentration.适中;
  229. 热水量 = 0;
  230. 热水温度 = TempEnum.低;
  231. 牛奶时间 = 0;
  232. 奶沫时间 = _奶沫时间;
  233. 预煮 = CancelOrOkEnum.是;
  234. 咖啡增强 = CancelOrOkEnum.是;
  235. 咖啡牛奶同时出 = CancelOrOkEnum.否;
  236. 出品顺序 = CancelOrOkEnum.是;
  237. return GetCoffeeRecipe();
  238. }
  239. /// <summary>
  240. /// 玛奇朵:热牛奶+奶沫+咖啡 牛奶和奶沫不能同时为0
  241. /// </summary>
  242. /// <param name="_咖啡量">15-240</param>
  243. /// <param name="_牛奶时间">5-120</param>
  244. /// <param name="_奶沫时间">5-120</param>
  245. public string GetMacChiato(int _咖啡量,int _牛奶时间,int _奶沫时间)
  246. {
  247. 饮品类型 = DrinkType.玛琪雅朵;
  248. 咖啡量 = _咖啡量;
  249. 咖啡温度 = TempEnum.中;
  250. 咖啡浓度 = CoffeeConcentration.适中;
  251. 热水量 = 0;
  252. 热水温度 = TempEnum.低;
  253. 牛奶时间 = _牛奶时间;
  254. 奶沫时间 = _奶沫时间;
  255. 预煮 = CancelOrOkEnum.是;
  256. 咖啡增强 = CancelOrOkEnum.否;
  257. 咖啡牛奶同时出 = CancelOrOkEnum.是;
  258. 出品顺序 = CancelOrOkEnum.否;
  259. return GetCoffeeRecipe();
  260. }
  261. /// <summary>
  262. /// 拿铁:热牛奶+奶沫+咖啡
  263. /// </summary>
  264. /// <param name="_咖啡量">15-240</param>
  265. /// <param name="_牛奶时间">5-120</param>
  266. /// <param name="_奶沫时间">5-120</param>
  267. public string GetLatte(int _咖啡量,int _牛奶时间,int _奶沫时间)
  268. {
  269. 饮品类型 = DrinkType.拿铁咖啡;
  270. 咖啡量 = _咖啡量;
  271. 咖啡温度 = TempEnum.中;
  272. 咖啡浓度 = CoffeeConcentration.适中;
  273. 热水量 = 0;
  274. 热水温度 = TempEnum.低;
  275. 牛奶时间 = _牛奶时间;
  276. 奶沫时间 = _奶沫时间;
  277. 预煮 = CancelOrOkEnum.是;
  278. 咖啡增强 = CancelOrOkEnum.否;
  279. 咖啡牛奶同时出 = CancelOrOkEnum.否;
  280. 出品顺序 = CancelOrOkEnum.是;
  281. return GetCoffeeRecipe();
  282. }
  283. /// <summary>
  284. /// 热牛奶:仅热牛奶
  285. /// </summary>
  286. /// <param name="_牛奶时间">5-120</param>
  287. public string GetHotMilk(int _牛奶时间)
  288. {
  289. 饮品类型 = DrinkType.热牛奶;
  290. 咖啡量 = 0;
  291. 咖啡温度 = TempEnum.低;
  292. 咖啡浓度 = CoffeeConcentration.清淡;
  293. 热水量 = 0;
  294. 热水温度 = TempEnum.低;
  295. 牛奶时间 = _牛奶时间;
  296. 奶沫时间 = 0;
  297. 预煮 = CancelOrOkEnum.否;
  298. 咖啡增强 = CancelOrOkEnum.否;
  299. 咖啡牛奶同时出 = CancelOrOkEnum.否;
  300. 出品顺序 = CancelOrOkEnum.否;
  301. return GetCoffeeRecipe();
  302. }
  303. /// <summary>
  304. /// 热奶沫:仅热奶沫
  305. /// </summary>
  306. /// <param name="_奶沫时间">5-120</param>
  307. public string GetHotMilkFoam(int _奶沫时间)
  308. {
  309. 饮品类型 = DrinkType.热奶沫;
  310. 咖啡量 = 0;
  311. 咖啡温度 = TempEnum.低;
  312. 咖啡浓度 = CoffeeConcentration.清淡;
  313. 热水量 = 0;
  314. 热水温度 = TempEnum.低;
  315. 牛奶时间 = 0;
  316. 奶沫时间 = _奶沫时间;
  317. 预煮 = CancelOrOkEnum.否;
  318. 咖啡增强 = CancelOrOkEnum.否;
  319. 咖啡牛奶同时出 = CancelOrOkEnum.否;
  320. 出品顺序 = CancelOrOkEnum.否;
  321. return GetCoffeeRecipe();
  322. }
  323. #endregion
  324. }
  325. }