diff --git a/Entity/Api/Resp/SwapVehicleResp.cs b/Entity/Api/Resp/SwapVehicleResp.cs index 8c187b9..b6ee309 100644 --- a/Entity/Api/Resp/SwapVehicleResp.cs +++ b/Entity/Api/Resp/SwapVehicleResp.cs @@ -40,4 +40,15 @@ public class SwapVehicleResp /// 钥匙状态 0: OFF 1: ACC 2: ON 0xFF: 不支持 /// public byte? KeyStatus { get; set; } + + + /// + /// 车辆档位 最小值:-1,最大值 14 ,0x0F表示无效,-1 代表倒档 R;0 代表空挡 N;大于 0 代表前进档 D; + /// + public byte? Gear { get; set; } + + /// + /// 刹车状态 "0:未拉手刹1:已拉手刹 其它值无效" + /// + public byte? Break { get; set; } } \ No newline at end of file diff --git a/Entity/Constant/StationParamConst.cs b/Entity/Constant/StationParamConst.cs index 7c78319..500c9ac 100644 --- a/Entity/Constant/StationParamConst.cs +++ b/Entity/Constant/StationParamConst.cs @@ -221,10 +221,11 @@ public class StationParamConst public static readonly string TboxStateBreak = "Tbox.StateHandbrake"; //Tbox是否需要断连 public static readonly string TboxStateDisConnect = "Tbox.StateDisConnect"; - + public static readonly string TboxStateCarList = "Tbox.TboxStateCarList"; //Tbox是否需要连接 public static readonly string TboxUrlConnect = "Tbox.UrlConnect"; - + + //Tbox 断连url public static readonly string TboxUrlDisConnect = "Tbox.UrlDisConnect"; diff --git a/Service/Init/StaticStationInfo.cs b/Service/Init/StaticStationInfo.cs index cda1cfc..152d66c 100644 --- a/Service/Init/StaticStationInfo.cs +++ b/Service/Init/StaticStationInfo.cs @@ -90,6 +90,12 @@ public class StaticStationInfo get => bool.Parse(Resolve(StationParamConst.TboxStateN)); set => Set(StationParamConst.TboxStateN, value); } + + public static bool TboxStateCarList + { + get => bool.Parse(Resolve(StationParamConst.TboxStateCarList)); + set => Set(StationParamConst.TboxStateCarList, value); + } public static bool TboxStateBreak { diff --git a/Service/Station/MonitorService.cs b/Service/Station/MonitorService.cs index 5403e50..fad9778 100644 --- a/Service/Station/MonitorService.cs +++ b/Service/Station/MonitorService.cs @@ -64,6 +64,9 @@ public class MonitorService VelVin = StationSoftMgr.SwappingStateMachine.RfidReadModel != null ? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelVin : null, + Break = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel?.CarStatus?.Break, + Gear = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel?.CarStatus?.Gear, + }, BatteryInfo = new() { diff --git a/WebStarter/Controllers/SwapMonitorController.cs b/WebStarter/Controllers/SwapMonitorController.cs index 9da9f6b..2ebe0b4 100644 --- a/WebStarter/Controllers/SwapMonitorController.cs +++ b/WebStarter/Controllers/SwapMonitorController.cs @@ -270,6 +270,20 @@ public class SwapMonitorController : ControllerBase [HttpGet("GetCarList")] public async Task>> GetCarList() { + //兼容不能查车辆列表的,就获取当前换电车辆 + if (!StaticStationInfo.TboxStateCarList) + { + if (StationSoftMgr.SwappingStateMachine.BoxCarInfoModel == null) + { + return Result>.Success(new List()); + } + + return Result>.Success(new() + { + StationSoftMgr.SwappingStateMachine.BoxCarInfoModel + }); + } + var carInfoList = await TBoxApi.GetCarInfoList(); if (carInfoList == null || carInfoList.Count <= 0) {