浏览代码

50L实时曲线显示修改

HK研究所反应釜三屏显示
ZhaoGang 1周前
父节点
当前提交
06ac6b28ed
共有 5 个文件被更改,包括 208 次插入143 次删除
  1. +96
    -31
      BPASmartClient.Academy/View/DeviceChart50LView.xaml
  2. +47
    -23
      BPASmartClient.Academy/View/DeviceChart50LView.xaml.cs
  3. +54
    -28
      BPASmartClient.Academy/View/DeviceMotion_2View.xaml
  4. +1
    -1
      BPASmartClient.Academy/View/ReactionKettle50LView.xaml
  5. +10
    -60
      BPASmartClient.Academy/ViewModel/DeviceChart50LViewModel.cs

+ 96
- 31
BPASmartClient.Academy/View/DeviceChart50LView.xaml 查看文件

@@ -197,12 +197,12 @@
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Tomato" StrokeThickness="2"
Stroke="Yellow" StrokeThickness="2"
Values="{Binding PartReferenceData.Temperature}" />
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="AliceBlue" StrokeThickness="2"
Stroke="Green" StrokeThickness="2"
Values="{Binding PartReferenceData.CondensateWaterTemperature}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
@@ -229,6 +229,12 @@
<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="Yellow" />
<TextBlock Foreground="White" Text="反应釜温度_参考" />
<Rectangle
Width="20" Height="2" Margin="10,0,0,2" Fill="Green" />
<TextBlock Foreground="White" Text="冷凝水罐温度_参考" />
</StackPanel>

</StackPanel>
@@ -243,20 +249,23 @@
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="#07F80C" StrokeThickness="2"
Stroke="Red" StrokeThickness="2"
Values="{Binding DataFeedback.SteamPressure}" />
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="#FFFFFF" StrokeThickness="2"
Stroke="Blue" StrokeThickness="2"
Values="{Binding DataFeedback.ReactPressure}" />
<!--<lvc:LineSeries
Fill="Transparent"
LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="#423FFD"
StrokeThickness="2"
Values="{Binding DataFeedback.M102_Speed}" />-->
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Yellow" StrokeThickness="2"
Values="{Binding PartReferenceData.SteamPressure}" />
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Green" StrokeThickness="2"
Values="{Binding PartReferenceData.ReactPressure}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis
@@ -277,18 +286,18 @@
</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" />
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="#FFFFFF" />
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="Yellow" />
<TextBlock Foreground="White" Text="反应釜蒸汽压力_参考" />
<Rectangle
Width="20" Height="2" Margin="10,0,0,2" Fill="Green" />
<TextBlock Foreground="White" Text="反应釜压力_参考" />
</StackPanel>

</StackPanel>
@@ -303,8 +312,13 @@
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="White" StrokeThickness="2"
Stroke="Red" StrokeThickness="2"
Values="{Binding DataFeedback.ProportionalValveOpening}" />
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Yellow" StrokeThickness="2"
Values="{Binding PartReferenceData.ProportionalValveOpening}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis MaxValue="110" MinValue="-10">
@@ -324,8 +338,11 @@
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock Foreground="White" Text="比例阀开度曲线" />
<Rectangle
Width="20" Height="2" Margin="20,0,0,2" Fill="White" />
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="Yellow" />
<TextBlock Foreground="White" Text="蒸汽比例阀开度_参考" />
</StackPanel>

</StackPanel>
@@ -345,8 +362,18 @@
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="#F1C74B" StrokeThickness="2"
Stroke="Blue" StrokeThickness="2"
Values="{Binding DataFeedback.NegativePressureFlowRate}" />
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Yellow" StrokeThickness="2"
Values="{Binding PartReferenceData.SteamFlowRate}" />
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Green" StrokeThickness="2"
Values="{Binding PartReferenceData.NegativePressureFlowRate}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis LabelFormatter="{Binding doubleFormatter}">
@@ -369,8 +396,14 @@
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" />
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="Yellow" />
<TextBlock Foreground="White" Text="反应釜蒸汽流量_参考" />
<Rectangle
Width="20" Height="2" Margin="20,0,0,2" Fill="Green" />
<TextBlock Foreground="White" Text="负压流量_参考" />
</StackPanel>

</StackPanel>
@@ -385,13 +418,23 @@
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Blue" StrokeThickness="2"
Stroke="Red" StrokeThickness="2"
Values="{Binding DataFeedback.WeighingWaterTankWeight}" />
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Brown" StrokeThickness="2"
Stroke="Blue" StrokeThickness="2"
Values="{Binding DataFeedback.BrineTankWeight}" />
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Yellow" StrokeThickness="2"
Values="{Binding PartReferenceData.WeighingWaterTankWeight}" />
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Green" StrokeThickness="2"
Values="{Binding PartReferenceData.BrineTankWeight}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis
@@ -413,11 +456,17 @@
<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" />
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="Brown" />
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="Yellow" />
<TextBlock Foreground="White" Text="冷却水罐重量_参考" />
<Rectangle
Width="20" Height="2" Margin="20,0,0,2" Fill="Green" />
<TextBlock Foreground="White" Text="卤水罐重量_参考" />
</StackPanel>

</StackPanel>
@@ -432,8 +481,13 @@
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="White" StrokeThickness="2"
Stroke="Red" StrokeThickness="2"
Values="{Binding DataFeedback.CondensateWaterHumidity}" />
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Yellow" StrokeThickness="2"
Values="{Binding PartReferenceData.CondensateWaterHumidity}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis MaxValue="110" MinValue="0">
@@ -453,8 +507,11 @@
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock Foreground="White" Text="湿度曲线" />
<Rectangle
Width="20" Height="2" Margin="20,0,0,2" Fill="White" />
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="Yellow" />
<TextBlock Foreground="White" Text="冷凝水罐湿度_参考" />
</StackPanel>

</StackPanel>
@@ -469,8 +526,13 @@
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="White" StrokeThickness="2"
Stroke="Red" StrokeThickness="2"
Values="{Binding DataFeedback.ReactEncoderValue}" />
<lvc:LineSeries
Fill="Transparent" LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Yellow" StrokeThickness="2"
Values="{Binding PartReferenceData.ReactEncoderValue}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis MaxValue="400" MinValue="-10">
@@ -490,8 +552,11 @@
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock Foreground="White" Text="反应釜角度曲线" />
<Rectangle
Width="20" Height="2" Margin="20,0,0,2" Fill="White" />
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="Yellow" />
<TextBlock Foreground="White" Text="反应釜编码器角度值_参考" />
</StackPanel>

</StackPanel>


+ 47
- 23
BPASmartClient.Academy/View/DeviceChart50LView.xaml.cs 查看文件

@@ -18,6 +18,8 @@ using System.Windows.Navigation;
using System.Windows.Shapes;
using ThingsGateway.Foundation.Core;
using BPASmartClient.Academy._50L;
using ThingsGateway.Foundation.Extension.String;
using BPASmartClient.CustomResource.UserControls.MessageShow;

namespace BPASmartClient.Academy.View
{
@@ -38,11 +40,22 @@ namespace BPASmartClient.Academy.View
public PlotModel plotModel { get; set; } = new PlotModel();
private void DataView_CLick(object sender, MouseButtonEventArgs e)
{
var datas = SqliteOperate.GetInstance.QueryableById(PlcControl.GetInstance.id);
if (datas is null || datas.Count==0)
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error,App.MainWindow,"无数据","当前无曲线数据。");
return;
}
ooo.Visibility = Visibility.Collapsed;
double min = DateTimeAxis.ToDouble(System.DateTime.Now.AddMinutes(-10));
double max = DateTimeAxis.ToDouble(System.DateTime.Now);
double maxrange = max - min;
CartesianChart liveCharts = sender as CartesianChart;
double min = DateTimeAxis.ToDouble(DateTime.MinValue);

DateTime startTime = datas.Select(x => x.Createtime).Min();
double max = DateTimeAxis.ToDouble(new DateTime((datas.Select(x=>x.Createtime).Max().AddMinutes(6) - startTime).Ticks));
//double min = DateTimeAxis.ToDouble(DateTime.Now.AddMinutes(-10));
//double max = DateTimeAxis.ToDouble(DateTime.Now);
double maxrange = max - min;

switch (liveCharts.ToolTip)
{
@@ -51,27 +64,31 @@ namespace BPASmartClient.Academy.View
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>();
ConcurrentDictionary<DateTime,float> keyValues = new ConcurrentDictionary<DateTime,float>();
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));
keyValues[t.Createtime] = t.Temperature;
});
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 DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间", StringFormat = "hh:mm:ss", AbsoluteMinimum = min, AbsoluteMaximum = 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);
List<HistoryDataPoint> reactorTemp = new();
List<HistoryDataPoint> CWTTemp = new();
datas.ForEach(t =>
{
var time =new DateTime((t.Createtime - startTime).Ticks);
reactorTemp.Add(new(time, t.Temperature));
CWTTemp.Add(new(time, t.CondensateWaterTemperature));
});
AddOxyLineSeries("反应釜温度", OxyColor.FromRgb(110, 79, 79), reactorTemp);
AddOxyLineSeries("冷凝水罐温度", OxyColor.FromRgb(110, 79, 79), CWTTemp);
if (this.DataContext is DeviceChart50LViewModel viewModel && viewModel.ReferenceData != null)
{
List<HistoryDataPoint> refReactorTemp = new();
List<HistoryDataPoint> refCWTTemp = new();
refReactorTemp = viewModel.ReferenceData.Temperature.Select(x => new HistoryDataPoint(x.DateTime, (float)x.Value)).ToList();
refCWTTemp = viewModel.ReferenceData.CondensateWaterTemperature.Select(x => new HistoryDataPoint(x.DateTime, (float)x.Value)).ToList();
AddOxyLineSeries("反应釜温度_参考", OxyColor.FromRgb(110, 79, 79), refReactorTemp);
AddOxyLineSeries("冷凝水罐温度_参考", OxyColor.FromRgb(110, 79, 79), refCWTTemp);
}
plotModel.InvalidatePlot(true);//重新加载曲线
chartView.Model = plotModel;
}
@@ -233,7 +250,7 @@ namespace BPASmartClient.Academy.View
break;
}
}
private void AddOxyLineSeries(string title,OxyColor markerFill, ConcurrentDictionary<DateTime, float> keyValues)
private void AddOxyLineSeries(string title,OxyColor markerFill, List<HistoryDataPoint> dataPoints)
{
OxyPlot.Series.LineSeries templine = new OxyPlot.Series.LineSeries()
{ LineStyle = LineStyle.Solid,
@@ -243,9 +260,9 @@ namespace BPASmartClient.Academy.View
LineLegendPosition = OxyPlot.Series.LineLegendPosition.End
};
List<DataPoint> twValues = new List<DataPoint>();
foreach (var item in keyValues)
foreach (var item in dataPoints)
{
twValues.Add(new DataPoint(DateTimeAxis.ToDouble(item.Key), item.Value));
twValues.Add(new DataPoint(DateTimeAxis.ToDouble(item.DateTime), item.Value));
}
templine.Points.AddRange(twValues);
plotModel.Series.Add(templine);
@@ -259,5 +276,12 @@ namespace BPASmartClient.Academy.View
plotModel.InvalidatePlot(true);
chartView.Model = plotModel;
}

record HistoryDataPoint(DateTime DateTime, float Value);
//class HistoryDataPoint
//{
// public DateTime DateTime { get; set; }
// public float Value { get; set; }
//}
}
}

+ 54
- 28
BPASmartClient.Academy/View/DeviceMotion_2View.xaml 查看文件

@@ -89,6 +89,7 @@
</Style>
</UserControl.Resources>
<Grid>
<!--#region 设备类型选择 -->
<Grid
Height="50" HorizontalAlignment="Right" VerticalAlignment="Top">
<Border Margin="0,0,100,0" HorizontalAlignment="Center">
@@ -99,6 +100,7 @@
Style="{StaticResource ButtonStyle}" />
</Border>
</Grid>
<!--#endregion-->
<Grid
x:Name="ooo" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" d:IsHitTestVisible="True"
d:Opacity="1" IsHitTestVisible="False" Opacity="0.5">
@@ -107,6 +109,7 @@
<RowDefinition Height="0" />
</Grid.RowDefinitions>
<Grid>
<!--#region 控件显示主体 -->
<Grid Margin="0,100">
<Viewbox Stretch="Uniform">
<Canvas
@@ -212,9 +215,10 @@

<!--#region 阀门4 回水阀-->
<TextBlock
Canvas.Left="507" Canvas.Top="220" FontSize="10"
Canvas.Left="507" Canvas.Top="220" HorizontalAlignment="Left" VerticalAlignment="Center"
FontSize="10"
Foreground="{Binding DeviceStatus.VX103, Converter={StaticResource deviceConvert}, ConverterParameter=4}"
Text="回水阀" HorizontalAlignment="Left" VerticalAlignment="Center" />
Text="回水阀" />
<StackPanel
Canvas.Left="427" Canvas.Top="200" Orientation="Horizontal">
<bpa:PipeLineH
@@ -460,10 +464,10 @@
Foreground="{Binding DeviceStatus.VX109, Converter={StaticResource deviceConvert}, ConverterParameter=4}"
Text="蒸汽疏水阀" />
<bpa:PipeLineV
Width="12" Height="43"
Canvas.Left="348" Canvas.Top="287" Width="12" Height="43"
Direction="{Binding DeviceStatus.VX109, Converter={StaticResource deviceConvert}, ConverterParameter=1}"
Fill="{Binding DeviceStatus.VX109, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
LineWidth="4" Canvas.Left="348" Canvas.Top="287" />
LineWidth="4" />
<bpa:HandValve
Width="35" Height="35" Margin="341,296,402,154"
OpenEnable="{Binding DeviceStatus.VX109}"
@@ -513,9 +517,10 @@

<!--#region 阀门12 冷却水排水阀-->
<TextBlock
Canvas.Left="23" Canvas.Top="306" FontSize="10"
Canvas.Left="23" Canvas.Top="306" HorizontalAlignment="Left" VerticalAlignment="Center"
FontSize="10"
Foreground="{Binding DeviceStatus.VX111, Converter={StaticResource deviceConvert}, ConverterParameter=4}"
Text="冷却水排水阀" HorizontalAlignment="Left" VerticalAlignment="Center" />
Text="冷却水排水阀" />
<bpa:PipeLineV
Width="12" Height="50" Margin="105,290,402,154"
Direction="{Binding DeviceStatus.VX111, Converter={StaticResource deviceConvert}, ConverterParameter=1}"
@@ -681,9 +686,10 @@
</bpa:HandValve>
</StackPanel>
<TextBlock
Canvas.Left="178" Canvas.Top="340" FontSize="10"
Canvas.Left="178" Canvas.Top="340" HorizontalAlignment="Left" VerticalAlignment="Center"
FontSize="10"
Foreground="{Binding DeviceStatus.VX114, Converter={StaticResource deviceConvert}, ConverterParameter=4}"
Text="出料阀" HorizontalAlignment="Left" VerticalAlignment="Center" />
Text="出料阀" />
<!--#endregion-->

<!--#region 水罐-->
@@ -717,20 +723,23 @@

<!--#region 仪器标注-->
<TextBlock
Canvas.Left="107" Canvas.Top="84" FontSize="10" Foreground="Blue"
Text="配料罐" HorizontalAlignment="Left" VerticalAlignment="Center" />
Canvas.Left="107" Canvas.Top="84" HorizontalAlignment="Left" VerticalAlignment="Center"
FontSize="10" Foreground="Blue" Text="配料罐" />
<TextBlock
Canvas.Left="92" Canvas.Top="70" Width="60" Foreground="Red"
Text="{Binding DeviceStatus.TempMaterial, StringFormat='{}{0}℃'}"
TextAlignment="Center" />
<TextBlock
Canvas.Left="217" Canvas.Top="290" Foreground="Blue" Text="反应釜" FontSize="10" HorizontalAlignment="Left" VerticalAlignment="Center"/>
Canvas.Left="217" Canvas.Top="290" HorizontalAlignment="Left" VerticalAlignment="Center"
FontSize="10" Foreground="Blue" Text="反应釜" />
<TextBlock
Canvas.Left="203" Canvas.Top="250" Width="60" Foreground="Red" FontSize="10"
Canvas.Left="203" Canvas.Top="250" Width="60" FontSize="10"
Foreground="Red"
Text="{Binding DeviceStatus.TempWok, StringFormat='{}{0}℃'}"
TextAlignment="Center" />
<TextBlock
Canvas.Left="203" Canvas.Top="270" Width="60" Foreground="Red" FontSize="10"
Canvas.Left="203" Canvas.Top="270" Width="60" FontSize="10"
Foreground="Red"
Text="{Binding DeviceStatus.PressureWok, StringFormat='{}{0:f2}mpa'}"
TextAlignment="Center" />
<StackPanel
@@ -750,18 +759,21 @@
Text="{Binding DeviceStatus.OpenValue, StringFormat='{}{0:f2}%'}" />
</StackPanel>
<TextBlock
Canvas.Left="573" Canvas.Top="88" Foreground="Blue" Text="冷凝器" FontSize="10" HorizontalAlignment="Left" VerticalAlignment="Center"/>
Canvas.Left="573" Canvas.Top="88" HorizontalAlignment="Left" VerticalAlignment="Center"
FontSize="10" Foreground="Blue" Text="冷凝器" />
<TextBlock
Canvas.Left="389" Canvas.Top="30" Width="150" d:Text="反应釜排气温度:12.33℃"
FontSize="10" Foreground="Red"
Text="{Binding DeviceStatus.TempVent, StringFormat='反应釜排气温度:{0}℃'}"
TextAlignment="Center" />
<TextBlock
Canvas.Left="573" Canvas.Top="168" Foreground="Blue" Text="蒸馏罐" FontSize="10" HorizontalAlignment="Left" VerticalAlignment="Center"/>
Canvas.Left="573" Canvas.Top="168" HorizontalAlignment="Left" VerticalAlignment="Center"
FontSize="10" Foreground="Blue" Text="蒸馏罐" />
<TextBlock
Canvas.Left="590" Canvas.Top="312" Foreground="Blue" Text="水罐" FontSize="10" HorizontalAlignment="Left" VerticalAlignment="Center"/>
Canvas.Left="590" Canvas.Top="312" HorizontalAlignment="Left" VerticalAlignment="Center"
FontSize="10" Foreground="Blue" Text="水罐" />
<TextBlock
Canvas.Left="570" Canvas.Top="295" Width="60" FontSize="10"
Canvas.Left="570" Canvas.Top="295" Width="60" FontSize="10"
Foreground="Red"
Text="{Binding DeviceStatus.WeightWok, StringFormat='{}{0:f2}g'}"
TextAlignment="Center" />
@@ -772,7 +784,7 @@

<!--#region 水罐重量清零-->
<Button
Canvas.Left="480" Canvas.Top="370" Width="100" Height="22"
Canvas.Left="480" Canvas.Top="370" Width="100" Height="22"
VerticalAlignment="Center" Click="ClearBtn_CLick" Content="水罐重量清零" FontSize="10"
Style="{StaticResource ButtonStyle}" />
<!--#endregion-->
@@ -865,7 +877,8 @@
Text="⬛" TextAlignment="Center" />
</StackPanel>
<StackPanel
Canvas.Left="483" Canvas.Top="86" Orientation="Vertical" HorizontalAlignment="Left" VerticalAlignment="Center">
Canvas.Left="483" Canvas.Top="86" HorizontalAlignment="Left" VerticalAlignment="Center"
Orientation="Vertical">
<RadioButton
Width="55" Height="22" Margin="0,0,0,2" BorderThickness="0"
Click="Open_Click" Content="回油阀:开" FontSize="8" Foreground="White"
@@ -947,7 +960,7 @@
<RadioButton
Width="70" Height="22" Margin="0,0,0,2" BorderThickness="0"
Click="Open_Click" Content="配料釜蒸汽阀:开" FontSize="8" Foreground="White"
GroupName="8"
GroupName="10"
Style="{StaticResource radiobutton}"
Tag="10" />
<RadioButton
@@ -957,8 +970,9 @@
Style="{StaticResource radiobutton}"
Tag="10" />
</StackPanel>
<StackPanel Canvas.Top="248" HorizontalAlignment="Left" VerticalAlignment="Center"
Orientation="Vertical" Canvas.Left="10">
<StackPanel
Canvas.Left="10" Canvas.Top="248" HorizontalAlignment="Left" VerticalAlignment="Center"
Orientation="Vertical">
<RadioButton
Width="55" Height="22" Margin="0,0,0,2" BorderThickness="0"
Click="Open_Click" Content="蒸汽阀:开" FontSize="8" Foreground="White"
@@ -973,7 +987,8 @@
Tag="11" />
</StackPanel>
<StackPanel
Canvas.Left="272" Canvas.Top="318" Orientation="Vertical" HorizontalAlignment="Left" VerticalAlignment="Center">
Canvas.Left="272" Canvas.Top="318" HorizontalAlignment="Left" VerticalAlignment="Center"
Orientation="Vertical">
<RadioButton
Width="70" Height="22" Margin="0,0,0,2" BorderThickness="0"
Click="Open_Click" Content="蒸汽疏水阀:开" FontSize="8" Foreground="White"
@@ -988,7 +1003,8 @@
Tag="12" />
</StackPanel>
<StackPanel
Canvas.Left="396" Canvas.Top="255" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top">
Canvas.Left="396" Canvas.Top="255" HorizontalAlignment="Center" VerticalAlignment="Top"
Orientation="Vertical">
<RadioButton
Width="70" Height="22" Margin="0,0,0,2" BorderThickness="0"
Click="Open_Click" Content="冷却水给水阀:开" FontSize="8" Foreground="White"
@@ -1002,8 +1018,9 @@
Style="{StaticResource radiobutton}"
Tag="13" />
</StackPanel>
<StackPanel Canvas.Top="322" HorizontalAlignment="Center" VerticalAlignment="Top"
Orientation="Vertical" Canvas.Left="19">
<StackPanel
Canvas.Left="19" Canvas.Top="322" HorizontalAlignment="Center" VerticalAlignment="Top"
Orientation="Vertical">
<RadioButton
Width="70" Height="22" Margin="0,0,0,2" BorderThickness="0"
Click="Open_Click" Content="冷却水排水阀:开" FontSize="8" Foreground="White"
@@ -1018,7 +1035,8 @@
Tag="18" />
</StackPanel>
<StackPanel
Canvas.Left="770" Canvas.Top="128" Orientation="Vertical" HorizontalAlignment="Left" VerticalAlignment="Center">
Canvas.Left="770" Canvas.Top="128" HorizontalAlignment="Left" VerticalAlignment="Center"
Orientation="Vertical">
<RadioButton
Width="70" Height="22" Margin="0,0,0,2" BorderThickness="0"
Click="Open_Click" Content="分馏真空阀:开" FontSize="8" Foreground="White"
@@ -1049,7 +1067,8 @@
Tag="20" />
</StackPanel>
<StackPanel
Canvas.Left="773" Canvas.Top="279" Orientation="Vertical" HorizontalAlignment="Left" VerticalAlignment="Center">
Canvas.Left="773" Canvas.Top="279" HorizontalAlignment="Left" VerticalAlignment="Center"
Orientation="Vertical">
<RadioButton
Width="55" Height="22" Margin="0,0,0,2" BorderThickness="0"
Click="Open_Click" Content="真空泵:开" FontSize="8" Foreground="White"
@@ -1437,6 +1456,8 @@
</Canvas>
</Viewbox>
</Grid>
<!--#endregion-->
<!--#region 底部参数设置窗体 -->
<Grid>
<Grid Margin="8,-3,-8,3">
<Grid.RowDefinitions>
@@ -1625,16 +1646,20 @@
</Grid>
</Grid>
</Grid>
<!--#endregion-->
</Grid>



</Grid>

<!--#region 未连接遮罩 -->
<TextBlock
x:Name="state" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="100"
FontWeight="Black" Text="设备未连接" Visibility="Collapsed" />
<!--#endregion-->

<!--#region 搅拌频率设置弹窗 -->
<Grid
x:Name="hzSet" Width="800" Height="500" Visibility="Collapsed">
<Grid.Background>
@@ -1674,5 +1699,6 @@
</StackPanel>
</UniformGrid>
</Grid>
<!--#endregion-->
</Grid>
</UserControl>

+ 1
- 1
BPASmartClient.Academy/View/ReactionKettle50LView.xaml 查看文件

@@ -1118,7 +1118,7 @@


<Grid
Canvas.Left="384" Canvas.Top="399" Panel.ZIndex="8">
Canvas.Left="384" Canvas.Top="399" Panel.ZIndex="8" MouseLeftButtonDown="Canvas_MouseDown">
<bpa:HandValve
Canvas.Right="400"
EdgeColor="{Binding DeviceStatus.ReactPressureAirInValve, ConverterParameter=2, Converter={StaticResource deviceConvert}}"


+ 10
- 60
BPASmartClient.Academy/ViewModel/DeviceChart50LViewModel.cs 查看文件

@@ -43,38 +43,17 @@ namespace BPASmartClient.Academy.ViewModel

InspectDataCommand = new BPARelayCommand<string>(s => { OxyInit(s); });

CheckedCommand = new BPARelayCommand<string>(async s =>
{
if (int.TryParse(s, out int index))
{
if (VisStatus.Length == OxyDataModels.Count && index >= 0 && index < VisStatus.Length)
{
IsEnable = false;

await Task.Run(() =>
{
sw.Start();
if (VisStatus[index]) OxyModel.Series.Add(OxyDataModels[index].Line);
else OxyModel.Series.Remove(OxyDataModels[index].Line);
OxyModel.InvalidatePlot(true); //重新加载曲线
IsEnable = true;
Debug.WriteLine(sw.ElapsedMilliseconds);
sw.Restart();
});

}
}
});

ShowRefrenceWindowCommand = new BPARelayCommand(() => {
ReferenceWindownVisiblity = Visibility.Visible;
});
HiddenRefrenceWindowCommand = new BPARelayCommand(() => {
ReferenceWindownVisiblity = Visibility.Collapsed;
});
Task.Factory.StartNew(async () =>
_tokenSource = new CancellationTokenSource();
Task.Factory.StartNew(async (o) =>
{
while (true)
while (!_tokenSource.IsCancellationRequested)
{
if (ReferenceData != null && ReferenceData.Temperature.Count > 0)
{
@@ -108,10 +87,15 @@ namespace BPASmartClient.Academy.ViewModel
}
await Task.Delay(2000);
}
}, TaskCreationOptions.LongRunning);
}, TaskCreationOptions.LongRunning,_tokenSource.Token);
}

~DeviceChart50LViewModel()
{
_tokenSource.Cancel(false);
}

private CancellationTokenSource _tokenSource;
private DataFeedBack_50 dataFeedback;
public DataFeedBack_50 DataFeedback { get { return dataFeedback; } set { dataFeedback = value; OnPropertyChanged(); } }

@@ -158,20 +142,6 @@ namespace BPASmartClient.Academy.ViewModel

}

private OxyLineSeries CreateLine(string title)
{
var scb = Application.Current.TryFindResource(title) as SolidColorBrush;
var color = scb.ToOxyColor();
return new OxyLineSeries()
{
LineStyle = LineStyle.Solid,
Title = title,
MarkerFill = scb.ToOxyColor(),
MarkerSize = 2,
LineLegendPosition = LineLegendPosition.End,
Color = color,
};
}

private void LoadNames(List<SaveNameData> data)
{
@@ -194,8 +164,6 @@ namespace BPASmartClient.Academy.ViewModel
});
}

public List<OxyDataModel> OxyDataModels { get; set; } = new List<OxyDataModel>();

public ObservableCollection<RecipeChart> RecipeCharts { get; set; } = new ObservableCollection<RecipeChart>();

public DateTime SelectTime { get { return _mSelectTime; } set { _mSelectTime = value; OnPropertyChanged(); } }
@@ -204,24 +172,7 @@ namespace BPASmartClient.Academy.ViewModel
public string ProductNum { get { return _mProductNum; } set { _mProductNum = value; OnPropertyChanged(); } }
private string _mProductNum;

public PlotModel OxyModel { get { return _mOxyModel; } set { _mOxyModel = value; OnPropertyChanged(); } }
private PlotModel _mOxyModel = new PlotModel();


public bool[] VisStatus { get { return _mVisStatus; } set { _mVisStatus = value; OnPropertyChanged(); } }
private bool[] _mVisStatus = new bool[11];

public bool IsEnable
{
get { return _mIsEnable; }
set
{
_mIsEnable = value;
LoadingVis = value ? Visibility.Collapsed : Visibility.Visible;
OnPropertyChanged();
}
}
private bool _mIsEnable = true;

public Visibility LoadingVis { get { return _mLoadingVis; } set { _mLoadingVis = value; OnPropertyChanged(); } }
private Visibility _mLoadingVis = Visibility.Collapsed;
@@ -233,7 +184,6 @@ namespace BPASmartClient.Academy.ViewModel

public BPARelayCommand<string> InspectDataCommand { get; set; }

public BPARelayCommand<string> CheckedCommand { get; set; }

public BPARelayCommand ShowRefrenceWindowCommand { get;private set; }
public BPARelayCommand HiddenRefrenceWindowCommand { get; private set; }


正在加载...
取消
保存