Преглед изворни кода

50L反应釜曲线添加。

reconfiguration
ZhaoGang пре 2 месеци
родитељ
комит
ff9efd2e38
8 измењених фајлова са 534 додато и 541 уклоњено
  1. +1
    -0
      BPASmartClient.Academy/50L/PlcControl.cs
  2. +2
    -0
      BPASmartClient.Academy/ColorResource.xaml
  3. +292
    -282
      BPASmartClient.Academy/View/DeviceChart50LView.xaml
  4. +162
    -101
      BPASmartClient.Academy/View/DeviceChart50LView.xaml.cs
  5. +58
    -143
      BPASmartClient.Academy/View/HistoryChart50LView.xaml
  6. +3
    -1
      BPASmartClient.Academy/ViewModel/DeviceChart50LViewModel.cs
  7. +5
    -1
      BPASmartClient.Academy/ViewModel/HistoryChart50LViewModel.cs
  8. +11
    -13
      BPASmartClient.Academy/ViewModel/ReactionKettle50LViewModel.cs

+ 1
- 0
BPASmartClient.Academy/50L/PlcControl.cs Прегледај датотеку

@@ -19,6 +19,7 @@ namespace BPASmartClient.Academy._50L
public DeviceStatus DeviceStatus { get; set; } = new DeviceStatus();
private ICommSiemens comm = CommHelper.Siemens;
public Action<bool> IsConnectChanged { get; set; }
public string id { get; set; } = "";
private bool _lastConnectState;
private volatile uint _readFailureCount;
public void Init()


+ 2
- 0
BPASmartClient.Academy/ColorResource.xaml Прегледај датотеку

@@ -6,5 +6,7 @@
<SolidColorBrush x:Key="冷凝水罐湿度">#ffa500</SolidColorBrush>
<SolidColorBrush x:Key="负压流量">#9b30ff</SolidColorBrush>
<SolidColorBrush x:Key="称重水罐重量">#00ffff</SolidColorBrush>
<SolidColorBrush x:Key="反应釜编码器值">#7FFF00</SolidColorBrush>
<SolidColorBrush x:Key="比例阀实际开度">#ff00ff</SolidColorBrush>
<SolidColorBrush x:Key="卤水配制罐重量">#0000ff</SolidColorBrush>
</ResourceDictionary>

+ 292
- 282
BPASmartClient.Academy/View/DeviceChart50LView.xaml Прегледај датотеку

@@ -6,321 +6,331 @@
xmlns:local="clr-namespace:BPASmartClient.Academy.View"
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:oxy="http://oxyplot.org/wpf"
xmlns:vm="clr-namespace:BPASmartClient.Academy.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.DataContext>
xmlns:oxy="http://oxyplot.org/wpf" xmlns:vm="clr-namespace:BPASmartClient.Academy.ViewModel"
d:DesignHeight="450" d:DesignWidth="800" mc:Ignorable="d">
<!--<UserControl.DataContext>
<vm:DeviceChart50LViewModel />
</UserControl.DataContext>
</UserControl.DataContext>-->
<Grid>
<UniformGrid
x:Name="ooo"
Grid.Row="1"
Columns="2"
Rows="2">
<StackPanel Orientation="Vertical">
<lvc:CartesianChart
x:Name="ppp"
Height="270"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
AnimationsSpeed="0:0:1"
DataTooltip="{x:Null}"
Hoverable="False"
MouseDoubleClick="DataView_CLick"
ToolTip="温度曲线">
<lvc:CartesianChart.Series>
<lvc:LineSeries
Fill="Transparent"
LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Red"
StrokeThickness="2"
Values="{Binding DataFeedback.CondensateWaterHumidity}" />
<lvc:LineSeries
Fill="Transparent"
LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Blue"
StrokeThickness="2"
Values="{Binding DataFeedback.Temperature}" />
<lvc:LineSeries
Fill="Transparent"
LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Green"
StrokeThickness="2"
Values="{Binding DataFeedback.TempVent}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis>
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis LabelFormatter="{Binding DateTimeFormatter}" Unit="{Binding AxisUnit}">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" Step="{Binding AxisStep}" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock Foreground="White" Text="温度曲线/℃" />
<Rectangle
Width="20"
Height="2"
Margin="10,0,0,2"
Fill="Blue" />
<TextBlock Foreground="White" Text="物料罐温度" />
<Rectangle
Width="20"
Height="2"
Margin="10,0,0,2"
Fill="Red" />
<TextBlock Foreground="White" Text="反应釜温度" />
<Rectangle
Width="20"
Height="2"
Margin="10,0,0,2"
Fill="Green" />
<TextBlock Foreground="White" Text="排气温度" />
</StackPanel>
<ScrollViewer x:Name="ooo" Grid.Row="1">

</StackPanel>
<UniformGrid Columns="2" Rows="4">
<StackPanel
Margin="20" Orientation="Vertical" Visibility="Visible">
<lvc:CartesianChart
x:Name="ppp" Height="270" HorizontalAlignment="Stretch" VerticalAlignment="Top"
AnimationsSpeed="0:0:1"
DataTooltip="{x:Null}"
Hoverable="False" MouseDoubleClick="DataView_CLick" ToolTip="温度曲线">
<lvc:CartesianChart.Series>
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Red" StrokeThickness="2"
Values="{Binding DataFeedback.Temperature}" />
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Blue" StrokeThickness="2"
Values="{Binding DataFeedback.CondensateWaterTemperature}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis MaxValue="200" MinValue="0">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis LabelFormatter="{Binding DateTimeFormatter}" Unit="{Binding AxisUnit}">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" Step="{Binding AxisStep}" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock Foreground="White" Text="温度曲线/℃" />

<StackPanel Margin="20,0,0,0" Orientation="Vertical">
<lvc:CartesianChart
Height="270"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
AnimationsSpeed="0:0:1"
DataTooltip="{x:Null}"
Hoverable="False"
MouseDoubleClick="DataView_CLick"
ToolTip="转速曲线">
<lvc:CartesianChart.Series>
<lvc:LineSeries
Fill="Transparent"
LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="#F44F15"
StrokeThickness="2"
Values="{Binding DataFeedback.M101_Speed}" />
<lvc:LineSeries
<Rectangle
Width="20" Height="2" Margin="10,0,0,2" Fill="Red" />
<TextBlock Foreground="White" Text="反应釜温度" />
<Rectangle
Width="20" Height="2" Margin="10,0,0,2" Fill="Blue" />
<TextBlock Foreground="White" Text="冷凝水罐温度" />
</StackPanel>

</StackPanel>

<StackPanel
Margin="20" Orientation="Vertical" Visibility="Visible">
<lvc:CartesianChart
Height="270" HorizontalAlignment="Stretch" VerticalAlignment="Top" AnimationsSpeed="0:0:1"
DataTooltip="{x:Null}"
Hoverable="False" MouseDoubleClick="DataView_CLick" ToolTip="压力曲线">
<lvc:CartesianChart.Series>
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="#F44F15" StrokeThickness="2"
Values="{Binding DataFeedback.SteamPressure}" />
<!--<lvc:LineSeries
Fill="Transparent"
LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="#423FFD"
StrokeThickness="2"
Values="{Binding DataFeedback.M102_Speed}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis>
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis LabelFormatter="{Binding DateTimeFormatter}" Unit="{Binding AxisUnit}">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" Step="{Binding AxisStep}" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock Foreground="White" Text="转速曲线/rpm" />
<Rectangle
Values="{Binding DataFeedback.M102_Speed}" />-->
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis
LabelFormatter="{Binding doubleFormatter}"
MaxValue="0.6" MinValue="-0.1">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis LabelFormatter="{Binding DateTimeFormatter}" Unit="{Binding AxisUnit}">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" Step="{Binding AxisStep}" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock Foreground="White" Text="压力曲线/MPa" />
<!--<Rectangle
Width="20"
Height="2"
Margin="10,0,0,2"
Fill="#423FFD" />
<TextBlock Foreground="White" Text="物料罐转速" />
<Rectangle
Width="20"
Height="2"
Margin="10,0,0,2"
Fill="#F44F15" />
<TextBlock Foreground="White" Text="反应釜转速" />
<TextBlock Foreground="White" Text="物料罐转速" />-->
<Rectangle
Width="20" Height="2" Margin="10,0,0,2" Fill="#F44F15" />
<TextBlock Foreground="White" Text="反应釜蒸汽压力" />
</StackPanel>

</StackPanel>

</StackPanel>
<StackPanel
Margin="20" Orientation="Vertical" Visibility="Visible">
<lvc:CartesianChart
Height="270" HorizontalAlignment="Stretch" VerticalAlignment="Top" AnimationsSpeed="0:0:1"
DataTooltip="{x:Null}"
Hoverable="False" MouseDoubleClick="DataView_CLick" ToolTip="比例阀开度曲线">
<lvc:CartesianChart.Series>
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="White" StrokeThickness="2"
Values="{Binding DataFeedback.ProportionalValveOpening}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis MaxValue="100" MinValue="0">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis LabelFormatter="{Binding DateTimeFormatter}" Unit="{Binding AxisUnit}">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" Step="{Binding AxisStep}" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock Foreground="White" Text="比例阀开度曲线" />
<Rectangle
Width="20" Height="2" Margin="20,0,0,2" Fill="White" />
<TextBlock Foreground="White" Text="蒸汽比例阀开度" />
</StackPanel>

<!--<StackPanel Orientation="Vertical">
<lvc:CartesianChart
Height="270"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
AnimationsSpeed="0:0:1"
DataTooltip="{x:Null}"
Hoverable="False"
MouseDoubleClick="DataView_CLick"
ToolTip="比例阀开度曲线">
<lvc:CartesianChart.Series>
<lvc:LineSeries
Fill="Transparent"
LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="White"
StrokeThickness="2"
Values="{Binding DataFeedback.OpenValve}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis>
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis
LabelFormatter="{Binding DateTimeFormatter}"
Unit="{Binding AxisUnit}">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" Step="{Binding AxisStep}" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock Foreground="White" Text="比例阀开度曲线" />
<Rectangle
Width="20"
Height="2"
Margin="20,0,0,2"
Fill="White" />
<TextBlock Foreground="White" Text="比例阀开度" />
</StackPanel>

</StackPanel>-->
<StackPanel
Margin="20" Orientation="Vertical" Visibility="Visible">
<lvc:CartesianChart
Height="270" HorizontalAlignment="Stretch" VerticalAlignment="Top" AnimationsSpeed="0:0:1"
DataTooltip="{x:Null}"
Hoverable="False" MouseDoubleClick="DataView_CLick" ToolTip="流量曲线">
<lvc:CartesianChart.Series>
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Red" StrokeThickness="2"
Values="{Binding DataFeedback.SteamFlowRate}" />
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="#F1C74B" StrokeThickness="2"
Values="{Binding DataFeedback.NegativePressureFlowRate}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis LabelFormatter="{Binding doubleFormatter}">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis LabelFormatter="{Binding DateTimeFormatter}" Unit="{Binding AxisUnit}">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" Step="{Binding AxisStep}" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock Foreground="White" Text="流量曲线/Mpa" />
<Rectangle
Width="20" Height="2" Margin="20,0,0,2" Fill="Red" />
<TextBlock Foreground="White" Text="反应釜蒸汽流量" />
<Rectangle
Width="20" Height="2" Margin="20,0,0,2" Fill="#F1C74B" />
<TextBlock Foreground="White" Text="负压流量" />
</StackPanel>

<!--<StackPanel Orientation="Vertical">
<lvc:CartesianChart
Height="270"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
AnimationsSpeed="0:0:1"
DataTooltip="{x:Null}"
Hoverable="False"
MouseDoubleClick="DataView_CLick"
ToolTip="压力曲线">
<lvc:CartesianChart.Series>
<lvc:LineSeries
Fill="Transparent"
LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="#F1C74B"
StrokeThickness="2"
Values="{Binding DataFeedback.PressureWok}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis
LabelFormatter="{Binding doubleFormatter}"
MaxValue="1.0"
MinValue="0">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis
LabelFormatter="{Binding DateTimeFormatter}"
Unit="{Binding AxisUnit}">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" Step="{Binding AxisStep}" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock Foreground="White" Text="压力曲线/Mpa" />
<Rectangle
Width="20"
Height="2"
Margin="20,0,0,2"
Fill="#F1C74B" />
<TextBlock Foreground="White" Text="反应釜压力" />
</StackPanel>

</StackPanel>-->
<StackPanel
Margin="20" Orientation="Vertical" Visibility="Visible">
<lvc:CartesianChart
Height="270" HorizontalAlignment="Stretch" VerticalAlignment="Top" AnimationsSpeed="0:0:1"
DataTooltip="{x:Null}"
Hoverable="False" MouseDoubleClick="DataView_CLick" ToolTip="重量曲线">
<lvc:CartesianChart.Series>
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Blue" StrokeThickness="2"
Values="{Binding DataFeedback.WeighingWaterTankWeight}" />
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Brown" StrokeThickness="2"
Values="{Binding DataFeedback.BrineTankWeight}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis
LabelFormatter="{Binding doubleFormatter}"
MaxValue="30" MinValue="-5">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis LabelFormatter="{Binding DateTimeFormatter}" Unit="{Binding AxisUnit}">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" Step="{Binding AxisStep}" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock Foreground="White" Text="重量曲线/kg" />
<Rectangle
Width="20" Height="2" Margin="20,0,0,2" Fill="Blue" />
<TextBlock Foreground="White" Text="冷却水罐重量" />
<Rectangle
Width="20" Height="2" Margin="20,0,0,2" Fill="Brown" />
<TextBlock Foreground="White" Text="卤水罐重量" />
</StackPanel>

<StackPanel Margin="0,20,0,0" Orientation="Vertical">
<lvc:CartesianChart
Height="270"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
AnimationsSpeed="0:0:1"
DataTooltip="{x:Null}"
Hoverable="False"
MouseDoubleClick="DataView_CLick"
ToolTip="重量曲线">
<lvc:CartesianChart.Series>
<lvc:LineSeries
Fill="Transparent"
LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Purple"
StrokeThickness="2"
Values="{Binding DataFeedback.WeightWok}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis>
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis LabelFormatter="{Binding DateTimeFormatter}" Unit="{Binding AxisUnit}">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" Step="{Binding AxisStep}" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock Foreground="White" Text="重量曲线/kg" />
<Rectangle
Width="20"
Height="2"
Margin="20,0,0,2"
Fill="Purple" />
<TextBlock Foreground="White" Text="冷却水罐重量" />
</StackPanel>

</StackPanel>
</UniformGrid>
<StackPanel
Margin="20" Orientation="Vertical" Visibility="Visible">
<lvc:CartesianChart
Height="270" HorizontalAlignment="Stretch" VerticalAlignment="Top" AnimationsSpeed="0:0:1"
DataTooltip="{x:Null}"
Hoverable="False" MouseDoubleClick="DataView_CLick" ToolTip="湿度曲线">
<lvc:CartesianChart.Series>
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="White" StrokeThickness="2"
Values="{Binding DataFeedback.CondensateWaterHumidity}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis MaxValue="100" MinValue="0">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis LabelFormatter="{Binding DateTimeFormatter}" Unit="{Binding AxisUnit}">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" Step="{Binding AxisStep}" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock Foreground="White" Text="湿度曲线" />
<Rectangle
Width="20" Height="2" Margin="20,0,0,2" Fill="White" />
<TextBlock Foreground="White" Text="冷凝水罐湿度" />
</StackPanel>

</StackPanel>

<StackPanel
Margin="20" Orientation="Vertical" Visibility="Visible">
<lvc:CartesianChart
Height="270" HorizontalAlignment="Stretch" VerticalAlignment="Top" AnimationsSpeed="0:0:1"
DataTooltip="{x:Null}"
Hoverable="False" MouseDoubleClick="DataView_CLick" ToolTip="反应釜角度曲线">
<lvc:CartesianChart.Series>
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="White" StrokeThickness="2"
Values="{Binding DataFeedback.ReactEncoderValue}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis MaxValue="400" MinValue="0">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis LabelFormatter="{Binding DateTimeFormatter}" Unit="{Binding AxisUnit}">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" Step="{Binding AxisStep}" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock Foreground="White" Text="反应釜角度曲线" />
<Rectangle
Width="20" Height="2" Margin="20,0,0,2" Fill="White" />
<TextBlock Foreground="White" Text="反应釜编码器角度值" />
</StackPanel>

</StackPanel>
</UniformGrid>
</ScrollViewer>
<Grid
x:Name="chartGrid"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="White"
x:Name="chartGrid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="White"
Visibility="Collapsed">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<oxy:PlotView
x:Name="chartView"
Margin="5"
Background="Transparent"
Foreground="Black"
x:Name="chartView" Margin="5" Background="Transparent" Foreground="Black"
PanCursor="Hand" />
<Button
Grid.Column="1"
Width="120"
Height=" 40"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Click="Button_Click"
Content="退出" />
Grid.Column="1" Width="120" Height=" 40" HorizontalAlignment="Center"
VerticalAlignment="Center" Click="Button_Click" Content="退出" />
</Grid>
</Grid>
</UserControl>

+ 162
- 101
BPASmartClient.Academy/View/DeviceChart50LView.xaml.cs Прегледај датотеку

@@ -17,6 +17,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ThingsGateway.Foundation.Core;
using BPASmartClient.Academy._50L;

namespace BPASmartClient.Academy.View
{
@@ -28,6 +29,7 @@ namespace BPASmartClient.Academy.View
public DeviceChart50LView()
{
InitializeComponent();
this.DataContext = DeviceChart50LViewModel.GetInstance;
}


@@ -43,122 +45,181 @@ namespace BPASmartClient.Academy.View
switch (liveCharts.ToolTip)
{
case "温度曲线":
plotModel.Series.Clear();
plotModel = new PlotModel() { Title = "温度曲线" };
chartGrid.Visibility = Visibility.Visible;
OxyPlot.Series.LineSeries line = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "反应釜温度", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
OxyPlot.Series.LineSeries line_1 = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "反应釜排气温度", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
OxyPlot.Series.LineSeries line_2 = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "配料罐温度", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
List<DataPoint> twValues = new List<DataPoint>();
List<DataPoint> tvValues = new List<DataPoint>();
List<DataPoint> tmValues = new List<DataPoint>();
Sqlite.GetInstance.SelectId(Simens_PLC.GetInstance.id).ForEach(t =>
{
twValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.TempWok));
tvValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.TempVent));
tmValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.TempMaterial));
plotModel.Series.Clear();
plotModel = new PlotModel() { Title = "温度曲线" };
chartGrid.Visibility = Visibility.Visible;
OxyPlot.Series.LineSeries templine = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "反应釜温度", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
OxyPlot.Series.LineSeries templine_1 = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "冷凝水罐温度", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
List<DataPoint> twValues = new List<DataPoint>();
List<DataPoint> tvValues = new List<DataPoint>();
SqliteOperate.GetInstance.QueryableById(PlcControl.GetInstance.id).ForEach(t =>
{
twValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.Temperature));
tvValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.CondensateWaterTemperature));

});
line.Points.AddRange(twValues);
line_1.Points.AddRange(tvValues);
line_2.Points.AddRange(tmValues);
if (!(plotModel.Axes.Count > 0))
});
templine.Points.AddRange(twValues);
templine_1.Points.AddRange(tvValues);
//line_2.Points.AddRange(tmValues);
if (!(plotModel.Axes.Count > 0))
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "温度/℃", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
}
plotModel.Series.Add(templine);
plotModel.Series.Add(templine_1);
plotModel.InvalidatePlot(true);//重新加载曲线
chartView.Model = plotModel;
}
break;
case "压力曲线":
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "温度/℃", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
plotModel.Series.Clear();
plotModel = new PlotModel() { Title = "反应釜蒸汽压力曲线" };
chartGrid.Visibility = Visibility.Visible;
OxyPlot.Series.LineSeries line = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "反应釜蒸汽压力", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
List<DataPoint> pressure = new List<DataPoint>();
SqliteOperate.GetInstance.QueryableById(PlcControl.GetInstance.id).ForEach(t =>
{
pressure.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.SteamPressure));
});
line.Points.AddRange(pressure);
if (!(plotModel.Axes.Count > 0))
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max, MaximumRange = maxrange });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "压力/Mpa", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2"), IsZoomEnabled = false });
}
plotModel.Series.Add(line);
plotModel.InvalidatePlot(true);//重新加载曲线
chartView.Model = plotModel;
}
plotModel.Series.Add(line);
plotModel.Series.Add(line_1);
plotModel.Series.Add(line_2);
plotModel.InvalidatePlot(true);//重新加载曲线
chartView.Model = plotModel;
break;
case "转速曲线":
plotModel.Series.Clear();
plotModel = new PlotModel() { Title = "转速曲线" };
chartGrid.Visibility = Visibility.Visible;
OxyPlot.Series.LineSeries line_3 = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "反应釜转速", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
OxyPlot.Series.LineSeries line_4 = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "配料罐转速", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
List<DataPoint> m101 = new List<DataPoint>();
List<DataPoint> m102 = new List<DataPoint>();
Sqlite.GetInstance.SelectId(Simens_PLC.GetInstance.id).ForEach(t =>
case "比例阀开度曲线":
{
m101.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.M101_Speed));
m102.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.M102_Speed));
plotModel.Series.Clear();
plotModel = new PlotModel() { Title = "比例阀开度曲线" };
chartGrid.Visibility = Visibility.Visible;
OxyPlot.Series.LineSeries line = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "蒸汽比例阀开度", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
List<DataPoint> open = new List<DataPoint>();
SqliteOperate.GetInstance.QueryableById(PlcControl.GetInstance.id).ForEach(t =>
{
open.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.ProportionalValveOpening));

});
line_3.Points.AddRange(m101);
line_4.Points.AddRange(m102);
if (!(plotModel.Axes.Count > 0))
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "转速/rpm", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
});
line.Points.AddRange(open);
if (!(plotModel.Axes.Count > 0))
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max, MaximumRange = maxrange });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "比例阀开度/%", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2"), IsZoomEnabled = false });
}
plotModel.Series.Add(line);
plotModel.InvalidatePlot(true);//重新加载曲线
chartView.Model = plotModel;
}
plotModel.Series.Add(line_3);
plotModel.Series.Add(line_4);
plotModel.InvalidatePlot(true);//重新加载曲线
chartView.Model = plotModel;
break;
//case "比例阀开度曲线":
// plotModel.Series.Clear();
// plotModel = new PlotModel() { Title = "比例阀开度曲线" };
// chartGrid.Visibility = Visibility.Visible;
// List<DataPoint> open = new List<DataPoint>();
// Sqlite.GetInstance.SelectId(Simens_PLC.GetInstance.id).ForEach(t =>
// {
// open.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.OpenValve));

// });
// line.Points.AddRange(open);
// if (!(plotModel.Axes.Count > 0))
// {
// plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max, MaximumRange = maxrange });
// plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "比例阀开度/挡", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2"), IsZoomEnabled = false });
// }
// plotModel.Series.Add(line);
// plotModel.InvalidatePlot(true);//重新加载曲线
// chartView.Model = plotModel;
// break;
//case "压力曲线":
// plotModel.Series.Clear();
// plotModel = new PlotModel() { Title = "反应釜压力曲线" };
// chartGrid.Visibility = Visibility.Visible;
// List<DataPoint> pressure = new List<DataPoint>();
// Sqlite.GetInstance.SelectId(Simens_PLC.GetInstance.id).ForEach(t =>
// {
// pressure.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.PressureWok));
case "流量曲线":
{
plotModel.Series.Clear();
plotModel = new PlotModel() { Title = "流量曲线" };
chartGrid.Visibility = Visibility.Visible;
OxyPlot.Series.LineSeries templine = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "反应釜蒸汽流量", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
OxyPlot.Series.LineSeries templine_1 = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "负压流量", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
List<DataPoint> twValues = new List<DataPoint>();
List<DataPoint> tvValues = new List<DataPoint>();
SqliteOperate.GetInstance.QueryableById(PlcControl.GetInstance.id).ForEach(t =>
{
twValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.SteamFlowRate));
tvValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.NegativePressureFlowRate));

// });
// line.Points.AddRange(pressure);
// if (!(plotModel.Axes.Count > 0))
// {
// plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max, MaximumRange = maxrange });
// plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "反应釜压力/Mpa", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2"), IsZoomEnabled = false });
// }
// plotModel.Series.Add(line);
// plotModel.InvalidatePlot(true);//重新加载曲线
// chartView.Model = plotModel;
// break;
});
templine.Points.AddRange(twValues);
templine_1.Points.AddRange(tvValues);
if (!(plotModel.Axes.Count > 0))
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "流量", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
}
plotModel.Series.Add(templine);
plotModel.Series.Add(templine_1);
plotModel.InvalidatePlot(true);//重新加载曲线
chartView.Model = plotModel;
}
break;
case "重量曲线":
plotModel.Series.Clear();
plotModel = new PlotModel() { Title = "冷却水罐重量曲线" };
chartGrid.Visibility = Visibility.Visible;
List<DataPoint> ww = new List<DataPoint>();
OxyPlot.Series.LineSeries line_5 = new OxyPlot.Series.LineSeries() { Title = "冷却水罐重量", Color = OxyColor.FromRgb(0, 0, 0), LineStyle = LineStyle.Solid, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
Sqlite.GetInstance.SelectId(Simens_PLC.GetInstance.id).ForEach(t =>
{
ww.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.WeightWok));
plotModel.Series.Clear();
plotModel = new PlotModel() { Title = "重量曲线" };
chartGrid.Visibility = Visibility.Visible;
List<DataPoint> ww = new List<DataPoint>();
List<DataPoint> ww1 = new List<DataPoint>();
OxyPlot.Series.LineSeries line_5 = new OxyPlot.Series.LineSeries() { Title = "冷却水罐重量", Color = OxyColor.FromRgb(110, 79, 79), LineStyle = LineStyle.Solid, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
OxyPlot.Series.LineSeries line_6 = new OxyPlot.Series.LineSeries() { Title = "卤水罐重量", Color = OxyColor.FromRgb(110, 79, 79), LineStyle = LineStyle.Solid, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };

});
line_5.Points.AddRange(ww);
if (!(plotModel.Axes.Count > 0))
SqliteOperate.GetInstance.QueryableById(PlcControl.GetInstance.id).ForEach(t =>
{
ww.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.WeighingWaterTankWeight));
ww1.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.BrineTankWeight));
});
line_5.Points.AddRange(ww);
line_6.Points.AddRange(ww1);
if (!(plotModel.Axes.Count > 0))
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "重量/kg", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
}
plotModel.Series.Add(line_5);
plotModel.Series.Add(line_6);
plotModel.InvalidatePlot(true);//重新加载曲线
chartView.Model = plotModel;
}
break;
case "湿度曲线":
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "冷却水罐重量/kg", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
plotModel.Series.Clear();
plotModel = new PlotModel() { Title = "湿度曲线" };
chartGrid.Visibility = Visibility.Visible;
List<DataPoint> ww = new List<DataPoint>();
OxyPlot.Series.LineSeries line_5 = new OxyPlot.Series.LineSeries() { Title = "冷却水罐湿度", Color = OxyColor.FromRgb(110, 79, 79), LineStyle = LineStyle.Solid, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };

SqliteOperate.GetInstance.QueryableById(PlcControl.GetInstance.id).ForEach(t =>
{
ww.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.CondensateWaterHumidity));
});
line_5.Points.AddRange(ww);
if (!(plotModel.Axes.Count > 0))
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "湿度", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
}
plotModel.Series.Add(line_5);
plotModel.InvalidatePlot(true);//重新加载曲线
chartView.Model = plotModel;
}
break;
case "反应釜角度曲线":
{
plotModel.Series.Clear();
plotModel = new PlotModel() { Title = "反应釜角度曲线" };
chartGrid.Visibility = Visibility.Visible;
List<DataPoint> ww = new List<DataPoint>();
OxyPlot.Series.LineSeries line_5 = new OxyPlot.Series.LineSeries() { Title = "反应釜角度", Color = OxyColor.FromRgb(110, 79, 79), LineStyle = LineStyle.Solid, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };

SqliteOperate.GetInstance.QueryableById(PlcControl.GetInstance.id).ForEach(t =>
{
ww.Add(new DataPoint(DateTimeAxis.ToDouble(t.Createtime), t.ReactEncoderValue));
});
line_5.Points.AddRange(ww);
if (!(plotModel.Axes.Count > 0))
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "角度/°", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
}
plotModel.Series.Add(line_5);
plotModel.InvalidatePlot(true);//重新加载曲线
chartView.Model = plotModel;
}
plotModel.Series.Add(line_5);
plotModel.InvalidatePlot(true);//重新加载曲线
chartView.Model = plotModel;
break;
default:
break;


+ 58
- 143
BPASmartClient.Academy/View/HistoryChart50LView.xaml Прегледај датотеку

@@ -5,11 +5,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.Academy.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:oxy="http://oxyplot.org/wpf"
xmlns:vm="clr-namespace:BPASmartClient.Academy.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
xmlns:oxy="http://oxyplot.org/wpf" xmlns:vm="clr-namespace:BPASmartClient.Academy.ViewModel"
d:DesignHeight="450" d:DesignWidth="800" mc:Ignorable="d">
<UserControl.DataContext>
<vm:HistoryChart50LViewModel />
</UserControl.DataContext>
@@ -50,52 +47,32 @@
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel
Margin="0,0,60,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Horizontal">
Margin="0,0,60,0" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
<TextBlock
VerticalAlignment="Center"
FontSize="16"
Foreground="DeepSkyBlue"
Text="产品编号:" />
VerticalAlignment="Center" FontSize="16" Foreground="DeepSkyBlue" Text="产品编号:" />
<TextBox
Width="200"
Height="30"
Margin="0,0,10,0"
VerticalContentAlignment="Center"
Background="Transparent"
BorderBrush="DeepSkyBlue"
CaretBrush="DeepSkyBlue"
FontSize="16"
Width="200" Height="30" Margin="0,0,10,0" VerticalContentAlignment="Center"
Background="Transparent" BorderBrush="DeepSkyBlue" CaretBrush="DeepSkyBlue" FontSize="16"
Foreground="DeepSkyBlue"
Style="{x:Null}"
Text="{Binding ProductNum}" />

<Button
Width="120"
Height="30"
Width="120" Height="30"
Command="{Binding FindProductCommand}"
Content="查询编号"
Style="{StaticResource ButtonStyle}" />

<TextBlock
Margin="30,0,0,0"
VerticalAlignment="Center"
FontSize="16"
Foreground="DeepSkyBlue"
Margin="30,0,0,0" VerticalAlignment="Center" FontSize="16" Foreground="DeepSkyBlue"
Text="查询时间:" />
<DatePicker
Width="150"
Margin="0,0,10,0"
BorderBrush="DeepSkyBlue"
FontSize="16"
Width="150" Margin="0,0,10,0" BorderBrush="DeepSkyBlue" FontSize="16"
SelectedDate="{Binding SelectTime}"
Style="{DynamicResource PickerStyle}" />

<Button
Width="120"
Height="30"
Width="120" Height="30"
Command="{Binding Select}"
Content="查询"
Style="{StaticResource ButtonStyle}" />
@@ -108,9 +85,7 @@
</Grid.ColumnDefinitions>
<!--#region 表格-->
<Grid
Grid.Column="0"
Margin="20,20,20,300"
Background="Transparent">
Grid.Column="0" Margin="20,20,20,300" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition />
@@ -124,63 +99,36 @@
<ColumnDefinition Width="50" />
</Grid.ColumnDefinitions>
<Border
Grid.ColumnSpan="1"
BorderBrush="#777777"
BorderThickness="0.8" />
Grid.ColumnSpan="1" BorderBrush="#777777" BorderThickness="0.8" />
<Border
Grid.ColumnSpan="2"
BorderBrush="#777777"
BorderThickness="0,0.8,0.8,0.8" />
Grid.ColumnSpan="2" BorderBrush="#777777" BorderThickness="0,0.8,0.8,0.8" />
<Border
Grid.ColumnSpan="3"
BorderBrush="#777777"
BorderThickness="0,0.8,0.8,0.8" />
Grid.ColumnSpan="3" BorderBrush="#777777" BorderThickness="0,0.8,0.8,0.8" />
<Border
Grid.ColumnSpan="4"
BorderBrush="#777777"
BorderThickness="0,0.8,0.8,0.8" />
Grid.ColumnSpan="4" BorderBrush="#777777" BorderThickness="0,0.8,0.8,0.8" />
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="White"
HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16" Foreground="White"
Text="序号" />
<TextBlock
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="White"
Text="配方名称" />
Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"
Foreground="White" Text="配方名称" />
<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="White"
Text="创建时间" />
Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"
Foreground="White" Text="创建时间" />
<TextBlock
Grid.Column="3"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="White"
Text="操作" />
Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"
Foreground="White" Text="操作" />
</Grid>
<!--#endregion-->
<!--#region 表格内容-->
<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
Grid.Row="1" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding RecipeCharts}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid
Height="30"
Margin="0,1"
Background="#163175">
Height="30" Margin="0,1" Background="#163175">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition />
@@ -188,52 +136,30 @@
<ColumnDefinition Width="50" />
</Grid.ColumnDefinitions>
<Border
Grid.ColumnSpan="1"
BorderBrush="#777777"
BorderThickness="0.4" />
Grid.ColumnSpan="1" BorderBrush="#777777" BorderThickness="0.4" />
<Border
Grid.ColumnSpan="2"
BorderBrush="#777777"
BorderThickness="0,0.4,0.4,0.4" />
Grid.ColumnSpan="2" BorderBrush="#777777" BorderThickness="0,0.4,0.4,0.4" />
<Border
Grid.ColumnSpan="3"
BorderBrush="#777777"
BorderThickness="0,0.4,0.4,0.4" />
Grid.ColumnSpan="3" BorderBrush="#777777" BorderThickness="0,0.4,0.4,0.4" />
<Border
Grid.ColumnSpan="4"
BorderBrush="#777777"
BorderThickness="0,0.4,0.4,0.4" />
Grid.ColumnSpan="4" BorderBrush="#777777" BorderThickness="0,0.4,0.4,0.4" />
<TextBlock
x:Name="num"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
x:Name="num" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"
Foreground="White"
Text="{Binding Num}" />
<TextBlock
Grid.Column="1"
Margin="5,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="16"
Foreground="White"
Grid.Column="1" Margin="5,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center"
FontSize="16" Foreground="White"
Text="{Binding Name}" />
<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"
Foreground="White"
Text="{Binding CreateTime, StringFormat={}{0:yyyy-MM-dd}}" />
<RadioButton
x:Name="ceshi"
Grid.Column="3"
x:Name="ceshi" Grid.Column="3"
Command="{Binding DataContext.InspectDataCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}}"
CommandParameter="{Binding Name}"
Content="查看"
FontSize="16"
Foreground="White"
GroupName="sss"
Content="查看" FontSize="16" Foreground="White" GroupName="sss"
Style="{StaticResource setCheck}" />
</Grid>
<!--<Popup
@@ -324,88 +250,77 @@
<UniformGrid Columns="8">
<CheckBox
Command="{Binding CheckedCommand}"
CommandParameter="0"
Content="反应釜温度"
FontSize="14"
CommandParameter="0" Content="反应釜温度" FontSize="14"
Foreground="{StaticResource 反应釜温度}"
IsChecked="{Binding VisStatus[0]}"
IsEnabled="{Binding IsEnable}" />
<CheckBox
Command="{Binding CheckedCommand}"
CommandParameter="1"
Content="反应釜蒸汽压力"
FontSize="14"
CommandParameter="1" Content="反应釜蒸汽压力" FontSize="14"
Foreground="{StaticResource 反应釜蒸汽压力}"
IsChecked="{Binding VisStatus[1]}"
IsEnabled="{Binding IsEnable}" />
<CheckBox
Command="{Binding CheckedCommand}"
CommandParameter="2"
Content="反应釜蒸汽流量"
FontSize="14"
CommandParameter="2" Content="反应釜蒸汽流量" FontSize="14"
Foreground="{StaticResource 反应釜蒸汽流量}"
IsChecked="{Binding VisStatus[2]}"
IsEnabled="{Binding IsEnable}" />
<CheckBox
Command="{Binding CheckedCommand}"
CommandParameter="3"
Content="冷凝水罐温度"
FontSize="14"
CommandParameter="3" Content="冷凝水罐温度" FontSize="14"
Foreground="{StaticResource 冷凝水罐温度}"
IsChecked="{Binding VisStatus[3]}"
IsEnabled="{Binding IsEnable}" />
<CheckBox
Command="{Binding CheckedCommand}"
CommandParameter="4"
Content="冷凝水罐湿度"
FontSize="14"
CommandParameter="4" Content="冷凝水罐湿度" FontSize="14"
Foreground="{StaticResource 冷凝水罐湿度}"
IsChecked="{Binding VisStatus[4]}"
IsEnabled="{Binding IsEnable}" />
<CheckBox
Command="{Binding CheckedCommand}"
CommandParameter="5"
Content="负压流量"
FontSize="14"
CommandParameter="5" Content="负压流量" FontSize="14"
Foreground="{StaticResource 负压流量}"
IsChecked="{Binding VisStatus[5]}"
IsEnabled="{Binding IsEnable}" />
<CheckBox
Command="{Binding CheckedCommand}"
CommandParameter="6"
Content="称重水罐重量"
FontSize="14"
CommandParameter="6" Content="称重水罐重量" FontSize="14"
Foreground="{StaticResource 称重水罐重量}"
IsChecked="{Binding VisStatus[6]}"
IsEnabled="{Binding IsEnable}" />
<CheckBox
Command="{Binding CheckedCommand}"
CommandParameter="7"
Content="比例阀开度"
FontSize="14"
Foreground="{StaticResource 比例阀实际开度}"
CommandParameter="7" Content="反应釜编码器值" FontSize="14"
Foreground="{StaticResource 反应釜编码器值}"
IsChecked="{Binding VisStatus[7]}"
IsEnabled="{Binding IsEnable}" />
<CheckBox
Command="{Binding CheckedCommand}"
CommandParameter="7" Content="比例阀开度" FontSize="14"
Foreground="{StaticResource 比例阀实际开度}"
IsChecked="{Binding VisStatus[8]}"
IsEnabled="{Binding IsEnable}" />
<CheckBox
Command="{Binding CheckedCommand}"
CommandParameter="7" Content="卤水配制罐重量" FontSize="14"
Foreground="{StaticResource 卤水配制罐重量}"
IsChecked="{Binding VisStatus[9]}"
IsEnabled="{Binding IsEnable}" />
</UniformGrid>

<oxy:PlotView
x:Name="chartView"
Grid.Row="1"
Margin="5"
Background="White"
x:Name="chartView" Grid.Row="1" Margin="5" Background="White"
Foreground="White"
Model="{Binding OxyModel}"
PanCursor="Hand" />

<Border
Grid.Row="1"
Background="#dd727272"
Grid.Row="1" Background="#dd727272"
Visibility="{Binding LoadingVis}">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="20"
Text="正在加载数据,请耐心等待..." />
HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20" Text="正在加载数据,请耐心等待..." />
</Border>

</Grid>


+ 3
- 1
BPASmartClient.Academy/ViewModel/DeviceChart50LViewModel.cs Прегледај датотеку

@@ -14,7 +14,9 @@ namespace BPASmartClient.Academy.ViewModel
{
public class DeviceChart50LViewModel : NotifyBase
{
public DeviceChart50LViewModel()
private volatile static DeviceChart50LViewModel _Instance;
public static DeviceChart50LViewModel GetInstance => _Instance ?? (_Instance = new DeviceChart50LViewModel());
private DeviceChart50LViewModel()
{
DataFeedback = new DataFeedBack_50();
var mapper = Mappers.Xy<DataValue>()


+ 5
- 1
BPASmartClient.Academy/ViewModel/HistoryChart50LViewModel.cs Прегледај датотеку

@@ -68,7 +68,9 @@ namespace BPASmartClient.Academy.ViewModel
OxyDataModels.Add(new OxyDataModel(CreateLine("冷凝水罐湿度")));
OxyDataModels.Add(new OxyDataModel(CreateLine("负压流量")));
OxyDataModels.Add(new OxyDataModel(CreateLine("称重水罐重量")));
OxyDataModels.Add(new OxyDataModel(CreateLine("反应釜编码器值")));
OxyDataModels.Add(new OxyDataModel(CreateLine("比例阀实际开度")));
OxyDataModels.Add(new OxyDataModel(CreateLine("卤水配制罐重量")));

SqliteOperate.GetInstance.QueryableByNum(num).ForEach(item =>
{
@@ -80,7 +82,9 @@ namespace BPASmartClient.Academy.ViewModel
OxyDataModels[4].dataPoints.Add(new DataPoint(x, item.CondensateWaterHumidity));
OxyDataModels[5].dataPoints.Add(new DataPoint(x, item.NegativePressureFlowRate));
OxyDataModels[6].dataPoints.Add(new DataPoint(x, item.WeighingWaterTankWeight));
OxyDataModels[7].dataPoints.Add(new DataPoint(x, item.ProportionalValveOpening));
OxyDataModels[7].dataPoints.Add(new DataPoint(x, item.ReactEncoderValue));
OxyDataModels[8].dataPoints.Add(new DataPoint(x, item.ProportionalValveOpening));
OxyDataModels[9].dataPoints.Add(new DataPoint(x, item.BrineTankWeight));
});
OxyDataModels.ForEach(item => { item.AddRange(); });
if (!(OxyModel.Axes.Count > 0))


+ 11
- 13
BPASmartClient.Academy/ViewModel/ReactionKettle50LViewModel.cs Прегледај датотеку

@@ -1,4 +1,6 @@
using BPASmartClient.Academy._50L;
using BPASmartClient.Academy.Model;

using System;
using System.Collections.Generic;
using System.Linq;
@@ -15,29 +17,25 @@ namespace BPASmartClient.Academy.ViewModel
{
Start = new BPARelayCommand(() =>
{
if (Name != "" && PlcControl.GetInstance.IsConnect)
if (!string.IsNullOrEmpty(Name) && PlcControl.GetInstance.IsConnect)
{
switch (Content)
{
case "系统启动":
IsChecked = true;
//DataFeedback dataFeedback = new DataFeedback();
//dataFeedback.Name = Name;
//var snd = new SaveNameData(Name);
//dataFeedback.ProductNumberId = snd.Id;
//Sqlite.GetInstance.AddData(snd);
//Simens_PLC.GetInstance.id = snd.Id;
//Simens_PLC.GetInstance.dataFeedback = dataFeedback;
//Simens_PLC.GetInstance.siemens.Write<bool>("DB1.DBX1002.0", true);
//Simens_PLC.GetInstance.siemens.Write<bool>("DB1.DBX1002.1", true);
DataFeedBack_50 dataFeedback = new ();
dataFeedback.Name = Name;
var snd = new SaveNameData(Name);
dataFeedback.ProductNumberId = snd.Id;
SqliteOperate.GetInstance.Add(snd);
PlcControl.GetInstance.id = snd.Id;
SqliteOperate.GetInstance.DataFeedBacks = dataFeedback;
PlcControl.GetInstance.Write(BoolAddEnum.系统启动, true);
Content = "系统停止";
break;
case "系统停止":
IsChecked = false;
//Simens_PLC.GetInstance.id = "";
//Simens_PLC.GetInstance.siemens.Write<bool>("DB1.DBX1002.0", false);
//Simens_PLC.GetInstance.siemens.Write<bool>("DB1.DBX1002.1", false);
PlcControl.GetInstance.id = "";
PlcControl.GetInstance.Write(BoolAddEnum.系统启动, false);
Content = "系统启动";
break;


Loading…
Откажи
Сачувај