88 lines
4.9 KiB
Plaintext
88 lines
4.9 KiB
Plaintext
@implements IAsyncDisposable
|
|
|
|
<MudPaper Elevation="0" Class="pa-2" Style="background:transparent;">
|
|
|
|
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center"
|
|
Style="cursor:pointer" @onclick="ToggleASRS">
|
|
<MudText Typo="Typo.subtitle1">ASRS</MudText>
|
|
<MudIcon Icon="@(IsAsrsExpanded ? Icons.Material.Filled.ExpandMore : Icons.Material.Filled.ExpandLess)" Size="Size.Small" />
|
|
</MudStack>
|
|
|
|
|
|
<MudCollapse Expanded="@IsAsrsExpanded">
|
|
|
|
<MudText Typo="Typo.caption" Class="sec-title mt-2">Pick Empty Box (S34)</MudText>
|
|
<div class="op-grid">
|
|
<MudButton Variant="Variant.Outlined" Size="Size.Small" Disabled="@(!CanOp("X1_S34", CanRun_S34(1)))" OnClick='()=>Cmd.AsrsWorkflowAsync("X1_S34")'>X1_S34</MudButton>
|
|
<MudButton Variant="Variant.Outlined" Size="Size.Small" Disabled="@(!CanOp("X2_S34", CanRun_S34(2)))" OnClick='()=>Cmd.AsrsWorkflowAsync("X2_S34")'>X2_S34</MudButton>
|
|
<MudButton Variant="Variant.Outlined" Size="Size.Small" Disabled="@(!CanOp("X3_S34", CanRun_S34(3)))" OnClick='()=>Cmd.AsrsWorkflowAsync("X3_S34")'>X3_S34</MudButton>
|
|
</div>
|
|
|
|
<MudText Typo="Typo.caption" Class="sec-title mt-2">Pick Empty Box (S12)</MudText>
|
|
<div class="op-grid">
|
|
<MudButton Variant="Variant.Outlined" Size="Size.Small" Disabled="@(!CanOp("X1_S12", CanRun_S12(1)))" OnClick='()=>Cmd.AsrsWorkflowAsync("X1_S12")'>X1_S12</MudButton>
|
|
<MudButton Variant="Variant.Outlined" Size="Size.Small" Disabled="@(!CanOp("X2_S12", CanRun_S12(2)))" OnClick='()=>Cmd.AsrsWorkflowAsync("X2_S12")'>X2_S12</MudButton>
|
|
<MudButton Variant="Variant.Outlined" Size="Size.Small" Disabled="@(!CanOp("X3_S12", CanRun_S12(3)))" OnClick='()=>Cmd.AsrsWorkflowAsync("X3_S12")'>X3_S12</MudButton>
|
|
</div>
|
|
|
|
<MudText Typo="Typo.caption" Class="sec-title mt-2">Return Tray (R43)</MudText>
|
|
<div class="op-grid">
|
|
<MudButton Variant="Variant.Outlined" Size="Size.Small" Disabled="@(!CanOp("X1_R43", CanRun_R43(1)))" OnClick='()=>Cmd.AsrsWorkflowAsync("X1_R43")'>X1_R43</MudButton>
|
|
<MudButton Variant="Variant.Outlined" Size="Size.Small" Disabled="@(!CanOp("X2_R43", CanRun_R43(2)))" OnClick='()=>Cmd.AsrsWorkflowAsync("X2_R43")'>X2_R43</MudButton>
|
|
<MudButton Variant="Variant.Outlined" Size="Size.Small" Disabled="@(!CanOp("X3_R43", CanRun_R43(3)))" OnClick='()=>Cmd.AsrsWorkflowAsync("X3_R43")'>X3_R43</MudButton>
|
|
</div>
|
|
|
|
<MudText Typo="Typo.caption" Class="sec-title mt-2">Return Tray (R12)</MudText>
|
|
<div class="op-grid">
|
|
<MudButton Variant="Variant.Outlined" Size="Size.Small" Disabled="@(!CanOp("X1_R12", CanRun_R12(1)))" OnClick='()=>Cmd.AsrsWorkflowAsync("X1_R12")'>X1_R12</MudButton>
|
|
<MudButton Variant="Variant.Outlined" Size="Size.Small" Disabled="@(!CanOp("X2_R12", CanRun_R12(2)))" OnClick='()=>Cmd.AsrsWorkflowAsync("X2_R12")'>X2_R12</MudButton>
|
|
<MudButton Variant="Variant.Outlined" Size="Size.Small" Disabled="@(!CanOp("X3_R12", CanRun_R12(3)))" OnClick='()=>Cmd.AsrsWorkflowAsync("X3_R12")'>X3_R12</MudButton>
|
|
</div>
|
|
|
|
<div class="mt-2">
|
|
<MudButton FullWidth="true" Variant="Variant.Outlined" Color="Color.Primary" Size="Size.Small"
|
|
Disabled="@(State.Asrs.IsBusy || !State.CanControl)" OnClick="Homing">Homing</MudButton>
|
|
</div>
|
|
|
|
</MudCollapse>
|
|
|
|
</MudPaper>
|
|
|
|
@code {
|
|
[Inject] StateService State { get; set; } = default!;
|
|
[Inject] CommandService Cmd { get; set; } = default!;
|
|
|
|
bool IsAsrsExpanded = true;
|
|
void ToggleASRS() => IsAsrsExpanded = !IsAsrsExpanded;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await State.StartAsync();
|
|
State.AsrsChanged += Refresh;
|
|
}
|
|
|
|
public ValueTask DisposeAsync()
|
|
{
|
|
State.AsrsChanged -= Refresh;
|
|
return ValueTask.CompletedTask;
|
|
}
|
|
|
|
private void Refresh() => InvokeAsync(StateHasChanged);
|
|
|
|
private Task Homing() => Cmd.AsrsHomingAsync();
|
|
|
|
private bool CanOp(string label, bool canRun)
|
|
=> State.CanControl && !State.Asrs.IsBusy && !State.AsrsIsLocked(label)
|
|
&& State.Asrs.SAFETY_MODE == true && canRun;
|
|
|
|
private bool CanRun_S12(int col) => col switch { 1 => State.Asrs.X11 == true, 2 => State.Asrs.X12 == true, 3 => State.Asrs.X13 == true, _ => false };
|
|
private bool CanRun_R12(int col) => col switch { 1 => State.Asrs.X11 == false, 2 => State.Asrs.X12 == false, 3 => State.Asrs.X13 == false, _ => false };
|
|
private bool CanRun_S34(int col) => col switch { 1 => State.Asrs.X31 == true, 2 => State.Asrs.X32 == true, 3 => State.Asrs.X33 == true, _ => false };
|
|
private bool CanRun_R43(int col) => col switch { 1 => State.Asrs.X31 == false, 2 => State.Asrs.X32 == false, 3 => State.Asrs.X33 == false, _ => false };
|
|
}
|
|
|
|
<style>
|
|
.sec-title { display:block; color:#9CA3AF; margin-bottom:4px; }
|
|
.op-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
|
|
</style>
|