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

49 lines
1.9 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Microsoft.Toolkit.Mvvm.Input;
  7. using BPA.Helper;
  8. using System.Collections.ObjectModel;
  9. namespace BPASmartClient.SmallBatchingSystem.ViewModels
  10. {
  11. public class GrindArenaceousViewModel : BaseModel
  12. {
  13. public GrindArenaceousViewModel()
  14. {
  15. ActionManage.GetInstance.Register(new Action<object>((o) =>
  16. {
  17. if (o != null && o is RecipeStatus recipe)
  18. {
  19. int index = Array.FindIndex(Recipes.ToArray(), p => p.RawMaterialName == recipe.RawMaterialName);
  20. if (index >= 0 && index < Recipes.Count)
  21. {
  22. Recipes.ElementAt(index).Status = recipe.Status;
  23. Recipes.ElementAt(index).IsChecked = true;
  24. }
  25. }
  26. }), "StatusNotify", true);
  27. ActionManage.GetInstance.Register(new Action<object>((o) =>
  28. {
  29. if (o != null && o is RecipeInfo recipe)
  30. {
  31. RecipeName = recipe.RecipeName;
  32. recipe.SiloInfoModels.ToList()?.ForEach(x =>
  33. {
  34. Recipes.Add(new RecipeStatus() { RawMaterialName = x.SiloName, Status = "等待配料" });
  35. });
  36. }
  37. }), "OpenRecipeStatusMotion", true);
  38. CancelCommand = new RelayCommand(() => { Control.GetInstance.IsCancel = true; ActionManage.GetInstance.Send("GrindArenaceousCancel"); });
  39. }
  40. public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } }
  41. private string _mRecipeName;
  42. public ObservableCollection<RecipeStatus> Recipes { get; set; } = new ObservableCollection<RecipeStatus>();
  43. }
  44. }