2024-03-11 05:12:02 +00:00
|
|
|
|
using LiveCharts.Defaults;
|
|
|
|
|
|
using LiveCharts.Wpf;
|
|
|
|
|
|
using LiveCharts;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
2024-03-30 00:17:37 +00:00
|
|
|
|
using InSituLaboratory.Models;
|
2024-04-18 09:47:36 +00:00
|
|
|
|
using InSituLaboratory.Entities.ExperimentalStationEntities;
|
2024-04-22 10:19:09 +00:00
|
|
|
|
using Prism.Regions;
|
|
|
|
|
|
using InSituLaboratory.IService;
|
2024-04-26 10:14:28 +00:00
|
|
|
|
using Prism.Commands;
|
2024-03-11 05:12:02 +00:00
|
|
|
|
|
|
|
|
|
|
namespace InSituLaboratory.ViewModels.Pages
|
|
|
|
|
|
{
|
|
|
|
|
|
public class DashboardViewModel : ViewModelBase
|
|
|
|
|
|
{
|
2024-04-22 10:19:09 +00:00
|
|
|
|
#region 实体类
|
2024-04-24 09:58:55 +00:00
|
|
|
|
public SysStatusModel SysStatusModel { get; set; } = new SysStatusModel();
|
2024-04-22 10:19:09 +00:00
|
|
|
|
|
2024-04-26 10:14:28 +00:00
|
|
|
|
public CurrentEquipmentModel CurrentWorkEquipment { get; set; } = new CurrentEquipmentModel();//当前工作设备
|
|
|
|
|
|
public CurrentEquipmentModel currentFaultyEquipment { get; set; } = new CurrentEquipmentModel();//当前故障设备
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-22 10:19:09 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
ISysStatusService _sysStatusService;
|
|
|
|
|
|
public DashboardViewModel(IRegionManager regionManager, ISysStatusService isysStatusService) : base(regionManager)
|
2024-03-11 05:12:02 +00:00
|
|
|
|
{
|
|
|
|
|
|
PageTitle = "数据中心";
|
|
|
|
|
|
IsCanClose = false;
|
2024-04-22 10:19:09 +00:00
|
|
|
|
_sysStatusService = isysStatusService;
|
|
|
|
|
|
|
|
|
|
|
|
this.Refresh();
|
|
|
|
|
|
}
|
2024-03-30 00:17:37 +00:00
|
|
|
|
|
2024-04-22 10:19:09 +00:00
|
|
|
|
public override void Refresh()
|
|
|
|
|
|
{
|
|
|
|
|
|
var sysStatuslist = _sysStatusService.GetSysStauts().ToList();
|
2024-04-26 10:14:28 +00:00
|
|
|
|
var CurrentWorklist = _sysStatusService.GetCurrentWorkEquipment().ToList();
|
|
|
|
|
|
var currentFaultylist = _sysStatusService.GetCurrentFaultyEquipment().ToList();
|
2024-04-22 10:19:09 +00:00
|
|
|
|
if (sysStatuslist.Count() != 0)
|
|
|
|
|
|
{
|
2024-04-28 01:27:21 +00:00
|
|
|
|
var data = _sysStatusService.GetSysStauts().FirstOrDefault();
|
2024-04-24 09:58:55 +00:00
|
|
|
|
SysStatusModel.PackagingTime = data.PackagingTime;
|
|
|
|
|
|
SysStatusModel.SamplingTime = data.SamplingTime;
|
|
|
|
|
|
SysStatusModel.Voltage48 = data.Voltage48;
|
|
|
|
|
|
SysStatusModel.Current48 = data.Current48;
|
|
|
|
|
|
SysStatusModel.BaseStation48VLeakageCS = data.BaseStation48VLeakageCS;
|
2024-04-26 10:14:28 +00:00
|
|
|
|
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;
|
2024-04-22 10:19:09 +00:00
|
|
|
|
}
|
2024-03-11 05:12:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|