更改了现场发现的问题
This commit is contained in:
@@ -4,60 +4,67 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:CapMachine.Shared.Controls"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
x:Name="MeterInstance"
|
||||
Width="130"
|
||||
Width="140"
|
||||
Height="155"
|
||||
BorderBrush="Gray"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="5*" />
|
||||
<RowDefinition Height="3*" />
|
||||
<RowDefinition Height="2*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border
|
||||
Margin="3,3,3,0"
|
||||
Background="#404040"
|
||||
CornerRadius="3" />
|
||||
<StackPanel Margin="3,3,3,0">
|
||||
<DockPanel Margin="5">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Left"
|
||||
FontSize="22"
|
||||
Foreground="White"
|
||||
Text="PV" />
|
||||
<TextBlock
|
||||
Margin="5,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="20"
|
||||
Foreground="White"
|
||||
Text="{Binding ElementName=MeterInstance, Path=PVValue}" />
|
||||
<TextBlock
|
||||
Margin="2,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Right"
|
||||
FontSize="12"
|
||||
Foreground="White"
|
||||
Text="{Binding ElementName=MeterInstance, Path=Unit}" />
|
||||
</DockPanel>
|
||||
<DockPanel Margin="5,-3,5,0">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Left"
|
||||
FontSize="20"
|
||||
FontStyle="Italic"
|
||||
Foreground="Gold"
|
||||
Text="SV" />
|
||||
<TextBlock
|
||||
Margin="10,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="20"
|
||||
Foreground="Gold"
|
||||
Text="{Binding ElementName=MeterInstance, Path=SVValue}" />
|
||||
<!--<TextBlock
|
||||
|
||||
<materialDesign:Card
|
||||
Margin="3"
|
||||
Background="{DynamicResource MaterialDesignLightBackground}"
|
||||
Foreground="{DynamicResource PrimaryHueLightForegroundBrush}"
|
||||
UniformCornerRadius="2">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="4*" />
|
||||
<RowDefinition Height="3*" />
|
||||
<RowDefinition Height="2*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border
|
||||
Margin="3,3,3,0"
|
||||
Background="#404040"
|
||||
CornerRadius="3" />
|
||||
<StackPanel Margin="3,3,3,0">
|
||||
<DockPanel Margin="3">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Left"
|
||||
FontSize="20"
|
||||
Foreground="White"
|
||||
Text="PV" />
|
||||
<TextBlock
|
||||
Margin="5,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="18"
|
||||
Foreground="White"
|
||||
Text="{Binding ElementName=MeterInstance, Path=PVValue}" />
|
||||
<TextBlock
|
||||
Margin="1,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Right"
|
||||
FontSize="12"
|
||||
Foreground="White"
|
||||
Text="{Binding ElementName=MeterInstance, Path=Unit}" />
|
||||
</DockPanel>
|
||||
<DockPanel Margin="3,-3,3,0">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Left"
|
||||
FontSize="20"
|
||||
FontStyle="Italic"
|
||||
Foreground="Gold"
|
||||
Text="SV" />
|
||||
<TextBlock
|
||||
Margin="10,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="18"
|
||||
Foreground="Gold"
|
||||
Text="{Binding ElementName=MeterInstance, Path=SVValue}" />
|
||||
<!--<TextBlock
|
||||
Margin="2,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
@@ -65,102 +72,106 @@
|
||||
FontSize="12"
|
||||
Foreground="Gold"
|
||||
Text="{Binding ElementName=MeterInstance, Path=Unit}" />-->
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Margin="0,3,0,0">
|
||||
<!--
|
||||
Command="{Binding ElementName=MeterInstance, Path=AutoHandCommand}"
|
||||
CommandParameter="{Binding ElementName=MeterInstance}"
|
||||
把整个控件作为参数传递进去
|
||||
-->
|
||||
<ToggleButton
|
||||
x:Name="ToggleBtnAutoHand"
|
||||
Width="40"
|
||||
Click="ToggleBtnAutoHand_Click_1"
|
||||
Command="{Binding ElementName=MeterInstance, Path=AutoHandCommand}"
|
||||
CommandParameter="{Binding ElementName=MeterInstance}"
|
||||
IsChecked="{Binding ElementName=MeterInstance, Path=AutoHandState}"
|
||||
Style="{StaticResource MaterialDesignSwitchToggleButton}"
|
||||
ToolTip="手自动" />
|
||||
<TextBlock
|
||||
Margin="0,5,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Foreground="CadetBlue"
|
||||
Text="{Binding ElementName=MeterInstance, Path=AutoStateMsg}" />
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Column="1" Margin="3,3,3,0">
|
||||
<StackPanel.Resources />
|
||||
<!--
|
||||
Text="{Binding ElementName=MeterInstance, Path=AutoStateMsg}"
|
||||
Command="{Binding ElementName=MeterInstance, Path=AutoHandCommand}"
|
||||
CommandParameter="{Binding ElementName=MeterInstance}"
|
||||
把整个控件作为参数传递进去
|
||||
-->
|
||||
<TextBox
|
||||
x:Name="HandValueMV"
|
||||
Width="42"
|
||||
HorizontalContentAlignment="Center"
|
||||
KeyDown="HandValueMV_KeyDown"
|
||||
Text="{Binding ElementName=MeterInstance, Path=HandValueMVParameter}"
|
||||
ToolTip="按【Enter】回车键才会发送生效"
|
||||
Visibility="{Binding ElementName=MeterInstance, Path=IsHandValueShow}" />
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Margin="0,3,0,0">
|
||||
<!--
|
||||
Command="{Binding ElementName=MeterInstance, Path=AutoHandCommand}"
|
||||
CommandParameter="{Binding ElementName=MeterInstance}"
|
||||
把整个控件作为参数传递进去
|
||||
-->
|
||||
<ToggleButton
|
||||
x:Name="ToggleBtnAutoHand"
|
||||
Width="40"
|
||||
Click="ToggleBtnAutoHand_Click_1"
|
||||
Command="{Binding ElementName=MeterInstance, Path=AutoHandCommand}"
|
||||
CommandParameter="{Binding ElementName=MeterInstance}"
|
||||
IsChecked="{Binding ElementName=MeterInstance, Path=AutoHandState}"
|
||||
Style="{StaticResource MaterialDesignSwitchToggleButton}"
|
||||
ToolTip="手自动" />
|
||||
<TextBlock
|
||||
Margin="0,5,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Foreground="CadetBlue"
|
||||
Text="{Binding ElementName=MeterInstance, Path=AutoStateMsg}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Column="1" Margin="3,3,3,0">
|
||||
<StackPanel.Resources />
|
||||
<!--
|
||||
Text="{Binding ElementName=MeterInstance, Path=AutoStateMsg}"
|
||||
Command="{Binding ElementName=MeterInstance, Path=AutoHandCommand}"
|
||||
CommandParameter="{Binding ElementName=MeterInstance}"
|
||||
把整个控件作为参数传递进去
|
||||
-->
|
||||
<TextBox
|
||||
x:Name="HandValueMV"
|
||||
Width="42"
|
||||
HorizontalContentAlignment="Center"
|
||||
KeyDown="HandValueMV_KeyDown"
|
||||
Text="{Binding ElementName=MeterInstance, Path=HandValueMVParameter}"
|
||||
ToolTip="按【Enter】回车键才会发送生效"
|
||||
Visibility="{Binding ElementName=MeterInstance, Path=IsHandValueShow}" />
|
||||
<TextBlock
|
||||
Margin="0,2,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Foreground="CadetBlue"
|
||||
Text="MV"
|
||||
Visibility="{Binding ElementName=MeterInstance, Path=IsHandValueShow}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Margin="3,3,3,0">
|
||||
<StackPanel.Resources />
|
||||
<!--
|
||||
Text="{Binding ElementName=MeterInstance, Path=AutoStateMsg}"
|
||||
Command="{Binding ElementName=MeterInstance, Path=AutoHandCommand}"
|
||||
CommandParameter="{Binding ElementName=MeterInstance}"
|
||||
把整个控件作为参数传递进去
|
||||
-->
|
||||
<TextBox
|
||||
x:Name="HandValueSV"
|
||||
Width="42"
|
||||
HorizontalContentAlignment="Center"
|
||||
KeyDown="HandValueSV_KeyDown"
|
||||
Text="{Binding ElementName=MeterInstance, Path=HandValueSVParameter}"
|
||||
ToolTip="按【Enter】回车键才会发送生效"
|
||||
Visibility="{Binding ElementName=MeterInstance, Path=IsHandValueShow}" />
|
||||
<TextBlock
|
||||
Margin="0,2,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Foreground="CadetBlue"
|
||||
Text="SV"
|
||||
Visibility="{Binding ElementName=MeterInstance, Path=IsHandValueShow}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Border
|
||||
Grid.Row="2"
|
||||
Margin="3,3,3,3"
|
||||
Background="Gray"
|
||||
CornerRadius="3">
|
||||
<TextBlock
|
||||
Margin="0,2,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Foreground="CadetBlue"
|
||||
Text="MV"
|
||||
Visibility="{Binding ElementName=MeterInstance, Path=IsHandValueShow}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Margin="3,3,3,0">
|
||||
<StackPanel.Resources />
|
||||
<!--
|
||||
Text="{Binding ElementName=MeterInstance, Path=AutoStateMsg}"
|
||||
Command="{Binding ElementName=MeterInstance, Path=AutoHandCommand}"
|
||||
CommandParameter="{Binding ElementName=MeterInstance}"
|
||||
把整个控件作为参数传递进去
|
||||
-->
|
||||
<TextBox
|
||||
x:Name="HandValueSV"
|
||||
Width="42"
|
||||
HorizontalContentAlignment="Center"
|
||||
KeyDown="HandValueSV_KeyDown"
|
||||
Text="{Binding ElementName=MeterInstance, Path=HandValueSVParameter}"
|
||||
ToolTip="按【Enter】回车键才会发送生效"
|
||||
Visibility="{Binding ElementName=MeterInstance, Path=IsHandValueShow}" />
|
||||
<TextBlock
|
||||
Margin="0,2,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Foreground="CadetBlue"
|
||||
Text="SV"
|
||||
Visibility="{Binding ElementName=MeterInstance, Path=IsHandValueShow}" />
|
||||
</StackPanel>
|
||||
FontSize="16"
|
||||
Foreground="White"
|
||||
Text="{Binding ElementName=MeterInstance, Path=MeterName}" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</materialDesign:Card>
|
||||
|
||||
|
||||
|
||||
<Border
|
||||
Grid.Row="2"
|
||||
Margin="3,3,3,3"
|
||||
Background="Gray"
|
||||
CornerRadius="3">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
Foreground="White"
|
||||
Text="{Binding ElementName=MeterInstance, Path=MeterName}" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -311,7 +311,7 @@ namespace CapMachine.Shared.Controls
|
||||
{
|
||||
//HandValueParameter 此时无法更新到最新的值(旧值),可能因为RaisePropertyChanged在ViewModel上,不受这边的控制了,所以直接取控件的数据
|
||||
//HandValueParameter 没有使用,直接取控件的值,HandValueParameter作为初始值使用
|
||||
if (int.TryParse(HandValueSV.Text, out int Result))
|
||||
if (double.TryParse(HandValueSV.Text, out double Result))
|
||||
{
|
||||
//把整个控件打包发送过去,无法访问Textbox的值,那么直接传送模型的数据给ViewModel
|
||||
HandValueCommand.Execute(new MeterChannelValue() { Name = MeterName, Value = Result, Type = "SV" });
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Prism.Mvvm;
|
||||
using HslCommunication;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -38,5 +39,9 @@ namespace CapMachine.Wpf.Dtos
|
||||
set { _State = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据结果
|
||||
/// </summary>
|
||||
public OperateResult<bool>? StateOperateResult { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
/// <summary>
|
||||
/// 工程值 Mv
|
||||
/// </summary>
|
||||
double EngMvValue { get; set; }
|
||||
short EngMvValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工程值的字符串 Mv
|
||||
|
||||
@@ -235,11 +235,11 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
}
|
||||
|
||||
|
||||
private double _EngMvValue;
|
||||
private short _EngMvValue;
|
||||
/// <summary>
|
||||
/// 工程值 MV
|
||||
/// </summary>
|
||||
public double EngMvValue
|
||||
public short EngMvValue
|
||||
{
|
||||
get { return _EngMvValue; }
|
||||
set
|
||||
@@ -249,7 +249,7 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
{
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
EngMvValueStr = Math.Round(value, DecimalPoint).ToString();
|
||||
EngMvValueStr = value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace CapMachine.Wpf.ProPars
|
||||
new PlcParsData(){ Name="速度",EnName="Speed",Step=150,SetAddressInfo=AddressInfo.OK,Steps=new List<PlcMeterStepCell>(),Ratio=1,Unit="",ValueStartAddress=1008,MinStartAddress=1000,SecStartAddress=1002,CycleStartAddress=1006,SlopConstAddress=1004 },
|
||||
new PlcParsData(){ Name="排气压力",EnName="ExPress",SetAddressInfo=AddressInfo.OK,Step=150,Steps=new List<PlcMeterStepCell>(),Ratio=100,Unit="" ,ValueStartAddress=1032,MinStartAddress=1024,SecStartAddress=1026,CycleStartAddress=1030,SlopConstAddress=1028 },
|
||||
new PlcParsData(){ Name="吸气压力",EnName="InhPress",SetAddressInfo=AddressInfo.OK,Step=150,Steps=new List<PlcMeterStepCell>(),Ratio=100,Unit="" ,ValueStartAddress=1046,MinStartAddress=1038,SecStartAddress=1040,CycleStartAddress=1044,SlopConstAddress=1042 },
|
||||
new PlcParsData(){ Name="吸气温度",EnName="InhTemp",SetAddressInfo=AddressInfo.OK,Step=150,Steps=new List<PlcMeterStepCell>(),Ratio=10,Unit="" ,ValueStartAddress=1058,MinStartAddress=1052,SecStartAddress=1054,CycleStartAddress=1058,SlopConstAddress=1056 },
|
||||
new PlcParsData(){ Name="吸气温度",EnName="InhTemp",SetAddressInfo=AddressInfo.OK,Step=150,Steps=new List<PlcMeterStepCell>(),Ratio=10,Unit="" ,ValueStartAddress=1060,MinStartAddress=1052,SecStartAddress=1054,CycleStartAddress=1058,SlopConstAddress=1056 },
|
||||
new PlcParsData(){ Name="冷凝器出口水温",EnName="Cond1Temp",SetAddressInfo=AddressInfo.OK,Step=150,Steps=new List<PlcMeterStepCell>(),Ratio=10,Unit="",ValueStartAddress=1074,MinStartAddress=1066,SecStartAddress=1068,CycleStartAddress=1072,SlopConstAddress=1070 },
|
||||
new PlcParsData(){ Name="吸气混合器温度",EnName="OS2Temp",Step=150,SetAddressInfo=AddressInfo.NoCycle,Steps=new List<PlcMeterStepCell>(),Ratio=10,Unit="" ,ValueStartAddress=1088,MinStartAddress=1080,SecStartAddress=1082 },//??
|
||||
new PlcParsData(){ Name="HV电压",EnName="HVVol",Step=150,SetAddressInfo=AddressInfo.OK,Steps=new List<PlcMeterStepCell>(),Ratio=10,Unit="" ,ValueStartAddress=1102,MinStartAddress=1094,SecStartAddress=1096,CycleStartAddress=1100,SlopConstAddress=1198 },
|
||||
@@ -1640,6 +1640,12 @@ namespace CapMachine.Wpf.ProPars
|
||||
/// <returns></returns>
|
||||
private static int GetCycleCount(int Cycle, int Index, int ListCount)
|
||||
{
|
||||
if (Cycle==1)
|
||||
{
|
||||
//只有一次,也就是没有循环,就是直接的步骤,统一返回没有循环固定值
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ListCount > 1)
|
||||
{
|
||||
//步骤ProStep内部有循环
|
||||
@@ -1677,23 +1683,6 @@ namespace CapMachine.Wpf.ProPars
|
||||
//展开每个控制参数的具体配置
|
||||
foreach (var itemMeter in plcParsDatas)
|
||||
{
|
||||
//var Stepaddress = StartAddress + Index * StepLengh;
|
||||
|
||||
//switch (itemMeter.SetAddressInfo)
|
||||
//{
|
||||
// case AddressInfo.OK:
|
||||
|
||||
// break;
|
||||
// case AddressInfo.NoCycle:
|
||||
|
||||
// break;
|
||||
// case AddressInfo.NoTimeAndCycle:
|
||||
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
//}
|
||||
|
||||
//循环Index
|
||||
int Index = 0;
|
||||
//每个参数循环内部的步骤信息,每个参数都是独立的时间和循环次数,数据上面已经铺开了,但是地址没有
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using AutoMapper.Internal;
|
||||
using CapMachine.Core;
|
||||
using CapMachine.Wpf.Dtos;
|
||||
using CapMachine.Wpf.Models;
|
||||
using CapMachine.Wpf.Models.Tag;
|
||||
using CapMachine.Wpf.PrismEvent;
|
||||
@@ -13,6 +14,7 @@ using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -794,6 +796,29 @@ namespace CapMachine.Wpf.Services
|
||||
|
||||
#endregion
|
||||
|
||||
ListHandSwitchData = new List<HandSwitchData>()
|
||||
{
|
||||
new HandSwitchData(){Name="自动",ActionAddress="M0.0",StateAddress="M0.0" },
|
||||
new HandSwitchData(){Name="抽真空",ActionAddress="M0.1",StateAddress="M0.1" },
|
||||
new HandSwitchData(){Name="复位",ActionAddress="M0.2",StateAddress="M0.2" },
|
||||
new HandSwitchData(){Name="消音",ActionAddress="M0.3",StateAddress="M0.3" },
|
||||
new HandSwitchData(){Name="HV电源",ActionAddress="M1.1",StateAddress="Q0.1" },
|
||||
new HandSwitchData(){Name="HV启动",ActionAddress="M1.2",StateAddress="Q0.6" },
|
||||
new HandSwitchData(){Name="LV电源",ActionAddress="M1.3",StateAddress="Q0.2" },
|
||||
new HandSwitchData(){Name="水泵",ActionAddress="M1.4",StateAddress="Q0.3" },
|
||||
new HandSwitchData(){Name="冷凝器电加热",ActionAddress="M1.5",StateAddress="Q0.4" },
|
||||
new HandSwitchData(){Name="吸气混合器电加热",ActionAddress="M1.6",StateAddress="Q0.5" },
|
||||
new HandSwitchData(){Name="吸排气球阀",ActionAddress="M1.7",StateAddress="Q0.7" },
|
||||
new HandSwitchData(){Name="试验箱",ActionAddress="M2.0",StateAddress="V15.0" },
|
||||
new HandSwitchData(){Name="水SEV1",ActionAddress="M2.1",StateAddress="Q1.0" },
|
||||
new HandSwitchData(){Name="水SEV2",ActionAddress="M2.2",StateAddress="Q1.1" },
|
||||
new HandSwitchData(){Name="HCV1",ActionAddress="M2.3",StateAddress="Q1.2" },
|
||||
new HandSwitchData(){Name="HCV2",ActionAddress="M2.4",StateAddress="Q1.3" },
|
||||
new HandSwitchData(){Name="ECV1",ActionAddress="M2.5",StateAddress="Q1.4" },
|
||||
new HandSwitchData(){Name="ECV2",ActionAddress="M2.6",StateAddress="Q1.5" },
|
||||
new HandSwitchData(){Name="使能",ActionAddress="M2.7",StateAddress="V15.1" },
|
||||
};
|
||||
|
||||
//TagManger.ListTag[0].Name = "new TestType() { byteValue=12}";
|
||||
//TagManger.ListTag[0].Name = "new TestType() { byteValue=12}";
|
||||
|
||||
@@ -821,6 +846,113 @@ namespace CapMachine.Wpf.Services
|
||||
PubRtDataStart();
|
||||
}
|
||||
|
||||
#region 手自动的操作
|
||||
|
||||
//// <summary>
|
||||
///// 手自动切换集合数据
|
||||
///// </summary>
|
||||
public List<HandSwitchData> ListHandSwitchData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序复位
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool SysReset()
|
||||
{
|
||||
var FindData = ListHandSwitchData.Where(a => a.Name == "复位");
|
||||
if (FindData.Count() > 0)
|
||||
{
|
||||
var Result = SiemensDrive.Write(FindData.First().ActionAddress, true);
|
||||
if (Result.IsSuccess)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 程序消音
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool SysMute()
|
||||
{
|
||||
var FindData = ListHandSwitchData.Where(a => a.Name == "消音");
|
||||
if (FindData.Count() > 0)
|
||||
{
|
||||
var Result = SiemensDrive.Write(FindData.First().ActionAddress, true);
|
||||
if (Result.IsSuccess)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 程序Start
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool SysStart()
|
||||
{
|
||||
var Result = SiemensDrive.Write("M0.4", true);
|
||||
if (Result.IsSuccess)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 程序结束
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool SysEnd()
|
||||
{
|
||||
var Result = SiemensDrive.Write("M0.7", true);
|
||||
if (Result.IsSuccess)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 程序暂停
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool SysPause()
|
||||
{
|
||||
var Result = SiemensDrive.Write("M0.6", true);
|
||||
if (Result.IsSuccess)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// UI更新
|
||||
/// </summary>
|
||||
@@ -900,6 +1032,11 @@ namespace CapMachine.Wpf.Services
|
||||
/// </summary>
|
||||
private OperateResult<short> OperateResultSVShort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// MV数据
|
||||
/// </summary>
|
||||
private OperateResult<short> OperateResultMVShort { get; set; }
|
||||
|
||||
private Random Random { get; set; } = new Random();
|
||||
|
||||
/// <summary>
|
||||
@@ -925,7 +1062,7 @@ namespace CapMachine.Wpf.Services
|
||||
try
|
||||
{
|
||||
//TagInfo.RtValue.Value++;
|
||||
|
||||
|
||||
//var data = TagManger.DicTags["转速"].ValueType.Name;
|
||||
|
||||
////第一次计时
|
||||
@@ -960,34 +1097,34 @@ namespace CapMachine.Wpf.Services
|
||||
|
||||
TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.IsShow = IsValueShow;
|
||||
|
||||
////仿真数据
|
||||
//TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = (short)Random.Next(1, 100);
|
||||
//TagManger.GetTagByName<short>(itemTag.Value.Name).EngPvValue = (short)Random.Next(1, 100) * 1.0 / TagManger.GetTagByName<short>(itemTag.Value.Name)!.Precision;
|
||||
//LinkState = false;
|
||||
//仿真数据
|
||||
TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = (short)Random.Next(1, 100);
|
||||
TagManger.GetTagByName<short>(itemTag.Value.Name).EngPvValue = (short)Random.Next(1, 100) * 1.0 / TagManger.GetTagByName<short>(itemTag.Value.Name)!.Precision;
|
||||
LinkState = false;
|
||||
|
||||
//PLC 数据
|
||||
if (!string.IsNullOrEmpty(itemTag.Value.PVAddress))
|
||||
{
|
||||
OperateResultShort = SiemensDrive.ReadInt16(itemTag.Value.PVAddress);
|
||||
if (OperateResultShort.IsSuccess)
|
||||
{
|
||||
TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = SiemensDrive.ReadInt16(itemTag.Value.PVAddress).Content;
|
||||
TagManger.GetTagByName<short>(itemTag.Value.Name).EngPvValue = TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value * 1.0 / TagManger.GetTagByName<short>(itemTag.Value.Name)!.Precision;
|
||||
LinkState = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LinkState = false;
|
||||
}
|
||||
}
|
||||
////PLC 数据
|
||||
//if (!string.IsNullOrEmpty(itemTag.Value.PVAddress))
|
||||
//{
|
||||
// OperateResultShort = SiemensDrive.ReadInt16(itemTag.Value.PVAddress);
|
||||
// if (OperateResultShort.IsSuccess)
|
||||
// {
|
||||
// TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = SiemensDrive.ReadInt16(itemTag.Value.PVAddress).Content;
|
||||
// TagManger.GetTagByName<short>(itemTag.Value.Name).EngPvValue = TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value * 1.0 / TagManger.GetTagByName<short>(itemTag.Value.Name)!.Precision;
|
||||
// LinkState = true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// LinkState = false;
|
||||
// }
|
||||
//}
|
||||
|
||||
if (!string.IsNullOrEmpty(itemTag.Value.SVAddress))
|
||||
{
|
||||
OperateResultSVShort = SiemensDrive.ReadInt16(itemTag.Value.SVAddress);
|
||||
if (OperateResultSVShort.IsSuccess)
|
||||
{
|
||||
TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = OperateResultSVShort.Content;
|
||||
TagManger.GetTagByName<short>(itemTag.Value.Name).EngSvValue = TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value * 1.0 / TagManger.GetTagByName<short>(itemTag.Value.Name)!.Precision;
|
||||
//TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = OperateResultSVShort.Content;
|
||||
TagManger.GetTagByName<short>(itemTag.Value.Name).EngSvValue = OperateResultSVShort.Content * 1.0 / TagManger.GetTagByName<short>(itemTag.Value.Name)!.Precision;
|
||||
LinkState = true;
|
||||
}
|
||||
else
|
||||
@@ -995,6 +1132,22 @@ namespace CapMachine.Wpf.Services
|
||||
LinkState = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(itemTag.Value.MVAddress))
|
||||
{
|
||||
OperateResultMVShort = SiemensDrive.ReadInt16(itemTag.Value.MVAddress);
|
||||
if (OperateResultMVShort.IsSuccess)
|
||||
{
|
||||
//TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = OperateResultMVShort.Content;
|
||||
TagManger.GetTagByName<short>(itemTag.Value.Name).EngMvValue = OperateResultMVShort.Content;
|
||||
LinkState = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LinkState = false;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -1014,6 +1167,17 @@ namespace CapMachine.Wpf.Services
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//循环读取手自动切换
|
||||
foreach (var item in ListHandSwitchData)
|
||||
{
|
||||
item.StateOperateResult = SiemensDrive.ReadBool(item.StateAddress);
|
||||
if (item.StateOperateResult.IsSuccess)
|
||||
{
|
||||
item.State = item.StateOperateResult.Content;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -40,6 +40,9 @@ namespace CapMachine.Wpf.ViewModels
|
||||
TagManager = MachineRtDataService.TagManger;
|
||||
_EventAggregator.GetEvent<ChartRtEvent>().Subscribe(GetChartRtEvent);
|
||||
|
||||
//赋值实例化
|
||||
ListHandSwitchData = MachineRtDataService.ListHandSwitchData;
|
||||
|
||||
ListTag = new ObservableCollection<ITag>(TagManager.DicTags.Values.ToList());
|
||||
ListMeterTag = TagManager.DicTags.Values.Where(a => a.IsMeter == true).ToList();
|
||||
|
||||
@@ -57,28 +60,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
Cond1TempTag = TagManager.DicTags.GetValueOrDefault("冷凝器出口水温[℃]");
|
||||
CondInTempTag = TagManager.DicTags.GetValueOrDefault("冷凝器进口温度[℃]");
|
||||
|
||||
ListHandSwitchData = new ObservableCollection<HandSwitchData>()
|
||||
{
|
||||
new HandSwitchData(){Name="自动",ActionAddress="M0.0",StateAddress="M0.0" },
|
||||
new HandSwitchData(){Name="抽真空",ActionAddress="M0.1",StateAddress="M0.1" },
|
||||
new HandSwitchData(){Name="复位",ActionAddress="M0.2",StateAddress="M0.2" },
|
||||
new HandSwitchData(){Name="消音",ActionAddress="M0.3",StateAddress="M0.3" },
|
||||
new HandSwitchData(){Name="HV电源",ActionAddress="M1.1",StateAddress="Q0.1" },
|
||||
new HandSwitchData(){Name="HV启动",ActionAddress="M1.2",StateAddress="Q0.6" },
|
||||
new HandSwitchData(){Name="LV电源",ActionAddress="M1.3",StateAddress="Q0.2" },
|
||||
new HandSwitchData(){Name="水泵",ActionAddress="M1.4",StateAddress="Q0.3" },
|
||||
new HandSwitchData(){Name="冷凝器电加热",ActionAddress="M1.5",StateAddress="Q0.4" },
|
||||
new HandSwitchData(){Name="吸气混合器电加热",ActionAddress="M1.6",StateAddress="Q0.5" },
|
||||
new HandSwitchData(){Name="吸排气球阀",ActionAddress="M1.7",StateAddress="Q0.7" },
|
||||
new HandSwitchData(){Name="试验箱",ActionAddress="M2.0",StateAddress="VW32" },
|
||||
new HandSwitchData(){Name="水SEV1",ActionAddress="M2.1",StateAddress="Q1.0" },
|
||||
new HandSwitchData(){Name="水SEV2",ActionAddress="M2.2",StateAddress="Q1.1" },
|
||||
new HandSwitchData(){Name="HCV1",ActionAddress="M2.3",StateAddress="Q1.2" },
|
||||
new HandSwitchData(){Name="HCV2",ActionAddress="M2.4",StateAddress="Q1.3" },
|
||||
new HandSwitchData(){Name="ECV1",ActionAddress="M2.5",StateAddress="Q1.4" },
|
||||
new HandSwitchData(){Name="ECV2",ActionAddress="M2.6",StateAddress="Q1.5" },
|
||||
new HandSwitchData(){Name="使能",ActionAddress="M2.7",StateAddress="V15.1" },
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public ConfigService ConfigService { get; }
|
||||
@@ -121,18 +103,22 @@ namespace CapMachine.Wpf.ViewModels
|
||||
/// </summary>
|
||||
public TagManager TagManager { get; set; }
|
||||
|
||||
//// <summary>
|
||||
///// 手自动切换集合数据
|
||||
///// </summary>
|
||||
public List<HandSwitchData> ListHandSwitchData { get; set; }
|
||||
|
||||
private ObservableCollection<HandSwitchData> _ListHandSwitchData;
|
||||
// <summary>
|
||||
/// 手自动切换集合数据
|
||||
/// <summary>
|
||||
/// 复位标签
|
||||
/// </summary>
|
||||
public ObservableCollection<HandSwitchData> ListHandSwitchData
|
||||
{
|
||||
get { return _ListHandSwitchData; }
|
||||
set { _ListHandSwitchData = value; RaisePropertyChanged(); }
|
||||
}
|
||||
public HandSwitchData ResetTag { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 消音标签
|
||||
/// </summary>
|
||||
public HandSwitchData MuteTag { get; set; }
|
||||
|
||||
#region 工艺图数据
|
||||
|
||||
/// <summary>
|
||||
@@ -230,19 +216,29 @@ namespace CapMachine.Wpf.ViewModels
|
||||
switch (Par)
|
||||
{
|
||||
case "开始":
|
||||
|
||||
MachineRtDataService.SysStart();
|
||||
|
||||
this.SysRunServer.MachineRunState1.FireStart();
|
||||
|
||||
DataRecordService.StartRecord();
|
||||
break;
|
||||
case "结束":
|
||||
MachineRtDataService.SysEnd();
|
||||
|
||||
this.SysRunServer.MachineRunState1.FireEnd();
|
||||
DataRecordService.EndRecord();
|
||||
break;
|
||||
case "复位":
|
||||
MachineRtDataService.SysReset();
|
||||
|
||||
this.SysRunServer.MachineRunState1.FireReset();
|
||||
DataRecordService.EndRecord();
|
||||
break;
|
||||
case "消音":
|
||||
|
||||
MachineRtDataService.SysMute();
|
||||
|
||||
//ShowDialogExpInfo();
|
||||
break;
|
||||
case "试验信息":
|
||||
@@ -292,7 +288,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item.Value.AutoHandSwitchAddress))
|
||||
{
|
||||
var Result = MachineRtDataService.SiemensDrive.Write(item.Value.AutoHandSwitchAddress, MeterControl.AutoHandState==true?1:0);
|
||||
var Result = MachineRtDataService.SiemensDrive.Write(item.Value.AutoHandSwitchAddress, MeterControl.AutoHandState == true ? (short)1 : (short)0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -341,7 +337,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
case "MV":
|
||||
if (!string.IsNullOrEmpty(item.Value.MVAddress))
|
||||
{
|
||||
var Result = MachineRtDataService.SiemensDrive.Write(item.Value.MVAddress, (short)((double)ChannelValue.Value* item.Value.Precision));
|
||||
var Result = MachineRtDataService.SiemensDrive.Write(item.Value.MVAddress, (short)((double)ChannelValue.Value));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -355,7 +351,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -411,7 +407,11 @@ namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
//ToDo
|
||||
Console.WriteLine($"{FindData.Name}-{FindData.ActionAddress}-{FindData.StateAddress}-{Data}");
|
||||
var Result = MachineRtDataService.SiemensDrive.Write(FindData.ActionAddress, true);
|
||||
var Result = MachineRtDataService.SiemensDrive.Write(FindData.ActionAddress, (bool)Data);
|
||||
if (Result.IsSuccess)
|
||||
{
|
||||
|
||||
}
|
||||
//FindData.State = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
HandValueCommand="{Binding Source={StaticResource Proxy}, Path=Data.HandValueCmd}"
|
||||
MeterName="{Binding NameNoUnit}"
|
||||
PVValue="{Binding EngPvValue}"
|
||||
SVValue="{Binding EngSVValue}"
|
||||
SVValue="{Binding EngSvValue}"
|
||||
Unit="{Binding Unit}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
@@ -853,7 +853,7 @@
|
||||
</Canvas.Background>
|
||||
<Rectangle
|
||||
Canvas.Left="30"
|
||||
Canvas.Top="107"
|
||||
Canvas.Top="85"
|
||||
Width="470"
|
||||
Height="380"
|
||||
HorizontalAlignment="Center"
|
||||
@@ -862,7 +862,7 @@
|
||||
StrokeThickness="4" />
|
||||
<Label
|
||||
Canvas.Left="35"
|
||||
Canvas.Top="110"
|
||||
Canvas.Top="88"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top"
|
||||
Content="压缩机环境箱"
|
||||
@@ -913,7 +913,7 @@
|
||||
Canvas.Top="231"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Content="CCV1
冷凝器进水"
|
||||
Content="CCV1
冷凝器出水"
|
||||
FontSize="16"
|
||||
FontWeight="Bold" />
|
||||
|
||||
@@ -988,7 +988,7 @@
|
||||
VerticalAlignment="Top"
|
||||
CellTitle="吸气压力MV"
|
||||
CellUnit="%"
|
||||
CellValue="15" />
|
||||
CellValue="{Binding InhPressTag.EngMvValue}" />
|
||||
<Controls:ValueShow
|
||||
Canvas.Left="1003"
|
||||
Canvas.Top="152"
|
||||
@@ -1014,18 +1014,18 @@
|
||||
CellUnit="{Binding OS2TempTag.Unit}"
|
||||
CellValue="{Binding OS2TempTag.EngPvValueStr}" />
|
||||
<Controls:ValueShow
|
||||
Canvas.Left="1190"
|
||||
Canvas.Top="357"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Canvas.Left="1076"
|
||||
Canvas.Top="360"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top"
|
||||
CellTitle="冷凝器进水温"
|
||||
CellUnit="{Binding Cond1TempTag.Unit}"
|
||||
CellValue="{Binding Cond1TempTag.EngPvValueStr}" />
|
||||
<Controls:ValueShow
|
||||
Canvas.Left="1074"
|
||||
Canvas.Top="357"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Canvas.Left="1194"
|
||||
Canvas.Top="360"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top"
|
||||
CellTitle="冷凝器出水温"
|
||||
CellUnit="{Binding CondInTempTag.Unit}"
|
||||
CellValue="{Binding CondInTempTag.EngPvValueStr}" />
|
||||
@@ -1036,7 +1036,7 @@
|
||||
VerticalAlignment="Center"
|
||||
CellTitle="排气压力MV"
|
||||
CellUnit="%"
|
||||
CellValue="15" />
|
||||
CellValue="{Binding ExPressTag.EngMvValue}" />
|
||||
<Controls:ValueShow
|
||||
Canvas.Left="871"
|
||||
Canvas.Top="224"
|
||||
@@ -1044,13 +1044,13 @@
|
||||
VerticalAlignment="Center"
|
||||
CellTitle="吸气温度MV"
|
||||
CellUnit="%"
|
||||
CellValue="15" />
|
||||
CellValue="{Binding InhTempTag.EngMvValue}" />
|
||||
<Label
|
||||
Canvas.Left="1339"
|
||||
Canvas.Top="135"
|
||||
HorizontalAlignment="Left"
|
||||
Canvas.Top="225"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top"
|
||||
Content="CCV2"
|
||||
Content="CCV2
冷凝器出水"
|
||||
FontSize="16"
|
||||
FontWeight="Bold" />
|
||||
<Label
|
||||
|
||||
@@ -314,13 +314,8 @@
|
||||
Text="内容区域"
|
||||
TextAlignment="Center" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</Border>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
BorderBrush="Black"
|
||||
|
||||
Reference in New Issue
Block a user