|
- using BPASmartClient.Business;
- using BPASmartClient.Device;
- using BPASmartClient.DRCoffee;
-
- using BPA.Helper;
- using BPASmartClient.LebaiRobot;
-
- 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 BPA.Helper;
-
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Threading;
- namespace BPASmartClient.MorkT_BarCounter.ViewModel;
- public class DebugViewModel : NotifyBase
- {
- public DebugViewModel()
- {
- if (Json<SaveParModel>.Data.parData != null)
- {
- CH_Value = Json<SaveParModel>.Data.parData;
- }
- RobotControlCommand = new BPARelayCommand(() =>
- {
- new WriteJaka() { DeviceId = 126, TagName = "JaKaProgramName", Value = JakaRobotProgram }.Publish();
-
- });
- CoffeeControlCommand = new BPARelayCommand(() =>
- {
- new DRCoffee_MakeCoffeeEvent() { DeviceId = 126, DrinkCode = (DrCoffeeDrinksCode)(CoffeeKind) }.Publish();
- });
- MikeTeaCupControlCommand = new BPARelayCommand(() =>
- {
- new MilkTea_MakeMilkTeaEvent() { DeviceId = 126, TagName = "Start" }.Publish();
- });
- GripperControlCommand = new BPARelayCommand(() =>
- {
- 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 BPARelayCommand(() =>
- {
- 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 BPARelayCommand RobotControlCommand { get; set; }
- public BPARelayCommand MikeTeaCupSetParCommand { get; set; }
- public int CoffeeKind { get { return _CoffeeKind; } set { _CoffeeKind = value; OnPropertyChanged(); } }
- private int _CoffeeKind { get; set; }
- public BPARelayCommand CoffeeControlCommand { get; set; }
-
- public int MilkTeaCub { get { return _MilkTeaCub; } set { _MilkTeaCub = value; OnPropertyChanged(); } }
- private int _MilkTeaCub { get; set; }
- public BPARelayCommand 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 BPARelayCommand GripperControlCommand { get; set; }
- }
|