|
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using BPASmartClient.Helper;
- using CommunityToolkit.Mvvm.ComponentModel;
- using CommunityToolkit.Mvvm.Input;
-
- namespace BPASmartClient.MorkBF.ViewModel
- {
- [INotifyPropertyChanged]
- partial class DebugViewModel
- {
-
- /// <summary>
- /// 加热挡位
- /// </summary>
- public ObservableCollection<int> FireGear { get; set; } = new ObservableCollection<int>() { 1, 2, 3, 4, 5 };
- /// <summary>
- /// 搅拌挡位
- /// </summary>
- public ObservableCollection<int> StirGear { get; set; } = new ObservableCollection<int>() { 1, 2, 3, 4, 5 };
-
- [ObservableProperty]
- private int _firePot1_FireGear = 0;
- [ObservableProperty]
- private int _firePot2_FireGear = 0;
- [ObservableProperty]
- private int _firePot1_StirGear = 0;
- [ObservableProperty]
- private int _firePot2_StirGear = 0;
- [ObservableProperty]
- private int _firePot1_TurnSpeed;
- [ObservableProperty]
- private int _firePot2_TurnSpeed;
- #region 炒锅1
-
- /// <summary>
- /// 设定加热挡位
- /// </summary>
- [RelayCommand]
- private void FirePot1_SetFireGear()
- {
- ActionManage.GetInstance.Send("FirePot1_SetFireGear",new List<int> { FirePot1_FireGear});
- }
- /// <summary>
- /// 加热启动
- /// </summary>
- [RelayCommand]
- private void FirePot1_StartFire()
- {
- ActionManage.GetInstance.Send("FirePot1_StartFire",true);
- }
- /// <summary>
- /// 关闭加热
- /// </summary>
- [RelayCommand]
- private void FirePot1_StopFire()
- {
- ActionManage.GetInstance.Send("FirePot1_StopFire",false);
- }
- /// <summary>
- /// 设定搅拌挡位
- /// </summary>
- [RelayCommand]
- private void FirePot1_SetStirGear()
- {
- ActionManage.GetInstance.Send("FirePot1_SetStirGear",new List<int> { FirePot1_StirGear});
- }
- /// <summary>
- /// 搅拌启动
- /// </summary>
- [RelayCommand]
- private void FirePot1_StartStir()
- {
- ActionManage.GetInstance.Send("FirePot1_StartStir",true);
- }
- /// <summary>
- /// 搅拌停止
- /// </summary>
- [RelayCommand]
- private void FirePot1_StopStir()
- {
- ActionManage.GetInstance.Send("FirePot1_StopStir",false);
- }
- /// <summary>
- /// 翻转频率设定
- /// </summary>
- [RelayCommand]
- private void FirePot1_SetTurnSpeed()
- {
- if (FirePot1_TurnSpeed > 800) FirePot1_TurnSpeed = 800;
- ActionManage.GetInstance.Send("FirePot1_SetTurnSpeed",new List<int> { FirePot1_TurnSpeed});
- }
- #endregion
-
- #region 炒锅2
- /// <summary>
- /// 设定加热挡位
- /// </summary>
- [RelayCommand]
- private void FirePot2_SetFireGear()
- {
- ActionManage.GetInstance.Send("FirePot2_SetFireGear", new List<int> { FirePot2_FireGear });
- }
- /// <summary>
- /// 加热启动
- /// </summary>
- [RelayCommand]
- private void FirePot2_StartFire()
- {
- ActionManage.GetInstance.Send("FirePot2_StartFire", true);
- }
- /// <summary>
- /// 关闭加热
- /// </summary>
- [RelayCommand]
- private void FirePot2_StopFire()
- {
- ActionManage.GetInstance.Send("FirePot2_StopFire", false);
- }
- /// <summary>
- /// 设定搅拌挡位
- /// </summary>
- [RelayCommand]
- private void FirePot2_SetStirGear()
- {
- ActionManage.GetInstance.Send("FirePot2_SetStirGear", new List<int> { FirePot2_StirGear });
- }
- /// <summary>
- /// 搅拌启动
- /// </summary>
- [RelayCommand]
- private void FirePot2_StartStir()
- {
- ActionManage.GetInstance.Send("FirePot2_StartStir", true);
- }
- /// <summary>
- /// 搅拌停止
- /// </summary>
- [RelayCommand]
- private void FirePot2_StopStir()
- {
- ActionManage.GetInstance.Send("FirePot1_StopStir", false);
- }
- /// <summary>
- /// 翻转频率设定
- /// </summary>
- [RelayCommand]
- private void FirePot2_SetTurnSpeed()
- {
- if (FirePot1_TurnSpeed > 800) FirePot1_TurnSpeed = 800;
- ActionManage.GetInstance.Send("FirePot2_SetTurnSpeed", new List<int> { FirePot2_TurnSpeed });
- }
- #endregion
-
- #region 炒锅通用
- /// <summary>
- /// 复位
- /// </summary>
- [RelayCommand]
- private void FirePot_Reset(object o)
- {
- ActionManage.GetInstance.Send("FirePot1_Reset", o);
- }
- /// <summary>
- /// 炒锅回原点
- /// </summary>
- [RelayCommand]
- private void FirePot_PotGotoOrigin(object o)
- {
- ActionManage.GetInstance.Send("FirePot_PotGotoOrigin", o);
- }
- /// <summary>
- /// 炒锅去位置1
- /// </summary>
- [RelayCommand]
- private void FirePot_PotGotoP1(object o)
- {
- ActionManage.GetInstance.Send("FirePot_PotGotoP1", o);
- }
- /// <summary>
- ///炒锅去位置2
- /// </summary>
- [RelayCommand]
- private void FirePot_PotGotoP2(object o)
- {
- ActionManage.GetInstance.Send("FirePot_PotGotoP2", o);
- }
- /// <summary>
- /// 炒锅去位置3
- /// </summary>
- [RelayCommand]
- private void FirePot_PotGotoP3(object o)
- {
- ActionManage.GetInstance.Send("FirePot_PotGotoP3", o);
- }
- /// <summary>
- /// 炒锅去位置4
- /// </summary>
- [RelayCommand]
- private void FirePot_PotGotoP4(object o)
- {
- ActionManage.GetInstance.Send("FirePot_PotGotoP4", o);
- }
- /// <summary>
- /// 炒锅去出餐位置
- /// </summary>
- [RelayCommand]
- private void FirePot_PotGotoOutFoodPositiong(object o)
- {
- ActionManage.GetInstance.Send("FirePot_PotGotoOutFoodPositiong", o);
- }
- /// <summary>
- /// 炒锅去投料位置
- /// </summary>
- [RelayCommand]
- private void FirePot_PotGotoInFoodPosition(object o)
- {
- ActionManage.GetInstance.Send("FirePot_PotGotoInFoodPosition", o);
- }
- /// <summary>
- /// 出餐启动
- /// </summary>
- [RelayCommand]
- private void FirePot_StartOutFood(object o)
- {
- ActionManage.GetInstance.Send("FirePot_StartOutFood", o);
- }
- /// <summary>
- /// 清洗
- /// </summary>
- [RelayCommand]
- private void FirePot_Clean(object o)
- {
- ActionManage.GetInstance.Send("FirePot_Clean",o);
- }
- /// <summary>
- /// 抽水启动
- /// </summary>
- [RelayCommand]
- private void FirePot_StartPumpWater(object o)
- {
- ActionManage.GetInstance.Send("FirePot_StartPumpWater", o);
- }
- /// <summary>
- /// 抽油启动
- /// </summary>
- [RelayCommand]
- private void FirePot_StartPumpOil(object o)
- {
- ActionManage.GetInstance.Send("FirePot_StartPumpOil", o);
- }
-
-
- #endregion
-
-
- #region 机器人
- public Dictionary<int,string> RobotActions { get; set; } = new Dictionary<int, string>()
- {
- {0, "无任务"},
- {1, "取1号炒锅荤菜盆倒1号炒锅"},
- {2, "取1号炒锅素菜盆1倒1号炒锅"},
- {3, "取1号炒锅素菜盆2倒1号炒锅"},
- {4, "取1号炒锅调料盆倒入1号炒锅"},
- {5, "取1号炒锅辅料盆1倒入1号炒锅"},
- {6, "取1号空盆出餐"},
- {20, "取2号炒锅荤菜盆1倒1号炒锅"},
- {21, "取2号炒锅素菜盆1倒1号炒锅"},
- {22, "取2号炒锅素菜盆2倒1号炒锅"},
- {23, "取2号炒锅调料盆倒入1号炒锅"},
- {24, "取2号炒锅辅料盆1倒入1号炒锅"},
- {25, "取2号空盆出餐"},
- };
-
- [ObservableProperty]
- private int _robotAction;
- /// <summary>
- /// 机器人启动
- /// </summary>
- [RelayCommand]
- private void RobotStart()
- {
- ActionManage.GetInstance.Send("RobotStart");
- }
- /// <summary>
- /// 机器人停止
- /// </summary>
- [RelayCommand]
- private void RobotStop()
- {
- ActionManage.GetInstance.Send("RobotStop");
- }
- /// <summary>
- /// 复位
- /// </summary>
- [RelayCommand]
- private void RobotReset()
- {
- ActionManage.GetInstance.Send("RobotReset");
- }
- /// <summary>
- /// 程序启动
- /// </summary>
- [RelayCommand]
- private void RobotProgramStart()
- {
- ActionManage.GetInstance.Send("RobotProgramStart");
- }
- /// <summary>
- /// 1号炒锅允许机器人投料
- /// </summary>
- [RelayCommand]
- private void Robot_Pot1AllowInMaterail()
- {
- ActionManage.GetInstance.Send("Robot_Pot1AllowInMaterail");
- }
- /// <summary>
- /// 1号炒锅出餐倒料到减速位
- /// </summary>
- [RelayCommand]
- private void Robot_Pot1OutFoodInSlowDown()
- {
- ActionManage.GetInstance.Send("Robot_Pot1OutFoodInSlowDown");
- }
- /// <summary>
- /// 1号炒锅出餐倒料完成
- /// </summary>
- [RelayCommand]
- private void Robot_Pot1OutFood()
- {
- ActionManage.GetInstance.Send("Robot_Pot1OutFood");
- }
- /// <summary>
- /// 2号炒锅允许机器人投料
- /// </summary>
- [RelayCommand]
- private void Robot_Pot2AllowInMaterail()
- {
- ActionManage.GetInstance.Send("Robot_Pot2AllowInMaterail");
- }
- /// <summary>
- /// 2号炒锅出餐倒料到减速位
- /// </summary>
- [RelayCommand]
- private void Robot_Pot2OutFoodInSlowDown()
- {
- ActionManage.GetInstance.Send("Robot_Pot2OutFoodInSlowDown");
- }
- /// <summary>
- /// 2号炒锅出餐倒料完成
- /// </summary>
- [RelayCommand]
- private void Robot_Pot2OutFood()
- {
- ActionManage.GetInstance.Send("Robot_Pot2OutFood");
- }
-
- /// <summary>
- /// 机器人动作启动
- /// </summary>
- [RelayCommand]
- private void RobotActionStart()
- {
- ActionManage.GetInstance.Send("RobotProgramStart",RobotAction );
- }
-
- #endregion
- }
- }
|