终端一体化运控平台
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

97 行
3.7 KiB

  1. using BPASmartClient.Business;
  2. using BPASmartClient.Device;
  3. using BPASmartClient.DRCoffee;
  4. using BPA.Helper;
  5. using BPASmartClient.LebaiRobot;
  6. using BPASmartClient.Model;
  7. using BPASmartClient.Model.乐白机器人;
  8. using BPASmartClient.Model.冰淇淋.Enum;
  9. using BPASmartClient.Model.单片机;
  10. using BPASmartClient.Model.单片机.Enum;
  11. using BPASmartClient.Model.咖啡机.Enum;
  12. using BPASmartClient.Model.奶茶味魔方;
  13. using BPASmartClient.Model.电夹爪;
  14. using BPA.Helper;
  15. using System;
  16. using System.Collections.Generic;
  17. using System.Collections.ObjectModel;
  18. using System.Linq;
  19. using System.Threading;
  20. namespace BPASmartClient.MorkT_BarCounter.ViewModel;
  21. public class DebugViewModel : NotifyBase
  22. {
  23. public DebugViewModel()
  24. {
  25. if (Json<SaveParModel>.Data.parData != null)
  26. {
  27. CH_Value = Json<SaveParModel>.Data.parData;
  28. }
  29. RobotControlCommand = new BPARelayCommand(() =>
  30. {
  31. new WriteJaka() { DeviceId = 126, TagName = "JaKaProgramName", Value = JakaRobotProgram }.Publish();
  32. });
  33. CoffeeControlCommand = new BPARelayCommand(() =>
  34. {
  35. new DRCoffee_MakeCoffeeEvent() { DeviceId = 126, DrinkCode = (DrCoffeeDrinksCode)(CoffeeKind) }.Publish();
  36. });
  37. MikeTeaCupControlCommand = new BPARelayCommand(() =>
  38. {
  39. new MilkTea_MakeMilkTeaEvent() { DeviceId = 126, TagName = "Start" }.Publish();
  40. });
  41. GripperControlCommand = new BPARelayCommand(() =>
  42. {
  43. string value = GripperProgam + "";
  44. if (value.Length == 1)
  45. {
  46. value = "000" + value;
  47. }
  48. else if (value.Length == 2)
  49. {
  50. value = "00" + value;
  51. }
  52. else if (value.Length == 3)
  53. {
  54. value = "0" + value;
  55. }
  56. else
  57. {
  58. value = "1350";
  59. }
  60. new WriteGripper() { DeviceId = 126, TagName = "PWMControl", CH_Number = "0", PWMOutput = value }.Publish();//夹爪的幅度控制
  61. });
  62. MikeTeaCupSetParCommand = new BPARelayCommand(() =>
  63. {
  64. for (int i = 0; i < 12; i++)
  65. {
  66. GVL_MorkT.MilkTeaCHValue[i] = CH_Value[i];
  67. }
  68. Json<SaveParModel>.Data.parData = GVL_MorkT.MilkTeaCHValue;
  69. Json<SaveParModel>.Save();
  70. new MilkTea_MakeMilkTeaEvent() { DeviceId = 126, TagName = "ParameterSet", MilkTeaKind = GVL_MorkT.MilkTeaCHValue }.Publish(); //写入奶茶参数
  71. });
  72. }
  73. public int JakaRobotProgram { get { return _JakaRobotProgram; } set { _JakaRobotProgram = value; OnPropertyChanged(); } }
  74. private int _JakaRobotProgram { get; set; }
  75. public BPARelayCommand RobotControlCommand { get; set; }
  76. public BPARelayCommand MikeTeaCupSetParCommand { get; set; }
  77. public int CoffeeKind { get { return _CoffeeKind; } set { _CoffeeKind = value; OnPropertyChanged(); } }
  78. private int _CoffeeKind { get; set; }
  79. public BPARelayCommand CoffeeControlCommand { get; set; }
  80. public int MilkTeaCub { get { return _MilkTeaCub; } set { _MilkTeaCub = value; OnPropertyChanged(); } }
  81. private int _MilkTeaCub { get; set; }
  82. public BPARelayCommand MikeTeaCupControlCommand { get; set; }
  83. public int GripperProgam { get { return _GripperProgam; } set { _GripperProgam = value; OnPropertyChanged(); } }
  84. private int _GripperProgam { get; set; }
  85. public ushort[] CH_Value { get { return _CH_Value; } set { _CH_Value = value; OnPropertyChanged(); } }
  86. private ushort[] _CH_Value { get; set; } = new ushort[12] {200,200,200,200,200,200,200,200,200,200,200,200 };
  87. public BPARelayCommand GripperControlCommand { get; set; }
  88. }