From 6cc5ecdbe27eb83e9275ec37a3d4ce0df38affc6 Mon Sep 17 00:00:00 2001 From: liuwf Date: Sat, 16 Nov 2024 18:11:55 +0800 Subject: [PATCH] =?UTF-8?q?add-=E6=B7=BB=E5=8A=A0agv=E5=AE=9E=E6=97=B6?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=85=B7=E4=BD=93=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SlnMesnac.Model/domain/DmsAgvCodeMap.cs | 54 +++++++++++++++++++ SlnMesnac.Model/domain/WcsAgvStatus.cs | 8 +++ SlnMesnac.WPF/Page/AgvAndTaskMonitorPage.xaml | 3 +- .../ViewModel/AgvAndTaskViewModel.cs | 20 +++++-- 4 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 SlnMesnac.Model/domain/DmsAgvCodeMap.cs diff --git a/SlnMesnac.Model/domain/DmsAgvCodeMap.cs b/SlnMesnac.Model/domain/DmsAgvCodeMap.cs new file mode 100644 index 0000000..c5d7142 --- /dev/null +++ b/SlnMesnac.Model/domain/DmsAgvCodeMap.cs @@ -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 + { + /// + /// 机器人状态码 + /// + [SugarColumn(IsPrimaryKey = true, ColumnName = "agv_code")] + public long AgvCode { get; set; } + + /// + /// 机器人状态 + /// + [SugarColumn(ColumnName = "agv_status")] + public string AgvStatus { get; set; } + + /// + /// 机器人状态定义说明 + /// + [SugarColumn(ColumnName = "agv_status_definition")] + public string AgvStatusDefinition { get; set; } + + /// + /// 显示屏显示内容 + /// + [SugarColumn(ColumnName = "agv_display_content")] + public string AgvDisplayContent { get; set; } + + /// + /// 备注 + /// + [SugarColumn(ColumnName = "remark")] + public string Remark { get; set; } + + /// + /// 创建人 + /// + [SugarColumn(ColumnName = "create_by")] + public string CreateBy { get; set; } + + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "create_time")] + public DateTime? CreateTime { get; set; } + } + +} diff --git a/SlnMesnac.Model/domain/WcsAgvStatus.cs b/SlnMesnac.Model/domain/WcsAgvStatus.cs index d92f71d..1421b65 100644 --- a/SlnMesnac.Model/domain/WcsAgvStatus.cs +++ b/SlnMesnac.Model/domain/WcsAgvStatus.cs @@ -93,6 +93,8 @@ namespace SlnMesnac.Model.domain [SugarColumn(ColumnName = "status")] public string Status { get; set; } + + /// /// 是否暂停 0-否 1-是 /// @@ -110,5 +112,11 @@ namespace SlnMesnac.Model.domain /// [SugarColumn(ColumnName = "agvName")] public string AgvName { get; set; } + + + /// + /// 机器人状态说明 + /// + public string StatusDefine { get; set; } } } diff --git a/SlnMesnac.WPF/Page/AgvAndTaskMonitorPage.xaml b/SlnMesnac.WPF/Page/AgvAndTaskMonitorPage.xaml index eefede7..65acc4a 100644 --- a/SlnMesnac.WPF/Page/AgvAndTaskMonitorPage.xaml +++ b/SlnMesnac.WPF/Page/AgvAndTaskMonitorPage.xaml @@ -47,7 +47,8 @@ - + + diff --git a/SlnMesnac.WPF/ViewModel/AgvAndTaskViewModel.cs b/SlnMesnac.WPF/ViewModel/AgvAndTaskViewModel.cs index b447799..58adade 100644 --- a/SlnMesnac.WPF/ViewModel/AgvAndTaskViewModel.cs +++ b/SlnMesnac.WPF/ViewModel/AgvAndTaskViewModel.cs @@ -116,13 +116,25 @@ namespace SlnMesnac.WPF.ViewModel /// private async Task RefreshWcsAgvStatusDataGrid() { - List agvList = await sqlSugarClient.AsTenant().GetConnection("mes").Queryable().ToListAsync(); - await App.Current.Dispatcher.BeginInvoke((Action)(() => + var query = sqlSugarClient.AsTenant().GetConnection("mes").Queryable() + .LeftJoin((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)(() => { WcsAgvStatusDataGrid.Clear(); - foreach (var agv in agvList) + foreach (var agv in query) { - agv.Online = agv.Online=="true"? "在线": "离线"; WcsAgvStatusDataGrid.Add(agv); } }));