|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430 |
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using BPA.Helper;
- using BPASmartClient.Model.大炒;
- using BPASmartClient.MorkBF.Model;
- using BPASmartClient.MorkBF.VIew;
-
- namespace BPASmartClient.MorkBF.ViewModel
- {
- //[INotifyPropertyChanged]
- partial class DebugViewModel : NotifyBase
- {
- /// <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 };
- /// <summary>
- /// 炒锅角度
- /// </summary>
- public ObservableCollection<int> PotAngle { get; set; } = new ObservableCollection<int>() { 1, 2, 3, 4, };
- /// <summary>
- /// 通道号
- /// </summary>
- public ObservableCollection<int> PassWay { get; set; } = new ObservableCollection<int>() { 1, 2, 3, 4, 5, 6, 7, 8 };
-
- //[ObservableProperty]
- //加热挡位
- public int FirePot1_FireGear { get { return _firePot1_FireGear; } set { _firePot1_FireGear = value; OnPropertyChanged(); } }
- private int _firePot1_FireGear = 1;
- public int FirePot2_FireGear { get { return _firePot2_FireGear; } set { _firePot2_FireGear = value; OnPropertyChanged(); } }
- private int _firePot2_FireGear = 1;
-
- //搅拌挡位
- public int FirePot1_StirGear { get { return _firePot1_StirGear; } set { _firePot1_StirGear = value; OnPropertyChanged(); } }
- private int _firePot1_StirGear = 1;
- public int FirePot2_StirGear { get { return _firePot2_StirGear; } set { _firePot2_StirGear = value; OnPropertyChanged(); } }
- private int _firePot2_StirGear = 1;
-
- //翻转速度
- public int FirePot1_TurnSpeed { get { return _firePot1_TurnSpeed; } set { _firePot1_TurnSpeed = value; OnPropertyChanged(); } }
- private int _firePot1_TurnSpeed;
- public int FirePot2_TurnSpeed { get { return _firePot2_TurnSpeed; } set { _firePot2_TurnSpeed = value; OnPropertyChanged(); } }
- private int _firePot2_TurnSpeed;
-
- //炒锅角度
- public int FirePot1_PotAngle { get { return _firePot1_PotAngle; } set { _firePot1_PotAngle = value; OnPropertyChanged(); } }
- private int _firePot1_PotAngle = 1;
- public int FirePot2_PotAngle { get { return _firePot2_PotAngle; } set { _firePot2_PotAngle = value; OnPropertyChanged(); } }
- private int _firePot2_PotAngle = 1;
-
- //通道需求值
- public int FirePot1_PassValue { get { return _firePot1_PassValue; } set { _firePot1_PassValue = value; OnPropertyChanged(); } }
- private int _firePot1_PassValue = 0;
- public int FirePot2_PassValue { get { return _firePot2_PassValue; } set { _firePot2_PassValue = value; OnPropertyChanged(); } }
- private int _firePot2_PassValue = 0;
-
- //通道需求值
- public int FirePot1_PassWay { get { return _firePot1_PassWay; } set { _firePot1_PassWay = value; OnPropertyChanged(); } }
- private int _firePot1_PassWay = 0;
- public int FirePot2_PassWay { get { return _firePot2_PassWay; } set { _firePot2_PassWay = value; OnPropertyChanged(); } }
- private int _firePot2_PassWay = 0;
-
-
- #region 炒锅
- /// <summary>
- /// 设定加热挡位
- /// </summary>
- //[BPARelayCommand]
- private void FirePot_SetFireGear(object o)
- {
- if (o == null) return;
- if (int.TryParse(o.ToString(), out int i))
- {
- int value = 0;
- if (i == 1)
- {
- value = FirePot1_FireGear;
- }
- else if (i == 2)
- {
- value = FirePot2_FireGear;
- }
- ActionManage.GetInstance.Send(new object[] { i, value }, "FirePot_SetFireGear");
- }
-
- }
- /// <summary>
- /// 加热启动
- /// </summary>
- //[BPARelayCommand]
- private void FirePot_StartFire(object o)
- {
- if (o == null) return;
- if (int.TryParse(o.ToString(), out int i))
- {
- ActionManage.GetInstance.Send(new object[] { i, true }, "FirePot_StartFire");
- }
-
- }
- /// <summary>
- /// 关闭加热
- /// </summary>
- //[BPARelayCommand]
- private void FirePot_StopFire(object o)
- {
- if (o == null) return;
- if (int.TryParse(o.ToString(), out int i))
- {
- ActionManage.GetInstance.Send(new object[] { i, false }, "FirePot_StopFire");
- }
- }
-
- /// <summary>
- /// 设定搅拌挡位
- /// </summary>
- //[BPARelayCommand]
- private void FirePot_SetStirGear(object o)
- {
- if (o == null) return;
- if (int.TryParse(o.ToString(), out int i))
- {
- int value = 0;
- if (i == 1)
- {
- value = FirePot1_StirGear;
- }
- else if (i == 2)
- {
- value = FirePot2_StirGear;
- }
- ActionManage.GetInstance.Send(new object[] { i, value }, "FirePot_SetStirGear");
- }
- }
- /// <summary>
- /// 搅拌启动
- /// </summary>
- //[BPARelayCommand]
- private void FirePot_StartStir(object o)
- {
-
- if (o == null) return;
- if (int.TryParse(o.ToString(), out int i))
- {
- ActionManage.GetInstance.Send(new object[] { i, true }, "FirePot_StartStir");
- }
- }
- /// <summary>
- /// 搅拌停止
- /// </summary>
- //[BPARelayCommand]
- private void FirePot_StopStir(object o)
- {
-
- if (o == null) return;
- if (int.TryParse(o.ToString(), out int i))
- {
- ActionManage.GetInstance.Send(new object[] { i, false }, "FirePot_StopStir");
- }
- }
- /// <summary>
- /// 翻转频率设定
- /// </summary>
- //[BPARelayCommand]
- private void FirePot_SetTurnSpeed(object o)
- {
- if (o == null) return;
- if (int.TryParse(o.ToString(), out int i))
- {
- int value = 0;
- if (i == 1)
- {
- value = FirePot1_TurnSpeed;
- }
- else if (i == 2)
- {
- value = FirePot2_TurnSpeed;
- }
- if (value > 800) value = 800;
- ActionManage.GetInstance.Send(new object[] { i, value }, "FirePot_SetTurnSpeed");
- }
- }
- /// <summary>
- /// 设定炒锅角度
- /// </summary>
- //[BPARelayCommand]
- private void FirePot_SetPotAngle(object o)
- {
- if (o == null) return;
- if (int.TryParse(o.ToString(), out int i))
- {
- int value = 0;
- if (i == 1)
- {
- value = FirePot1_PotAngle;
- }
- else if (i == 2)
- {
- value = FirePot2_PotAngle;
- }
- ActionManage.GetInstance.Send(new object[] { i, value }, "FirePot_SetPotAngle");
- }
- }
-
- /// <summary>
- /// 通道出料启动
- /// </summary>
- //[BPARelayCommand]
- private void FirePot_StartPassWay(object o)
- {
- if (o == null) return;
- if (int.TryParse(o.ToString(), out int i))
- {
- int value1 = 0;
- int value2 = 0;
- if (i == 1)
- {
- value1 = FirePot1_PassWay;
- value2 = FirePot1_PassValue;
- }
- else if (i == 2)
- {
- value1 = FirePot2_PassWay;
- value2 = FirePot2_PassValue;
- }
- ActionManage.GetInstance.Send(new object[] { i, value1, value2 }, "FirePot_StartPassWay");
- }
- }
-
- /// <summary>
- /// 复位
- /// </summary>
- //[BPARelayCommand]
- private void FirePot_Reset(object o)
- {
- //ActionManage.GetInstance.Send("FirePot1_Reset", o);
- }
- /// <summary>
- /// 炒锅回原点
- /// </summary>
- //[BPARelayCommand]
- private void FirePot_PotGotoOrigin(object o)
- {
- ActionManage.GetInstance.Send(int.Parse(o.ToString()), "FirePot_PotGotoOrigin");
- }
-
- /// <summary>
- /// 炒锅去投料位置
- /// </summary>
- //[BPARelayCommand]
- private void FirePot_PotGotoInFoodPosition(object o)
- {
-
- ActionManage.GetInstance.Send(int.Parse(o.ToString()), "FirePot_PotGotoInFoodPosition");
- }
- /// <summary>
- /// 出餐启动
- /// </summary>
- //[BPARelayCommand]
- private void FirePot_StartOutFood(object o)
- {
- ActionManage.GetInstance.Send(int.Parse(o.ToString()), "FirePot_StartOutFood");
- }
- /// <summary>
- /// 清洗
- /// </summary>
- //[BPARelayCommand]
- private void FirePot_Clean(object o)
- {
- ActionManage.GetInstance.Send(int.Parse(o.ToString()), "FirePot_Clean");
- }
- /// <summary>
- /// 抽水启动
- /// </summary>
- //[BPARelayCommand]
- private void FirePot_StartPumpWater(object o)
- {
- ActionManage.GetInstance.Send(new object[] { int.Parse(o.ToString()), true }, "FirePot_StartPumpWater");
- }
- /// <summary>
- /// 抽水关闭
- /// </summary>
- //[BPARelayCommand]
- private void FirePot_StopPumpWater(object o)
- {
- ActionManage.GetInstance.Send(new object[] { int.Parse(o.ToString()), false }, "FirePot_StopPumpWater");
- }
- /// <summary>
- /// 推杆伸出
- /// </summary>
- //[BPARelayCommand]
- private void FirePot_PushReach(object o)
- {
- ActionManage.GetInstance.Send(int.Parse(o.ToString()), "FirePot_PushReach");
- }
- /// <summary>
- /// 推杆缩回
- /// </summary>
- //[BPARelayCommand]
- private void FirePot_PushRetract(object o)
- {
- ActionManage.GetInstance.Send(int.Parse(o.ToString()), "FirePot_PushRetract");
- }
- /// <summary>
- /// 翻转正转
- /// </summary>
- //[BPARelayCommand]
- private void FirePot_PotForward(object o)
- {
- ActionManage.GetInstance.Send(int.Parse(o.ToString()), "FirePot_PotForward");
- }
- /// <summary>
- /// 翻转反转
- /// </summary>
- //[BPARelayCommand]
- private void FirePot_PotReversal(object o)
- {
- ActionManage.GetInstance.Send(int.Parse(o.ToString()), "FirePot_PotReversal");
- }
-
-
-
- #endregion
-
-
- #region 机器人
- public ObservableCollection<MainTask> RobotMainTask { get; set; } = new ObservableCollection<MainTask>(Enum.GetValues<MainTask>());
- public ObservableCollection<SubTask1> RobotSubTask1 { get; set; } = new ObservableCollection<SubTask1>(Enum.GetValues<SubTask1>());
- public ObservableCollection<SubTask2> RobotSubTask2 { get; set; } = new ObservableCollection<SubTask2>(Enum.GetValues<SubTask2>());
- public ObservableCollection<SubTask3> RobotSubTask3 { get; set; } = new ObservableCollection<SubTask3>(Enum.GetValues<SubTask3>());
- public ObservableCollection<SubTask4> RobotSubTask4 { get; set; } = new ObservableCollection<SubTask4>(Enum.GetValues<SubTask4>());
-
-
- public MainTask MainTask { get { return _mainTask; } set { _mainTask = value; OnPropertyChanged(); } }
- private MainTask _mainTask;
-
- public SubTask1 SubTask1 { get { return _subTask1; } set { _subTask1 = value; OnPropertyChanged(); } }
- private SubTask1 _subTask1;
-
- public SubTask2 SubTask2 { get { return _subTask2; } set { _subTask2 = value; OnPropertyChanged(); } }
- private SubTask2 _subTask2;
- public SubTask3 SubTask3 { get { return _subTask3; } set { _subTask3 = value; OnPropertyChanged(); } }
- private SubTask3 _subTask3;
-
- public SubTask4 SubTask4 { get { return _subTask4; } set { _subTask4 = value; OnPropertyChanged(); } }
- private SubTask4 _subTask4;
-
-
-
- /// <summary>
- /// 机器人启动
- /// </summary>
- //[BPARelayCommand]
- private void RobotStart()
- {
- ActionManage.GetInstance.Send("RobotStart");
- }
- /// <summary>
- /// 机器人停止
- /// </summary>
- //[BPARelayCommand]
- private void RobotStop()
- {
- ActionManage.GetInstance.Send("RobotStop");
- }
- /// <summary>
- /// 复位
- /// </summary>
- //[BPARelayCommand]
- private void RobotReset()
- {
- ActionManage.GetInstance.Send("RobotReset");
- }
- /// <summary>
- /// 机器人上使能
- /// </summary>
- //[BPARelayCommand]
- private void RobotEnable()
- {
- ActionManage.GetInstance.Send("RobotEnable");
- }
-
- /// <summary>
- /// 机器人动作
- /// </summary>
- //[BPARelayCommand]
- private void RobotAction(object o)
- {
- if (int.TryParse(o.ToString(), out int value))
- {
- object item = new object();
- switch (value)
- {
- case 0:
- item = this.MainTask;
- break;
- case 1:
- item = SubTask1;
- break;
- case 2:
- item = SubTask2;
- break;
- case 3:
- item = SubTask3;
- break;
- case 4:
- item = SubTask4;
- break;
- default:
- break;
- }
- ActionManage.GetInstance.Send(new object[] { value, item }, "RobotAction");
- }
- }
-
-
- #endregion
-
-
-
-
- }
- }
|