增加报警

This commit is contained in:
2025-01-01 17:41:48 +08:00
parent f26bf28181
commit 7b5df5877d
16 changed files with 896 additions and 122 deletions

View File

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