using Entity.Constant;
using Entity.DbModel.Station;
using log4net;
using Service.Cloud.Client;
using Service.Cloud.Common;
using Service.Cloud.Msg.Host.Req;
using Service.Execute.Model;
using Service.Init;
using System.Text.Json;
namespace Service.Execute.Api;
public abstract class CloudApi
{
private const int TimeSpan = 10;
private static readonly ILog Log = LogManager.GetLogger("CloudApi");
///
/// 上传云端车辆就绪
///
/// 车牌号
///
public static bool UploadCloudReady(string carNumber)
{
if (carNumber == null) { carNumber = ""; }
ReadyTopic readyTopic = new ReadyTopic()
{
stationSn = StaticStationInfo.StationSn,
carNumber = carNumber,
};
string jsonString = JsonSerializer.Serialize(readyTopic);
return CloudClientMgr.Send(CloudConst.commandSubFind, jsonString);
}
///
/// 换电完成上传
///
///
///
///
///
///
public static bool UploadCloudSwapFinish(string carNumber, string orderID, string before_soc, string after_soc)
{
SwapFinish swapFinish = new SwapFinish()
{
stationSn = StaticStationInfo.StationSn,
carNumber = carNumber,
orderID = orderID,
before_soc = before_soc,
after_soc = after_soc,
};
string jsonString = JsonSerializer.Serialize(swapFinish);
return CloudClientMgr.Send(CloudConst.CommandSubOver, jsonString);
}
}