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

562 lines
20 KiB

  1. using BPASmartClient.AGV;
  2. using BPA.Helper;
  3. using FryPot_DosingSystem.Control;
  4. using FryPot_DosingSystem.ViewModel;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading;
  10. using System.Threading.Tasks;
  11. using System.Windows;
  12. using System.Windows.Controls;
  13. using System.Windows.Data;
  14. using System.Windows.Documents;
  15. using System.Windows.Input;
  16. using System.Windows.Media;
  17. using System.Windows.Media.Imaging;
  18. using System.Windows.Navigation;
  19. using System.Windows.Shapes;
  20. namespace FryPot_DosingSystem.View
  21. {
  22. /// <summary>
  23. /// DebugView.xaml 的交互逻辑
  24. /// </summary>
  25. public partial class DebugView : UserControl
  26. {
  27. public DebugView()
  28. {
  29. InitializeComponent();
  30. }
  31. string taskId = string.Empty;
  32. private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
  33. {
  34. if (sender is ComboBox cbo)
  35. {
  36. if (cbo.SelectedValue != null)
  37. {
  38. ActionManage.GetInstance.Send("EightWorkLoc",cbo.SelectedValue);
  39. }
  40. }
  41. }
  42. private void ComboBox_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
  43. {
  44. if (sender is ComboBox cbo)
  45. {
  46. if (cbo.SelectedValue != null)
  47. {
  48. ActionManage.GetInstance.Send("TwoEightWorkLoc", cbo.SelectedValue);
  49. }
  50. }
  51. }
  52. private void ComboBox_SelectionChanged_2(object sender, SelectionChangedEventArgs e)
  53. {
  54. if (sender is ComboBox cbo)
  55. {
  56. if (cbo.SelectedValue != null)
  57. {
  58. ActionManage.GetInstance.Send("ThreeEightWorkLoc", cbo.SelectedValue);
  59. }
  60. }
  61. }
  62. private void Button_Click(object sender, RoutedEventArgs e)
  63. {
  64. DeviceOperate.GetInstance.WritePlcData("D1060", 0);
  65. // AGVHelper.GetInstance.AgvFromLineOneToFryFourLoadRoller(Guid.NewGuid().ToString("D"));
  66. }
  67. private void Button_Click_1(object sender, RoutedEventArgs e)
  68. {
  69. AGVHelper.GetInstance.AgvToLineTwoLoadRoller(Guid.NewGuid().ToString("D"));
  70. }
  71. private void Button_Click_2(object sender, RoutedEventArgs e)
  72. {
  73. AGVHelper.GetInstance.AgvFromLineTwoToFryFiveLoadRoller(Guid.NewGuid().ToString("D"));
  74. }
  75. private void Button_Click_3(object sender, RoutedEventArgs e)
  76. {
  77. AGVHelper.GetInstance.AgvToLineThreeLoadRoller(Guid.NewGuid().ToString("D"));
  78. }
  79. private void Button_Click_4(object sender, RoutedEventArgs e)
  80. {
  81. AGVHelper.GetInstance.AgvLeaveFryPotOne(Guid.NewGuid().ToString("D"));
  82. }
  83. private void Button_Click_5(object sender, RoutedEventArgs e)
  84. {
  85. AGVHelper.GetInstance.AgvLeaveFryPotTwo(Guid.NewGuid().ToString("D"));
  86. }
  87. private void Button_Click_6(object sender, RoutedEventArgs e)
  88. {
  89. AGVHelper.GetInstance.AgvLeaveFryPotThree(Guid.NewGuid().ToString("D"));
  90. }
  91. private void Button_Click_7(object sender, RoutedEventArgs e)
  92. {
  93. AGVHelper.GetInstance.AgvLeaveFryPotFour(Guid.NewGuid().ToString("D"));
  94. }
  95. private void Button_Click_8(object sender, RoutedEventArgs e)
  96. {
  97. AGVHelper.GetInstance.AgvLeaveFryPotFive(Guid.NewGuid().ToString("D"));
  98. }
  99. private void Button_Click_9(object sender, RoutedEventArgs e)
  100. {
  101. AGVHelper.GetInstance.AgvLeaveLOneToClean(Guid.NewGuid().ToString("D"));
  102. }
  103. private void Button_Click_10(object sender, RoutedEventArgs e)
  104. {
  105. AGVHelper.GetInstance.AgvLeaveLTwoToClean(Guid.NewGuid().ToString("D"));
  106. }
  107. private void Button_Click_11(object sender, RoutedEventArgs e)
  108. {
  109. AGVHelper.GetInstance.AgvLeaveLThreeToClean(Guid.NewGuid().ToString("D"));
  110. }
  111. private void Button_Click_12(object sender, RoutedEventArgs e)
  112. {
  113. AGVHelper.GetInstance.AgvFromCleanToLineFourUnLoadRoller(Guid.NewGuid().ToString("D"));
  114. }
  115. /// <summary>
  116. /// 回桶线信号复位
  117. /// </summary>
  118. /// <param name="sender"></param>
  119. /// <param name="e"></param>
  120. private void Button_Click_13(object sender, RoutedEventArgs e)
  121. {
  122. DeviceOperate.GetInstance.WritePlcData("D1067",0);
  123. }
  124. /// <summary>
  125. /// 空桶洗桶信号复位
  126. /// </summary>
  127. /// <param name="sender"></param>
  128. /// <param name="e"></param>
  129. private void Button_Click_14(object sender, RoutedEventArgs e)
  130. {
  131. DeviceOperate.GetInstance.WritePlcData("D1065", 0);
  132. }
  133. /// <summary>
  134. /// 线体1AGV进料复位
  135. /// </summary>
  136. /// <param name="sender"></param>
  137. /// <param name="e"></param>
  138. private void Button_Click_15(object sender, RoutedEventArgs e)
  139. {
  140. DeviceOperate.GetInstance.WritePlcData("D1052", 0);
  141. }
  142. /// <summary>
  143. /// 线体2AGV进料复位
  144. /// </summary>
  145. /// <param name="sender"></param>
  146. /// <param name="e"></param>
  147. private void Button_Click_16(object sender, RoutedEventArgs e)
  148. {
  149. DeviceOperate.GetInstance.WritePlcData("D1053", 0);
  150. }
  151. /// <summary>
  152. /// 线体3AGV进料复位
  153. /// </summary>
  154. /// <param name="sender"></param>
  155. /// <param name="e"></param>
  156. private void Button_Click_17(object sender, RoutedEventArgs e)
  157. {
  158. DeviceOperate.GetInstance.WritePlcData("D1054", 0);
  159. }
  160. /// <summary>
  161. /// 炒锅1进桶复位
  162. /// </summary>
  163. /// <param name="sender"></param>
  164. /// <param name="e"></param>
  165. private void Button_Click_18(object sender, RoutedEventArgs e)
  166. {
  167. DeviceOperate.GetInstance.WritePlcData("D1055", 0);
  168. }
  169. /// <summary>
  170. /// 炒锅2进桶复位
  171. /// </summary>
  172. /// <param name="sender"></param>
  173. /// <param name="e"></param>
  174. private void Button_Click_19(object sender, RoutedEventArgs e)
  175. {
  176. DeviceOperate.GetInstance.WritePlcData("D1056", 0);
  177. }
  178. /// <summary>
  179. /// 炒锅3进桶复位
  180. /// </summary>
  181. /// <param name="sender"></param>
  182. /// <param name="e"></param>
  183. private void Button_Click_20(object sender, RoutedEventArgs e)
  184. {
  185. DeviceOperate.GetInstance.WritePlcData("D1057", 0);
  186. }
  187. /// <summary>
  188. /// 炒锅4进桶复位
  189. /// </summary>
  190. /// <param name="sender"></param>
  191. /// <param name="e"></param>
  192. private void Button_Click_21(object sender, RoutedEventArgs e)
  193. {
  194. DeviceOperate.GetInstance.WritePlcData("D1058", 0);
  195. }
  196. /// <summary>
  197. /// 炒锅5进桶复位
  198. /// </summary>
  199. /// <param name="sender"></param>
  200. /// <param name="e"></param>
  201. private void Button_Click_22(object sender, RoutedEventArgs e)
  202. {
  203. DeviceOperate.GetInstance.WritePlcData("D1059", 0);
  204. }
  205. /// <summary>
  206. /// 炒锅1出桶复位
  207. /// </summary>
  208. /// <param name="sender"></param>
  209. /// <param name="e"></param>
  210. private void Button_Click_23(object sender, RoutedEventArgs e)
  211. {
  212. DeviceOperate.GetInstance.WritePlcData("D1060", 0);
  213. }
  214. /// <summary>
  215. /// 炒锅2出桶复位
  216. /// </summary>
  217. /// <param name="sender"></param>
  218. /// <param name="e"></param>
  219. private void Button_Click_24(object sender, RoutedEventArgs e)
  220. {
  221. DeviceOperate.GetInstance.WritePlcData("D1061", 0);
  222. }
  223. /// <summary>
  224. /// 炒锅3出桶复位
  225. /// </summary>
  226. /// <param name="sender"></param>
  227. /// <param name="e"></param>
  228. private void Button_Click_25(object sender, RoutedEventArgs e)
  229. {
  230. DeviceOperate.GetInstance.WritePlcData("D1062", 0);
  231. }
  232. /// <summary>
  233. /// 炒锅4出桶复位
  234. /// </summary>
  235. /// <param name="sender"></param>
  236. /// <param name="e"></param>
  237. private void Button_Click_26(object sender, RoutedEventArgs e)
  238. {
  239. DeviceOperate.GetInstance.WritePlcData("D1063", 0);
  240. }
  241. /// <summary>
  242. /// 炒锅5出桶复位
  243. /// </summary>
  244. /// <param name="sender"></param>
  245. /// <param name="e"></param>
  246. private void Button_Click_27(object sender, RoutedEventArgs e)
  247. {
  248. DeviceOperate.GetInstance.WritePlcData("D1064", 0);
  249. }
  250. /// <summary>
  251. /// 洗桶机出桶复位
  252. /// </summary>
  253. /// <param name="sender"></param>
  254. /// <param name="e"></param>
  255. private void Button_Click_28(object sender, RoutedEventArgs e)
  256. {
  257. DeviceOperate.GetInstance.WritePlcData("D1066", 0);
  258. }
  259. /// <summary>
  260. /// 炒锅1空桶AGV到位信号
  261. /// </summary>
  262. /// <param name="sender"></param>
  263. /// <param name="e"></param>
  264. private void Button_Click_29(object sender, RoutedEventArgs e)
  265. {
  266. DeviceOperate.GetInstance.WritePlcData("D1060", 1);
  267. }
  268. /// <summary>
  269. /// 炒锅2空桶AGV到位信号
  270. /// </summary>
  271. /// <param name="sender"></param>
  272. /// <param name="e"></param>
  273. private void Button_Click_30(object sender, RoutedEventArgs e)
  274. {
  275. DeviceOperate.GetInstance.WritePlcData("D1061", 1);
  276. }
  277. /// <summary>
  278. /// 炒锅3空桶AGV到位信号
  279. /// </summary>
  280. /// <param name="sender"></param>
  281. /// <param name="e"></param>
  282. private void Button_Click_31(object sender, RoutedEventArgs e)
  283. {
  284. DeviceOperate.GetInstance.WritePlcData("D1062", 1);
  285. }
  286. /// <summary>
  287. /// 炒锅4空桶AGV到位信号
  288. /// </summary>
  289. /// <param name="sender"></param>
  290. /// <param name="e"></param>
  291. private void Button_Click_32(object sender, RoutedEventArgs e)
  292. {
  293. DeviceOperate.GetInstance.WritePlcData("D1063", 1);
  294. }
  295. /// <summary>
  296. /// 炒锅5空桶AGV到位信号
  297. /// </summary>
  298. /// <param name="sender"></param>
  299. /// <param name="e"></param>
  300. private void Button_Click_33(object sender, RoutedEventArgs e)
  301. {
  302. DeviceOperate.GetInstance.WritePlcData("D1064", 1);
  303. }
  304. /// <summary>
  305. /// 线体1AGV到位信号
  306. /// </summary>
  307. /// <param name="sender"></param>
  308. /// <param name="e"></param>
  309. private void Button_Click_34(object sender, RoutedEventArgs e)
  310. {
  311. DeviceOperate.GetInstance.WritePlcData("D1052", 1);
  312. }
  313. /// <summary>
  314. /// 线体2AGV到位信号
  315. /// </summary>
  316. /// <param name="sender"></param>
  317. /// <param name="e"></param>
  318. private void Button_Click_35(object sender, RoutedEventArgs e)
  319. {
  320. DeviceOperate.GetInstance.WritePlcData("D1053", 1);
  321. }
  322. /// <summary>
  323. /// 线体3AGV到位信号
  324. /// </summary>
  325. /// <param name="sender"></param>
  326. /// <param name="e"></param>
  327. private void Button_Click_36(object sender, RoutedEventArgs e)
  328. {
  329. DeviceOperate.GetInstance.WritePlcData("D1054", 1);
  330. }
  331. /// <summary>
  332. /// 洗桶机出桶g
  333. /// </summary>
  334. /// <param name="sender"></param>
  335. /// <param name="e"></param>
  336. private void Button_Click_37(object sender, RoutedEventArgs e)
  337. {
  338. DeviceOperate.GetInstance.WritePlcData("D1066", 1);
  339. }
  340. /// <summary>
  341. /// 炒锅1进桶信号
  342. /// </summary>
  343. /// <param name="sender"></param>
  344. /// <param name="e"></param>
  345. private void Button_Click_38(object sender, RoutedEventArgs e)
  346. {
  347. DeviceOperate.GetInstance.WritePlcData("D1055", 1);
  348. }
  349. /// <summary>
  350. /// 炒锅2进桶信号
  351. /// </summary>
  352. /// <param name="sender"></param>
  353. /// <param name="e"></param>
  354. private void Button_Click_39(object sender, RoutedEventArgs e)
  355. {
  356. DeviceOperate.GetInstance.WritePlcData("D1056", 1);
  357. }
  358. /// <summary>
  359. /// 炒锅3进桶信号
  360. /// </summary>
  361. /// <param name="sender"></param>
  362. /// <param name="e"></param>
  363. private void Button_Click_40(object sender, RoutedEventArgs e)
  364. {
  365. DeviceOperate.GetInstance.WritePlcData("D1057", 1);
  366. }
  367. /// <summary>
  368. /// 炒锅4进桶信号
  369. /// </summary>
  370. /// <param name="sender"></param>
  371. /// <param name="e"></param>
  372. private void Button_Click_41(object sender, RoutedEventArgs e)
  373. {
  374. DeviceOperate.GetInstance.WritePlcData("D1058", 1);
  375. }
  376. /// <summary>
  377. /// 炒锅5进桶信号
  378. /// </summary>
  379. /// <param name="sender"></param>
  380. /// <param name="e"></param>
  381. private void Button_Click_42(object sender, RoutedEventArgs e)
  382. {
  383. DeviceOperate.GetInstance.WritePlcData("D1059", 1);
  384. }
  385. /// <summary>
  386. /// 洗桶机进桶信号
  387. /// </summary>
  388. /// <param name="sender"></param>
  389. /// <param name="e"></param>
  390. private void Button_Click_43(object sender, RoutedEventArgs e)
  391. {
  392. DeviceOperate.GetInstance.WritePlcData("D1065", 1);
  393. }
  394. /// <summary>
  395. /// 回桶线进桶信号
  396. /// </summary>
  397. /// <param name="sender"></param>
  398. /// <param name="e"></param>
  399. private void Button_Click_44(object sender, RoutedEventArgs e)
  400. {
  401. DeviceOperate.GetInstance.WritePlcData("D1067", 1);
  402. }
  403. /// <summary>
  404. /// 炒锅1配方复位
  405. /// </summary>
  406. /// <param name="sender"></param>
  407. /// <param name="e"></param>
  408. private void Button_Click_45(object sender, RoutedEventArgs e)
  409. {
  410. DeviceOperate.GetInstance.WritePotOnePlcData("D2999",1);
  411. Task.Run(new Action(() => { Thread.Sleep(2000); DeviceOperate.GetInstance.WritePotOnePlcData("D2999", 0); }));
  412. }
  413. /// <summary>
  414. /// 炒锅2配方复位
  415. /// </summary>
  416. /// <param name="sender"></param>
  417. /// <param name="e"></param>
  418. private void Button_Click_46(object sender, RoutedEventArgs e)
  419. {
  420. DeviceOperate.GetInstance.WritePotTwoPlcData("D2999", 1);
  421. Task.Run(new Action(() => { Thread.Sleep(2000); DeviceOperate.GetInstance.WritePotTwoPlcData("D2999", 0); }));
  422. }
  423. /// <summary>
  424. /// 炒锅3配方复位
  425. /// </summary>
  426. /// <param name="sender"></param>
  427. /// <param name="e"></param>
  428. private void Button_Click_47(object sender, RoutedEventArgs e)
  429. {
  430. DeviceOperate.GetInstance.WritePotThreePlcData("D2999", 1);
  431. Task.Run(new Action(() => { Thread.Sleep(2000); DeviceOperate.GetInstance.WritePotThreePlcData("D2999", 0); }));
  432. }
  433. /// <summary>
  434. /// 炒锅4配方复位
  435. /// </summary>
  436. /// <param name="sender"></param>
  437. /// <param name="e"></param>
  438. private void Button_Click_48(object sender, RoutedEventArgs e)
  439. {
  440. DeviceOperate.GetInstance.WritePotFourPlcData("D2999", 1);
  441. Task.Run(new Action(() => { Thread.Sleep(2000); DeviceOperate.GetInstance.WritePotFourPlcData("D2999", 0); }));
  442. }
  443. /// <summary>
  444. /// 炒锅5配方复位
  445. /// </summary>
  446. /// <param name="sender"></param>
  447. /// <param name="e"></param>
  448. private void Button_Click_49(object sender, RoutedEventArgs e)
  449. {
  450. DeviceOperate.GetInstance.WritePotFivePlcData("D2999", 1);
  451. Task.Run(new Action(() => { Thread.Sleep(2000); DeviceOperate.GetInstance.WritePotFivePlcData("D2999", 0); }));
  452. }
  453. /// <summary>
  454. /// 线体1总复位
  455. /// </summary>
  456. /// <param name="sender"></param>
  457. /// <param name="e"></param>
  458. private void Button_Click_50(object sender, RoutedEventArgs e)
  459. {
  460. ActionManage.GetInstance.Send("LineOneTaskExit");
  461. DeviceOperate.GetInstance.WritePlcData("D1052", 0);
  462. }
  463. /// <summary>
  464. /// 线体2总复位
  465. /// </summary>
  466. /// <param name="sender"></param>
  467. /// <param name="e"></param>
  468. private void Button_Click_51(object sender, RoutedEventArgs e)
  469. {
  470. ActionManage.GetInstance.Send("LineTwoTaskExit");
  471. DeviceOperate.GetInstance.WritePlcData("D1053", 0);
  472. }
  473. /// <summary>
  474. /// 线体3总复位
  475. /// </summary>
  476. /// <param name="sender"></param>
  477. /// <param name="e"></param>
  478. private void Button_Click_52(object sender, RoutedEventArgs e)
  479. {
  480. ActionManage.GetInstance.Send("LineThreeTaskExit");
  481. DeviceOperate.GetInstance.WritePlcData("D1054", 0);
  482. }
  483. /// <summary>
  484. /// 炒锅1信号总复位
  485. /// </summary>
  486. /// <param name="sender"></param>
  487. /// <param name="e"></param>
  488. private void Button_Click_53(object sender, RoutedEventArgs e)
  489. {
  490. DeviceOperate.GetInstance.WritePlcData("D1055", 0);
  491. DeviceOperate.GetInstance.WritePlcData("D1060", 0);
  492. DeviceOperate.GetInstance.WritePotOnePlcData("D2999", 1);
  493. Task.Run(new Action(() => { Thread.Sleep(2000); DeviceOperate.GetInstance.WritePotOnePlcData("D2999", 0); }));
  494. }
  495. /// <summary>
  496. /// 炒锅2信号总复位
  497. /// </summary>
  498. /// <param name="sender"></param>
  499. /// <param name="e"></param>
  500. private void Button_Click_54(object sender, RoutedEventArgs e)
  501. {
  502. DeviceOperate.GetInstance.WritePlcData("D1056", 0);
  503. DeviceOperate.GetInstance.WritePlcData("D1061", 0);
  504. DeviceOperate.GetInstance.WritePotTwoPlcData("D2999", 1);
  505. Task.Run(new Action(() => { Thread.Sleep(2000); DeviceOperate.GetInstance.WritePotTwoPlcData("D2999", 0); }));
  506. }
  507. /// <summary>
  508. /// 炒锅3信号总复位
  509. /// </summary>
  510. /// <param name="sender"></param>
  511. /// <param name="e"></param>
  512. private void Button_Click_55(object sender, RoutedEventArgs e)
  513. {
  514. DeviceOperate.GetInstance.WritePlcData("D1057", 0);
  515. DeviceOperate.GetInstance.WritePlcData("D1062", 0);
  516. DeviceOperate.GetInstance.WritePotTwoPlcData("D2999", 1);
  517. Task.Run(new Action(() => { Thread.Sleep(2000); DeviceOperate.GetInstance.WritePotTwoPlcData("D2999", 0); }));
  518. }
  519. /// <summary>
  520. /// 炒锅4信号总复位
  521. /// </summary>
  522. /// <param name="sender"></param>
  523. /// <param name="e"></param>
  524. private void Button_Click_56(object sender, RoutedEventArgs e)
  525. {
  526. DeviceOperate.GetInstance.WritePlcData("D1058", 0);
  527. DeviceOperate.GetInstance.WritePlcData("D1063", 0);
  528. DeviceOperate.GetInstance.WritePotTwoPlcData("D2999", 1);
  529. Task.Run(new Action(() => { Thread.Sleep(2000); DeviceOperate.GetInstance.WritePotTwoPlcData("D2999", 0); }));
  530. }
  531. /// <summary>
  532. /// 炒锅5信号总复位
  533. /// </summary>
  534. /// <param name="sender"></param>
  535. /// <param name="e"></param>
  536. private void Button_Click_57(object sender, RoutedEventArgs e)
  537. {
  538. DeviceOperate.GetInstance.WritePlcData("D1059", 0);
  539. DeviceOperate.GetInstance.WritePlcData("D1064", 0);
  540. DeviceOperate.GetInstance.WritePotTwoPlcData("D2999", 1);
  541. Task.Run(new Action(() => { Thread.Sleep(2000); DeviceOperate.GetInstance.WritePotTwoPlcData("D2999", 0); }));
  542. }
  543. }
  544. }