增加报警
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using AutoMapper;
|
||||
using CapMachine.Core;
|
||||
using CapMachine.Model;
|
||||
using CapMachine.Model.Alarm;
|
||||
using CapMachine.Wpf.Dtos;
|
||||
using CapMachine.Wpf.Models;
|
||||
using CapMachine.Wpf.Services;
|
||||
@@ -40,13 +41,13 @@ namespace CapMachine.Wpf.ViewModels
|
||||
|
||||
CategoryComboBoxList = new List<ComboBoxModel>()
|
||||
{
|
||||
new ComboBoxModel(){Key="0",Text="系统" },
|
||||
new ComboBoxModel(){Key="0",Text="系统日志" },
|
||||
new ComboBoxModel(){Key="1",Text="程序步骤" },
|
||||
new ComboBoxModel(){Key="2",Text="报警" },
|
||||
new ComboBoxModel(){Key="2",Text="历史报警" },
|
||||
};
|
||||
}
|
||||
|
||||
private string CurrentName = "埋塞敲入螺旋钉安装";
|
||||
private string CurrentName = "";
|
||||
|
||||
private string CurrentTemplate = "BurPlugInstallTemplate.xlsx";
|
||||
|
||||
@@ -89,14 +90,14 @@ namespace CapMachine.Wpf.ViewModels
|
||||
/// <summary>
|
||||
/// 列表集合
|
||||
/// </summary>
|
||||
private ObservableCollection<ActionLogDto> _ListModelDto=new ObservableCollection<ActionLogDto>();
|
||||
private ObservableCollection<object> _ListModelDto = new ObservableCollection<object>();
|
||||
/// <summary>
|
||||
/// 列表集合
|
||||
/// </summary>
|
||||
public ObservableCollection<ActionLogDto> ListModelDto
|
||||
public ObservableCollection<object> ListModelDto
|
||||
{
|
||||
get { return _ListModelDto; }
|
||||
set { _ListModelDto = value; }
|
||||
set { _ListModelDto = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
#region 搜索条件属性
|
||||
@@ -201,32 +202,47 @@ namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
try
|
||||
{
|
||||
var MulConQueryable = FreeSql.Select<ActionLog>();
|
||||
|
||||
//多条件查询
|
||||
if (!string.IsNullOrEmpty(SearchCategory))
|
||||
switch (SearchCategory)
|
||||
{
|
||||
MulConQueryable = MulConQueryable.Where(t => t.Category == SearchCategory);
|
||||
}
|
||||
//多条件查询
|
||||
if (!string.IsNullOrEmpty(SearchStartDate))
|
||||
{
|
||||
MulConQueryable = MulConQueryable.Where(t => t.CreateTime.Date >= Convert.ToDateTime(SearchStartDate));
|
||||
}
|
||||
//多条件查询
|
||||
if (!string.IsNullOrEmpty(SearchEndDate))
|
||||
{
|
||||
MulConQueryable = MulConQueryable.Where(t => t.CreateTime.Date < Convert.ToDateTime(SearchEndDate).AddDays(1));
|
||||
}
|
||||
var ListDpI = MulConQueryable.OrderByDescending(a => a.CreateTime).ToList();//.Where(a => a.CreateTime >= DateTime.Now);
|
||||
ListModelDto.Clear();
|
||||
case "历史报警":
|
||||
var MulConHistoryAlarmQueryable = FreeSql.Select<HistoryAlarm>();
|
||||
|
||||
//多条件查询
|
||||
if (!string.IsNullOrEmpty(SearchStartDate))
|
||||
{
|
||||
MulConHistoryAlarmQueryable = MulConHistoryAlarmQueryable.Where(t => t.CreateTime.Date >= Convert.ToDateTime(SearchStartDate));
|
||||
}
|
||||
//多条件查询
|
||||
if (!string.IsNullOrEmpty(SearchEndDate))
|
||||
{
|
||||
MulConHistoryAlarmQueryable = MulConHistoryAlarmQueryable.Where(t => t.CreateTime.Date < Convert.ToDateTime(SearchEndDate).AddDays(1));
|
||||
}
|
||||
var ListHistoryAlarmDpI = MulConHistoryAlarmQueryable.OrderByDescending(a => a.CreateTime).ToList();//.Where(a => a.CreateTime >= DateTime.Now);
|
||||
|
||||
foreach (var item in ListDpI)
|
||||
{
|
||||
ListModelDto.Add(Mapper.Map<ActionLogDto>(item));
|
||||
ListModelDto = new ObservableCollection<object>(Mapper.Map<List<HistoryAlarmDto>>(ListHistoryAlarmDpI));
|
||||
break;
|
||||
case "系统日志":
|
||||
//ActionLog
|
||||
var MulConActionLogQueryable = FreeSql.Select<ActionLog>();
|
||||
|
||||
//多条件查询
|
||||
if (!string.IsNullOrEmpty(SearchStartDate))
|
||||
{
|
||||
MulConActionLogQueryable = MulConActionLogQueryable.Where(t => t.CreateTime.Date >= Convert.ToDateTime(SearchStartDate));
|
||||
}
|
||||
//多条件查询
|
||||
if (!string.IsNullOrEmpty(SearchEndDate))
|
||||
{
|
||||
MulConActionLogQueryable = MulConActionLogQueryable.Where(t => t.CreateTime.Date < Convert.ToDateTime(SearchEndDate).AddDays(1));
|
||||
}
|
||||
var ListActionLogDpI = MulConActionLogQueryable.OrderByDescending(a => a.CreateTime).ToList();//.Where(a => a.CreateTime >= DateTime.Now);
|
||||
ListModelDto = new ObservableCollection<object>(Mapper.Map<List<ActionLogDto>>(ListActionLogDpI));
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
/// <param name="machineRtDataService"></param>
|
||||
/// <param name="dialogService"></param>
|
||||
public MonitorViewModel(ConfigService configService, IEventAggregator eventAggregator,
|
||||
DataRecordService dataRecordService, SysRunService sysRunService,
|
||||
DataRecordService dataRecordService, SysRunService sysRunService, AlarmService alarmService,
|
||||
MachineRtDataService machineRtDataService, IDialogService dialogService)
|
||||
{
|
||||
ConfigService = configService;
|
||||
@@ -34,6 +34,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
_EventAggregator = eventAggregator;
|
||||
DataRecordService = dataRecordService;
|
||||
SysRunServer = sysRunService;
|
||||
AlarmService = alarmService;
|
||||
MachineRtDataService = machineRtDataService;
|
||||
DialogService = dialogService;
|
||||
TagManager = MachineRtDataService.TagManger;
|
||||
@@ -85,6 +86,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
private IEventAggregator _EventAggregator { get; set; }
|
||||
public DataRecordService DataRecordService { get; }
|
||||
public SysRunService SysRunServer { get; }
|
||||
public AlarmService AlarmService { get; }
|
||||
public MachineRtDataService MachineRtDataService { get; }
|
||||
public IDialogService DialogService { get; }
|
||||
public List<ChartRtValue> ListChartRtValue { get; set; } = new List<ChartRtValue>()
|
||||
|
||||
Reference in New Issue
Block a user