终端一体化运控平台
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

66 satır
2.7 KiB

  1. using BPASmartClient.CustomResource.Pages.Model;
  2. using BPASmartClient.CustomResource.UserControls;
  3. using BPASmartClient.CustomResource.UserControls.MessageShow;
  4. using BPASmartClient.Helper;
  5. using BPASmartClient.JXJFoodBigStation.Model;
  6. using BPASmartClient.JXJFoodBigStation.Model.Siemens;
  7. using Microsoft.Toolkit.Mvvm.ComponentModel;
  8. using Microsoft.Toolkit.Mvvm.Input;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Collections.ObjectModel;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Threading.Tasks;
  15. namespace BPASmartClient.JXJFoodBigStation.ViewModel
  16. {
  17. internal class RecipeSendDownViewModel:ObservableObject
  18. {
  19. public ObservableCollection<RecipeData> Recipes { get; set; } = Json<LocalRecipe>.Data.Recipes;
  20. /// <summary>
  21. /// 当前正在制作的配方
  22. /// </summary>
  23. public static ObservableCollection<RawMaterial> recipeProcesses { get; set; } = new ObservableCollection<RawMaterial>();
  24. /// <summary>
  25. /// 等待制作的配方
  26. /// </summary>
  27. public static ObservableCollection<RecipeData> UserTreeWait { get; set; } = new ObservableCollection<RecipeData>();
  28. /// <summary>
  29. /// 已完成的配方
  30. /// </summary>
  31. public static ObservableCollection<RecipeData> UserTreeCompelete { get; set; } = new ObservableCollection<RecipeData>();
  32. public RelayCommand<string> StartCommand { get; set; }
  33. public RecipeSendDownViewModel()
  34. {
  35. StartCommand = new RelayCommand<string>((recipeName) =>
  36. {
  37. if (recipeName != null)
  38. {
  39. if (GVL_BigStation.IsUseLocalRecipe)
  40. {
  41. //配方下发逻辑
  42. var res = Recipes.FirstOrDefault(p => p.RecipeName == recipeName);
  43. if (res != null)
  44. {
  45. if (!Json<RemoteRecipe>.Data.Recipes.Contains(res))
  46. {
  47. res.RecipesSource = RecipeSource.本地;
  48. Json<RemoteRecipe>.Data.Recipes.Add(res);
  49. MessageNotify.GetInstance.ShowRunLog($"手动下发配方:{recipeName}完成");
  50. NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"配方下发完成");
  51. }
  52. }
  53. }
  54. else
  55. {
  56. NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"未处于本地配方模式,无法下发配方");
  57. }
  58. }
  59. });
  60. }
  61. }
  62. }