终端一体化运控平台
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

128 rindas
7.1 KiB

  1. using BPASmartClient.Helper;
  2. using BPASmartClient.JXJFoodBigStation.Model;
  3. using BPASmartClient.JXJFoodBigStation.Model.HK_PLC;
  4. using BPASmartClient.JXJFoodBigStation.Model.Siemens;
  5. using Microsoft.Toolkit.Mvvm.ComponentModel;
  6. using Microsoft.Toolkit.Mvvm.Input;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Collections.ObjectModel;
  10. using System.ComponentModel;
  11. using System.Linq;
  12. using System.Reflection;
  13. using System.Runtime.CompilerServices;
  14. using System.Text;
  15. using System.Threading;
  16. using System.Threading.Tasks;
  17. namespace BPASmartClient.JXJFoodBigStation.ViewModel
  18. {
  19. public class ManualFlowViewModel:ObservableObject
  20. {
  21. public ManualFlowViewModel()
  22. {
  23. TrayInPlace = new RelayCommand<object>((o) =>
  24. {
  25. if (o != null)
  26. {
  27. byte loc = Convert.ToByte(o);
  28. GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(loc, true);
  29. }
  30. });
  31. TrayLeave = new RelayCommand<object>((o) =>
  32. {
  33. if (o!=null)
  34. {
  35. byte loc = Convert.ToByte(o);
  36. GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(loc, false);
  37. }
  38. });
  39. ClearTrayInPlace = new RelayCommand(() =>
  40. {
  41. GVL_BigStation.AGVPutTray = 0;
  42. });
  43. ClearAllRecipe = new RelayCommand(() =>
  44. {
  45. Json<RemoteRecipe>.Data.Recipes.Clear();
  46. GVL_BigStation.SiemensSendRecipeStatus = 0;
  47. });
  48. CancelRecipeCommand = new RelayCommand(() =>
  49. {
  50. if (Json<RemoteRecipe>.Data.Recipes != null)
  51. {
  52. int index = Array.FindIndex(Json<RemoteRecipe>.Data.Recipes.ToArray(), p => p.RecipeCode == CancelRecipeCode);
  53. if (index >= 0)
  54. {
  55. GVL_BigStation.Order_Cancel = true;
  56. GVL_BigStation.Order_CancelRecipeCode = CancelRecipeCode;
  57. }
  58. }
  59. });
  60. ThreadManage.GetInstance().StartLong(new Action(() =>
  61. {
  62. Heartbeat = GVL_BigStation.HeartBeatFromPlc;
  63. Thread.Sleep(100);
  64. StockBin1Name = GVL_BigStation.stockBinName.RawMaterialName1;
  65. StockBin2Name = GVL_BigStation.stockBinName.RawMaterialName2;
  66. StockBin3Name = GVL_BigStation.stockBinName.RawMaterialName3;
  67. StockBin4Name = GVL_BigStation.stockBinName.RawMaterialName4;
  68. StockBin5Name = GVL_BigStation.stockBinName.RawMaterialName5;
  69. StockBin6Name = GVL_BigStation.stockBinName.RawMaterialName6;
  70. StockBin7Name = GVL_BigStation.stockBinName.RawMaterialName7;
  71. StockBin8Name = GVL_BigStation.stockBinName.RawMaterialName8;
  72. StockBin9Name = GVL_BigStation.stockBinName.RawMaterialName9;
  73. StockBin10Name = GVL_BigStation.stockBinName.RawMaterialName10;
  74. StockBin11Name = GVL_BigStation.stockBinName.RawMaterialName11;
  75. StockBin12Name = GVL_BigStation.stockBinName.RawMaterialName12;
  76. StockBin13Name = GVL_BigStation.stockBinName.RawMaterialName13;
  77. StockBin14Name = GVL_BigStation.stockBinName.RawMaterialName14;
  78. }), "设备状态读取",true);
  79. }
  80. public RelayCommand<object> TrayInPlace { get; set; }
  81. public RelayCommand<object> TrayLeave { get; set; }
  82. public RelayCommand ClearTrayInPlace { get; set; }
  83. public RelayCommand ClearAllRecipe { get; set; }
  84. public static bool Heartbeat { get { return _mHeartbeat; } set { _mHeartbeat = value; OnStaticPropertyChanged(); } }
  85. private static bool _mHeartbeat;
  86. public string CancelRecipeCode { get { return _CancelRecipeCode; } set { _CancelRecipeCode = value; OnPropertyChanged(); } }
  87. public string _CancelRecipeCode { get; set; }
  88. public static string StockBin1Name { get { return _StockBin1Name; } set { _StockBin1Name = value; OnStaticPropertyChanged(); } }
  89. private static string _StockBin1Name { get; set; }
  90. public static string StockBin2Name { get { return _StockBin2Name; } set { _StockBin2Name = value; OnStaticPropertyChanged(); } }
  91. private static string _StockBin2Name { get; set; }
  92. public static string StockBin3Name { get { return _StockBin3Name; } set { _StockBin3Name = value; OnStaticPropertyChanged(); } }
  93. private static string _StockBin3Name { get; set; }
  94. public static string StockBin4Name { get { return _StockBin4Name; } set { _StockBin4Name = value; OnStaticPropertyChanged(); } }
  95. private static string _StockBin4Name { get; set; }
  96. public static string StockBin5Name { get { return _StockBin5Name; } set { _StockBin5Name = value; OnStaticPropertyChanged(); } }
  97. private static string _StockBin5Name { get; set; }
  98. public static string StockBin6Name { get { return _StockBin6Name; } set { _StockBin6Name = value; OnStaticPropertyChanged(); } }
  99. private static string _StockBin6Name { get; set; }
  100. public static string StockBin7Name { get { return _StockBin7Name; } set { _StockBin7Name = value; OnStaticPropertyChanged(); } }
  101. private static string _StockBin7Name { get; set; }
  102. public static string StockBin8Name { get { return _StockBin8Name; } set { _StockBin8Name = value; OnStaticPropertyChanged(); } }
  103. private static string _StockBin8Name { get; set; }
  104. public static string StockBin9Name { get { return _StockBin9Name; } set { _StockBin9Name = value; OnStaticPropertyChanged(); } }
  105. private static string _StockBin9Name { get; set; }
  106. public static string StockBin10Name { get { return _StockBin10Name; } set { _StockBin10Name = value; OnStaticPropertyChanged(); } }
  107. private static string _StockBin10Name { get; set; }
  108. public static string StockBin11Name { get { return _StockBin11Name; } set { _StockBin11Name = value; OnStaticPropertyChanged(); } }
  109. private static string _StockBin11Name { get; set; }
  110. public static string StockBin12Name { get { return _StockBin12Name; } set { _StockBin12Name = value; OnStaticPropertyChanged(); } }
  111. private static string _StockBin12Name { get; set; }
  112. public static string StockBin13Name { get { return _StockBin13Name; } set { _StockBin13Name = value; OnStaticPropertyChanged(); } }
  113. private static string _StockBin13Name { get; set; }
  114. public static string StockBin14Name { get { return _StockBin14Name; } set { _StockBin14Name = value; OnStaticPropertyChanged(); } }
  115. private static string _StockBin14Name { get; set; }
  116. public RelayCommand CancelRecipeCommand { get; set; }
  117. public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;
  118. public static void OnStaticPropertyChanged([CallerMemberName] string PropName = "")
  119. {
  120. StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(PropName));
  121. }
  122. }
  123. }