From 51251bbe030c5813c6d225d723b2d1807835f830 Mon Sep 17 00:00:00 2001 From: liuwf Date: Tue, 23 Jul 2024 21:01:12 +0800 Subject: [PATCH] =?UTF-8?q?add-=E5=88=86=E5=9E=9B=E5=BA=93=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E3=80=81=E6=B5=8B=E6=B8=A9=E9=87=87=E9=9B=86=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E6=B7=BB=E5=8A=A0=E4=BA=8B=E5=8A=A1=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Business/InstoreBusiness.cs | 17 ++++- .../ViewModels/MainWindowViewModel.cs | 66 ++++++++++++++++++- Aucma.Core.Palletiz/Views/IndexPageView.xaml | 4 +- Aucma.Core.Palletiz/Views/MainWindow.xaml | 7 ++ .../Business/InstoreBusiness.cs | 10 ++- .../ViewModels/IndexPageViewModel.cs | 44 +++++++++++++ .../Views/IndexPageView.xaml | 16 +++-- .../AucamTemperatureMeasurementService.cs | 23 +++++-- 8 files changed, 169 insertions(+), 18 deletions(-) diff --git a/Aucma.Core.Palletiz/Business/InstoreBusiness.cs b/Aucma.Core.Palletiz/Business/InstoreBusiness.cs index 68ade063..084a82c1 100644 --- a/Aucma.Core.Palletiz/Business/InstoreBusiness.cs +++ b/Aucma.Core.Palletiz/Business/InstoreBusiness.cs @@ -423,7 +423,7 @@ namespace Aucma.Core.Palletiz.Business RefreshMsgEvent?.Invoke(msg); return; } - msg = $"成品码:{asciiStr},仓库区域:{spaceinfo.SpaceArea},匹配货道:{spaceinfo.SpaceCode};旋转:{(spinFlag == 3 ? "0°" : "180°")};下发plc放行信号"; + msg = $"成品码:{asciiStr},仓库区域:{spaceinfo.SpaceArea},匹配货道:{spaceinfo.SpaceCode};旋转:{IntToRange(spinFlag)}度;下发plc放行信号"; RefreshMsgEvent?.Invoke(msg); DateTime startTime = DateTime.Now; while (isFlag) @@ -532,6 +532,21 @@ namespace Aucma.Core.Palletiz.Business return result; } + + public int IntToRange(int range) + { + + int result = 0; + switch (range) + { + case 3: result = 0; break; + case 1: result = 90; break; + case 4: result = 180; break; + case 2: result = 270; break; + } + + return result; + } /// /// 提取货道号 /// diff --git a/Aucma.Core.Palletiz/ViewModels/MainWindowViewModel.cs b/Aucma.Core.Palletiz/ViewModels/MainWindowViewModel.cs index 92e6d4d9..84a0b42d 100644 --- a/Aucma.Core.Palletiz/ViewModels/MainWindowViewModel.cs +++ b/Aucma.Core.Palletiz/ViewModels/MainWindowViewModel.cs @@ -123,6 +123,7 @@ namespace Aucma.Core.Palletiz.ViewModels string ip1 = Appsettings.app("Middleware", "Scanner1", "Ip"); bool flag1 = true;// MvCodeHelper.ConnectionStatus(ip1); Scanner1State(flag1); + Scanner2State(flag1); } #endregion @@ -419,13 +420,13 @@ namespace Aucma.Core.Palletiz.ViewModels { if (type) { - Scanner1UIStatusWb = "扫码器1连接成功"; + Scanner1UIStatusWb = "A区域扫码器"; Scanner1UIColor = "Green"; Scanner1UIIcon = "Assets/Images/Green.png"; } else { - Scanner1UIStatusWb = "扫码器1状态异常"; + Scanner1UIStatusWb = "A区域扫码器"; Scanner1UIColor = "Red"; Scanner1UIIcon = "Assets/Images/Red.png"; } @@ -433,6 +434,67 @@ namespace Aucma.Core.Palletiz.ViewModels } #endregion + + #region 扫码器2状态 + /// + /// UI 展示状态-文字 + /// + public string _scanner2UIStatusWb; + public string Scanner2UIStatusWb + { + //get { return plcUIStatusWb; } + //set { plcUIStatusWb = value; RaisePropertyChanged("PlcUIStatusWb"); } + get => _scanner2UIStatusWb; + set => SetProperty(ref _scanner2UIStatusWb, value); + } + /// + /// UI 展示状态-颜色 + /// + public string _scanner2UIColor; + public string Scanner2UIColor + { + //get { return plcUIColor; } + //set { plcUIColor = value; RaisePropertyChanged("PlcUIColor"); } + get => _scanner2UIColor; + set => SetProperty(ref _scanner2UIColor, value); + } + /// + /// UI 展示状态-图标 + /// + public string _scanner2UIIcon; + public string Scanner2UIIcon + { + //get { return plcUIIcon; } + //set { plcUIIcon = value; RaisePropertyChanged("plcUIIcon"); } + get => _scanner2UIIcon; + set => SetProperty(ref _scanner2UIIcon, value); + } + + /// + /// 扫码器1连接状态-true:连接成功;false:失败 + /// + /// + public void Scanner2State(bool type) + { + Application.Current.Dispatcher.Invoke(() => + { + if (type) + { + Scanner1UIStatusWb = "B区域扫码器"; + Scanner1UIColor = "Green"; + Scanner1UIIcon = "Assets/Images/Green.png"; + } + else + { + Scanner1UIStatusWb = "B区域扫码器"; + Scanner1UIColor = "Red"; + Scanner1UIIcon = "Assets/Images/Red.png"; + } + }); + } + #endregion + + #region 刷新时间 public string _currentDateTime; diff --git a/Aucma.Core.Palletiz/Views/IndexPageView.xaml b/Aucma.Core.Palletiz/Views/IndexPageView.xaml index 7375d4e5..f0bb92ea 100644 --- a/Aucma.Core.Palletiz/Views/IndexPageView.xaml +++ b/Aucma.Core.Palletiz/Views/IndexPageView.xaml @@ -261,7 +261,7 @@