终端一体化运控平台
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

97 linhas
3.8 KiB

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