|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- 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.WindSend;
- using BPASmartClient.JXJFoodSmallStation.Model.Par;
- using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC;
- using BPASmartClient.CustomResource.Pages.Model;
-
- namespace BPASmartClient.JXJFoodSmallStation.ViewModel
- {
- public class SystemParViewModel : NotifyBase
- {
- public SystemParViewModel()
- {
- SiemensConnect = Json<DevicePar>.Data.deviceConnectPar.SiemensConnect;
- WindSendConnect = Json<DevicePar>.Data.deviceConnectPar.WindSendConnect;
- HKPlcConnect = Json<DevicePar>.Data.deviceConnectPar.HKPlcConnect;
- ShieldStockbinAlarm = Json<DevicePar>.Data.deviceConnectPar.ShieldStockbinAlarm;
-
- AxisLoadSpeed = Json<DevicePar>.Data.deviceConnectPar.AxisLoadSpeed;
- AxisMidSpeed = Json<DevicePar>.Data.deviceConnectPar.AxisMidSpeed;
- AxisUnLoadSpeed = Json<DevicePar>.Data.deviceConnectPar.AxisUnLoadSpeed;
- AxisMidSpeed = Json<DevicePar>.Data.deviceConnectPar.AxisMidSpeed;
- Axis1Speed = Json<DevicePar>.Data.deviceConnectPar.Axis1Speed;
- Axis2Speed = Json<DevicePar>.Data.deviceConnectPar.Axis2Speed;
- SaveCommand = new BPARelayCommand(() =>
- {
- Json<DevicePar>.Data.deviceConnectPar.SiemensConnect = SiemensConnect;
- Json<DevicePar>.Data.deviceConnectPar.WindSendConnect = WindSendConnect;
- Json<DevicePar>.Data.deviceConnectPar.HKPlcConnect = HKPlcConnect;
- Json<DevicePar>.Data.deviceConnectPar.ShieldStockbinAlarm = ShieldStockbinAlarm;
-
- Json<DevicePar>.Data.deviceConnectPar.AxisLoadSpeed = AxisLoadSpeed;
- Json<DevicePar>.Data.deviceConnectPar.AxisMidSpeed = AxisMidSpeed;
- Json<DevicePar>.Data.deviceConnectPar.AxisUnLoadSpeed = AxisUnLoadSpeed;
- Json<DevicePar>.Data.deviceConnectPar.AxisMidSpeed = AxisMidSpeed;
- Json<DevicePar>.Data.deviceConnectPar.Axis1Speed = Axis1Speed;
- Json<DevicePar>.Data.deviceConnectPar.Axis2Speed = Axis2Speed;
- Json<DevicePar>.Save();
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"系统设置参数保存成功!");
- MessageNotify.GetInstance.ShowUserLog("保存系统设置参数。");
- });
- SetParCommand = new BPARelayCommand(() =>
- {
- ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB47.DBD0", PlcVarType = PlcVarType.Real, Value = Axis1Speed });
- ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB47.DBD4", PlcVarType = PlcVarType.Real, Value = Axis2Speed });
- ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB47.DBW8", PlcVarType = PlcVarType.Int, Value = AxisLoadSpeed });
- ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB47.DBW10", PlcVarType = PlcVarType.Int, Value = AxisMidSpeed });
- ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB47.DBW12", PlcVarType = PlcVarType.Int, Value = AxisUnLoadSpeed });
-
- //ActionManage.GetInstance.Send("AxisLoadSpeedSet", AxisLoadSpeed);
- //ActionManage.GetInstance.Send("AxisMidSpeedSet", AxisMidSpeed);
- //ActionManage.GetInstance.Send("AxisUnLoadSpeedSet", AxisUnLoadSpeed);
- //ActionManage.GetInstance.Send("Axis1SpeedSet", Axis1Speed);
- //ActionManage.GetInstance.Send("Axis2SpeedSet", Axis2Speed);
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"电机参数设置成功!");
- MessageNotify.GetInstance.ShowUserLog("电机设置参数下发成功。");
- });
- }
-
- public ConnectParMode CommBaseParModel { get { return Json<DevicePar>.Data.deviceConnectPar; } set { Json<DevicePar>.Data.deviceConnectPar = value; OnPropertyChanged(); } }
-
- public bool SiemensConnect { get { return _mSiemensConnect; } set { _mSiemensConnect = value; OnPropertyChanged(); } }
- private bool _mSiemensConnect;
- public bool WindSendConnect { get { return _mWindSendConnect; } set { _mWindSendConnect = value; OnPropertyChanged(); } }
- private bool _mWindSendConnect;
- public bool HKPlcConnect { get { return _mHKPlcConnect; } set { _mHKPlcConnect = value; OnPropertyChanged(); } }
- private bool _mHKPlcConnect;
- public bool ShieldStockbinAlarm { get { return _mShieldStockbinAlarm; } set { _mShieldStockbinAlarm = value; OnPropertyChanged(); } }
- private bool _mShieldStockbinAlarm;
-
- public short AxisLoadSpeed { get { return _mAxisLoadSpeed; } set { _mAxisLoadSpeed = value; OnPropertyChanged(); } }
- private short _mAxisLoadSpeed;
- public short AxisMidSpeed { get { return _mAxisMidSpeed; } set { _mAxisMidSpeed = value; OnPropertyChanged(); } }
- private short _mAxisMidSpeed;
- public short AxisUnLoadSpeed { get { return _mAxisUnLoadSpeed; } set { _mAxisUnLoadSpeed = value; OnPropertyChanged(); } }
- private short _mAxisUnLoadSpeed;
- public float Axis1Speed { get { return _mAxis1Speed; } set { _mAxis1Speed = value; OnPropertyChanged(); } }
- private float _mAxis1Speed;
- public float Axis2Speed { get { return _mAxis2Speed; } set { _mAxis2Speed = value; OnPropertyChanged(); } }
- private float _mAxis2Speed;
- public BPARelayCommand SaveCommand { get; set; }
- public BPARelayCommand SetParCommand { get; set; }
-
- }
- }
|