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 { /// /// 加热挡位 /// public ObservableCollection FireGear { get; set; } = new ObservableCollection() { 1, 2, 3, 4, 5 }; /// /// 搅拌挡位 /// public ObservableCollection StirGear { get; set; } = new ObservableCollection() { 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 /// /// 设定加热挡位 /// [RelayCommand] private void FirePot1_SetFireGear() { ActionManage.GetInstance.Send("FirePot1_SetFireGear",new List { FirePot1_FireGear}); } /// /// 加热启动 /// [RelayCommand] private void FirePot1_StartFire() { ActionManage.GetInstance.Send("FirePot1_StartFire",true); } /// /// 关闭加热 /// [RelayCommand] private void FirePot1_StopFire() { ActionManage.GetInstance.Send("FirePot1_StopFire",false); } /// /// 设定搅拌挡位 /// [RelayCommand] private void FirePot1_SetStirGear() { ActionManage.GetInstance.Send("FirePot1_SetStirGear",new List { FirePot1_StirGear}); } /// /// 搅拌启动 /// [RelayCommand] private void FirePot1_StartStir() { ActionManage.GetInstance.Send("FirePot1_StartStir",true); } /// /// 搅拌停止 /// [RelayCommand] private void FirePot1_StopStir() { ActionManage.GetInstance.Send("FirePot1_StopStir",false); } /// /// 翻转频率设定 /// [RelayCommand] private void FirePot1_SetTurnSpeed() { if (FirePot1_TurnSpeed > 800) FirePot1_TurnSpeed = 800; ActionManage.GetInstance.Send("FirePot1_SetTurnSpeed",new List { FirePot1_TurnSpeed}); } #endregion #region 炒锅2 /// /// 设定加热挡位 /// [RelayCommand] private void FirePot2_SetFireGear() { ActionManage.GetInstance.Send("FirePot2_SetFireGear", new List { FirePot2_FireGear }); } /// /// 加热启动 /// [RelayCommand] private void FirePot2_StartFire() { ActionManage.GetInstance.Send("FirePot2_StartFire", true); } /// /// 关闭加热 /// [RelayCommand] private void FirePot2_StopFire() { ActionManage.GetInstance.Send("FirePot2_StopFire", false); } /// /// 设定搅拌挡位 /// [RelayCommand] private void FirePot2_SetStirGear() { ActionManage.GetInstance.Send("FirePot2_SetStirGear", new List { FirePot2_StirGear }); } /// /// 搅拌启动 /// [RelayCommand] private void FirePot2_StartStir() { ActionManage.GetInstance.Send("FirePot2_StartStir", true); } /// /// 搅拌停止 /// [RelayCommand] private void FirePot2_StopStir() { ActionManage.GetInstance.Send("FirePot1_StopStir", false); } /// /// 翻转频率设定 /// [RelayCommand] private void FirePot2_SetTurnSpeed() { if (FirePot1_TurnSpeed > 800) FirePot1_TurnSpeed = 800; ActionManage.GetInstance.Send("FirePot2_SetTurnSpeed", new List { FirePot2_TurnSpeed }); } #endregion #region 炒锅通用 /// /// 复位 /// [RelayCommand] private void FirePot_Reset(object o) { ActionManage.GetInstance.Send("FirePot1_Reset", o); } /// /// 炒锅回原点 /// [RelayCommand] private void FirePot_PotGotoOrigin(object o) { ActionManage.GetInstance.Send("FirePot_PotGotoOrigin", o); } /// /// 炒锅去位置1 /// [RelayCommand] private void FirePot_PotGotoP1(object o) { ActionManage.GetInstance.Send("FirePot_PotGotoP1", o); } /// ///炒锅去位置2 /// [RelayCommand] private void FirePot_PotGotoP2(object o) { ActionManage.GetInstance.Send("FirePot_PotGotoP2", o); } /// /// 炒锅去位置3 /// [RelayCommand] private void FirePot_PotGotoP3(object o) { ActionManage.GetInstance.Send("FirePot_PotGotoP3", o); } /// /// 炒锅去位置4 /// [RelayCommand] private void FirePot_PotGotoP4(object o) { ActionManage.GetInstance.Send("FirePot_PotGotoP4", o); } /// /// 炒锅去出餐位置 /// [RelayCommand] private void FirePot_PotGotoOutFoodPositiong(object o) { ActionManage.GetInstance.Send("FirePot_PotGotoOutFoodPositiong", o); } /// /// 炒锅去投料位置 /// [RelayCommand] private void FirePot_PotGotoInFoodPosition(object o) { ActionManage.GetInstance.Send("FirePot_PotGotoInFoodPosition", o); } /// /// 出餐启动 /// [RelayCommand] private void FirePot_StartOutFood(object o) { ActionManage.GetInstance.Send("FirePot_StartOutFood", o); } /// /// 清洗 /// [RelayCommand] private void FirePot_Clean(object o) { ActionManage.GetInstance.Send("FirePot_Clean",o); } /// /// 抽水启动 /// [RelayCommand] private void FirePot_StartPumpWater(object o) { ActionManage.GetInstance.Send("FirePot_StartPumpWater", o); } /// /// 抽油启动 /// [RelayCommand] private void FirePot_StartPumpOil(object o) { ActionManage.GetInstance.Send("FirePot_StartPumpOil", o); } #endregion #region 机器人 public Dictionary RobotActions { get; set; } = new Dictionary() { {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; /// /// 机器人启动 /// [RelayCommand] private void RobotStart() { ActionManage.GetInstance.Send("RobotStart"); } /// /// 机器人停止 /// [RelayCommand] private void RobotStop() { ActionManage.GetInstance.Send("RobotStop"); } /// /// 复位 /// [RelayCommand] private void RobotReset() { ActionManage.GetInstance.Send("RobotReset"); } /// /// 程序启动 /// [RelayCommand] private void RobotProgramStart() { ActionManage.GetInstance.Send("RobotProgramStart"); } /// /// 1号炒锅允许机器人投料 /// [RelayCommand] private void Robot_Pot1AllowInMaterail() { ActionManage.GetInstance.Send("Robot_Pot1AllowInMaterail"); } /// /// 1号炒锅出餐倒料到减速位 /// [RelayCommand] private void Robot_Pot1OutFoodInSlowDown() { ActionManage.GetInstance.Send("Robot_Pot1OutFoodInSlowDown"); } /// /// 1号炒锅出餐倒料完成 /// [RelayCommand] private void Robot_Pot1OutFood() { ActionManage.GetInstance.Send("Robot_Pot1OutFood"); } /// /// 2号炒锅允许机器人投料 /// [RelayCommand] private void Robot_Pot2AllowInMaterail() { ActionManage.GetInstance.Send("Robot_Pot2AllowInMaterail"); } /// /// 2号炒锅出餐倒料到减速位 /// [RelayCommand] private void Robot_Pot2OutFoodInSlowDown() { ActionManage.GetInstance.Send("Robot_Pot2OutFoodInSlowDown"); } /// /// 2号炒锅出餐倒料完成 /// [RelayCommand] private void Robot_Pot2OutFood() { ActionManage.GetInstance.Send("Robot_Pot2OutFood"); } /// /// 机器人动作启动 /// [RelayCommand] private void RobotActionStart() { ActionManage.GetInstance.Send("RobotProgramStart",RobotAction ); } #endregion } }