using BPASmartClient.Helper; using BPASmartClient.MorkTM; 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.Text; using System.Threading.Tasks; namespace BPASmartClient.MilkWithTea.ViewModel { public class PatrameterSettiongViewModel: ObservableObject { /// /// 物料通道口列表 /// public ObservableCollection materialPosions { get; set; } = new ObservableCollection(); /// /// 转盘位置列表 /// public ObservableCollection TurntablePosion { get; set; } = new ObservableCollection(); /// /// 出料位置ID /// public int MaterialID { get { return _materialID; } set { _materialID = value; OnPropertyChanged(); } } private int _materialID = 0; /// /// 出料重量 /// public float OutMaterailWeight { get { return _outMaterilWeight; } set { _outMaterilWeight = value; OnPropertyChanged(); } } private float _outMaterilWeight; /// /// 装盘ID /// public int TurntableID { get { return _turntableID; } set { _turntableID = value; OnPropertyChanged(); } } private int _turntableID = 0; /// /// 矫正的通道号 /// public int CorrectPassway { get { return _CorrectPassway; } set { _CorrectPassway = value; OnPropertyChanged(); } } private int _CorrectPassway = 0; /// /// 通道是否开启 /// public bool PasswayIsOpen { get { return _passwayIsOpen; } set { _passwayIsOpen = value; OnPropertyChanged(); } } private bool _passwayIsOpen ; /// /// 矫正重量 /// public float CorrectMatetailWeight { get { return _CorrectMatetailWeight; } set { _CorrectMatetailWeight = value; OnPropertyChanged(); } } private float _CorrectMatetailWeight = 0; /// /// 矫正时间 /// public int OutTime { get { return _0utTime; } set { _0utTime = value; OnPropertyChanged(); } } private int _0utTime = 0; public bool IsEnable { get { return !GLobal.makeEnable; } set { GLobal.makeEnable = !value; OnPropertyChanged(); } } /// /// 出料动作 /// public RelayCommand OutMaterailCommad { get; set; } /// /// 转动转盘 /// public RelayCommand TurntableCommad { get; set; } /// /// 开始矫正 /// public RelayCommand CheckPasswayCommad { get; set; } /// /// 开启通道 /// public RelayCommand OpenPasswayCommand { get; set; } /// /// 确认重量 /// public RelayCommand CheckMaterailWeightCommand { get; set; } public PatrameterSettiongViewModel() { foreach(MaterialPosion materialPosion in Enum.GetValues(typeof(MaterialPosion))) { materialPosions.Add(materialPosion); } foreach(OutMaterialPosion outMaterialPosion in Enum.GetValues(typeof(OutMaterialPosion))) { TurntablePosion.Add(outMaterialPosion); } OutMaterailCommad = new RelayCommand(new Action(() => { ActionManage.GetInstance.Send("通道口出料", new object[] { MaterialID +1, OutMaterailWeight }); })); TurntableCommad = new RelayCommand(new Action(() => { ActionManage.GetInstance.Send("转盘转动", new object[] { TurntableID }); })); OpenPasswayCommand = new RelayCommand(new Action(() => { if(PasswayIsOpen) ActionManage.GetInstance.Send("开启通道", new object[] { CorrectPassway + 1 }); })); CheckPasswayCommad = new RelayCommand(new Action(() => { ActionManage.GetInstance.Send("开始矫正", new object[] { CorrectPassway + 1,OutTime }); })); CheckMaterailWeightCommand = new RelayCommand(new Action(() => { ActionManage.GetInstance.Send("矫正重量", new object[] { CorrectPassway + 1, CorrectMatetailWeight }); })); } } }