|
|
|
@ -26,7 +26,7 @@ public class CarController : ControllerBase
|
|
|
|
|
{
|
|
|
|
|
CarInfoResp carInfoResp = new CarInfoResp()
|
|
|
|
|
{
|
|
|
|
|
Connected = CarServerMgr.CarServer?.Connected ?? false,
|
|
|
|
|
Connected = CarServerMgr.CarServer != null && CarServerMgr.CarServer.Connected,
|
|
|
|
|
CarNo = CarServerMgr.CarServer?.HeartBeatMsg?.CarNo,
|
|
|
|
|
ElecMsg = CarServerMgr.CarServer?.ElecMsg,
|
|
|
|
|
HeartBeatMsg = CarServerMgr.CarServer?.HeartBeatMsg
|
|
|
|
@ -38,55 +38,63 @@ public class CarController : ControllerBase
|
|
|
|
|
/// 锁车
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>发送结果</returns>
|
|
|
|
|
[HttpGet("/lock")]
|
|
|
|
|
public bool Lock()
|
|
|
|
|
[HttpGet("/lock/{carNo}")]
|
|
|
|
|
public bool Lock(string carNo)
|
|
|
|
|
{
|
|
|
|
|
Log.Info("Lock ");
|
|
|
|
|
if (CarServerMgr.CarServer == null || (CarServerMgr.CarServer?.Connected ?? false))
|
|
|
|
|
if (CarServerMgr.CarServer == null || !CarServerMgr.CarServer.Connected)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CarServerMgr.CarServer.LockMsgResp = null;
|
|
|
|
|
SessionMgr.Broadcast(new LockMsg());
|
|
|
|
|
SessionMgr.Broadcast(new LockMsg()
|
|
|
|
|
{
|
|
|
|
|
CarNo = carNo
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 解锁
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>发送结果</returns>
|
|
|
|
|
[HttpGet("/unLock")]
|
|
|
|
|
public bool UnLock()
|
|
|
|
|
/// <param name="carNo"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/unLock/{carNo}")]
|
|
|
|
|
public bool UnLock(string carNo)
|
|
|
|
|
{
|
|
|
|
|
Log.Info("UnLock ");
|
|
|
|
|
if (CarServerMgr.CarServer == null || (CarServerMgr.CarServer?.Connected ?? false))
|
|
|
|
|
if (CarServerMgr.CarServer == null || !CarServerMgr.CarServer.Connected)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CarServerMgr.CarServer.UnLockMsgResp = null;
|
|
|
|
|
SessionMgr.Broadcast(new UnLockMsg());
|
|
|
|
|
SessionMgr.Broadcast(new UnLockMsg()
|
|
|
|
|
{
|
|
|
|
|
CarNo = carNo
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 结算
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>发送结果</returns>
|
|
|
|
|
[HttpGet("/SettleConfirm")]
|
|
|
|
|
public bool SettleConfirm()
|
|
|
|
|
/// <param name="carNo"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/SettleConfirm/{carNo}")]
|
|
|
|
|
public bool SettleConfirm(string carNo)
|
|
|
|
|
{
|
|
|
|
|
Log.Info("SettleConfirm ");
|
|
|
|
|
if (CarServerMgr.CarServer == null || (CarServerMgr.CarServer?.Connected ?? false))
|
|
|
|
|
if (CarServerMgr.CarServer == null || !CarServerMgr.CarServer.Connected)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CarServerMgr.CarServer.SettleConfirmMsgResp = null;
|
|
|
|
|
SessionMgr.Broadcast(new SettleConfirmMsg());
|
|
|
|
|
SessionMgr.Broadcast(new SettleConfirmMsg() { CarNo = carNo });
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
@ -99,7 +107,7 @@ public class CarController : ControllerBase
|
|
|
|
|
public bool SetParam(SetParam setParam)
|
|
|
|
|
{
|
|
|
|
|
Log.Info("SetParam");
|
|
|
|
|
if (CarServerMgr.CarServer == null || (CarServerMgr.CarServer?.Connected ?? false))
|
|
|
|
|
if (CarServerMgr.CarServer == null || !CarServerMgr.CarServer.Connected)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|