2024-01-12 08:30:42 +00:00
|
|
|
@using System.Text
|
|
|
|
@using UI_SequentMicrosystems.Constants
|
|
|
|
@using UI_SequentMicrosystems.Models
|
|
|
|
@using UI_SequentMicrosystems.Services
|
|
|
|
@using UI_SequentMicrosystems.Components
|
|
|
|
|
|
|
|
@inject PointsService _PointsService
|
|
|
|
@inject RTD8TMService _RTD8TMService
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-12 22:22:40 +00:00
|
|
|
@if (_RTD8TMService.GetActualData() != null)
|
|
|
|
{
|
|
|
|
<table class="table table-striped text-white">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th scope="col">Time</th>
|
|
|
|
|
|
|
|
@foreach (byte stack in _RTD8TMService.GetActualData().Keys)
|
2024-01-12 08:30:42 +00:00
|
|
|
{
|
2024-01-12 22:22:40 +00:00
|
|
|
for (byte chanel = 0; chanel < 8; chanel++)
|
2024-01-12 08:30:42 +00:00
|
|
|
{
|
2024-01-12 22:22:40 +00:00
|
|
|
if (_RTD8TMService.GetChanelName(stack, chanel) != "----------")
|
|
|
|
{
|
|
|
|
<th>
|
|
|
|
@_RTD8TMService.GetChanelName(stack, chanel)
|
|
|
|
|
|
|
|
@if (_RTD8TMService.GetValueType(stack, chanel) == RTD8TMSensorTypes.PT100)
|
|
|
|
{
|
|
|
|
@Celsius
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
@Ohm
|
|
|
|
}
|
|
|
|
</th>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2024-01-12 08:30:42 +00:00
|
|
|
|
2024-01-12 22:22:40 +00:00
|
|
|
<tbody>
|
|
|
|
@foreach (long time in TableData.Keys)
|
|
|
|
{
|
|
|
|
<tr class="text-white @TableBacgroundChanger() ">
|
|
|
|
<td>@(new DateTime(time).ToString("HH:mm:ss"))</td>
|
|
|
|
|
|
|
|
@foreach (byte stack in TableData[time].Keys)
|
|
|
|
{
|
|
|
|
for (byte chanel = 0; chanel < 8; chanel++)
|
|
|
|
{
|
|
|
|
if (_RTD8TMService.GetChanelName(stack, chanel) != "----------")
|
2024-01-12 08:30:42 +00:00
|
|
|
{
|
2024-01-12 22:22:40 +00:00
|
|
|
<td>@(new RTD8TMChanelComponent().RecalculateValues(TableData[time][stack][chanel], _RTD8TMService.GetValueType(stack, chanel)))</td>
|
2024-01-12 08:30:42 +00:00
|
|
|
}
|
2024-01-12 22:22:40 +00:00
|
|
|
}
|
2024-01-12 08:30:42 +00:00
|
|
|
}
|
2024-01-12 22:22:40 +00:00
|
|
|
</tr>
|
2024-01-12 08:30:42 +00:00
|
|
|
}
|
2024-01-12 22:22:40 +00:00
|
|
|
</tbody>
|
|
|
|
|
|
|
|
@if (TableData.Keys.Count > 1)
|
2024-01-12 08:30:42 +00:00
|
|
|
{
|
2024-01-12 22:22:40 +00:00
|
|
|
<tfoot>
|
|
|
|
<tr class="text-warning">
|
|
|
|
<td>30min Change</td>
|
2024-01-12 08:30:42 +00:00
|
|
|
|
2024-01-12 22:22:40 +00:00
|
|
|
@foreach (byte stack in TableData[TableData.Keys.OrderDescending().First()].Keys)
|
2024-01-12 08:30:42 +00:00
|
|
|
{
|
2024-01-12 22:22:40 +00:00
|
|
|
for (byte chanel = 0; chanel < 8; chanel++)
|
2024-01-12 08:30:42 +00:00
|
|
|
{
|
2024-01-12 22:22:40 +00:00
|
|
|
if (_RTD8TMService.GetChanelName(stack, chanel) != "----------")
|
|
|
|
{
|
|
|
|
<td>@Math.Round(new RTD8TMChanelComponent().RecalculateValues(TableData[LastDataTime][stack][chanel], _RTD8TMService.GetValueType(stack, chanel)) - new RTD8TMChanelComponent().RecalculateValues(TableData[AfterHalfHour][stack][chanel], _RTD8TMService.GetValueType(stack, chanel)), 2)</td>
|
|
|
|
}
|
2024-01-12 08:30:42 +00:00
|
|
|
}
|
|
|
|
}
|
2024-01-12 22:22:40 +00:00
|
|
|
</tr>
|
|
|
|
</tfoot>
|
2024-01-12 08:30:42 +00:00
|
|
|
}
|
2024-01-12 22:22:40 +00:00
|
|
|
</table>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<h1>No data</h1>
|
|
|
|
}
|
2024-01-12 08:30:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
@code {
|
|
|
|
private SortedList<long, SortedList<byte,List<float>>> TableData = new();
|
|
|
|
private string Ohm = " (Ω)";
|
|
|
|
private string Celsius = " (°C)";
|
|
|
|
private bool TableBackground = false;
|
2024-01-12 22:22:40 +00:00
|
|
|
private long LastDataTime = 0;
|
|
|
|
private long AfterHalfHour = 0;
|
2024-01-12 08:30:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
protected override void OnInitialized()
|
|
|
|
{
|
|
|
|
TableData = _PointsService.GetPoints().RTD8TM;
|
2024-01-12 22:22:40 +00:00
|
|
|
_PointsService.EventPointPage += UpdateView;
|
2024-01-12 08:30:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private string TableBacgroundChanger()
|
|
|
|
{
|
|
|
|
if (TableBackground)
|
|
|
|
{
|
|
|
|
TableBackground = false;
|
|
|
|
return "bg-black";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TableBackground = true;
|
|
|
|
return "bg-dark";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-12 22:22:40 +00:00
|
|
|
private void HalfHourTime()
|
|
|
|
{
|
|
|
|
LastDataTime = TableData.Keys.OrderDescending().First();
|
|
|
|
long backhalfhour = new DateTime(LastDataTime).AddMinutes(-30).Ticks;
|
|
|
|
AfterHalfHour = TableData.Keys.OrderBy(item => Math.Abs(backhalfhour - item)).First();
|
|
|
|
}
|
2024-01-12 08:30:42 +00:00
|
|
|
|
|
|
|
|
2024-01-12 22:22:40 +00:00
|
|
|
public async Task UpdateView(object? o, bool b)
|
|
|
|
{
|
|
|
|
await InvokeAsync(() =>
|
|
|
|
{
|
|
|
|
TableBackground = false;
|
|
|
|
StateHasChanged();
|
|
|
|
HalfHourTime();
|
|
|
|
});
|
|
|
|
}
|
2024-01-12 08:30:42 +00:00
|
|
|
}
|