添加消防controller,配置文件添加消防是否连接

master
CZ 5 months ago
parent 8a62aaf84a
commit 47447648c1

@ -1,10 +1,12 @@
using HybirdFrameworkCore.Const; using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.Const;
using HybirdFrameworkDriver.ModbusTcpMaster; using HybirdFrameworkDriver.ModbusTcpMaster;
using log4net; using log4net;
using Service.FireControl.Msg; using Service.FireControl.Msg;
namespace Service.FireControl.Client; namespace Service.FireControl.Client;
[Scope]
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));
@ -58,10 +60,6 @@ public class FireControlClient: ModbusTcpMaster
{ {
ModbusDecoder.Decode<Subzone8>(bytes08, FireControlMgr.Subzone8, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC); ModbusDecoder.Decode<Subzone8>(bytes08, FireControlMgr.Subzone8, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
} }
if (bytes02 != null)
{
ModbusDecoder.Decode<Subzone2>(bytes02, FireControlMgr.Subzone2, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
}
if (bytes09 != null) if (bytes09 != null)
{ {
ModbusDecoder.Decode<Subzone9>(bytes09, FireControlMgr.Subzone9, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC); ModbusDecoder.Decode<Subzone9>(bytes09, FireControlMgr.Subzone9, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);

@ -35,7 +35,7 @@ public class FireControlMgr
/// </summary> /// </summary>
/// <param name="no"></param> /// <param name="no"></param>
/// <returns></returns> /// <returns></returns>
public bool WriteExtinguisherOn(int no) public static bool WriteExtinguisherOn(int no)
{ {
if (FireControlClient != null) if (FireControlClient != null)
{ {
@ -309,7 +309,7 @@ public class FireControlMgr
/// </summary> /// </summary>
/// <param name="no"></param> /// <param name="no"></param>
/// <returns></returns> /// <returns></returns>
public bool WriteExtinguisherOff(int no) public static bool WriteExtinguisherOff(int no)
{ {
if (FireControlClient != null) if (FireControlClient != null)
{ {
@ -583,7 +583,7 @@ public class FireControlMgr
/// 复位开 /// 复位开
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public bool ResettingOn() public static bool ResettingOn()
{ {
if (FireControlClient != null) if (FireControlClient != null)
{ {
@ -599,7 +599,7 @@ public class FireControlMgr
/// 复位关 /// 复位关
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public bool ResettingOff() public static bool ResettingOff()
{ {
if (FireControlClient != null) if (FireControlClient != null)
{ {
@ -615,7 +615,7 @@ public class FireControlMgr
/// 消报警音开 /// 消报警音开
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public bool MuteAlarmToneOn() public static bool MuteAlarmToneOn()
{ {
if (FireControlClient != null) if (FireControlClient != null)
{ {
@ -631,7 +631,7 @@ public class FireControlMgr
/// 消报警音关 /// 消报警音关
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public bool MuteAlarmToneOff() public static bool MuteAlarmToneOff()
{ {
if (FireControlClient != null) if (FireControlClient != null)
{ {
@ -647,7 +647,7 @@ public class FireControlMgr
/// 自检开 /// 自检开
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public bool SelfInspectionOn() public static bool SelfInspectionOn()
{ {
if (FireControlClient != null) if (FireControlClient != null)
{ {
@ -663,7 +663,7 @@ public class FireControlMgr
/// 自检关 /// 自检关
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public bool SelfInspectionOff() public static bool SelfInspectionOff()
{ {
if (FireControlClient != null) if (FireControlClient != null)
{ {
@ -679,7 +679,7 @@ public class FireControlMgr
/// 声光报警 /// 声光报警
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public bool AudibleVisualAlarmOn() public static bool AudibleVisualAlarmOn()
{ {
if (FireControlClient != null) if (FireControlClient != null)
{ {
@ -695,7 +695,7 @@ public class FireControlMgr
/// 声光报警 /// 声光报警
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public bool AudibleVisualAlarmOff() public static bool AudibleVisualAlarmOff()
{ {
if (FireControlClient != null) if (FireControlClient != null)
{ {
@ -711,7 +711,7 @@ public class FireControlMgr
/// 手动模式 /// 手动模式
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public bool ManualModeOn() public static bool ManualModeOn()
{ {
if (FireControlClient != null) if (FireControlClient != null)
{ {
@ -727,7 +727,7 @@ public class FireControlMgr
/// 手动模式 /// 手动模式
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public bool ManualModeOff() public static bool ManualModeOff()
{ {
if (FireControlClient != null) if (FireControlClient != null)
{ {
@ -743,7 +743,7 @@ public class FireControlMgr
/// 自动模式开 /// 自动模式开
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public bool AutomaticModeOn() public static bool AutomaticModeOn()
{ {
if (FireControlClient != null) if (FireControlClient != null)
{ {
@ -759,7 +759,7 @@ public class FireControlMgr
/// 自动模式关 /// 自动模式关
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public bool AutomaticModeOff() public static bool AutomaticModeOff()
{ {
if (FireControlClient != null) if (FireControlClient != null)
{ {

@ -0,0 +1,182 @@
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc;
using Service.FireControl.Client;
namespace WebStarter.Controllers;
/// <summary>
/// 消防控制
/// </summary>
[ApiController]
[Route("api/[controller]")]
public class FireControlController
{
/// <summary>
/// 分区灭火器开
/// </summary>
/// <param name="removeBinNo"></param>
/// <param name="putBinNo"></param>
/// <returns></returns>
[HttpGet("WriteExtinguisherOn/{id}")]
public Result<bool> WriteExtinguisherOn(int id)
{
return Result<bool>.Success(FireControlMgr.WriteExtinguisherOn(id));
}
/// <summary>
/// 分区灭火器关
/// </summary>
/// <param name="removeBinNo"></param>
/// <param name="putBinNo"></param>
/// <returns></returns>
[HttpGet("WriteExtinguisherOff/{id}")]
public Result<bool> WriteExtinguisherOff(int id)
{
return Result<bool>.Success(FireControlMgr.WriteExtinguisherOff(id));
}
/// <summary>
/// 复位开
/// </summary>
/// <param name="removeBinNo"></param>
/// <param name="putBinNo"></param>
/// <returns></returns>
[HttpGet("ResettingOn")]
public Result<bool> ResettingOn()
{
return Result<bool>.Success(FireControlMgr.ResettingOn());
}
/// <summary>
/// 复位关
/// </summary>
/// <param name="removeBinNo"></param>
/// <param name="putBinNo"></param>
/// <returns></returns>
[HttpGet("ResettingOff")]
public Result<bool> ResettingOff()
{
return Result<bool>.Success(FireControlMgr.ResettingOff());
}
/// <summary>
/// 报警消音开
/// </summary>
/// <param name="removeBinNo"></param>
/// <param name="putBinNo"></param>
/// <returns></returns>
[HttpGet("MuteAlarmToneOn")]
public Result<bool> MuteAlarmToneOn()
{
return Result<bool>.Success(FireControlMgr.MuteAlarmToneOn());
}
/// <summary>
/// 报警消音关
/// </summary>
/// <param name="removeBinNo"></param>
/// <param name="putBinNo"></param>
/// <returns></returns>
[HttpGet("MuteAlarmToneOff")]
public Result<bool> MuteAlarmToneOff()
{
return Result<bool>.Success(FireControlMgr.MuteAlarmToneOff());
}
/// <summary>
/// 自检关
/// </summary>
/// <param name="removeBinNo"></param>
/// <param name="putBinNo"></param>
/// <returns></returns>
[HttpGet("SelfInspectionOn")]
public Result<bool> SelfInspectionOn()
{
return Result<bool>.Success(FireControlMgr.SelfInspectionOn());
}
/// <summary>
/// 自检关
/// </summary>
/// <param name="removeBinNo"></param>
/// <param name="putBinNo"></param>
/// <returns></returns>
[HttpGet("SelfInspectionOff")]
public Result<bool> SelfInspectionOff()
{
return Result<bool>.Success(FireControlMgr.SelfInspectionOff());
}
/// <summary>
/// 声光报警开
/// </summary>
/// <param name="removeBinNo"></param>
/// <param name="putBinNo"></param>
/// <returns></returns>
[HttpGet("AudibleVisualAlarmOn")]
public Result<bool> AudibleVisualAlarmOn()
{
return Result<bool>.Success(FireControlMgr.AudibleVisualAlarmOn());
}
/// <summary>
/// 声光报警关
/// </summary>
/// <param name="removeBinNo"></param>
/// <param name="putBinNo"></param>
/// <returns></returns>
[HttpGet("AudibleVisualAlarmOff")]
public Result<bool> AudibleVisualAlarmOff()
{
return Result<bool>.Success(FireControlMgr.AudibleVisualAlarmOff());
}
/// <summary>
/// 手动模式开
/// </summary>
/// <param name="removeBinNo"></param>
/// <param name="putBinNo"></param>
/// <returns></returns>
[HttpGet("ManualModeOn")]
public Result<bool> ManualModeOn()
{
return Result<bool>.Success(FireControlMgr.ManualModeOn());
}
/// <summary>
/// 手动模式关
/// </summary>
/// <param name="removeBinNo"></param>
/// <param name="putBinNo"></param>
/// <returns></returns>
[HttpGet("ManualModeOff")]
public Result<bool> ManualModeOff()
{
return Result<bool>.Success(FireControlMgr.ManualModeOff());
}
/// <summary>
/// 自动模式关
/// </summary>
/// <param name="removeBinNo"></param>
/// <param name="putBinNo"></param>
/// <returns></returns>
[HttpGet("AutomaticModeOn")]
public Result<bool> AutomaticModeOn()
{
return Result<bool>.Success(FireControlMgr.AutomaticModeOn());
}
/// <summary>
/// 自动模式关
/// </summary>
/// <param name="removeBinNo"></param>
/// <param name="putBinNo"></param>
/// <returns></returns>
[HttpGet("AutomaticModeOff")]
public Result<bool> AutomaticModeOff()
{
return Result<bool>.Success(FireControlMgr.AutomaticModeOff());
}
}

@ -120,7 +120,10 @@
"enable": true "enable": true
}, },
"task": { "task": {
"enable": true "enable": false
},
"fire": {
"enable": false
}, },
"Task": { "Task": {
"Disabled": "ChargeOrderUploadTask" "Disabled": "ChargeOrderUploadTask"

Loading…
Cancel
Save