|
- using BPASmartClient.CustomResource.Pages.Model;
- using BPASmartClient.CustomResource.UserControls;
- using BPASmartClient.CustomResource.UserControls.MessageShow;
- using BPA.Helper;
- using BPASmartClient.JXJFoodBigStation.Model;
- using BPASmartClient.JXJFoodBigStation.Model.HK_PLC;
- using BPASmartClient.JXJFoodBigStation.Model.Siemens;
- using BPA.Helper;
-
- 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:NotifyBase
- {
- public ManualFlowViewModel()
- {
- TrayInPlace = new BPARelayCommand<object>((o) =>
- {
- if (o != null)
- {
- byte loc = Convert.ToByte(o);
- GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(loc, true);
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"操作成功");
- MessageNotify.GetInstance.ShowUserLog($"手动点击AGV到达工位{loc}。");
- }
- });
- TrayLeave = new BPARelayCommand<object>((o) =>
- {
- if (o!=null)
- {
- byte loc = Convert.ToByte(o);
- GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(loc, false);
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"操作成功");
- MessageNotify.GetInstance.ShowUserLog($"手动点击AGV离开工位{loc}。");
- }
- });
- ClearTrayInPlace = new BPARelayCommand(() =>
- {
- GVL_BigStation.AGVPutTray = 0;
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"操作成功");
- MessageNotify.GetInstance.ShowUserLog($"手动点击清除AGV到位信号按钮。");
- });
- ClearAllRecipe = new BPARelayCommand(() =>
- {
- if (!MessageNotify.GetInstance.ShowDialog($"请确认,是否清除所有西门子配方?",DialogType.Warning))
- {
- return;
- }
- Json<RemoteRecipe>.Data.Recipes.Clear();
- GVL_BigStation.SiemensSendRecipeStatus = 0;
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"清除所有配方完成");
- MessageNotify.GetInstance.ShowUserLog($"手动清除所有西门子配方。");
- });
- CancelRecipeCommand = new BPARelayCommand(() =>
- {
- if (!MessageNotify.GetInstance.ShowDialog($"请确认,是否取消订单【{CancelRecipeCode}】?", DialogType.Warning))
- {
- return;
- }
-
- if (Json<RemoteRecipe>.Data.Recipes != null)
- {
- int index = Array.FindIndex(Json<RemoteRecipe>.Data.Recipes.ToArray(), p => p.RecipeCode == CancelRecipeCode);
- if (index >= 0)
- {
- GVL_BigStation.Order_Cancel = true;
- GVL_BigStation.Order_CancelRecipeCode = CancelRecipeCode;
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"订单取消完成");
- MessageNotify.GetInstance.ShowUserLog($"手动取消订单【{CancelRecipeCode}】。");
- }
- }
- });
- TaskManage.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 BPARelayCommand<object> TrayInPlace { get; set; }
- public BPARelayCommand<object> TrayLeave { get; set; }
- public BPARelayCommand ClearTrayInPlace { get; set; }
- public BPARelayCommand 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 BPARelayCommand CancelRecipeCommand { get; set; }
-
- public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;
- public static void OnStaticPropertyChanged([CallerMemberName] string PropName = "")
- {
- StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(PropName));
- }
- }
- }
|