Browse Source

调试修改

reconfiguration
ZhaoGang 2 months ago
parent
commit
22d297c9ad
12 changed files with 142 additions and 72 deletions
  1. +82
    -20
      BPASmartClient.Academy/50L/PlcControl.cs
  2. +1
    -1
      BPASmartClient.Academy/50L/SqliteOperate.cs
  3. +1
    -1
      BPASmartClient.Academy/App.xaml.cs
  4. +1
    -1
      BPASmartClient.Academy/BPASmartClient.Academy.csproj
  5. +8
    -8
      BPASmartClient.Academy/View/DeviceChart50LView.xaml
  6. +1
    -1
      BPASmartClient.Academy/View/DeviceChart50LView.xaml.cs
  7. +5
    -5
      BPASmartClient.Academy/View/HistoryChart50LView.xaml
  8. +3
    -3
      BPASmartClient.Academy/View/HistoryChartView.xaml
  9. +25
    -19
      BPASmartClient.Academy/View/ReactionKettle50LView.xaml
  10. +4
    -4
      BPASmartClient.Academy/View/ReactionKettle50LView.xaml.cs
  11. +3
    -3
      BPASmartClient.Academy/ViewModel/DeviceChart50LViewModel.cs
  12. +8
    -6
      BPASmartClient.Academy/ViewModel/HistoryChart50LViewModel.cs

+ 82
- 20
BPASmartClient.Academy/50L/PlcControl.cs View File

@@ -7,6 +7,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Collections.Concurrent;
using System.Diagnostics;
using BPA.Helper;

namespace BPASmartClient.Academy._50L
{
@@ -22,22 +23,25 @@ namespace BPASmartClient.Academy._50L
public string id { get; set; } = "";
private bool _lastConnectState;
private volatile uint _readFailureCount;
private Timer _readTrendDataTimer;
public void Init()
{
Task.Factory.StartNew(() =>
{
CommHelper.CreateSiemens(CpuType.S7200Smart, Json<DevicePar>.Data.IpAddress).OnSuccess(s =>
CommHelper.CreateSiemens(CpuType.S71500, Json<DevicePar>.Data.IpAddress).OnSuccess(s =>
{
comm = s.Content;
_lastConnectState = true;
IsConnectChanged?.Invoke(true);
Read();
//_readTrendDataTimer = new(ReadTrendData, null,0,2000);
});
});
}

}


private volatile bool _isReadSuccess;
private void Read()
{
TaskManage.GetInstance.StartLong(() =>
@@ -84,6 +88,7 @@ namespace BPASmartClient.Academy._50L
#endregion
}).OnFailure((s) => { _readFailureCount++; });


comm.Read<float[]>("DB1.DBD2006", 10).OnSuccess(s =>
{
//Data[FeedbackData.反应釜温度] = s.Content[0];
@@ -120,12 +125,22 @@ namespace BPASmartClient.Academy._50L
ProportionalValveOpening = s.Content[8],
BrineTankWeight = s.Content[9]
};
SqliteOperate.GetInstance.Add(sampling);
SqliteOperate.GetInstance.RealtimeChart(sampling);

}).OnFailure((s) => { _readFailureCount++; });

comm.Read<bool[]>("DB1.DBX1003.7", 1).OnSuccess(s => DeviceStatus.HeartBeat = s.Content[0] ).OnFailure((s) => { _readFailureCount++; });
if (Delay.GetInstance("趋势数据").Start(_isReadSuccess, 2))
{
_isReadSuccess = false;
}
else if (!_isReadSuccess)
{
SqliteOperate.GetInstance.RealtimeChart(sampling);
if (!string.IsNullOrWhiteSpace(id))
{
sampling.ProductNumberId = id;
SqliteOperate.GetInstance.Add(sampling);
}
_isReadSuccess = true;
}
});
comm.Read<bool>("DB1.DBX1003.7", 1).OnSuccess(s => DeviceStatus.HeartBeat = s.Content ).OnFailure((s) => { _readFailureCount++; });

comm.Read<bool[]>("DB1.DBX2004.0", 16).OnSuccess(s =>
{
@@ -136,21 +151,22 @@ namespace BPASmartClient.Academy._50L
AlarmHelper.GetInstance.Get<AlarmData>("50L反应釜").CompressorError = s.Content[4];
}).OnFailure((s) => { _readFailureCount++; });

if (Delay.GetInstance("心跳").Start(FeedbackData.心跳.GetValue<bool>(), 3))
if (Delay.GetInstance("心跳").Start(!DeviceStatus.HeartBeat, 2))
{
Write(BoolAddEnum.心跳, true);
}
if (_readFailureCount > 3 && _lastConnectState)
{
_lastConnectState = false;
IsConnectChanged?.Invoke(false);
}
if (_readFailureCount == 0 && !_lastConnectState)
{
_lastConnectState = true;
IsConnectChanged?.Invoke(true);
}
Thread.Sleep(10);
//if (_readFailureCount > 3 && _lastConnectState)
//{
// _lastConnectState = false;
// IsConnectChanged?.Invoke(false);
//}
//if (_readFailureCount == 0 && !_lastConnectState)
//{
// _lastConnectState = true;
// IsConnectChanged?.Invoke(true);
//}
IsConnectChanged?.Invoke(this.IsConnect);
Thread.Sleep(100);
}, "数据获取", true);
//ThreadManage.GetInstance.StartLong(() =>
//{
@@ -162,6 +178,52 @@ namespace BPASmartClient.Academy._50L

}

private void ReadTrendData(object? state)
{
if (comm.IsConnected())
{
comm.Read<float[]>("DB1.DBD2006", 10).OnSuccess(s =>
{
//Data[FeedbackData.反应釜温度] = s.Content[0];
//Data[FeedbackData.反应釜蒸汽压力] = s.Content[1];
//Data[FeedbackData.反应釜蒸汽流量] = s.Content[2];
//Data[FeedbackData.冷凝水罐温度] = s.Content[3];
//Data[FeedbackData.冷凝水罐湿度] = s.Content[4];
//Data[FeedbackData.负压流量] = s.Content[5];
//Data[FeedbackData.称重水罐重量] = s.Content[6];
//Data[FeedbackData.反应釜编码器值] = s.Content[7];
//Data[FeedbackData.蒸汽比例阀实际开度] = s.Content[8];
DeviceStatus.ReactTemp = s.Content[0];
DeviceStatus.ReactSteamPressure = s.Content[1];
DeviceStatus.ReactSteamFlow = s.Content[2];
DeviceStatus.ColdWaterTankTemp = s.Content[3];
DeviceStatus.ColdWaterTankHumidity = s.Content[4];
DeviceStatus.VacuumFlow = s.Content[5];
DeviceStatus.WaterTankWeight = s.Content[6];
DeviceStatus.ReactEncoderValue = s.Content[7];
DeviceStatus.SteamProportValveRealOpening = s.Content[8];
DeviceStatus.BrineTankWeight = s.Content[9];


SamplingData sampling = new SamplingData()
{
Temperature = s.Content[0],
SteamPressure = s.Content[1],
SteamFlowRate = s.Content[2],
CondensateWaterTemperature = s.Content[3],
CondensateWaterHumidity = s.Content[4],
NegativePressureFlowRate = s.Content[5],
WeighingWaterTankWeight = s.Content[6],
ReactEncoderValue = s.Content[7],
ProportionalValveOpening = s.Content[8],
BrineTankWeight = s.Content[9]
};
SqliteOperate.GetInstance.Add(sampling);
SqliteOperate.GetInstance.RealtimeChart(sampling);

});
}
}
public OperateResult Write(BoolAddEnum add, bool value)
{
if (boolAdds.ContainsKey(add))


+ 1
- 1
BPASmartClient.Academy/50L/SqliteOperate.cs View File

@@ -123,7 +123,7 @@ namespace BPASmartClient.Academy._50L
{
try
{
return Db.Queryable<SamplingData>().SplitTable().Where(p => p.Id == id).ToList();
return Db.Queryable<SamplingData>().SplitTable().Where(p => p.ProductNumberId == id).ToList();
}
catch (Exception ex) { return new List<SamplingData>(); }
}


+ 1
- 1
BPASmartClient.Academy/App.xaml.cs View File

@@ -322,7 +322,7 @@ namespace BPASmartClient.Academy
Simens_PLC.GetInstance.Connect();
break;
case ProjectType.HKYF20240916:
//SqliteOperate.GetInstance.Init();
SqliteOperate.GetInstance.Init();
PlcControl.GetInstance.Init();
break;
default:


+ 1
- 1
BPASmartClient.Academy/BPASmartClient.Academy.csproj View File

@@ -20,7 +20,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Communication" Version="1.0.178" />
<PackageReference Include="BPA.Communication" Version="1.0.183" />
<PackageReference Include="LiveCharts.Wpf" Version="0.9.7" />
<PackageReference Include="OxyPlot.Wpf" Version="2.1.2" />
</ItemGroup>


+ 8
- 8
BPASmartClient.Academy/View/DeviceChart50LView.xaml View File

@@ -8,9 +8,9 @@
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>
<UserControl.DataContext>
<vm:DeviceChart50LViewModel />
</UserControl.DataContext>-->
</UserControl.DataContext>
<Grid>
<ScrollViewer x:Name="ooo" Grid.Row="1">

@@ -35,7 +35,7 @@
Values="{Binding DataFeedback.CondensateWaterTemperature}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis MaxValue="200" MinValue="0">
<lvc:Axis MaxValue="210" MinValue="-10">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
@@ -85,7 +85,7 @@
<lvc:CartesianChart.AxisY>
<lvc:Axis
LabelFormatter="{Binding doubleFormatter}"
MaxValue="0.6" MinValue="-0.1">
MaxValue="0.7" MinValue="-0.2">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
@@ -128,7 +128,7 @@
Values="{Binding DataFeedback.ProportionalValveOpening}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis MaxValue="100" MinValue="0">
<lvc:Axis MaxValue="110" MinValue="-10">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
@@ -217,7 +217,7 @@
<lvc:CartesianChart.AxisY>
<lvc:Axis
LabelFormatter="{Binding doubleFormatter}"
MaxValue="30" MinValue="-5">
MaxValue="35" MinValue="-5">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
@@ -257,7 +257,7 @@
Values="{Binding DataFeedback.CondensateWaterHumidity}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis MaxValue="100" MinValue="0">
<lvc:Axis MaxValue="110" MinValue="0">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
@@ -294,7 +294,7 @@
Values="{Binding DataFeedback.ReactEncoderValue}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis MaxValue="400" MinValue="0">
<lvc:Axis MaxValue="400" MinValue="-10">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>


+ 1
- 1
BPASmartClient.Academy/View/DeviceChart50LView.xaml.cs View File

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




+ 5
- 5
BPASmartClient.Academy/View/HistoryChart50LView.xaml View File

@@ -95,7 +95,7 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="200" />
<ColumnDefinition Width="50" />
</Grid.ColumnDefinitions>
<Border
@@ -132,7 +132,7 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="200" />
<ColumnDefinition Width="50" />
</Grid.ColumnDefinitions>
<Border
@@ -154,7 +154,7 @@
<TextBlock
Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"
Foreground="White"
Text="{Binding CreateTime, StringFormat={}{0:yyyy-MM-dd}}" />
Text="{Binding CreateTime, StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}" />
<RadioButton
x:Name="ceshi" Grid.Column="3"
Command="{Binding DataContext.InspectDataCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}}"
@@ -298,13 +298,13 @@
IsEnabled="{Binding IsEnable}" />
<CheckBox
Command="{Binding CheckedCommand}"
CommandParameter="7" Content="比例阀开度" FontSize="14"
CommandParameter="8" Content="比例阀开度" FontSize="14"
Foreground="{StaticResource 比例阀实际开度}"
IsChecked="{Binding VisStatus[8]}"
IsEnabled="{Binding IsEnable}" />
<CheckBox
Command="{Binding CheckedCommand}"
CommandParameter="7" Content="卤水配制罐重量" FontSize="14"
CommandParameter="9" Content="卤水配制罐重量" FontSize="14"
Foreground="{StaticResource 卤水配制罐重量}"
IsChecked="{Binding VisStatus[9]}"
IsEnabled="{Binding IsEnable}" />


+ 3
- 3
BPASmartClient.Academy/View/HistoryChartView.xaml View File

@@ -120,7 +120,7 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition Width="180" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="200" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Border
@@ -185,7 +185,7 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition Width="180" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="200" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Border
@@ -224,7 +224,7 @@
VerticalAlignment="Center"
FontSize="16"
Foreground="White"
Text="{Binding CreateTime, StringFormat={}{0:yyyy-MM-dd}}" />
Text="{Binding CreateTime, StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}" />
<RadioButton
x:Name="ceshi"
Grid.Column="3"


+ 25
- 19
BPASmartClient.Academy/View/ReactionKettle50LView.xaml View File

@@ -245,7 +245,7 @@
<TextBlock
x:Name="state" Grid.RowSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center"
Panel.ZIndex="299" d:Visibility="Collapsed" FontSize="100" FontWeight="Black"
Foreground="Red" Text="设 备 未 连 接" Visibility="Collapsed" />
Foreground="Red" Text="设 备 未 连 接" Visibility="Visible" />
<!--#endregion-->
<!--#region 切换设备类型-->
<Grid
@@ -261,7 +261,7 @@
<!--#endregion-->
<Grid
x:Name="ooo" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" d:Opacity="1.0"
IsHitTestVisible="True" Opacity="0.5">
IsHitTestVisible="False" Opacity="0.5">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="*" />
@@ -294,10 +294,10 @@
<!--#region 开关控制按钮-->
<bpa:PipeLineH
Canvas.Left="600.5" Canvas.Top="214.5" Canvas.Right="339.4" Width="42"
Height="5"
Height="5" HorizontalAlignment="Left" VerticalAlignment="Center"
Direction="{Binding DeviceStatus.HotGasEmptyValve, ConverterParameter=1, Converter={StaticResource deviceConvert}}"
Fill="{Binding DeviceStatus.HotGasEmptyValve, ConverterParameter=2, Converter={StaticResource deviceConvert}}"
LineWidth="1" Speed="10" HorizontalAlignment="Left" VerticalAlignment="Center" />
LineWidth="1" Speed="10" />
<!--#region 开关控制按钮-->
<bpa:PipeLineH
Canvas.Left="681" Canvas.Top="51.3" Canvas.Right="261" Width="58.5"
@@ -305,7 +305,7 @@
Direction="{Binding DeviceStatus.ReactInColdValve, ConverterParameter=1, Converter={StaticResource deviceConvert}}"
Fill="{Binding DeviceStatus.ReactInColdValve, ConverterParameter=2, Converter={StaticResource deviceConvert}}"
LineWidth="1" Speed="2" />
<bpa:PipeLineH
<bpa:PipeLineH Fill="#E31A1A"
Canvas.Left="52" Canvas.Top="22" Canvas.Right="260.7" Width="310"
Height="5" HorizontalAlignment="Left" VerticalAlignment="Center" d:Direction="1"
LineWidth="1" Speed="25" />
@@ -337,7 +337,7 @@
Fill="{Binding DeviceStatus.ColdWaterTankVacuumValve, ConverterParameter=2, Converter={StaticResource deviceConvert}}"
LineWidth="1" />
<!--#region 开关控制按钮-->
<bpa:PipeLineH
<bpa:PipeLineH Fill="#E31A1A"
Canvas.Left="115" Canvas.Top="456" Canvas.Right="257.5" Width="95"
Height="5" HorizontalAlignment="Center" VerticalAlignment="Top" d:Direction="1"
LineWidth="1" Speed="10" />
@@ -647,6 +647,8 @@
<bpa:PipeLineBR
Canvas.Left="718" Canvas.Top="389" Canvas.Right="272.3" Width="9"
Height="11" HorizontalAlignment="Center" VerticalAlignment="Center" d:Direction="1"
Direction="{Binding DeviceStatus.ReactInBrineWaterValve, ConverterParameter=1, Converter={StaticResource deviceConvert}}"
Fill="{Binding DeviceStatus.ReactInBrineWaterValve, ConverterParameter=2, Converter={StaticResource deviceConvert}}"
LineWidth="10" Speed="1.5" />
<Image
Canvas.Left="384" Canvas.Top="59" Width="235" Height="264"
@@ -707,7 +709,7 @@
Text="{Binding DeviceStatus.ReactSteamFlow, StringFormat=蒸汽流量:\{0:F2\}}"
TextAlignment="Center" />
<TextBlock
Canvas.Left="332" Canvas.Top="135" Width="131" HorizontalAlignment="Left"
Canvas.Left="332" Canvas.Top="135" Width="135" HorizontalAlignment="Left"
VerticalAlignment="Center" d:Text="冷凝水罐温度:30.02℃" Foreground="Red"
Text="{Binding DeviceStatus.ColdWaterTankTemp, StringFormat=冷凝水罐温度:\{0:F2\}℃}"
TextAlignment="Center" />
@@ -746,7 +748,8 @@
<!--#region 冷却水出水阀-->
<bpa:PipeLineV
Canvas.Left="735" Canvas.Top="224.571" Canvas.Right="260" Width="5"
Height="67" HorizontalAlignment="Center" VerticalAlignment="Top" LineWidth="1" />
Height="67" HorizontalAlignment="Center" VerticalAlignment="Top" Fill="#E31A1A"
LineWidth="1" />
<!--#region 冷凝水罐进气阀-->
<bpa:PipeLineV
Canvas.Left="590.8" Canvas.Top="72.7" Canvas.Right="404.2" Width="5"
@@ -791,6 +794,8 @@
<bpa:PipeLineTR
Canvas.Left="590.8" Canvas.Top="209.532" Canvas.Right="399.2" Width="10"
Height="10" HorizontalAlignment="Center" VerticalAlignment="Top" d:Direction="2"
Direction="{Binding DeviceStatus.HotGasEmptyValve, ConverterParameter=5, Converter={StaticResource deviceConvert}}"
Fill="{Binding DeviceStatus.HotGasEmptyValve, ConverterParameter=2, Converter={StaticResource deviceConvert}}"
LineWidth="10" Speed="1.5" />
<bpa:PipeLineH
Canvas.Left="652" Canvas.Top="215" Canvas.Right="339.4" Width="27"
@@ -810,8 +815,8 @@
<!--#region 排热空气阀-->
<bpa:PipeLineTL
Canvas.Left="730" Canvas.Top="290.5" Canvas.Right="260" Width="10"
Height="10" HorizontalAlignment="Center" VerticalAlignment="Top" LineWidth="10"
Speed="1.5" />
Height="10" HorizontalAlignment="Center" VerticalAlignment="Top" Fill="#E31A1A"
LineWidth="10" Speed="1.5" />
<bpa:PipeLineH
Canvas.Left="600.3" Canvas.Top="295.5" Canvas.Right="269.7" Width="130"
Height="5" HorizontalAlignment="Center" VerticalAlignment="Top" d:Direction="2"
@@ -897,7 +902,7 @@
<bpa:PipeLineV
Canvas.Left="751.7" Canvas.Top="224.571" Canvas.Right="243.3" Width="5"
Height="160" HorizontalAlignment="Center" VerticalAlignment="Top" d:Direction="2"
LineWidth="1" />
Fill="#E31A1A" LineWidth="1" />
<bpa:PipeLineTL
Canvas.Left="741.7" Canvas.Top="384.3" Canvas.Right="238.3" Width="20"
Height="10" HorizontalAlignment="Center" VerticalAlignment="Top" d:Direction="2"
@@ -976,21 +981,22 @@
<!--#region 冷却水进水阀-->
<bpa:PipeLineV
Canvas.Left="744.1" Canvas.Top="31.963" Canvas.Right="250.9" Width="5"
Height="169" HorizontalAlignment="Center" VerticalAlignment="Top" LineWidth="1" />
Height="169" HorizontalAlignment="Center" VerticalAlignment="Top" Fill="#E31A1A"
LineWidth="1" />
<bpa:PipeLineBL
Canvas.Left="739.1" Canvas.Top="51.3" Canvas.Right="250.9" Width="10"
Height="10" HorizontalAlignment="Center" VerticalAlignment="Top"
Direction="{Binding DeviceStatus.ReactInColdValve, ConverterParameter=1, Converter={StaticResource deviceConvert}}"
Fill="{Binding DeviceStatus.ReactInColdValve, ConverterParameter=2, Converter={StaticResource deviceConvert}}"
LineWidth="10" Speed="1.5" />
<bpa:PipeLineBL
<bpa:PipeLineBL Fill="#E31A1A"
Canvas.Left="184.502" Canvas.Top="51.3" Width="10" Height="10"
HorizontalAlignment="Center" VerticalAlignment="Top" LineWidth="10" Speed="2" />
<bpa:PipeLineH
Canvas.Left="31" Canvas.Top="51" Canvas.Right="260.7" Width="642"
Canvas.Left="31" Canvas.Top="51" Canvas.Right="260.7" Width="642" Direction="2"
Height="5" HorizontalAlignment="Left" VerticalAlignment="Center" d:Direction="2"
LineWidth="1" Speed="2" />
<bpa:PipeLineV
Fill="#E31A1A" LineWidth="1" Speed="2" />
<bpa:PipeLineV Fill="#E31A1A"
Canvas.Left="189.5" Canvas.Top="61" Width="5" Height="107"
HorizontalAlignment="Left" VerticalAlignment="Center" d:Direction="1" LineWidth="1" />
<bpa:PipeLineH
@@ -1084,12 +1090,12 @@
<bpa:PipeLineV
Canvas.Left="321" Canvas.Top="109" Canvas.Right="404.2" Width="5"
Height="238" HorizontalAlignment="Center" VerticalAlignment="Top" d:Direction="1"
LineWidth="1" />
LineWidth="1" Fill="#E31A1A"/>
<bpa:PipeLineBL
Canvas.Left="315.8" Canvas.Top="100.069" Canvas.Right="404.2" Width="10"
Height="10" HorizontalAlignment="Center" VerticalAlignment="Top" d:Direction="1"
LineWidth="10" Speed="1.5" />
<bpa:PipeLineTL
LineWidth="10" Speed="1.5" Fill="#E31A1A"/>
<bpa:PipeLineTL Fill="#E31A1A"
Canvas.Left="311" Canvas.Top="347" Canvas.Right="238.3" Width="20"
Height="10" HorizontalAlignment="Center" VerticalAlignment="Top" d:Direction="1"
LineWidth="10" Speed="1.5" />


+ 4
- 4
BPASmartClient.Academy/View/ReactionKettle50LView.xaml.cs View File

@@ -29,20 +29,20 @@ namespace BPASmartClient.Academy.View
this.DataContext = ReactionKettle50LViewModel.GetInstance;
this.Loaded += ReactionKettle50LView_Loaded;
}
private bool _lastState = false;
private void ReactionKettle50LView_Loaded(object sender, RoutedEventArgs e)
{
PlcControl.GetInstance.IsConnectChanged = o =>
{
App.Current.Dispatcher.Invoke(() =>
{
if (o)
if (o && !_lastState)
{
ooo.Opacity = 1;
ooo.IsHitTestVisible = true;
state.Visibility = Visibility.Collapsed;
}
else
else if(!o && _lastState)
{

ooo.Opacity = 0.5;
@@ -53,7 +53,7 @@ namespace BPASmartClient.Academy.View
state.Foreground = Brushes.Red;
}
});
_lastState = o;
};
}



+ 3
- 3
BPASmartClient.Academy/ViewModel/DeviceChart50LViewModel.cs View File

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


+ 8
- 6
BPASmartClient.Academy/ViewModel/HistoryChart50LViewModel.cs View File

@@ -71,7 +71,7 @@ namespace BPASmartClient.Academy.ViewModel
OxyDataModels.Add(new OxyDataModel(CreateLine("反应釜编码器值")));
OxyDataModels.Add(new OxyDataModel(CreateLine("比例阀实际开度")));
OxyDataModels.Add(new OxyDataModel(CreateLine("卤水配制罐重量")));
SqliteOperate.GetInstance.QueryableById(Id).ForEach(item =>
{
double x = DateTimeAxis.ToDouble(item.Createtime);
@@ -85,6 +85,7 @@ namespace BPASmartClient.Academy.ViewModel
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))
@@ -93,13 +94,13 @@ namespace BPASmartClient.Academy.ViewModel
{
Position = OxyPlot.Axes.AxisPosition.Bottom,
Title = "时间",
StringFormat = "hh:mm:ss",
StringFormat = "HH:mm:ss",
AxislineColor = OxyColor.FromRgb(84, 164, 227)
});
OxyModel.Axes.Add(new LinearAxis()
{
Key = "y1",
Title = "温度/℃\r\n压力/kap\r\n流量/m³",
Title = "温度/℃\r\n压力/MPa\r\n流量/m³\r\n重量/Kg\r\n开度/%",
Position = OxyPlot.Axes.AxisPosition.Left,
LabelFormatter = value => value.ToString(),
AxislineColor = OxyColor.Parse("#9C9C9C"),
@@ -112,14 +113,15 @@ namespace BPASmartClient.Academy.ViewModel
private LineSeries CreateLine(string title)
{
var scb = Application.Current.TryFindResource(title) as SolidColorBrush;
scb.ToOxyColor();
var color= scb.ToOxyColor();
return new LineSeries()
{
LineStyle = LineStyle.Solid,
Title = title,
MarkerFill = scb.ToOxyColor(),
MarkerSize = 2,
LineLegendPosition = LineLegendPosition.End
LineLegendPosition = LineLegendPosition.End,
Color=color,
};
}

@@ -159,7 +161,7 @@ namespace BPASmartClient.Academy.ViewModel


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

public bool IsEnable
{


Loading…
Cancel
Save