This commit is contained in:
2026-10-23 16:03:02 +07:00
parent 62d33e8ef0
commit dfedb70403
11 changed files with 90 additions and 6 deletions

View File

@@ -21,6 +21,14 @@
</div>
</div>
@if (S.Available)
{
<div class="mt-1 mb-1">
<MudButton FullWidth="true" Variant="Variant.Outlined" Color="Color.Error" Size="Size.Small"
Disabled="@(!CanCancel)" OnClick="Cancel">Cancel</MudButton>
</div>
}
@if (!string.IsNullOrEmpty(S.LastError))
{
<MudText Typo="Typo.caption" Style="color:#e74c3c;display:block;">@S.LastError</MudText>
@@ -137,6 +145,9 @@
private bool CanCommand => State.CanControl && S.Available && S.Online
&& S.Fault != true && !S.DriverBusy;
// Cancel bấm được cả khi đang chạy / PLC Busy (lệnh có thể do client khác gửi)
private bool CanCancel => State.CanControl && S.Available && S.Online;
private bool CanRetrieve => CanCommand && _from is { } f && _to is null && Occ(f) == true;
private bool CanStore => CanCommand && _from is { } f && _to is null && Occ(f) == false;
private bool CanMove => CanCommand && _from is { } f && _to is { } t && Occ(f) == true && Occ(t) == false;
@@ -163,6 +174,7 @@
private Task StoreAny() => Cmd.AsrsOpcStoreAnyAsync(_conveyor);
private Task Home() => Cmd.AsrsOpcHomeAsync();
private Task Cancel() => Cmd.AsrsOpcCancelAsync();
private void ClearSel() { _from = null; _to = null; }
}

View File

@@ -170,6 +170,9 @@ public class CommandService
}
// ── ASRS qua OPC UA (gateway) ─────────────────────────────────────────
public Task AsrsOpcCancelAsync(CancellationToken ct = default)
=> PostAsrsOpcAsync("Cancel", null, "/api/asrs/opc/cancel", null, ct);
public Task AsrsOpcHomeAsync(CancellationToken ct = default)
=> PostAsrsOpcAsync("Home", null, "/api/asrs/opc/home", null, ct);