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

118 line
4.3 KiB

  1. using BPASmartClient.MorkMV1.Event;
  2. using System.Windows;
  3. namespace BPASmartClient.MorkMV1.ViewModel
  4. {
  5. public class DebugViewModel : NotifyBase
  6. {
  7. public DebugViewModel()
  8. {
  9. NoodleLoc = new();
  10. for (int i = 0; i < 5; i++)
  11. {
  12. NoodleLoc.Add(false);
  13. }
  14. InitCommand = new BPARelayCommand(() =>
  15. {
  16. ActionManage.GetInstance.Send("InitDevice");
  17. ActionManage.GetInstance.Send("初始化设定煮面时间");
  18. });
  19. SimOrderCommand = new BPARelayCommand(() =>
  20. {
  21. var noodleLocs = GetNoodelLocs();
  22. if (noodleLocs.Count==0)
  23. {
  24. MessageLog.GetInstance.Show("下发模拟订单失败,未选择素材。");
  25. return;
  26. }
  27. MessageLog.GetInstance.Show("下发模拟订单。");
  28. //new MorksSimorderModel() { Bowloc = this.BowlLoc, NoodleLoc = this.NoodleLoc }.Publish();
  29. new MorkMV1SimorderModel() { BowlLoc = this.BowlLoc, NoodleLoc = noodleLocs }.Publish();
  30. });
  31. SimOrderRandomCommand = new BPARelayCommand(() =>
  32. {
  33. List<int> NoodPosition;
  34. int BowPosion = 0;
  35. NoodPosition = IsNoodPositon == true ? new() : GetNoodelLocs();
  36. BowPosion = IsBowPositon == true ? 0 : BowlLoc;
  37. MessageLog.GetInstance.Show("开始自动模拟下发订单。");
  38. ActionManage.GetInstance.Send("EnableForOrder", new object[] { NoodPosition, BowPosion });
  39. });
  40. SimOrderRandomCloseCommand = new BPARelayCommand(() =>
  41. {
  42. TaskManage.GetInstance.StopTask("ForOrder");
  43. MessageLog.GetInstance.Show("停止模拟随机订单");
  44. });
  45. EnableLacalSimOrder = new BPARelayCommand(() =>
  46. {
  47. Global.EnableLocalSimOrder = LocalSimOrder;
  48. VisibilitySimOrder = LocalSimOrder == true ? Visibility.Visible : Visibility.Collapsed;
  49. });
  50. VisibilitySimOrder = LocalSimOrder == true ? Visibility.Visible : Visibility.Collapsed;
  51. }
  52. private List<int> GetNoodelLocs()
  53. {
  54. List<int> noodleLocs = new();
  55. for (int i = 0; i < NoodleLoc.Count; i++)
  56. {
  57. if (NoodleLoc[i])
  58. {
  59. for (int j = 0; j < MaterialCount; j++)
  60. {
  61. noodleLocs.Add(i + 1);
  62. }
  63. }
  64. }
  65. return noodleLocs;
  66. }
  67. public BPARelayCommand InitCommand { get; set; }
  68. public BPARelayCommand SimOrderCommand { get; set; }
  69. public BPARelayCommand SimOrderRandomCommand { get; set; }
  70. public BPARelayCommand SimOrderRandomCloseCommand { get; set; }
  71. public BPARelayCommand EnableLacalSimOrder { get; set; }
  72. //public int NoodleLoc { get { return _mNoodleLoc; } set { _mNoodleLoc = value; OnPropertyChanged(); } }
  73. //private int _mNoodleLoc = 1;
  74. public ObservableCollection<bool> NoodleLoc { get; set; }
  75. private int _materialCount = 1;
  76. /// <summary>素材份量</summary>
  77. public int MaterialCount
  78. {
  79. get { return _materialCount; }
  80. set { _materialCount = value; OnPropertyChanged(); }
  81. }
  82. public int BowlLoc
  83. { get { return _mBowlLoc; } set { _mBowlLoc = value; OnPropertyChanged(); } }
  84. private int _mBowlLoc = 11;
  85. public bool IsNoodPositon
  86. { get { return _isNoodPositon; } set { _isNoodPositon = value; OnPropertyChanged(); } }
  87. private bool _isNoodPositon = false;
  88. public bool IsBowPositon
  89. { get { return _isBowPositon; } set { _isBowPositon = value; OnPropertyChanged(); } }
  90. private bool _isBowPositon = false;
  91. public bool LocalSimOrder
  92. { get { return _localSimOrder; } set { _localSimOrder = value; OnPropertyChanged(); } }
  93. private bool _localSimOrder = Global.EnableLocalSimOrder;
  94. public Visibility VisibilitySimOrder
  95. { get { return _visibilitySimOrder; } set { _visibilitySimOrder = value; OnPropertyChanged(); } }
  96. private Visibility _visibilitySimOrder;
  97. }
  98. }