initial commit

This commit is contained in:
robotics_x1
2026-10-12 15:24:08 +07:00
commit 55228b3772
367 changed files with 162893 additions and 0 deletions

View File

@@ -0,0 +1,96 @@
@implements IAsyncDisposable
<MudPaper Elevation="0" Class="pa-3" Style="background:transparent;">
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center"
Style="cursor:pointer" @onclick="ToggleExpand">
<MudText Typo="Typo.subtitle1">CONVEYOR</MudText>
<MudIcon Icon="@(_expanded ? Icons.Material.Filled.ExpandMore : Icons.Material.Filled.ExpandLess)" Size="Size.Small" />
</MudStack>
<div class="status-row mt-2">
<MudIcon Icon="@Icons.Material.Filled.Circle" Size="Size.Small" Color="@StatusColor" />
<div>
<MudText Typo="Typo.caption">@StatusText.ToUpper()</MudText>
<MudText Typo="Typo.caption" Style="color:#9a9a9a;">@DetailText</MudText>
</div>
</div>
@if (_expanded)
{
<ConveyorPanel />
}
</MudPaper>
@code {
[Inject] StateService State { get; set; } = default!;
private bool _expanded = true;
protected override async Task OnInitializedAsync()
{
await State.StartAsync();
State.ConveyorChanged += Refresh;
State.WorkflowChanged += Refresh;
State.SystemChanged += Refresh;
State.LockStateChanged += Refresh;
}
public ValueTask DisposeAsync()
{
State.ConveyorChanged -= Refresh;
State.WorkflowChanged -= Refresh;
State.SystemChanged -= Refresh;
State.LockStateChanged -= Refresh;
return ValueTask.CompletedTask;
}
private void ToggleExpand() => _expanded = !_expanded;
private void Refresh() => InvokeAsync(StateHasChanged);
private bool C1Online => State.Conveyor.C1Out != null;
private bool C2Online => State.Conveyor.C2Out != null;
private bool AnyRunning =>
State.Conveyor.C1In == true ||
State.Conveyor.C1Out == true ||
State.Conveyor.C1IMRin == true ||
State.Conveyor.C1IMRout == true ||
State.Conveyor.C2In == true ||
State.Conveyor.C2Out == true;
private string StatusText
{
get
{
if (!string.IsNullOrWhiteSpace(State.Conveyor.WriteError)) return "error";
if (AnyRunning) return "running";
if (C1Online || C2Online) return "ok";
return "off";
}
}
private Color StatusColor => StatusText switch
{
"ok" => Color.Success,
"running" => Color.Info,
"error" => Color.Error,
_ => Color.Default
};
private string DetailText =>
$"C1: {LineState(C1Online, State.Conveyor.C1In, State.Conveyor.C1Out, State.Conveyor.C1IMRin, State.Conveyor.C1IMRout)} | " +
$"C2: {LineState(C2Online, State.Conveyor.C2In, State.Conveyor.C2Out)}";
private static string LineState(bool online, params bool?[] states)
{
if (!online) return "off";
return states.Any(v => v == true) ? "running" : "ready";
}
}
<style>
.status-row { display:flex; align-items:center; gap:8px; margin-bottom:4px; }
</style>