|
- 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
- {
- /// <summary>
- /// 物料通道口列表
- /// </summary>
- public ObservableCollection<MaterialPosion> materialPosions { get; set; } = new ObservableCollection<MaterialPosion>();
- /// <summary>
- /// 转盘位置列表
- /// </summary>
- public ObservableCollection<OutMaterialPosion> TurntablePosion { get; set; } = new ObservableCollection<OutMaterialPosion>();
-
- /// <summary>
- /// 出料位置ID
- /// </summary>
- public int MaterialID { get { return _materialID; } set { _materialID = value; OnPropertyChanged(); } }
- private int _materialID = 0;
- /// <summary>
- /// 出料重量
- /// </summary>
- public float OutMaterailWeight { get { return _outMaterilWeight; } set { _outMaterilWeight = value; OnPropertyChanged(); } }
- private float _outMaterilWeight;
- /// <summary>
- /// 装盘ID
- /// </summary>
- public int TurntableID { get { return _turntableID; } set { _turntableID = value; OnPropertyChanged(); } }
- private int _turntableID = 0;
- /// <summary>
- /// 矫正的通道号
- /// </summary>
- public int CorrectPassway { get { return _CorrectPassway; } set { _CorrectPassway = value; OnPropertyChanged(); } }
- private int _CorrectPassway = 0;
- /// <summary>
- /// 通道是否开启
- /// </summary>
- public bool PasswayIsOpen { get { return _passwayIsOpen; } set { _passwayIsOpen = value; OnPropertyChanged(); } }
- private bool _passwayIsOpen ;
- /// <summary>
- /// 矫正重量
- /// </summary>
- public float CorrectMatetailWeight { get { return _CorrectMatetailWeight; } set { _CorrectMatetailWeight = value; OnPropertyChanged(); } }
- private float _CorrectMatetailWeight = 0;
- /// <summary>
- /// 矫正时间
- /// </summary>
- 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(); } }
- /// <summary>
- /// 出料动作
- /// </summary>
- public RelayCommand OutMaterailCommad { get; set; }
- /// <summary>
- /// 转动转盘
- /// </summary>
- public RelayCommand TurntableCommad { get; set; }
- /// <summary>
- /// 开始矫正
- /// </summary>
- public RelayCommand CheckPasswayCommad { get; set; }
- /// <summary>
- /// 开启通道
- /// </summary>
- public RelayCommand OpenPasswayCommand { get; set; }
- /// <summary>
- /// 确认重量
- /// </summary>
- 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 });
- }));
-
- }
- }
- }
|