first commit

This commit is contained in:
2026-10-22 14:31:58 +07:00
parent 55228b3772
commit 62d33e8ef0
24 changed files with 1073 additions and 25 deletions

View File

@@ -26,13 +26,13 @@
<MudDivider Class="mt-2 mb-1" />
@* ── ASRS grid ── *@
@* ── ASRS grid — Slot.{cột}.{tầng}.Occupied từ gateway OPC UA, tầng cao nhất ở trên ── *@
<div style="display:grid;grid-template-columns:repeat(3,1fr);gap:4px;">
@foreach (var row in AsrsRows)
{
@foreach (var cell in row.Cells)
{
bool on = cell.Val == true && !State.Asrs.IsOffline;
bool on = cell.Val == true && State.AsrsOpc.Online;
<MudChip T="string" Size="Size.Small"
Color="@(on ? Color.Info : Color.Default)"
Variant="@(on ? Variant.Filled : Variant.Outlined)"
@@ -63,13 +63,13 @@
protected override async Task OnInitializedAsync()
{
await State.StartAsync();
State.AsrsChanged += Refresh;
State.AsrsOpcChanged += Refresh;
State.WorkflowChanged += Refresh;
}
public ValueTask DisposeAsync()
{
State.AsrsChanged -= Refresh;
State.AsrsOpcChanged -= Refresh;
State.WorkflowChanged -= Refresh;
return ValueTask.CompletedTask;
}
@@ -94,12 +94,13 @@
!string.IsNullOrEmpty(State.Workflow.LastError) ? "color:#e74c3c;" :
State.Workflow.IsRunning ? "color:#4a9eff;" : "color:#9CA3AF;";
private (string RowLabel, (string Label, bool? Val)[] Cells)[] AsrsRows => new[]
{
("L4", new (string, bool?)[] { ("41", State.Asrs.X41), ("42", State.Asrs.X42), ("43", State.Asrs.X43) }),
("L3", new (string, bool?)[] { ("31", State.Asrs.X31), ("32", State.Asrs.X32), ("33", State.Asrs.X33) }),
("L2", new (string, bool?)[] { ("21", State.Asrs.X21), ("22", State.Asrs.X22), ("23", State.Asrs.X23) }),
("L1", new (string, bool?)[] { ("11", State.Asrs.X11), ("12", State.Asrs.X12), ("13", State.Asrs.X13) }),
};
private (string RowLabel, (string Label, bool? Val)[] Cells)[] AsrsRows =>
Enumerable.Range(1, AsrsOpcLayout.Shelves).Reverse()
.Select(shelf => ($"T{shelf}",
Enumerable.Range(1, AsrsOpcLayout.Columns)
.Select(col => ($"{col}.{shelf}",
State.AsrsOpc.Occupied.ElementAtOrDefault(AsrsOpcLayout.SlotIndex(col, shelf))))
.ToArray()))
.ToArray();
}