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 @@