终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

124 lines
4.6 KiB

  1. using BPASmartClient.Helper;
  2. using BPASmartClient.MorkTM;
  3. using Microsoft.Toolkit.Mvvm.ComponentModel;
  4. using Microsoft.Toolkit.Mvvm.Input;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Collections.ObjectModel;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace BPASmartClient.MilkWithTea.ViewModel
  12. {
  13. public class PatrameterSettiongViewModel: ObservableObject
  14. {
  15. /// <summary>
  16. /// 物料通道口列表
  17. /// </summary>
  18. public ObservableCollection<MaterialPosion> materialPosions { get; set; } = new ObservableCollection<MaterialPosion>();
  19. /// <summary>
  20. /// 转盘位置列表
  21. /// </summary>
  22. public ObservableCollection<OutMaterialPosion> TurntablePosion { get; set; } = new ObservableCollection<OutMaterialPosion>();
  23. /// <summary>
  24. /// 出料位置ID
  25. /// </summary>
  26. public int MaterialID { get { return _materialID; } set { _materialID = value; OnPropertyChanged(); } }
  27. private int _materialID = 0;
  28. /// <summary>
  29. /// 出料重量
  30. /// </summary>
  31. public float OutMaterailWeight { get { return _outMaterilWeight; } set { _outMaterilWeight = value; OnPropertyChanged(); } }
  32. private float _outMaterilWeight;
  33. /// <summary>
  34. /// 装盘ID
  35. /// </summary>
  36. public int TurntableID { get { return _turntableID; } set { _turntableID = value; OnPropertyChanged(); } }
  37. private int _turntableID = 0;
  38. /// <summary>
  39. /// 矫正的通道号
  40. /// </summary>
  41. public int CorrectPassway { get { return _CorrectPassway; } set { _CorrectPassway = value; OnPropertyChanged(); } }
  42. private int _CorrectPassway = 0;
  43. /// <summary>
  44. /// 通道是否开启
  45. /// </summary>
  46. public bool PasswayIsOpen { get { return _passwayIsOpen; } set { _passwayIsOpen = value; OnPropertyChanged(); } }
  47. private bool _passwayIsOpen ;
  48. /// <summary>
  49. /// 矫正重量
  50. /// </summary>
  51. public float CorrectMatetailWeight { get { return _CorrectMatetailWeight; } set { _CorrectMatetailWeight = value; OnPropertyChanged(); } }
  52. private float _CorrectMatetailWeight = 0;
  53. /// <summary>
  54. /// 矫正时间
  55. /// </summary>
  56. public int OutTime { get { return _0utTime; } set { _0utTime = value; OnPropertyChanged(); } }
  57. private int _0utTime = 0;
  58. public bool IsEnable { get { return !GLobal.makeEnable; } set { GLobal.makeEnable = !value; OnPropertyChanged(); } }
  59. /// <summary>
  60. /// 出料动作
  61. /// </summary>
  62. public RelayCommand OutMaterailCommad { get; set; }
  63. /// <summary>
  64. /// 转动转盘
  65. /// </summary>
  66. public RelayCommand TurntableCommad { get; set; }
  67. /// <summary>
  68. /// 开始矫正
  69. /// </summary>
  70. public RelayCommand CheckPasswayCommad { get; set; }
  71. /// <summary>
  72. /// 开启通道
  73. /// </summary>
  74. public RelayCommand OpenPasswayCommand { get; set; }
  75. /// <summary>
  76. /// 确认重量
  77. /// </summary>
  78. public RelayCommand CheckMaterailWeightCommand { get; set; }
  79. public PatrameterSettiongViewModel()
  80. {
  81. foreach(MaterialPosion materialPosion in Enum.GetValues(typeof(MaterialPosion)))
  82. {
  83. materialPosions.Add(materialPosion);
  84. }
  85. foreach(OutMaterialPosion outMaterialPosion in Enum.GetValues(typeof(OutMaterialPosion)))
  86. {
  87. TurntablePosion.Add(outMaterialPosion);
  88. }
  89. OutMaterailCommad = new RelayCommand(new Action(() =>
  90. {
  91. ActionManage.GetInstance.Send("通道口出料", new object[] { MaterialID +1, OutMaterailWeight });
  92. }));
  93. TurntableCommad = new RelayCommand(new Action(() =>
  94. {
  95. ActionManage.GetInstance.Send("转盘转动", new object[] { TurntableID });
  96. }));
  97. OpenPasswayCommand = new RelayCommand(new Action(() =>
  98. {
  99. if(PasswayIsOpen) ActionManage.GetInstance.Send("开启通道", new object[] { CorrectPassway + 1 });
  100. }));
  101. CheckPasswayCommad = new RelayCommand(new Action(() =>
  102. {
  103. ActionManage.GetInstance.Send("开始矫正", new object[] { CorrectPassway + 1,OutTime });
  104. }));
  105. CheckMaterailWeightCommand = new RelayCommand(new Action(() =>
  106. {
  107. ActionManage.GetInstance.Send("矫正重量", new object[] { CorrectPassway + 1, CorrectMatetailWeight });
  108. }));
  109. }
  110. }
  111. }