add-添加agv实时状态具体展示

dev
liuwf 1 week ago
parent 49a255484e
commit 6cc5ecdbe2

@ -0,0 +1,54 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Model.domain
{
[SugarTable("dms_agv_code_map"), TenantAttribute("mes")]
public class DmsAgvCodeMap
{
/// <summary>
/// 机器人状态码
/// </summary>
[SugarColumn(IsPrimaryKey = true, ColumnName = "agv_code")]
public long AgvCode { get; set; }
/// <summary>
/// 机器人状态
/// </summary>
[SugarColumn(ColumnName = "agv_status")]
public string AgvStatus { get; set; }
/// <summary>
/// 机器人状态定义说明
/// </summary>
[SugarColumn(ColumnName = "agv_status_definition")]
public string AgvStatusDefinition { get; set; }
/// <summary>
/// 显示屏显示内容
/// </summary>
[SugarColumn(ColumnName = "agv_display_content")]
public string AgvDisplayContent { get; set; }
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnName = "remark")]
public string Remark { get; set; }
/// <summary>
/// 创建人
/// </summary>
[SugarColumn(ColumnName = "create_by")]
public string CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnName = "create_time")]
public DateTime? CreateTime { get; set; }
}
}

@ -93,6 +93,8 @@ namespace SlnMesnac.Model.domain
[SugarColumn(ColumnName = "status")] [SugarColumn(ColumnName = "status")]
public string Status { get; set; } public string Status { get; set; }
/// <summary> /// <summary>
/// 是否暂停 0-否 1-是 /// 是否暂停 0-否 1-是
/// </summary> /// </summary>
@ -110,5 +112,11 @@ namespace SlnMesnac.Model.domain
/// </summary> /// </summary>
[SugarColumn(ColumnName = "agvName")] [SugarColumn(ColumnName = "agvName")]
public string AgvName { get; set; } public string AgvName { get; set; }
/// <summary>
/// 机器人状态说明
/// </summary>
public string StatusDefine { get; set; }
} }
} }

@ -47,7 +47,8 @@
<!--resourceStyle 399行修改选中字体颜色--> <!--resourceStyle 399行修改选中字体颜色-->
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn Binding="{Binding AgvName}" Header="AGV名称信息" Width="2*" IsReadOnly="True"/> <DataGridTextColumn Binding="{Binding AgvName}" Header="AGV名称信息" Width="2*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Online}" Header="在线状态" Width="*" IsReadOnly="True"/> <DataGridTextColumn Binding="{Binding Online}" Header="是否在线" Width="*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding StatusDefine}" Header="实时状态" Width="*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Battery}" Header="电量" Width="*" IsReadOnly="True"/> <DataGridTextColumn Binding="{Binding Battery}" Header="电量" Width="*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Speed}" Header="速度" Width="*" IsReadOnly="True"/> <DataGridTextColumn Binding="{Binding Speed}" Header="速度" Width="*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding PosX}" Header="X轴坐标" Width="*" IsReadOnly="True"/> <DataGridTextColumn Binding="{Binding PosX}" Header="X轴坐标" Width="*" IsReadOnly="True"/>

@ -116,13 +116,25 @@ namespace SlnMesnac.WPF.ViewModel
/// <param name="palletTasks"></param> /// <param name="palletTasks"></param>
private async Task RefreshWcsAgvStatusDataGrid() private async Task RefreshWcsAgvStatusDataGrid()
{ {
List<WcsAgvStatus> agvList = await sqlSugarClient.AsTenant().GetConnection("mes").Queryable<WcsAgvStatus>().ToListAsync(); var query = sqlSugarClient.AsTenant().GetConnection("mes").Queryable<WcsAgvStatus>()
.LeftJoin<DmsAgvCodeMap>((was, dacm) => long.Parse(was.Status) == dacm.AgvCode)
.Select((was, dacm) => new WcsAgvStatus
{
AgvName = was.AgvName,
Online = was.Online == "true" ? "在线" : "离线",
StatusDefine = dacm.AgvStatus,
Battery = was.Battery,
Speed = was.Speed,
PosX = was.PosX,
PosY = was.PosY,
Timestamp = was.Timestamp
}).ToList();
await App.Current.Dispatcher.BeginInvoke((Action)(() => await App.Current.Dispatcher.BeginInvoke((Action)(() =>
{ {
WcsAgvStatusDataGrid.Clear(); WcsAgvStatusDataGrid.Clear();
foreach (var agv in agvList) foreach (var agv in query)
{ {
agv.Online = agv.Online=="true"? "在线": "离线";
WcsAgvStatusDataGrid.Add(agv); WcsAgvStatusDataGrid.Add(agv);
} }
})); }));

Loading…
Cancel
Save