更新站控新协议、同步部分字段和cmd

master
tq 1 month ago
parent c9311417ea
commit aba8ee8f68

@ -0,0 +1,61 @@
namespace Entity.Dto.Req;
/// <summary>
/// 上传换电订单电池列表
/// </summary>
public class SwapOrderBatteryRecord
{
/// <summary>
/// 出仓安装电池序列号
/// </summary>
public string outBatteryNo { get; set; }
/// <summary>
/// 出仓安装电池SOC
/// </summary>
public int outSoc { get; set; }
/// <summary>
/// 取车电池上次换电结算时 的SOC
/// </summary>
public int lastSoc { get; set; }
/// <summary>
/// 出仓安装电池的SOE
/// 单位:kWh,保留两位小数
/// </summary>
public float outSoe { get; set; }
/// <summary>
/// 取车电池上次换电结算时 的 SOE
/// 单位:kWh,保留两位小数
/// </summary>
public float lastSoe { get; set; }
/// <summary>
/// 拆卸入仓电池序列号
/// </summary>
public string enterBatteryNo { get; set; }
/// <summary>
/// 拆卸入仓电池SOC
/// 单位:kWh,保留两位小数
/// </summary>
public int enterSoc { get; set; }
/// <summary>
/// 拆卸入仓电池SOE
/// 单位:kWh,保留两位小数
/// </summary>
public float enterSoe { get; set; }
/// <summary>
/// 出仓安装地仓位号
/// </summary>
public int? outBin { get; set; }
/// <summary>
/// 拆卸入仓池仓位号
/// </summary>
public int? enterBin { get; set; }
}

@ -307,13 +307,13 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR
{
Model<T> model = new Model<T>
{
Header = new Header()
header = new Header()
{
cmd = data.GetCmd(),
cipherFlag = Encrypt,
id = GetIncrementId(),
sid = StationNo,
timeStamp = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000
stationNo = StationNo,
timestamp = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000
},
body = data
};
@ -349,7 +349,7 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR
NullValueHandling = NullValueHandling.Ignore
};
string body = JsonConvert.SerializeObject(model.body, settings);
return MD5Util.MD5Encrypt32(body + ":" + model.Header.timeStamp + ":" + model.Header.id).ToLower();
return MD5Util.MD5Encrypt32(body + ":" + model.header.timestamp + ":" + model.header.id).ToLower();
}
/// <summary>
@ -726,36 +726,36 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR
SwapOrder? swapOrder = SwapOrderRepository.QueryByClause(it => it.Sn == swapOrderSn);
ChargeRecordUpLoad req = new ChargeRecordUpLoad()
{
chrsn = chargeOrder.CloudChargeOrder,
son = swapOrder?.CloudSn,
bid = chargeOrder.BatteryNo,
st = chargeOrder.StartTime ?? DateTime.Now,
et = lastChargeOrder.EndTime ?? DateTime.Now,
ssoc = chargeOrder.StartSoc ?? 0,
esoc = lastChargeOrder.StopSoc ?? 0,
chargeOrderNo = chargeOrder.CloudChargeOrder,
swapOrderNo = swapOrder?.CloudSn,
batteryNo = chargeOrder.BatteryNo,
startTime = chargeOrder.StartTime ?? DateTime.Now,
endTime = lastChargeOrder.EndTime ?? DateTime.Now,
startSoc = chargeOrder.StartSoc ?? 0,
endSoc = lastChargeOrder.StopSoc ?? 0,
//ssoe = chargeOrder.soe
//esoe
dcce =0,
acce =0,
tp = 0,
pp = 0,
fp = 0,
vp = 0,
ct = 0,
cn = orders.Count,
sfs = op,
directCurrent =0,
acMeter =0,
theTipElectric = 0,
peakElectric = 0,
flatElectric = 0,
theValleyElectric = 0,
chargerTime = 0,
chargerFrequency = orders.Count,
reportType = op,
vin = swapOrder?.VehicleVin,
sfoc = 0,
chargerType = 0,
};
foreach (ChargeOrder order in orders)
{
req.dcce += Convert.ToSingle(order.StopDcElec ?? 0 - order.StartDcElec ?? 0);
req.acce += Convert.ToSingle(order.StopAcElec ?? 0 - order.StartAcElec ?? 0);
req.tp += Convert.ToSingle(order.SharpElecCount);
req.pp += Convert.ToSingle(order.PeakElecCount);
req.fp += Convert.ToSingle(order.FlatElecCount);
req.vp += Convert.ToSingle(order.ValleyElecCount);
req.ct += ((order.EndTime ?? DateTime.Now).Subtract(order.StartTime ?? DateTime.Now)).Minutes;
req.directCurrent += Convert.ToSingle(order.StopDcElec ?? 0 - order.StartDcElec ?? 0);
req.acMeter += Convert.ToSingle(order.StopAcElec ?? 0 - order.StartAcElec ?? 0);
req.theTipElectric += Convert.ToSingle(order.SharpElecCount);
req.peakElectric += Convert.ToSingle(order.PeakElecCount);
req.flatElectric += Convert.ToSingle(order.FlatElecCount);
req.theValleyElectric += Convert.ToSingle(order.ValleyElecCount);
req.chargerTime += ((order.EndTime ?? DateTime.Now).Subtract(order.StartTime ?? DateTime.Now)).Minutes;
}
this.SendChargeRecordUpLoad(req);

@ -83,7 +83,7 @@ public class CloudClientMgr
#region 遥测合并上报
req.datainfo = new List<DataInfo>();
req.chargeDevDataList = new List<DataInfo>();
redisHelper?.GetSubscriber().Subscribe("UploadTelemetryData", (channel, value) =>
{
try
@ -98,48 +98,48 @@ public class CloudClientMgr
BinInfo? binInfo = binInfoRepository.QueryByClause(it => it.ChargerNo == data.ChargerNo);
//ChargeDevDataInfo req = new ChargeDevDataInfo();
req.sn = StaticStationInfo.StationNo;
req.stationNo = StaticStationInfo.StationNo;
DataInfo dataInfo = new DataInfo();
dataInfo.en = StaticStationInfo.StationNo + data.ChargerNo;
dataInfo.equipmentNo = StaticStationInfo.StationNo + data.ChargerNo;
var areNotEqual = !dataInfo.en.Equals(
req.datainfo.Select(d => d.en)
var areNotEqual = !dataInfo.equipmentNo.Equals(
req.chargeDevDataList.Select(d => d.equipmentNo)
.ToList()
.Any(x => x == dataInfo.en));
.Any(x => x == dataInfo.equipmentNo));
if (areNotEqual)//如果没有重复的
{
dataInfo.sd = "A" + int.Parse(binInfo.No);
dataInfo.mtp = StaticStationInfo.ChargePower;
dataInfo.mcr = 1;
dataInfo.hb = binInfo?.Exists ?? 0;
dataInfo.el = 0;
dataInfo.cno = int.Parse(binInfo.No);
dataInfo.cs = binInfo.ChargeStatus ?? 0;
dataInfo.fs = 0;
dataInfo.@as = 0;
dataInfo.chargerId = "A" + int.Parse(binInfo.No);
dataInfo.highPower = StaticStationInfo.ChargePower;
dataInfo.highSpeed = 1;
dataInfo.isThereAnyBattery = binInfo?.Exists ?? 0;
dataInfo.electronicStreet = 0;
dataInfo.chargerNo = int.Parse(binInfo.No);
dataInfo.chargerStatus = binInfo.ChargeStatus ?? 0;
dataInfo.faultStatus = 0;
dataInfo.alarmStatus = 0;
//fc = data.,
//st = data.,
dataInfo.ct = data.ChargingTime;
dataInfo.chargerTime = data.ChargingTime;
//ssoc = data.,
dataInfo.csoc = data.CurrentSoc;
dataInfo.soc = data.CurrentSoc;
//ssoe = data.,
//csoe = data.,
dataInfo.cvot = data.BmsChargingVoltage;
dataInfo.ccur = data.BmsChargingCurrent;
dataInfo.nvot = data.BmsNeedVoltage;
dataInfo.ncur = data.BmsNeedCurrent;
dataInfo.lsv = data.SingleBatteryMinVoltage;
dataInfo.hsv = data.SingleBatteryMaxVoltage;
dataInfo.lst = data.MinBatteryTemp;
dataInfo.hst = data.MaxBatteryTemp;
dataInfo.ws = 0xFF;
dataInfo.it = 0xFF;
dataInfo.ot = 0xFF;
dataInfo.bt = DateTime.Now;
if (req.datainfo.Count < 7)
dataInfo.voltage = data.BmsChargingVoltage;
dataInfo.electricCurrent = data.BmsChargingCurrent;
dataInfo.bmsVoltage = data.BmsNeedVoltage;
dataInfo.bmsElectricCurrent = data.BmsNeedCurrent;
dataInfo.lowVoltage = data.SingleBatteryMinVoltage;
dataInfo.highVoltage = data.SingleBatteryMaxVoltage;
dataInfo.lowTemperature = data.MinBatteryTemp;
dataInfo.highTemperature = data.MaxBatteryTemp;
dataInfo.waterCoolingStatus = 0xFF;
dataInfo.intakeTemperature = 0xFF;
dataInfo.outletTemperature = 0xFF;
dataInfo.updateTime = DateTime.Now;
if (req.chargeDevDataList.Count < 7)
{
req.datainfo.Add(dataInfo);
req.chargeDevDataList.Add(dataInfo);
}
}
@ -150,12 +150,12 @@ public class CloudClientMgr
}
_dateTime = DateTime.Now;
if (req.datainfo.Count > 0)
if (req.chargeDevDataList.Count > 0)
{
CloudClient?.SendChargeDevDataInfo(req);
req = new ChargeDevDataInfo();
req.datainfo = new List<DataInfo>();
req.chargeDevDataList = new List<DataInfo>();
}
Log.Info($"receive UploadTelemetryData={value}");
@ -197,7 +197,6 @@ public class CloudClientMgr
StartAsyncLoop();
}

@ -14,8 +14,8 @@ public class CloudConst
public static readonly string signInRes = "signInRes";
public static readonly string devList = "devList";
public static readonly string devListRep = "devListRep";
public static readonly string staSwapRecord = "staSwapRecord";
public static readonly string staSwapRecordRes = "staSwapRecordRes";
public static readonly string staSwapRecord = "uploadSwapOrder";
public static readonly string staSwapRecordRes = "uploadSwapOrderRes";
public static readonly string ChargeRecordReport = "ChargeRecordReport";
public static readonly string ChargeRecordReportsRes = "ChargeRecordReportsRes";
public static readonly string stationRunStatus = "stationRunStatus";
@ -34,10 +34,10 @@ public class CloudConst
public static readonly string eqmStateEndLogInfoRes = "eqmStateEndLogInfoRes";
public static readonly string chargeDevDataInfo = "chargeDevDataInfo";
public static readonly string chargeDevDataInfoRes = "chargeDevDataInfoRes";
public static readonly string batDataInfo = "batDataInfo";
public static readonly string batDataInfoRes = "batDataInfoRes";
public static readonly string ChargeRecordUpLoad = "ChargeRecordUpLoad";
public static readonly string ChargeRecordUpLoadRes = "ChargeRecordUploadRes";
public static readonly string batDataInfo = "batteryDataInfo";
public static readonly string batDataInfoRes = "batteryDataInfoRes";
public static readonly string ChargeRecordUpLoad = "uploadChargeOrder";
public static readonly string ChargeRecordUpLoadRes = "uploadChargeOrderRes";
public static readonly string batteryTotal = "batteryTotal";
public static readonly string batteryTotalRes = "batteryTotalRes";
public static readonly string chargingTotalDis = "chargingTotalDis";

@ -0,0 +1,23 @@
using HybirdFrameworkCore.Autofac.Attribute;
using log4net;
using Newtonsoft.Json;
using Service.Cloud.Common;
using Service.Cloud.Msg.Cloud.Resp;
namespace Service.Cloud.Handler;
[Scope("InstancePerDependency")]
public class BatDataInfoResHandler: IBaseHandler
{
private static readonly ILog Log = LogManager.GetLogger(typeof(BatDataInfoResHandler));
public bool CanHandle(string cmd)
{
return CloudConst.batDataInfoRes== cmd;
}
public void Handle(string t)
{
BatDataInfoRes? res = JsonConvert.DeserializeObject<BatDataInfoRes>(t);
Log.Info($"receive BatDataInfoRes res={res} {JsonConvert.SerializeObject(res)}"); }
}

@ -3,6 +3,7 @@ using Newtonsoft.Json;
using Service.Cloud.Client;
using Service.Cloud.Common;
using Service.Cloud.Msg.Cloud.Req;
using Service.Cloud.Msg.Host.Resp;
namespace Service.Cloud.Handler;
@ -18,5 +19,10 @@ public class CarCanStartHandler : IBaseHandler
{
CarCanStart? carCanStart = JsonConvert.DeserializeObject<CarCanStart>(t);
CloudClientMgr.CloudClient.CarCanStart = carCanStart;
if (carCanStart!=null)
{
CarCanStartRes resp = new CarCanStartRes(0,carCanStart.channel,carCanStart.order,1);
CloudClientMgr.CloudClient?.Publish(resp);
}
}
}

@ -12,7 +12,7 @@ namespace Service.Cloud.Handler;
public class ChargeRecordUploadResHandler : IBaseHandler
{
private static readonly ILog Log = LogManager.GetLogger(typeof(ChargeRecordUploadResHandler));
public ChargeOrderRepository ChargeOrderRepository { get; set; }
public void Handle(string t)
@ -23,9 +23,9 @@ public class ChargeRecordUploadResHandler : IBaseHandler
if (CloudClientMgr.CloudClient != null)
{
CloudClientMgr.CloudClient.ChargeRecordUpLoad.SetResp(res);
string? reqChrsn = CloudClientMgr.CloudClient.ChargeRecordUpLoad.Req?.chrsn;
string? reqChrsn = res.chargeOrderNo;
Log.Info($"receive ChargeRecordUploadRes chargeOrderNo={reqChrsn} {JsonConvert.SerializeObject(res)}");
if (!string.IsNullOrWhiteSpace(reqChrsn) && res.re == 0)
if (!string.IsNullOrWhiteSpace(reqChrsn) && res.result == 0)
{
ChargeOrderRepository.Update(it => it.CloudReportStatus == 1, it => it.CloudChargeOrder == reqChrsn);
}

@ -3,8 +3,10 @@ using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac;
using HybirdFrameworkCore.Autofac.Attribute;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Service.Cloud.Client;
using Service.Cloud.Common;
using Service.Cloud.Msg;
using Service.Cloud.Msg.Cloud.Resp;
namespace Service.Cloud.Handler;
@ -12,26 +14,23 @@ namespace Service.Cloud.Handler;
[Scope("InstancePerDependency")]
public class SignInRespHandler : IBaseHandler
{
public bool CanHandle(string cmd)
{
return CloudConst.signInRes == cmd;
}
public void Handle(string t)
{
SignInRes? signInResp = JsonConvert.DeserializeObject<SignInRes>(t);
if (signInResp != null)
{
CloudClientMgr.CloudClient.Authed = signInResp.re == 0;
CloudClientMgr.CloudClient.Authed = signInResp.result == 0;
CloudClientMgr.CloudClient.EquipmentUpload = signInResp.dl_up;
if (CloudClientMgr.CloudClient.EquipmentUpload != 0)
{
//上传设备列表
CloudClientMgr.SendDevList(1);
}
}
}
public bool CanHandle(string cmd)
{
return CloudConst.signInRes == cmd;
}
}

@ -0,0 +1,25 @@
using HybirdFrameworkCore.Autofac.Attribute;
using log4net;
using Newtonsoft.Json;
using Service.Cloud.Common;
using Service.Cloud.Msg.Cloud.Resp;
namespace Service.Cloud.Handler;
[Scope("InstancePerDependency")]
public class StationChnRunStatusResHandler: IBaseHandler
{
private static readonly ILog Log = LogManager.GetLogger(typeof(StationChnRunStatusResHandler));
public bool CanHandle(string cmd)
{
return CloudConst.stationChnRunStatusRes== cmd;
}
public void Handle(string t)
{
StationChnRunStatusRes? res = JsonConvert.DeserializeObject<StationChnRunStatusRes>(t);
Log.Info($"receive StationChnRunStatusRes res={res} {JsonConvert.SerializeObject(res)}");
}
}

@ -22,9 +22,9 @@ public class UploadSwapOrderResHandler : IBaseHandler
if (CloudClientMgr.CloudClient != null)
{
CloudClientMgr.CloudClient.UploadPowerChange.SetResp(resp);
string? reqSon = CloudClientMgr.CloudClient.UploadPowerChange.Req?.son;
string? reqSon = CloudClientMgr.CloudClient.UploadPowerChange.Req?.orderNo;
Log.Info($"receive UploadSwapOrderRes swapOrderNo={reqSon} {JsonConvert.SerializeObject(resp)}");
if (!string.IsNullOrWhiteSpace(reqSon) && resp.re == 0)
if (!string.IsNullOrWhiteSpace(reqSon) && resp.result == 0)
{
SwapOrderRepository.Update(it => it.CloudReportStatus == 1, it => it.Sn == reqSon);
}

@ -16,23 +16,23 @@ namespace Service.Cloud.Msg.Cloud.Req
/// 订单号
/// 场站编码12 字节)+时间yyyyMMddHHmmss)14 位 + 2 位
/// </summary>
public string on { get; set; }
public string order { get; set; }
/// <summary>
/// 车辆所在的换电 通道
/// 从 1 开始递增, 0表示默认单仓单通道
/// </summary>
public int en { get; set; }
public int channel { get; set; }
/// <summary>
/// 车牌号
/// 一般车牌规则,当 ty 为 1 时,该字段必须填
/// </summary>
public string cn { get; set; }
public string carNo { get; set; }
/// <summary>
/// 是否开始换电 1:可以开始换电 2:终止换电
/// 1:可以开始换电 2:终止换电(取消换电)
/// <see cref="Entity.Constant.CloudEnum.WhetherToBattery"/>
/// /// </summary>
public byte cs { get; set; }
public byte swapFlag { get; set; }
public string GetCmd()
{
return CloudConst.carCanStart;

@ -9,7 +9,7 @@ public class BatDataInfoRes : ICmd
/// 0:成功 1失败
/// <see cref="Entity.Constant.CloudEnum.Result"/>
/// </summary>
public byte re { get; set; }
public byte result { get; set; }
public string GetCmd()
{

@ -23,20 +23,20 @@ namespace Service.Cloud.Msg.Cloud.Resp
/// 6没有招到对应的 rfid 卡号
/// <see cref="Entity.Constant.CloudEnum.VehicleAuthResult"/>
/// </summary>
public int re { get; set; }
public int result { get; set; }
/// <summary>
/// 认证方式
/// 1 车牌号 2 rfid 卡号
/// <see cref="Entity.Constant.CloudEnum.AuthenticationMethod"/>
/// </summary>
public int ty { get; set; }
public int authType { get; set; }
/// <summary>
/// 车牌号
/// 当 ty 为 1 时,该字段必须填,其他为可选项,一般车牌规则
/// </summary>
public string cn { get; set; }
public string carNo { get; set; }
/// <summary>
/// 卡号
@ -48,13 +48,13 @@ namespace Service.Cloud.Msg.Cloud.Resp
/// 车辆识别号
/// 该字段必须填
/// </summary>
public string vi { get; set; }
public string vin { get; set; }
/// <summary>
/// 订单号
/// 场站编码12 字节)+时间yyyyMMddHHmmss)14 位 + 2 位
/// </summary>
public string on { get; set; }
public string order { get; set; }
/// <summary>
/// Mac 地址

@ -15,7 +15,7 @@ namespace Service.Cloud.Msg.Cloud.Resp
/// <summary>
/// 应答结果0成功1失败
/// </summary>
public byte re { get; set; }
public byte result { get; set; }
public string GetCmd()
{

@ -4,7 +4,8 @@ namespace Service.Cloud.Msg.Cloud.Resp;
public class ChargeRecordUploadRes : ICmd
{
public int re { get; set; }
public int result { get; set; }
public string chargeOrderNo { get; set; }
public string GetCmd()
{

@ -11,7 +11,7 @@ public class SignInRes : ICmd
/// 0:成功 1:设备不存在 2非法设备 3站控软件版本错误 4.协议版本错误
/// <see cref="Entity.Constant.CloudEnum.SignInResult"/>
/// </summary>
public int re { get; set; }
public int result { get; set; }
/// <summary>
/// 是否需要上传设备列表
/// 2初始上传 1需要重新上传 0不需要上传
@ -22,13 +22,13 @@ public class SignInRes : ICmd
/// 云平台系统时间
/// 格式”yyyy-MM-dd HH:mm:ss”
/// </summary>
public DateTime ti { get; set; }
public DateTime cloudTime { get; set; }
/// <summary>
/// 加密方式
/// 0:不加密 1AES
/// <see cref="Entity.Constant.CloudEnum.Encryption"/>
/// </summary>
public int ew { get; set; }
public int encryptType { get; set; }
public string GetCmd()
{

@ -17,11 +17,15 @@ namespace Service.Cloud.Msg.Cloud.Resp
/// 0:成功 1:失败
/// <see cref="Entity.Constant.CloudEnum.ResultInt"/>
/// </summary>
public int re { get; set; }
public int result { get; set; }
/// <summary>
/// 换电订单号
/// </summary>
public string orderNo { get; set; }
/// <summary>
/// 失败原因
/// </summary>
public string fr { get; set; }
public string causeOfFailure { get; set; }
public string GetCmd()
{

@ -17,12 +17,12 @@ namespace Service.Cloud.Msg.Cloud.Resp
/// 0:成功 1失败
/// <see cref="Entity.Constant.CloudEnum.Result"/>
/// </summary>
public byte re { get; set; }
public byte result { get; set; }
/// <summary>
/// 接收失败原因
/// 比如:解析失败
/// </summary>
public byte rs { get; set; }
public string resultReason { get; set; }
public string GetCmd()
{

@ -13,7 +13,7 @@ public class Header
/// <summary>
///
/// </summary>
public string sid { get; set; }
public string stationNo { get; set; }
/// <summary>
///
/// </summary>
@ -21,5 +21,5 @@ public class Header
/// <summary>
///
/// </summary>
public long timeStamp { get; set; }
public long timestamp { get; set; }
}

@ -10,17 +10,17 @@ namespace Service.Cloud.Msg.Host.Req
/// <summary>
/// 场站编码 换电站唯一码
/// </summary>
public string sn { get; set; }
public string stationNo { get; set; }
/// <summary>
/// 换电站电池包总 数量
/// </summary>
public int batn { get; set; }
public int batteryQuantity { get; set; }
/// <summary>
/// 电池信息
/// </summary>
public List<SingleBatInfo> datainfo { get; set; }
public List<SingleBatInfo> dataList { get; set; }
public string GetCmd()
{

@ -18,12 +18,12 @@ namespace Service.Cloud.Msg.Host.Req
/// 1 车牌号 2 rfid 卡号
/// <see cref="Entity.Constant.CloudEnum.AuthenticationMethod"/>
/// </summary>
public int ty { get; set; }
public int authType { get; set; }
/// <summary>
/// 车牌号
/// 一般车牌规则,当 ty 为 1 时,该字段必须填
/// </summary>
public string cn { get; set; }
public string carNo { get; set; }
/// <summary>
/// rfid卡号
/// 当 ty 为 2 时,该字段必须填
@ -33,7 +33,7 @@ namespace Service.Cloud.Msg.Host.Req
/// 车辆识别号
/// 当 ty 为 2 时,该字段必须填,如果字段为空时,需要进行 MAC 地址验证,MAC地址和 vin 不能同时为空。
/// </summary>
public string vi { get; set; }
public string vin { get; set; }
/// <summary>
/// MAC地址
/// 当 ty 为 2 时,该字段必须填,如果该字段为空时,需要进行 VIN 验证MAC地址和 vin 不能同时为空。
@ -43,17 +43,17 @@ namespace Service.Cloud.Msg.Host.Req
/// 所有车队
/// 当 ty 为 2 时,该字段必须填
/// </summary>
public string mc { get; set; }
public string teamCode { get; set; }
/// <summary>
/// 车辆所在换电通 道
/// 从 1 开始递增 0表示默认单仓单通道
/// </summary>
public int en { get; set; }
public int channel { get; set; }
/// <summary>
/// 车辆进入的时间
/// 格式 “yyyy-mm-dd hh:mm:ss”
/// </summary>
public DateTime? dt { get; set; }
public DateTime? enterTime { get; set; }
/// <summary>
/// 车牌图片
/// 可选项,换电站需将图片进行 base64编码后才能传输后台收到字段进行base64 解码后才能查看

@ -10,9 +10,9 @@ namespace Service.Cloud.Msg.Host.Req
/// <summary>
/// 场站编码 换电站唯一码
/// </summary>
public string sn { get; set; }
public string stationNo { get; set; }
public List<DataInfo> datainfo { get; set; }
public List<DataInfo> chargeDevDataList { get; set; }
public string GetCmd()
@ -26,144 +26,144 @@ namespace Service.Cloud.Msg.Host.Req
/// <summary>
/// 设备编号 设备编号
/// </summary>
public string en { get; set; }
public string equipmentNo { get; set; }
/// <summary>
/// 充电架 ID 按电池架的编号 A1A2…
/// </summary>
public string sd { get; set; }
public string chargerId { get; set; }
/// <summary>
/// 充电机最大允许 输出功率 单位 0.1kw
/// </summary>
public float mtp { get; set; }
public float highPower { get; set; }
/// <summary>
/// 充电机最大允 许充电速率 单位 0.1C
/// </summary>
public float mcr { get; set; }
public float highSpeed { get; set; }
/// <summary>
/// 电池架上是否有 电池 0未知 1有电池 2无电池
/// </summary>
public int hb { get; set; }
public int isThereAnyBattery { get; set; }
/// <summary>
/// 电接头连接状态 0未知 1已经连接 2未连接
/// </summary>
public int el { get; set; }
public int electronicStreet { get; set; }
/// <summary>
/// 充电机序号 从 1 开始递增
/// </summary>
public int cno { get; set; }
public int chargerNo { get; set; }
/// <summary>
/// 充电机的工作状态 00H待机 01H工作02H工作完成03H充电暂停
/// </summary>
public int cs { get; set; }
public int chargerStatus { get; set; }
/// <summary>
/// 故障状态 00H无故障 01H有故障
/// </summary>
public int fs { get; set; }
public int faultStatus { get; set; }
///告警状态 00H无告警.01H:有告警
public int @as { get; set; }
public int alarmStatus { get; set; }
/// <summary>
/// 故障码 参考充电机的故障码定义
/// </summary>
public int fc { get; set; }
public int faultCode { get; set; }
/// <summary>
/// 充电开始时间 没有进行充电填空
/// </summary>
public DateTime st { get; set; }
public DateTime startTime { get; set; }
/// <summary>
/// 已经充电时间 单位 分钟
/// </summary>
public int ct { get; set; }
public int chargerTime { get; set; }
/// <summary>
/// 充电开始 SOC 0-100 单位 0.1 ,没有充电填 0
/// </summary>
public int ssoc { get; set; }
public int startSoc { get; set; }
/// <summary>
/// 当前 SOC 单位 0.1
/// </summary>
public int csoc { get; set; }
public int soc { get; set; }
/// <summary>
/// 充电开始 SOE 单位 0.1kwh,没有充电填 0
/// </summary>
public float ssoe { get; set; }
public float startSoe { get; set; }
/// <summary>
/// 当前 SOE 单位 0.1kwh
/// </summary>
public float csoe { get; set; }
public float soe { get; set; }
/// <summary>
/// 当前充电电压 单位 0.1V,没有充电填 0
/// </summary>
public float cvot { get; set; }
public float voltage { get; set; }
/// <summary>
/// 当前充电电流 单位 0.1A,没有充电填 0
/// </summary>
public float ccur { get; set; }
public float electricCurrent { get; set; }
/// <summary>
/// BMS 需求电压 单位 0.1V,没有充电填 0
/// </summary>
public float nvot { get; set; }
public float bmsVoltage { get; set; }
/// <summary>
/// BMS 需求电流 单位 0.1A,没有充电填 0
/// </summary>
public float ncur { get; set; }
public float bmsElectricCurrent { get; set; }
/// <summary>
/// 最低单体电压 单位 0.01V
/// </summary>
public float lsv { get; set; }
public float lowVoltage { get; set; }
/// <summary>
/// 最高单体电压 单位 0.01V
/// </summary>
public float hsv { get; set; }
public float highVoltage { get; set; }
/// <summary>
/// 最低单体温度 单位 0.1℃
/// </summary>
public float lst { get; set; }
public float lowTemperature { get; set; }
/// <summary>
/// 最高单体温度 单位 0.1℃
/// </summary>
public float hst { get; set; }
public float highTemperature { get; set; }
/// <summary>
/// 水冷状态 0未知 1开启 2关闭 0xFF 无水冷设备
/// </summary>
public byte ws { get; set; }
public byte waterCoolingStatus { get; set; }
/// <summary>
/// 进水口温度 单位 0.1℃ , 没有水冷设备填 0xFF
/// </summary>
public float it { get; set; }
public float intakeTemperature { get; set; }
/// <summary>
/// 出水口温度 单位 0.1℃ , 没有水冷设备填 0xFF
/// </summary>
public float ot { get; set; }
public float outletTemperature { get; set; }
/// <summary>
/// 更新时间 格式 ”yyyy-MM-dd HH:mm:ss ”
/// </summary>
public DateTime bt { get; set; }
public DateTime updateTime { get; set; }
}
}

@ -7,92 +7,92 @@ public class ChargeRecordUpLoad : ICmd
/// <summary>
/// 充电序列号
/// </summary>
public string chrsn { get; set; }
public string chargeOrderNo { get; set; }
/// <summary>
/// 换电序列号
/// </summary>
public string son { get; set; }
public string swapOrderNo { get; set; }
/// <summary>
/// 电池序列号
/// </summary>
public string bid { get; set; }
public string batteryNo { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public DateTime st { get; set; }
public DateTime startTime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public DateTime et { get; set; }
public DateTime endTime { get; set; }
/// <summary>
/// 开始 SOC
/// </summary>
public int ssoc { get; set; }
public int startSoc { get; set; }
/// <summary>
/// 结束 SOC
/// </summary>
public int esoc { get; set; }
public int endSoc { get; set; }
/// <summary>
/// 开始 SOE
/// </summary>
public float ssoe { get; set; }
public float startSoe { get; set; }
/// <summary>
/// 结束 SOE
/// </summary>
public float esoe { get; set; }
public float endSoe { get; set; }
/// <summary>
/// 直流电表充电 电量
/// </summary>
public float dcce { get; set; }
public float directCurrent { get; set; }
/// <summary>
/// 交流电表充电 电量
/// </summary>
public float acce { get; set; }
public float acMeter { get; set; }
/// <summary>
/// 尖时段电量
/// </summary>
public float tp { get; set; }
public float theTipElectric { get; set; }
/// <summary>
/// 峰时段电量
/// </summary>
public float pp { get; set; }
public float peakElectric { get; set; }
/// <summary>
/// 平时段电量
/// </summary>
public float fp { get; set; }
public float flatElectric { get; set; }
/// <summary>
/// 谷时段电量
/// </summary>
public float vp { get; set; }
public float theValleyElectric { get; set; }
/// <summary>
/// 充电时长 分钟
/// </summary>
public int ct { get; set; }
public int chargerTime { get; set; }
/// <summary>
/// 充电次数
/// </summary>
public int cn { get; set; }
public int chargerFrequency { get; set; }
/// <summary>
/// 1 自动; 2 人工手动
/// </summary>
public int sfs { get; set; }
public int reportType { get; set; }
/// <summary>
/// 车辆vin码
@ -102,7 +102,7 @@ public class ChargeRecordUpLoad : ICmd
/// <summary>
/// 0:站内充电 1 站外充电
/// </summary>
public int sfoc { get; set; }
public int chargerType { get; set; }
public string GetCmd()
{

@ -9,50 +9,50 @@ public class SignIn : ICmd
/// <summary>
/// 换电站编码
/// </summary>
public string sn { get; set; }
public string stationNo { get; set; }
/// <summary>
/// 供应商识别码
/// (以中心平台给出为准). 每个厂家对应一个 Key
/// </summary>
public string ky { get; set; }
public string supplierCode { get; set; }
/// <summary>
/// 换电站类型
/// 01:单道通左 02:单通道右 03:双道通
/// <see cref="Entity.Constant.CloudEnum.PowerStationType"/>
/// </summary>
public string st { get; set; }
public string stationType { get; set; }
/// <summary>
/// 设备型号
/// </summary>
public string dv { get; set; }
public string equipmentType { get; set; }
/// <summary>
/// 软件版本
/// 站类型代号(24 个大写字母)_X.XX其中 X 位 0~9 数字,非重大改变,整数数字不改变,小数点后数字单数加 0双数不变依次累加比如A_1.01
/// </summary>
public string sv { get; set; }
public string version { get; set; }
/// <summary>
/// 换电站服务状态
/// 0:未知1:服务状态2:停止服务状态
/// </summary>
public int ss { get; set; }
public int stationStatus { get; set; }
/// <summary>
/// 换电站配电容量
/// 单位 0.1kwh
/// </summary>
public float ca { get; set; }
public float stationCapacity { get; set; }
/// <summary>
/// 设备列表配置版本 号
/// </summary>
public string VS { get; set; }
public string equipmentVersion { get; set; }
/// <summary>
/// 充电功率
/// </summary>
public int cp { get; set; }
public int chargePower { get; set; }
/// <summary>
/// 换电站基础信息版 本号
/// 换电站基础信息版本号(换电站编码+更新时间(yyyyMMddHHmmss)
/// </summary>
public string bs { get; set; }
public string stationVersion { get; set; }
/// <summary>
/// 经度
/// </summary>
@ -65,21 +65,21 @@ public class SignIn : ICmd
/// 换电通道数量
/// 换电通道的数目
/// </summary>
public int en { get; set; }
public int channelNumber { get; set; }
/// <summary>
/// 充电机(仓)数量
/// </summary>
public int cn { get; set; }
public int chargerNumber { get; set; }
/// <summary>
/// 电价模型id
/// 服务器分配,默认值为-1
/// </summary>
public int eid { get; set; }
public int electricityId { get; set; }
/// <summary>
/// 电池运营模型id
/// 服务器分配,默认为值-1
/// </summary>
public int oid { get; set; }
public int billingId { get; set; }
public string GetCmd()

@ -7,27 +7,27 @@ public class SingleBatInfo
/// <summary>
/// 电池序列号
/// </summary>
public string bn { get; set; }
public string batteryNo { get; set; }
/// <summary>
/// 充电架 ID 按电池架的编号 A1A2…
/// 充电机编码
/// </summary>
public string sd { get; set; }
public string chargerNo { get; set; }
/// <summary>
/// 所在充电机序号 从 1 开始递增
/// 所在仓编号
/// </summary>
public int cno { get; set; }
public int binNo { get; set; }
/// <summary>
/// 是否在充电 0未知 1正在充电 2未电池
/// </summary>
public int hc { get; set; }
public int chargeOrNot { get; set; }
/// <summary>
/// 电接头连接状态 0未知 1已经连接 2未连接
/// </summary>
public int el { get; set; }
public int spliceStatus { get; set; }
/// <summary>
/// 剩余能量 单位 0.1 kwh
@ -47,22 +47,22 @@ public class SingleBatInfo
/// <summary>
/// 最低单体电压 单位 0.01V
/// </summary>
public float lsv { get; set; }
public float lowVoltage { get; set; }
/// <summary>
/// 最高单体电压 单位 0.01V
/// </summary>
public float hsv { get; set; }
public float highVoltage { get; set; }
/// <summary>
/// 最低单体温度 单位 0.1℃
/// </summary>
public float lst { get; set; }
public float lowTemperature { get; set; }
/// <summary>
/// 最高单体温度 单位 0.1℃
/// </summary>
public float hst { get; set; }
public float highTemperature { get; set; }
/// <summary>
/// 单体电池号 从 1 开始递增
@ -72,16 +72,16 @@ public class SingleBatInfo
/// <summary>
/// 单体电压 每一节电芯的单体电压 单位 0.1V 如果没有该节电芯的数据填65535.0 无效值
/// </summary>
public float sv { get; set; }
public float voltage { get; set; }
/// <summary>
/// 单体温度 每一节电芯的单体温度 单位 0.1℃ ,如果没有该节电芯的数据填65535.0 无效值
/// </summary>
public float st { get; set; }
public float temperature { get; set; }
/// <summary>
/// 更新时间 格式 ”yyyy-MM-dd HH:mm:ss ”
/// </summary>
public DateTime bt { get; set; }
public DateTime updateTime { get; set; }
}

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Entity.Dto.Req;
namespace Service.Cloud.Msg.Host.Req
{
@ -16,38 +17,38 @@ namespace Service.Cloud.Msg.Host.Req
/// 换电站编码
/// 换电站唯一码,区域码+类型码+流水号
/// </summary>
public string sn { get; set; }
public string stationNo { get; set; }
/// <summary>
/// 换电订单号
/// 场站编码+时间yyyyMMddHHmmss)+车牌号,唯一,索引
/// </summary>
public string son { get; set; }
public string orderNo { get; set; }
/// <summary>
/// 订单是否取消
/// 0:正常1:取消
/// <see cref="Entity.Constant.CloudEnum.OrderCancellation"/>
/// </summary>
public byte od { get; set; }
public byte cancelFlag { get; set; }
/// <summary>
/// 是否成功换电
/// 本次换电是否成功.0:失败1:成功
/// <see cref="Entity.Constant.CloudEnum.WhetherTheBatterySwapIsSuccessful"/>
/// </summary>
public byte ic { get; set; }
public byte successFlag { get; set; }
/// <summary>
/// 换电结果
/// 0:正常 1失败
/// <see cref="Entity.Constant.CloudEnum.BatterySwapResults"/>
/// </summary>
public byte rs { get; set; }
public byte result { get; set; }
/// <summary>
/// 失败原因
/// </summary>
public byte fr { get; set; }
public byte causeOfFailure { get; set; }
/// <summary>
/// 车牌号
/// </summary>
public string cn { get; set; }
public string carNo { get; set; }
/// <summary>
/// 车辆VIN码
/// 车辆唯一识别码
@ -61,162 +62,120 @@ namespace Service.Cloud.Msg.Host.Req
/// <summary>
/// 所属车队
/// </summary>
public string mC { get; set; }
/// <summary>
/// 出仓安装电池序列号
/// </summary>
public string dbid { get; set; }
/// <summary>
/// 出仓安装电池SOC
/// </summary>
public int dsoc { get; set; }
/// <summary>
/// 取车电池上次换电结算时 的SOC
/// </summary>
public int lsoc { get; set; }
/// <summary>
/// 出仓安装电池的SOE
/// 单位:kWh,保留两位小数
/// </summary>
public float dsoe { get; set; }
/// <summary>
/// 取车电池上次换电结算时 的 SOE
/// 单位:kWh,保留两位小数
/// </summary>
public float lsoe { get; set; }
/// <summary>
/// 拆卸入仓电池序列号
/// </summary>
public string ubid { get; set; }
/// <summary>
/// 拆卸入仓电池SOC
/// 单位:kWh,保留两位小数
/// </summary>
public int usoc { get; set; }
/// <summary>
/// 拆卸入仓电池SOE
/// 单位:kWh,保留两位小数
/// </summary>
public float usoe { get; set; }
public string teamCode { get; set; }
/// <summary>
/// 装上电池行驶里程
/// 单位:kWh,保留两位小数
/// </summary>
public float tm { get; set; }
public float batteryVtm { get; set; }
/// <summary>
/// 此次换电次序
/// 本日第几次换电
/// </summary>
public int so { get; set; }
public int swapDayCount { get; set; }
/// <summary>
/// 车牌识别时间(或车辆进 站时间)
/// 单位:秒
/// </summary>
public DateTime? ct { get; set; }
public DateTime? recognizeTime { get; set; }
/// <summary>
/// 换电开始时刻
/// 格式”yyyy-MMddHH:mm:ss”
/// </summary>
public DateTime? st { get; set; }
public DateTime? startTime { get; set; }
/// <summary>
/// 换电结来时刻
/// 格式”yyyy-MMddHH:mm:ss”
/// </summary>
public DateTime? et { get; set; }
public DateTime? endTime { get; set; }
/// <summary>
/// 车辆高开时间
/// 格式”yyyy-MMdd
/// </summary>
public DateTime? ot { get; set; }
public DateTime? leaveTime { get; set; }
/// <summary>
/// 本次换电时同
/// 单位:秒 (车辆进站到出站的时间)
/// </summary>
public int wt { get; set; }
/// <summary>
/// 出仓安装地仓位号
/// </summary>
public int? deno { get; set; }
/// <summary>
/// 拆卸入仓池仓位号
/// </summary>
public int? ueno { get; set; }
public int swapTime { get; set; }
/// <summary>
/// 车朝总里程
/// 单位:kWh, 保留两位小数
/// </summary>
public float? vtm { get; set; }
public float? vehicleTotalMiles { get; set; }
/// <summary>
/// 车制累计换电次数
/// </summary>
public int vct { get; set; }
public int swapCount { get; set; }
/// <summary>
/// 车辆累计放电量
/// 单位:kWh, 保留两位小数
/// </summary>
public float vtdc { get; set; }
public float carElectricDischarge { get; set; }
/// <summary>
/// 车辆系计回馈电量
/// 单位:kWh, 保留两位小数
/// </summary>
public float vtfe { get; set; }
public float carFeedbackElectricity { get; set; }
/// <summary>
/// 车朝累计插枪充电量
/// 单位:kWh, 保留两位小数
/// </summary>
public float vtcc { get; set; }
public float chargerTheGunCount { get; set; }
/// <summary>
/// 车制累计综合能耗
/// 单位:kWh, 保留两位小数
/// </summary>
public float vtec { get; set; }
public float carEnergyConsumption { get; set; }
/// <summary>
/// 本次实时放电量
/// 单位:kWh, 保留两位小数
/// </summary>
public float rtdc { get; set; }
public float realTimeDischarge { get; set; }
/// <summary>
/// 上一次结算放电量
/// 至少保留两位有效小数
/// </summary>
public float lsdc { get; set; }
public float lastDischarge { get; set; }
/// <summary>
/// 本次实时回馈电量
/// 单位:kWh, 保留两位小数
/// </summary>
public float rtfc { get; set; }
public float realFeedbackPower { get; set; }
/// <summary>
/// 上一才生笙回性中量
/// 单位:kWh, 保留两位
/// </summary>
public float lsfc { get; set; }
public float lastFeedback { get; set; }
/// <summary>
/// 本次实时插枪充电量
/// 单位:kWh, 保留两位小数
/// </summary>
public float rtce { get; set; }
public float realChargeCount { get; set; }
/// <summary>
/// 上一次结算插枪充电量
/// 单位:kWh, 保留两位小数
/// </summary>
public float lscc { get; set; }
public float lastChargeCount { get; set; }
/// <summary>
/// 本次实时综合能耗
/// 单位:kWh, 保留两位小数
/// </summary>
public float rtec { get; set; }
public float realEnergyConsumption { get; set; }
/// <summary>
/// 上报方式
/// 1自动2人工手动
/// <see cref="Entity.Constant.CloudEnum.EscalationMethod"/>
/// </summary>
public int sfs { get; set; }
public int reportType { get; set; }
/// <summary>
/// 是否是离线订单
/// 0不是1
/// <see cref="Entity.Constant.CloudEnum.OrderType"/>
/// </summary>
public int sflx { get; set; }
public int offlineFlag { get; set; }
public List<SwapOrderBatteryRecord> batteryList { get; set; }
public string GetCmd()
{
return CloudConst.staSwapRecord;

@ -16,43 +16,43 @@ namespace Service.Cloud.Msg.Host.Req
/// 换电通道编号
/// 从 1 开始递增, 0表示默认单仓单通道
/// </summary>
public int ec { get; set; }
public int passageNo { get; set; }
/// <summary>
/// 工作状态
/// 0:未知 1空闲 2工作中 3工作完成
/// <see cref="Entity.Constant.CloudEnum.WorkingStatus"/>
/// </summary>
public int ws { get; set; }
public int status { get; set; }
/// <summary>
/// 换电通道状态
/// 0:未知 1空闲 2占位 3换电准备 4换电开始 5换电中 6换电完成 7换电中故障等待修复
/// 8换电中故障修复完成 9换电暂停 10换电继续 11:换电完成,车辆未驶离 12:换电完成,车辆驶离
/// <see cref="Entity.Constant.CloudEnum.BatterySwapStatus"/>
/// </summary>
public int cs { get; set; }
public int passageStatus { get; set; }
/// <summary>
/// 是否有车
/// 0未知 1有车 2无车
/// <see cref="Entity.Constant.CloudEnum.WhetherThereIsACarOrNot"/>
/// </summary>
public int iv { get; set; }
public int carFlag { get; set; }
/// <summary>
/// 锁止状态
/// 商用车有效 0未知 1加锁状态 2解锁状态
/// <see cref="Entity.Constant.CloudEnum.LockedState"/>
/// </summary>
public int ls { get; set; }
public int lockStatus { get; set; }
/// <summary>
/// 换电站通道故障等级
/// 0 正常 1故障等级一 2故障等级二 3故障等级三 4故障等级四 5故障等级五 6故障等级六
/// <see cref="Entity.Constant.CloudEnum.FailureLevel"/>
/// </summary>
public int fl { get; set; }
public int faultLevel { get; set; }
/// <summary>
/// 更新时间
/// 格式”yyyy-MM-dd HH:mm:ss”
/// </summary>
public DateTime ut { get; set; }
public DateTime updateTime { get; set; }
public string GetCmd()
{

@ -17,26 +17,33 @@ namespace Service.Cloud.Msg.Host.Resp
/// 0:成功 1失败
/// <see cref="Entity.Constant.CloudEnum.ResultInt"/>
/// </summary>
public int re { get; set; }
public int result { get; set; }
/// <summary>
/// 车辆所在的换电 通道
/// 从 1 开始递增, 0表示默认单仓单通道
/// </summary>
public int en { get; set; }
public int channel { get; set; }
/// <summary>
/// 订单号
/// 场站编码12 字节)+时间yyyyMMddHHmmss)14 位 + 2 位
/// </summary>
public string on { get; set; }
public string order { get; set; }
/// <summary>
/// 换电请求应答
/// 0 无 1 换电请求成功 2 换电请求失败3 取消换电请求成功 4 取消换电请求失败
/// <see cref="Entity.Constant.CloudEnum.AnsweringTheBatterySwapRequest"/>
/// </summary>
public int cs { get; set; }
public int swapFlag { get; set; }
public string GetCmd()
{
return CloudConst.carCanStartRes;
}
public CarCanStartRes(int result, int channel, string order, int swapFlag)
{
this.result = result;
this.channel = channel;
this.order = order;
this.swapFlag = swapFlag;
}
}
}

@ -2,7 +2,7 @@
public class Model<T> where T : ICmd
{
public Header Header { get; set; }
public Header header { get; set; }
public T body { get; set; }
public string dataSign { get; set; }
}

@ -13,6 +13,7 @@ using Service.Execute.Model;
using Service.Execute.Model.Tbox;
using Service.Init;
using System.Security.Cryptography;
using Entity.Dto.Req;
namespace Service.Execute.Api;
@ -32,13 +33,13 @@ public abstract class CloudApi
{
CarAuth carAuth = new()
{
ty = 2,
authType = 1,
rfid = rfidReadModel.VelVin,
cn = rfidReadModel.VelNo,
vi = rfidReadModel.VelVin,
carNo = rfidReadModel.VelNo,
vin = rfidReadModel.VelVin,
// mac = rfidReadModel.VelMac,
en = 0,
dt = swapOrder.VehicleEnterTime,
channel = 0,
enterTime = swapOrder.VehicleEnterTime,
mode = 0,
};
@ -61,37 +62,47 @@ public abstract class CloudApi
/// <param name="rfidReadModel"></param>
/// <param name="swapOrder"></param>
/// <returns></returns>
public static int UploadSwapOrder(SwapOrder swapOrder, int seq, SwapOrderBattery swapOrderBattery, int uploadType
public static int UploadSwapOrder(SwapOrder swapOrder, int seq, List<SwapOrderBattery> swapOrderBattery, int uploadType
,SwapOrderReportCloud orderReportCloud)
{
List<SwapOrderBatteryRecord> swapOrderBatteryList = new List<SwapOrderBatteryRecord>();
foreach (var orderBattery in swapOrderBattery)
{
SwapOrderBatteryRecord batteryRecord = new SwapOrderBatteryRecord();
batteryRecord.outBatteryNo = orderBattery.UpBatteryNo;
batteryRecord.outBin = orderBattery.UpBatteryBinNo;
batteryRecord.outSoc = orderBattery.UpBatterySoc.ToInt();
batteryRecord.enterBatteryNo = orderBattery.DownBatteryNo;
batteryRecord.enterBin = orderBattery.DownBatteryBinNo;
batteryRecord.enterSoc = orderBattery.DownBatterySoc.ToInt();
batteryRecord.outSoe = orderBattery.UpBatterySoe.ToInt();
batteryRecord.enterSoe = orderBattery.DownBatterySoe.ToInt();
swapOrderBatteryList.Add(batteryRecord);
}
StaSwapRecord staSwapRecord = new()
{
rfid = swapOrder.VehicleVin,
sn = StaticStationInfo.StationNo,
son = swapOrder.CloudSn,
cn = swapOrder.VehicleNo,
so = seq,
ct = swapOrder.VehicleEnterTime,
st = swapOrder.SwapBeginTime,
dbid = swapOrderBattery.UpBatteryNo,
deno = swapOrderBattery.UpBatteryBinNo,
dsoc = swapOrderBattery.UpBatterySoc.ToInt(),
stationNo = StaticStationInfo.StationNo,
orderNo = swapOrder.CloudSn,
carNo = swapOrder.VehicleNo,
swapDayCount = seq,
recognizeTime = swapOrder.VehicleEnterTime,
startTime = swapOrder.SwapBeginTime,
//dsoe = swapOrderBattery.UpBatterySoe.ToInt(),
et = swapOrder.SwapEndTime,
od = 0,
ot = swapOrder.VehicleLeaveTime,
rs = 0,
sflx = 0,
sfs = uploadType,
ubid = swapOrderBattery.DownBatteryNo,
ueno = swapOrderBattery.DownBatteryBinNo,
usoc = swapOrderBattery.DownBatterySoc.ToInt(),
endTime = swapOrder.SwapEndTime,
cancelFlag = 0,
leaveTime = swapOrder.VehicleLeaveTime,
result = 0,
offlineFlag = 0,
reportType = uploadType,
// usoe = swapOrderBattery.DownBatterySoe.ToInt(),
vin = swapOrder.VehicleVin,
wt = new TimeSpan((swapOrder.SwapEndTime.ToDateTime().Ticks - swapOrder.SwapBeginTime.ToDateTime().Ticks))
swapTime = new TimeSpan((swapOrder.SwapEndTime.ToDateTime().Ticks - swapOrder.SwapBeginTime.ToDateTime().Ticks))
.TotalSeconds.ToInt(),
vtm=orderReportCloud.Vtm,
vehicleTotalMiles=orderReportCloud.Vtm,
batteryList=swapOrderBatteryList,
};
Log.Info(
$" CloudApi UploadSwapOrder seq={seq} SendUploadPowerChangeOrder param={JsonConvert.SerializeObject(staSwapRecord)}");
@ -107,7 +118,7 @@ public abstract class CloudApi
return -1;
}
return sendUploadPowerChangeOrder.re;
return sendUploadPowerChangeOrder.result;
}
@ -128,13 +139,13 @@ public abstract class CloudApi
{
stationChnRunStatus = new()
{
ec = 0,
ws = StationSoftMgr.SwappingStateMachine.SwapStatus == 0 ? 2 : 3,
cs = (int)StationSoftMgr.SwappingStateMachine.BusinessSwappingForCloudState,
iv = StationSoftMgr.SwappingStateMachine.RadarInFlag == true ? 1 : 2,
ls = StationSoftMgr.SwappingStateMachine.VelUnlockFlag == true ? 2 : 1,
fl = Convert.ToInt32(StaticStationInfo.Faultlevel),
ut = DateTime.Now,
passageNo = 0,
status = StationSoftMgr.SwappingStateMachine.SwapStatus == 0 ? 2 : 3,
passageStatus = (int)StationSoftMgr.SwappingStateMachine.BusinessSwappingForCloudState,
carFlag = StationSoftMgr.SwappingStateMachine.RadarInFlag == true ? 1 : 2,
lockStatus = StationSoftMgr.SwappingStateMachine.VelUnlockFlag == true ? 2 : 1,
faultLevel = Convert.ToInt32(StaticStationInfo.Faultlevel),
updateTime = DateTime.Now,
};
}
@ -143,13 +154,13 @@ public abstract class CloudApi
stationChnRunStatus = new()
{
ec = 0,
ws = 1,
cs = 1,
iv = 2,
ls = 0,
fl = Convert.ToInt32(StaticStationInfo.Faultlevel),
ut = DateTime.Now,
passageNo = 0,
status = 1,
passageStatus = 1,
carFlag = 2,
lockStatus = 0,
faultLevel = Convert.ToInt32(StaticStationInfo.Faultlevel),
updateTime = DateTime.Now,
};
}
@ -385,28 +396,26 @@ public abstract class CloudApi
{
SignIn signIn = new()
{
sn = StaticStationInfo.StationNo,
ky = StaticStationInfo.StationSn,
st = "02",
dv = "",
sv = StaticStationInfo.StationSftVer,
ss = StaticStationInfo.Sevstatus,
ca = Convert.ToSingle(StaticStationInfo.DistributionCapacity),
VS = "1.0",
cp = Convert.ToInt32(StaticStationInfo.TotalPower),
bs= StaticStationInfo.StationVersion,
stationNo = StaticStationInfo.StationNo,
supplierCode = StaticStationInfo.StationSn,
stationType = "02",
equipmentType = "",
version = StaticStationInfo.StationSftVer,
stationStatus = StaticStationInfo.Sevstatus,
stationCapacity = Convert.ToSingle(StaticStationInfo.DistributionCapacity),
equipmentVersion = "1.0",
chargePower = Convert.ToInt32(StaticStationInfo.TotalPower),
stationVersion= StaticStationInfo.StationVersion,
lo= StaticStationInfo.Longitude,
la= StaticStationInfo.Latitude,
en=1,
cn=7,
eid= Convert.ToInt32(StaticStationInfo.Ceid),
oid = Convert.ToInt32(StaticStationInfo.Oid),
channelNumber=1,
chargerNumber=7,
electricityId= Convert.ToInt32(StaticStationInfo.Ceid),
billingId = Convert.ToInt32(StaticStationInfo.Oid),
};
//CloudClientMgr.CloudClient?.SendSignIn(signIn,
// global::System.TimeSpan.FromSeconds(TimeSpan));
CloudClientMgr.CloudClient?.SendSignIn(signIn,
global::System.TimeSpan.FromSeconds(TimeSpan));
}
/// <summary>

@ -196,7 +196,7 @@ public class CarPrepareState : IState
{
CarAuthRes? vehicleCertificationResp =
CloudApi.VehicleCheck(machine.RfidReadModel, machine.SwapOrder);
if (vehicleCertificationResp == null || vehicleCertificationResp.re != 0)
if (vehicleCertificationResp == null || vehicleCertificationResp.result != 0)
{
_log.Info("cloud check vehicle error");
// machine.LedTool?.WriteProgramContent("换电准备中:云平台车辆验证完成");
@ -208,7 +208,7 @@ public class CarPrepareState : IState
machine.CloudVelCheckFlag = true;
// machine.LedTool?.WriteProgramContent("换电准备中:云平台车辆验证完成");
machine.SwapOrder.CloudSn = vehicleCertificationResp.on;
machine.SwapOrder.CloudSn = vehicleCertificationResp.order;
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag,
machine);
}

@ -58,14 +58,14 @@ public class SwapCanStartState : IState
if (carCanStart != null)
{
//车牌号
if (carCanStart.cn.Equals(machine.BoxCarInfoModel.CarNo))
if (carCanStart.carNo.Equals(machine.BoxCarInfoModel.CarNo))
{
//可以开始换电
if (carCanStart.cs == 1)
if (carCanStart.swapFlag == 1)
{
_log.Info("SwapCanStart ok");
//更新换电订单
machine.SwapOrder.CloudSn = carCanStart.on;
machine.SwapOrder.CloudSn = carCanStart.order;
_swapOrderRepository.Update(machine.SwapOrder.CloudSn);
machine.CloudCarCanStartFlag = true;

@ -78,7 +78,7 @@ public class SwapOrderMgr
var count = _swapOrderRepository.GetCount(i =>
i.SwapResult == 1 && i.SwapEndTime >= DateTime.Today && i.SwapEndTime < swapOrder.SwapEndTime);
swapOrderReportClouds.TryGetValue(swapOrder.Id, out SwapOrderReportCloud value);
var uploadSwapOrder = CloudApi.UploadSwapOrder(swapOrder, count++, swapOrderBattery, uploadType,value);
var uploadSwapOrder = CloudApi.UploadSwapOrder(swapOrder, count++, batterys, uploadType,value);
if (uploadSwapOrder == 0)
{

@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Mvc;
using Repository.Station;
using Service.Cloud.Client;
using Service.Cloud.Msg.Cloud.Resp;
using Service.Cloud.Msg.Host.Req;
using Service.Execute.Api;
using Service.Execute.Model;
using SqlSugar;
@ -61,6 +62,21 @@ public class GenController : ControllerBase
[HttpGet("CloudTestUploadSwapOrder")]
public Result<CarAuthRes> CloudTestUploadSwapOrder()
{
var swapOrderBatterList = new List<SwapOrderBattery>()
{
new SwapOrderBattery()
{
DownBatteryNo = "123", DownBatterySoc = 30, DownBatteryBinNo = 2, UpBatteryNo = "456",
UpBatterySoc = 100, UpBatteryBinNo = 3
},
new SwapOrderBattery()
{
DownBatteryNo = "789", DownBatterySoc = 40, DownBatteryBinNo = 4, UpBatteryNo = "987",
UpBatterySoc = 95, UpBatteryBinNo = 5
}
};
var uploadSwapOrder = CloudApi.UploadSwapOrder(new SwapOrder()
{
VehicleEnterTime = DateTime.Now,
@ -72,11 +88,7 @@ public class GenController : ControllerBase
VehicleLeaveTime = DateTime.Now,
},
1,
new SwapOrderBattery()
{
DownBatteryNo = "123", DownBatterySoc = 30, DownBatteryBinNo = 2, UpBatteryNo = "456",
UpBatterySoc = 100, UpBatteryBinNo = 3
}, 1, new SwapOrderReportCloud()
swapOrderBatterList, 1, new SwapOrderReportCloud()
{
});
@ -106,6 +118,15 @@ public class GenController : ControllerBase
return Result<CarAuthRes>.Success();
}
[HttpGet("CloudTestStationChnRunStatus")]
public Result<CarAuthRes> CloudTestStationChnRunStatus()
{
StationChnRunStatus stationChnRunStatus = new StationChnRunStatus();
stationChnRunStatus.updateTime=DateTime.Now;
CloudClientMgr.CloudClient?.SendChannelStatusReporting(stationChnRunStatus, new TimeSpan());
return Result<CarAuthRes>.Success();
}
[HttpGet("test115")]

Loading…
Cancel
Save