启动换电和卷帘门接口

master
xjl 4 months ago
parent 3ad892a020
commit c19fff931b

@ -21,7 +21,9 @@ public class SwapModelResp
/// 换电站状态: 1营运中 2歇业中 3设备维护状态 4暂停营业 /// 换电站状态: 1营运中 2歇业中 3设备维护状态 4暂停营业
/// </summary> /// </summary>
public int? StationStatus { get; set; } public int? StationStatus { get; set; }
/// <summary>
/// 启动方式: 1:自动启动2拍按钮启动
/// </summary>
public byte? SwapInitiateMode { get; set; }
} }

@ -47,7 +47,18 @@ public class StationConstant
} }
/// <summary>
/// 启动方式1:自动换电 2手动换电
/// </summary>
public enum SwapInitiateMode
{
[Description("自动启动")]
Auto = 1,
[Description("手动启动")]
Manual,
}
} }

@ -405,7 +405,7 @@ public class PlcMgr
/// <returns></returns> /// <returns></returns>
public static bool WriteRollerShutter(ushort pollerShutter) public static bool WriteRollerShutter(ushort pollerShutter)
{ {
bool bResult = false; bool bResult = true;
if (PlcClient != null) if (PlcClient != null)
{ {
HostToPlc writeHostToPlc = new HostToPlc(); HostToPlc writeHostToPlc = new HostToPlc();
@ -428,7 +428,7 @@ public class PlcMgr
} }
else else
{ {
return false; return true;
} }
} }
/// <summary> /// <summary>

@ -152,7 +152,8 @@ public class MonitorService
{ {
StationStatus = StaticStationInfo.StationStatus, StationStatus = StaticStationInfo.StationStatus,
StationWay = StaticStationInfo.StationWay, StationWay = StaticStationInfo.StationWay,
StationModel = StaticStationInfo.StationModel StationModel = StaticStationInfo.StationModel,
SwapInitiateMode = StaticStationInfo.SwapInitiateMode,
}; };
return Result<SwapModelResp>.Success(resp); return Result<SwapModelResp>.Success(resp);

@ -252,6 +252,7 @@ public class SwapMonitorController : ControllerBase
return Result<bool>.Success(); return Result<bool>.Success();
} }
/// <summary> /// <summary>
/// 切换成 营业状态 /// 切换成 营业状态
/// 换电站状态: 1营运中 2歇业中 3设备维护状态 4暂停营业 /// 换电站状态: 1营运中 2歇业中 3设备维护状态 4暂停营业
@ -320,4 +321,46 @@ public class SwapMonitorController : ControllerBase
return Result<bool>.Success(); return Result<bool>.Success();
} }
/// <summary>
/// 切换成 自动启动
/// </summary>
[HttpPost("AutoInitiate")]
public Result<bool> AutoInitiate()
{
StaticStationInfo.SwapInitiateMode = (byte)StationConstant.SwapInitiateMode.Auto;
return Result<bool>.Success();
}
/// <summary>
/// 切换成 手动启动
/// </summary>
[HttpPost("ManualInitiate")]
public Result<bool> ManualInitiate()
{
StaticStationInfo.SwapInitiateMode = (byte)StationConstant.SwapInitiateMode.Manual;
return Result<bool>.Success();
}
/// <summary>
/// 卷帘门控制1000请求开启 1010请求关闭
/// </summary>
/// <returns></returns>
[HttpPost("RollerShutter")]
public async Task<Result<bool>> RollerShutter(ushort value)
{
return PlcMgr.WriteRollerShutter(value) ? Result<bool>.Success(true) : Result<bool>.Fail();
}
/// <summary>
/// 卷帘门是否开启
/// </summary>
/// <returns>true开启状态false关闭状态 </returns>
[HttpPost("GetRollerShutter")]
public async Task<Result<bool>> GetRollerShutter()
{
return PlcMgr.RollerShutterRadar() ? Result<bool>.Success(true) : Result<bool>.Fail();
}
} }
Loading…
Cancel
Save