增加报警
This commit is contained in:
75
CapMachine.Model/Alarm/AlarmConfig.cs
Normal file
75
CapMachine.Model/Alarm/AlarmConfig.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using System;
|
||||
|
||||
namespace CapMachine.Model.Alarm
|
||||
{
|
||||
/// <summary>
|
||||
/// 报警配置信息
|
||||
/// </summary>
|
||||
[Table(Name = "AlarmConfig")]
|
||||
public class AlarmConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[Column(IsPrimary = true, IsIdentity = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 报警配置类别
|
||||
/// </summary>
|
||||
[Column(Name = "Category", IsNullable = false, StringLength = 20)]
|
||||
public string? Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 报警的地址
|
||||
/// </summary>
|
||||
[Column(Name = "Address", IsNullable = false, StringLength = 20)]
|
||||
public string? Address { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 报警等级
|
||||
/// </summary>
|
||||
[Column(Name = "AlarmLevel", IsNullable = false)]
|
||||
public AlarmLevel AlarmLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 激活类型
|
||||
/// </summary>
|
||||
[Column(Name = "ActiveType", IsNullable = false)]
|
||||
public ActiveType ActiveType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 报警配置名称
|
||||
/// </summary>
|
||||
[Column(Name = "Name", IsNullable = false, StringLength = 50)]
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 报警消息
|
||||
/// </summary>
|
||||
[Column(Name = "Message", IsNullable = false, StringLength = 150)]
|
||||
public string? Message { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 布尔激活的阀值
|
||||
/// </summary>
|
||||
[Column(Name = "BoolActiveValue", IsNullable = false)]
|
||||
public bool BoolActiveValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 报警上限阀值
|
||||
/// </summary>
|
||||
[Column(Name = "ThresholdUp", DbType = "decimal(8, 3)", IsNullable = true)]
|
||||
public decimal ThresholdUp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 报警下限阀值
|
||||
/// </summary>
|
||||
[Column(Name = "ThresholdDown", DbType = "decimal(8, 3)", IsNullable = true)]
|
||||
public decimal ThresholdDown { get; set; }
|
||||
|
||||
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
|
||||
public DateTime CreateTime { get; set; }
|
||||
}
|
||||
}
|
||||
45
CapMachine.Model/Alarm/AlarmLevel.cs
Normal file
45
CapMachine.Model/Alarm/AlarmLevel.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Model.Alarm
|
||||
{
|
||||
/// <summary>
|
||||
/// 报警等级
|
||||
/// </summary>
|
||||
public enum AlarmLevel
|
||||
{
|
||||
/// <summary>
|
||||
/// 一级
|
||||
/// </summary>
|
||||
Level1=1,
|
||||
|
||||
/// <summary>
|
||||
/// 二级
|
||||
/// </summary>
|
||||
Level2 = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 三级
|
||||
/// </summary>
|
||||
Level3 = 3,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 报警激活类型
|
||||
/// </summary>
|
||||
public enum ActiveType
|
||||
{
|
||||
/// <summary>
|
||||
/// 阀值
|
||||
/// </summary>
|
||||
Threshold = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 布尔类型
|
||||
/// </summary>
|
||||
Bool = 2,
|
||||
}
|
||||
}
|
||||
59
CapMachine.Model/Alarm/HistoryAlarm.cs
Normal file
59
CapMachine.Model/Alarm/HistoryAlarm.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using System;
|
||||
|
||||
namespace CapMachine.Model.Alarm
|
||||
{
|
||||
/// <summary>
|
||||
/// PLC报警 HistoryAlarm
|
||||
/// </summary>
|
||||
[Table(Name = "HistoryAlarm")]
|
||||
public class HistoryAlarm
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[Column(IsPrimary = true, IsIdentity = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 报警消息分类
|
||||
/// </summary>
|
||||
[Column(Name = "Category", IsNullable = false, StringLength = 20)]
|
||||
public string? Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 报警等级
|
||||
/// </summary>
|
||||
[Column(Name = "AlarmLevel", IsNullable = false)]
|
||||
public AlarmLevel AlarmLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 报警名称
|
||||
/// </summary>
|
||||
[Column(Name = "Name", IsNullable = false, StringLength = 50)]
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 报警消息
|
||||
/// </summary>
|
||||
[Column(Name = "Message", IsNullable = false, StringLength = 150)]
|
||||
public string? Message { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 报警时长
|
||||
/// 秒
|
||||
/// </summary>
|
||||
[Column(Name = "Duration")]
|
||||
public long Duration { get; set; }
|
||||
|
||||
[Column(Name = "CreateTime")]
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ///////////////////////////////////////////导航属性///////////////////////////////////////////////////////
|
||||
/// </summary>
|
||||
|
||||
//public Guid? AlarmAddressId { get; set; }
|
||||
//public AlarmAddress AlarmAddress { get; set; }
|
||||
}
|
||||
}
|
||||
105
CapMachine.Wpf/Alarm/AlarmRunCell.cs
Normal file
105
CapMachine.Wpf/Alarm/AlarmRunCell.cs
Normal file
@@ -0,0 +1,105 @@
|
||||
using CapMachine.Model.Alarm;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Alarm
|
||||
{
|
||||
/// <summary>
|
||||
/// 报警运行单元
|
||||
/// </summary>
|
||||
public class AlarmRunCell : BindableBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 实例化函数
|
||||
/// </summary>
|
||||
public AlarmRunCell(IFreeSql freeSql)
|
||||
{
|
||||
CurAlarmConfig = new AlarmConfig();
|
||||
FreeSql = freeSql;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新报警对应的值
|
||||
/// </summary>
|
||||
public void UpdateBoolValue(bool Value)
|
||||
{
|
||||
if (CurAlarmConfig.ActiveType == ActiveType.Bool)
|
||||
{
|
||||
if (CurAlarmConfig.BoolActiveValue == Value)
|
||||
{
|
||||
ActiveState = true;
|
||||
ActiveTime = DateTime.Now;
|
||||
}
|
||||
else
|
||||
{
|
||||
ActiveState = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 布尔类型的变量 序号
|
||||
/// </summary>
|
||||
public long Index { get; set; }
|
||||
|
||||
private bool _ActiveState = false;
|
||||
/// <summary>
|
||||
/// 报警激活状态
|
||||
/// </summary>
|
||||
public bool ActiveState
|
||||
{
|
||||
get { return _ActiveState; }
|
||||
set
|
||||
{
|
||||
if (_ActiveState != value)
|
||||
{
|
||||
_ActiveState = value;
|
||||
RaisePropertyChanged();
|
||||
|
||||
//报警结束时保存报警
|
||||
if (ActiveState==false)
|
||||
{
|
||||
SaveAlarm();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存报警
|
||||
/// </summary>
|
||||
private void SaveAlarm()
|
||||
{
|
||||
FreeSql.Insert<HistoryAlarm>(new HistoryAlarm()
|
||||
{
|
||||
AlarmLevel = CurAlarmConfig.AlarmLevel,
|
||||
Category = CurAlarmConfig.Category,
|
||||
Message = CurAlarmConfig.Message,
|
||||
Name = CurAlarmConfig.Name,
|
||||
Duration = (long)(DateTime.Now - ActiveTime).TotalSeconds,
|
||||
CreateTime = ActiveTime,
|
||||
}).ExecuteAffrows();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 报警时长
|
||||
/// </summary>
|
||||
public int TimeDuration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 激活时间
|
||||
/// </summary>
|
||||
public DateTime ActiveTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前的报警配置
|
||||
/// </summary>
|
||||
public AlarmConfig CurAlarmConfig { get; set; }
|
||||
public IFreeSql FreeSql { get; }
|
||||
}
|
||||
}
|
||||
@@ -92,6 +92,7 @@ namespace CapMachine.Wpf
|
||||
containerRegistry.RegisterSingleton<SysRunService>();
|
||||
containerRegistry.RegisterSingleton<ConfigService>();
|
||||
|
||||
containerRegistry.RegisterSingleton<AlarmService>();
|
||||
////注册设备服务
|
||||
//containerRegistry.RegisterSingleton<MachineDataService>();
|
||||
containerRegistry.RegisterSingleton<MachineRtDataService>();
|
||||
@@ -99,6 +100,7 @@ namespace CapMachine.Wpf
|
||||
containerRegistry.RegisterSingleton<CanDriveService>();
|
||||
containerRegistry.RegisterSingleton<HighSpeedDataService>();
|
||||
containerRegistry.RegisterSingleton<PPCService>();
|
||||
|
||||
|
||||
//注册AutoMapper 将IAutoMapperProvider注入IOC容器,并对外提供IMapper注入类型。
|
||||
containerRegistry.RegisterSingleton<IMapperProvider, MapperConfig>();
|
||||
@@ -220,6 +222,7 @@ namespace CapMachine.Wpf
|
||||
var appVersionService = ContainerLocator.Container.Resolve<IFreeSql>();
|
||||
//var appVersionService1 = ContainerLocator.Container.Resolve<MachineDataService>();
|
||||
//var appVersionService2 = ContainerLocator.Container.Resolve<ILogService>();
|
||||
var appVersionService12 = ContainerLocator.Container.Resolve<AlarmService>();
|
||||
var appVersionService3 = ContainerLocator.Container.Resolve<MachineRtDataService>();
|
||||
var appVersionService4 = ContainerLocator.Container.Resolve<ProStepConfigPsView>();
|
||||
var appVersionService5 = ContainerLocator.Container.Resolve<ProConfigView>();
|
||||
@@ -229,6 +232,7 @@ namespace CapMachine.Wpf
|
||||
var appVersionService9 = ContainerLocator.Container.Resolve<DataRecordService>();
|
||||
var appVersionService10 = ContainerLocator.Container.Resolve<HighSpeedDataService>();
|
||||
var appVersionService11 = ContainerLocator.Container.Resolve<PPCService>();
|
||||
|
||||
|
||||
|
||||
//给当前的全局异常捕捉服务使用
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -15,21 +16,25 @@ namespace CapMachine.Wpf.Dtos
|
||||
/// <summary>
|
||||
/// 等级
|
||||
/// </summary>
|
||||
[Description("等级")]
|
||||
public int Level { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分类
|
||||
/// </summary>
|
||||
[Description("分类")]
|
||||
public string? Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 内容
|
||||
/// </summary>
|
||||
[Description("内容")]
|
||||
public string? Content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
[Description("创建时间")]
|
||||
public DateTime CreateTime { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
57
CapMachine.Wpf/Dtos/AlarmRtDto.cs
Normal file
57
CapMachine.Wpf/Dtos/AlarmRtDto.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using CapMachine.Model.Alarm;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// 报警实时模型
|
||||
/// </summary>
|
||||
public class AlarmRtDto:BindableBase
|
||||
{
|
||||
private string? _Name;
|
||||
/// <summary>
|
||||
/// 报警名称
|
||||
/// </summary>
|
||||
public string? Name
|
||||
{
|
||||
get { return _Name; }
|
||||
set { _Name = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private string? _Message;
|
||||
/// <summary>
|
||||
/// 报警消息
|
||||
/// </summary>
|
||||
public string? Message
|
||||
{
|
||||
get { return _Message; }
|
||||
set { _Message = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private string? _Category;
|
||||
/// <summary>
|
||||
/// 报警消息分类
|
||||
/// </summary>
|
||||
public string? Category
|
||||
{
|
||||
get { return _Category; }
|
||||
set { _Category = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private AlarmLevel? _AlarmLevel;
|
||||
/// <summary>
|
||||
/// 报警等级
|
||||
/// </summary>
|
||||
public AlarmLevel? AlarmLevel
|
||||
{
|
||||
get { return _AlarmLevel; }
|
||||
set { _AlarmLevel = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
56
CapMachine.Wpf/Dtos/HistoryAlarmDto.cs
Normal file
56
CapMachine.Wpf/Dtos/HistoryAlarmDto.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// 历史报警模型
|
||||
/// </summary>
|
||||
public class HistoryAlarmDto : BindableBase
|
||||
{
|
||||
private string? _Category;
|
||||
[Description("分类")]
|
||||
public string? Category
|
||||
{
|
||||
get { return _Category; }
|
||||
set { _Category = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private string? _AlarmLevel;
|
||||
[Description("报警等级")]
|
||||
public string? AlarmLevel
|
||||
{
|
||||
get { return _AlarmLevel; }
|
||||
set { _AlarmLevel = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private string? _Name;
|
||||
[Description("报警名称")]
|
||||
public string? Name
|
||||
{
|
||||
get { return _Name; }
|
||||
set { _Name = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private long _Duration;
|
||||
[Description("报警时长")]
|
||||
public long Duration
|
||||
{
|
||||
get { return _Duration; }
|
||||
set { _Duration = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private DateTime _CreateTime;
|
||||
[Description("报警时间")]
|
||||
public DateTime CreateTime
|
||||
{
|
||||
get { return _CreateTime; }
|
||||
set { _CreateTime = value; RaisePropertyChanged(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
20
CapMachine.Wpf/MapperProfile/HistoryAlarmProfile.cs
Normal file
20
CapMachine.Wpf/MapperProfile/HistoryAlarmProfile.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using AutoMapper;
|
||||
using CapMachine.Model;
|
||||
using CapMachine.Model.Alarm;
|
||||
using CapMachine.Wpf.Dtos;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.MapperProfile
|
||||
{
|
||||
public class HistoryAlarmProfile : Profile
|
||||
{
|
||||
public HistoryAlarmProfile()
|
||||
{
|
||||
CreateMap<HistoryAlarm, HistoryAlarmDto>().ReverseMap();
|
||||
}
|
||||
}
|
||||
}
|
||||
235
CapMachine.Wpf/Services/AlarmService.cs
Normal file
235
CapMachine.Wpf/Services/AlarmService.cs
Normal file
@@ -0,0 +1,235 @@
|
||||
using CapMachine.Model.Alarm;
|
||||
using CapMachine.Wpf.Alarm;
|
||||
using CapMachine.Wpf.Dtos;
|
||||
using Prism.Events;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 报警服务
|
||||
/// </summary>
|
||||
public class AlarmService : BindableBase
|
||||
{
|
||||
public AlarmService(ConfigService configService, IEventAggregator eventAggregator,IFreeSql freeSql
|
||||
)
|
||||
{
|
||||
ConfigService = configService;
|
||||
//事件服务
|
||||
_EventAggregator = eventAggregator;
|
||||
FreeSql = freeSql;
|
||||
//DataRecordService = dataRecordService;
|
||||
//SysRunServer = sysRunService;
|
||||
|
||||
ListAlarmRunCell = new ObservableCollection<AlarmRunCell>()
|
||||
{
|
||||
new AlarmRunCell(FreeSql){Index=0,CurAlarmConfig=new AlarmConfig()
|
||||
{
|
||||
Name="急停报警",
|
||||
ActiveType=ActiveType.Bool,
|
||||
Address="V0.0",
|
||||
AlarmLevel=AlarmLevel.Level1,
|
||||
Category="一般报警",
|
||||
Message="急停报警",
|
||||
ThresholdDown=1,
|
||||
ThresholdUp=1,
|
||||
BoolActiveValue=true
|
||||
}},
|
||||
new AlarmRunCell(FreeSql){Index=1,CurAlarmConfig=new AlarmConfig()
|
||||
{
|
||||
Name="高压压控",
|
||||
ActiveType=ActiveType.Bool,
|
||||
Address="V0.1",
|
||||
AlarmLevel=AlarmLevel.Level1,
|
||||
Category="一般报警",
|
||||
Message="高压压控",
|
||||
ThresholdDown=1,
|
||||
ThresholdUp=1,
|
||||
BoolActiveValue=true
|
||||
}},
|
||||
new AlarmRunCell(FreeSql){Index=2,CurAlarmConfig=new AlarmConfig()
|
||||
{
|
||||
Name="低压压控",
|
||||
ActiveType=ActiveType.Bool,
|
||||
Address="V0.2",
|
||||
AlarmLevel=AlarmLevel.Level1,
|
||||
Category="一般报警",
|
||||
Message="低压压控",
|
||||
ThresholdDown=1,
|
||||
ThresholdUp=1,
|
||||
BoolActiveValue=true
|
||||
}},
|
||||
new AlarmRunCell(FreeSql){Index=3,CurAlarmConfig=new AlarmConfig()
|
||||
{
|
||||
Name="水压低",
|
||||
ActiveType=ActiveType.Bool,
|
||||
Address="V0.3",
|
||||
AlarmLevel=AlarmLevel.Level1,
|
||||
Category="一般报警",
|
||||
Message="水压低",
|
||||
ThresholdDown=1,
|
||||
ThresholdUp=1,
|
||||
BoolActiveValue=true
|
||||
}},
|
||||
new AlarmRunCell(FreeSql){Index=4,CurAlarmConfig=new AlarmConfig()
|
||||
{
|
||||
Name="水泵过载",
|
||||
ActiveType=ActiveType.Bool,
|
||||
Address="V0.4",
|
||||
AlarmLevel=AlarmLevel.Level1,
|
||||
Category="一般报警",
|
||||
Message="水泵过载",
|
||||
ThresholdDown=1,
|
||||
ThresholdUp=1,
|
||||
BoolActiveValue=true
|
||||
}},
|
||||
new AlarmRunCell(FreeSql){Index=5,CurAlarmConfig=new AlarmConfig()
|
||||
{
|
||||
Name="冷水机组故障",
|
||||
ActiveType=ActiveType.Bool,
|
||||
Address="V0.5",
|
||||
AlarmLevel=AlarmLevel.Level1,
|
||||
Category="一般报警",
|
||||
Message="冷水机组故障",
|
||||
ThresholdDown=1,
|
||||
ThresholdUp=1,
|
||||
BoolActiveValue=true
|
||||
}},
|
||||
new AlarmRunCell(FreeSql){Index=6,CurAlarmConfig=new AlarmConfig()
|
||||
{
|
||||
Name="排气压力",
|
||||
ActiveType=ActiveType.Bool,
|
||||
Address="V0.6",
|
||||
AlarmLevel=AlarmLevel.Level1,
|
||||
Category="一般报警",
|
||||
Message="排气压力",
|
||||
ThresholdDown=1,
|
||||
ThresholdUp=1,
|
||||
BoolActiveValue=true
|
||||
}},
|
||||
new AlarmRunCell(FreeSql){Index=7,CurAlarmConfig=new AlarmConfig()
|
||||
{
|
||||
Name="吸气压力",
|
||||
ActiveType=ActiveType.Bool,
|
||||
Address="V0.7",
|
||||
AlarmLevel=AlarmLevel.Level1,
|
||||
Category="一般报警",
|
||||
Message="吸气压力",
|
||||
ThresholdDown=1,
|
||||
ThresholdUp=1,
|
||||
BoolActiveValue=true
|
||||
}},
|
||||
new AlarmRunCell(FreeSql){Index=8,CurAlarmConfig=new AlarmConfig()
|
||||
{
|
||||
Name="吸气温度",
|
||||
ActiveType=ActiveType.Bool,
|
||||
Address="V1.0",
|
||||
AlarmLevel=AlarmLevel.Level1,
|
||||
Category="一般报警",
|
||||
Message="吸气温度",
|
||||
ThresholdDown=1,
|
||||
ThresholdUp=1,
|
||||
BoolActiveValue=true
|
||||
}},
|
||||
new AlarmRunCell(FreeSql){Index=9,CurAlarmConfig=new AlarmConfig()
|
||||
{
|
||||
Name="吸气混合器温度",
|
||||
ActiveType=ActiveType.Bool,
|
||||
Address="V1.1",
|
||||
AlarmLevel=AlarmLevel.Level1,
|
||||
Category="一般报警",
|
||||
Message="吸气混合器温度",
|
||||
ThresholdDown=1,
|
||||
ThresholdUp=1,
|
||||
BoolActiveValue=true
|
||||
}},
|
||||
new AlarmRunCell(FreeSql){Index=10,CurAlarmConfig=new AlarmConfig()
|
||||
{
|
||||
Name="水加热温度",
|
||||
ActiveType=ActiveType.Bool,
|
||||
Address="V1.2",
|
||||
AlarmLevel=AlarmLevel.Level1,
|
||||
Category="一般报警",
|
||||
Message="水加热温度",
|
||||
ThresholdDown=1,
|
||||
ThresholdUp=1,
|
||||
BoolActiveValue=true
|
||||
}},
|
||||
new AlarmRunCell(FreeSql){Index=11,CurAlarmConfig=new AlarmConfig()
|
||||
{
|
||||
Name="排气温度",
|
||||
ActiveType=ActiveType.Bool,
|
||||
Address="V1.3",
|
||||
AlarmLevel=AlarmLevel.Level1,
|
||||
Category="一般报警",
|
||||
Message="排气温度",
|
||||
ThresholdDown=1,
|
||||
ThresholdUp=1,
|
||||
BoolActiveValue=true
|
||||
}},
|
||||
new AlarmRunCell(FreeSql){Index=12,CurAlarmConfig=new AlarmConfig()
|
||||
{
|
||||
Name="水箱进水温度",
|
||||
ActiveType=ActiveType.Bool,
|
||||
Address="V1.4",
|
||||
AlarmLevel=AlarmLevel.Level1,
|
||||
Category="一般报警",
|
||||
Message="水箱进水温度",
|
||||
ThresholdDown=1,
|
||||
ThresholdUp=1,
|
||||
BoolActiveValue=true
|
||||
}},
|
||||
new AlarmRunCell(FreeSql){Index=13,CurAlarmConfig=new AlarmConfig()
|
||||
{
|
||||
Name="压缩机表面温度",
|
||||
ActiveType=ActiveType.Bool,
|
||||
Address="V1.5",
|
||||
AlarmLevel=AlarmLevel.Level1,
|
||||
Category="一般报警",
|
||||
Message="压缩机表面温度",
|
||||
ThresholdDown=1,
|
||||
ThresholdUp=1,
|
||||
BoolActiveValue=true
|
||||
}},
|
||||
new AlarmRunCell(FreeSql){Index=14,CurAlarmConfig=new AlarmConfig()
|
||||
{
|
||||
Name="试验箱",
|
||||
ActiveType=ActiveType.Bool,
|
||||
Address="V1.6",
|
||||
AlarmLevel=AlarmLevel.Level1,
|
||||
Category="一般报警",
|
||||
Message="试验箱",
|
||||
ThresholdDown=1,
|
||||
ThresholdUp=1,
|
||||
BoolActiveValue=true
|
||||
}},
|
||||
};
|
||||
}
|
||||
public ConfigService ConfigService { get; }
|
||||
|
||||
private IEventAggregator _EventAggregator { get; set; }
|
||||
public IFreeSql FreeSql { get; }
|
||||
public DataRecordService DataRecordService { get; }
|
||||
public SysRunService SysRunServer { get; }
|
||||
public MachineRtDataService MachineRtDataService { get; }
|
||||
|
||||
|
||||
private ObservableCollection<AlarmRunCell> _ListAlarmRunCell;
|
||||
/// <summary>
|
||||
/// 报警实时数据集合
|
||||
/// </summary>
|
||||
public ObservableCollection<AlarmRunCell> ListAlarmRunCell
|
||||
{
|
||||
get { return _ListAlarmRunCell; }
|
||||
set { _ListAlarmRunCell = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ namespace CapMachine.Wpf.Services
|
||||
/// 事件聚合器
|
||||
/// </summary>
|
||||
private IEventAggregator _EventAggregator { get; set; }
|
||||
public AlarmService AlarmService { get; }
|
||||
|
||||
/// <summary>
|
||||
/// PLCScanTask扫描Task
|
||||
@@ -97,7 +98,7 @@ namespace CapMachine.Wpf.Services
|
||||
/// 实例化函数
|
||||
/// </summary>
|
||||
/// <param name="eventAggregator"></param>
|
||||
public MachineRtDataService(IEventAggregator eventAggregator)
|
||||
public MachineRtDataService(IEventAggregator eventAggregator, AlarmService alarmService)//, AlarmService alarmService
|
||||
{
|
||||
//ConcurrentDictionary<DateTime, RecordInfo> keyValuePairs = new ConcurrentDictionary<DateTime, RecordInfo>();
|
||||
|
||||
@@ -110,6 +111,7 @@ namespace CapMachine.Wpf.Services
|
||||
|
||||
//事件服务
|
||||
_EventAggregator = eventAggregator;
|
||||
AlarmService = alarmService;
|
||||
|
||||
//秒触发一次
|
||||
CycleTimer = new System.Timers.Timer(500);
|
||||
@@ -181,7 +183,7 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "VW200",
|
||||
MVAddress = "VW250",
|
||||
IsMeter = true,
|
||||
AutoHandSwitchAddress= "VW240",
|
||||
AutoHandSwitchAddress = "VW240",
|
||||
Precision = 1,
|
||||
DecimalPoint = 0,
|
||||
Samp = 1,
|
||||
@@ -895,6 +897,11 @@ namespace CapMachine.Wpf.Services
|
||||
|
||||
private Random Random { get; set; } = new Random();
|
||||
|
||||
/// <summary>
|
||||
/// 报警结果集合
|
||||
/// </summary>
|
||||
private OperateResult<bool[]> OperateResultAlarm { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PLC扫描线程
|
||||
/// </summary>
|
||||
@@ -912,28 +919,8 @@ namespace CapMachine.Wpf.Services
|
||||
//DiagnosticsTime.Start();
|
||||
try
|
||||
{
|
||||
//var MyProperty = typeof(int);
|
||||
|
||||
//foreach (var item in TagManger.DicTags)
|
||||
//{
|
||||
// if (item.Value.ValueType == typeof(short))
|
||||
// {
|
||||
// var Tag = TagManger.GetTagByName<short>(item.Key);
|
||||
// Tag.RtValue.Value++;
|
||||
// }
|
||||
// else if (item.Value.ValueType == typeof(double))
|
||||
// {
|
||||
// var Tag = TagManger.GetTagByName<double>(item.Key);
|
||||
// Tag.RtValue.Value++;
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
//TagInfo.RtValue.Value++;
|
||||
|
||||
//RT TODO
|
||||
//SiemensDrive.Read("VW1", 2);
|
||||
|
||||
|
||||
//var data = TagManger.DicTags["转速"].ValueType.Name;
|
||||
|
||||
////第一次计时
|
||||
@@ -1001,6 +988,16 @@ namespace CapMachine.Wpf.Services
|
||||
//stopwatch.Stop(); //停止Stopwatch
|
||||
//Console.WriteLine("Add Elapsed output runTime:{0}", stopwatch.Elapsed.TotalSeconds.ToString());
|
||||
//stopwatch.Reset();
|
||||
|
||||
OperateResultAlarm = SiemensDrive.ReadBool("V0.0", 15);
|
||||
if (OperateResultAlarm.IsSuccess)
|
||||
{
|
||||
foreach (var item in AlarmService.ListAlarmRunCell)
|
||||
{
|
||||
item.UpdateBoolValue(OperateResultAlarm.Content[item.Index]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -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>()
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
Width="1920"
|
||||
Height="980"
|
||||
Height="960"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="220" />
|
||||
<RowDefinition Height="160" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<GroupBox Margin="5,10,5,10" Header="日志查询条件">
|
||||
<GroupBox Margin="3,5,3,3" Header="日志/历史报警查询">
|
||||
<StackPanel Margin="0,0,0,0" Orientation="Vertical">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="StackPanel">
|
||||
@@ -35,23 +35,20 @@
|
||||
</StackPanel.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="9*" />
|
||||
<RowDefinition Height="3*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel
|
||||
Grid.Column="0"
|
||||
Margin="0,0,0,20"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
|
||||
<StackPanel
|
||||
Margin="20"
|
||||
Margin="20,5"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Label
|
||||
HorizontalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
Content="分类:" />
|
||||
Content="分类:"
|
||||
FontSize="20" />
|
||||
<DockPanel x:Name="Combbox1">
|
||||
<StackPanel>
|
||||
<!--<ComboBox Width="200" HorizontalAlignment="Left" ItemsSource="{Binding CombboxList}" SelectedItem="{Binding CombboxItem}" DisplayMemberPath="Text" SelectedValuePath="Key" ></ComboBox>-->
|
||||
@@ -59,18 +56,23 @@
|
||||
Width="120"
|
||||
materialDesign:HintAssist.Hint="分类"
|
||||
DisplayMemberPath="Text"
|
||||
FontSize="18"
|
||||
ItemsSource="{Binding CategoryComboBoxList}"
|
||||
SelectedValue="{Binding SearchCategory}"
|
||||
SelectedValuePath="Text" />
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="20">
|
||||
<Label HorizontalContentAlignment="Center" Content="创建时间:" />
|
||||
<StackPanel Margin="20,5">
|
||||
<Label
|
||||
HorizontalContentAlignment="Center"
|
||||
Content="创建时间:"
|
||||
FontSize="20" />
|
||||
<DatePicker
|
||||
Width="120"
|
||||
Margin="0,0,10,0"
|
||||
materialDesign:HintAssist.Hint="开始时间"
|
||||
FontSize="16"
|
||||
Language="zh-CN"
|
||||
SelectedDate="{Binding SearchStartDate, Mode=TwoWay}"
|
||||
Style="{StaticResource MaterialDesignFloatingHintDatePicker}" />
|
||||
@@ -78,78 +80,95 @@
|
||||
Width="120"
|
||||
Margin="10,0,10,0"
|
||||
materialDesign:HintAssist.Hint="结束时间"
|
||||
FontSize="16"
|
||||
Language="zh-CN"
|
||||
SelectedDate="{Binding SearchEndDate, Mode=TwoWay}"
|
||||
Style="{StaticResource MaterialDesignFloatingHintDatePicker}" />
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Background=" AliceBlue"
|
||||
Orientation="Horizontal">
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||
<Button
|
||||
Width="120"
|
||||
Height="30"
|
||||
Margin="10,10,10,10"
|
||||
HorizontalAlignment="Center"
|
||||
Background="Green"
|
||||
Command="{Binding SearchCmd}"
|
||||
Content="搜索"
|
||||
Foreground="White" />
|
||||
<Button
|
||||
Foreground="White">
|
||||
<StackPanel
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="0,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
Margin="0,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="18"
|
||||
Text="搜索" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<!--<Button
|
||||
Width="120"
|
||||
Height="30"
|
||||
Margin="10,10,10,10"
|
||||
HorizontalAlignment="Center"
|
||||
Background="Orange"
|
||||
Command="{Binding OutputDataCmd}"
|
||||
Content="导出数据"
|
||||
Foreground="White" />
|
||||
Foreground="White" />-->
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
<Grid Grid.Row="1" Margin="8">
|
||||
<DataGrid
|
||||
x:Name="dg1"
|
||||
Grid.ColumnSpan="2"
|
||||
AutoGenerateColumns="False"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding ListModelDto}"
|
||||
SelectionMode="Single"
|
||||
SelectionUnit="Cell">
|
||||
<!--<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding SelectedItemsCmd}" CommandParameter="{Binding ElementName=dg1}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>-->
|
||||
<DataGrid.Columns>
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Margin="2"
|
||||
BorderBrush="Gray"
|
||||
BorderThickness="1"
|
||||
CornerRadius="3">
|
||||
<Grid>
|
||||
<DataGrid
|
||||
x:Name="dg1"
|
||||
VerticalAlignment="Stretch"
|
||||
AutoGenerateColumns="True"
|
||||
AutoGeneratingColumn="dg1_AutoGeneratingColumn"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding ListModelDto}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||
SelectionMode="Extended">
|
||||
<!--<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding SelectedItemsCmd}" CommandParameter="{Binding ElementName=dg1}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>-->
|
||||
<!--<DataGrid.Columns>
|
||||
|
||||
<DataGridTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding Level}"
|
||||
Header="等级" />
|
||||
<DataGridTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding Level}"
|
||||
Header="等级" />
|
||||
|
||||
|
||||
<DataGridTextColumn
|
||||
Width="200"
|
||||
Binding="{Binding Category}"
|
||||
Header="分类" />
|
||||
<DataGridTextColumn
|
||||
Width="200"
|
||||
Binding="{Binding Category}"
|
||||
Header="分类" />
|
||||
|
||||
<DataGridTextColumn
|
||||
Width="1200"
|
||||
Binding="{Binding Content}"
|
||||
Header="内容" />
|
||||
<DataGridTextColumn
|
||||
Width="1200"
|
||||
Binding="{Binding Content}"
|
||||
Header="内容" />
|
||||
|
||||
<DataGridTextColumn
|
||||
Width="180"
|
||||
Binding="{Binding CreateTime, StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}"
|
||||
Header="创建时间" />
|
||||
</DataGrid.Columns>-->
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<DataGridTextColumn
|
||||
Width="180"
|
||||
Binding="{Binding CreateTime, StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}"
|
||||
Header="创建时间" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Microsoft.VisualBasic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -24,5 +25,17 @@ namespace CapMachine.Wpf.Views
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void dg1_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty((e.PropertyDescriptor as System.ComponentModel.PropertyDescriptor).Description))
|
||||
{
|
||||
e.Column.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Column.Header = (e.PropertyDescriptor as System.ComponentModel.PropertyDescriptor).Description;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@
|
||||
<Grid>
|
||||
<Grid.Resources>
|
||||
<Style x:Key="TitelStyle" TargetType="TextBlock">
|
||||
<Setter Property="FontSize" Value="32" />
|
||||
<Setter Property="FontSize" Value="26" />
|
||||
<Setter Property="Margin" Value="10,0" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
@@ -195,6 +195,7 @@
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
@@ -216,12 +217,12 @@
|
||||
Margin="10,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="30"
|
||||
FontSize="26"
|
||||
Text="" />
|
||||
<TextBlock Style="{StaticResource TitelStyle}" Text="试验名称:" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="30"
|
||||
FontSize="26"
|
||||
FontWeight="Bold"
|
||||
Text="{Binding ConfigService.CurExpInfo.Name}" />
|
||||
</StackPanel>
|
||||
@@ -239,7 +240,7 @@
|
||||
Margin="10,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="30"
|
||||
FontSize="26"
|
||||
Text="" />
|
||||
<TextBlock Style="{StaticResource TitelStyle}" Text="当前进度:" />
|
||||
|
||||
@@ -264,7 +265,7 @@
|
||||
Margin="10,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="30"
|
||||
FontSize="26"
|
||||
Text="" />
|
||||
<TextBlock Style="{StaticResource TitelStyle}" Text="总时间:" />
|
||||
<TextBlock
|
||||
@@ -288,7 +289,7 @@
|
||||
Margin="10,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="30"
|
||||
FontSize="26"
|
||||
Text="" />
|
||||
<TextBlock Style="{StaticResource TitelStyle}" Text="剩余时间:" />
|
||||
<TextBlock
|
||||
@@ -312,12 +313,12 @@
|
||||
Margin="10,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="30"
|
||||
FontSize="26"
|
||||
Text="" />
|
||||
<TextBlock Style="{StaticResource TitelStyle}" Text="当前步骤:" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="30"
|
||||
FontSize="26"
|
||||
FontWeight="Bold"
|
||||
Text="0" />
|
||||
</StackPanel>
|
||||
@@ -476,6 +477,71 @@
|
||||
|
||||
</StackPanel>
|
||||
</materialDesign:Card>
|
||||
<materialDesign:Card
|
||||
Grid.Row="3"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="6"
|
||||
Margin="3"
|
||||
Background="{DynamicResource MaterialDesignLightBackground}"
|
||||
Foreground="{DynamicResource PrimaryHueLightForegroundBrush}"
|
||||
UniformCornerRadius="5">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="10,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="26"
|
||||
Foreground="OrangeRed"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
Foreground="OrangeRed"
|
||||
Style="{StaticResource TitelStyle}"
|
||||
Text="报警:" />
|
||||
|
||||
<ItemsControl ItemsSource="{Binding AlarmService.ListAlarmRunCell}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<!-- HandValueParameter="{Binding MVValue}" -->
|
||||
<DataTemplate>
|
||||
<Border Margin="3,6" CornerRadius="2">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ActiveState}" Value="True">
|
||||
<Setter Property="Background" Value="Red" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding ActiveState}" Value="false">
|
||||
<Setter Property="Background" Value="LightSlateGray" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<TextBlock
|
||||
Margin="5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
Foreground="WhiteSmoke"
|
||||
Text="{Binding CurAlarmConfig.Name}"
|
||||
ToolTip="{Binding CurAlarmConfig.Message}">
|
||||
<!--<TextBlock.ToolTip>
|
||||
<StackPanel>
|
||||
<TextBlock FontWeight="Bold" Text="官方网站" />
|
||||
<TextBlock Text="点击这个按钮,进入百度首页" />
|
||||
</StackPanel>
|
||||
</TextBlock.ToolTip>-->
|
||||
</TextBlock>
|
||||
</Border>
|
||||
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
</StackPanel>
|
||||
</materialDesign:Card>
|
||||
</Grid>
|
||||
</materialDesign:Card>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user