终端一体化运控平台
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.
 
 
 

110 lines
3.6 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using BPA.Helper;
  7. using BPASmartClient.Model;
  8. using BPA.Helper;
  9. using BPASmartClient.MorkSVer3.Model;
  10. using System.Windows;
  11. namespace BPASmartClient.MorkSVer3.ViewModel
  12. {
  13. public class DebugViewModel : NotifyBase
  14. {
  15. public DebugViewModel()
  16. {
  17. InitCommand = new BPARelayCommand(() =>
  18. {
  19. ActionManage.GetInstance.Send("InitDevice");
  20. //ActionManage.GetInstance.Send("初始化设定煮面时间");
  21. });
  22. SimOrderCommand = new BPARelayCommand(() =>
  23. {
  24. new MorksSimorderModel() { Bowloc = this.BowlLoc, NoodleLoc = this.NoodleLoc }.Publish();
  25. });
  26. SimOrderRandomCommand = new BPARelayCommand(() =>
  27. {
  28. int NoodPosition = 0;
  29. int BowPosion = 0;
  30. NoodPosition = IsNoodPositon == true ? 0 : NoodleLoc;
  31. BowPosion = IsBowPositon == true ? 0 : BowlLoc;
  32. ActionManage.GetInstance.Send(new object[] { NoodPosition, BowPosion }, "EnableForOrder");
  33. });
  34. SimOrderRandomCloseCommand = new BPARelayCommand(() =>
  35. {
  36. TaskManage.GetInstance.StopTask("ForOrder");
  37. MessageLog.GetInstance.Show("停止模拟随机订单");
  38. });
  39. EnableLacalSimOrder = new BPARelayCommand(() =>
  40. {
  41. Global.EnableLocalSimOrder = LocalSimOrder;
  42. VisibilitySimOrder = LocalSimOrder == true ? Visibility.Visible : Visibility.Collapsed;
  43. });
  44. VisibilitySimOrder = LocalSimOrder == true ? Visibility.Visible : Visibility.Collapsed;
  45. }
  46. public BPARelayCommand InitCommand { get; set; }
  47. public BPARelayCommand SimOrderCommand { get; set; }
  48. public BPARelayCommand SimOrderRandomCommand { get; set; }
  49. public BPARelayCommand SimOrderRandomCloseCommand { get; set; }
  50. public BPARelayCommand EnableLacalSimOrder { get; set; }
  51. public int NoodleLoc
  52. {
  53. get { return _mNoodleLoc; }
  54. set
  55. {
  56. if (value <= 3 && value >= 1)
  57. {
  58. _mNoodleLoc = value;
  59. }
  60. else
  61. { _mNoodleLoc = 1; }
  62. OnPropertyChanged();
  63. }
  64. }
  65. private int _mNoodleLoc = 1;
  66. public int BowlLoc
  67. {
  68. get { return _mBowlLoc; }
  69. set
  70. {
  71. if (value == 10 || value == 11)
  72. {
  73. _mBowlLoc = value;
  74. }
  75. else
  76. {
  77. _mBowlLoc = 11;
  78. }
  79. OnPropertyChanged();
  80. }
  81. }
  82. private int _mBowlLoc = 11;
  83. public bool IsNoodPositon { get { return _isNoodPositon; } set { _isNoodPositon = value; OnPropertyChanged(); } }
  84. private bool _isNoodPositon = false;
  85. public bool IsBowPositon { get { return _isBowPositon; } set { _isBowPositon = value; OnPropertyChanged(); } }
  86. private bool _isBowPositon = false;
  87. public bool LocalSimOrder { get { return _localSimOrder; } set { _localSimOrder = value; OnPropertyChanged(); } }
  88. private bool _localSimOrder = Global.EnableLocalSimOrder;
  89. public Visibility VisibilitySimOrder { get { return _visibilitySimOrder; } set { _visibilitySimOrder = value; OnPropertyChanged(); } }
  90. private Visibility _visibilitySimOrder;
  91. }
  92. }