diff --git a/BPASmartClient.Academy/App.xaml.cs b/BPASmartClient.Academy/App.xaml.cs index 159b09ba..859c4845 100644 --- a/BPASmartClient.Academy/App.xaml.cs +++ b/BPASmartClient.Academy/App.xaml.cs @@ -35,6 +35,7 @@ namespace BPASmartClient.Academy Forground = System.Windows.Media.Brushes.Red }); }); + AlarmViewModel.AlarmInfos = MessageNotify.GetInstance.alarmLogs; ProgramStarted = new EventWaitHandle(false, EventResetMode.AutoReset, "Academy", out createNew); if (!createNew) { @@ -183,6 +184,13 @@ namespace BPASmartClient.Academy AssemblyName = "BPASmartClient.Academy", ToggleWindowPath = "View.DeviceChartView" }); + DeviceMonitor.Add(new SubMenumodel() + { + SubMenuName = "数据曲线", + SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + AssemblyName = "BPASmartClient.Academy", + ToggleWindowPath = "View.HistoryChartView" + }); MenuManage.GetInstance.menuModels.Add(new MenuModel() { MainMenuIcon = "", diff --git a/BPASmartClient.Academy/BPASmartClient.Academy.csproj b/BPASmartClient.Academy/BPASmartClient.Academy.csproj index dae720d1..5df12eca 100644 --- a/BPASmartClient.Academy/BPASmartClient.Academy.csproj +++ b/BPASmartClient.Academy/BPASmartClient.Academy.csproj @@ -2,7 +2,7 @@ WinExe - net6.0-windows7.0 + net6.0-windows enable enable true diff --git a/BPASmartClient.Academy/Model/DeviceCtrl.cs b/BPASmartClient.Academy/Model/DeviceCtrl.cs index 54d93d38..b94ff57e 100644 --- a/BPASmartClient.Academy/Model/DeviceCtrl.cs +++ b/BPASmartClient.Academy/Model/DeviceCtrl.cs @@ -56,6 +56,14 @@ namespace BPASmartClient.Academy.Model private bool _vx114 = false; public bool VX115 { get { return _vx115; } set { _vx115 = value; OnPropertyChanged(); } } private bool _vx115 = false; - + + public int TempWok { get { return _tempWok; } set { _tempWok = value; OnPropertyChanged(); } } + private int _tempWok; + public int TempMaterial { get { return _tempMaterial; } set { _tempMaterial = value; OnPropertyChanged(); } } + private int _tempMaterial; + public float WeightWok { get { return _weightWok; } set { _weightWok = value; OnPropertyChanged(); } } + private float _weightWok; + public int TempVent { get { return _tempVent; } set { _tempVent = value; OnPropertyChanged(); } } + private int _tempVent; } } diff --git a/BPASmartClient.Academy/Model/SaveData.cs b/BPASmartClient.Academy/Model/SaveData.cs index ad335d1c..8dce3cda 100644 --- a/BPASmartClient.Academy/Model/SaveData.cs +++ b/BPASmartClient.Academy/Model/SaveData.cs @@ -46,7 +46,7 @@ namespace BPASmartClient.Academy.Model ///// //public double PressureWok { get; set; } /// - /// 反应釜重量 + /// 冷却水罐重量 /// public float WeightWok { get; set; } } diff --git a/BPASmartClient.Academy/Model/Simens_PLC.cs b/BPASmartClient.Academy/Model/Simens_PLC.cs index d9eb6fea..634fa154 100644 --- a/BPASmartClient.Academy/Model/Simens_PLC.cs +++ b/BPASmartClient.Academy/Model/Simens_PLC.cs @@ -23,6 +23,7 @@ namespace BPASmartClient.Academy.Model private static Simens_PLC _instance; public static Simens_PLC GetInstance { get; set; } = _instance ??= new Simens_PLC(); private Simens_PLC() { } + public DataFeedback dataFeedback { get; set; } = new DataFeedback(); public string id { get; set; } = ""; //public SiemensHelper siemens { get; set; } = new SiemensHelper(); @@ -107,6 +108,7 @@ namespace BPASmartClient.Academy.Model { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", Simens_PLC.GetInstance.AlarmInfo[o], 2, 1); }); + MessageNotify.GetInstance.ShowAlarmLog(Simens_PLC.GetInstance.AlarmInfo[o]); } }); }); @@ -198,7 +200,22 @@ namespace BPASmartClient.Academy.Model { deviceCtrl.VX115 = o.Content; }); - + siemens.Read("DB1.DBD2022").OnSuccess(o => + { + deviceCtrl.TempWok = o.Content; + }); + siemens.Read("DB1.DBD2026").OnSuccess(o => + { + deviceCtrl.TempMaterial = o.Content; + }); + siemens.Read("DB1.DBD2018").OnSuccess(o => + { + deviceCtrl.WeightWok = o.Content; + }); + siemens.Read("DB1.DBD2030").OnSuccess(o => + { + deviceCtrl.TempVent = o.Content; + }); PipeDetect(); Thread.Sleep(100); } diff --git a/BPASmartClient.Academy/Model/Sqlite.cs b/BPASmartClient.Academy/Model/Sqlite.cs index 7a543d37..88c69012 100644 --- a/BPASmartClient.Academy/Model/Sqlite.cs +++ b/BPASmartClient.Academy/Model/Sqlite.cs @@ -19,7 +19,7 @@ namespace BPASmartClient.Academy.Model get { Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory); - return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AccessFile\\DB\\data.db"); + return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"AccessFile\\DB{DateTime.Now.ToString("yyyy-MM-dd")}\\data.db"); } } public SqlSugarScope Db = new SqlSugarScope(new ConnectionConfig() diff --git a/BPASmartClient.Academy/View/DeviceChartView.xaml b/BPASmartClient.Academy/View/DeviceChartView.xaml index 2ff182c0..b1132bef 100644 --- a/BPASmartClient.Academy/View/DeviceChartView.xaml +++ b/BPASmartClient.Academy/View/DeviceChartView.xaml @@ -297,7 +297,7 @@ Height="2" Margin="20,0,0,2" Fill="Purple" /> - + diff --git a/BPASmartClient.Academy/View/DeviceChartView.xaml.cs b/BPASmartClient.Academy/View/DeviceChartView.xaml.cs index 833601bc..0f1c4c71 100644 --- a/BPASmartClient.Academy/View/DeviceChartView.xaml.cs +++ b/BPASmartClient.Academy/View/DeviceChartView.xaml.cs @@ -141,10 +141,10 @@ namespace BPASmartClient.Academy.View // break; case "重量曲线": plotModel.Series.Clear(); - plotModel = new PlotModel() { Title = "反应釜重量曲线"}; + plotModel = new PlotModel() { Title = "冷却水罐重量曲线" }; chartGrid.Visibility = Visibility.Visible; List ww = new List(); - OxyPlot.Series.LineSeries line_5 = new OxyPlot.Series.LineSeries() { Title = "反应釜重量",Color = OxyColor.FromRgb(0, 0, 0),LineStyle = LineStyle.Solid, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End }; + OxyPlot.Series.LineSeries line_5 = new OxyPlot.Series.LineSeries() { Title = "冷却水罐重量", Color = OxyColor.FromRgb(0, 0, 0),LineStyle = LineStyle.Solid, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End }; Sqlite.GetInstance.SelectId(Simens_PLC.GetInstance.id).ForEach(t => { ww.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.WeightWok)); @@ -154,7 +154,7 @@ namespace BPASmartClient.Academy.View if (!(plotModel.Axes.Count > 0)) { plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max }); - plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "反应釜重量/kg", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2")}); + plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "冷却水罐重量/kg", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2")}); } plotModel.Series.Add(line_5); plotModel.InvalidatePlot(true);//重新加载曲线 diff --git a/BPASmartClient.Academy/View/DeviceMotionView.xaml b/BPASmartClient.Academy/View/DeviceMotionView.xaml index 8fbbbf37..d79fa92e 100644 --- a/BPASmartClient.Academy/View/DeviceMotionView.xaml +++ b/BPASmartClient.Academy/View/DeviceMotionView.xaml @@ -5,10 +5,7 @@ xmlns:bpa="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:BPASmartClient.Academy.View" - xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:oxy="http://oxyplot.org/wpf" - xmlns:vm="clr-namespace:BPASmartClient.Academy.ViewModel" d:DesignHeight="450" d:DesignWidth="800" mc:Ignorable="d"> @@ -95,10 +92,10 @@ + VerticalAlignment="Stretch" + IsHitTestVisible="True" + Opacity="1"> @@ -112,7 +109,7 @@ + MotorColors="{Binding DeviceStatus.M101, Converter={StaticResource deviceConvert}, ConverterParameter=3}" /> - + + Text="进料阀" /> - + + Text="回油阀" /> - + + Text="回水阀" /> - + + Text="汇馏阀" /> - + + Text="蒸馏阀" /> - + + Text="排馏阀" /> - + + Text="冷凝器冷却水阀" /> - + + Text="配料釜蒸汽阀" /> - + + Text="蒸汽阀" /> - + + Text="蒸汽疏水阀" /> - + + Text="冷却水给水阀" /> - + + Text="冷却水排水阀" /> - + + Text="分馏真空阀" /> - + + Text="蒸馏真空阀" /> @@ -781,17 +778,30 @@ Canvas.Left="756" Canvas.Top="311" Width="10" - Height="50" + Height="40" Direction="{Binding PipeLine.PipeH_4.Direction}" Fill="{Binding PipeLine.PipeH_4.Fill, Converter={StaticResource deviceConvert}, ConverterParameter=2}" Speed="4" /> + + + + + @@ -848,6 +858,112 @@ Margin="0,-5,-15,0" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +