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

Control_MorkBF.cs 27 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804
  1. using BPA.Message;
  2. using BPA.Message.Enum;
  3. using BPASmartClient.Business;
  4. using BPASmartClient.Device;
  5. using BPASmartClient.EventBus;
  6. using BPASmartClient.Helper;
  7. using BPASmartClient.Model;
  8. using BPASmartClient.MorkBF.ViewModel;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading;
  14. using System.Threading.Tasks;
  15. using static BPASmartClient.EventBus.EventBus;
  16. namespace BPASmartClient.MorkBF
  17. {
  18. public class Control_MorkBF : BaseDevice
  19. {
  20. GVL_MorkBF morkBF = new GVL_MorkBF();
  21. public override DeviceClientType DeviceType => DeviceClientType.MORKCS;
  22. public override void DoMain()
  23. {
  24. MonitorViewModel.DeviceId = DeviceId;
  25. CommandRegist();//调试
  26. ServerInit();
  27. DataParse();//数据解析
  28. ScreenDataServer();//大屏数据上报
  29. DeviceProcessLogShow("MORKF 设备初始化完成");
  30. }
  31. private void DataParse()
  32. {
  33. EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle)
  34. {
  35. if (@event == null) return;
  36. if (@event is DoOrderEvent order)
  37. {
  38. if (order.MorkOrder.GoodBatchings == null) return;
  39. OrderCount++;
  40. DeviceProcessLogShow($"接收到{OrderCount}次订单");
  41. }
  42. });
  43. }
  44. private void ServerInit()
  45. {
  46. //物料信息
  47. EventBus.EventBus.GetInstance().Subscribe<MaterialDeliveryEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
  48. {
  49. if (@event == null) return;
  50. if (@event is MaterialDeliveryEvent material)
  51. {
  52. orderMaterialDelivery = material.orderMaterialDelivery;
  53. }
  54. });
  55. //配方数据信息
  56. EventBus.EventBus.GetInstance().Subscribe<RecipeBomEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
  57. {
  58. if (@event == null) return;
  59. if (@event is RecipeBomEvent recipe)
  60. {
  61. recipeBoms = recipe.recipeBoms;
  62. }
  63. });
  64. }
  65. /// <summary>
  66. /// 调试
  67. /// </summary>
  68. /// <exception cref="NotImplementedException"></exception>
  69. private void CommandRegist()
  70. {
  71. #region 炒锅1
  72. ActionManage.GetInstance.Register(FirePot1_SetFireGear, "FirePot1_SetFireGear");//炒锅1设定加热挡位
  73. ActionManage.GetInstance.Register(FirePot1_StartFire, "FirePot1_StartFire");//炒锅1加热启动
  74. ActionManage.GetInstance.Register(FirePot1_StartFire, "FirePot1_StopFire");//炒锅1关闭加热
  75. ActionManage.GetInstance.Register(FirePot1_SetStirGear, "FirePot1_SetStirGear");//炒锅1设定搅拌挡位
  76. ActionManage.GetInstance.Register(FirePot1_StartStir, "FirePot1_StartStir");//炒锅1搅拌启动
  77. ActionManage.GetInstance.Register(FirePot1_StartStir, "FirePot1_StopStir");//炒锅1搅拌停止
  78. ActionManage.GetInstance.Register(FirePot1_SetTurnSpeed, "FirePot1_SetTurnSpeed");//炒锅1翻转频率设定
  79. #endregion
  80. #region 炒锅2
  81. ActionManage.GetInstance.Register(FirePot2_SetFireGear, "FirePot2_SetFireGear");//炒锅2设定加热挡位
  82. ActionManage.GetInstance.Register(FirePot2_StartFire, "FirePot2_StartFire");//炒锅2加热启动
  83. ActionManage.GetInstance.Register(FirePot2_StartFire, "FirePot2_StopFire");//炒锅2关闭加热
  84. ActionManage.GetInstance.Register(FirePot2_SetStirGear, "FirePot2_SetStirGear");//炒锅2设定搅拌挡位
  85. ActionManage.GetInstance.Register(FirePot2_StartStir, "FirePot2_StartStir");//炒锅2搅拌启动
  86. ActionManage.GetInstance.Register(FirePot2_StartStir, "FirePot2_StopStir");//炒锅2搅拌停止
  87. ActionManage.GetInstance.Register(FirePot2_SetTurnSpeed, "FirePot2_SetTurnSpeed");//炒锅2翻转频率设定
  88. #endregion
  89. #region 炒锅通用
  90. ActionManage.GetInstance.Register(FirePot_Reset, "FirePot_Reset");//复位;
  91. ActionManage.GetInstance.Register(FirePot_PotGotoOrigin, "FirePot_PotGotoOrigin");//炒锅回原点
  92. ActionManage.GetInstance.Register(FirePot_PotGotoP1, "FirePot_PotGotoP1");//炒锅去位置1
  93. ActionManage.GetInstance.Register(FirePot_PotGotoP2, "FirePot_PotGotoP2");//炒锅去位置2
  94. ActionManage.GetInstance.Register(FirePot_PotGotoP3, "FirePot_PotGotoP3");//炒锅去位置3
  95. ActionManage.GetInstance.Register(FirePot_PotGotoP4, "FirePot_PotGotoP4");//炒锅去位置4
  96. ActionManage.GetInstance.Register(FirePot_PotGotoOutFoodPositiong, "FirePot_PotGotoOutFoodPositiong");//炒锅去出餐位置
  97. ActionManage.GetInstance.Register(FirePot_PotGotoInFoodPosition, "FirePot_PotGotoInFoodPosition");//炒锅去投料位置
  98. ActionManage.GetInstance.Register(FirePot_StartOutFood, "FirePot_StartOutFood");//出餐启动
  99. ActionManage.GetInstance.Register(FirePot_Clean, "FirePot_Clean");//清洗
  100. ActionManage.GetInstance.Register(FirePot_StartPumpWater, "FirePot_StartPumpWater");//抽水启动
  101. ActionManage.GetInstance.Register(FirePot_StartPumpOil, "FirePot_StartPumpOil");//抽油启动
  102. #endregion
  103. #region 机器人
  104. ActionManage.GetInstance.Register(RobotStart, "RobotStart");//机器人启动
  105. ActionManage.GetInstance.Register(RobotStop, "RobotStop");//机器人停止
  106. ActionManage.GetInstance.Register(RobotReset, "RobotReset");//复位
  107. ActionManage.GetInstance.Register(RobotProgramStart, "RobotProgramStart");//程序启动
  108. ActionManage.GetInstance.Register(Robot_Pot1AllowInMaterail, "Robot_Pot1AllowInMaterail");//1号炒锅允许机器人投料
  109. ActionManage.GetInstance.Register(Robot_Pot1OutFoodInSlowDown, "Robot_Pot1OutFoodInSlowDown");//1号炒锅出餐倒料到减速位
  110. ActionManage.GetInstance.Register(Robot_Pot1OutFood, "Robot_Pot1OutFoodInSlowDown");//1号炒锅出餐倒料完成
  111. ActionManage.GetInstance.Register(Robot_Pot2AllowInMaterail, "Robot_Pot2AllowInMaterail");//2号炒锅允许机器人投料
  112. ActionManage.GetInstance.Register(Robot_Pot2OutFoodInSlowDown, "Robot_Pot2OutFoodInSlowDown");//2号炒锅出餐倒料到减速位
  113. ActionManage.GetInstance.Register(Robot_Pot2OutFood, "Robot_Pot2OutFood");//2号炒锅出餐倒料完成
  114. ActionManage.GetInstance.Register(RobotActionStart, "Robot_Pot2OutFood");//2号炒锅出餐倒料完成
  115. #endregion
  116. }
  117. public override void MainTask()
  118. {
  119. }
  120. private void FirePot1_Process()
  121. {
  122. }
  123. private void FirePot2_Process()
  124. {
  125. }
  126. public override void ReadData()
  127. {
  128. GetStatus("M20.0",new Action<object>((o)=>
  129. {
  130. if (o == null) return;
  131. if(o is bool[] values&&values.Length == 19)
  132. {
  133. morkBF.FirePot1_InitCompleted = values[0];
  134. morkBF.FirePot1_IsAuto = values[1];
  135. morkBF.FirePot1_Emergencystop = values[2];
  136. morkBF.FirePot1_MealTubExist = values[3];
  137. morkBF.FirePot1_VegetablesTub1Exist = values[4];
  138. morkBF.FirePot1_VegetablesTub2Exist = values[5];
  139. morkBF.FirePot1_Seasoning1Exist = values[6];
  140. morkBF.FirePot1_Seasoning2Exist = values[7];
  141. morkBF.FirePot1_Accessories1Exist = values[8];
  142. morkBF.FirePot1_Accessories2Exist = values[9];
  143. morkBF.FirePot1_OutFoodTubExist = values[10];
  144. morkBF.FirePot1_OnOrigin = values[11];
  145. morkBF.FirePot1_FirePosition1 = values[12];
  146. morkBF.FirePot1_FirePosition2 = values[13];
  147. morkBF.FirePot1_FirePosition3 = values[14];
  148. morkBF.FirePot1_FirePosition4 = values[15];
  149. morkBF.FirePot1_PotOnOutFoodPosition = values[16];
  150. morkBF.FirePot1_PotOnIntoFoodPosition = values[17];
  151. morkBF.FirePot1_PotOnCleanPosition = values[18];
  152. }
  153. }),0);
  154. GetStatus("VW120", new Action<object>((o) =>
  155. {
  156. if (o == null) return;
  157. if (o is int[] values&&values.Length == 2)
  158. {
  159. morkBF.FirePot1_Temperature = values[0];
  160. morkBF.FirePot1_Pulse = values[1];
  161. }
  162. }), 0);
  163. GetStatus("M25.0", new Action<object>((o) =>
  164. {
  165. if (o == null) return;
  166. if (o is bool[] values&& values.Length == 19)
  167. {
  168. morkBF.FirePot2_InitCompleted = values[0];
  169. morkBF.FirePot2_IsAuto = values[1];
  170. morkBF.FirePot2_Emergencystop = values[2];
  171. morkBF.FirePot2_MealTubExist = values[3];
  172. morkBF.FirePot2_VegetablesTub1Exist = values[4];
  173. morkBF.FirePot2_VegetablesTub2Exist = values[5];
  174. morkBF.FirePot2_Seasoning1Exist = values[6];
  175. morkBF.FirePot2_Seasoning2Exist = values[7];
  176. morkBF.FirePot2_Accessories1Exist = values[8];
  177. morkBF.FirePot2_Accessories2Exist = values[9];
  178. morkBF.FirePot2_OutFoodTubExist = values[10];
  179. morkBF.FirePot2_OnOrigin = values[11];
  180. morkBF.FirePot2_FirePosition1 = values[12];
  181. morkBF.FirePot2_FirePosition2 = values[13];
  182. morkBF.FirePot2_FirePosition3 = values[14];
  183. morkBF.FirePot2_FirePosition4 = values[15];
  184. morkBF.FirePot2_PotOnOutFoodPosition = values[16];
  185. morkBF.FirePot2_PotOnIntoFoodPosition = values[17];
  186. morkBF.FirePot2_PotOnCleanPosition = values[18];
  187. }
  188. }), 0);
  189. GetStatus("VW150", new Action<object>((o) =>
  190. {
  191. if (o == null) return;
  192. if (o is int[] values&& values.Length == 2)
  193. {
  194. morkBF.FirePot2_Temperature = values[0];
  195. morkBF.FirePot2_Pulse = values[1];
  196. }
  197. }), 0);
  198. GetStatus("GM500", new Action<object>((o) =>
  199. {
  200. if (o == null) return;
  201. if (o is bool[] values && values.Length == 7)
  202. {
  203. morkBF.Robot_FirePot1OutMeal = values[0];
  204. morkBF.Robot_FirePot1OutVegetables1 = values[1];
  205. morkBF.Robot_FirePot1OutVegetables2 = values[2];
  206. morkBF.Robot_FirePot1OutSeasoning = values[3];
  207. morkBF.Robot_FirePot1OutAccessories = values[4];
  208. morkBF.Robot_ArriveFirePot1 = values[5];
  209. morkBF.Robot_FirePot1OutFoodComplete = values[6];
  210. }
  211. }), 1);
  212. GetStatus("GM510", new Action<object>((o) =>
  213. {
  214. if (o == null) return;
  215. if (o is bool[] values && values.Length == 7)
  216. {
  217. morkBF.Robot_FirePot2OutMeal = values[0];
  218. morkBF.Robot_FirePot2OutVegetables1 = values[1];
  219. morkBF.Robot_FirePot2OutVegetables2 = values[2];
  220. morkBF.Robot_FirePot2OutSeasoning = values[3];
  221. morkBF.Robot_FirePot2OutAccessories = values[4];
  222. morkBF.Robot_ArriveFirePot2 = values[5];
  223. morkBF.Robot_FirePot2OutFoodComplete = values[6];
  224. }
  225. }), 1);
  226. GetStatus("GI5", new Action<object>((o) =>
  227. {
  228. if (o == null) return;
  229. if (o is int[] values && values.Length == 1)
  230. {
  231. morkBF.Robot_ActionCallback = values[0];
  232. }
  233. }), 1);
  234. }
  235. public override void ResetProgram()
  236. {
  237. morkBF = null;
  238. morkBF = new GVL_MorkBF();
  239. }
  240. public override void SimOrder()
  241. {
  242. }
  243. public override void Stop()
  244. {
  245. }
  246. /// <summary>
  247. /// 获取炒锅PLC的所有状态
  248. /// </summary>
  249. /// <param name="key"></param>
  250. /// <param name="action"></param>
  251. /// <param name="num">炒锅编号</param>
  252. private void GetStatus(string key, Action<object> action, int num)
  253. {
  254. if (dicPort2peripheralStatus.ContainsKey(num))
  255. {
  256. if (dicPort2peripheralStatus[num].ContainsKey(key))
  257. {
  258. action((object)dicPort2peripheralStatus[num][key]);//获取PLC指定地址的状态值
  259. }
  260. }
  261. }
  262. #region 控制
  263. private void FirePot_Write(string address, object value, int i = 0)
  264. {
  265. WriteControlExact(address, value, i);
  266. }
  267. private void Robot_Write(string address, object value, int i = 1)
  268. {
  269. WriteControlExact(address, value, i);
  270. }
  271. #region 炒锅1
  272. /// <summary>
  273. /// 炒锅1设定加热挡位
  274. /// </summary>
  275. /// <param name="o"></param>
  276. private void FirePot1_SetFireGear(object o)
  277. {
  278. if (o == null) return;
  279. if (o is int value)
  280. {
  281. FirePot_Write("VW100", value);
  282. }
  283. }
  284. /// <summary>
  285. /// 炒锅1加热启停
  286. /// </summary>
  287. /// <param name="b"></param>
  288. private void FirePot1_StartFire(object o)
  289. {
  290. if (o == null) return;
  291. if (o is bool value)
  292. {
  293. FirePot_Write("M10.0", value);
  294. }
  295. }
  296. /// <summary>
  297. /// 炒锅1设置搅拌挡位
  298. /// </summary>
  299. /// <param name="o"></param>
  300. private void FirePot1_SetStirGear(object o)
  301. {
  302. if (o == null) return;
  303. if (o is int value)
  304. {
  305. FirePot_Write("VW102", value);
  306. }
  307. }
  308. /// <summary>
  309. /// 炒锅1搅拌启停
  310. /// </summary>
  311. /// <param name="o"></param>
  312. private void FirePot1_StartStir(object o)
  313. {
  314. if (o == null) return;
  315. if (o is bool value)
  316. {
  317. FirePot_Write("M10.1", value);
  318. }
  319. }
  320. /// <summary>
  321. /// 设置炒锅1翻转速度
  322. /// </summary>
  323. /// <param name="o"></param>
  324. private void FirePot1_SetTurnSpeed(object o)
  325. {
  326. if (o == null) return;
  327. if (o is int value)
  328. {
  329. FirePot_Write("VW104", value);
  330. }
  331. }
  332. #endregion
  333. #region 炒锅2
  334. /// <summary>
  335. /// 炒锅2设定加热挡位
  336. /// </summary>
  337. /// <param name="o"></param>
  338. private void FirePot2_SetFireGear(object o)
  339. {
  340. if (o == null) return;
  341. if (o is int value)
  342. {
  343. FirePot_Write("VW130", value);
  344. }
  345. }
  346. /// <summary>
  347. /// 炒锅2加热启停
  348. /// </summary>
  349. /// <param name="b"></param>
  350. private void FirePot2_StartFire(object o)
  351. {
  352. if (o == null) return;
  353. if (o is bool value)
  354. {
  355. FirePot_Write("M15.0", value);
  356. }
  357. }
  358. /// <summary>
  359. /// 炒锅2设置搅拌挡位
  360. /// </summary>
  361. /// <param name="o"></param>
  362. private void FirePot2_SetStirGear(object o)
  363. {
  364. if (o == null) return;
  365. if (o is int value)
  366. {
  367. FirePot_Write("VW132", value);
  368. }
  369. }
  370. /// <summary>
  371. /// 炒锅2搅拌启停
  372. /// </summary>
  373. /// <param name="o"></param>
  374. private void FirePot2_StartStir(object o)
  375. {
  376. if (o == null) return;
  377. if (o is bool value)
  378. {
  379. FirePot_Write("M15.1", value);
  380. }
  381. }
  382. /// <summary>
  383. /// 设置炒锅2翻转速度
  384. /// </summary>
  385. /// <param name="o"></param>
  386. private void FirePot2_SetTurnSpeed(object o)
  387. {
  388. if (o == null) return;
  389. if (o is int value)
  390. {
  391. FirePot_Write("VW134", value);
  392. }
  393. }
  394. #endregion
  395. #region 炒锅通用
  396. /// <summary>
  397. /// 炒锅复位
  398. /// </summary>
  399. /// <param name="o"></param>
  400. private void FirePot_Reset(object o)
  401. {
  402. if (o == null) return;
  403. if (o is int i)
  404. {
  405. if (i == 1)
  406. {
  407. }
  408. else if (i == 2)
  409. {
  410. }
  411. }
  412. }
  413. /// <summary>
  414. /// 炒锅回原点
  415. /// </summary>
  416. /// <param name="o"></param>
  417. private void FirePot_PotGotoOrigin(object o)
  418. {
  419. if (o == null) return;
  420. if (o is int i)
  421. {
  422. if (i == 1)
  423. {
  424. FirePot_Write("M10.5", true);
  425. }
  426. else if (i == 2)
  427. {
  428. FirePot_Write("M15.5", true);
  429. }
  430. }
  431. }
  432. /// <summary>
  433. /// 炒锅去位置1
  434. /// </summary>
  435. /// <param name="o"></param>
  436. private void FirePot_PotGotoP1(object o)
  437. {
  438. if (o == null) return;
  439. if (o is int i)
  440. {
  441. if (i == 1)
  442. {
  443. FirePot_Write("M11.2", true);
  444. }
  445. else if (i == 2)
  446. {
  447. FirePot_Write("M16.2", true);
  448. }
  449. }
  450. }
  451. /// <summary>
  452. /// 炒锅去位置2
  453. /// </summary>
  454. /// <param name="o"></param>
  455. private void FirePot_PotGotoP2(object o)
  456. {
  457. if (o == null) return;
  458. if (o is int i)
  459. {
  460. if (i == 1)
  461. {
  462. FirePot_Write("M11.3", true);
  463. }
  464. else if (i == 2)
  465. {
  466. FirePot_Write("M16.3", true);
  467. }
  468. }
  469. }
  470. /// <summary>
  471. /// 炒锅去位置3
  472. /// </summary>
  473. /// <param name="o"></param>
  474. private void FirePot_PotGotoP3(object o)
  475. {
  476. if (o == null) return;
  477. if (o is int i)
  478. {
  479. if (i == 1)
  480. {
  481. FirePot_Write("M11.4", true);
  482. }
  483. else if (i == 2)
  484. {
  485. FirePot_Write("M16.4", true);
  486. }
  487. }
  488. }
  489. /// <summary>
  490. /// 炒锅去位置4
  491. /// </summary>
  492. /// <param name="o"></param>
  493. private void FirePot_PotGotoP4(object o)
  494. {
  495. if (o == null) return;
  496. if (o is int i)
  497. {
  498. if (i == 1)
  499. {
  500. FirePot_Write("M11.5", true);
  501. }
  502. else if (i == 2)
  503. {
  504. FirePot_Write("M16.5", true);
  505. }
  506. }
  507. }
  508. /// <summary>
  509. /// 炒锅去出餐位置
  510. /// </summary>
  511. /// <param name="o"></param>
  512. private void FirePot_PotGotoOutFoodPositiong(object o)
  513. {
  514. if (o == null) return;
  515. if (o is int i)
  516. {
  517. if (i == 1)
  518. {
  519. FirePot_Write("M11.6", true);
  520. }
  521. else if (i == 2)
  522. {
  523. FirePot_Write("M16.6", true);
  524. }
  525. }
  526. }
  527. /// <summary>
  528. /// 炒锅去投料位置
  529. /// </summary>
  530. /// <param name="o"></param>
  531. private void FirePot_PotGotoInFoodPosition(object o)
  532. {
  533. if (o == null) return;
  534. if (o is int i)
  535. {
  536. if (i == 1)
  537. {
  538. FirePot_Write("M11.7", true);
  539. }
  540. else if (i == 2)
  541. {
  542. FirePot_Write("M16.7", true);
  543. }
  544. }
  545. }
  546. /// <summary>
  547. /// 出餐启动
  548. /// </summary>
  549. /// <param name="o"></param>
  550. private void FirePot_StartOutFood(object o)
  551. {
  552. if (o == null) return;
  553. if (o is int i)
  554. {
  555. if (i == 1)
  556. {
  557. FirePot_Write("M10.6", true);
  558. }
  559. else if (i == 2)
  560. {
  561. FirePot_Write("M15.6", true);
  562. }
  563. }
  564. }
  565. /// <summary>
  566. /// 清洗
  567. /// </summary>
  568. /// <param name="o"></param>
  569. private void FirePot_Clean(object o)
  570. {
  571. if (o == null) return;
  572. if (o is int i)
  573. {
  574. if (i == 1)
  575. {
  576. FirePot_Write("M10.7", true);
  577. }
  578. else if (i == 2)
  579. {
  580. FirePot_Write("M15.7", true);
  581. }
  582. }
  583. }
  584. /// <summary>
  585. /// 抽水启动
  586. /// </summary>
  587. /// <param name="o"></param>
  588. private void FirePot_StartPumpWater(object o)
  589. {
  590. if (o == null) return;
  591. if (o is int i)
  592. {
  593. if (i == 1)
  594. {
  595. FirePot_Write("M11.0", true);
  596. }
  597. else if (i == 2)
  598. {
  599. FirePot_Write("M16.0", true);
  600. }
  601. }
  602. }
  603. /// <summary>
  604. /// 抽油启动
  605. /// </summary>
  606. /// <param name="o"></param>
  607. private void FirePot_StartPumpOil(object o)
  608. {
  609. if (o == null) return;
  610. if (o is int i)
  611. {
  612. if (i == 1)
  613. {
  614. FirePot_Write("M16.0", true);
  615. }
  616. else if (i == 2)
  617. {
  618. FirePot_Write("M16.1", true);
  619. }
  620. }
  621. }
  622. #endregion
  623. #region 机器人
  624. /// <summary>
  625. /// 机器人启动
  626. /// </summary>
  627. private void RobotStart()
  628. {
  629. Robot_Write("GM600",true);
  630. }
  631. /// <summary>
  632. /// 机器人停止
  633. /// </summary>
  634. private void RobotStop()
  635. {
  636. Robot_Write("GM601", true);
  637. }
  638. /// <summary>
  639. /// 机器人复位
  640. /// </summary>
  641. private void RobotReset()
  642. {
  643. Robot_Write("GM602", true);
  644. }
  645. /// <summary>
  646. /// 机器人程序重启
  647. /// </summary>
  648. private void RobotProgramStart()
  649. {
  650. Robot_Write("GM603", true);
  651. }
  652. /// <summary>
  653. /// 1号炒锅允许机器人投料(炒锅在投料位给出)
  654. /// </summary>
  655. private void Robot_Pot1AllowInMaterail()
  656. {
  657. Robot_Write("GM520", true);
  658. }
  659. /// <summary>
  660. /// 1号炒锅出餐倒料到减速位
  661. /// </summary>
  662. private void Robot_Pot1OutFoodInSlowDown()
  663. {
  664. Robot_Write("GM621", true);
  665. }
  666. /// <summary>
  667. /// 1号炒锅出餐倒料完成
  668. /// </summary>
  669. private void Robot_Pot1OutFood()
  670. {
  671. Robot_Write("GM522", true);
  672. }
  673. /// <summary>
  674. /// 2号炒锅允许机器人投料(炒锅在投料位给出)
  675. /// </summary>
  676. private void Robot_Pot2AllowInMaterail()
  677. {
  678. Robot_Write("GM530", true);
  679. }
  680. /// <summary>
  681. /// 2号炒锅出餐倒料到减速位。开始倒菜
  682. /// </summary>
  683. private void Robot_Pot2OutFoodInSlowDown()
  684. {
  685. Robot_Write("GM531", true);
  686. }
  687. /// <summary>
  688. /// 2号炒锅出餐倒料完成
  689. /// </summary>
  690. private void Robot_Pot2OutFood()
  691. {
  692. Robot_Write("GM532", true);
  693. }
  694. /// <summary>
  695. ///
  696. /// </summary>
  697. private void RobotActionStart(object o)
  698. {
  699. if (o == null) return;
  700. if(o is int value)
  701. {
  702. Robot_Write("GI0",value);
  703. }
  704. }
  705. #endregion
  706. #endregion
  707. private void ScreenDataServer()
  708. {
  709. LocalMqtt.GetInstance.Init(ScreenDeviceType.大炒);
  710. ThreadManage.GetInstance().StartLong(new Action(() =>
  711. {
  712. List<StatsModel> statsModels = new List<StatsModel>();
  713. statsModels.Add(new StatsModel() { Name = "帝王蟹", Count = 666 });
  714. ScreenModelMaxWok maxWok = new ScreenModelMaxWok
  715. {
  716. IsRun = new Random().Next(0, 2) == 0 ? IsRun.运行 : IsRun.停止,
  717. WorkStatus_1 = (WorkStatus)new Random().Next(0, 3),
  718. WorkStatus_2 = (WorkStatus)new Random().Next(0, 3),
  719. RobotStatu = (WorkStatus)new Random().Next(0, 3),
  720. Alarm = new List<AlarmModel>(),
  721. FailuresCount = 0,
  722. StatsCount = statsModels,
  723. MaxWok_Dishes_1 = "满汉全席",
  724. MaxWok_Dishes_2 = "海鲜大餐",
  725. MaxWok_Task_1 = "炒制菜品",
  726. MaxWok_Task_2 = "热油",
  727. MaxWok_Process_1 = new List<ProcessModel>(),
  728. MaxWok_HeatGear_1 = new Random().Next(0, 5).ToString(),
  729. MaxWok_HeatGear_2 = new Random().Next(0, 5).ToString(),
  730. MaxWok_StirGear_1 = new Random().Next(0, 5).ToString(),
  731. MaxWok_StirGear_2 = new Random().Next(0, 5).ToString(),
  732. MaxWok_FlipSpeed_1 = new Random().Next(250, 450).ToString(),
  733. MaxWok_FlipSpeed_2 = new Random().Next(250, 450).ToString(),
  734. MaxWok_Temp_1 = new Random().Next(250, 450).ToString(),
  735. MaxWok_Temp_2 = new Random().Next(250, 450).ToString(),
  736. MaxWok_OrderCount_1 = 2,
  737. MaxWok_OrderCount_2 = 2,
  738. MaxWok_ErrorOrderCount_1 = 0,
  739. MaxWok_ErrorOrderCount_2 = 0,
  740. };
  741. LocalMqtt.GetInstance.Publish(maxWok);
  742. Thread.Sleep(1000);
  743. }), "大屏数据上报");
  744. }
  745. }
  746. }