|
- using BPASmartClient.Business;
- using BPASmartClient.Device;
- using BPASmartClient.DRCoffee;
- using BPASmartClient.EventBus;
- using BPASmartClient.Helper;
- using BPASmartClient.LebaiRobot;
- using BPASmartClient.Message;
- using BPASmartClient.Model;
- using BPASmartClient.Model.乐白机器人;
- using BPASmartClient.Model.冰淇淋.Enum;
- using BPASmartClient.Model.单片机;
- using BPASmartClient.Model.单片机.Enum;
- using BPASmartClient.Model.咖啡机.Enum;
- using BPASmartClient.Model.奶茶味魔方;
- using BPASmartClient.Model.电夹爪;
- using Microsoft.Toolkit.Mvvm.ComponentModel;
- using Microsoft.Toolkit.Mvvm.Input;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Threading;
- namespace BPASmartClient.MorkT_BarCounter.ViewModel;
- public class DebugViewModel : ObservableObject
- {
- public DebugViewModel()
- {
- if (Json<SaveParModel>.Data.parData != null)
- {
- CH_Value = Json<SaveParModel>.Data.parData;
- }
- RobotControlCommand = new RelayCommand(() =>
- {
- new WriteJaka() { DeviceId = 126, TagName = "JaKaProgramName", Value = JakaRobotProgram }.Publish();
-
- });
- CoffeeControlCommand = new RelayCommand(() =>
- {
- new DRCoffee_MakeCoffeeEvent() { DeviceId = 126, DrinkCode = (DrCoffeeDrinksCode)(CoffeeKind) }.Publish();
- });
- MikeTeaCupControlCommand = new RelayCommand(() =>
- {
- new MilkTea_MakeMilkTeaEvent() { DeviceId = 126, TagName = "Start" }.Publish();
- });
- GripperControlCommand = new RelayCommand(() =>
- {
- string value = GripperProgam + "";
- if (value.Length == 1)
- {
- value = "000" + value;
- }
- else if (value.Length == 2)
- {
- value = "00" + value;
- }
- else if (value.Length == 3)
- {
- value = "0" + value;
- }
- else
- {
- value = "1350";
- }
- new WriteGripper() { DeviceId = 126, TagName = "PWMControl", CH_Number = "0", PWMOutput = value }.Publish();//夹爪的幅度控制
- });
- MikeTeaCupSetParCommand = new RelayCommand(() =>
- {
- for (int i = 0; i < 12; i++)
- {
- GVL_MorkT.MilkTeaCHValue[i] = CH_Value[i];
- }
- Json<SaveParModel>.Data.parData = GVL_MorkT.MilkTeaCHValue;
- Json<SaveParModel>.Save();
- new MilkTea_MakeMilkTeaEvent() { DeviceId = 126, TagName = "ParameterSet", MilkTeaKind = GVL_MorkT.MilkTeaCHValue }.Publish(); //写入奶茶参数
- });
- }
- public int JakaRobotProgram { get { return _JakaRobotProgram; } set { _JakaRobotProgram = value; OnPropertyChanged(); } }
- private int _JakaRobotProgram { get; set; }
- public RelayCommand RobotControlCommand { get; set; }
- public RelayCommand MikeTeaCupSetParCommand { get; set; }
- public int CoffeeKind { get { return _CoffeeKind; } set { _CoffeeKind = value; OnPropertyChanged(); } }
- private int _CoffeeKind { get; set; }
- public RelayCommand CoffeeControlCommand { get; set; }
-
- public int MilkTeaCub { get { return _MilkTeaCub; } set { _MilkTeaCub = value; OnPropertyChanged(); } }
- private int _MilkTeaCub { get; set; }
- public RelayCommand MikeTeaCupControlCommand { get; set; }
- public int GripperProgam { get { return _GripperProgam; } set { _GripperProgam = value; OnPropertyChanged(); } }
- private int _GripperProgam { get; set; }
-
- public ushort[] CH_Value { get { return _CH_Value; } set { _CH_Value = value; OnPropertyChanged(); } }
- private ushort[] _CH_Value { get; set; } = new ushort[12] {200,200,200,200,200,200,200,200,200,200,200,200 };
-
- public RelayCommand GripperControlCommand { get; set; }
- }
|