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.

62 lines
1.7 KiB

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");
/// <summary>
/// 上传云端车辆就绪
/// </summary>
/// <param name="carNumber">车牌号</param>
/// <returns></returns>
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);
}
/// <summary>
/// 换电完成上传
/// </summary>
/// <param name="carNumber"></param>
/// <param name="orderID"></param>
/// <param name="before_soc"></param>
/// <param name="after_soc"></param>
/// <returns></returns>
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);
}
}