You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.3 KiB

using Entity.Constant;
using Entity.DbModel.Station;
using log4net;
using Service.Cloud.Client;
using Service.Cloud.Msg.Cloud.Req;
using Service.Cloud.Msg.Cloud.Resp;
using Service.Cloud.Msg.Host.Req;
using Service.Execute.Model;
namespace Service.Execute.Api;
public abstract class CloudApi
{
6 months ago
private const int TimeSpan = 60;
/// <summary>
/// 云平台车辆认证
/// </summary>
/// <param name="rfidReadModel"></param>
/// <returns></returns>
public static int VehicleCheck(RfidReadModel rfidReadModel, SwapOrder swapOrder)
{
VehicleCertification vehicleCertification = new()
{
ty = 1,
cn = rfidReadModel.VelNo,
vi = rfidReadModel.VelVin,
mac = rfidReadModel.VelMac,
en = 0,
dt = swapOrder.VehicleEnterTime,
mode = 0,
};
VehicleCertificationResp? sendVehicleCertification =
CloudClientMgr.CloudClient?.SendVehicleCertification(vehicleCertification,
global::System.TimeSpan.FromSeconds(TimeSpan));
if (sendVehicleCertification == null)
{
return -1;
}
return sendVehicleCertification.re;
}
/// <summary>
/// 上报换电步序到云端
/// </summary>
/// <param name="swapOrder"></param>
/// <param name="state"></param>
public static void SendStateLog(SwapOrder swapOrder, InfoEnum.BusinessSwappingForCloudState state)
{
ChannelStatusReporting channelStatusReporting = new()
{
};
CloudClientMgr.CloudClient?.SendChannelStatusReporting(channelStatusReporting,
global::System.TimeSpan.FromSeconds(TimeSpan));
return;
}
/// <summary>
/// 上报车辆数据
/// </summary>
public static void UploadTBoxCarInfo(SwapOrder swapOrder, TboxCarInfoModel model)
{
return;
}
/// <summary>
/// 云平台下发换电指令
/// </summary>
/// <returns></returns>
public static CarCanStart CarCanStart()
{
return CloudClientMgr.CloudClient.CarCanStart;
}
/// <summary>
/// 清除下发的换电指令
/// </summary>
/// <returns></returns>
public static bool ClearCarCanStartInfo()
{
CloudClientMgr.CloudClient.CarCanStart = null;
return true;
}
}