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

891 lines
31 KiB

  1. using BPASmartClient.CustomResource.Pages.Model;
  2. using BPASmartClient.CustomResource.UserControls.MessageShow;
  3. using BPASmartClient.MorkCL.HelpClass;
  4. using System.Reflection.Metadata;
  5. using System.Windows.Markup;
  6. namespace BPASmartClient.MorkCL.ViewModel
  7. {
  8. public class DebugViewModel : NotifyBase
  9. {
  10. private ushort heatGear;
  11. private ushort agitaFrequency;
  12. public DebugViewModel()
  13. {
  14. #region 炒锅1#命令实例
  15. WriteAgitaParamCommand = new(async () =>
  16. {
  17. //if (!GetDeviceIsIdle(EDeviceType.炒锅1))
  18. //{
  19. // return;
  20. //}
  21. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  22. {
  23. return;
  24. }
  25. ActionManage.GetInstance.Send(new WriteModel<ushort>(EDeviceType.炒锅1, "LW1", (ushort)(AgitaFrequency * 100)), "WriteUshort");
  26. await SendWriteRequest("LB10", EDeviceType.炒锅1);
  27. ShowNotify($"写入搅拌参数成功。");
  28. });
  29. StartAgitateCommand = new(() =>
  30. {
  31. if (!GetDeviceIsIdle(EDeviceType.炒锅1))
  32. {
  33. return;
  34. }
  35. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  36. {
  37. return;
  38. }
  39. ActionManage.GetInstance.Send(new WriteModel<bool>(EDeviceType.炒锅1, "LB0", true), "WriteBool");
  40. ShowNotify($"写入搅拌启动成功。");
  41. });
  42. StopAgitateCommand = new(() =>
  43. {
  44. //if (!GetDeviceIsIdle(EDeviceType.炒锅1))
  45. //{
  46. // return;
  47. //}
  48. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  49. {
  50. return;
  51. }
  52. ActionManage.GetInstance.Send(new WriteModel<bool>(EDeviceType.炒锅1, "LB0", false), "WriteBool");
  53. ShowNotify($"写入搅拌停止成功。");
  54. });
  55. WriteHeatParamCommand = new(async () =>
  56. {
  57. //if (!GetDeviceIsIdle(EDeviceType.炒锅1))
  58. //{
  59. // return;
  60. //}
  61. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  62. {
  63. return;
  64. }
  65. ActionManage.GetInstance.Send(new WriteModel<ushort>(EDeviceType.炒锅1, "LW0", HeatGear), "WriteUshort");
  66. await SendWriteRequest("LB9", EDeviceType.炒锅1);
  67. ShowNotify($"写入加热参数成功。");
  68. });
  69. StartHeatCommand = new(() =>
  70. {
  71. if (!GetDeviceIsIdle(EDeviceType.炒锅1))
  72. {
  73. return;
  74. }
  75. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  76. {
  77. return;
  78. }
  79. ActionManage.GetInstance.Send(new WriteModel<bool>(EDeviceType.炒锅1, "LB3", true), "WriteBool");
  80. ShowNotify($"写入加热启动成功。");
  81. });
  82. StopHeatCommand = new(() =>
  83. {
  84. //if (!GetDeviceIsIdle(EDeviceType.炒锅1))
  85. //{
  86. // return;
  87. //}
  88. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  89. {
  90. return;
  91. }
  92. ActionManage.GetInstance.Send(new WriteModel<bool>(EDeviceType.炒锅1, "LB3", false), "WriteBool");
  93. ShowNotify($"写入加热停止成功。");
  94. });
  95. ChannelCuttingCommand = new(async () =>
  96. {
  97. //var channelIndex = ChannelSelect;
  98. //var weight = Convert.ToUInt16(Weight);
  99. //byte[] LWOffset = new byte[3] { 3, 4, 5 };
  100. //byte[] LBOffset = new byte[3] { 6, 7, 8 };
  101. //ActionManage.GetInstance.Send("WriteUshort", new WriteModel<ushort>(EDeviceType.炒锅1, $"LW{LWOffset[channelIndex]}", weight));
  102. //await SendWriteRequest($"LB{LBOffset[channelIndex]}");
  103. if (!GetDeviceIsIdle(EDeviceType.炒锅1))
  104. {
  105. return;
  106. }
  107. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  108. {
  109. return;
  110. }
  111. object[] para = new object[3];
  112. para[0] = EDeviceType.炒锅1;
  113. para[1] = ChannelSelect + 1;
  114. para[2] = Convert.ToUInt16(Weight);
  115. await Task.Run(() => ActionManage.GetInstance.Send(para, "DeviceCuttingControl"));
  116. ShowNotify($"写入通道下料控制成功。");
  117. });
  118. GoFryLocCommand = new(async () =>
  119. {
  120. if (!GetDeviceIsIdle(EDeviceType.炒锅1))
  121. {
  122. return;
  123. }
  124. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  125. {
  126. return;
  127. }
  128. var loc = StirFryLocSelect + 17;
  129. await SendWriteRequest($"LB{loc}", EDeviceType.炒锅1);
  130. ShowNotify($"写入去炒制位成功。");
  131. });
  132. GoHomeCommand = new(async () =>
  133. {
  134. if (!GetDeviceIsIdle(EDeviceType.炒锅1))
  135. {
  136. return;
  137. }
  138. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  139. {
  140. return;
  141. }
  142. await SendWriteRequest("LB12", EDeviceType.炒锅1);
  143. ShowNotify($"写入回原点成功。");
  144. });
  145. GoSeasoningFeddLocCommand = new(async () =>
  146. {
  147. if (!GetDeviceIsIdle(EDeviceType.炒锅1))
  148. {
  149. return;
  150. }
  151. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  152. {
  153. return;
  154. }
  155. await SendWriteRequest("LB16", EDeviceType.炒锅1);
  156. ShowNotify($"写入去调料投料位成功。");
  157. });
  158. OutDiningStartCommand = new(async () =>
  159. {
  160. if (!GetDeviceIsIdle(EDeviceType.炒锅1))
  161. {
  162. return;
  163. }
  164. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  165. {
  166. return;
  167. }
  168. await SendWriteRequest("LB13", EDeviceType.炒锅1);
  169. ShowNotify($"写入出餐启动成功。");
  170. });
  171. FryPanCleanCommand = new(async () =>
  172. {
  173. if (!GetDeviceIsIdle(EDeviceType.炒锅1))
  174. {
  175. return;
  176. }
  177. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  178. {
  179. return;
  180. }
  181. await SendWriteRequest("LB14", EDeviceType.炒锅1);
  182. ShowNotify($"写入炒锅清洗成功。");
  183. });
  184. SetAutoModeCommand = new(() =>
  185. {
  186. ActionManage.GetInstance.Send(new WriteModel<bool>(EDeviceType.炒锅1, "LB20", true), "WriteBool");
  187. ShowNotify($"设置设备自动模式成功。");
  188. });
  189. SetManualModeCommand = new(() =>
  190. {
  191. if (!GetDeviceIsIdle(EDeviceType.炒锅1))
  192. {
  193. return;
  194. }
  195. ActionManage.GetInstance.Send(new WriteModel<bool>(EDeviceType.炒锅1, "LB20", false), "WriteBool");
  196. ShowNotify($"设置设备手动模式成功。");
  197. });
  198. InitalDeviceCommand = new(async () =>
  199. {
  200. if (!GetDeviceIsIdle(EDeviceType.炒锅1))
  201. {
  202. return;
  203. }
  204. //复位所有变量。
  205. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  206. {
  207. return;
  208. }
  209. ResetFryPanVariable(EDeviceType.炒锅1);
  210. await SendWriteRequest("LB21", EDeviceType.炒锅1);
  211. ShowNotify($"设置设备初始化成功。");
  212. });
  213. StopDeviceCommand = new(async () =>
  214. {
  215. //if (!GetDeviceIsIdle(EDeviceType.炒锅1))
  216. //{
  217. // return;
  218. //}
  219. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  220. {
  221. return;
  222. }
  223. await SendWriteRequest("LB22", EDeviceType.炒锅1);
  224. ShowNotify($"设置设备停止成功。");
  225. });
  226. //炒锅那边复位变量没有使用。
  227. GoCleanLocCommand = new(async () =>
  228. {
  229. if (!GetDeviceIsIdle(EDeviceType.炒锅1))
  230. {
  231. return;
  232. }
  233. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  234. {
  235. return;
  236. }
  237. await SendWriteRequest("LB23", EDeviceType.炒锅1);
  238. ShowNotify($"设置设备去洗锅位成功。");
  239. });
  240. #endregion
  241. #region 炒锅2#命令实例
  242. WriteAgitaParamCommand2 = new(async () =>
  243. {
  244. //if (!GetDeviceIsIdle(EDeviceType.炒锅2))
  245. //{
  246. // return;
  247. //}
  248. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  249. {
  250. return;
  251. }
  252. ActionManage.GetInstance.Send(new WriteModel<ushort>(EDeviceType.炒锅2, "LW1", (ushort)(AgitaFrequency * 100)), "WriteUshort");
  253. await SendWriteRequest("LB10", EDeviceType.炒锅2);
  254. ShowNotify($"写入搅拌参数成功。");
  255. });
  256. StartAgitateCommand2 = new(() =>
  257. {
  258. if (!GetDeviceIsIdle(EDeviceType.炒锅2))
  259. {
  260. return;
  261. }
  262. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  263. {
  264. return;
  265. }
  266. ActionManage.GetInstance.Send(new WriteModel<bool>(EDeviceType.炒锅2, "LB0", true), "WriteBool");
  267. ShowNotify($"写入搅拌启动成功。");
  268. });
  269. StopAgitateCommand2 = new(() =>
  270. {
  271. //if (!GetDeviceIsIdle(EDeviceType.炒锅2))
  272. //{
  273. // return;
  274. //}
  275. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  276. {
  277. return;
  278. }
  279. ActionManage.GetInstance.Send(new WriteModel<bool>(EDeviceType.炒锅2, "LB0", false), "WriteBool");
  280. ShowNotify($"写入搅拌停止成功。");
  281. });
  282. WriteHeatParamCommand2 = new(async () =>
  283. {
  284. //if (!GetDeviceIsIdle(EDeviceType.炒锅2))
  285. //{
  286. // return;
  287. //}
  288. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  289. {
  290. return;
  291. }
  292. ActionManage.GetInstance.Send(new WriteModel<ushort>(EDeviceType.炒锅2, "LW0", HeatGear), "WriteUshort");
  293. await SendWriteRequest("LB9", EDeviceType.炒锅2);
  294. ShowNotify($"写入加热参数成功。");
  295. });
  296. StartHeatCommand2 = new(() =>
  297. {
  298. if (!GetDeviceIsIdle(EDeviceType.炒锅2))
  299. {
  300. return;
  301. }
  302. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  303. {
  304. return;
  305. }
  306. ActionManage.GetInstance.Send(new WriteModel<bool>(EDeviceType.炒锅2, "LB3", true), "WriteBool");
  307. ShowNotify($"写入加热启动成功。");
  308. });
  309. StopHeatCommand2 = new(() =>
  310. {
  311. //if (!GetDeviceIsIdle(EDeviceType.炒锅2))
  312. //{
  313. // return;
  314. //}
  315. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  316. {
  317. return;
  318. }
  319. ActionManage.GetInstance.Send(new WriteModel<bool>(EDeviceType.炒锅2, "LB3", false), "WriteBool");
  320. ShowNotify($"写入加热停止成功。");
  321. });
  322. ChannelCuttingCommand2 = new(async () =>
  323. {
  324. //var channelIndex = ChannelSelect;
  325. //var weight = Convert.ToUInt16(Weight);
  326. //byte[] LWOffset = new byte[3] { 3, 4, 5 };
  327. //byte[] LBOffset = new byte[3] { 6, 7, 8 };
  328. //ActionManage.GetInstance.Send("WriteUshort", new WriteModel<ushort>(EDeviceType.炒锅2, $"LW{LWOffset[channelIndex]}", weight));
  329. //await SendWriteRequest($"LB{LBOffset[channelIndex]}");
  330. if (!GetDeviceIsIdle(EDeviceType.炒锅2))
  331. {
  332. return;
  333. }
  334. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  335. {
  336. return;
  337. }
  338. object[] para = new object[3];
  339. para[0] = EDeviceType.炒锅2;
  340. para[1] = ChannelSelect + 1;
  341. para[2] = Convert.ToUInt16(Weight);
  342. await Task.Run(() => ActionManage.GetInstance.Send(para, "DeviceCuttingControl"));
  343. ShowNotify($"写入通道下料控制成功。");
  344. });
  345. GoFryLocCommand2 = new(async () =>
  346. {
  347. if (!GetDeviceIsIdle(EDeviceType.炒锅2))
  348. {
  349. return;
  350. }
  351. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  352. {
  353. return;
  354. }
  355. var loc = StirFryLocSelect + 17;
  356. await SendWriteRequest($"LB{loc}", EDeviceType.炒锅2);
  357. ShowNotify($"写入去炒制位成功。");
  358. });
  359. GoHomeCommand2 = new(async () =>
  360. {
  361. if (!GetDeviceIsIdle(EDeviceType.炒锅2))
  362. {
  363. return;
  364. }
  365. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  366. {
  367. return;
  368. }
  369. await SendWriteRequest("LB12", EDeviceType.炒锅2);
  370. ShowNotify($"写入回原点成功。");
  371. });
  372. GoSeasoningFeddLocCommand2 = new(async () =>
  373. {
  374. if (!GetDeviceIsIdle(EDeviceType.炒锅2))
  375. {
  376. return;
  377. }
  378. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  379. {
  380. return;
  381. }
  382. await SendWriteRequest("LB16", EDeviceType.炒锅2);
  383. ShowNotify($"写入去调料投料位成功。");
  384. });
  385. OutDiningStartCommand2 = new(async () =>
  386. {
  387. if (!GetDeviceIsIdle(EDeviceType.炒锅2))
  388. {
  389. return;
  390. }
  391. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  392. {
  393. return;
  394. }
  395. await SendWriteRequest("LB13", EDeviceType.炒锅2);
  396. ShowNotify($"写入出餐启动成功。");
  397. });
  398. FryPanCleanCommand2 = new(async () =>
  399. {
  400. if (!GetDeviceIsIdle(EDeviceType.炒锅2))
  401. {
  402. return;
  403. }
  404. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  405. {
  406. return;
  407. }
  408. await SendWriteRequest("LB14", EDeviceType.炒锅2);
  409. ShowNotify($"写入炒锅清洗成功。");
  410. });
  411. SetAutoModeCommand2 = new(() =>
  412. {
  413. ActionManage.GetInstance.Send(new WriteModel<bool>(EDeviceType.炒锅2, "LB20", true), "WriteBool");
  414. ShowNotify($"设置设备自动模式成功。");
  415. });
  416. SetManualModeCommand2 = new(() =>
  417. {
  418. if (!GetDeviceIsIdle(EDeviceType.炒锅2))
  419. {
  420. return;
  421. }
  422. ActionManage.GetInstance.Send(new WriteModel<bool>(EDeviceType.炒锅2, "LB20", false), "WriteBool");
  423. ShowNotify($"设置设备手动模式成功。");
  424. });
  425. InitalDeviceCommand2 = new(async () =>
  426. {
  427. if (!GetDeviceIsIdle(EDeviceType.炒锅2))
  428. {
  429. return;
  430. }
  431. //复位所有变量。
  432. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  433. {
  434. return;
  435. }
  436. ResetFryPanVariable(EDeviceType.炒锅2);
  437. await SendWriteRequest("LB21", EDeviceType.炒锅2);
  438. ShowNotify($"设置设备初始化成功。");
  439. });
  440. StopDeviceCommand2 = new(async () =>
  441. {
  442. //if (!GetDeviceIsIdle(EDeviceType.炒锅2))
  443. //{
  444. // return;
  445. //}
  446. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  447. {
  448. return;
  449. }
  450. await SendWriteRequest("LB22", EDeviceType.炒锅2);
  451. ShowNotify($"设置设备停止成功。");
  452. });
  453. //炒锅那边复位变量没有使用。
  454. GoCleanLocCommand2 = new(async () =>
  455. {
  456. if (!GetDeviceIsIdle(EDeviceType.炒锅2))
  457. {
  458. return;
  459. }
  460. if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
  461. {
  462. return;
  463. }
  464. await SendWriteRequest("LB23", EDeviceType.炒锅2);
  465. ShowNotify($"设置设备去洗锅位成功。");
  466. });
  467. #endregion
  468. CancelFryPanTaskCommand = new((string device) =>
  469. {
  470. ActionManage.GetInstance.Send("CancelFryPanTask", device);
  471. ShowNotify($"[{device}#]取消当前任务成功");
  472. });
  473. ClearFryPanTaskCommand_1 = new(() =>
  474. {
  475. });
  476. ClearFryPanTaskCommand_2 = new(() =>
  477. {
  478. });
  479. InitRobotVarCommand = new(() =>
  480. {
  481. Task.Run(() =>
  482. {
  483. ActionManage.GetInstance.Send("InitRobotAllVar");
  484. });
  485. });
  486. RobotGoCleanLocCommand = new(() =>
  487. {
  488. if (!MessageNotify.GetInstance.ShowDialog("确认是否将机械手移动到清洗位?"))
  489. {
  490. return;
  491. }
  492. ActionManage.GetInstance.Send("RobotGoCleanLoc");
  493. });
  494. CleanFinishCommand = new(() =>
  495. {
  496. if (!MessageNotify.GetInstance.ShowDialog("请确认机械手清洗完成且机器人周围安全,否则可能会造成碰撞事故。"))
  497. {
  498. return;
  499. }
  500. ActionManage.GetInstance.Send("RobotCleanFinish");
  501. });
  502. }
  503. #region 私有方法
  504. private async Task SendWriteRequest(string address, EDeviceType device)
  505. {
  506. ActionManage.GetInstance.Send(new WriteModel<bool>(device, address, false), "WriteBool");
  507. await Task.Delay(400);
  508. ActionManage.GetInstance.Send(new WriteModel<bool>(device, address, true), "WriteBool");
  509. await Task.Delay(400);
  510. ActionManage.GetInstance.Send(new WriteModel<bool>(device, address, false), "WriteBool");
  511. }
  512. private void ShowNotify(string info)
  513. {
  514. NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, Application.Current.MainWindow, "提示", info);
  515. }
  516. private bool GetDeviceIsIdle(EDeviceType device)
  517. {
  518. bool frypanisIdle = false;
  519. ActionManage.GetInstance.Send(device, "GetDeviceIsIdle").OnSuccess(S =>
  520. {
  521. frypanisIdle = true;
  522. }).OnFailure(E =>
  523. {
  524. NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "失败", "当前炒锅正在炒菜,稍后再试。");
  525. });
  526. //if (ActionManage.GetInstance.SendResult("GetDeviceIsIdle", device) is bool frypanisIdle)
  527. //{
  528. // if (frypanisIdle)
  529. // {
  530. // return true;
  531. // }
  532. // else
  533. // {
  534. // NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "失败", "当前炒锅正在炒菜,稍后再试。");
  535. // }
  536. //}
  537. return frypanisIdle;
  538. }
  539. /// <summary>
  540. /// 复位指定炒锅的所有变量。
  541. /// </summary>
  542. /// <param name="deviceType"></param>
  543. private void ResetFryPanVariable(EDeviceType deviceType)
  544. {
  545. ActionManage.GetInstance.Send(new WriteModel<bool>(deviceType, "LB0", false), "WriteBool");
  546. ActionManage.GetInstance.Send(new WriteModel<bool>(deviceType, "LB3", false), "WriteBool");
  547. for (int i = 6; i <= 19; i++)
  548. {
  549. ActionManage.GetInstance.Send(new WriteModel<bool>(deviceType, "LB" + i, false), "WriteBool");
  550. }
  551. for (int i = 0; i <= 5; i++)
  552. {
  553. ActionManage.GetInstance.Send(new WriteModel<ushort>(deviceType, "LW" + i, 0), "WriteUshort");
  554. }
  555. }
  556. #endregion 私有方法
  557. private EDeviceType fryingPanSelect = EDeviceType.炒锅1;
  558. /// <summary>炒锅选择。</summary>
  559. public EDeviceType FryingPanSelect
  560. {
  561. get { return fryingPanSelect; }
  562. set { fryingPanSelect = value; OnPropertyChanged(); }
  563. }
  564. public ObservableCollection<EDeviceType> DeviceTypes { get; set; } = new ObservableCollection<EDeviceType>() { EDeviceType.炒锅1, EDeviceType.炒锅2 };
  565. #region 属性_1#炒锅
  566. /// <summary>搅拌频率</summary>
  567. public ushort AgitaFrequency
  568. {
  569. get => agitaFrequency; set
  570. {
  571. if (value >= 50)
  572. agitaFrequency = 50;
  573. else if (value <= 1)
  574. agitaFrequency = 1;
  575. else
  576. agitaFrequency = value;
  577. OnPropertyChanged();
  578. }
  579. }
  580. /// <summary>加热档位</summary>
  581. public ushort HeatGear
  582. {
  583. get => heatGear; set
  584. {
  585. if (value >= 8)
  586. heatGear = 8;
  587. else if (value <= 1)
  588. heatGear = 1;
  589. else
  590. heatGear = value;
  591. OnPropertyChanged();
  592. }
  593. }
  594. private float weight;
  595. /// <summary>下料重量</summary>
  596. public float Weight
  597. {
  598. get { return weight; }
  599. set { weight = value; }
  600. }
  601. private int channelSelect;
  602. /// <summary>下料通道选择。</summary>
  603. public int ChannelSelect
  604. {
  605. get { return channelSelect; }
  606. set { channelSelect = value; OnPropertyChanged(); }
  607. }
  608. private int stirFryLocSelect;
  609. /// <summary>炒制位选择。</summary>
  610. public int StirFryLocSelect
  611. {
  612. get { return stirFryLocSelect; }
  613. set { stirFryLocSelect = value; OnPropertyChanged(); }
  614. }
  615. #endregion 属性
  616. #region 属性_2#炒锅
  617. private ushort heatGear2;
  618. private ushort agitaFrequency2;
  619. /// <summary>搅拌频率</summary>
  620. public ushort AgitaFrequency2
  621. {
  622. get => agitaFrequency2; set
  623. {
  624. if (value >= 50)
  625. agitaFrequency2 = 50;
  626. else if (value <= 1)
  627. agitaFrequency2 = 1;
  628. else
  629. agitaFrequency2 = value;
  630. OnPropertyChanged();
  631. }
  632. }
  633. /// <summary>加热档位</summary>
  634. public ushort HeatGear2
  635. {
  636. get => heatGear2; set
  637. {
  638. if (value >= 8)
  639. heatGear2 = 8;
  640. else if (value <= 1)
  641. heatGear2 = 1;
  642. else
  643. heatGear2 = value;
  644. OnPropertyChanged();
  645. }
  646. }
  647. private float weight2;
  648. /// <summary>下料重量</summary>
  649. public float Weight2
  650. {
  651. get { return weight2; }
  652. set { weight2 = value; }
  653. }
  654. private int channelSelect2;
  655. /// <summary>下料通道选择。</summary>
  656. public int ChannelSelect2
  657. {
  658. get { return channelSelect2; }
  659. set { channelSelect2 = value; OnPropertyChanged(); }
  660. }
  661. private int stirFryLocSelect2;
  662. /// <summary>炒制位选择。</summary>
  663. public int StirFryLocSelect2
  664. {
  665. get { return stirFryLocSelect2; }
  666. set { stirFryLocSelect2 = value; OnPropertyChanged(); }
  667. }
  668. #endregion
  669. #region 命令
  670. /// <summary>
  671. /// 取消指定炒锅当前任务。
  672. /// </summary>
  673. public BPARelayCommand<string> CancelFryPanTaskCommand { get; set; }
  674. /// <summary>
  675. /// 清空1#炒锅所有任务。
  676. /// </summary>
  677. public BPARelayCommand ClearFryPanTaskCommand_1 { get; set; }
  678. /// <summary>
  679. /// 清空2#炒锅所有任务。
  680. /// </summary>
  681. public BPARelayCommand ClearFryPanTaskCommand_2 { get; set; }
  682. /// <summary>
  683. /// 复位机器人所有由上位机下发的变量。
  684. /// </summary>
  685. public BPARelayCommand InitRobotVarCommand { get; set; }
  686. public BPARelayCommand RobotGoCleanLocCommand { get; set; }
  687. public BPARelayCommand CleanFinishCommand { get; set; }
  688. #endregion
  689. #region 命令_1#炒锅
  690. /// <summary>写入搅拌参数。</summary>
  691. public BPARelayCommand WriteAgitaParamCommand { get; set; }
  692. /// <summary>开始搅拌。</summary>
  693. public BPARelayCommand StartAgitateCommand { get; set; }
  694. /// <summary>停止搅拌。</summary>
  695. public BPARelayCommand StopAgitateCommand { get; set; }
  696. /// <summary>写入加热参数。</summary>
  697. public BPARelayCommand WriteHeatParamCommand { get; set; }
  698. /// <summary>开始加热。</summary>
  699. public BPARelayCommand StartHeatCommand { get; set; }
  700. /// <summary>停止加热。</summary>
  701. public BPARelayCommand StopHeatCommand { get; set; }
  702. /// <summary>通道下料启动。</summary>
  703. public BPARelayCommand ChannelCuttingCommand { get; set; }
  704. /// <summary>去炒制位。</summary>
  705. public BPARelayCommand GoFryLocCommand { get; set; }
  706. /// <summary>回原点/投料位置。</summary>
  707. public BPARelayCommand GoHomeCommand { get; set; }
  708. /// <summary>去调料投料位。</summary>
  709. public BPARelayCommand GoSeasoningFeddLocCommand { get; set; }
  710. /// <summary>出餐启动。</summary>
  711. public BPARelayCommand OutDiningStartCommand { get; set; }
  712. /// <summary>炒锅清洗。</summary>
  713. public BPARelayCommand FryPanCleanCommand { get; set; }
  714. /// <summary>
  715. /// 设为自动模式。
  716. /// </summary>
  717. public BPARelayCommand SetAutoModeCommand { get; set; }
  718. /// <summary>
  719. /// 设为手动模式。
  720. /// </summary>
  721. public BPARelayCommand SetManualModeCommand { get; set; }
  722. /// <summary>
  723. /// 初始化设备。
  724. /// </summary>
  725. public BPARelayCommand InitalDeviceCommand { get; set; }
  726. /// <summary>
  727. /// 设备停止。
  728. /// </summary>
  729. public BPARelayCommand StopDeviceCommand { get; set; }
  730. /// <summary>
  731. /// 设备去洗锅位置。
  732. /// </summary>
  733. public BPARelayCommand GoCleanLocCommand { get; set; }
  734. #endregion 命令
  735. #region 命令_2#炒锅
  736. /// <summary>写入搅拌参数。</summary>
  737. public BPARelayCommand WriteAgitaParamCommand2 { get; set; }
  738. /// <summary>开始搅拌。</summary>
  739. public BPARelayCommand StartAgitateCommand2 { get; set; }
  740. /// <summary>停止搅拌。</summary>
  741. public BPARelayCommand StopAgitateCommand2 { get; set; }
  742. /// <summary>写入加热参数。</summary>
  743. public BPARelayCommand WriteHeatParamCommand2 { get; set; }
  744. /// <summary>开始加热。</summary>
  745. public BPARelayCommand StartHeatCommand2 { get; set; }
  746. /// <summary>停止加热。</summary>
  747. public BPARelayCommand StopHeatCommand2 { get; set; }
  748. /// <summary>通道下料启动。</summary>
  749. public BPARelayCommand ChannelCuttingCommand2 { get; set; }
  750. /// <summary>去炒制位。</summary>
  751. public BPARelayCommand GoFryLocCommand2 { get; set; }
  752. /// <summary>回原点/投料位置。</summary>
  753. public BPARelayCommand GoHomeCommand2 { get; set; }
  754. /// <summary>去调料投料位。</summary>
  755. public BPARelayCommand GoSeasoningFeddLocCommand2 { get; set; }
  756. /// <summary>出餐启动。</summary>
  757. public BPARelayCommand OutDiningStartCommand2 { get; set; }
  758. /// <summary>炒锅清洗。</summary>
  759. public BPARelayCommand FryPanCleanCommand2 { get; set; }
  760. /// <summary>
  761. /// 设为自动模式。
  762. /// </summary>
  763. public BPARelayCommand SetAutoModeCommand2 { get; set; }
  764. /// <summary>
  765. /// 设为手动模式。
  766. /// </summary>
  767. public BPARelayCommand SetManualModeCommand2 { get; set; }
  768. /// <summary>
  769. /// 初始化设备。
  770. /// </summary>
  771. public BPARelayCommand InitalDeviceCommand2 { get; set; }
  772. /// <summary>
  773. /// 设备停止。
  774. /// </summary>
  775. public BPARelayCommand StopDeviceCommand2 { get; set; }
  776. /// <summary>
  777. /// 设备去洗锅位置。
  778. /// </summary>
  779. public BPARelayCommand GoCleanLocCommand2 { get; set; }
  780. #endregion 命令
  781. }
  782. }