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

51 lines
1.9 KiB

  1. using BPA.Helper;
  2. using BPASmartClient.MorkS.Model;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Collections.ObjectModel;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. namespace BPASmartClient.MorkS.ViewModel
  11. {
  12. internal class GoodsEditViewModel : NotifyBase
  13. {
  14. private string _orderNum { get; set; }
  15. public string OrderNum { get { return _orderNum; } set { _orderNum = value; OnPropertyChanged(); } }
  16. private string _goodsName = "板面";
  17. public string GoodsName { get { return _goodsName; } set { _goodsName = value; OnPropertyChanged(); } }
  18. public ObservableCollection<bool> bowlLocs { get; set; } = new ObservableCollection<bool>() { false, false };
  19. public ObservableCollection<bool> noodlesLocs { get; set; } = new ObservableCollection<bool>() { false, false, false, false, false };
  20. public BPARelayCommand ConfirmCommand { get; set; }
  21. public GoodsEditViewModel()
  22. {
  23. ConfirmCommand = new BPARelayCommand(() =>
  24. {
  25. GoodsModel goods = new GoodsModel();
  26. goods.OrderNum = Guid.NewGuid().ToString("D");
  27. goods.GoodsName = GoodsName;
  28. var bLoc = bowlLocs.ToList().FindIndex(p => p == true);
  29. var noLoc = noodlesLocs.ToList().FindIndex(p => p == true);
  30. if (bLoc != -1 && noLoc != -1)
  31. {
  32. goods.BowlLoc = bLoc + 10;
  33. goods.NoodlesLoc = noLoc + 1;
  34. }
  35. else
  36. {
  37. MessageBox.Show("请选择面位置或碗类型", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
  38. return;
  39. }
  40. ActionManage.GetInstance.Send(goods, "orderEdit");
  41. ActionManage.GetInstance.Send("CloseEditWindow");
  42. });
  43. }
  44. }
  45. }