|
|
@ -1,7 +1,10 @@
|
|
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
|
|
using Common.Const;
|
|
|
|
|
|
|
|
using Entity.DbModel.Station;
|
|
|
|
|
|
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
|
|
using HybirdFrameworkCore.Const;
|
|
|
|
using HybirdFrameworkCore.Const;
|
|
|
|
using HybirdFrameworkDriver.ModbusTcpMaster;
|
|
|
|
using HybirdFrameworkDriver.ModbusTcpMaster;
|
|
|
|
using log4net;
|
|
|
|
using log4net;
|
|
|
|
|
|
|
|
using Repository.Station;
|
|
|
|
using Service.FireControl.Msg;
|
|
|
|
using Service.FireControl.Msg;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Service.FireControl.Client;
|
|
|
|
namespace Service.FireControl.Client;
|
|
|
@ -10,6 +13,9 @@ namespace Service.FireControl.Client;
|
|
|
|
public class FireControlClient: ModbusTcpMaster
|
|
|
|
public class FireControlClient: ModbusTcpMaster
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(FireControlClient));
|
|
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(FireControlClient));
|
|
|
|
|
|
|
|
public EquipAlarmDefineRepository EquipAlarmDefineRepository { get; set; }
|
|
|
|
|
|
|
|
public EquipAlarmRecordRepository EquipAlarmRecordRepository { get; set; }
|
|
|
|
|
|
|
|
public EquipAlarmProcessRecordRepository EquipAlarmProcessRecordRepository { get; set; }
|
|
|
|
public FireControlClient()
|
|
|
|
public FireControlClient()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ReadAction = BatchRead;
|
|
|
|
ReadAction = BatchRead;
|
|
|
@ -23,16 +29,40 @@ public class FireControlClient: ModbusTcpMaster
|
|
|
|
|
|
|
|
|
|
|
|
private void BatchRead(ModbusTcpMaster master)
|
|
|
|
private void BatchRead(ModbusTcpMaster master)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
//1电表
|
|
|
|
|
|
|
|
//2消防
|
|
|
|
|
|
|
|
//3温湿度
|
|
|
|
Log.Info("fire start read");
|
|
|
|
Log.Info("fire start read");
|
|
|
|
var bytes02 = master.ReadCoil("0x0000", 17).Content;//0x01
|
|
|
|
|
|
|
|
var bytes03 = master.BatchReadHolderRegister(1, 3);//0x03 读1 3
|
|
|
|
#region 电表
|
|
|
|
var bytes04 = master.BatchReadHolderRegister(0x0100, 383);//0x03 读256 383
|
|
|
|
|
|
|
|
var bytes05 = master.BatchReadHolderRegister(1, 115);//0x04 可以
|
|
|
|
var readPowerValue = master.Read("x=3;39424", 4).Content;
|
|
|
|
|
|
|
|
if (readPowerValue != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ModbusDecoder.Decode<PowerValue>(readPowerValue, FireControlMgr.PowerValue, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 温湿度
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var readTem = master.Read("s=3;x=3;0", 2).Content;
|
|
|
|
|
|
|
|
if (readTem!=null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ModbusDecoder.Decode<TemperatureHumidity>(readTem, FireControlMgr.TemperatureHumidity, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var bytes02 = master.ReadCoil("s=2;x=1;0", 17).Content;//0x01
|
|
|
|
|
|
|
|
var bytes03 = master.Read("s=2;x=3;1", 3).Content;//0x03 读1 3
|
|
|
|
|
|
|
|
var bytes04 = master.Read("s=2;x=3;257", 383).Content;//0x03 读256 383
|
|
|
|
|
|
|
|
var bytes05 = master.Read("s=2;x=4;1", 115).Content;//0x04 可以
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<byte> bytes06=new List<byte>();//= master.BatchReadHolderRegister(0x0800, 2048);//0x04 可以
|
|
|
|
List<byte> bytes06=new List<byte>();//= master.BatchReadHolderRegister(0x0800, 2048);//0x04 可以
|
|
|
|
var bytesAdd1 = master.BatchReadHolderRegister(0x0800, 1000);//0x04 可以
|
|
|
|
var bytesAdd1 = master.Read("s=2;x=4;2048", 1000).Content;//0x04 可以
|
|
|
|
var bytesAdd2 = master.BatchReadHolderRegister(3048, 1048);//0x04 可以
|
|
|
|
var bytesAdd2 = master.Read("s=2;x=4;3048", 1048).Content;//0x04 可以
|
|
|
|
if (bytesAdd1 != null && bytesAdd2 != null)
|
|
|
|
if (bytesAdd1 != null && bytesAdd2 != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bytes06.AddRange(bytesAdd1);
|
|
|
|
bytes06.AddRange(bytesAdd1);
|
|
|
@ -40,115 +70,199 @@ public class FireControlClient: ModbusTcpMaster
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var bytes07 = master.BatchReadHolderRegister(0x1000, 32);//0x04 可以
|
|
|
|
var bytes07 = master.Read("s=2;x=4;4096", 32).Content;//0x04 可以
|
|
|
|
var bytes08 = master.BatchReadHolderRegister(0x0000, 134);//0x05 写
|
|
|
|
var bytes08 = master.Read("s=2;x=5;0", 134).Content;//0x05 写
|
|
|
|
var bytes09 = master.BatchReadHolderRegister(0x0100, 64);//0x06 写
|
|
|
|
var bytes09 = master.Read("s=2;x=6;256", 64).Content;//0x06 写
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
if (bytes02 != null)
|
|
|
|
if (bytes02 != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Log.Info("fire read bytes02 success");
|
|
|
|
|
|
|
|
//ModbusDecoder.Decode<Subzone2Resp>(bytes02, FireControlMgr.Subzone2Resp, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.GiveAnAlarm.Value = bytes02[0];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.NumberOfFailures.Value = bytes02[1];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.SoundSuppression.Value = bytes02[2];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.SelfInspection.Value = bytes02[3];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.MainPower.Value = bytes02[4];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.PowerSupplyBackup.Value = bytes02[5];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.BackupPowerUnderpowered.Value = bytes02[6];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.AutomaticMode.Value = bytes02[7];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.ManualMode.Value = bytes02[8];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.ManualStart.Value = bytes02[9];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.ManualScram.Value = bytes02[10];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.StartUpControl.Value = bytes02[11];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.Delay.Value = bytes02[12];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.PrimingSpray.Value = bytes02[13];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.Spray.Value = bytes02[14];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.AudibleVisualAlarmStatus.Value = bytes02[15];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.DeflatedDoNotEnter.Value = bytes02[16];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Log.Info($"fire read bytes02 erroe{e}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (bytes03 != null)
|
|
|
|
Log.Info("fire read bytes02 success");
|
|
|
|
{
|
|
|
|
FireControlMgr.Subzone2.GiveAnAlarm.Value = bytes02[0];
|
|
|
|
ModbusDecoder.Decode<Subzone3>(bytes03, FireControlMgr.Subzone3, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
FireControlMgr.Subzone2.NumberOfFailures.Value = bytes02[1];
|
|
|
|
}
|
|
|
|
FireControlMgr.Subzone2.SoundSuppression.Value = bytes02[2];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.SelfInspection.Value = bytes02[3];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.MainPower.Value = bytes02[4];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.PowerSupplyBackup.Value = bytes02[5];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.BackupPowerUnderpowered.Value = bytes02[6];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.AutomaticMode.Value = bytes02[7];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.ManualMode.Value = bytes02[8];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.ManualStart.Value = bytes02[9];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.ManualScram.Value = bytes02[10];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.StartUpControl.Value = bytes02[11];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.Delay.Value = bytes02[12];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.PrimingSpray.Value = bytes02[13];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.Spray.Value = bytes02[14];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.AudibleVisualAlarmStatus.Value = bytes02[15];
|
|
|
|
|
|
|
|
FireControlMgr.Subzone2.DeflatedDoNotEnter.Value = bytes02[16];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
|
|
|
|
|
|
if (bytes03 != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Log.Info($"fire read bytes03 erroe{e}");
|
|
|
|
ModbusDecoder.Decode<Subzone3>(bytes03, FireControlMgr.Subzone3, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
try
|
|
|
|
|
|
|
|
|
|
|
|
if (bytes04 != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (bytes04 != null)
|
|
|
|
ModbusDecoder.Decode<Subzone4>(bytes04, FireControlMgr.Subzone4, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
|
|
|
|
List<string> faultList = new List<string>()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ModbusDecoder.Decode<Subzone4>(bytes04, FireControlMgr.Subzone4, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber01.Value.ToString()},
|
|
|
|
}
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber02.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber03.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber04.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber05.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber06.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber07.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber08.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber09.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber10.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber11.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber12.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber13.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber14.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber15.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber16.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber17.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber18.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber19.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber20.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber21.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber22.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber23.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber24.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber25.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber26.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber27.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber28.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber29.Value.ToString()},
|
|
|
|
|
|
|
|
{FireControlMgr.Subzone4.EquipmentNumber30.Value.ToString()},
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
SaveAlarmInfo(faultList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
|
|
|
|
|
|
if (bytes05 != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Log.Info($"fire read bytes04 erroe{e}");
|
|
|
|
ModbusDecoder.Decode<Subzone5>(bytes05, FireControlMgr.Subzone5, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
try
|
|
|
|
|
|
|
|
|
|
|
|
if (bytes06 != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (bytes05 != null)
|
|
|
|
ModbusDecoder.Decode<Subzone6>(bytes06.ToArray(), FireControlMgr.Subzone6, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
{
|
|
|
|
|
|
|
|
ModbusDecoder.Decode<Subzone5>(bytes05, FireControlMgr.Subzone5, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
|
|
|
|
|
|
if (bytes07 != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Log.Info($"fire read bytes05 erroe{e}");
|
|
|
|
ModbusDecoder.Decode<Subzone7>(bytes07, FireControlMgr.Subzone7, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
try
|
|
|
|
|
|
|
|
|
|
|
|
/*if (bytes08 != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (bytes06 != null)
|
|
|
|
ModbusDecoder.Decode<Subzone8>(bytes08, FireControlMgr.Subzone8, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
{
|
|
|
|
|
|
|
|
ModbusDecoder.Decode<Subzone6>(bytes06.ToArray(), FireControlMgr.Subzone6, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
|
|
|
|
|
|
if (bytes09 != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Log.Info($"fire read bytes06 erroe{e}");
|
|
|
|
ModbusDecoder.Decode<Subzone9>(bytes09, FireControlMgr.Subzone9, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
try
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void SaveAlarmInfo(List<string> lstAlarm)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (lstAlarm.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
#region 有报警比较两边差异,新出现的报警就添加,消失的报警就处理并记录
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var lstEquipAlarmRecord = EquipAlarmRecordRepository.QueryListByClause(i => i.EquipTypeCode == (int)EquipmentType.Fire);
|
|
|
|
|
|
|
|
var sqllstAlarm = lstEquipAlarmRecord.Select(obj => obj.ErrorCode).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
if (bytes07 != null)
|
|
|
|
// 找出实时报警中存在但数据库中不存在的元素
|
|
|
|
|
|
|
|
List<string> uniqueToList1 = lstAlarm.Except(sqllstAlarm).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 找出数据库中存在但实时报警中不存在的元素
|
|
|
|
|
|
|
|
List<string> uniqueToList2 = sqllstAlarm.Except(lstAlarm).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (uniqueToList1.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ModbusDecoder.Decode<Subzone7>(bytes07, FireControlMgr.Subzone7, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
//这里要添加新的报警数据
|
|
|
|
|
|
|
|
foreach (var errorCode in uniqueToList1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (errorCode != "0")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
EquipAlarmDefine? alarmDefine =
|
|
|
|
|
|
|
|
EquipAlarmDefineRepository.QueryByClause(i=>i.EquipTypeCode==(int)EquipmentType.Fire&&i.ErrorCode==errorCode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (alarmDefine != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
EquipAlarmRecord record = new EquipAlarmRecord()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
EquipTypeCode = alarmDefine.EquipTypeCode,
|
|
|
|
|
|
|
|
EquipCode = alarmDefine.EquipCode,
|
|
|
|
|
|
|
|
ErrorCode = alarmDefine.ErrorCode,
|
|
|
|
|
|
|
|
ErrorLevel = alarmDefine.ErrorLevel,
|
|
|
|
|
|
|
|
ErrorMsg = alarmDefine.ErrorMsg,
|
|
|
|
|
|
|
|
ProcessMethod = alarmDefine.ProcessMethod,
|
|
|
|
|
|
|
|
StartTime = DateTime.Now
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
EquipAlarmRecordRepository.Insert(record);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
if (uniqueToList2.Count > 0)
|
|
|
|
{
|
|
|
|
|
|
|
|
Log.Info($"fire read bytes07 erroe{e}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (bytes08 != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ModbusDecoder.Decode<Subzone8>(bytes08, FireControlMgr.Subzone8, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
//这些是要清除实时报警,并且处理记录的。
|
|
|
|
|
|
|
|
// 使用LINQ找出ErrorCode在uniqueToList2中的EquipAlarmRecord对象
|
|
|
|
|
|
|
|
List<EquipAlarmRecord> filteredObjectList = lstEquipAlarmRecord
|
|
|
|
|
|
|
|
.Where(obj => uniqueToList2.Contains(obj.ErrorCode))
|
|
|
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
foreach (var VARIABLE in filteredObjectList)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
EquipAlarmProcessRecord EquipAlarmProcessRecord = new EquipAlarmProcessRecord();
|
|
|
|
|
|
|
|
EquipAlarmProcessRecord.EquipTypeCode = VARIABLE.EquipTypeCode;
|
|
|
|
|
|
|
|
EquipAlarmProcessRecord.EquipCode = VARIABLE.EquipCode;
|
|
|
|
|
|
|
|
EquipAlarmProcessRecord.ErrorCode = VARIABLE.ErrorCode;
|
|
|
|
|
|
|
|
EquipAlarmProcessRecord.ErrorLevel = VARIABLE.ErrorLevel;
|
|
|
|
|
|
|
|
EquipAlarmProcessRecord.ErrorMsg = VARIABLE.ErrorMsg;
|
|
|
|
|
|
|
|
EquipAlarmProcessRecord.ProcessMethod = VARIABLE.ProcessMethod;
|
|
|
|
|
|
|
|
EquipAlarmProcessRecord.StartTime = VARIABLE.StartTime;
|
|
|
|
|
|
|
|
EquipAlarmProcessRecord.ProcessTime = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EquipAlarmProcessRecordRepository.Insert(EquipAlarmProcessRecord);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EquipAlarmRecordRepository.Delete(filteredObjectList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
else
|
|
|
|
{
|
|
|
|
|
|
|
|
Log.Info($"fire read bytes08 erroe{e}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (bytes09 != null)
|
|
|
|
#region 没报警把已处理记录更新并删除实时报警
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var lstEquipAlarmRecord = EquipAlarmRecordRepository.QueryListByClause(i => i.EquipTypeCode == 3);
|
|
|
|
|
|
|
|
if (lstEquipAlarmRecord.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ModbusDecoder.Decode<Subzone9>(bytes09, FireControlMgr.Subzone9, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
foreach (var VARIABLE in lstEquipAlarmRecord)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
EquipAlarmProcessRecord EquipAlarmProcessRecord = new EquipAlarmProcessRecord();
|
|
|
|
|
|
|
|
EquipAlarmProcessRecord.EquipTypeCode = VARIABLE.EquipTypeCode;
|
|
|
|
|
|
|
|
EquipAlarmProcessRecord.EquipCode = VARIABLE.EquipCode;
|
|
|
|
|
|
|
|
EquipAlarmProcessRecord.ErrorCode = VARIABLE.ErrorCode;
|
|
|
|
|
|
|
|
EquipAlarmProcessRecord.ErrorLevel = VARIABLE.ErrorLevel;
|
|
|
|
|
|
|
|
EquipAlarmProcessRecord.ErrorMsg = VARIABLE.ErrorMsg;
|
|
|
|
|
|
|
|
EquipAlarmProcessRecord.ProcessMethod = VARIABLE.ProcessMethod;
|
|
|
|
|
|
|
|
EquipAlarmProcessRecord.StartTime = VARIABLE.StartTime;
|
|
|
|
|
|
|
|
EquipAlarmProcessRecord.ProcessTime = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EquipAlarmProcessRecordRepository.Insert(EquipAlarmProcessRecord);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
EquipAlarmRecordRepository.Delete(lstEquipAlarmRecord);
|
|
|
|
{
|
|
|
|
|
|
|
|
Log.Info($"fire read bytes02 erroe{e}");
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|