feat: 에너지 화면 요약 데이터 출력

hhsung_work
HyungJune Kim 10 months ago
parent 11382dcea6
commit 9a2bcb47bd

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SmartAquaViewer.Model
{
public class CCTVInfo
{
public string? DeviceId { get; set; }
public string? DeviceName { get; set; }
public string? RtspUrl { get; set; }
public string? Status { get; set; }
}
}

@ -6,11 +6,16 @@
xmlns:local="clr-namespace:SmartAquaViewer.View" xmlns:local="clr-namespace:SmartAquaViewer.View"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<Grid> <ItemsControl ItemsSource="{Binding WaterQualityList}">
<TextBlock Text="CCTV View" <ItemsControl.ItemsPanel>
FontSize="24" FontWeight="Bold" <ItemsPanelTemplate>
HorizontalAlignment="Center" <UniformGrid Rows="{Binding RowCount}" Columns="{Binding ColumnCount}" />
VerticalAlignment="Center" </ItemsPanelTemplate>
Foreground="Black"/> </ItemsControl.ItemsPanel>
</Grid> <ItemsControl.ItemTemplate>
<DataTemplate>
<Border Background="Green" Margin="2" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</UserControl> </UserControl>

@ -22,14 +22,69 @@
<Border.Background> <Border.Background>
<ImageBrush ImageSource="/Resources/Images/top_bg.png" Stretch="Fill"/> <ImageBrush ImageSource="/Resources/Images/top_bg.png" Stretch="Fill"/>
</Border.Background> </Border.Background>
<UniformGrid Columns="9">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="총 소비 전력" HorizontalAlignment="Center"
FontSize="22" Foreground="White" FontFamily="{StaticResource SCDream5}"/>
<TextBlock Text="{Binding TotalEnergy, StringFormat=\{0:F2\}}" HorizontalAlignment="Center"
FontSize="26" Foreground="White" FontFamily="{StaticResource SCDream4}"/>
</StackPanel>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="모래여과기" HorizontalAlignment="Center"
FontSize="22" Foreground="White" FontFamily="{StaticResource SCDream5}"/>
<TextBlock Text="{Binding TotalSandFilterEnergy, StringFormat=\{0:F2\}}" HorizontalAlignment="Center"
FontSize="26" Foreground="White" FontFamily="{StaticResource SCDream4}"/>
</StackPanel>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="순환펌프" HorizontalAlignment="Center"
FontSize="22" Foreground="White" FontFamily="{StaticResource SCDream5}"/>
<TextBlock Text="{Binding TotalCirculationPumpEnergy, StringFormat=\{0:F2\}}" HorizontalAlignment="Center"
FontSize="26" Foreground="White" FontFamily="{StaticResource SCDream4}"/>
</StackPanel>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="히트펌프" HorizontalAlignment="Center"
FontSize="22" Foreground="White" FontFamily="{StaticResource SCDream5}"/>
<TextBlock Text="{Binding TotalHeatPumpEnergy, StringFormat=\{0:F2\}}" HorizontalAlignment="Center"
FontSize="26" Foreground="White" FontFamily="{StaticResource SCDream4}"/>
</StackPanel>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="에어브로와" HorizontalAlignment="Center"
FontSize="22" Foreground="White" FontFamily="{StaticResource SCDream5}"/>
<TextBlock Text="{Binding TotalAirBlowerEnergy, StringFormat=\{0:F2\}}" HorizontalAlignment="Center"
FontSize="26" Foreground="White" FontFamily="{StaticResource SCDream4}"/>
</StackPanel>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="오존발생기" HorizontalAlignment="Center"
FontSize="22" Foreground="White" FontFamily="{StaticResource SCDream5}"/>
<TextBlock Text="{Binding TotalOzoneGeneratorEnergy, StringFormat=\{0:F2\}}" HorizontalAlignment="Center"
FontSize="26" Foreground="White" FontFamily="{StaticResource SCDream4}"/>
</StackPanel>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="자외선 살균기" HorizontalAlignment="Center"
FontSize="22" Foreground="White" FontFamily="{StaticResource SCDream5}"/>
<TextBlock Text="{Binding TotalUVSterilizerEnergy, StringFormat=\{0:F2\}}" HorizontalAlignment="Center"
FontSize="26" Foreground="White" FontFamily="{StaticResource SCDream4}"/>
</StackPanel>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="오존용해장치" HorizontalAlignment="Center"
FontSize="22" Foreground="White" FontFamily="{StaticResource SCDream5}"/>
<TextBlock Text="{Binding TotalOzoneDissolverEnergy, StringFormat=\{0:F2\}}" HorizontalAlignment="Center"
FontSize="26" Foreground="White" FontFamily="{StaticResource SCDream4}"/>
</StackPanel>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="배오존장치" HorizontalAlignment="Center"
FontSize="22" Foreground="White" FontFamily="{StaticResource SCDream5}"/>
<TextBlock Text="{Binding TotalExcessOzoneDestroyerEnergy, StringFormat=\{0:F2\}}" HorizontalAlignment="Center"
FontSize="26" Foreground="White" FontFamily="{StaticResource SCDream4}"/>
</StackPanel>
</UniformGrid>
</Border> </Border>
<ScrollViewer Grid.Row="1" Grid.RowSpan="2" Margin="20 0 20 20" <ScrollViewer Grid.Row="1" Grid.RowSpan="2" Margin="20 0 20 20"
HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
HorizontalAlignment="Center"> HorizontalAlignment="Center">
<DataGrid Style="{StaticResource DataGridStyle}" ItemsSource="{Binding WaterQualityList}" <DataGrid Style="{StaticResource DataGridStyle}" ItemsSource="{Binding WaterQualityList}" Background="Transparent"
RowStyle="{StaticResource DataGridRowStyle}" ColumnHeaderStyle="{StaticResource DataGridColumnHeaderStyle}"> RowStyle="{StaticResource DataGridRowStyle}" ColumnHeaderStyle="{StaticResource DataGridColumnHeaderStyle}" SelectionChanged="DataGrid_SelectionChanged">
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn <DataGridTextColumn
Header="시간" Header="시간"

@ -24,5 +24,10 @@ namespace SmartAquaViewer.View
{ {
InitializeComponent(); InitializeComponent();
} }
private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}
} }
} }

@ -1,18 +1,54 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using SmartAquaViewer.DataAnalysis;
using SmartAquaViewer.Model;
namespace SmartAquaViewer.ViewModel namespace SmartAquaViewer.ViewModel
{ {
public class CCTVViewModel : INotifyPropertyChanged public class CCTVViewModel : INotifyPropertyChanged
{ {
public List<WaterQualityVO> WaterQualityList { get; } = new List<WaterQualityVO>();
private int _columnCount;
public int ColumnCount
{
get => _columnCount;
set
{
if (_columnCount != value)
{
_columnCount = value;
OnPropertyChanged();
}
}
}
private int _rowCount;
public int RowCount
{
get => _rowCount;
set
{
if (_rowCount != value)
{
_rowCount = value;
OnPropertyChanged();
}
}
}
public CCTVViewModel() public CCTVViewModel()
{ {
ColumnCount = 4; // Default value
RowCount = 2; // Default value
WaterQualityList = Datas.GetWaterQualityVO().Take(5).ToList();
} }
public event PropertyChangedEventHandler? PropertyChanged; public event PropertyChangedEventHandler? PropertyChanged;

@ -5,6 +5,7 @@ using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using OxyPlot.Axes;
using SmartAquaViewer.DataAnalysis; using SmartAquaViewer.DataAnalysis;
using SmartAquaViewer.Model; using SmartAquaViewer.Model;
@ -13,9 +14,164 @@ namespace SmartAquaViewer.ViewModel
public class EnergyViewModel : INotifyPropertyChanged public class EnergyViewModel : INotifyPropertyChanged
{ {
public List<WaterQualityVO> WaterQualityList { get; set; } public List<WaterQualityVO> WaterQualityList { get; set; }
private double _totalEnergy;
public double TotalEnergy
{
get => _totalEnergy;
set
{
if (_totalEnergy != value)
{
_totalEnergy = value;
OnPropertyChanged();
}
}
}
private double _totalSandFilterEnergy;
public double TotalSandFilterEnergy
{
get => _totalSandFilterEnergy;
set
{
if (_totalSandFilterEnergy != value)
{
_totalSandFilterEnergy = value;
OnPropertyChanged();
}
}
}
private double _totalCirculationPumpEnergy;
public double TotalCirculationPumpEnergy
{
get => _totalCirculationPumpEnergy;
set
{
if (_totalCirculationPumpEnergy != value)
{
_totalCirculationPumpEnergy = value;
OnPropertyChanged();
}
}
}
private double _totalHeatPumpEnergy;
public double TotalHeatPumpEnergy
{
get => _totalHeatPumpEnergy;
set
{
if (_totalHeatPumpEnergy != value)
{
_totalHeatPumpEnergy = value;
OnPropertyChanged();
}
}
}
private double _totalAirBlowerEnergy;
public double TotalAirBlowerEnergy
{
get => _totalAirBlowerEnergy;
set
{
if (_totalAirBlowerEnergy != value)
{
_totalAirBlowerEnergy = value;
OnPropertyChanged();
}
}
}
private double _totalOzoneGeneratorEnergy;
public double TotalOzoneGeneratorEnergy
{
get => _totalOzoneGeneratorEnergy;
set
{
if (_totalOzoneGeneratorEnergy != value)
{
_totalOzoneGeneratorEnergy = value;
OnPropertyChanged();
}
}
}
private double _totalUVSterilizerEnergy;
public double TotalUVSterilizerEnergy
{
get => _totalUVSterilizerEnergy;
set
{
if (_totalUVSterilizerEnergy != value)
{
_totalUVSterilizerEnergy = value;
OnPropertyChanged();
}
}
}
private double _totalOzoneDissolverEnergy;
public double TotalOzoneDissolverEnergy
{
get => _totalOzoneDissolverEnergy;
set
{
if (_totalOzoneDissolverEnergy != value)
{
_totalOzoneDissolverEnergy = value;
OnPropertyChanged();
}
}
}
private double _totalExcessOzoneDestroyerEnergy;
public double TotalExcessOzoneDestroyerEnergy
{
get => _totalExcessOzoneDestroyerEnergy;
set
{
if (_totalExcessOzoneDestroyerEnergy != value)
{
_totalExcessOzoneDestroyerEnergy = value;
OnPropertyChanged();
}
}
}
public EnergyViewModel() public EnergyViewModel()
{ {
WaterQualityList = Datas.GetWaterQualityVO(); WaterQualityList = Datas.GetWaterQualityVO();
TotalSandFilterEnergy = WaterQualityList.Sum(vo => ResolveEnergyField(vo, "Filtering.SandFilterEnergy") ?? 0);
TotalCirculationPumpEnergy = WaterQualityList.Sum(vo => ResolveEnergyField(vo, "Filtering.CirculationPumpEnergy") ?? 0);
TotalHeatPumpEnergy = WaterQualityList.Sum(vo => ResolveEnergyField(vo, "Filtering.HeatPumpEnergy") ?? 0);
TotalAirBlowerEnergy = WaterQualityList.Sum(vo => ResolveEnergyField(vo, "Filtering.AirBlowerEnergy") ?? 0);
TotalOzoneGeneratorEnergy = WaterQualityList.Sum(vo => ResolveEnergyField(vo, "Sterilizing.OzoneGeneratorEnergy") ?? 0);
TotalUVSterilizerEnergy = WaterQualityList.Sum(vo => ResolveEnergyField(vo, "Sterilizing.UVSterilizerEnergy") ?? 0);
TotalOzoneDissolverEnergy = WaterQualityList.Sum(vo => ResolveEnergyField(vo, "Sterilizing.OzoneDissolverEnergy") ?? 0);
TotalExcessOzoneDestroyerEnergy = WaterQualityList.Sum(vo => ResolveEnergyField(vo, "Sterilizing.ExcessOzoneDestroyerEnergy") ?? 0);
TotalEnergy = WaterQualityList.Sum(vo => ResolveEnergyField(vo, "TotalEnergy") ?? 0);
}
private double? ResolveEnergyField(WaterQualityVO vo, string fieldName)
{
return fieldName switch
{
"Filtering.SandFilterEnergy" => vo.Filtering.SandFilterEnergy,
"Filtering.CirculationPumpEnergy" => vo.Filtering.CirculationPumpEnergy,
"Filtering.HeatPumpEnergy" => vo.Filtering.HeatPumpEnergy,
"Filtering.AirBlowerEnergy" => vo.Filtering.AirBlowerEnergy,
"Sterilizing.OzoneGeneratorEnergy" => vo.Sterilizing.OzoneGeneratorEnergy,
"Sterilizing.UVSterilizerEnergy" => vo.Sterilizing.UVSterilizerEnergy,
"Sterilizing.OzoneDissolverEnergy" => vo.Sterilizing.OzoneDissolverEnergy,
"Sterilizing.ExcessOzoneDestroyerEnergy" => vo.Sterilizing.ExcessOzoneDestroyerEnergy,
"TotalEnergy" => vo.TotalEnergy,
_ => null
};
} }
public event PropertyChangedEventHandler? PropertyChanged; public event PropertyChangedEventHandler? PropertyChanged;

@ -243,7 +243,6 @@ namespace SmartAquaViewer.ViewModel
BtnVisibilityUp = Visibility.Collapsed; BtnVisibilityUp = Visibility.Collapsed;
WaterQualityList = WaterQualityVO.GetSampleData(new DateTime(2025, 8, 1), new DateTime(2025, 8, 1), 10); WaterQualityList = WaterQualityVO.GetSampleData(new DateTime(2025, 8, 1), new DateTime(2025, 8, 1), 10);
var list = Test.GetSampleData(new DateTime(2025, 8, 1), new DateTime(2025, 8, 1), 24);
Datas.SetWaterQualityVO(WaterQualityList); Datas.SetWaterQualityVO(WaterQualityList);
TankGroups = WaterQualityList TankGroups = WaterQualityList

Loading…
Cancel
Save