add - 添加提升机手动任务执行界面
parent
54f8b5a72e
commit
0264cea34b
@ -0,0 +1,305 @@
|
|||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Net.Http.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using Sln.Wcs.Model.Domain;
|
||||||
|
using Sln.Wcs.Repository.service;
|
||||||
|
using Sln.Wcs.Serilog;
|
||||||
|
|
||||||
|
namespace Sln.Wcs.UI.ViewModels.Task;
|
||||||
|
|
||||||
|
public partial class ManualTaskViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
private const string HoistBaseUrl = "http://localhost:5100";
|
||||||
|
|
||||||
|
private readonly ILiveTaskQueueService _taskQueueService;
|
||||||
|
private readonly ILiveTaskDetailService _taskDetailService;
|
||||||
|
private readonly HttpClient _http;
|
||||||
|
private readonly SerilogHelper _logger;
|
||||||
|
|
||||||
|
private FreeHoistResponse? _allocatedHoist;
|
||||||
|
|
||||||
|
private Dictionary<string,FreeHoistResponse> hoistDic = new Dictionary<string,FreeHoistResponse>();
|
||||||
|
|
||||||
|
public string PageTitle => "手动执行任务";
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<LiveTaskQueue> _tasks = new();
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private LiveTaskQueue? _selectedTask;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<LiveTaskDetail> _details = new();
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _statusText = string.Empty;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool _isExecuting;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool _isMaterialReady;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool _taskExecuted;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _hoistInfo = "--";
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _dockingPoint = "--";
|
||||||
|
|
||||||
|
public ManualTaskViewModel(
|
||||||
|
ILiveTaskQueueService taskQueueService,
|
||||||
|
ILiveTaskDetailService taskDetailService,
|
||||||
|
SerilogHelper logger)
|
||||||
|
{
|
||||||
|
_taskQueueService = taskQueueService;
|
||||||
|
_taskDetailService = taskDetailService;
|
||||||
|
_http = new HttpClient { Timeout = System.TimeSpan.FromSeconds(5) };
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Avalonia.Controls.Control CreateView() => new Views.Task.ManualTaskView();
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void Load()
|
||||||
|
{
|
||||||
|
RefreshTaskList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RefreshTaskList()
|
||||||
|
{
|
||||||
|
List<LiveTaskQueue> list = _taskQueueService.getLiveTaskQueues(x=>x.executionMode == 1 && x.isFlag == 1);
|
||||||
|
Tasks = new ObservableCollection<LiveTaskQueue>(list);
|
||||||
|
StatusText = list.Count > 0
|
||||||
|
? $"查询到 {list.Count} 条待执行手动任务"
|
||||||
|
: "暂无待执行的手动任务";
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void OnSelectedTaskChanged(LiveTaskQueue? value)
|
||||||
|
{
|
||||||
|
TaskExecuted = false;
|
||||||
|
_allocatedHoist = null;
|
||||||
|
HoistInfo = "--";
|
||||||
|
DockingPoint = "--";
|
||||||
|
if (value is not null)
|
||||||
|
LoadDetails(value.taskCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadDetails(string taskCode)
|
||||||
|
{
|
||||||
|
var detailList = _taskDetailService.Query(x => x.taskCode == taskCode)
|
||||||
|
.OrderBy(d => d.objId)
|
||||||
|
.ToList();
|
||||||
|
Details = new ObservableCollection<LiveTaskDetail>(detailList);
|
||||||
|
//StatusText = $"任务 {taskCode},共 {detailList.Count} 条明细";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务执行:调用提升机调度中心 API 获取空闲提升机后下发任务
|
||||||
|
/// </summary>
|
||||||
|
[RelayCommand]
|
||||||
|
private async System.Threading.Tasks.Task ExecuteTaskAsync()
|
||||||
|
{
|
||||||
|
if (SelectedTask is null)
|
||||||
|
{
|
||||||
|
StatusText = "请先选择一条任务";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SelectedTask.taskStatus != 1)
|
||||||
|
{
|
||||||
|
StatusText = "当前任务状态不允许执行";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var hoistDetail = Details.FirstOrDefault(d => d.deviceType == 2);
|
||||||
|
if (hoistDetail is null)
|
||||||
|
{
|
||||||
|
StatusText = "当前任务未包含提升机步骤,无需手动执行";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IsExecuting = true;
|
||||||
|
StatusText = "正在获取空闲提升机...";
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 1. 获取空闲提升机
|
||||||
|
string hostCode = "1#Host";
|
||||||
|
var freeUrl = $"{HoistBaseUrl}/api/hoist/free?hostCode={Uri.EscapeDataString(hostCode)}";
|
||||||
|
var freeRes = await _http.GetFromJsonAsync<FreeHoistResponse>(freeUrl);
|
||||||
|
|
||||||
|
if (freeRes is not { found: true })
|
||||||
|
{
|
||||||
|
StatusText = "暂无空闲提升机,请稍后重新获取";
|
||||||
|
HoistInfo = "忙碌";
|
||||||
|
_logger.Info($"手动任务 {SelectedTask.taskCode} 获取空闲提升机失败:无空闲设备");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_allocatedHoist = freeRes;
|
||||||
|
HoistInfo = $"{freeRes.deviceName ?? freeRes.deviceCode} (空闲)";
|
||||||
|
DockingPoint = $"{freeRes.deviceSerialNo}" ?? "--";
|
||||||
|
|
||||||
|
StatusText = $"已获取空闲提升机 {freeRes.deviceName ?? freeRes.deviceCode},正在下发任务...";
|
||||||
|
hoistDic.Add(SelectedTask.taskCode,freeRes);
|
||||||
|
// 2. 下发提升机调度任务
|
||||||
|
var dispatchBody = new
|
||||||
|
{
|
||||||
|
hostCode = freeRes.hostCode,
|
||||||
|
serialNo = freeRes.deviceSerialNo,
|
||||||
|
taskCode = hoistDetail.taskCode,
|
||||||
|
startPoint = hoistDetail.startPoint,
|
||||||
|
endPoint = hoistDetail.endPoint
|
||||||
|
};
|
||||||
|
|
||||||
|
var dispatchRes = await _http.PostAsJsonAsync($"{HoistBaseUrl}/api/task/dispatch", dispatchBody);
|
||||||
|
var dispatchResult = await dispatchRes.Content.ReadFromJsonAsync<ApiResult>();
|
||||||
|
|
||||||
|
if (dispatchResult is not { success: true })
|
||||||
|
{
|
||||||
|
StatusText = $"任务下发失败: {dispatchResult?.msg ?? "未知错误"}";
|
||||||
|
_logger.Error($"手动任务 {SelectedTask.taskCode} 下发失败");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 更新任务状态为执行中
|
||||||
|
await System.Threading.Tasks.Task.Run(() =>
|
||||||
|
{
|
||||||
|
SelectedTask.taskStatus = 2;
|
||||||
|
_taskQueueService.Update(SelectedTask);
|
||||||
|
|
||||||
|
hoistDetail.taskStatus = 2;
|
||||||
|
_taskDetailService.Update(hoistDetail);
|
||||||
|
});
|
||||||
|
|
||||||
|
TaskExecuted = true;
|
||||||
|
_logger.Info($"手动任务 {SelectedTask.taskCode} 已下发到提升机 {freeRes.deviceCode}");
|
||||||
|
StatusText = $"任务 {SelectedTask.taskCode} 已下发到提升机 {freeRes.deviceName ?? freeRes.deviceCode}";
|
||||||
|
LoadDetails(SelectedTask.taskCode);
|
||||||
|
RefreshTaskList();
|
||||||
|
}
|
||||||
|
catch (HttpRequestException ex)
|
||||||
|
{
|
||||||
|
TaskExecuted = false;
|
||||||
|
_allocatedHoist = null;
|
||||||
|
HoistInfo = "--";
|
||||||
|
StatusText = $"与提升机调度中心通信失败: {ex.Message}";
|
||||||
|
_logger.Error($"HoistServer 通信失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TaskExecuted = false;
|
||||||
|
_allocatedHoist = null;
|
||||||
|
HoistInfo = "--";
|
||||||
|
StatusText = $"任务执行失败: {ex.Message}";
|
||||||
|
_logger.Error($"手动任务执行失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
IsExecuting = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料到位确认:调用提升机调度中心 receive-pallet 接口
|
||||||
|
/// </summary>
|
||||||
|
[RelayCommand]
|
||||||
|
private async System.Threading.Tasks.Task MaterialReadyAsync()
|
||||||
|
{
|
||||||
|
if (SelectedTask is null)
|
||||||
|
{
|
||||||
|
StatusText = "请先选择一条任务";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hoistDic.TryGetValue(SelectedTask.taskCode, out _allocatedHoist);
|
||||||
|
|
||||||
|
if (_allocatedHoist is null)
|
||||||
|
{
|
||||||
|
StatusText = "请先执行任务获取空闲提升机,再确认物料到位";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var hoistDetail = Details.FirstOrDefault(d => d.deviceType == 2);
|
||||||
|
if (hoistDetail is null)
|
||||||
|
{
|
||||||
|
StatusText = "未找到提升机任务明细";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IsMaterialReady = true;
|
||||||
|
StatusText = "正在确认物料到位...";
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var body = new
|
||||||
|
{
|
||||||
|
hostCode = _allocatedHoist.hostCode,
|
||||||
|
serialNo = _allocatedHoist.deviceSerialNo,
|
||||||
|
taskCode = hoistDetail.taskCode,
|
||||||
|
palletBarcode = hoistDetail.palletBarcode ?? "",
|
||||||
|
startPoint = hoistDetail.startPoint,
|
||||||
|
endPoint = hoistDetail.endPoint
|
||||||
|
};
|
||||||
|
|
||||||
|
var res = await _http.PostAsJsonAsync($"{HoistBaseUrl}/api/hoist/receive-pallet", body);
|
||||||
|
var result = await res.Content.ReadFromJsonAsync<ApiResult>();
|
||||||
|
|
||||||
|
if (result is not { success: true })
|
||||||
|
{
|
||||||
|
StatusText = $"receive-pallet 调用失败: {result?.msg ?? "未知错误"}";
|
||||||
|
_logger.Error($"receive-pallet 失败: {result?.msg}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新备注
|
||||||
|
await System.Threading.Tasks.Task.Run(() =>
|
||||||
|
{
|
||||||
|
SelectedTask.remark = "物料已到位";
|
||||||
|
_taskQueueService.Update(SelectedTask);
|
||||||
|
});
|
||||||
|
|
||||||
|
_logger.Info($"手动任务 {SelectedTask.taskCode} 物料到位确认,已调用 receive-pallet");
|
||||||
|
StatusText = $"任务 {SelectedTask.taskCode} 物料已到位,提升机已启动";
|
||||||
|
LoadDetails(SelectedTask.taskCode);
|
||||||
|
}
|
||||||
|
catch (HttpRequestException ex)
|
||||||
|
{
|
||||||
|
StatusText = $"与提升机调度中心通信失败: {ex.Message}";
|
||||||
|
_logger.Error($"HoistServer 通信失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
StatusText = $"物料到位确认失败: {ex.Message}";
|
||||||
|
_logger.Error($"物料到位确认失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
IsMaterialReady = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- API 响应 DTO ----
|
||||||
|
|
||||||
|
private class FreeHoistResponse
|
||||||
|
{
|
||||||
|
public bool found { get; set; }
|
||||||
|
public string? deviceCode { get; set; }
|
||||||
|
public string? deviceName { get; set; }
|
||||||
|
public string? hostCode { get; set; }
|
||||||
|
public int deviceSerialNo { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ApiResult
|
||||||
|
{
|
||||||
|
public bool success { get; set; }
|
||||||
|
public string? msg { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,163 @@
|
|||||||
|
<UserControl x:CompileBindings="False" xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
x:Class="Sln.Wcs.UI.Views.Task.ManualTaskView">
|
||||||
|
<Grid RowDefinitions="*,Auto" Margin="20,14,20,14">
|
||||||
|
|
||||||
|
<!-- 上部:任务列表 + 明细 -->
|
||||||
|
<Grid Grid.Row="0" ColumnDefinitions="1.2*,1*" Margin="0,0,0,14">
|
||||||
|
|
||||||
|
<!-- 左侧:任务列表 -->
|
||||||
|
<Border Grid.Column="0" CornerRadius="8" Padding="14" Background="{DynamicResource CardBgBrush}"
|
||||||
|
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Margin="0,0,8,0">
|
||||||
|
<Grid RowDefinitions="Auto,Auto,*">
|
||||||
|
<StackPanel Grid.Row="0" Orientation="Horizontal" Spacing="8" Margin="0,0,0,10">
|
||||||
|
<Rectangle Width="3" Height="18" Fill="#4FC3F7" RadiusX="2" RadiusY="2" />
|
||||||
|
<TextBlock Text="手动任务列表" FontSize="14" FontWeight="SemiBold"
|
||||||
|
Foreground="{DynamicResource PrimaryTextBrush}" />
|
||||||
|
<Button Content="刷新" Command="{Binding LoadCommand}"
|
||||||
|
Background="{DynamicResource TealBtnBrush}" Foreground="White"
|
||||||
|
FontSize="11" Padding="10,4" HorizontalAlignment="Right" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 列表头 -->
|
||||||
|
<Border Grid.Row="1" Background="{DynamicResource PrimaryBgBrush}" Padding="8,6"
|
||||||
|
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,0,0,1">
|
||||||
|
<Grid ColumnDefinitions="1.4*,0.8*,0.8*,1.2*,1.2*,0.8*">
|
||||||
|
<TextBlock Grid.Column="0" Text="任务编号" FontSize="11" FontWeight="SemiBold"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}" />
|
||||||
|
<TextBlock Grid.Column="1" Text="类型" FontSize="11" FontWeight="SemiBold"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}" />
|
||||||
|
<TextBlock Grid.Column="2" Text="类别" FontSize="11" FontWeight="SemiBold"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}" />
|
||||||
|
<TextBlock Grid.Column="3" Text="起始位置" FontSize="11" FontWeight="SemiBold"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}" />
|
||||||
|
<TextBlock Grid.Column="4" Text="结束位置" FontSize="11" FontWeight="SemiBold"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}" />
|
||||||
|
<TextBlock Grid.Column="5" Text="步骤" FontSize="11" FontWeight="SemiBold"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}" />
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<ListBox Grid.Row="2" ItemsSource="{Binding Tasks}" SelectedItem="{Binding SelectedTask, Mode=TwoWay}"
|
||||||
|
Background="Transparent" Foreground="{DynamicResource PrimaryTextBrush}" BorderThickness="0">
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Border Padding="8,5" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,0,0,1"
|
||||||
|
Background="Transparent">
|
||||||
|
<Grid ColumnDefinitions="1.4*,0.8*,0.8*,1.2*,1.2*,0.8*">
|
||||||
|
<TextBlock Grid.Column="0" Text="{Binding taskCode}"
|
||||||
|
Foreground="{DynamicResource PrimaryTextBrush}" FontSize="12" VerticalAlignment="Center" />
|
||||||
|
<TextBlock Grid.Column="1" Text="{Binding taskType}"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}" FontSize="12" VerticalAlignment="Center" />
|
||||||
|
<TextBlock Grid.Column="2" Text="{Binding taskCategory}"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}" FontSize="12" VerticalAlignment="Center" />
|
||||||
|
<TextBlock Grid.Column="3" Text="{Binding startPoint}"
|
||||||
|
Foreground="{DynamicResource AccentTextBrush}" FontSize="12" VerticalAlignment="Center" />
|
||||||
|
<TextBlock Grid.Column="4" Text="{Binding endPoint}"
|
||||||
|
Foreground="{DynamicResource AccentTextBrush}" FontSize="12" VerticalAlignment="Center" />
|
||||||
|
<TextBlock Grid.Column="5" Text="{Binding taskSteps}"
|
||||||
|
Foreground="{DynamicResource PrimaryTextBrush}" FontSize="12" VerticalAlignment="Center" />
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 右侧:明细列表 -->
|
||||||
|
<Border Grid.Column="1" CornerRadius="8" Padding="14" Background="{DynamicResource CardBgBrush}"
|
||||||
|
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Margin="8,0,0,0">
|
||||||
|
<Grid RowDefinitions="Auto,Auto,*">
|
||||||
|
<StackPanel Grid.Row="0" Orientation="Horizontal" Spacing="8" Margin="0,0,0,10">
|
||||||
|
<Rectangle Width="3" Height="18" Fill="#4FC3F7" RadiusX="2" RadiusY="2" />
|
||||||
|
<TextBlock Text="任务明细" FontSize="14" FontWeight="SemiBold"
|
||||||
|
Foreground="{DynamicResource PrimaryTextBrush}" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 明细表头 -->
|
||||||
|
<Border Grid.Row="1" Background="{DynamicResource PrimaryBgBrush}" Padding="8,6"
|
||||||
|
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,0,0,1">
|
||||||
|
<Grid ColumnDefinitions="0.5*,1.2*,1.2*,0.7*,0.7*,0.7*">
|
||||||
|
<TextBlock Grid.Column="0" Text="序号" FontSize="11" FontWeight="SemiBold"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}" />
|
||||||
|
<TextBlock Grid.Column="1" Text="起始位置" FontSize="11" FontWeight="SemiBold"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}" />
|
||||||
|
<TextBlock Grid.Column="2" Text="结束位置" FontSize="11" FontWeight="SemiBold"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}" />
|
||||||
|
<TextBlock Grid.Column="3" Text="设备" FontSize="11" FontWeight="SemiBold"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}" />
|
||||||
|
<TextBlock Grid.Column="4" Text="状态" FontSize="11" FontWeight="SemiBold"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}" />
|
||||||
|
<TextBlock Grid.Column="5" Text="执行方式" FontSize="11" FontWeight="SemiBold"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}" />
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<ListBox Grid.Row="2" ItemsSource="{Binding Details}"
|
||||||
|
Background="Transparent" Foreground="{DynamicResource PrimaryTextBrush}" BorderThickness="0">
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Border Padding="8,5" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,0,0,1">
|
||||||
|
<Grid ColumnDefinitions="0.5*,1.2*,1.2*,0.7*,0.7*,0.7*">
|
||||||
|
<TextBlock Grid.Column="0" Text="{Binding objId}"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}" FontSize="11" VerticalAlignment="Center" />
|
||||||
|
<TextBlock Grid.Column="1" Text="{Binding startPoint}"
|
||||||
|
Foreground="{DynamicResource AccentTextBrush}" FontSize="11" VerticalAlignment="Center" />
|
||||||
|
<TextBlock Grid.Column="2" Text="{Binding endPoint}"
|
||||||
|
Foreground="{DynamicResource AccentTextBrush}" FontSize="11" VerticalAlignment="Center" />
|
||||||
|
<TextBlock Grid.Column="3" Text="{Binding deviceType}"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}" FontSize="11" VerticalAlignment="Center" />
|
||||||
|
<TextBlock Grid.Column="4" Text="{Binding taskStatus}"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}" FontSize="11" VerticalAlignment="Center" />
|
||||||
|
<TextBlock Grid.Column="5" Text="{Binding executionMode}"
|
||||||
|
Foreground="{DynamicResource PrimaryTextBrush}" FontSize="11" VerticalAlignment="Center" />
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- 下部:操作区 -->
|
||||||
|
<Border Grid.Row="1" CornerRadius="8" Padding="18" Background="{DynamicResource CardBgBrush}"
|
||||||
|
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1">
|
||||||
|
<Grid ColumnDefinitions="Auto,Auto,Auto,Auto,*">
|
||||||
|
<Button Grid.Column="0" Content="任务执行" Command="{Binding ExecuteTaskCommand}"
|
||||||
|
IsEnabled="{Binding !TaskExecuted}"
|
||||||
|
Background="{DynamicResource PrimaryBtnBrush}" Foreground="White"
|
||||||
|
FontSize="13" Padding="20,10" />
|
||||||
|
<Button Grid.Column="1" Content="物料到位" Command="{Binding MaterialReadyCommand}"
|
||||||
|
IsEnabled="{Binding !IsMaterialReady}"
|
||||||
|
Background="#FF9800" Foreground="White"
|
||||||
|
FontSize="13" Padding="20,10" Margin="16,0,0,0" />
|
||||||
|
|
||||||
|
<!-- 设备状态显示 -->
|
||||||
|
<Border Grid.Column="2" CornerRadius="6" Padding="14,8" Margin="24,0,0,0"
|
||||||
|
Background="#1A1A2E" BorderBrush="#4FC3F7" BorderThickness="1">
|
||||||
|
<StackPanel Orientation="Horizontal" Spacing="20">
|
||||||
|
<StackPanel Orientation="Horizontal" Spacing="6">
|
||||||
|
<TextBlock Text="提升机:" FontSize="12" FontWeight="SemiBold"
|
||||||
|
Foreground="#4FC3F7" VerticalAlignment="Center" />
|
||||||
|
<TextBlock Text="{Binding HoistInfo}" FontSize="14" FontWeight="Bold"
|
||||||
|
Foreground="#FFFFFF" VerticalAlignment="Center" />
|
||||||
|
</StackPanel>
|
||||||
|
<Border Width="1" Background="#333" Margin="4,2" />
|
||||||
|
<StackPanel Orientation="Horizontal" Spacing="6">
|
||||||
|
<TextBlock Text="接驳位:" FontSize="12" FontWeight="SemiBold"
|
||||||
|
Foreground="#4FC3F7" VerticalAlignment="Center" />
|
||||||
|
<TextBlock Text="{Binding DockingPoint}" FontSize="14" FontWeight="Bold"
|
||||||
|
Foreground="#FFFFFF" VerticalAlignment="Center" />
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="4" Text="{Binding StatusText}" FontSize="12"
|
||||||
|
Foreground="{DynamicResource AccentTextBrush}"
|
||||||
|
VerticalAlignment="Center" TextWrapping="Wrap" Margin="24,0,0,0" />
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
using Sln.Wcs.UI.ViewModels.Task;
|
||||||
|
|
||||||
|
namespace Sln.Wcs.UI.Views.Task;
|
||||||
|
|
||||||
|
public partial class ManualTaskView : UserControl
|
||||||
|
{
|
||||||
|
public ManualTaskView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue