diff --git a/Entity/Dto/Req/SwapOrderBatteryRecord.cs b/Entity/Dto/Req/SwapOrderBatteryRecord.cs new file mode 100644 index 0000000..3620725 --- /dev/null +++ b/Entity/Dto/Req/SwapOrderBatteryRecord.cs @@ -0,0 +1,61 @@ +namespace Entity.Dto.Req; + +/// +/// 上传换电订单电池列表 +/// +public class SwapOrderBatteryRecord +{ + /// + /// 出仓安装电池序列号 + /// + public string outBatteryNo { get; set; } + + /// + /// 出仓安装电池SOC + /// + public int outSoc { get; set; } + + /// + /// 取车电池上次换电结算时 的SOC + /// + public int lastSoc { get; set; } + + /// + /// 出仓安装电池的SOE + /// 单位:kWh,保留两位小数 + /// + public float outSoe { get; set; } + + /// + /// 取车电池上次换电结算时 的 SOE + /// 单位:kWh,保留两位小数 + /// + public float lastSoe { get; set; } + + /// + /// 拆卸入仓电池序列号 + /// + public string enterBatteryNo { get; set; } + + /// + /// 拆卸入仓电池SOC + /// 单位:kWh,保留两位小数 + /// + public int enterSoc { get; set; } + + /// + /// 拆卸入仓电池SOE + /// 单位:kWh,保留两位小数 + /// + public float enterSoe { get; set; } + + /// + /// 出仓安装地仓位号 + /// + public int? outBin { get; set; } + + /// + /// 拆卸入仓池仓位号 + /// + public int? enterBin { get; set; } +} \ No newline at end of file diff --git a/Service/Cloud/Client/CloudClient.cs b/Service/Cloud/Client/CloudClient.cs index 8fd352b..d6f5ad5 100644 --- a/Service/Cloud/Client/CloudClient.cs +++ b/Service/Cloud/Client/CloudClient.cs @@ -307,13 +307,13 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR { Model model = new Model { - 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(); } /// @@ -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); diff --git a/Service/Cloud/Client/CloudClientMgr.cs b/Service/Cloud/Client/CloudClientMgr.cs index 0a20291..96a7f3f 100644 --- a/Service/Cloud/Client/CloudClientMgr.cs +++ b/Service/Cloud/Client/CloudClientMgr.cs @@ -83,7 +83,7 @@ public class CloudClientMgr #region 遥测合并上报 - req.datainfo = new List(); + req.chargeDevDataList = new List(); 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(); + req.chargeDevDataList = new List(); } Log.Info($"receive UploadTelemetryData={value}"); @@ -197,7 +197,6 @@ public class CloudClientMgr StartAsyncLoop(); - } diff --git a/Service/Cloud/Common/CloudConst.cs b/Service/Cloud/Common/CloudConst.cs index 4c92382..9d778ff 100644 --- a/Service/Cloud/Common/CloudConst.cs +++ b/Service/Cloud/Common/CloudConst.cs @@ -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"; diff --git a/Service/Cloud/Handler/BatDataInfoResHandler.cs b/Service/Cloud/Handler/BatDataInfoResHandler.cs new file mode 100644 index 0000000..4a355ca --- /dev/null +++ b/Service/Cloud/Handler/BatDataInfoResHandler.cs @@ -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(t); + Log.Info($"receive BatDataInfoRes res={res} {JsonConvert.SerializeObject(res)}"); } +} \ No newline at end of file diff --git a/Service/Cloud/Handler/CarCanStartHandler.cs b/Service/Cloud/Handler/CarCanStartHandler.cs index cdf3d77..9ebf576 100644 --- a/Service/Cloud/Handler/CarCanStartHandler.cs +++ b/Service/Cloud/Handler/CarCanStartHandler.cs @@ -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(t); CloudClientMgr.CloudClient.CarCanStart = carCanStart; + if (carCanStart!=null) + { + CarCanStartRes resp = new CarCanStartRes(0,carCanStart.channel,carCanStart.order,1); + CloudClientMgr.CloudClient?.Publish(resp); + } } } \ No newline at end of file diff --git a/Service/Cloud/Handler/ChargeRecordUploadResHandler.cs b/Service/Cloud/Handler/ChargeRecordUploadResHandler.cs index 790982d..3c4687f 100644 --- a/Service/Cloud/Handler/ChargeRecordUploadResHandler.cs +++ b/Service/Cloud/Handler/ChargeRecordUploadResHandler.cs @@ -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); } diff --git a/Service/Cloud/Handler/SignInRespHandler.cs b/Service/Cloud/Handler/SignInRespHandler.cs index 2290e29..20f0d13 100644 --- a/Service/Cloud/Handler/SignInRespHandler.cs +++ b/Service/Cloud/Handler/SignInRespHandler.cs @@ -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(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; - } - } \ No newline at end of file diff --git a/Service/Cloud/Handler/StationChnRunStatusResHandler.cs b/Service/Cloud/Handler/StationChnRunStatusResHandler.cs new file mode 100644 index 0000000..19539c9 --- /dev/null +++ b/Service/Cloud/Handler/StationChnRunStatusResHandler.cs @@ -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(t); + Log.Info($"receive StationChnRunStatusRes res={res} {JsonConvert.SerializeObject(res)}"); + + } +} \ No newline at end of file diff --git a/Service/Cloud/Handler/UploadSwapOrderResHandler.cs b/Service/Cloud/Handler/UploadSwapOrderResHandler.cs index dde7b3a..7ff85e2 100644 --- a/Service/Cloud/Handler/UploadSwapOrderResHandler.cs +++ b/Service/Cloud/Handler/UploadSwapOrderResHandler.cs @@ -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); } diff --git a/Service/Cloud/Msg/Cloud/Req/CarCanStart.cs b/Service/Cloud/Msg/Cloud/Req/CarCanStart.cs index 90d20cb..f4d89e9 100644 --- a/Service/Cloud/Msg/Cloud/Req/CarCanStart.cs +++ b/Service/Cloud/Msg/Cloud/Req/CarCanStart.cs @@ -16,23 +16,23 @@ namespace Service.Cloud.Msg.Cloud.Req /// 订单号 /// 场站编码(12 字节)+时间(yyyyMMddHHmmss)14 位 + 2 位 /// - public string on { get; set; } + public string order { get; set; } /// /// 车辆所在的换电 通道 /// 从 1 开始递增, 0:表示默认单仓单通道 /// - public int en { get; set; } + public int channel { get; set; } /// /// 车牌号 /// 一般车牌规则,当 ty 为 1 时,该字段必须填 /// - public string cn { get; set; } + public string carNo { get; set; } /// /// 是否开始换电 1:可以开始换电 2:终止换电 /// 1:可以开始换电 2:终止换电(取消换电) /// /// /// - public byte cs { get; set; } + public byte swapFlag { get; set; } public string GetCmd() { return CloudConst.carCanStart; diff --git a/Service/Cloud/Msg/Cloud/Resp/BatDataInfoRes.cs b/Service/Cloud/Msg/Cloud/Resp/BatDataInfoRes.cs index 03f63a1..cbc3f8c 100644 --- a/Service/Cloud/Msg/Cloud/Resp/BatDataInfoRes.cs +++ b/Service/Cloud/Msg/Cloud/Resp/BatDataInfoRes.cs @@ -9,7 +9,7 @@ public class BatDataInfoRes : ICmd /// 0:成功 1:失败 /// /// - public byte re { get; set; } + public byte result { get; set; } public string GetCmd() { diff --git a/Service/Cloud/Msg/Cloud/Resp/CarAuthRes.cs b/Service/Cloud/Msg/Cloud/Resp/CarAuthRes.cs index a24616d..d8e4258 100644 --- a/Service/Cloud/Msg/Cloud/Resp/CarAuthRes.cs +++ b/Service/Cloud/Msg/Cloud/Resp/CarAuthRes.cs @@ -23,20 +23,20 @@ namespace Service.Cloud.Msg.Cloud.Resp /// 6:没有招到对应的 rfid 卡号 /// /// - public int re { get; set; } + public int result { get; set; } /// /// 认证方式 /// 1 车牌号 2 rfid 卡号 /// /// - public int ty { get; set; } + public int authType { get; set; } /// /// 车牌号 /// 当 ty 为 1 时,该字段必须填,其他为可选项,一般车牌规则 /// - public string cn { get; set; } + public string carNo { get; set; } /// /// 卡号 @@ -48,13 +48,13 @@ namespace Service.Cloud.Msg.Cloud.Resp /// 车辆识别号 /// 该字段必须填 /// - public string vi { get; set; } + public string vin { get; set; } /// /// 订单号 /// 场站编码(12 字节)+时间(yyyyMMddHHmmss)14 位 + 2 位 /// - public string on { get; set; } + public string order { get; set; } /// /// Mac 地址 diff --git a/Service/Cloud/Msg/Cloud/Resp/ChargeDevDataInfoRes.cs b/Service/Cloud/Msg/Cloud/Resp/ChargeDevDataInfoRes.cs index f38f803..be7e436 100644 --- a/Service/Cloud/Msg/Cloud/Resp/ChargeDevDataInfoRes.cs +++ b/Service/Cloud/Msg/Cloud/Resp/ChargeDevDataInfoRes.cs @@ -15,7 +15,7 @@ namespace Service.Cloud.Msg.Cloud.Resp /// /// 应答结果0成功1失败 /// - public byte re { get; set; } + public byte result { get; set; } public string GetCmd() { diff --git a/Service/Cloud/Msg/Cloud/Resp/ChargeRecordUploadRes.cs b/Service/Cloud/Msg/Cloud/Resp/ChargeRecordUploadRes.cs index 31095ab..2598ab0 100644 --- a/Service/Cloud/Msg/Cloud/Resp/ChargeRecordUploadRes.cs +++ b/Service/Cloud/Msg/Cloud/Resp/ChargeRecordUploadRes.cs @@ -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() { diff --git a/Service/Cloud/Msg/Cloud/Resp/SignInRes.cs b/Service/Cloud/Msg/Cloud/Resp/SignInRes.cs index 55556ca..883042a 100644 --- a/Service/Cloud/Msg/Cloud/Resp/SignInRes.cs +++ b/Service/Cloud/Msg/Cloud/Resp/SignInRes.cs @@ -11,7 +11,7 @@ public class SignInRes : ICmd /// 0:成功 1:设备不存在 2:非法设备 3:站控软件版本错误 4.协议版本错误 /// /// - public int re { get; set; } + public int result { get; set; } /// /// 是否需要上传设备列表 /// 2:初始上传 1:需要重新上传 0:不需要上传 @@ -22,13 +22,13 @@ public class SignInRes : ICmd /// 云平台系统时间 /// 格式”yyyy-MM-dd HH:mm:ss” /// - public DateTime ti { get; set; } + public DateTime cloudTime { get; set; } /// /// 加密方式 /// 0:不加密 1:AES /// /// - public int ew { get; set; } + public int encryptType { get; set; } public string GetCmd() { diff --git a/Service/Cloud/Msg/Cloud/Resp/StaSwapRecordRes.cs b/Service/Cloud/Msg/Cloud/Resp/StaSwapRecordRes.cs index 4e299c6..9293c1d 100644 --- a/Service/Cloud/Msg/Cloud/Resp/StaSwapRecordRes.cs +++ b/Service/Cloud/Msg/Cloud/Resp/StaSwapRecordRes.cs @@ -17,11 +17,15 @@ namespace Service.Cloud.Msg.Cloud.Resp /// 0:成功 1:失败 /// /// - public int re { get; set; } + public int result { get; set; } + /// + /// 换电订单号 + /// + public string orderNo { get; set; } /// /// 失败原因 /// - public string fr { get; set; } + public string causeOfFailure { get; set; } public string GetCmd() { diff --git a/Service/Cloud/Msg/Cloud/Resp/StationChnRunStatusRes.cs b/Service/Cloud/Msg/Cloud/Resp/StationChnRunStatusRes.cs index b01c0f9..f5a1fdc 100644 --- a/Service/Cloud/Msg/Cloud/Resp/StationChnRunStatusRes.cs +++ b/Service/Cloud/Msg/Cloud/Resp/StationChnRunStatusRes.cs @@ -17,12 +17,12 @@ namespace Service.Cloud.Msg.Cloud.Resp /// 0:成功 1:失败 /// /// - public byte re { get; set; } + public byte result { get; set; } /// /// 接收失败原因 /// 比如:解析失败 /// - public byte rs { get; set; } + public string resultReason { get; set; } public string GetCmd() { diff --git a/Service/Cloud/Msg/Header.cs b/Service/Cloud/Msg/Header.cs index fcd91fb..d884ad1 100644 --- a/Service/Cloud/Msg/Header.cs +++ b/Service/Cloud/Msg/Header.cs @@ -13,7 +13,7 @@ public class Header /// /// /// - public string sid { get; set; } + public string stationNo { get; set; } /// /// /// @@ -21,5 +21,5 @@ public class Header /// /// /// - public long timeStamp { get; set; } + public long timestamp { get; set; } } \ No newline at end of file diff --git a/Service/Cloud/Msg/Host/Req/BatDataInfo.cs b/Service/Cloud/Msg/Host/Req/BatDataInfo.cs index 0a91b8f..c477bfc 100644 --- a/Service/Cloud/Msg/Host/Req/BatDataInfo.cs +++ b/Service/Cloud/Msg/Host/Req/BatDataInfo.cs @@ -10,17 +10,17 @@ namespace Service.Cloud.Msg.Host.Req /// /// 场站编码 换电站唯一码 /// - public string sn { get; set; } + public string stationNo { get; set; } /// /// 换电站电池包总 数量 /// - public int batn { get; set; } + public int batteryQuantity { get; set; } /// /// 电池信息 /// - public List datainfo { get; set; } + public List dataList { get; set; } public string GetCmd() { diff --git a/Service/Cloud/Msg/Host/Req/CarAuth.cs b/Service/Cloud/Msg/Host/Req/CarAuth.cs index aaf3e6c..ea29ebe 100644 --- a/Service/Cloud/Msg/Host/Req/CarAuth.cs +++ b/Service/Cloud/Msg/Host/Req/CarAuth.cs @@ -18,12 +18,12 @@ namespace Service.Cloud.Msg.Host.Req /// 1 车牌号 2 rfid 卡号 /// /// - public int ty { get; set; } + public int authType { get; set; } /// /// 车牌号 /// 一般车牌规则,当 ty 为 1 时,该字段必须填 /// - public string cn { get; set; } + public string carNo { get; set; } /// /// rfid卡号 /// 当 ty 为 2 时,该字段必须填 @@ -33,7 +33,7 @@ namespace Service.Cloud.Msg.Host.Req /// 车辆识别号 /// 当 ty 为 2 时,该字段必须填,如果字段为空时,需要进行 MAC 地址验证,MAC地址和 vin 不能同时为空。 /// - public string vi { get; set; } + public string vin { get; set; } /// /// MAC地址 /// 当 ty 为 2 时,该字段必须填,如果该字段为空时,需要进行 VIN 验证,MAC地址和 vin 不能同时为空。 @@ -43,17 +43,17 @@ namespace Service.Cloud.Msg.Host.Req /// 所有车队 /// 当 ty 为 2 时,该字段必须填 /// - public string mc { get; set; } + public string teamCode { get; set; } /// /// 车辆所在换电通 道 /// 从 1 开始递增 0:表示默认单仓单通道 /// - public int en { get; set; } + public int channel { get; set; } /// /// 车辆进入的时间 /// 格式 “yyyy-mm-dd hh:mm:ss” /// - public DateTime? dt { get; set; } + public DateTime? enterTime { get; set; } /// /// 车牌图片 /// 可选项,换电站需将图片进行 base64编码后才能传输,后台收到字段进行base64 解码后才能查看 diff --git a/Service/Cloud/Msg/Host/Req/ChargeDevDataInfo.cs b/Service/Cloud/Msg/Host/Req/ChargeDevDataInfo.cs index c74b1c4..56d589c 100644 --- a/Service/Cloud/Msg/Host/Req/ChargeDevDataInfo.cs +++ b/Service/Cloud/Msg/Host/Req/ChargeDevDataInfo.cs @@ -10,9 +10,9 @@ namespace Service.Cloud.Msg.Host.Req /// /// 场站编码 换电站唯一码 /// - public string sn { get; set; } + public string stationNo { get; set; } - public List datainfo { get; set; } + public List chargeDevDataList { get; set; } public string GetCmd() @@ -26,144 +26,144 @@ namespace Service.Cloud.Msg.Host.Req /// /// 设备编号 设备编号 /// - public string en { get; set; } + public string equipmentNo { get; set; } /// /// 充电架 ID 按电池架的编号 A1,A2… /// - public string sd { get; set; } + public string chargerId { get; set; } /// /// 充电机最大允许 输出功率 单位 0.1kw /// - public float mtp { get; set; } + public float highPower { get; set; } /// /// 充电机最大允 许充电速率 单位 0.1C /// - public float mcr { get; set; } + public float highSpeed { get; set; } /// /// 电池架上是否有 电池 0:未知 1:有电池 2:无电池 /// - public int hb { get; set; } + public int isThereAnyBattery { get; set; } /// /// 电接头连接状态 0:未知 1:已经连接 2:未连接 /// - public int el { get; set; } + public int electronicStreet { get; set; } /// /// 充电机序号 从 1 开始递增 /// - public int cno { get; set; } + public int chargerNo { get; set; } /// /// 充电机的工作状态 00H:待机 01H:工作02H:工作完成03H:充电暂停 /// - public int cs { get; set; } + public int chargerStatus { get; set; } /// /// 故障状态 00H:无故障 01H:有故障 /// - public int fs { get; set; } + public int faultStatus { get; set; } ///告警状态 00H:无告警.01H:有告警 - public int @as { get; set; } + public int alarmStatus { get; set; } /// /// 故障码 参考充电机的故障码定义 /// - public int fc { get; set; } + public int faultCode { get; set; } /// /// 充电开始时间 没有进行充电填空 /// - public DateTime st { get; set; } + public DateTime startTime { get; set; } /// /// 已经充电时间 单位 分钟 /// - public int ct { get; set; } + public int chargerTime { get; set; } /// /// 充电开始 SOC 0-100 单位 0.1 ,没有充电填 0 /// - public int ssoc { get; set; } + public int startSoc { get; set; } /// /// 当前 SOC 单位 0.1 /// - public int csoc { get; set; } + public int soc { get; set; } /// /// 充电开始 SOE 单位 0.1kwh,没有充电填 0 /// - public float ssoe { get; set; } + public float startSoe { get; set; } /// /// 当前 SOE 单位 0.1kwh /// - public float csoe { get; set; } + public float soe { get; set; } /// /// 当前充电电压 单位 0.1V,没有充电填 0 /// - public float cvot { get; set; } + public float voltage { get; set; } /// /// 当前充电电流 单位 0.1A,没有充电填 0 /// - public float ccur { get; set; } + public float electricCurrent { get; set; } /// /// BMS 需求电压 单位 0.1V,没有充电填 0 /// - public float nvot { get; set; } + public float bmsVoltage { get; set; } /// /// BMS 需求电流 单位 0.1A,没有充电填 0 /// - public float ncur { get; set; } + public float bmsElectricCurrent { get; set; } /// /// 最低单体电压 单位 0.01V /// - public float lsv { get; set; } + public float lowVoltage { get; set; } /// /// 最高单体电压 单位 0.01V /// - public float hsv { get; set; } + public float highVoltage { get; set; } /// /// 最低单体温度 单位 0.1℃ /// - public float lst { get; set; } + public float lowTemperature { get; set; } /// /// 最高单体温度 单位 0.1℃ /// - public float hst { get; set; } + public float highTemperature { get; set; } /// /// 水冷状态 0:未知 1:开启 2:关闭 0xFF: 无水冷设备 /// - public byte ws { get; set; } + public byte waterCoolingStatus { get; set; } /// /// 进水口温度 单位 0.1℃ , 没有水冷设备填 0xFF /// - public float it { get; set; } + public float intakeTemperature { get; set; } /// /// 出水口温度 单位 0.1℃ , 没有水冷设备填 0xFF /// - public float ot { get; set; } + public float outletTemperature { get; set; } /// /// 更新时间 格式 ”yyyy-MM-dd HH:mm:ss ” /// - public DateTime bt { get; set; } + public DateTime updateTime { get; set; } } } \ No newline at end of file diff --git a/Service/Cloud/Msg/Host/Req/ChargeRecordUpLoad.cs b/Service/Cloud/Msg/Host/Req/ChargeRecordUpLoad.cs index 2032b06..2a44884 100644 --- a/Service/Cloud/Msg/Host/Req/ChargeRecordUpLoad.cs +++ b/Service/Cloud/Msg/Host/Req/ChargeRecordUpLoad.cs @@ -7,92 +7,92 @@ public class ChargeRecordUpLoad : ICmd /// /// 充电序列号 /// - public string chrsn { get; set; } + public string chargeOrderNo { get; set; } /// /// 换电序列号 /// - public string son { get; set; } + public string swapOrderNo { get; set; } /// /// 电池序列号 /// - public string bid { get; set; } + public string batteryNo { get; set; } /// /// 开始时间 /// - public DateTime st { get; set; } + public DateTime startTime { get; set; } /// /// 结束时间 /// - public DateTime et { get; set; } + public DateTime endTime { get; set; } /// /// 开始 SOC /// - public int ssoc { get; set; } + public int startSoc { get; set; } /// /// 结束 SOC /// - public int esoc { get; set; } + public int endSoc { get; set; } /// /// 开始 SOE /// - public float ssoe { get; set; } + public float startSoe { get; set; } /// /// 结束 SOE /// - public float esoe { get; set; } + public float endSoe { get; set; } /// /// 直流电表充电 电量 /// - public float dcce { get; set; } + public float directCurrent { get; set; } /// /// 交流电表充电 电量 /// - public float acce { get; set; } + public float acMeter { get; set; } /// /// 尖时段电量 /// - public float tp { get; set; } + public float theTipElectric { get; set; } /// /// 峰时段电量 /// - public float pp { get; set; } + public float peakElectric { get; set; } /// /// 平时段电量 /// - public float fp { get; set; } + public float flatElectric { get; set; } /// /// 谷时段电量 /// - public float vp { get; set; } + public float theValleyElectric { get; set; } /// /// 充电时长 分钟 /// - public int ct { get; set; } + public int chargerTime { get; set; } /// /// 充电次数 /// - public int cn { get; set; } + public int chargerFrequency { get; set; } /// /// 1: 自动; 2: 人工手动 /// - public int sfs { get; set; } + public int reportType { get; set; } /// /// 车辆vin码 @@ -102,7 +102,7 @@ public class ChargeRecordUpLoad : ICmd /// /// 0:站内充电 1: 站外充电 /// - public int sfoc { get; set; } + public int chargerType { get; set; } public string GetCmd() { diff --git a/Service/Cloud/Msg/Host/Req/SignIn.cs b/Service/Cloud/Msg/Host/Req/SignIn.cs index 9b27665..0fb262e 100644 --- a/Service/Cloud/Msg/Host/Req/SignIn.cs +++ b/Service/Cloud/Msg/Host/Req/SignIn.cs @@ -9,50 +9,50 @@ public class SignIn : ICmd /// /// 换电站编码 /// - public string sn { get; set; } + public string stationNo { get; set; } /// /// 供应商识别码 /// (以中心平台给出为准). 每个厂家对应一个 Key /// - public string ky { get; set; } + public string supplierCode { get; set; } /// /// 换电站类型 /// 01:单道通左 02:单通道右 03:双道通 /// /// - public string st { get; set; } + public string stationType { get; set; } /// /// 设备型号 /// - public string dv { get; set; } + public string equipmentType { get; set; } /// /// 软件版本 /// 站类型代号(24 个大写字母)_X.XX,其中 X 位 0~9 数字,非重大改变,整数数字不改变,小数点后数字单数加 0,双数不变,依次累加,比如A_1.01 /// - public string sv { get; set; } + public string version { get; set; } /// /// 换电站服务状态 /// 0:未知;1:服务状态;2:停止服务状态 /// - public int ss { get; set; } + public int stationStatus { get; set; } /// /// 换电站配电容量 /// 单位 0.1kwh /// - public float ca { get; set; } + public float stationCapacity { get; set; } /// /// 设备列表配置版本 号 /// - public string VS { get; set; } + public string equipmentVersion { get; set; } /// /// 充电功率 /// - public int cp { get; set; } + public int chargePower { get; set; } /// /// 换电站基础信息版 本号 /// 换电站基础信息版本号(换电站编码+更新时间(yyyyMMddHHmmss) /// - public string bs { get; set; } + public string stationVersion { get; set; } /// /// 经度 /// @@ -65,21 +65,21 @@ public class SignIn : ICmd /// 换电通道数量 /// 换电通道的数目 /// - public int en { get; set; } + public int channelNumber { get; set; } /// /// 充电机(仓)数量 /// - public int cn { get; set; } + public int chargerNumber { get; set; } /// /// 电价模型id /// 服务器分配,默认值为-1 /// - public int eid { get; set; } + public int electricityId { get; set; } /// /// 电池运营模型id /// 服务器分配,默认为值-1 /// - public int oid { get; set; } + public int billingId { get; set; } public string GetCmd() diff --git a/Service/Cloud/Msg/Host/Req/SingleBatInfo.cs b/Service/Cloud/Msg/Host/Req/SingleBatInfo.cs index 9e2c19e..aa92ea4 100644 --- a/Service/Cloud/Msg/Host/Req/SingleBatInfo.cs +++ b/Service/Cloud/Msg/Host/Req/SingleBatInfo.cs @@ -7,27 +7,27 @@ public class SingleBatInfo /// /// 电池序列号 /// - public string bn { get; set; } + public string batteryNo { get; set; } /// - /// 充电架 ID 按电池架的编号 A1,A2… + /// 充电机编码 /// - public string sd { get; set; } + public string chargerNo { get; set; } /// - /// 所在充电机序号 从 1 开始递增 + /// 所在仓编号 /// - public int cno { get; set; } + public int binNo { get; set; } /// /// 是否在充电 0:未知 1:正在充电 2:未电池 /// - public int hc { get; set; } + public int chargeOrNot { get; set; } /// /// 电接头连接状态 0:未知 1:已经连接 2:未连接 /// - public int el { get; set; } + public int spliceStatus { get; set; } /// /// 剩余能量 单位 0.1 kwh @@ -47,22 +47,22 @@ public class SingleBatInfo /// /// 最低单体电压 单位 0.01V /// - public float lsv { get; set; } + public float lowVoltage { get; set; } /// /// 最高单体电压 单位 0.01V /// - public float hsv { get; set; } + public float highVoltage { get; set; } /// /// 最低单体温度 单位 0.1℃ /// - public float lst { get; set; } + public float lowTemperature { get; set; } /// /// 最高单体温度 单位 0.1℃ /// - public float hst { get; set; } + public float highTemperature { get; set; } /// /// 单体电池号 从 1 开始递增 @@ -72,16 +72,16 @@ public class SingleBatInfo /// /// 单体电压 每一节电芯的单体电压 单位 0.1V ,如果没有该节电芯的数据,填65535.0 无效值 /// - public float sv { get; set; } + public float voltage { get; set; } /// /// 单体温度 每一节电芯的单体温度 单位 0.1℃ ,如果没有该节电芯的数据,填65535.0 无效值 /// - public float st { get; set; } + public float temperature { get; set; } /// /// 更新时间 格式 ”yyyy-MM-dd HH:mm:ss ” /// - public DateTime bt { get; set; } + public DateTime updateTime { get; set; } } \ No newline at end of file diff --git a/Service/Cloud/Msg/Host/Req/StaSwapRecord.cs b/Service/Cloud/Msg/Host/Req/StaSwapRecord.cs index c235a66..072ad5e 100644 --- a/Service/Cloud/Msg/Host/Req/StaSwapRecord.cs +++ b/Service/Cloud/Msg/Host/Req/StaSwapRecord.cs @@ -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 /// 换电站编码 /// 换电站唯一码,区域码+类型码+流水号 /// - public string sn { get; set; } + public string stationNo { get; set; } /// /// 换电订单号 /// 场站编码+时间(yyyyMMddHHmmss)+车牌号,唯一,索引 /// - public string son { get; set; } + public string orderNo { get; set; } /// /// 订单是否取消 /// 0:正常;1:取消 /// /// - public byte od { get; set; } + public byte cancelFlag { get; set; } /// /// 是否成功换电 /// 本次换电是否成功.0:失败;1:成功 /// /// - public byte ic { get; set; } + public byte successFlag { get; set; } /// /// 换电结果 /// 0:正常 1:失败 /// /// - public byte rs { get; set; } + public byte result { get; set; } /// /// 失败原因 /// - public byte fr { get; set; } + public byte causeOfFailure { get; set; } /// /// 车牌号 /// - public string cn { get; set; } + public string carNo { get; set; } /// /// 车辆VIN码 /// 车辆唯一识别码 @@ -61,162 +62,120 @@ namespace Service.Cloud.Msg.Host.Req /// /// 所属车队 /// - public string mC { get; set; } - /// - /// 出仓安装电池序列号 - /// - public string dbid { get; set; } - /// - /// 出仓安装电池SOC - /// - public int dsoc { get; set; } - /// - /// 取车电池上次换电结算时 的SOC - /// - public int lsoc { get; set; } - /// - /// 出仓安装电池的SOE - /// 单位:kWh,保留两位小数 - /// - public float dsoe { get; set; } - /// - /// 取车电池上次换电结算时 的 SOE - /// 单位:kWh,保留两位小数 - /// - public float lsoe { get; set; } - /// - /// 拆卸入仓电池序列号 - /// - public string ubid { get; set; } - /// - /// 拆卸入仓电池SOC - /// 单位:kWh,保留两位小数 - /// - public int usoc { get; set; } - /// - /// 拆卸入仓电池SOE - /// 单位:kWh,保留两位小数 - /// - public float usoe { get; set; } + public string teamCode { get; set; } /// /// 装上电池行驶里程 /// 单位:kWh,保留两位小数 /// - public float tm { get; set; } + public float batteryVtm { get; set; } /// /// 此次换电次序 /// 本日第几次换电 /// - public int so { get; set; } + public int swapDayCount { get; set; } /// /// 车牌识别时间(或车辆进 站时间) /// 单位:秒 /// - public DateTime? ct { get; set; } + public DateTime? recognizeTime { get; set; } /// /// 换电开始时刻 /// 格式”yyyy-MMddHH:mm:ss” /// - public DateTime? st { get; set; } + public DateTime? startTime { get; set; } /// /// 换电结来时刻 /// 格式”yyyy-MMddHH:mm:ss” /// - public DateTime? et { get; set; } + public DateTime? endTime { get; set; } /// /// 车辆高开时间 /// 格式”yyyy-MMdd /// - public DateTime? ot { get; set; } + public DateTime? leaveTime { get; set; } /// /// 本次换电时同 /// 单位:秒 (车辆进站到出站的时间) /// - public int wt { get; set; } - /// - /// 出仓安装地仓位号 - /// - public int? deno { get; set; } - /// - /// 拆卸入仓池仓位号 - /// - public int? ueno { get; set; } + public int swapTime { get; set; } /// /// 车朝总里程 /// 单位:kWh, 保留两位小数 /// - public float? vtm { get; set; } + public float? vehicleTotalMiles { get; set; } /// /// 车制累计换电次数 /// - public int vct { get; set; } + public int swapCount { get; set; } /// /// 车辆累计放电量 /// 单位:kWh, 保留两位小数 /// - public float vtdc { get; set; } + public float carElectricDischarge { get; set; } /// /// 车辆系计回馈电量 /// 单位:kWh, 保留两位小数 /// - public float vtfe { get; set; } + public float carFeedbackElectricity { get; set; } /// /// 车朝累计插枪充电量 /// 单位:kWh, 保留两位小数 /// - public float vtcc { get; set; } + public float chargerTheGunCount { get; set; } /// /// 车制累计综合能耗 /// 单位:kWh, 保留两位小数 /// - public float vtec { get; set; } + public float carEnergyConsumption { get; set; } /// /// 本次实时放电量 /// 单位:kWh, 保留两位小数 /// - public float rtdc { get; set; } + public float realTimeDischarge { get; set; } /// /// 上一次结算放电量 /// 至少保留两位有效小数 /// - public float lsdc { get; set; } + public float lastDischarge { get; set; } /// /// 本次实时回馈电量 /// 单位:kWh, 保留两位小数 /// - public float rtfc { get; set; } + public float realFeedbackPower { get; set; } /// /// 上一才生笙回性中量 /// 单位:kWh, 保留两位 /// - public float lsfc { get; set; } + public float lastFeedback { get; set; } /// /// 本次实时插枪充电量 /// 单位:kWh, 保留两位小数 /// - public float rtce { get; set; } + public float realChargeCount { get; set; } /// /// 上一次结算插枪充电量 /// 单位:kWh, 保留两位小数 /// - public float lscc { get; set; } + public float lastChargeCount { get; set; } /// /// 本次实时综合能耗 /// 单位:kWh, 保留两位小数 /// - public float rtec { get; set; } + public float realEnergyConsumption { get; set; } /// /// 上报方式 /// 1:自动;2:人工手动 /// /// - public int sfs { get; set; } + public int reportType { get; set; } /// /// 是否是离线订单 /// 0:不是;1:是 /// /// - public int sflx { get; set; } + public int offlineFlag { get; set; } + + public List batteryList { get; set; } public string GetCmd() { return CloudConst.staSwapRecord; diff --git a/Service/Cloud/Msg/Host/Req/StationChnRunStatus.cs b/Service/Cloud/Msg/Host/Req/StationChnRunStatus.cs index 6c472d5..701f180 100644 --- a/Service/Cloud/Msg/Host/Req/StationChnRunStatus.cs +++ b/Service/Cloud/Msg/Host/Req/StationChnRunStatus.cs @@ -16,43 +16,43 @@ namespace Service.Cloud.Msg.Host.Req /// 换电通道编号 /// 从 1 开始递增, 0:表示默认单仓单通道 /// - public int ec { get; set; } + public int passageNo { get; set; } /// /// 工作状态 /// 0:未知 1:空闲 2:工作中 3:工作完成 /// /// - public int ws { get; set; } + public int status { get; set; } /// /// 换电通道状态 /// 0:未知 1:空闲 2:占位 3:换电准备 4:换电开始 5:换电中 6:换电完成 7:换电中故障,等待修复 /// 8:换电中故障,修复完成 9:换电暂停 10:换电继续 11:换电完成,车辆未驶离 12:换电完成,车辆驶离 /// /// - public int cs { get; set; } + public int passageStatus { get; set; } /// /// 是否有车 /// 0:未知 1:有车 2:无车 /// /// - public int iv { get; set; } + public int carFlag { get; set; } /// /// 锁止状态 /// 商用车有效 0:未知 1:加锁状态 2:解锁状态 /// /// - public int ls { get; set; } + public int lockStatus { get; set; } /// /// 换电站通道故障等级 /// 0 正常 1:故障等级一 2:故障等级二 3:故障等级三 4:故障等级四 5:故障等级五 6:故障等级六 /// /// - public int fl { get; set; } + public int faultLevel { get; set; } /// /// 更新时间 /// 格式”yyyy-MM-dd HH:mm:ss” /// - public DateTime ut { get; set; } + public DateTime updateTime { get; set; } public string GetCmd() { diff --git a/Service/Cloud/Msg/Host/Resp/CarCanStartRes.cs b/Service/Cloud/Msg/Host/Resp/CarCanStartRes.cs index 3a95f67..8ee3b33 100644 --- a/Service/Cloud/Msg/Host/Resp/CarCanStartRes.cs +++ b/Service/Cloud/Msg/Host/Resp/CarCanStartRes.cs @@ -17,26 +17,33 @@ namespace Service.Cloud.Msg.Host.Resp /// 0:成功 1:失败 /// /// - public int re { get; set; } + public int result { get; set; } /// /// 车辆所在的换电 通道 /// 从 1 开始递增, 0:表示默认单仓单通道 /// - public int en { get; set; } + public int channel { get; set; } /// /// 订单号 /// 场站编码(12 字节)+时间(yyyyMMddHHmmss)14 位 + 2 位 /// - public string on { get; set; } + public string order { get; set; } /// /// 换电请求应答 /// 0 无 1 换电请求成功 2 换电请求失败3 取消换电请求成功 4 取消换电请求失败 /// /// - 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; + } } } diff --git a/Service/Cloud/Msg/Model.cs b/Service/Cloud/Msg/Model.cs index 374a576..1c4e549 100644 --- a/Service/Cloud/Msg/Model.cs +++ b/Service/Cloud/Msg/Model.cs @@ -2,7 +2,7 @@ public class Model where T : ICmd { - public Header Header { get; set; } + public Header header { get; set; } public T body { get; set; } public string dataSign { get; set; } } \ No newline at end of file diff --git a/Service/Execute/Api/CloudApi.cs b/Service/Execute/Api/CloudApi.cs index da41b67..ec54782 100644 --- a/Service/Execute/Api/CloudApi.cs +++ b/Service/Execute/Api/CloudApi.cs @@ -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 /// /// /// - public static int UploadSwapOrder(SwapOrder swapOrder, int seq, SwapOrderBattery swapOrderBattery, int uploadType + public static int UploadSwapOrder(SwapOrder swapOrder, int seq, List swapOrderBattery, int uploadType ,SwapOrderReportCloud orderReportCloud) { + List swapOrderBatteryList = new List(); + 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)); } /// diff --git a/Service/Execute/Step/CarPrepareState.cs b/Service/Execute/Step/CarPrepareState.cs index 12680b4..6ea2024 100644 --- a/Service/Execute/Step/CarPrepareState.cs +++ b/Service/Execute/Step/CarPrepareState.cs @@ -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); } diff --git a/Service/Execute/Step/SwapCanStartState.cs b/Service/Execute/Step/SwapCanStartState.cs index 1c42e9d..3418c6a 100644 --- a/Service/Execute/Step/SwapCanStartState.cs +++ b/Service/Execute/Step/SwapCanStartState.cs @@ -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; diff --git a/Service/Mgr/SwapOrderMgr.cs b/Service/Mgr/SwapOrderMgr.cs index 0950b01..4839329 100644 --- a/Service/Mgr/SwapOrderMgr.cs +++ b/Service/Mgr/SwapOrderMgr.cs @@ -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) { diff --git a/WebStarter/Controllers/Test/GenController.cs b/WebStarter/Controllers/Test/GenController.cs index f425bd4..90246b2 100644 --- a/WebStarter/Controllers/Test/GenController.cs +++ b/WebStarter/Controllers/Test/GenController.cs @@ -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 CloudTestUploadSwapOrder() { + + var swapOrderBatterList = new List() + { + 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.Success(); } + + [HttpGet("CloudTestStationChnRunStatus")] + public Result CloudTestStationChnRunStatus() + { + StationChnRunStatus stationChnRunStatus = new StationChnRunStatus(); + stationChnRunStatus.updateTime=DateTime.Now; + CloudClientMgr.CloudClient?.SendChannelStatusReporting(stationChnRunStatus, new TimeSpan()); + return Result.Success(); + } [HttpGet("test115")]