兼容无车辆列表的

master
lxw 5 months ago
parent ba8a828e6d
commit 59e7b93859

@ -40,4 +40,15 @@ public class SwapVehicleResp
/// 钥匙状态 0: OFF 1: ACC 2: ON 0xFF: 不支持 /// 钥匙状态 0: OFF 1: ACC 2: ON 0xFF: 不支持
/// </summary> /// </summary>
public byte? KeyStatus { get; set; } public byte? KeyStatus { get; set; }
/// <summary>
/// 车辆档位 最小值:-1最大值 14 0x0F表示无效-1 代表倒档 R0 代表空挡 N大于 0 代表前进档 D
/// </summary>
public byte? Gear { get; set; }
/// <summary>
/// 刹车状态 "0:未拉手刹1已拉手刹 其它值无效"
/// </summary>
public byte? Break { get; set; }
} }

@ -221,10 +221,11 @@ public class StationParamConst
public static readonly string TboxStateBreak = "Tbox.StateHandbrake"; public static readonly string TboxStateBreak = "Tbox.StateHandbrake";
//Tbox是否需要断连 //Tbox是否需要断连
public static readonly string TboxStateDisConnect = "Tbox.StateDisConnect"; public static readonly string TboxStateDisConnect = "Tbox.StateDisConnect";
public static readonly string TboxStateCarList = "Tbox.TboxStateCarList";
//Tbox是否需要连接 //Tbox是否需要连接
public static readonly string TboxUrlConnect = "Tbox.UrlConnect"; public static readonly string TboxUrlConnect = "Tbox.UrlConnect";
//Tbox 断连url //Tbox 断连url
public static readonly string TboxUrlDisConnect = "Tbox.UrlDisConnect"; public static readonly string TboxUrlDisConnect = "Tbox.UrlDisConnect";

@ -90,6 +90,12 @@ public class StaticStationInfo
get => bool.Parse(Resolve(StationParamConst.TboxStateN)); get => bool.Parse(Resolve(StationParamConst.TboxStateN));
set => Set(StationParamConst.TboxStateN, value); set => Set(StationParamConst.TboxStateN, value);
} }
public static bool TboxStateCarList
{
get => bool.Parse(Resolve(StationParamConst.TboxStateCarList));
set => Set(StationParamConst.TboxStateCarList, value);
}
public static bool TboxStateBreak public static bool TboxStateBreak
{ {

@ -64,6 +64,9 @@ public class MonitorService
VelVin = StationSoftMgr.SwappingStateMachine.RfidReadModel != null VelVin = StationSoftMgr.SwappingStateMachine.RfidReadModel != null
? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelVin ? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelVin
: null, : null,
Break = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel?.CarStatus?.Break,
Gear = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel?.CarStatus?.Gear,
}, },
BatteryInfo = new() BatteryInfo = new()
{ {

@ -270,6 +270,20 @@ public class SwapMonitorController : ControllerBase
[HttpGet("GetCarList")] [HttpGet("GetCarList")]
public async Task<Result<List<TboxCarInfoModel>>> GetCarList() public async Task<Result<List<TboxCarInfoModel>>> GetCarList()
{ {
//兼容不能查车辆列表的,就获取当前换电车辆
if (!StaticStationInfo.TboxStateCarList)
{
if (StationSoftMgr.SwappingStateMachine.BoxCarInfoModel == null)
{
return Result<List<TboxCarInfoModel>>.Success(new List<TboxCarInfoModel>());
}
return Result<List<TboxCarInfoModel>>.Success(new()
{
StationSoftMgr.SwappingStateMachine.BoxCarInfoModel
});
}
var carInfoList = await TBoxApi.GetCarInfoList(); var carInfoList = await TBoxApi.GetCarInfoList();
if (carInfoList == null || carInfoList.Count <= 0) if (carInfoList == null || carInfoList.Count <= 0)
{ {

Loading…
Cancel
Save