|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using BPA.Helper;
- using System.Collections.ObjectModel;
- using BPASmartClient.JXJFoodSmallStation.Model;
- using BPA.Helper;
-
- 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 : NotifyBase
- {
- public RobotViewModel()
- {
- TaskManage.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 BPARelayCommand(() => {
- ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX0.1");
- MessageNotify.GetInstance.ShowUserLog($"手动控制,机器人启动");
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"机器人启动,操作完成!");
- });
- SystemStop = new BPARelayCommand(() => {
- ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX0.2");
- MessageNotify.GetInstance.ShowUserLog($"手动控制,机器人停止");
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"机器人停止,操作完成!");
- });
- EStopReset = new BPARelayCommand(() => {
- ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX0.3");
- MessageNotify.GetInstance.ShowUserLog($"手动控制,机器人急停复位");
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"机器人急停复位,操作完成!");
- });
-
- //TestRobotRun = new BPARelayCommand(() => {
- // ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX100.4");
- //});
- //AutoMode = new BPARelayCommand(() => {
- // ActionManage.GetInstance.Send("RobotSendFalseCommand", "DB4.DBX100.3");
- //});
- //TestMode = new BPARelayCommand(() => {
- // ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX100.3");
- //});
-
- //RobotGetEmptyBarrel = new BPARelayCommand(() => {
- // ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX100.7");
- //});
- //RobotPutEmptyBarrel = new BPARelayCommand(() => {
- // ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX101.0");
- //});
- //RobotGetFullBarrel = new BPARelayCommand(() => {
- // ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX101.1");
- //});
- //RobotPutFullBarrel = new BPARelayCommand(() => {
- // ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX101.2");
- //});
- //SetProgramNumCommand = new BPARelayCommand(() =>{
- // ActionManage.GetInstance.Send("RobotSetProgramNum", SetProgramNum);
- //});
- }
- public BPARelayCommand SystemStart { get; set; }
- public BPARelayCommand SystemStop { get; set; }
- public BPARelayCommand EStopReset { get; set; }
-
- public BPARelayCommand TestRobotRun { get; set; }
- public BPARelayCommand AutoMode { get; set; }
- public BPARelayCommand TestMode { get; set; }
-
- public BPARelayCommand RobotGetEmptyBarrel { get; set; }
- public BPARelayCommand RobotPutEmptyBarrel { get; set; }
- public BPARelayCommand RobotGetFullBarrel { get; set; }
- public BPARelayCommand RobotPutFullBarrel { get; set; }
- public BPARelayCommand 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));
- }
- }
- }
|