终端一体化运控平台
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

174 lignes
7.0 KiB

  1. using FryPot_DosingSystem.AGV;
  2. using FryPot_DosingSystem.ViewModel;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Animation;
  15. using System.Windows.Media.Imaging;
  16. using System.Windows.Navigation;
  17. using System.Windows.Shapes;
  18. namespace FryPot_DosingSystem.View
  19. {
  20. /// <summary>
  21. /// AgvView.xaml 的交互逻辑
  22. /// </summary>
  23. public partial class AgvView : UserControl
  24. {
  25. public AgvView()
  26. {
  27. InitializeComponent();
  28. this.DataContext = AgvViewModel.GetInstance();
  29. 控制命令.ItemsSource = AgvViewModel.GetInstance().GetCommand();
  30. }
  31. private void Button_Click(object sender, RoutedEventArgs e)
  32. {
  33. int id = 1;
  34. if (sender is Button)
  35. {
  36. byte[] data;
  37. bool istrue = false;
  38. Button button = sender as Button;
  39. if (button.Tag != null)
  40. {
  41. switch (button.Tag.ToString())
  42. {
  43. case "设置有车":
  44. try
  45. {
  46. id=int.Parse(tcz_text.Text.ToString());
  47. }
  48. catch (Exception ex)
  49. {
  50. MessageBox.Show("只能输入 1-5 的数字!");
  51. return;
  52. }
  53. AgvViewModel.GetInstance().Set停车桩(id, IsBool.Yes);
  54. break;
  55. case "设置无车":
  56. try
  57. {
  58. id = int.Parse(tcz_text.Text.ToString());
  59. }
  60. catch (Exception ex)
  61. {
  62. MessageBox.Show("只能输入 1-5 的数字!");
  63. return;
  64. }
  65. AgvViewModel.GetInstance().Set停车桩(id, IsBool.No);
  66. break;
  67. case "启动":
  68. try
  69. {
  70. id = int.Parse(liaotong_text.Text.ToString());
  71. }
  72. catch (Exception ex)
  73. {
  74. MessageBox.Show("只能输入 1-5 的数字!");
  75. return;
  76. }
  77. AgvViewModel.GetInstance().Set滚筒线状态(id, IsRun.Start);
  78. break;
  79. case "停止":
  80. try
  81. {
  82. id = int.Parse(liaotong_text.Text.ToString());
  83. }
  84. catch (Exception ex)
  85. {
  86. MessageBox.Show("只能输入 1-5 的数字!");
  87. return;
  88. }
  89. AgvViewModel.GetInstance().Set滚筒线状态(id, IsRun.Stop);
  90. break;
  91. case "设置物料":
  92. try
  93. {
  94. id = int.Parse(liaotongwuliao_text.Text.ToString());
  95. }
  96. catch (Exception ex)
  97. {
  98. MessageBox.Show("只能输入 1-8 的数字!");
  99. return;
  100. }
  101. AgvViewModel.GetInstance().Set滚筒线上数量(id, liaotongwuliaoshuliang_text.Text);
  102. break;
  103. case "小车停止":
  104. try
  105. {
  106. id = int.Parse(xiaoche_text.Text.ToString());
  107. }
  108. catch (Exception ex)
  109. {
  110. MessageBox.Show("只能输入 1-4 的数字!");
  111. return;
  112. }
  113. AgvViewModel.GetInstance().Set小车停止(id);
  114. break;
  115. case "运行小车":
  116. try
  117. {
  118. id = int.Parse(xiaoche_text.Text.ToString());
  119. }
  120. catch (Exception ex)
  121. {
  122. MessageBox.Show("只能输入 1-4 的数字!");
  123. return;
  124. }
  125. AgvViewModel.GetInstance().Set小车运动(id, AgvViewModel.GetInstance().GetCommandValue(控制命令.Text));
  126. break;
  127. case "有菜和碗":
  128. try
  129. {
  130. id = int.Parse(xiaochewuping_text.Text.ToString());
  131. }
  132. catch (Exception ex)
  133. {
  134. MessageBox.Show("只能输入 1-4 的数字!");
  135. return;
  136. }
  137. AgvViewModel.GetInstance().Set小车是否承载物品(id, IsBool.Yes);
  138. break;
  139. case "只有碗":
  140. try
  141. {
  142. id = int.Parse(xiaochewuping_text.Text.ToString());
  143. }
  144. catch (Exception ex)
  145. {
  146. MessageBox.Show("只能输入 1-4 的数字!");
  147. return;
  148. }
  149. AgvViewModel.GetInstance().Set小车是否承载物品(id, IsBool.OnllYes);
  150. break;
  151. case "无物品":
  152. try
  153. {
  154. id = int.Parse(xiaochewuping_text.Text.ToString());
  155. }
  156. catch (Exception ex)
  157. {
  158. MessageBox.Show("只能输入 1-4 的数字!");
  159. return;
  160. }
  161. AgvViewModel.GetInstance().Set小车是否承载物品(id, IsBool.No);
  162. break;
  163. }
  164. }
  165. }
  166. }
  167. }
  168. }