|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- using BPASmartClient.MorkMV1.Event;
- using System.Windows;
-
- namespace BPASmartClient.MorkMV1.ViewModel
- {
- public class DebugViewModel : NotifyBase
- {
- public DebugViewModel()
- {
- NoodleLoc = new();
- for (int i = 0; i < 5; i++)
- {
- NoodleLoc.Add(false);
- }
-
- InitCommand = new BPARelayCommand(() =>
- {
- ActionManage.GetInstance.Send("InitDevice");
- ActionManage.GetInstance.Send("初始化设定煮面时间");
- });
- SimOrderCommand = new BPARelayCommand(() =>
- {
-
- var noodleLocs = GetNoodelLocs();
- if (noodleLocs.Count==0)
- {
- MessageLog.GetInstance.Show("下发模拟订单失败,未选择素材。");
- return;
- }
- MessageLog.GetInstance.Show("下发模拟订单。");
- //new MorksSimorderModel() { Bowloc = this.BowlLoc, NoodleLoc = this.NoodleLoc }.Publish();
- new MorkMV1SimorderModel() { BowlLoc = this.BowlLoc, NoodleLoc = noodleLocs }.Publish();
- });
- SimOrderRandomCommand = new BPARelayCommand(() =>
- {
- List<int> NoodPosition;
- int BowPosion = 0;
- NoodPosition = IsNoodPositon == true ? new() : GetNoodelLocs();
- BowPosion = IsBowPositon == true ? 0 : BowlLoc;
-
- MessageLog.GetInstance.Show("开始自动模拟下发订单。");
-
- ActionManage.GetInstance.Send("EnableForOrder", new object[] { NoodPosition, BowPosion });
-
- });
- SimOrderRandomCloseCommand = new BPARelayCommand(() =>
- {
- TaskManage.GetInstance.StopTask("ForOrder");
- MessageLog.GetInstance.Show("停止模拟随机订单");
- });
- EnableLacalSimOrder = new BPARelayCommand(() =>
- {
- Global.EnableLocalSimOrder = LocalSimOrder;
- VisibilitySimOrder = LocalSimOrder == true ? Visibility.Visible : Visibility.Collapsed;
- });
- VisibilitySimOrder = LocalSimOrder == true ? Visibility.Visible : Visibility.Collapsed;
- }
-
- private List<int> GetNoodelLocs()
- {
- List<int> noodleLocs = new();
-
- for (int i = 0; i < NoodleLoc.Count; i++)
- {
- if (NoodleLoc[i])
- {
- for (int j = 0; j < MaterialCount; j++)
- {
- noodleLocs.Add(i + 1);
- }
- }
- }
- return noodleLocs;
- }
-
- public BPARelayCommand InitCommand { get; set; }
-
- public BPARelayCommand SimOrderCommand { get; set; }
-
- public BPARelayCommand SimOrderRandomCommand { get; set; }
-
- public BPARelayCommand SimOrderRandomCloseCommand { get; set; }
-
- public BPARelayCommand EnableLacalSimOrder { get; set; }
- //public int NoodleLoc { get { return _mNoodleLoc; } set { _mNoodleLoc = value; OnPropertyChanged(); } }
- //private int _mNoodleLoc = 1;
-
- public ObservableCollection<bool> NoodleLoc { get; set; }
-
- private int _materialCount = 1;
- /// <summary>素材份量</summary>
- public int MaterialCount
- {
- get { return _materialCount; }
- set { _materialCount = value; OnPropertyChanged(); }
- }
-
- public int BowlLoc
- { get { return _mBowlLoc; } set { _mBowlLoc = value; OnPropertyChanged(); } }
- private int _mBowlLoc = 11;
-
- public bool IsNoodPositon
- { get { return _isNoodPositon; } set { _isNoodPositon = value; OnPropertyChanged(); } }
- private bool _isNoodPositon = false;
-
- public bool IsBowPositon
- { get { return _isBowPositon; } set { _isBowPositon = value; OnPropertyChanged(); } }
- private bool _isBowPositon = false;
-
- public bool LocalSimOrder
- { get { return _localSimOrder; } set { _localSimOrder = value; OnPropertyChanged(); } }
- private bool _localSimOrder = Global.EnableLocalSimOrder;
-
- public Visibility VisibilitySimOrder
- { get { return _visibilitySimOrder; } set { _visibilitySimOrder = value; OnPropertyChanged(); } }
- private Visibility _visibilitySimOrder;
- }
- }
|