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 @@ 日志 - +