添加项目文件。
This commit is contained in:
39
OrpaonEMS.Core/ChannelModel/AlarmChannel.cs
Normal file
39
OrpaonEMS.Core/ChannelModel/AlarmChannel.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.ChannelModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Channel数据传输内容信息
|
||||
/// </summary>
|
||||
public class AlarmChannel
|
||||
{
|
||||
/// <summary>
|
||||
/// 报警内容
|
||||
/// </summary>
|
||||
public string Content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 开始时间
|
||||
/// </summary>
|
||||
public DateTime StartTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结束时间
|
||||
/// </summary>
|
||||
public DateTime EndTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 报警时间
|
||||
/// </summary>
|
||||
public decimal AlarmDur { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 报警等级
|
||||
/// </summary>
|
||||
public int Level { get; set; }
|
||||
}
|
||||
}
|
||||
193
OrpaonEMS.Core/ComHelper.cs
Normal file
193
OrpaonEMS.Core/ComHelper.cs
Normal file
@@ -0,0 +1,193 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 公共帮助类
|
||||
/// </summary>
|
||||
public class ComHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据Int类型的值,返回用1或0(对应True或Flase)填充的数组
|
||||
/// <remarks>从右侧开始向左索引(0~31)</remarks>
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<bool> GetBitList(int value)
|
||||
{
|
||||
var list = new List<bool>(32);
|
||||
for (var i = 0; i <= 31; i++)
|
||||
{
|
||||
var val = 1 << i;
|
||||
list.Add((value & val) == val);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回Int数据中某一位是否为1
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="index">32位数据的从右向左的偏移位索引(0~31)</param>
|
||||
/// <returns>true表示该位为1,false表示该位为0</returns>
|
||||
public static bool GetBitValue(int value, ushort index)
|
||||
{
|
||||
if (index > 31) throw new ArgumentOutOfRangeException("index"); //索引出错
|
||||
var val = 1 << index;
|
||||
return (value & val) == val;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设定Int数据中某一位的值
|
||||
/// </summary>
|
||||
/// <param name="value">位设定前的值</param>
|
||||
/// <param name="index">32位数据的从右向左的偏移位索引(0~31)</param>
|
||||
/// <param name="bitValue">true设该位为1,false设为0</param>
|
||||
/// <returns>返回位设定后的值</returns>
|
||||
public static int SetBitValue(int value, ushort index, bool bitValue)
|
||||
{
|
||||
if (index > 31) throw new ArgumentOutOfRangeException("index"); //索引出错
|
||||
var val = 1 << index;
|
||||
return bitValue ? (value | val) : (value & ~val);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// intel格式CAN报文 转 数值
|
||||
/// </summary>
|
||||
/// <param name="data">CAN报文</param>
|
||||
/// <param name="startBit">信号起始bit</param>
|
||||
/// <param name="bitLength">信号总长度</param>
|
||||
/// <param name="factor">精度值</param>
|
||||
/// <param name="offset">偏移值</param>
|
||||
/// <returns>数值</returns>
|
||||
public static double GetIntelSignalValue(byte[] data, int startBit, int bitLength, double factor, double offset)
|
||||
{
|
||||
ulong canSignalValue = 0;
|
||||
for (int i = data.Length - 1; i >= 0; i--)
|
||||
{
|
||||
canSignalValue += (ulong)data[i] << i * 8;
|
||||
}
|
||||
int x = startBit / 8;
|
||||
int y = startBit % 8;
|
||||
int rightMoveCount = x * 8 + y;
|
||||
canSignalValue >>= rightMoveCount;
|
||||
canSignalValue = canSignalValue & ulong.MaxValue >> 64 - bitLength;
|
||||
double values = canSignalValue * factor + offset;
|
||||
return values;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 数值 转 intel格式CAN报文
|
||||
/// </summary>
|
||||
/// <param name="values">物理信号值</param>
|
||||
/// <param name="startBit">信号起始bit</param>
|
||||
/// <param name="bitLength">信号总长度</param>
|
||||
/// <param name="factor">精度值</param>
|
||||
/// <param name="offset">偏移值</param>
|
||||
/// <returns>intel格式CAN报文</returns>
|
||||
public static byte[] ValueToIntelSignal(double values, int startBit, int bitLength, double factor, double offset)
|
||||
{
|
||||
byte[] IntelSignal = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
ulong data = Convert.ToUInt64((values - offset) / factor);
|
||||
int dataLength = bitLength / 8 + (bitLength / 4) % 2;
|
||||
int IntelSignal_pos = startBit / 8;
|
||||
for (int Count = 0; Count < dataLength; Count++, IntelSignal_pos++)
|
||||
{
|
||||
ulong lowBit = (data >> (8 * Count)) & 0xFF; // 将数据移至低8位并取出
|
||||
IntelSignal[IntelSignal_pos] = Convert.ToByte(lowBit);
|
||||
}
|
||||
return IntelSignal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数值 转 intel格式CAN报文
|
||||
/// </summary>
|
||||
/// <param name="values">物理信号值</param>
|
||||
/// <param name="startBit">信号起始bit</param>
|
||||
/// <param name="bitLength">信号总长度</param>
|
||||
/// <param name="factor">精度值</param>
|
||||
/// <param name="offset">偏移值</param>
|
||||
/// <returns>intel格式CAN报文</returns>
|
||||
public static byte[] ValueToIntelSignal(byte[] IntelSignal, double values, int startBit, int bitLength, double factor, double offset)
|
||||
{
|
||||
//byte[] IntelSignal = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
ulong data = Convert.ToUInt64((values - offset) / factor);
|
||||
int dataLength = bitLength / 8 + (bitLength / 4) % 2;
|
||||
int IntelSignal_pos = startBit / 8;
|
||||
for (int Count = 0; Count < dataLength; Count++, IntelSignal_pos++)
|
||||
{
|
||||
ulong lowBit = (data >> (8 * Count)) & 0xFF; // 将数据移至低8位并取出
|
||||
IntelSignal[IntelSignal_pos] = Convert.ToByte(lowBit);
|
||||
}
|
||||
return IntelSignal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Motorola格式CAN报文 转 数值
|
||||
/// </summary>
|
||||
/// <param name="data">CAN报文</param>
|
||||
/// <param name="startBit">信号起始bit</param>
|
||||
/// <param name="bitLength">信号总长度</param>
|
||||
/// <param name="factor">精度值</param>
|
||||
/// <param name="offset">偏移值</param>
|
||||
/// <returns>物理信号值</returns>
|
||||
public static double GetMotorolaSignalValue(byte[] data, int startBit, int bitLength, double factor, double offset)
|
||||
{
|
||||
ulong canSignalValue = 0;
|
||||
for (int i = data.Length - 1, j = 0; i >= 0; i--, j++)
|
||||
{
|
||||
canSignalValue += (ulong)data[j] << i * 8;
|
||||
}
|
||||
int x = startBit / 8;
|
||||
int y = startBit % 8;
|
||||
int z = x * 8 + bitLength - y;
|
||||
int rightMoveCount = data.Length * 8 - z;
|
||||
canSignalValue >>= rightMoveCount;
|
||||
canSignalValue = canSignalValue & ulong.MaxValue >> 64 - bitLength;
|
||||
|
||||
double values = canSignalValue * factor + offset;
|
||||
return values;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数值 转 Motorola格式CAN报文
|
||||
/// </summary>
|
||||
/// <param name="MotorolaSignal">CAN报文</param>
|
||||
/// <param name="values">物理信号值</param>
|
||||
/// <param name="startBit">信号起始bit</param>
|
||||
/// <param name="bitLength">信号总长度</param>
|
||||
/// <param name="factor">精度值</param>
|
||||
/// <param name="offset">偏移值</param>
|
||||
/// <returns>Motorola格式CAN报文</returns>
|
||||
public static byte[] ValueToMotorolaSignal_Part(byte[] MotorolaSignal, double values, int startBit, int bitLength, double factor, double offset)
|
||||
{
|
||||
// = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
ulong data = Convert.ToUInt64((values - offset) / factor);
|
||||
int dataLength = bitLength / 8 + (bitLength / 4) % 2;
|
||||
int str_length = data.ToString().Length;
|
||||
int MotorolaSignal_pos = startBit / 8;
|
||||
data = str_length % 2 != 0 ? data << 4 : data;
|
||||
for (int Count = dataLength - 1; Count >= 0; Count--, MotorolaSignal_pos++)
|
||||
{
|
||||
ulong newBit = (data >> (8 * Count)) & 0xFF;
|
||||
ulong newBit2 = ((newBit << 4) & 0xF0) + ((newBit >> 4) & 0x0F);
|
||||
ulong Bit = (data > 0x0F & bitLength > 8) ? newBit2 : newBit;
|
||||
MotorolaSignal[MotorolaSignal_pos] = Convert.ToByte(Bit);
|
||||
}
|
||||
return MotorolaSignal;
|
||||
}
|
||||
}
|
||||
}
|
||||
59
OrpaonEMS.Core/ConfigHelper.cs
Normal file
59
OrpaonEMS.Core/ConfigHelper.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core
|
||||
{
|
||||
public class ConfigHelper
|
||||
{
|
||||
Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||
/// <summary>
|
||||
/// 根据Key取Value值
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
public static string GetValue(string key)
|
||||
{
|
||||
return ConfigurationManager.AppSettings[key].ToString().Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据Key修改Value
|
||||
/// </summary>
|
||||
/// <param name="key">要修改的Key</param>
|
||||
/// <param name="value">要修改为的值</param>
|
||||
public static void SetValue(string key, string value)
|
||||
{
|
||||
//ConfigurationManager.AppSettings.Set(key, value);
|
||||
//cfa.AppSettings.Settings[key].Value = value;
|
||||
//cfa.Save();
|
||||
|
||||
Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||
configuration.AppSettings.Settings[key].Value = value;
|
||||
configuration.Save();
|
||||
ConfigurationManager.RefreshSection("appSettings");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加新的Key ,Value键值对
|
||||
/// </summary>
|
||||
/// <param name="key">Key</param>
|
||||
/// <param name="value">Value</param>
|
||||
public static void Add(string key, string value)
|
||||
{
|
||||
ConfigurationManager.AppSettings.Add(key, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据Key删除项
|
||||
/// </summary>
|
||||
/// <param name="key">Key</param>
|
||||
public static void Remove(string key)
|
||||
{
|
||||
ConfigurationManager.AppSettings.Remove(key);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
53
OrpaonEMS.Core/Converts/CmdPwTypeConverter.cs
Normal file
53
OrpaonEMS.Core/Converts/CmdPwTypeConverter.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using OrpaonEMS.Model.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace OrpaonEMS.Core.Converts
|
||||
{
|
||||
public class CmdPwTypeConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
return null;
|
||||
|
||||
var DATA = GetEnumDescription((string)value);
|
||||
|
||||
return DATA;
|
||||
}
|
||||
|
||||
private bool GetEnumDescription(string value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case "Charg":
|
||||
return false;
|
||||
case "DisCharg":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
return null;
|
||||
|
||||
if ((bool)value)
|
||||
{
|
||||
return "DisCharg";
|
||||
}
|
||||
|
||||
return "Charg";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
43
OrpaonEMS.Core/Converts/ElePvConverter.cs
Normal file
43
OrpaonEMS.Core/Converts/ElePvConverter.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using OrpaonEMS.Model.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace OrpaonEMS.Core.Converts
|
||||
{
|
||||
public class ElePvConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
return null;
|
||||
|
||||
var EleStr = GetEnumDescription((ElePVEnum)value);
|
||||
|
||||
return EleStr;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public string GetEnumDescription(Enum enumValue)
|
||||
{
|
||||
string value = enumValue.ToString();
|
||||
FieldInfo field = enumValue.GetType().GetField(value);
|
||||
//获取描述属性
|
||||
object[] objs = field.GetCustomAttributes(typeof(DescriptionAttribute), false);
|
||||
if (objs == null || objs.Length == 0) //当描述属性没有时,直接返回名称
|
||||
return value;
|
||||
DescriptionAttribute descriptionAttribute = (DescriptionAttribute)objs[0];
|
||||
return descriptionAttribute.Description;
|
||||
}
|
||||
}
|
||||
}
|
||||
31
OrpaonEMS.Core/Converts/RatioConverter.cs
Normal file
31
OrpaonEMS.Core/Converts/RatioConverter.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using OrpaonEMS.Model.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace OrpaonEMS.Core.Converts
|
||||
{
|
||||
public class RatioConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
return null;
|
||||
|
||||
return ((double)value) / 100.0;
|
||||
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
return null;
|
||||
|
||||
return ((double)value) * 100.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
118
OrpaonEMS.Core/CoolAutoControl.cs
Normal file
118
OrpaonEMS.Core/CoolAutoControl.cs
Normal file
@@ -0,0 +1,118 @@
|
||||
using OrpaonEMS.Core.Enums;
|
||||
using OrpaonEMS.Core.EventHandMsg;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 液冷自动控制
|
||||
/// </summary>
|
||||
public class CoolAutoControl
|
||||
{
|
||||
public CoolAutoControl()
|
||||
{
|
||||
_CurCoolState = CoolState.AutoCycle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 事件
|
||||
/// </summary>
|
||||
public event EventHandler<CoolValue> CoolCmdHandler;
|
||||
|
||||
/// <summary>
|
||||
/// 设置的目标温度
|
||||
/// </summary>
|
||||
public double SetTargetTemp { get; set; } = 25;
|
||||
|
||||
/// <summary>
|
||||
/// 是否报警
|
||||
/// </summary>
|
||||
public bool IsAlarm { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 更新液冷状态
|
||||
/// </summary>
|
||||
public void UpdateCoolState(bool AlarmState)
|
||||
{
|
||||
IsAlarm = AlarmState;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新回水温度值
|
||||
/// </summary>
|
||||
public void UpdateValue(double OutTempValue)
|
||||
{
|
||||
//如果报警了,则不要进行下面的设置数据
|
||||
if (IsAlarm)
|
||||
{
|
||||
CurCoolState = CoolState.Stop;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (OutTempValue > 30)//大于30 启动制冷
|
||||
{
|
||||
//设置制冷模式
|
||||
CurCoolState = CoolState.Cool;
|
||||
return;
|
||||
}
|
||||
|
||||
if (OutTempValue < 20)
|
||||
{
|
||||
//设置加热模式
|
||||
CurCoolState = CoolState.Heat;
|
||||
return;
|
||||
}
|
||||
|
||||
//达到目标值就会停止
|
||||
if (OutTempValue <= (SetTargetTemp + 1) && OutTempValue >= (SetTargetTemp - 1))
|
||||
{
|
||||
//设置停止模式
|
||||
CurCoolState = CoolState.Stop;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private CoolState _CurCoolState;
|
||||
/// <summary>
|
||||
/// 当前液冷状态
|
||||
/// </summary>
|
||||
public CoolState CurCoolState
|
||||
{
|
||||
get { return _CurCoolState; }
|
||||
set
|
||||
{
|
||||
if (_CurCoolState != value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case CoolState.Stop:
|
||||
CoolCmdHandler(this, new CoolValue() { CmdType = CoolState.Stop, TargetTemp = SetTargetTemp });
|
||||
break;
|
||||
case CoolState.Cool:
|
||||
CoolCmdHandler(this, new CoolValue() { CmdType = CoolState.Cool, TargetTemp = SetTargetTemp });
|
||||
break;
|
||||
case CoolState.Heat:
|
||||
CoolCmdHandler(this, new CoolValue() { CmdType = CoolState.Heat, TargetTemp = SetTargetTemp });
|
||||
break;
|
||||
case CoolState.AutoCycle:
|
||||
CoolCmdHandler(this, new CoolValue() { CmdType = CoolState.AutoCycle, TargetTemp = SetTargetTemp });
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_CurCoolState = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
61
OrpaonEMS.Core/DbModel/HistoryAlarm.cs
Normal file
61
OrpaonEMS.Core/DbModel/HistoryAlarm.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using System;
|
||||
|
||||
namespace OrpaonEMS.Core.DbModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 历史报警
|
||||
/// </summary>
|
||||
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 = "WorkDay", IsNullable = false, StringLength = 20)]
|
||||
public string WorkDay { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 报警内容
|
||||
/// </summary>
|
||||
[Column(Name = "Content", IsNullable = false, StringLength = 100)]
|
||||
public string Content { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 报警等级
|
||||
/// </summary>
|
||||
[Column(Name = "Level", IsNullable = false)]
|
||||
public int Level { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 开始时间
|
||||
/// </summary>
|
||||
[Column(Name = "StartTime", IsNullable = false)]
|
||||
public DateTime StartTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结束时间
|
||||
/// </summary>
|
||||
[Column(Name = "EndTime", IsNullable = false)]
|
||||
public DateTime EndTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 暂停时间
|
||||
/// </summary>
|
||||
[Column(DbType = "decimal(8, 3)")]
|
||||
public decimal StopDur { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
55
OrpaonEMS.Core/DialogViewModel.cs
Normal file
55
OrpaonEMS.Core/DialogViewModel.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using Prism.Mvvm;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 弹窗基类
|
||||
/// </summary>
|
||||
public class DialogViewModel : BindableBase, IDialogAware
|
||||
{
|
||||
public string Title { get; set; }
|
||||
|
||||
public event Action<IDialogResult> RequestClose;
|
||||
|
||||
/// <summary>
|
||||
/// 调用RequestClose
|
||||
/// </summary>
|
||||
/// <param name="dialogResult"></param>
|
||||
public void RaiseRequestClose(IDialogResult dialogResult)
|
||||
{
|
||||
RequestClose?.Invoke(dialogResult);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否关闭窗口
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool CanCloseDialog()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 关闭时触发
|
||||
/// </summary>
|
||||
public void OnDialogClosed()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开时触发
|
||||
/// </summary>
|
||||
/// <param name="parameters"></param>
|
||||
public virtual void OnDialogOpened(IDialogParameters parameters)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
101
OrpaonEMS.Core/Enums/BMSAlarmStateEnum.cs
Normal file
101
OrpaonEMS.Core/Enums/BMSAlarmStateEnum.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// BMS系统告警状态
|
||||
/// 告警的状态
|
||||
/// </summary>
|
||||
public enum BMSAlarmStateEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// 禁充标志
|
||||
/// </summary>
|
||||
StopCharg = 1,
|
||||
/// <summary>
|
||||
/// 禁放标志
|
||||
/// </summary>
|
||||
StopDisCharg = 2,
|
||||
/// <summary>
|
||||
/// 告警状态
|
||||
/// </summary>
|
||||
Alarm = 3,
|
||||
/// <summary>
|
||||
/// 充满状态
|
||||
/// </summary>
|
||||
Full = 4,
|
||||
/// <summary>
|
||||
/// 放空状态
|
||||
/// </summary>
|
||||
Empty = 5,
|
||||
/// <summary>
|
||||
/// 无报警
|
||||
/// </summary>
|
||||
NoAlarm = 5
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 电池簇电池状态
|
||||
/// </summary>
|
||||
public enum BMSStateEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// 初始化状态
|
||||
/// </summary>
|
||||
Initial = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 自检
|
||||
/// </summary>
|
||||
SelfTest = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 上电
|
||||
/// </summary>
|
||||
PowerOn = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 上电完成
|
||||
/// </summary>
|
||||
PowerOnCom = 4,
|
||||
|
||||
/// <summary>
|
||||
/// 禁充
|
||||
/// </summary>
|
||||
StopCharge = 5,
|
||||
|
||||
/// <summary>
|
||||
/// 禁放
|
||||
/// </summary>
|
||||
StopDisCharge = 6,
|
||||
|
||||
/// <summary>
|
||||
/// 待机
|
||||
/// </summary>
|
||||
Standby = 7,
|
||||
|
||||
/// <summary>
|
||||
/// 故障下电
|
||||
/// </summary>
|
||||
FaultPoweOff = 8,
|
||||
|
||||
/// <summary>
|
||||
/// 故障下电后故障已清除
|
||||
/// </summary>
|
||||
FaultClear = 9,
|
||||
|
||||
/// <summary>
|
||||
/// 测试模式
|
||||
/// </summary>
|
||||
TestMode = 10,
|
||||
|
||||
/// <summary>
|
||||
/// 单簇维护
|
||||
/// </summary>
|
||||
SingleMaintenance = 11,
|
||||
}
|
||||
}
|
||||
40
OrpaonEMS.Core/Enums/BmsState.cs
Normal file
40
OrpaonEMS.Core/Enums/BmsState.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// 英博定义的BMS状态
|
||||
/// </summary>
|
||||
public enum BmsState
|
||||
{
|
||||
/// <summary>
|
||||
/// 禁止充电
|
||||
/// </summary>
|
||||
StopChrg = 1,
|
||||
/// <summary>
|
||||
/// 禁止放电
|
||||
/// </summary>
|
||||
StopDisChrg = 2,
|
||||
/// <summary>
|
||||
/// 待机
|
||||
/// </summary>
|
||||
Standby = 3,
|
||||
/// <summary>
|
||||
/// 故障
|
||||
/// </summary>
|
||||
Fulat = 4,
|
||||
/// <summary>
|
||||
/// 正常
|
||||
/// </summary>
|
||||
Normal = 5,
|
||||
/// <summary>
|
||||
/// 报警
|
||||
/// </summary>
|
||||
Alarm = 6
|
||||
}
|
||||
|
||||
}
|
||||
39
OrpaonEMS.Core/Enums/CoolState.cs
Normal file
39
OrpaonEMS.Core/Enums/CoolState.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// 液冷工作状态
|
||||
/// </summary>
|
||||
public enum CoolState
|
||||
{
|
||||
/// <summary>
|
||||
/// 停机模式
|
||||
/// </summary>
|
||||
Stop = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 制冷模式
|
||||
/// </summary>
|
||||
Cool = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 加热模式
|
||||
/// </summary>
|
||||
Heat = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 自循环模式
|
||||
/// </summary>
|
||||
AutoCycle = 4,
|
||||
|
||||
/// <summary>
|
||||
/// 自动模式
|
||||
/// </summary>
|
||||
Auto = 5,
|
||||
}
|
||||
}
|
||||
39
OrpaonEMS.Core/Enums/ElePeakValley.cs
Normal file
39
OrpaonEMS.Core/Enums/ElePeakValley.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// 削峰填谷 状态机使用
|
||||
/// </summary>
|
||||
public enum ElePeakValley
|
||||
{
|
||||
/// <summary>
|
||||
/// 高峰模式
|
||||
/// </summary>
|
||||
TopPeak = 1,
|
||||
/// <summary>
|
||||
/// 峰模式
|
||||
/// </summary>
|
||||
Peak = 2,
|
||||
/// <summary>
|
||||
/// 谷模式
|
||||
/// </summary>
|
||||
Valley = 3,
|
||||
/// <summary>
|
||||
/// 平模式
|
||||
/// </summary>
|
||||
Flat = 4,
|
||||
/// <summary>
|
||||
/// 报警
|
||||
/// </summary>
|
||||
Alarm = 5,
|
||||
/// <summary>
|
||||
/// 初始状态
|
||||
/// </summary>
|
||||
Initialize = 10
|
||||
}
|
||||
}
|
||||
35
OrpaonEMS.Core/Enums/ElePeakValleyTrig.cs
Normal file
35
OrpaonEMS.Core/Enums/ElePeakValleyTrig.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// 削峰填谷触发器 状态机使用
|
||||
/// </summary>
|
||||
public enum ElePeakValleyTrig
|
||||
{
|
||||
/// <summary>
|
||||
/// 高峰模式
|
||||
/// </summary>
|
||||
TopPeakTrig = 1,
|
||||
/// <summary>
|
||||
/// 峰模式
|
||||
/// </summary>
|
||||
PeakTrig = 2,
|
||||
/// <summary>
|
||||
/// 谷模式
|
||||
/// </summary>
|
||||
ValleyTrig = 3,
|
||||
/// <summary>
|
||||
/// 平模式
|
||||
/// </summary>
|
||||
FlatTrig = 4,
|
||||
/// <summary>
|
||||
/// 报警
|
||||
/// </summary>
|
||||
AlarmTrig = 5
|
||||
}
|
||||
}
|
||||
50
OrpaonEMS.Core/Enums/EnergyStorageState.cs
Normal file
50
OrpaonEMS.Core/Enums/EnergyStorageState.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// 储能系统状态
|
||||
/// </summary>
|
||||
public enum EnergyStorageState
|
||||
{
|
||||
/// <summary>
|
||||
/// 初始化
|
||||
/// </summary>
|
||||
Inital = 10,
|
||||
|
||||
///// <summary>
|
||||
///// 充电
|
||||
///// </summary>
|
||||
//Charge = 1,
|
||||
|
||||
///// <summary>
|
||||
///// 放电
|
||||
///// </summary>
|
||||
//Discharge = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 待机
|
||||
/// </summary>
|
||||
Standby = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 报警
|
||||
/// </summary>
|
||||
Alarm = 4,
|
||||
|
||||
/// <summary>
|
||||
/// 等待指令
|
||||
/// </summary>
|
||||
ReadyCmd = 5,
|
||||
|
||||
/// <summary>
|
||||
/// 手动
|
||||
/// </summary>
|
||||
Hand = 6
|
||||
|
||||
}
|
||||
}
|
||||
45
OrpaonEMS.Core/Enums/EnergyStorageStateTrig.cs
Normal file
45
OrpaonEMS.Core/Enums/EnergyStorageStateTrig.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// 储能系统状态触发
|
||||
/// </summary>
|
||||
public enum EnergyStorageStateTrig
|
||||
{
|
||||
/// <summary>
|
||||
/// 充电触发
|
||||
/// </summary>
|
||||
InitalTrig = 1,
|
||||
|
||||
///// <summary>
|
||||
///// 放电触发
|
||||
///// </summary>
|
||||
//DischargeTrig = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 待机触发
|
||||
/// </summary>
|
||||
StandbyTrig = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 报警触发
|
||||
/// </summary>
|
||||
AlarmTrig = 4,
|
||||
|
||||
/// <summary>
|
||||
/// 等待指令模式触发
|
||||
/// </summary>
|
||||
ReadyCmdTrig = 5,
|
||||
|
||||
/// <summary>
|
||||
/// 手动触发
|
||||
/// </summary>
|
||||
HandTrig = 6
|
||||
|
||||
}
|
||||
}
|
||||
46
OrpaonEMS.Core/Enums/EnergyStoryageCmdState.cs
Normal file
46
OrpaonEMS.Core/Enums/EnergyStoryageCmdState.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// 储能当前的指令状态
|
||||
/// 只是标记指令的状态
|
||||
/// </summary>
|
||||
public enum EnergyStoryageCmdState
|
||||
{
|
||||
/// <summary>
|
||||
/// 无指令中
|
||||
/// </summary>
|
||||
NoCmd = 15,
|
||||
|
||||
/// <summary>
|
||||
/// 待机指令
|
||||
/// </summary>
|
||||
Standby = 12,
|
||||
|
||||
/// <summary>
|
||||
/// 充电指令中
|
||||
/// </summary>
|
||||
ChargeValue = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 放电指令中
|
||||
/// </summary>
|
||||
DischargeValue = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 全功率充电指令中
|
||||
/// </summary>
|
||||
FullCharge = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 全功率放电指令中
|
||||
/// </summary>
|
||||
FullDischarge = 4,
|
||||
|
||||
}
|
||||
}
|
||||
46
OrpaonEMS.Core/Enums/EnergyStoryageCmdStateTrig.cs
Normal file
46
OrpaonEMS.Core/Enums/EnergyStoryageCmdStateTrig.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// 储能当前的指令状态触发器
|
||||
/// 只是标记指令的状态
|
||||
/// </summary>
|
||||
public enum EnergyStoryageCmdStateTrig
|
||||
{
|
||||
/// <summary>
|
||||
/// 无指令中
|
||||
/// </summary>
|
||||
NoCmdTrig = 15,
|
||||
|
||||
/// <summary>
|
||||
/// 待机指令
|
||||
/// </summary>
|
||||
StandbyTrig = 12,
|
||||
|
||||
/// <summary>
|
||||
/// 充电指令中
|
||||
/// </summary>
|
||||
ChargeValueTrig = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 放电指令中
|
||||
/// </summary>
|
||||
DischargeValueTrig = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 全功率充电指令中
|
||||
/// </summary>
|
||||
FullChargeTrig = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 全功率放电指令中
|
||||
/// </summary>
|
||||
FullDischargeTrig = 4,
|
||||
|
||||
}
|
||||
}
|
||||
36
OrpaonEMS.Core/Enums/EnergyStoryageState.cs
Normal file
36
OrpaonEMS.Core/Enums/EnergyStoryageState.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 储能当前状态
|
||||
/// </summary>
|
||||
public enum EnergyStoryageState
|
||||
{
|
||||
/// <summary>
|
||||
/// 充电指令中
|
||||
/// </summary>
|
||||
ChargeValue = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 放电指令中
|
||||
/// </summary>
|
||||
DischargeValue = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 全功率充电指令中
|
||||
/// </summary>
|
||||
FullCharge = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 全功率放电指令中
|
||||
/// </summary>
|
||||
FullDischarge = 4,
|
||||
|
||||
}
|
||||
}
|
||||
18
OrpaonEMS.Core/Enums/IOType.cs
Normal file
18
OrpaonEMS.Core/Enums/IOType.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据读写类型
|
||||
/// </summary>
|
||||
public enum IOType
|
||||
{
|
||||
RW = 0,
|
||||
R = 1,
|
||||
W = 2
|
||||
}
|
||||
}
|
||||
30
OrpaonEMS.Core/Enums/LinkState.cs
Normal file
30
OrpaonEMS.Core/Enums/LinkState.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// 连接状态
|
||||
/// </summary>
|
||||
public enum LinkState
|
||||
{
|
||||
/// <summary>
|
||||
/// 初始状态
|
||||
/// </summary>
|
||||
Initial = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 连接OK
|
||||
/// </summary>
|
||||
LinkOK = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 连接NG
|
||||
/// </summary>
|
||||
LinkNG = 2,
|
||||
}
|
||||
|
||||
}
|
||||
24
OrpaonEMS.Core/Enums/LinkStateTrig.cs
Normal file
24
OrpaonEMS.Core/Enums/LinkStateTrig.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// 连接状态
|
||||
/// </summary>
|
||||
public enum LinkStateTrig
|
||||
{
|
||||
/// <summary>
|
||||
/// 连接OK触发器
|
||||
/// </summary>
|
||||
LinkOKTrig = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 连接NG触发器
|
||||
/// </summary>
|
||||
LinkNGTrig = 2,
|
||||
}
|
||||
}
|
||||
26
OrpaonEMS.Core/Enums/PCSOffLineInfo.cs
Normal file
26
OrpaonEMS.Core/Enums/PCSOffLineInfo.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// PCS并离网的配置
|
||||
/// </summary>
|
||||
public enum PCSOffLineInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 并网
|
||||
/// </summary>
|
||||
OnLine = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 离网
|
||||
/// </summary>
|
||||
OffLine = 1,
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
31
OrpaonEMS.Core/Enums/PCSState.cs
Normal file
31
OrpaonEMS.Core/Enums/PCSState.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// 英博PCS状态
|
||||
/// </summary>
|
||||
public enum PCSState
|
||||
{
|
||||
/// <summary>
|
||||
/// 初始状态
|
||||
/// </summary>
|
||||
Inital = 0,
|
||||
/// <summary>
|
||||
/// 停机状态
|
||||
/// </summary>
|
||||
Stop = 1,
|
||||
/// <summary>
|
||||
/// 待机状态
|
||||
/// </summary>
|
||||
Standby = 2,
|
||||
/// <summary>
|
||||
/// 运行
|
||||
/// </summary>
|
||||
Run = 3,
|
||||
}
|
||||
}
|
||||
31
OrpaonEMS.Core/Enums/PCSStateTrigger.cs
Normal file
31
OrpaonEMS.Core/Enums/PCSStateTrigger.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// 英博PCS状态
|
||||
/// </summary>
|
||||
public enum PCSStateTrigger
|
||||
{
|
||||
/// <summary>
|
||||
/// 初始状态
|
||||
/// </summary>
|
||||
InitalTrig = 6,
|
||||
/// <summary>
|
||||
/// 停机状态
|
||||
/// </summary>
|
||||
StopTrig = 1,
|
||||
/// <summary>
|
||||
/// 待机状态
|
||||
/// </summary>
|
||||
StandbyTrig = 2,
|
||||
/// <summary>
|
||||
/// 运行
|
||||
/// </summary>
|
||||
RunTrig = 3,
|
||||
}
|
||||
}
|
||||
24
OrpaonEMS.Core/Enums/PcsAlarmState.cs
Normal file
24
OrpaonEMS.Core/Enums/PcsAlarmState.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// PCS报警状态
|
||||
/// </summary>
|
||||
public enum PcsAlarmState
|
||||
{
|
||||
/// <summary>
|
||||
/// 报警中
|
||||
/// </summary>
|
||||
Alarm = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 正常
|
||||
/// </summary>
|
||||
Normal = 2,
|
||||
}
|
||||
}
|
||||
24
OrpaonEMS.Core/Enums/PcsFaultState.cs
Normal file
24
OrpaonEMS.Core/Enums/PcsFaultState.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// PCS故障状态
|
||||
/// </summary>
|
||||
public enum PcsFaultState
|
||||
{
|
||||
/// <summary>
|
||||
/// 故障中
|
||||
/// </summary>
|
||||
Fault = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 正常
|
||||
/// </summary>
|
||||
Normal = 2,
|
||||
}
|
||||
}
|
||||
25
OrpaonEMS.Core/Enums/PcsRemoteLocation.cs
Normal file
25
OrpaonEMS.Core/Enums/PcsRemoteLocation.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// PCS远程本地状态
|
||||
/// </summary>
|
||||
public enum PcsRemoteLocation
|
||||
{
|
||||
/// <summary>
|
||||
/// 远程
|
||||
/// </summary>
|
||||
Remote = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 本地
|
||||
/// </summary>
|
||||
Location = 2,
|
||||
}
|
||||
|
||||
}
|
||||
20
OrpaonEMS.Core/Enums/SysOnLineRunState.cs
Normal file
20
OrpaonEMS.Core/Enums/SysOnLineRunState.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// 系统在线运行状态
|
||||
/// </summary>
|
||||
public enum SysOnLineRunState
|
||||
{
|
||||
PeakValley,
|
||||
Timing,
|
||||
Alarm,
|
||||
Standby,
|
||||
Initialize
|
||||
}
|
||||
}
|
||||
20
OrpaonEMS.Core/Enums/SysOnLineRunTrigger.cs
Normal file
20
OrpaonEMS.Core/Enums/SysOnLineRunTrigger.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// 系统在线运行触发
|
||||
/// </summary>
|
||||
public enum SysOnLineRunTrigger
|
||||
{
|
||||
PeakValleyTrig,
|
||||
TimingTrig,
|
||||
AlarmTrig,
|
||||
InitializeTrig,
|
||||
StandbyTrig
|
||||
}
|
||||
}
|
||||
32
OrpaonEMS.Core/EventHandMsg/BmsAlarmCellEventHandMsg.cs
Normal file
32
OrpaonEMS.Core/EventHandMsg/BmsAlarmCellEventHandMsg.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.EventHandMsg
|
||||
{
|
||||
public class BmsAlarmCellEventHandMsg : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 报警状态
|
||||
/// </summary>
|
||||
public bool AlarmState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alarm等级
|
||||
/// </summary>
|
||||
public int AlarmLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alarm内容
|
||||
/// </summary>
|
||||
public string AlarmContent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alarm时间
|
||||
/// </summary>
|
||||
public DateTime AlarmTime { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
22
OrpaonEMS.Core/EventHandMsg/BmsEventHandMsg.cs
Normal file
22
OrpaonEMS.Core/EventHandMsg/BmsEventHandMsg.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.EventHandMsg
|
||||
{
|
||||
public class BmsEventHandMsg : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 消息类型
|
||||
/// Alarm
|
||||
/// </summary>
|
||||
public string MsgType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alarm状态
|
||||
/// </summary>
|
||||
public bool AlarmState { get; set; }
|
||||
}
|
||||
}
|
||||
22
OrpaonEMS.Core/EventHandMsg/CoolValue.cs
Normal file
22
OrpaonEMS.Core/EventHandMsg/CoolValue.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using OrpaonEMS.Core.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.EventHandMsg
|
||||
{
|
||||
public class CoolValue : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 指令
|
||||
/// </summary>
|
||||
public CoolState CmdType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 目标温度
|
||||
/// </summary>
|
||||
public double TargetTemp { get; set; }
|
||||
}
|
||||
}
|
||||
20
OrpaonEMS.Core/EventHandMsg/HourDataEventHandMsg.cs
Normal file
20
OrpaonEMS.Core/EventHandMsg/HourDataEventHandMsg.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using OrpaonEMS.Core.DbModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.EventHandMsg
|
||||
{
|
||||
/// <summary>
|
||||
/// 小时数据发布
|
||||
/// </summary>
|
||||
public class HourDataEventHandMsg : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 最新的12条数据
|
||||
/// </summary>
|
||||
//public List<HourData> hourData { get; set; }
|
||||
}
|
||||
}
|
||||
33
OrpaonEMS.Core/EventHandMsg/PcsAlarmCellEventHandMsg.cs
Normal file
33
OrpaonEMS.Core/EventHandMsg/PcsAlarmCellEventHandMsg.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using OrpaonEMS.Core.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.EventHandMsg
|
||||
{
|
||||
public class PcsAlarmCellEventHandMsg : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Alarm状态
|
||||
/// </summary>
|
||||
public bool State { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alarm等级
|
||||
/// </summary>
|
||||
public int Level { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alarm内容
|
||||
/// </summary>
|
||||
public string Content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 报警时间信息
|
||||
/// </summary>
|
||||
public AlarmTimeInfo CurTimeInfo { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
16
OrpaonEMS.Core/FSqlContext.cs
Normal file
16
OrpaonEMS.Core/FSqlContext.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core
|
||||
{
|
||||
public class FSqlContext
|
||||
{
|
||||
public static IFreeSql FDb = new FreeSql.FreeSqlBuilder()
|
||||
.UseConnectionString(FreeSql.DataType.SqlServer, ConfigHelper.GetValue("connecting"))
|
||||
.UseAutoSyncStructure(true) //自动同步实体结构到数据库
|
||||
.Build(); //请务必定义成 Singleton 单例模式
|
||||
}
|
||||
}
|
||||
50
OrpaonEMS.Core/Model/AlarmTimeInfo.cs
Normal file
50
OrpaonEMS.Core/Model/AlarmTimeInfo.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// 报警时间信息
|
||||
/// </summary>
|
||||
public class AlarmTimeInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 开始报警
|
||||
/// </summary>
|
||||
public DateTime StartTime { set; get; }
|
||||
|
||||
|
||||
private DateTime _EndTime;
|
||||
/// <summary>
|
||||
/// 结束报警
|
||||
/// </summary>
|
||||
public DateTime EndTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return _EndTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
_EndTime = value;
|
||||
this.AlarmDur = (EndTime - StartTime).TotalMinutes;
|
||||
}
|
||||
}
|
||||
|
||||
private double _AlarmDur;
|
||||
public double AlarmDur
|
||||
{
|
||||
get
|
||||
{
|
||||
return _AlarmDur;
|
||||
}
|
||||
set
|
||||
{
|
||||
_AlarmDur = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
OrpaonEMS.Core/Model/BmsRtAlarmModel.cs
Normal file
31
OrpaonEMS.Core/Model/BmsRtAlarmModel.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Model
|
||||
{
|
||||
public class BmsRtAlarmModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 报警状态
|
||||
/// </summary>
|
||||
public bool AlarmState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alarm等级
|
||||
/// </summary>
|
||||
public int AlarmLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alarm内容
|
||||
/// </summary>
|
||||
public string AlarmContent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alarm时间
|
||||
/// </summary>
|
||||
public DateTime AlarmTime { get; set; }
|
||||
}
|
||||
}
|
||||
78
OrpaonEMS.Core/Model/LinkStateModel.cs
Normal file
78
OrpaonEMS.Core/Model/LinkStateModel.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// 连接状态模型
|
||||
/// 有些设备有时候会出现一次连接失败,但是下一次就会连接成功,那么不能判断为连接失败
|
||||
/// </summary>
|
||||
public class LinkStateModel : BindableBase
|
||||
{
|
||||
public LinkStateModel()
|
||||
{
|
||||
_LinkState = true;
|
||||
}
|
||||
|
||||
|
||||
private string _BmsLinkStateMsg = "失败";
|
||||
/// <summary>
|
||||
/// Bms通信状态Msg
|
||||
/// </summary>
|
||||
public string BmsLinkStateMsg
|
||||
{
|
||||
get { return _BmsLinkStateMsg; }
|
||||
set { _BmsLinkStateMsg = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
private bool _LinkState;
|
||||
/// <summary>
|
||||
/// 通信连接状态
|
||||
/// </summary>
|
||||
public bool LinkState
|
||||
{
|
||||
get { return _LinkState; }
|
||||
set
|
||||
{
|
||||
if (_LinkState != value)
|
||||
{
|
||||
if (value)//改变后连接成功
|
||||
{
|
||||
//连接成功了就把报错的设置为0
|
||||
LinkErrCount = 0;
|
||||
BmsLinkStateMsg = "正常";
|
||||
_LinkState = value;
|
||||
}
|
||||
else//改变后连接失败
|
||||
{
|
||||
//
|
||||
LinkErrCount = LinkErrCount + 1;
|
||||
if (LinkErrCount >= 3)//连续达到三次算作报错
|
||||
{
|
||||
BmsLinkStateMsg = "失败";
|
||||
//连接失败
|
||||
_LinkState = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//小于三次的话则判定为没有问题
|
||||
_LinkState = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通信连接失败次数
|
||||
/// </summary>
|
||||
public int LinkErrCount { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
81
OrpaonEMS.Core/Model/TranceCmdValue.cs
Normal file
81
OrpaonEMS.Core/Model/TranceCmdValue.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// 追踪指令值的模型
|
||||
/// </summary>
|
||||
public class TranceCmdValue
|
||||
{
|
||||
/// <summary>
|
||||
/// 实例化函数
|
||||
/// </summary>
|
||||
/// <param name="changeThreshold"></param>
|
||||
public TranceCmdValue(double changeThreshold)
|
||||
{
|
||||
ChangeThreshold = changeThreshold;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 变化的阀值
|
||||
/// </summary>
|
||||
public double ChangeThreshold { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 事件
|
||||
/// </summary>
|
||||
public event EventHandler<double> CmdValueChanged;
|
||||
|
||||
|
||||
private double _CmdValue;
|
||||
/// <summary>
|
||||
/// 指令值
|
||||
/// 可实时赋值
|
||||
/// </summary>
|
||||
public double CmdValue
|
||||
{
|
||||
get { return _CmdValue; }
|
||||
set
|
||||
{
|
||||
//发送0,代表是待机,此时不需要看变化了,防止上一个值在0附近,没有触发变化,还是输出一个靠近0的值出去
|
||||
if (value == 0 && value != _CmdValue)//value != _CmdValue 防止一直0值导致不停是Invoke事件
|
||||
{
|
||||
_CmdValue = value;
|
||||
//超过变化的阀值,可以触发动作 BeginInvoke 换 Invoke 可能导致问题
|
||||
CmdValueChanged.Invoke(this, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (value != _CmdValue && GetChange(value, _CmdValue))
|
||||
{
|
||||
_CmdValue = value;
|
||||
//超过变化的阀值,可以触发动作
|
||||
CmdValueChanged.Invoke(this, value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否超过某个阀值数据
|
||||
/// </summary>
|
||||
/// <param name="newValue"></param>
|
||||
/// <param name="oldValue"></param>
|
||||
/// <returns></returns>
|
||||
private bool GetChange(double newValue, double oldValue)
|
||||
{
|
||||
if (Math.Abs(newValue - oldValue) >= ChangeThreshold)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
46
OrpaonEMS.Core/NavigationViewModel.cs
Normal file
46
OrpaonEMS.Core/NavigationViewModel.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using Prism.Mvvm;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 导航的基类
|
||||
/// </summary>
|
||||
public class NavigationViewModel : BindableBase, INavigationAware
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否重用导航对象
|
||||
/// </summary>
|
||||
/// <param name="navigationContext"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool IsNavigationTarget(NavigationContext navigationContext)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导航被切换触发
|
||||
/// </summary>
|
||||
/// <param name="navigationContext"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public virtual void OnNavigatedFrom(NavigationContext navigationContext)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导航被执行触发
|
||||
/// </summary>
|
||||
/// <param name="navigationContext"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public virtual void OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
20
OrpaonEMS.Core/OrpaonEMS.Core.csproj
Normal file
20
OrpaonEMS.Core/OrpaonEMS.Core.csproj
Normal file
@@ -0,0 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FreeSql" Version="3.2.820" />
|
||||
<PackageReference Include="Prism.DryIoc" Version="8.1.97" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Extensions\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OrpaonEMS.Model\OrpaonEMS.Model.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
33
OrpaonEMS.Core/cbxItem.cs
Normal file
33
OrpaonEMS.Core/cbxItem.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrpaonEMS.Core
|
||||
{
|
||||
public class cbxItem : BindableBase
|
||||
{
|
||||
private string key;
|
||||
/// <summary>
|
||||
/// Key值
|
||||
/// </summary>
|
||||
public string Key
|
||||
{
|
||||
get { return key; }
|
||||
set { key = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
private string text;
|
||||
/// <summary>
|
||||
/// Text值
|
||||
/// </summary>
|
||||
public string Text
|
||||
{
|
||||
get { return text; }
|
||||
set { text = value; RaisePropertyChanged(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user