终端一体化运控平台
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

55 строки
2.1 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. using BPASmartClient.CustomResource.Pages.Model;
  10. namespace BPASmartClient.SmallBatchingSystem.ViewModels
  11. {
  12. public class GrindArenaceousViewModel : BaseModel
  13. {
  14. public GrindArenaceousViewModel()
  15. {
  16. ActionManage.GetInstance.Register(new Action<object>((o) =>
  17. {
  18. if (o != null && o is RecipeStatus recipe)
  19. {
  20. int index = Array.FindIndex(Recipes.ToArray(), p => p.RawMaterialName == recipe.RawMaterialName);
  21. if (index >= 0 && index < Recipes.Count)
  22. {
  23. Recipes.ElementAt(index).Status = recipe.Status;
  24. Recipes.ElementAt(index).IsChecked = true;
  25. }
  26. }
  27. }), "StatusNotify", true);
  28. ActionManage.GetInstance.Register(new Action<object>((o) =>
  29. {
  30. if (o != null && o is RecipeInfo recipe)
  31. {
  32. RecipeName = recipe.RecipeName;
  33. recipe.SiloInfoModels.ToList()?.ForEach(x =>
  34. {
  35. Recipes.Add(new RecipeStatus() { RawMaterialName = x.SiloName, Status = "等待配料" });
  36. });
  37. }
  38. }), "OpenRecipeStatusMotion", true);
  39. CancelCommand = new RelayCommand(() =>
  40. {
  41. if (MessageNotify.GetInstance.ShowDialog($"是否取消配方制作,取消后设备将终止配料过程!", DialogType.Warning))
  42. {
  43. Control.GetInstance.IsCancel = true; ActionManage.GetInstance.Send("GrindArenaceousCancel");
  44. }
  45. });
  46. }
  47. public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } }
  48. private string _mRecipeName;
  49. public ObservableCollection<RecipeStatus> Recipes { get; set; } = new ObservableCollection<RecipeStatus>();
  50. }
  51. }