using BPASmartClient.Helper; using BPASmartClient.JXJFoodBigStation.Model; using BPASmartClient.JXJFoodBigStation.Model.HK_PLC; using BPASmartClient.JXJFoodBigStation.Model.Siemens; using Microsoft.Toolkit.Mvvm.ComponentModel; using Microsoft.Toolkit.Mvvm.Input; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Text; using System.Threading; using System.Threading.Tasks; namespace BPASmartClient.JXJFoodBigStation.ViewModel { public class ManualFlowViewModel:ObservableObject { public ManualFlowViewModel() { TrayInPlace = new RelayCommand((o) => { if (o != null) { byte loc = Convert.ToByte(o); GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(loc, true); } }); TrayLeave = new RelayCommand((o) => { if (o!=null) { byte loc = Convert.ToByte(o); GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(loc, false); } }); ClearTrayInPlace = new RelayCommand(() => { GVL_BigStation.AGVPutTray = 0; }); ClearAllRecipe = new RelayCommand(() => { Json.Data.Recipes.Clear(); GVL_BigStation.SiemensSendRecipeStatus = 0; }); CancelRecipeCommand = new RelayCommand(() => { if (Json.Data.Recipes != null) { int index = Array.FindIndex(Json.Data.Recipes.ToArray(), p => p.RecipeCode == CancelRecipeCode); if (index >= 0) { GVL_BigStation.Order_Cancel = true; GVL_BigStation.Order_CancelRecipeCode = CancelRecipeCode; } } }); ThreadManage.GetInstance().StartLong(new Action(() => { Heartbeat = GVL_BigStation.HeartBeatFromPlc; Thread.Sleep(100); StockBin1Name = GVL_BigStation.stockBinName.RawMaterialName1; StockBin2Name = GVL_BigStation.stockBinName.RawMaterialName2; StockBin3Name = GVL_BigStation.stockBinName.RawMaterialName3; StockBin4Name = GVL_BigStation.stockBinName.RawMaterialName4; StockBin5Name = GVL_BigStation.stockBinName.RawMaterialName5; StockBin6Name = GVL_BigStation.stockBinName.RawMaterialName6; StockBin7Name = GVL_BigStation.stockBinName.RawMaterialName7; StockBin8Name = GVL_BigStation.stockBinName.RawMaterialName8; StockBin9Name = GVL_BigStation.stockBinName.RawMaterialName9; StockBin10Name = GVL_BigStation.stockBinName.RawMaterialName10; StockBin11Name = GVL_BigStation.stockBinName.RawMaterialName11; StockBin12Name = GVL_BigStation.stockBinName.RawMaterialName12; StockBin13Name = GVL_BigStation.stockBinName.RawMaterialName13; StockBin14Name = GVL_BigStation.stockBinName.RawMaterialName14; }), "设备状态读取",true); } public RelayCommand TrayInPlace { get; set; } public RelayCommand TrayLeave { get; set; } public RelayCommand ClearTrayInPlace { get; set; } public RelayCommand ClearAllRecipe { get; set; } public static bool Heartbeat { get { return _mHeartbeat; } set { _mHeartbeat = value; OnStaticPropertyChanged(); } } private static bool _mHeartbeat; public string CancelRecipeCode { get { return _CancelRecipeCode; } set { _CancelRecipeCode = value; OnPropertyChanged(); } } public string _CancelRecipeCode { get; set; } public static string StockBin1Name { get { return _StockBin1Name; } set { _StockBin1Name = value; OnStaticPropertyChanged(); } } private static string _StockBin1Name { get; set; } public static string StockBin2Name { get { return _StockBin2Name; } set { _StockBin2Name = value; OnStaticPropertyChanged(); } } private static string _StockBin2Name { get; set; } public static string StockBin3Name { get { return _StockBin3Name; } set { _StockBin3Name = value; OnStaticPropertyChanged(); } } private static string _StockBin3Name { get; set; } public static string StockBin4Name { get { return _StockBin4Name; } set { _StockBin4Name = value; OnStaticPropertyChanged(); } } private static string _StockBin4Name { get; set; } public static string StockBin5Name { get { return _StockBin5Name; } set { _StockBin5Name = value; OnStaticPropertyChanged(); } } private static string _StockBin5Name { get; set; } public static string StockBin6Name { get { return _StockBin6Name; } set { _StockBin6Name = value; OnStaticPropertyChanged(); } } private static string _StockBin6Name { get; set; } public static string StockBin7Name { get { return _StockBin7Name; } set { _StockBin7Name = value; OnStaticPropertyChanged(); } } private static string _StockBin7Name { get; set; } public static string StockBin8Name { get { return _StockBin8Name; } set { _StockBin8Name = value; OnStaticPropertyChanged(); } } private static string _StockBin8Name { get; set; } public static string StockBin9Name { get { return _StockBin9Name; } set { _StockBin9Name = value; OnStaticPropertyChanged(); } } private static string _StockBin9Name { get; set; } public static string StockBin10Name { get { return _StockBin10Name; } set { _StockBin10Name = value; OnStaticPropertyChanged(); } } private static string _StockBin10Name { get; set; } public static string StockBin11Name { get { return _StockBin11Name; } set { _StockBin11Name = value; OnStaticPropertyChanged(); } } private static string _StockBin11Name { get; set; } public static string StockBin12Name { get { return _StockBin12Name; } set { _StockBin12Name = value; OnStaticPropertyChanged(); } } private static string _StockBin12Name { get; set; } public static string StockBin13Name { get { return _StockBin13Name; } set { _StockBin13Name = value; OnStaticPropertyChanged(); } } private static string _StockBin13Name { get; set; } public static string StockBin14Name { get { return _StockBin14Name; } set { _StockBin14Name = value; OnStaticPropertyChanged(); } } private static string _StockBin14Name { get; set; } public RelayCommand CancelRecipeCommand { get; set; } public static event EventHandler StaticPropertyChanged; public static void OnStaticPropertyChanged([CallerMemberName] string PropName = "") { StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(PropName)); } } }