diff --git a/Service/Car/Handler/HeartBeatMsgHandler.cs b/Service/Car/Handler/HeartBeatMsgHandler.cs index 8032951..6ceb140 100644 --- a/Service/Car/Handler/HeartBeatMsgHandler.cs +++ b/Service/Car/Handler/HeartBeatMsgHandler.cs @@ -42,7 +42,9 @@ public class HeartBeatMsgHandler : SimpleChannelInboundHandler, IB ioSession.BusinessMap.AddOrUpdate("HeartBeatMsg", msg, ((s, o) => msg)); ioSession?.BusinessMap.AddOrUpdate("Connected", true, ((s, o) => true)); - HeartBeatMsgResp resp = new HeartBeatMsgResp(CarServerMgr.CarServer.StationStatus) + byte stationStatus = msg.CarNo == CarServerMgr.CarServer.VIN ? CarServerMgr.CarServer.StationStatus :(byte)1; + + HeartBeatMsgResp resp = new HeartBeatMsgResp(stationStatus) { CarNo = msg.CarNo }; diff --git a/Service/Car/Msg/Car/Req/ElecBaseMsg.cs b/Service/Car/Msg/Car/Req/ElecBaseMsg.cs index 7c1c87e..bf9a619 100644 --- a/Service/Car/Msg/Car/Req/ElecBaseMsg.cs +++ b/Service/Car/Msg/Car/Req/ElecBaseMsg.cs @@ -15,7 +15,7 @@ namespace Service.Car.Msg.Car.Req [Property(248, 192)] public string BatteryCode { get; set; } /// - /// 电池编码 + /// 电池厂家 /// [Property(340, 8)] public byte BatteryManufacturer { get; set; } diff --git a/Service/Car/Server/CarServer.cs b/Service/Car/Server/CarServer.cs index 1f4c4be..74c4eec 100644 --- a/Service/Car/Server/CarServer.cs +++ b/Service/Car/Server/CarServer.cs @@ -24,8 +24,9 @@ public class CarServer : TcpServer /// 1 待机 2 换电 /// public byte StationStatus { get; set; } = 1; + public string VIN { get; set; }; - + public CarServer() : base() { this.ChannelInActiveAction = Clean; diff --git a/WebStarter/Controllers/CarController.cs b/WebStarter/Controllers/CarController.cs index f985277..20f88d5 100644 --- a/WebStarter/Controllers/CarController.cs +++ b/WebStarter/Controllers/CarController.cs @@ -156,6 +156,28 @@ public class CarController : ControllerBase{ return CarServerMgr.CarServer.UnLockMsgPair.GetResp(TimeSpan.FromSeconds(5))?.Result == 0; } + + /// + /// 设置心跳返回信息 + /// + /// + /// 1 换电站待机 + /// 2 开始换电 + /// 3 换电进行中 + /// 4 换电完成 + /// 5 换电站故障 + /// + [HttpGet("Vin/{VIN}/SetStatus/{status}")] + public bool SetStatus(string VIN, byte status) + { + if (CarServerMgr.CarServer != null) + { + CarServerMgr.CarServer.VIN = VIN; + CarServerMgr.CarServer.StationStatus = status; + return true; + } + return false; + } /// /// 结算 /// diff --git a/nhetCnAgvVehicle.sln b/nhetCnVehicle.sln similarity index 100% rename from nhetCnAgvVehicle.sln rename to nhetCnVehicle.sln