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

72 lines
2.2 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using BPASmartClient.MorkCL.Model.DataInfo;
  8. namespace BPASmartClient.MorkCL.ViewModel
  9. {
  10. public class AddRawMaterialViewModel:NotifyBase
  11. {
  12. public AddRawMaterialViewModel()
  13. {
  14. InitialTestData();
  15. RemoveAccessoryCommand = new BPARelayCommand<string>((Id) =>
  16. {
  17. Accessories.Remove(Accessories.FirstOrDefault(a=>a.Id==Id));
  18. });
  19. }
  20. private void InitialTestData()
  21. {
  22. Accessories = new ObservableCollection<AccessoriesInfo>();
  23. for (int i = 0; i < 8; i++)
  24. {
  25. Accessories.Add(new AccessoriesInfo() { Id = i.ToString(), Name = $"第{i}样", Loc = i });
  26. }
  27. Ingredients = new();
  28. for (int i = 0; i < 12; i++)
  29. {
  30. Ingredients.Add(new IngredientsInfo() { Id = i.ToString(), Name = $"第{i}样"});
  31. }
  32. Seasonings = new();
  33. for (int i = 0; i < 3; i++)
  34. {
  35. Seasonings.Add(new SeasoningInfo() { Id = i.ToString(), Name = $"第{i}样", Loc = i });
  36. }
  37. }
  38. /// <summary>
  39. /// 辅料信息集合
  40. /// </summary>
  41. public ObservableCollection<AccessoriesInfo> Accessories { get; set; }
  42. /// <summary>
  43. /// 主料信息集合
  44. /// </summary>
  45. public ObservableCollection<IngredientsInfo> Ingredients { get; set; }
  46. /// <summary>
  47. /// 调料信息集合
  48. /// </summary>
  49. public ObservableCollection<SeasoningInfo> Seasonings { get; set; }
  50. /// <summary>
  51. /// 删除辅料信息
  52. /// </summary>
  53. public BPARelayCommand<string> RemoveAccessoryCommand { get;set; }
  54. /// <summary>
  55. /// 删除主料信息
  56. /// </summary>
  57. public BPARelayCommand<string> RemoveIngreditentCommand { get; set; }
  58. /// <summary>
  59. /// 删除调料信息
  60. /// </summary>
  61. public BPARelayCommand<string> RemoveSeasoningCommand { get; set; }
  62. }
  63. }