|
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Microsoft.Toolkit.Mvvm.ComponentModel;
- using System.Collections.ObjectModel;
- using BPASmartClient.JXJFoodSmallStation.Model;
- using BPASmartClient.Helper;
- using Microsoft.Toolkit.Mvvm.Input;
- using BPASmartClient.CustomResource.UserControls.MessageShow;
- using BPASmartClient.CustomResource.UserControls;
- using System.Diagnostics;
- using BPASmartClient.JXJFoodSmallStation.Model.Siemens;
- using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC;
- using System.Threading;
- using System.ComponentModel;
- using System.Runtime.CompilerServices;
- using BPASmartClient.CustomResource.Pages.Model;
-
- namespace BPASmartClient.JXJFoodSmallStation.ViewModel
- {
- public class RobotViewModel : ObservableObject
- {
- public RobotViewModel()
- {
- ThreadManage.GetInstance().StartLong(() =>
- {
- IsRunProgramNum = GVL_SmallStation.GetInstance.RobotProgramNum;
- RobotIsAutoMode = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(2);
- RobotIsAutoRun = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(3);
- RobotIsStop = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(4);
- RobotIsRun = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(5);
- RobotIsAlarm = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(6);
- RobotIsHomed = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(7);
- //RobotGetEmptyBarrelComplete = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(8);
- //RobotPutEmptyBarrelComplete = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(9);
- //RobotGetFullBarrelComplete = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(10);
- //RobotPutFullBarrelComplete = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(11);
-
- Thread.Sleep(10);
-
- },"机器人状态",true);
- SystemStart = new RelayCommand(() => {
- ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX0.1");
- MessageNotify.GetInstance.ShowUserLog($"手动控制,机器人启动");
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"机器人启动,操作完成!");
- });
- SystemStop = new RelayCommand(() => {
- ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX0.2");
- MessageNotify.GetInstance.ShowUserLog($"手动控制,机器人停止");
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"机器人停止,操作完成!");
- });
- EStopReset = new RelayCommand(() => {
- ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX0.3");
- MessageNotify.GetInstance.ShowUserLog($"手动控制,机器人急停复位");
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"机器人急停复位,操作完成!");
- });
-
- //TestRobotRun = new RelayCommand(() => {
- // ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX100.4");
- //});
- //AutoMode = new RelayCommand(() => {
- // ActionManage.GetInstance.Send("RobotSendFalseCommand", "DB4.DBX100.3");
- //});
- //TestMode = new RelayCommand(() => {
- // ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX100.3");
- //});
-
- //RobotGetEmptyBarrel = new RelayCommand(() => {
- // ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX100.7");
- //});
- //RobotPutEmptyBarrel = new RelayCommand(() => {
- // ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX101.0");
- //});
- //RobotGetFullBarrel = new RelayCommand(() => {
- // ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX101.1");
- //});
- //RobotPutFullBarrel = new RelayCommand(() => {
- // ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX101.2");
- //});
- //SetProgramNumCommand = new RelayCommand(() =>{
- // ActionManage.GetInstance.Send("RobotSetProgramNum", SetProgramNum);
- //});
- }
- public RelayCommand SystemStart { get; set; }
- public RelayCommand SystemStop { get; set; }
- public RelayCommand EStopReset { get; set; }
-
- public RelayCommand TestRobotRun { get; set; }
- public RelayCommand AutoMode { get; set; }
- public RelayCommand TestMode { get; set; }
-
- public RelayCommand RobotGetEmptyBarrel { get; set; }
- public RelayCommand RobotPutEmptyBarrel { get; set; }
- public RelayCommand RobotGetFullBarrel { get; set; }
- public RelayCommand RobotPutFullBarrel { get; set; }
- public RelayCommand SetProgramNumCommand { get; set; }
-
- public static short IsRunProgramNum { get { return _runProgramNum; } set { _runProgramNum = value; OnStaticPropertyChanged(); } }
- private static short _runProgramNum;
- public short SetProgramNum { get { return _SetProgramNum; } set { _SetProgramNum = value; OnPropertyChanged(); } }
- private short _SetProgramNum;
-
- public static bool RobotIsAutoMode { get { return _RobotIsAutoMode; } set { _RobotIsAutoMode = value; OnStaticPropertyChanged(); } }
- private static bool _RobotIsAutoMode;
- public static bool RobotIsAutoRun { get { return _RobotIsAutoRun; } set { _RobotIsAutoRun = value; OnStaticPropertyChanged(); } }
- private static bool _RobotIsAutoRun;
- public static bool RobotIsStop { get { return _RobotIsStop; } set { _RobotIsStop = value; OnStaticPropertyChanged(); } }
- private static bool _RobotIsStop;
- public static bool RobotIsRun { get { return _RobotIsRun; } set { _RobotIsRun = value; OnStaticPropertyChanged(); } }
- private static bool _RobotIsRun;
- public static bool RobotIsAlarm { get { return _RobotIsAlarm; } set { _RobotIsAlarm = value; OnStaticPropertyChanged(); } }
- private static bool _RobotIsAlarm;
- public static bool RobotIsHomed { get { return _RobotIsHomed; } set { _RobotIsHomed = value; OnStaticPropertyChanged(); } }
- private static bool _RobotIsHomed;
- public bool RobotGetEmptyBarrelComplete { get { return _RobotGetEmptyBarrelComplete; } set { _RobotGetEmptyBarrelComplete = value; OnPropertyChanged(); } }
- private bool _RobotGetEmptyBarrelComplete;
- public bool RobotPutEmptyBarrelComplete { get { return _RobotPutEmptyBarrelComplete; } set { _RobotPutEmptyBarrelComplete = value; OnPropertyChanged(); } }
- private bool _RobotPutEmptyBarrelComplete;
- public bool RobotGetFullBarrelComplete { get { return _RobotGetFullBarrelComplete; } set { _RobotGetFullBarrelComplete = value; OnPropertyChanged(); } }
- private bool _RobotGetFullBarrelComplete;
-
- public bool RobotPutFullBarrelComplete { get { return _RobotPutFullBarrelComplete; } set { _RobotPutFullBarrelComplete = value; OnPropertyChanged(); } }
- private bool _RobotPutFullBarrelComplete;
-
-
- public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;
- public static void OnStaticPropertyChanged([CallerMemberName] string PropName = "")
- {
- StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(PropName));
- }
- }
- }
|