数据中心数据绑定
This commit is contained in:
parent
2e49e6f6e6
commit
9f970ab127
41
InSituLaboratory.Base/FaultStateConvert.cs
Normal file
41
InSituLaboratory.Base/FaultStateConvert.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace InSituLaboratory.Base
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 故障状态转换器
|
||||||
|
/// </summary>
|
||||||
|
public class FaultStateConvert : IValueConverter
|
||||||
|
{
|
||||||
|
public static object ConvertObject;
|
||||||
|
|
||||||
|
object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
Brush background = null;
|
||||||
|
if ((string)value == "故障")
|
||||||
|
{
|
||||||
|
//红色
|
||||||
|
background = new SolidColorBrush(Color.FromRgb(255, 0, 0));
|
||||||
|
}
|
||||||
|
else if ((string)value == "正常")
|
||||||
|
{
|
||||||
|
//绿色
|
||||||
|
background = new SolidColorBrush(Color.FromRgb(0, 255, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
return background;
|
||||||
|
}
|
||||||
|
|
||||||
|
object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
203
InSituLaboratory.Models/SysStatusModel.cs
Normal file
203
InSituLaboratory.Models/SysStatusModel.cs
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
using Prism.Mvvm;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace InSituLaboratory.Models
|
||||||
|
{
|
||||||
|
public class SysStatusModel : BindableBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 组包时间
|
||||||
|
/// </summary>
|
||||||
|
private DateTime? _packagingTime;
|
||||||
|
public DateTime? PackagingTime
|
||||||
|
{
|
||||||
|
get { return _packagingTime; }
|
||||||
|
set { SetProperty(ref _packagingTime, value); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 采样时间
|
||||||
|
/// </summary>
|
||||||
|
private DateTime? _samplingTime;
|
||||||
|
public DateTime? SamplingTime
|
||||||
|
{
|
||||||
|
get { return _samplingTime; }
|
||||||
|
set { SetProperty(ref _samplingTime, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
private DateTime? _createTime;
|
||||||
|
public DateTime? CreateTime
|
||||||
|
{
|
||||||
|
get { return _createTime; }
|
||||||
|
set { SetProperty(ref _createTime, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 48V 电压
|
||||||
|
/// </summary>
|
||||||
|
private float? _voltage48;
|
||||||
|
public float? Voltage48
|
||||||
|
{
|
||||||
|
get { return _voltage48; }
|
||||||
|
set { SetProperty(ref _voltage48, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 48V 电流
|
||||||
|
/// </summary>
|
||||||
|
private float? _current48;
|
||||||
|
public float? Current48
|
||||||
|
{
|
||||||
|
get { return _current48; }
|
||||||
|
set { SetProperty(ref _current48, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 基站48V漏电流状态 第0位 (0表示该状态正常,1表示1级报警,2表示2级报警,3表示故障)
|
||||||
|
/// </summary>
|
||||||
|
private string? _baseStation48VLeakageCS;
|
||||||
|
public string? BaseStation48VLeakageCS
|
||||||
|
{
|
||||||
|
get { return _baseStation48VLeakageCS; }
|
||||||
|
set { SetProperty(ref _baseStation48VLeakageCS, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电池48V漏电流状态 第2位 (0表示该状态正常,1表示1级报警,2表示2级报警,3表示故障)
|
||||||
|
/// </summary>
|
||||||
|
private string? _batterz48VLeakageCS;
|
||||||
|
public string? Batterz48VLeakageCS
|
||||||
|
{
|
||||||
|
get { return _batterz48VLeakageCS; }
|
||||||
|
set { SetProperty(ref _batterz48VLeakageCS, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ICL漏电流状态 第4位 (0表示该状态正常,1表示1级报警,2表示2级报警,3表示故障)
|
||||||
|
/// </summary>
|
||||||
|
private string? _iCLLeakageCS;
|
||||||
|
public string? ICLLeakageCS
|
||||||
|
{
|
||||||
|
get { return _iCLLeakageCS; }
|
||||||
|
set { SetProperty(ref _iCLLeakageCS, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工控机漏电流状态 第6位 (0表示该状态正常,1表示1级报警,2表示2级报警,3表示故障)
|
||||||
|
/// </summary>
|
||||||
|
private string? _iComputerLeakageCS;
|
||||||
|
public string? IComputerLeakageCS
|
||||||
|
{
|
||||||
|
get { return _iComputerLeakageCS; }
|
||||||
|
set { SetProperty(ref _iComputerLeakageCS, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 温度1状态 第8位 (0表示该状态正常,1表示1级报警,2表示2级报警,3表示故障)
|
||||||
|
/// </summary>
|
||||||
|
private string? _temperatureStaus1;
|
||||||
|
public string? TemperatureStaus1
|
||||||
|
{
|
||||||
|
get { return _temperatureStaus1; }
|
||||||
|
set { SetProperty(ref _temperatureStaus1, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 温度2状态 第10位 (0表示该状态正常,1表示1级报警,2表示2级报警,3表示故障)
|
||||||
|
/// </summary>
|
||||||
|
private string? _temperatureStaus2;
|
||||||
|
public string? TemperatureStaus2
|
||||||
|
{
|
||||||
|
get { return _temperatureStaus2; }
|
||||||
|
set { SetProperty(ref _temperatureStaus2, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 湿度1状态 第12位 (0表示该状态正常,1表示1级报警,2表示2级报警,3表示故障)
|
||||||
|
/// </summary>
|
||||||
|
private string? _humidityStaus1;
|
||||||
|
public string? HumidityStaus1
|
||||||
|
{
|
||||||
|
get { return _humidityStaus1; }
|
||||||
|
set { SetProperty(ref _humidityStaus1, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 湿度2状态 第14位 (0表示该状态正常,1表示1级报警,2表示2级报警,3表示故障)
|
||||||
|
/// </summary>
|
||||||
|
private string? _humidityStaus2;
|
||||||
|
public string? HumidityStaus2
|
||||||
|
{
|
||||||
|
get { return _humidityStaus2; }
|
||||||
|
set { SetProperty(ref _humidityStaus2, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 漏水1状态 第16位 (0表示该状态正常,1表示1级报警,2表示2级报警,3表示故障)
|
||||||
|
/// </summary>
|
||||||
|
private string? _leakageStaus1;
|
||||||
|
public string? LeakageStaus1
|
||||||
|
{
|
||||||
|
get { return _leakageStaus1; }
|
||||||
|
set { SetProperty(ref _leakageStaus1, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 漏水2状态 第18位 (0表示该状态正常,1表示1级报警,2表示2级报警,3表示故障)
|
||||||
|
/// </summary>
|
||||||
|
private string? _leakageStaus2;
|
||||||
|
public string? LeakageStaus2
|
||||||
|
{
|
||||||
|
get { return _leakageStaus2; }
|
||||||
|
set { SetProperty(ref _leakageStaus2, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 内部压力1状态 第20位 (0表示该状态正常,1表示1级报警,2表示2级报警,3表示故障)
|
||||||
|
/// </summary>
|
||||||
|
private string? _iternalPressure1;
|
||||||
|
public string? InternalPressure1
|
||||||
|
{
|
||||||
|
get { return _iternalPressure1; }
|
||||||
|
set { SetProperty(ref _iternalPressure1, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 内部压力2状态 第22位 (0表示该状态正常,1表示1级报警,2表示2级报警,3表示故障)
|
||||||
|
/// </summary>
|
||||||
|
private string? _internalPressure2;
|
||||||
|
public string? InternalPressure2
|
||||||
|
{
|
||||||
|
get { return _internalPressure2; }
|
||||||
|
set { SetProperty(ref _internalPressure2, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 时序组号
|
||||||
|
/// </summary>
|
||||||
|
private string? _timeSeriesGroupNumber;
|
||||||
|
public string? TimeSeriesGroupNumber
|
||||||
|
{
|
||||||
|
get { return _timeSeriesGroupNumber; }
|
||||||
|
set { SetProperty(ref _timeSeriesGroupNumber, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 时序状态 0表示保持,1表示成功,2表示错误
|
||||||
|
/// </summary>
|
||||||
|
private string? _groupNumberStatus;
|
||||||
|
public string? GroupNumberStatus
|
||||||
|
{
|
||||||
|
get { return _groupNumberStatus; }
|
||||||
|
set { SetProperty(ref _groupNumberStatus, value); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -17,47 +17,7 @@ namespace InSituLaboratory.ViewModels.Pages
|
|||||||
public class DashboardViewModel : ViewModelBase
|
public class DashboardViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
#region 实体类
|
#region 实体类
|
||||||
/// <summary>
|
public SysStatusModel SysStatusModel { get; set; } = new SysStatusModel();
|
||||||
/// 组包时间
|
|
||||||
/// </summary>
|
|
||||||
private DateTime? _packagingTime;
|
|
||||||
public DateTime? PackagingTime
|
|
||||||
{
|
|
||||||
get { return _packagingTime; }
|
|
||||||
set { SetProperty(ref _packagingTime, value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 采样时间
|
|
||||||
/// </summary>
|
|
||||||
private DateTime? _samplingTime;
|
|
||||||
public DateTime? SamplingTime
|
|
||||||
{
|
|
||||||
get { return _samplingTime; }
|
|
||||||
set { SetProperty(ref _samplingTime, value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 48V 电压
|
|
||||||
/// </summary>
|
|
||||||
private float? _voltage48;
|
|
||||||
public float? Voltage48
|
|
||||||
{
|
|
||||||
get { return _voltage48; }
|
|
||||||
set { SetProperty(ref _voltage48, value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 48V 电流
|
|
||||||
/// </summary>
|
|
||||||
private float? _current48;
|
|
||||||
public float? Current48
|
|
||||||
{
|
|
||||||
get { return _current48; }
|
|
||||||
set { SetProperty(ref _current48, value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -78,10 +38,11 @@ namespace InSituLaboratory.ViewModels.Pages
|
|||||||
{
|
{
|
||||||
var data = _sysStatusService.GetSysStauts().First();
|
var data = _sysStatusService.GetSysStauts().First();
|
||||||
|
|
||||||
PackagingTime = data.PackagingTime;
|
SysStatusModel.PackagingTime = data.PackagingTime;
|
||||||
SamplingTime = data.SamplingTime;
|
SysStatusModel.SamplingTime = data.SamplingTime;
|
||||||
Voltage48 = data.Voltage48;
|
SysStatusModel.Voltage48 = data.Voltage48;
|
||||||
Current48 = data.Current48;
|
SysStatusModel.Current48 = data.Current48;
|
||||||
|
SysStatusModel.BaseStation48VLeakageCS = data.BaseStation48VLeakageCS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<converters:StateBackConvert x:Key="StateBackConvert" />
|
<converters:StateBackConvert x:Key="StateBackConvert" />
|
||||||
<converters:WorkStateConvert x:Key="WorkStateConvert" />
|
<converters:WorkStateConvert x:Key="WorkStateConvert" />
|
||||||
|
<converters:FaultStateConvert x:Key="FaultStateConvert" />
|
||||||
<Style TargetType="GroupBox">
|
<Style TargetType="GroupBox">
|
||||||
<Setter Property="Margin" Value="10,5" />
|
<Setter Property="Margin" Value="10,5" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
@ -72,7 +73,7 @@
|
|||||||
<Run Text="组包时间" FontSize="18"/>
|
<Run Text="组包时间" FontSize="18"/>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
|
||||||
<TextBlock Text="{Binding PackagingTime ,Mode=TwoWay,StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}" FontSize="15" FontWeight="Normal" Foreground="#555"/>
|
<TextBlock Text="{Binding SysStatusModel.PackagingTime ,Mode=TwoWay,StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}" FontSize="15" FontWeight="Normal" Foreground="#555"/>
|
||||||
|
|
||||||
<Grid TextBlock.FontSize="11">
|
<Grid TextBlock.FontSize="11">
|
||||||
<TextBlock HorizontalAlignment="Left" Foreground="Green">
|
<TextBlock HorizontalAlignment="Left" Foreground="Green">
|
||||||
@ -92,7 +93,7 @@
|
|||||||
<Run Text="采样时间" FontSize="18"/>
|
<Run Text="采样时间" FontSize="18"/>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
|
||||||
<TextBlock Text="{Binding SamplingTime ,Mode=TwoWay,StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}" FontSize="15" FontWeight="Normal" Foreground="#555"/>
|
<TextBlock Text="{Binding SysStatusModel.SamplingTime ,Mode=TwoWay,StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}" FontSize="15" FontWeight="Normal" Foreground="#555"/>
|
||||||
|
|
||||||
<Grid TextBlock.FontSize="11">
|
<Grid TextBlock.FontSize="11">
|
||||||
<TextBlock HorizontalAlignment="Left" Foreground="Green">
|
<TextBlock HorizontalAlignment="Left" Foreground="Green">
|
||||||
@ -112,7 +113,7 @@
|
|||||||
<Run Text="48V电压" FontSize="18"/>
|
<Run Text="48V电压" FontSize="18"/>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
|
||||||
<TextBlock Text="{Binding Voltage48 ,Mode=TwoWay,StringFormat={}{0}V}" FontSize="15" FontWeight="Normal" Foreground="#555"/>
|
<TextBlock Text="{Binding SysStatusModel.Voltage48 ,Mode=TwoWay,StringFormat={}{0}V}" FontSize="15" FontWeight="Normal" Foreground="#555"/>
|
||||||
|
|
||||||
<Grid TextBlock.FontSize="11">
|
<Grid TextBlock.FontSize="11">
|
||||||
<TextBlock HorizontalAlignment="Left" Foreground="Green">
|
<TextBlock HorizontalAlignment="Left" Foreground="Green">
|
||||||
@ -132,7 +133,7 @@
|
|||||||
<Run Text="48V电流" FontSize="18"/>
|
<Run Text="48V电流" FontSize="18"/>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
|
||||||
<TextBlock Text="{Binding Current48 ,Mode=TwoWay,StringFormat={}{0}A}" FontSize="15" FontWeight="Normal" Foreground="#555"/>
|
<TextBlock Text="{Binding SysStatusModel.Current48 ,Mode=TwoWay,StringFormat={}{0}A}" FontSize="15" FontWeight="Normal" Foreground="#555"/>
|
||||||
|
|
||||||
<Grid TextBlock.FontSize="11">
|
<Grid TextBlock.FontSize="11">
|
||||||
<TextBlock HorizontalAlignment="Left" Foreground="Green">
|
<TextBlock HorizontalAlignment="Left" Foreground="Green">
|
||||||
@ -144,7 +145,7 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- 主腔体状态 -->
|
<!-- 主腔体状态 -->
|
||||||
<Grid Margin="0,110,0,0">
|
<Grid Margin="0,110,0,40" Grid.RowSpan="2">
|
||||||
<GroupBox Header="主腔体状态">
|
<GroupBox Header="主腔体状态">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@ -167,7 +168,7 @@
|
|||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Grid.Column="0" Text="基站48V漏电流状态" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
<TextBlock Grid.Column="0" Text="基站48V漏电流状态" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||||
<Border Grid.Column="1" Width="20" Height="20" Background="Green" CornerRadius="10" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
<Border Grid.Column="1" Width="20" Height="20" Background="{Binding SysStatusModel.BaseStation48VLeakageCS, Converter={StaticResource ResourceKey=StateBackConvert}}" CornerRadius="10" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid Grid.Row="2">
|
<Grid Grid.Row="2">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@ -249,9 +250,9 @@
|
|||||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
|
||||||
<TextBlock Text="正常" Margin="10,5"/>
|
<TextBlock Text="正常" Margin="10,5"/>
|
||||||
<Border Width="20" Height="20" Background="Green" CornerRadius="10" />
|
<Border Width="20" Height="20" Background="Green" CornerRadius="10" />
|
||||||
<TextBlock Text="一级告警" Margin="10,5"/>
|
<TextBlock Text="一级报警" Margin="10,5"/>
|
||||||
<Border Width="20" Height="20" Background="Yellow" CornerRadius="10" />
|
<Border Width="20" Height="20" Background="Yellow" CornerRadius="10" />
|
||||||
<TextBlock Text="二级告警" Margin="10,5"/>
|
<TextBlock Text="二级报警" Margin="10,5"/>
|
||||||
<Border Width="20" Height="20" Background="Orange" CornerRadius="10" />
|
<Border Width="20" Height="20" Background="Orange" CornerRadius="10" />
|
||||||
<TextBlock Text="故障" Margin="10,5"/>
|
<TextBlock Text="故障" Margin="10,5"/>
|
||||||
<Border Width="20" Height="20" Background="red" CornerRadius="10" />
|
<Border Width="20" Height="20" Background="red" CornerRadius="10" />
|
||||||
@ -295,12 +296,12 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!--当前工作状态/当前故障设备-->
|
<!--当前工作状态/当前故障设备-->
|
||||||
<Grid Grid.Row="2" Margin="0,-80,0,0">
|
<Grid Grid.Row="2" Margin="0,-40,0,0">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid Grid.Column="0" Margin="0,0,0,-52" >
|
<Grid Grid.Column="0" Margin="0,14,0,-140" >
|
||||||
<GroupBox Header="当前工作设备">
|
<GroupBox Header="当前工作设备">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@ -394,7 +395,7 @@
|
|||||||
</GroupBox>
|
</GroupBox>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid Grid.Column="1" Margin="0,0,0,-52">
|
<Grid Grid.Column="1" Margin="0,14,0,-140">
|
||||||
<GroupBox Header="当前故障设备">
|
<GroupBox Header="当前故障设备">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user