SV2功能增加
一些功能的修复
This commit is contained in:
162
CapMachine.Wpf/ViewModels/DialogMeterExdViewModel.cs
Normal file
162
CapMachine.Wpf/ViewModels/DialogMeterExdViewModel.cs
Normal file
@@ -0,0 +1,162 @@
|
||||
using CapMachine.Core;
|
||||
using CapMachine.Wpf.Dtos;
|
||||
using CapMachine.Wpf.Models;
|
||||
using CapMachine.Wpf.Services;
|
||||
using Prism.Commands;
|
||||
using Prism.Services.Dialogs;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
public class DialogMeterExdViewModel : DialogViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 实例化函数
|
||||
/// </summary>
|
||||
public DialogMeterExdViewModel(MachineRtDataService machineRtDataService)
|
||||
{
|
||||
Title = "拓展控制";
|
||||
MachineRtDataService = machineRtDataService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前的仪表命令消息
|
||||
/// </summary>
|
||||
public MeterCmdMsg CurMeterCmdMsg { get; set; }
|
||||
|
||||
private string name;
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get { return name; }
|
||||
set { name = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private int _Value;
|
||||
/// <summary>
|
||||
/// 值和数据
|
||||
/// </summary>
|
||||
public int Value
|
||||
{
|
||||
get { return _Value; }
|
||||
set { _Value = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
private DelegateCommand _SendDataCmd;
|
||||
/// <summary>
|
||||
/// 发送数据命令
|
||||
/// </summary>
|
||||
public DelegateCommand SendDataCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
_SendDataCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (_SendDataCmd == null)
|
||||
{
|
||||
_SendDataCmd = new DelegateCommand(() => SendDataCmdMethod());
|
||||
}
|
||||
return _SendDataCmd;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 发送数据命令方法
|
||||
/// </summary>
|
||||
private void SendDataCmdMethod()
|
||||
{
|
||||
switch (CurMeterCmdMsg.Name)
|
||||
{
|
||||
case "PTC功率":
|
||||
//发送数据 SV2
|
||||
MachineRtDataService.SiemensDrive.Write("VW434", (short)Value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private DelegateCommand saveCmd;
|
||||
/// <summary>
|
||||
/// 保存命令
|
||||
/// </summary>
|
||||
public DelegateCommand SaveCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
saveCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (saveCmd == null)
|
||||
{
|
||||
saveCmd = new DelegateCommand(() => SaveCmdMethod());
|
||||
}
|
||||
return saveCmd;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存命令方法
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void SaveCmdMethod()
|
||||
{
|
||||
DialogParameters pars = new DialogParameters
|
||||
{
|
||||
{ "NewData", "" }
|
||||
};
|
||||
|
||||
RaiseRequestClose(new DialogResult(ButtonResult.OK, pars));
|
||||
}
|
||||
|
||||
private DelegateCommand cancelCmd;
|
||||
/// <summary>
|
||||
/// 保存命令
|
||||
/// </summary>
|
||||
public DelegateCommand CancelCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
cancelCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (cancelCmd == null)
|
||||
{
|
||||
cancelCmd = new DelegateCommand(() => CancelCmdMethod());
|
||||
}
|
||||
return cancelCmd;
|
||||
}
|
||||
}
|
||||
|
||||
public MachineRtDataService MachineRtDataService { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 取消命令方法
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void CancelCmdMethod()
|
||||
{
|
||||
RaiseRequestClose(new DialogResult(ButtonResult.Cancel));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 窗口打开时的传递的参数
|
||||
/// </summary>
|
||||
/// <param name="parameters"></param>
|
||||
public override void OnDialogOpened(IDialogParameters parameters)
|
||||
{
|
||||
//Name = parameters.GetValue<string>("Name");
|
||||
CurMeterCmdMsg = parameters.GetValue<MeterCmdMsg>("MeterCmdMsg");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
//ListTag = new ObservableCollection<ITag>(TagManager.DicTags.Values.ToList());
|
||||
RefreshListTag();
|
||||
|
||||
ListMeterTag = TagManager.DicTags.Values.Where(a => a.Group == "程序").OrderBy(a=>a.Id).ToList();
|
||||
ListMeterTag = TagManager.DicTags.Values.Where(a => a.Group == "程序").OrderBy(a => a.Id).ToList();
|
||||
|
||||
SpeedTag = TagManager.DicTags.GetValueOrDefault("转速[rpm]");
|
||||
ExPressTag = TagManager.DicTags.GetValueOrDefault("排气压力[BarA]");
|
||||
@@ -454,6 +454,62 @@ namespace CapMachine.Wpf.ViewModels
|
||||
|
||||
}
|
||||
|
||||
|
||||
private DelegateCommand<object> _ExdCmd;
|
||||
/// <summary>
|
||||
/// 拓展操作指令
|
||||
/// </summary>
|
||||
public DelegateCommand<object> ExdCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
_ExdCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (_ExdCmd == null)
|
||||
{
|
||||
_ExdCmd = new DelegateCommand<object>((p) => ExdCmdCall(p));
|
||||
}
|
||||
return _ExdCmd;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 操作指令执行方法
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void ExdCmdCall(object Par)
|
||||
{
|
||||
if (Par != null && Par is Meter)
|
||||
{
|
||||
//
|
||||
var MeterControl = (Meter)Par;
|
||||
//Console.WriteLine($"{MeterControl.MeterName}-{MeterControl.AutoHandState}");
|
||||
//弹窗
|
||||
DialogService.ShowDialog("DialogMeterExdView", new DialogParameters() { { "MeterCmdMsg", new MeterCmdMsg() {Name= MeterControl.MeterName,Par="SV2" } } }, (par) =>
|
||||
{
|
||||
if (par.Result == ButtonResult.OK)
|
||||
{
|
||||
//试验信息
|
||||
var ListChartTabGroupDto = par.Parameters.GetValue<ExpInfoDto>("ReturnValue");
|
||||
|
||||
|
||||
}
|
||||
else if (par.Result == ButtonResult.Cancel)
|
||||
{
|
||||
//取消
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private DelegateCommand<object> _HandValueCmd;
|
||||
/// <summary>
|
||||
/// 手动给值
|
||||
|
||||
Reference in New Issue
Block a user