From 7f35077c07959e9571515ee1a1f88123f9e20bd5 Mon Sep 17 00:00:00 2001 From: hehaibing-1996 Date: Tue, 11 Jun 2024 22:25:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=AB=AF=EF=BC=9A=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=87=AA=E6=A3=80=E5=92=8C=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E8=87=AA=E6=A3=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WCS.WebApi/Controllers/HomeController.cs | 5 --- 货架标准上位机/ViewModels/HomeViewModel.cs | 45 +++++++++++++++++++++- 货架标准上位机/Views/HomeView.xaml | 2 +- 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/WCS.WebApi/Controllers/HomeController.cs b/WCS.WebApi/Controllers/HomeController.cs index aaea3b9..89137e0 100644 --- a/WCS.WebApi/Controllers/HomeController.cs +++ b/WCS.WebApi/Controllers/HomeController.cs @@ -104,11 +104,6 @@ namespace WCS.WebApi.Controllers { try { - //var shelfs = ShelfManager.Shelves - // .WhereIF(request.GroupNames?.Count > 0, t => request.GroupNames!.Contains(t.GroupName)) - // .Select(t => t.ShelfCode) - // .ToList(); - //直接返回当前内存中缓存的货架和状态 return await _selfCheckService.StartSelfCheckByGroupName(request.GroupNames); } catch (Exception ex) diff --git a/货架标准上位机/ViewModels/HomeViewModel.cs b/货架标准上位机/ViewModels/HomeViewModel.cs index 366898b..bf92eef 100644 --- a/货架标准上位机/ViewModels/HomeViewModel.cs +++ b/货架标准上位机/ViewModels/HomeViewModel.cs @@ -16,6 +16,7 @@ using 货架标准上位机.Api; using WCS.Model; using System.Diagnostics; using System.Security.Cryptography; +using WCS.Model.ApiModel.Home; namespace 货架标准上位机.ViewModel { @@ -38,6 +39,10 @@ namespace 货架标准上位机.ViewModel Thread.Sleep(2000); } }); + + #region 启动自检 + SelfCheck(); + #endregion } #region 绑定 @@ -63,7 +68,6 @@ namespace 货架标准上位机.ViewModel WarnInfo.RemoveAll(WarnInfoType.AlwayWarn); } - public ICommand AddUserControlCommand { get => new DelegateCommand(RefreshUserControl); } public WrapPanel wrapPanel; public async void RefreshUserControl() { @@ -72,7 +76,7 @@ namespace 货架标准上位机.ViewModel { var body = new GetShelfStatusRequest() { - UserName = "xxx", + UserName = LocalStatic.CurrentUser, DeviceType = "WCS前端", GroupNames = LocalFile.Config.GroupName, }; @@ -100,6 +104,43 @@ namespace 货架标准上位机.ViewModel } } + + public ICommand SelfCheckCommand { get => new DelegateCommand(SelfCheck); } + public void SelfCheck() + { + #region 调用接口请求后台进行自检 + lock (this) + { + try + { + var body = new GetShelfStatusRequest() + { + UserName = LocalStatic.CurrentUser, + DeviceType = "WCS前端", + GroupNames = LocalFile.Config.GroupName, + }; + var Result = ApiHelp.GetDataFromHttp(LocalFile.Config.ApiIpHost + "home/shelfCheckAll", body, "POST",true); + if (Result != null && Result.Code == 200) + { + + } + else + { + + } + Thread.Sleep(20); + } + catch (Exception ex) + { + + } + finally + { + + } + } + #endregion + } #endregion #region 页面加载时任务 diff --git a/货架标准上位机/Views/HomeView.xaml b/货架标准上位机/Views/HomeView.xaml index 0486d6f..c12de53 100644 --- a/货架标准上位机/Views/HomeView.xaml +++ b/货架标准上位机/Views/HomeView.xaml @@ -48,7 +48,7 @@ 日志 - +