diff --git a/InSituLaboratory.IService/ISysStatusService.cs b/InSituLaboratory.IService/ISysStatusService.cs index 023eeeb..f15af38 100644 --- a/InSituLaboratory.IService/ISysStatusService.cs +++ b/InSituLaboratory.IService/ISysStatusService.cs @@ -10,6 +10,22 @@ namespace InSituLaboratory.IService { public interface ISysStatusService : IBaseService { + /// + /// 获取主腔体运行状态数据 + /// + /// IEnumerable GetSysStauts(); + + /// + /// 获取当前工作设备的状态数据 + /// + /// + IEnumerable GetCurrentWorkEquipment(); + + /// + /// 获取当前故障设备的状态数据 + /// + /// + IEnumerable GetCurrentFaultyEquipment(); } } diff --git a/InSituLaboratory.Models/CurrentEquipmentModel.cs b/InSituLaboratory.Models/CurrentEquipmentModel.cs new file mode 100644 index 0000000..59153fe --- /dev/null +++ b/InSituLaboratory.Models/CurrentEquipmentModel.cs @@ -0,0 +1,106 @@ +using Prism.Mvvm; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace InSituLaboratory.Models +{ + /// + /// 当前设备----工作/故障 + /// + public class CurrentEquipmentModel : BindableBase + { + /// + /// 采样时间 + /// + private DateTime? _samplingTime; + public DateTime? SamplingTime + { + get { return _samplingTime; } + set { SetProperty(ref _samplingTime, value); } + } + + /// + /// 创建时间 + /// + private DateTime? _createTime; + public DateTime? CreateTime + { + get { return _createTime; } + set { SetProperty(ref _createTime, value); } + } + + /// + /// MEMS色谱仪 + /// + private string? _chromatograph_MEMS; + public string? Chromatograph_MEMS + { + get { return _chromatograph_MEMS; } + set { SetProperty(ref _chromatograph_MEMS, value); } + } + + /// + /// MEMS质谱仪 + /// + private string? _massSpectrometer_MEMS; + public string? MassSpectrometer_MEMS + { + get { return _massSpectrometer_MEMS; } + set { SetProperty(ref _massSpectrometer_MEMS, value); } + } + + /// + /// 色质联用仪 + /// + private string? _colorMassSpectrometer; + public string? ColorMassSpectrometer + { + get { return _colorMassSpectrometer; } + set { SetProperty(ref _colorMassSpectrometer, value); } + } + + /// + /// 甲烷同位素分析仪 + /// + private string? _cH4Analyzer; + public string? CH4Analyzer + { + get { return _cH4Analyzer; } + set { SetProperty(ref _cH4Analyzer, value); } + } + + /// + /// 二氧化碳同位素分析仪 + /// + private string? _cO2Analyzer; + public string? CO2Analyzer + { + get { return _cO2Analyzer; } + set { SetProperty(ref _cO2Analyzer, value); } + } + + /// + /// 颗粒物分析仪 + /// + private string? _particleAnalyzer; + public string? ParticleAnalyzer + { + get { return _particleAnalyzer; } + set { SetProperty(ref _particleAnalyzer, value); } + } + + /// + /// 测序仪 + /// + private string? _sequencer; + public string? Sequencer + { + get { return _sequencer; } + set { SetProperty(ref _sequencer, value); } + } + + } +} diff --git a/InSituLaboratory.Service/SysStatusService.cs b/InSituLaboratory.Service/SysStatusService.cs index 1b1591a..db15fad 100644 --- a/InSituLaboratory.Service/SysStatusService.cs +++ b/InSituLaboratory.Service/SysStatusService.cs @@ -15,13 +15,33 @@ namespace InSituLaboratory.Service public SysStatusService(DbContext context) : base(context) { } - + /// + /// 获取主腔体状态数据 + /// + /// public IEnumerable GetSysStauts() { return this.Set().OrderByDescending(n => n.CreateTime); - } - + /// + /// 获取当前工作设备数据 + /// + /// + public IEnumerable GetCurrentWorkEquipment() + { + return this.Set().OrderByDescending(n => n.CreateTime); + } + + /// + /// 获取当前故障设备数据 + /// + /// + public IEnumerable GetCurrentFaultyEquipment() + { + return this.Set().OrderByDescending(n => n.CreateTime); + } + + } } diff --git a/InSituLaboratory/ViewModels/Pages/DashboardViewModel.cs b/InSituLaboratory/ViewModels/Pages/DashboardViewModel.cs index 804095a..a0de99a 100644 --- a/InSituLaboratory/ViewModels/Pages/DashboardViewModel.cs +++ b/InSituLaboratory/ViewModels/Pages/DashboardViewModel.cs @@ -11,6 +11,7 @@ using InSituLaboratory.Models; using InSituLaboratory.Entities.ExperimentalStationEntities; using Prism.Regions; using InSituLaboratory.IService; +using Prism.Commands; namespace InSituLaboratory.ViewModels.Pages { @@ -19,6 +20,10 @@ namespace InSituLaboratory.ViewModels.Pages #region 实体类 public SysStatusModel SysStatusModel { get; set; } = new SysStatusModel(); + public CurrentEquipmentModel CurrentWorkEquipment { get; set; } = new CurrentEquipmentModel();//当前工作设备 + public CurrentEquipmentModel currentFaultyEquipment { get; set; } = new CurrentEquipmentModel();//当前故障设备 + + #endregion ISysStatusService _sysStatusService; @@ -34,15 +39,51 @@ namespace InSituLaboratory.ViewModels.Pages public override void Refresh() { var sysStatuslist = _sysStatusService.GetSysStauts().ToList(); + var CurrentWorklist = _sysStatusService.GetCurrentWorkEquipment().ToList(); + var currentFaultylist = _sysStatusService.GetCurrentFaultyEquipment().ToList(); if (sysStatuslist.Count() != 0) { var data = _sysStatusService.GetSysStauts().First(); - SysStatusModel.PackagingTime = data.PackagingTime; SysStatusModel.SamplingTime = data.SamplingTime; SysStatusModel.Voltage48 = data.Voltage48; SysStatusModel.Current48 = data.Current48; SysStatusModel.BaseStation48VLeakageCS = data.BaseStation48VLeakageCS; + SysStatusModel.Batterz48VLeakageCS = data.Batterz48VLeakageCS; + SysStatusModel.ICLLeakageCS = data.ICLLeakageCS; + SysStatusModel.IComputerLeakageCS = data.IComputerLeakageCS; + SysStatusModel.TemperatureStaus1 = data.TemperatureStaus1; + SysStatusModel.TemperatureStaus2 = data.TemperatureStaus2; + SysStatusModel.HumidityStaus1 = data.HumidityStaus1; + SysStatusModel.HumidityStaus2 = data.HumidityStaus2; + SysStatusModel.LeakageStaus1 = data.LeakageStaus1; + SysStatusModel.LeakageStaus2 = data.LeakageStaus2; + SysStatusModel.InternalPressure1 = data.InternalPressure1; + SysStatusModel.InternalPressure2 = data.InternalPressure2; + } + + if (CurrentWorklist.Count() != 0) + { + var data = _sysStatusService.GetCurrentWorkEquipment().First(); + CurrentWorkEquipment.Chromatograph_MEMS = data.Chromatograph_MEMS; + CurrentWorkEquipment.MassSpectrometer_MEMS = data.MassSpectrometer_MEMS; + CurrentWorkEquipment.ColorMassSpectrometer = data.ColorMassSpectrometer; + CurrentWorkEquipment.CH4Analyzer = data.CH4Analyzer; + CurrentWorkEquipment.CO2Analyzer = data.CO2Analyzer; + CurrentWorkEquipment.ParticleAnalyzer = data.ParticleAnalyzer; + CurrentWorkEquipment.Sequencer = data.Sequencer; + } + + if (currentFaultylist.Count() != 0) + { + var data = _sysStatusService.GetCurrentFaultyEquipment().First(); + currentFaultyEquipment.Chromatograph_MEMS = data.Chromatograph_MEMS; + currentFaultyEquipment.MassSpectrometer_MEMS = data.MassSpectrometer_MEMS; + currentFaultyEquipment.ColorMassSpectrometer = data.ColorMassSpectrometer; + currentFaultyEquipment.CH4Analyzer = data.CH4Analyzer; + currentFaultyEquipment.CO2Analyzer = data.CO2Analyzer; + currentFaultyEquipment.ParticleAnalyzer = data.ParticleAnalyzer; + currentFaultyEquipment.Sequencer = data.Sequencer; } } } diff --git a/InSituLaboratory/Views/Pages/DashboardView.xaml b/InSituLaboratory/Views/Pages/DashboardView.xaml index 24ce84e..827f237 100644 --- a/InSituLaboratory/Views/Pages/DashboardView.xaml +++ b/InSituLaboratory/Views/Pages/DashboardView.xaml @@ -141,6 +141,9 @@ + + +