CZ 8 months ago
commit fbc91c1342

@ -27,7 +27,7 @@ namespace BatCharging.Model
/// <summary>
/// 内部索引号
/// </summary>
public UInt32 value05 { get; set; }
public int value05 { get; set; }
/// <summary>
/// 7、8、9 字段有效标志
/// <para>0- 无效</para>

@ -363,7 +363,7 @@ namespace BatCharging.Model
/// 4 字节电表安装时间(秒时戳, HEX)
/// 1 字节端钮历史状态(0 正常1 发生过端钮盖打开时间)
/// </summary>
public byte value80 { get; set; }
public string value80 { get; set; }
/// <summary>
/// 电表表号 6
/// </summary>

@ -63,7 +63,7 @@ namespace BatCharging.Model
/// 命令 402 报文此字段单位是0.01kWh/bit
/// 命令 422 报 文 此 字 段 单 位 是0.001kWh/bit
/// </summary>
public float currentChargingLevel { get; set; }
public string currentChargingLevel { get; set; }
/// <summary>
/// 充电前电表读数
/// </summary>
@ -109,7 +109,7 @@ namespace BatCharging.Model
/// 金额单位为0.01元
/// 电量时单位为0.01kw
/// </summary>
public float chargingStrategyPara { get; set; }
public string chargingStrategyPara { get; set; }
/// <summary>
/// 车辆VIN 直流桩上传,没有填’\0
/// </summary>
@ -262,7 +262,7 @@ namespace BatCharging.Model
/// 如平台不对电量第三位小数做强检要求可忽略本字段。
/// 如本字段为0x09,千分位电量为 0.009Kw* h
/// </summary>
public byte millennialpowerConsumption { get; set; }
public string millennialpowerConsumption { get; set; }
/// <summary>
/// 并充标志
/// 0/1-单枪充电

@ -1206,8 +1206,12 @@ namespace BatCharging.Service
if (CMD202 != null)
{
//todo
//CmnChargerParam._CHR00TCPCLIENT.Send201(CMD202,);
//todo 实例化CMD201对象
CMD201 cMD201 = new CMD201();
//201中其他字段如何赋值
cMD201.value05 = CMD202.value17;
CmnChargerParam._CHR00TCPCLIENT.Send201(cMD201, func);
}
}
break;
@ -1281,23 +1285,6 @@ namespace BatCharging.Service
}
}
break;
//case 222:
// {
// CMD222 CMD222 = new MsgReceiveCMDCom().ConCMD222(data);
// string result = "充电桩上报“即插即充”启动充电结果 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
// result += "\r\n" + "充电桩上报“即插即充”启动充电结果:" + JsonConvert.SerializeObject(CMD222);
// Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
// if (CMD222 != null)
// {
// //(CMD=9)后台服务器应答桩上传命令请求(预留)
// uint value05 = 0;
// CMD221 CMD221 = new CMD221();
// CmnChargerParam._CHR00TCPCLIENT.Send221(CMD221,value05);
// }
// }
// break;
#endregion
#region 直流充电桩 BMS 信息数据(预留)
@ -1335,8 +1322,9 @@ namespace BatCharging.Service
#region 历史记录
case 402:
case 422:
{
CMD402 CMD402 = new MsgReceiveCMDCom().ConCMD402(data);
CMD402 CMD402 = new MsgReceiveCMDCom().ConCMD402(func,data);
string result = "充电桩上报历史的充电记录 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩上报历史的充电记录:" + JsonConvert.SerializeObject(CMD402);
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
@ -2247,13 +2235,13 @@ namespace BatCharging.Service
#region 充电信息数据
public void Send201(CMD202 CMD202, byte value06, uint value07, uint value08, uint value09, uint value10, uint value11, uint value12)
public void Send201(CMD201 CMD201,uint func)
{
if (_chr_client != null)
{
if (_chr_client.Connected)
{
new ChargerSendMsgUtils().Send201(_chr_client, CMD202, value06, value07, value08, value09, value10, value11, value12);
new ChargerSendMsgUtils().Send201(_chr_client, CMD201, func);
}
}
}

@ -601,21 +601,10 @@ namespace BatCharging.Service
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send201(TcpClientChargerTool tcp_client, CMD202 CMD202, byte value06, uint value07, uint value08, uint value09, uint value10, uint value11, uint value12)
internal void Send201(TcpClientChargerTool tcp_client, CMD201 CMD,uint func)
{
CMD201 CMD = new CMD201();
CMD.value03 = CMD202.value05;
CMD.value04 = CMD202.value06;
CMD.value05 = (uint)CMD202.value17;
CMD.value06 = value06;
CMD.value07 = value07;
CMD.value08 = value08;
CMD.value09 = value09;
CMD.value10 = value10;
CMD.value11 = value11;
CMD.value12 = value12;
byte[] bytes = new ChargerSendCMD().SendRCMD201(out APDUModel APDUModel, CMD);
byte[] bytes = new ChargerSendCMD().SendRCMD201(out APDUModel APDUModel, CMD, func);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");

@ -411,64 +411,64 @@ namespace BatCharging.Service.DataRlt
CMD202.value26 = ByteUtils.DToUInt16(data, 167).ToString();
CMD202.value27 = ByteUtils.DToUInt16(data, 171).ToString();
CMD202.value28 = ByteUtils.DToUInt16(data, 175).ToString();
CMD202.value29 = ByteUtils.DToUInt16(data, 179).ToString();
CMD202.value30 = ByteUtils.DToUInt16(data, 183).ToString();
CMD202.value31 = ByteUtils.DToUInt16(data, 187).ToString();
CMD202.value32 = ByteUtils.DToUInt16(data, 191).ToString();
CMD202.value33 = ByteUtils.DToUInt16(data, 195).ToString();
CMD202.value34 = ByteUtils.DToUInt16(data, 199).ToString();
CMD202.value35 = ByteUtils.DToUInt16(data, 203).ToString();
CMD202.value36 = ByteUtils.DToUInt16(data, 207).ToString();
CMD202.value37 = ByteUtils.DToUInt16(data, 211).ToString();
CMD202.value38 = ByteUtils.DToUInt16(data, 215).ToString();
CMD202.value39 = ByteUtils.DToUInt16(data, 219).ToString();
CMD202.value40 = ByteUtils.DToUInt16(data, 223).ToString();
CMD202.value41 = ByteUtils.DToUInt16(data, 227).ToString();
CMD202.value42 = ByteUtils.DToUInt16(data, 231).ToString();
CMD202.value43 = ByteUtils.DToUInt16(data, 235).ToString();
CMD202.value44 = ByteUtils.DToUInt16(data, 239).ToString();
CMD202.value45 = ByteUtils.DToUInt16(data, 243).ToString();
CMD202.value46 = ByteUtils.DToUInt16(data, 247).ToString();
CMD202.value47 = ByteUtils.DToUInt16(data, 251).ToString();
CMD202.value48 = ByteUtils.DToUInt16(data, 255).ToString();
CMD202.value49 = ByteUtils.DToUInt16(data, 259).ToString();
CMD202.value50 = ByteUtils.DToUInt16(data, 263).ToString();
CMD202.value51 = ByteUtils.DToUInt16(data, 267).ToString();
CMD202.value52 = ByteUtils.DToUInt16(data, 271).ToString();
CMD202.value53 = ByteUtils.DToUInt16(data, 275).ToString();
CMD202.value54 = ByteUtils.DToUInt16(data, 279).ToString();
CMD202.value55 = ByteUtils.DToUInt16(data, 283).ToString();
CMD202.value56 = ByteUtils.DToUInt16(data, 287).ToString();
CMD202.value57 = ByteUtils.DToUInt16(data, 291).ToString();
CMD202.value58 = ByteUtils.DToUInt16(data, 295).ToString();
CMD202.value59 = ByteUtils.DToUInt16(data, 299).ToString();
CMD202.value60 = ByteUtils.DToUInt16(data, 303).ToString();
CMD202.value61 = ByteUtils.DToUInt16(data, 307).ToString();
CMD202.value63 = ByteUtils.DToUInt16(data, 311).ToString();
CMD202.value64 = ByteUtils.DToUInt16(data, 315).ToString();
CMD202.value64 = ByteUtils.DToUInt16(data, 319).ToString();
CMD202.value65 = ByteUtils.DToUInt16(data, 323).ToString();
CMD202.value66 = ByteUtils.DToUInt16(data, 327).ToString();
CMD202.value67 = ByteUtils.DToUInt16(data, 331).ToString();
CMD202.value68 = ByteUtils.DToUInt16(data, 335).ToString();
CMD202.value69 = ByteUtils.DToUInt16(data, 339).ToString();
CMD202.value70 = ByteUtils.DToUInt16(data, 343).ToString();
CMD202.value71 = ByteUtils.DToUInt16(data, 347).ToString();
CMD202.value72 = ByteUtils.DToUInt16(data, 351).ToString();
CMD202.value73 = ByteUtils.DToUInt16(data, 355).ToString();
CMD202.value27 = ByteUtils.DToUInt16(data, 169).ToString();
CMD202.value28 = ByteUtils.DToUInt16(data, 171).ToString();
CMD202.value29 = ByteUtils.DToUInt16(data, 173).ToString();
CMD202.value30 = ByteUtils.DToUInt16(data, 175).ToString();
CMD202.value31 = ByteUtils.DToUInt16(data, 177).ToString();
CMD202.value32 = ByteUtils.DToUInt16(data, 179).ToString();
CMD202.value33 = ByteUtils.DToUInt16(data, 181).ToString();
CMD202.value34 = ByteUtils.DToUInt16(data, 183).ToString();
CMD202.value35 = ByteUtils.DToUInt16(data, 185).ToString();
CMD202.value36 = ByteUtils.DToUInt16(data, 187).ToString();
CMD202.value37 = ByteUtils.DToUInt16(data, 189).ToString();
CMD202.value38 = ByteUtils.DToUInt16(data, 191).ToString();
CMD202.value39 = ByteUtils.DToUInt16(data, 193).ToString();
CMD202.value40 = ByteUtils.DToUInt16(data, 195).ToString();
CMD202.value41 = ByteUtils.DToUInt16(data, 197).ToString();
CMD202.value42 = ByteUtils.DToUInt16(data, 199).ToString();
CMD202.value43 = ByteUtils.DToUInt16(data, 201).ToString();
CMD202.value44 = ByteUtils.DToUInt16(data, 203).ToString();
CMD202.value45 = ByteUtils.DToUInt16(data, 205).ToString();
CMD202.value46 = ByteUtils.DToUInt16(data, 207).ToString();
CMD202.value47 = ByteUtils.DToUInt16(data, 209).ToString();
CMD202.value48 = ByteUtils.DToUInt16(data, 211).ToString();
CMD202.value49 = ByteUtils.DToUInt16(data, 213).ToString();
CMD202.value50 = ByteUtils.DToUInt16(data, 215).ToString();
CMD202.value51 = ByteUtils.DToUInt16(data, 217).ToString();
CMD202.value52 = ByteUtils.DToUInt16(data, 219).ToString();
CMD202.value53 = ByteUtils.DToUInt16(data, 221).ToString();
CMD202.value54 = ByteUtils.DToUInt16(data, 223).ToString();
CMD202.value55 = ByteUtils.DToUInt16(data, 225).ToString();
CMD202.value56 = ByteUtils.DToUInt16(data, 227).ToString();
CMD202.value57 = ByteUtils.DToUInt16(data, 229).ToString();
CMD202.value58 = ByteUtils.DToUInt16(data, 231).ToString();
CMD202.value59 = ByteUtils.DToUInt16(data, 233).ToString();
CMD202.value60 = ByteUtils.DToUInt16(data, 235).ToString();
CMD202.value61 = ByteUtils.DToUInt16(data, 237).ToString();
CMD202.value63 = ByteUtils.DToUInt16(data, 239).ToString();
CMD202.value64 = ByteUtils.DToUInt16(data, 241).ToString();
CMD202.value64 = ByteUtils.DToUInt16(data, 243).ToString();
CMD202.value65 = ByteUtils.DToUInt16(data, 245).ToString();
CMD202.value66 = ByteUtils.DToUInt16(data, 247).ToString();
CMD202.value67 = ByteUtils.DToUInt16(data, 249).ToString();
CMD202.value68 = ByteUtils.DToUInt16(data, 251).ToString();
CMD202.value69 = ByteUtils.DToUInt16(data, 253).ToString();
CMD202.value70 = ByteUtils.DToUInt16(data, 255).ToString();
CMD202.value71 = ByteUtils.DToUInt16(data, 257).ToString();
CMD202.value72 = ByteUtils.DToUInt16(data, 259).ToString();
CMD202.value73 = ByteUtils.DToUInt16(data, 261).ToString();
CMD202.value74 = data[359];
CMD202.value75 = Encoding.ASCII.GetString(data, 360, 32);
CMD202.value76 = ByteUtils.DToUInt32(data, 392);
CMD202.value77 = data[394];
CMD202.value78 = data[395];
CMD202.value79 = data[396];
CMD202.value80 = data[397];
CMD202.value81 = Encoding.ASCII.GetString(data, 398, 6);
CMD202.value82 = ByteUtils.DToUInt16(data, 404);
CMD202.value83 = data[408];
CMD202.value74 = data[263];
CMD202.value75 = Encoding.ASCII.GetString(data, 264, 32);
CMD202.value76 = ByteUtils.DToUInt32(data, 296);
CMD202.value77 = data[300];
CMD202.value78 = data[301];
CMD202.value79 = data[302];
CMD202.value80 = Encoding.ASCII.GetString(data, 303, 34);
CMD202.value81 = Encoding.ASCII.GetString(data, 337, 6);
CMD202.value82 = ByteUtils.DToUInt16(data, 343);
CMD202.value83 = data[345];
}
else if (func == 222)
{
@ -477,65 +477,65 @@ namespace BatCharging.Service.DataRlt
CMD202.value15 = (ByteUtils.DToUInt32(data, 112) * 0.001).ToString("F3");
CMD202.value26 = (ByteUtils.DToUInt32(data, 167)*0.001).ToString("F3");
CMD202.value27 = (ByteUtils.DToUInt32(data, 171)*0.001).ToString("F3");
CMD202.value28 = (ByteUtils.DToUInt32(data, 175)*0.001).ToString("F3");
CMD202.value29 = (ByteUtils.DToUInt32(data, 179)*0.001).ToString("F3");
CMD202.value30 = (ByteUtils.DToUInt32(data, 183)*0.001).ToString("F3");
CMD202.value31 = (ByteUtils.DToUInt32(data, 187)*0.001).ToString("F3");
CMD202.value32 = (ByteUtils.DToUInt32(data, 191)*0.001).ToString("F3");
CMD202.value33 = (ByteUtils.DToUInt32(data, 195)*0.001).ToString("F3");
CMD202.value34 = (ByteUtils.DToUInt32(data, 199)*0.001).ToString("F3");
CMD202.value35 = (ByteUtils.DToUInt32(data, 203)*0.001).ToString("F3");
CMD202.value36 = (ByteUtils.DToUInt32(data, 207)*0.001).ToString("F3");
CMD202.value37 = (ByteUtils.DToUInt32(data, 211)*0.001).ToString("F3");
CMD202.value38 = (ByteUtils.DToUInt32(data, 215)*0.001).ToString("F3");
CMD202.value39 = (ByteUtils.DToUInt32(data, 219)*0.001).ToString("F3");
CMD202.value40 = (ByteUtils.DToUInt32(data, 223)*0.001).ToString("F3");
CMD202.value41 = (ByteUtils.DToUInt32(data, 227)*0.001).ToString("F3");
CMD202.value42 = (ByteUtils.DToUInt32(data, 231)*0.001).ToString("F3");
CMD202.value43 = (ByteUtils.DToUInt32(data, 235)*0.001).ToString("F3");
CMD202.value44 = (ByteUtils.DToUInt32(data, 239)*0.001).ToString("F3");
CMD202.value45 = (ByteUtils.DToUInt32(data, 243)*0.001).ToString("F3");
CMD202.value46 = (ByteUtils.DToUInt32(data, 247)*0.001).ToString("F3");
CMD202.value47 = (ByteUtils.DToUInt32(data, 251)*0.001).ToString("F3");
CMD202.value48 = (ByteUtils.DToUInt32(data, 255)*0.001).ToString("F3");
CMD202.value49 = (ByteUtils.DToUInt32(data, 259)*0.001).ToString("F3");
CMD202.value50 = (ByteUtils.DToUInt32(data, 263)*0.001).ToString("F3");
CMD202.value51 = (ByteUtils.DToUInt32(data, 267)*0.001).ToString("F3");
CMD202.value52 = (ByteUtils.DToUInt32(data, 271)*0.001).ToString("F3");
CMD202.value53 = (ByteUtils.DToUInt32(data, 275)*0.001).ToString("F3");
CMD202.value54 = (ByteUtils.DToUInt32(data, 279)*0.001).ToString("F3");
CMD202.value55 = (ByteUtils.DToUInt32(data, 283)*0.001).ToString("F3");
CMD202.value56 = (ByteUtils.DToUInt32(data, 287)*0.001).ToString("F3");
CMD202.value57 = (ByteUtils.DToUInt32(data, 291)*0.001).ToString("F3");
CMD202.value58 = (ByteUtils.DToUInt32(data, 295)*0.001).ToString("F3");
CMD202.value59 = (ByteUtils.DToUInt32(data, 299)*0.001).ToString("F3");
CMD202.value60 = (ByteUtils.DToUInt32(data, 303)*0.001).ToString("F3");
CMD202.value61 = (ByteUtils.DToUInt32(data, 307)*0.001).ToString("F3");
CMD202.value63 = (ByteUtils.DToUInt32(data, 311)*0.001).ToString("F3");
CMD202.value64 = (ByteUtils.DToUInt32(data, 315)*0.001).ToString("F3");
CMD202.value64 = (ByteUtils.DToUInt32(data, 319)*0.001).ToString("F3");
CMD202.value65 = (ByteUtils.DToUInt32(data, 323)*0.001).ToString("F3");
CMD202.value66 = (ByteUtils.DToUInt32(data, 327)*0.001).ToString("F3");
CMD202.value67 = (ByteUtils.DToUInt32(data, 331)*0.001).ToString("F3");
CMD202.value68 = (ByteUtils.DToUInt32(data, 335)*0.001).ToString("F3");
CMD202.value69 = (ByteUtils.DToUInt32(data, 339)*0.001).ToString("F3");
CMD202.value70 = (ByteUtils.DToUInt32(data, 343)*0.001).ToString("F3");
CMD202.value71 = (ByteUtils.DToUInt32(data, 347)*0.001).ToString("F3");
CMD202.value72 = (ByteUtils.DToUInt32(data, 351)*0.001).ToString("F3");
CMD202.value73 = (ByteUtils.DToUInt32(data, 355)*0.001).ToString("F3");
CMD202.value26 = (ByteUtils.DToUInt32(data, 167) * 0.001).ToString("F3");
CMD202.value27 = (ByteUtils.DToUInt32(data, 171) * 0.001).ToString("F3");
CMD202.value28 = (ByteUtils.DToUInt32(data, 175) * 0.001).ToString("F3");
CMD202.value29 = (ByteUtils.DToUInt32(data, 179) * 0.001).ToString("F3");
CMD202.value30 = (ByteUtils.DToUInt32(data, 183) * 0.001).ToString("F3");
CMD202.value31 = (ByteUtils.DToUInt32(data, 187) * 0.001).ToString("F3");
CMD202.value32 = (ByteUtils.DToUInt32(data, 191) * 0.001).ToString("F3");
CMD202.value33 = (ByteUtils.DToUInt32(data, 195) * 0.001).ToString("F3");
CMD202.value34 = (ByteUtils.DToUInt32(data, 199) * 0.001).ToString("F3");
CMD202.value35 = (ByteUtils.DToUInt32(data, 203) * 0.001).ToString("F3");
CMD202.value36 = (ByteUtils.DToUInt32(data, 207) * 0.001).ToString("F3");
CMD202.value37 = (ByteUtils.DToUInt32(data, 211) * 0.001).ToString("F3");
CMD202.value38 = (ByteUtils.DToUInt32(data, 215) * 0.001).ToString("F3");
CMD202.value39 = (ByteUtils.DToUInt32(data, 219) * 0.001).ToString("F3");
CMD202.value40 = (ByteUtils.DToUInt32(data, 223) * 0.001).ToString("F3");
CMD202.value41 = (ByteUtils.DToUInt32(data, 227) * 0.001).ToString("F3");
CMD202.value42 = (ByteUtils.DToUInt32(data, 231) * 0.001).ToString("F3");
CMD202.value43 = (ByteUtils.DToUInt32(data, 235) * 0.001).ToString("F3");
CMD202.value44 = (ByteUtils.DToUInt32(data, 239) * 0.001).ToString("F3");
CMD202.value45 = (ByteUtils.DToUInt32(data, 243) * 0.001).ToString("F3");
CMD202.value46 = (ByteUtils.DToUInt32(data, 247) * 0.001).ToString("F3");
CMD202.value47 = (ByteUtils.DToUInt32(data, 251) * 0.001).ToString("F3");
CMD202.value48 = (ByteUtils.DToUInt32(data, 255) * 0.001).ToString("F3");
CMD202.value49 = (ByteUtils.DToUInt32(data, 259) * 0.001).ToString("F3");
CMD202.value50 = (ByteUtils.DToUInt32(data, 263) * 0.001).ToString("F3");
CMD202.value51 = (ByteUtils.DToUInt32(data, 267) * 0.001).ToString("F3");
CMD202.value52 = (ByteUtils.DToUInt32(data, 271) * 0.001).ToString("F3");
CMD202.value53 = (ByteUtils.DToUInt32(data, 275) * 0.001).ToString("F3");
CMD202.value54 = (ByteUtils.DToUInt32(data, 279) * 0.001).ToString("F3");
CMD202.value55 = (ByteUtils.DToUInt32(data, 283) * 0.001).ToString("F3");
CMD202.value56 = (ByteUtils.DToUInt32(data, 287) * 0.001).ToString("F3");
CMD202.value57 = (ByteUtils.DToUInt32(data, 291) * 0.001).ToString("F3");
CMD202.value58 = (ByteUtils.DToUInt32(data, 295) * 0.001).ToString("F3");
CMD202.value59 = (ByteUtils.DToUInt32(data, 299) * 0.001).ToString("F3");
CMD202.value60 = (ByteUtils.DToUInt32(data, 303) * 0.001).ToString("F3");
CMD202.value61 = (ByteUtils.DToUInt32(data, 307) * 0.001).ToString("F3");
CMD202.value63 = (ByteUtils.DToUInt32(data, 311) * 0.001).ToString("F3");
CMD202.value64 = (ByteUtils.DToUInt32(data, 315) * 0.001).ToString("F3");
CMD202.value64 = (ByteUtils.DToUInt32(data, 319) * 0.001).ToString("F3");
CMD202.value65 = (ByteUtils.DToUInt32(data, 323) * 0.001).ToString("F3");
CMD202.value66 = (ByteUtils.DToUInt32(data, 327) * 0.001).ToString("F3");
CMD202.value67 = (ByteUtils.DToUInt32(data, 331) * 0.001).ToString("F3");
CMD202.value68 = (ByteUtils.DToUInt32(data, 335) * 0.001).ToString("F3");
CMD202.value69 = (ByteUtils.DToUInt32(data, 339) * 0.001).ToString("F3");
CMD202.value70 = (ByteUtils.DToUInt32(data, 343) * 0.001).ToString("F3");
CMD202.value71 = (ByteUtils.DToUInt32(data, 347) * 0.001).ToString("F3");
CMD202.value72 = (ByteUtils.DToUInt32(data, 351) * 0.001).ToString("F3");
CMD202.value73 = (ByteUtils.DToUInt32(data, 355) * 0.001).ToString("F3");
CMD202.value74 = data[359];
CMD202.value75 = Encoding.ASCII.GetString(data, 360, 32);
CMD202.value76 = ByteUtils.DToUInt32(data, 392);
CMD202.value77 = data[394];
CMD202.value78 = data[395];
CMD202.value79 = data[396];
CMD202.value80 = data[397];
CMD202.value81 = Encoding.ASCII.GetString(data, 398, 6);
CMD202.value82 = ByteUtils.DToUInt16(data, 404);
CMD202.value83 = data[408];
CMD202.value77 = data[396];
CMD202.value78 = data[397];
CMD202.value79 = data[398];
CMD202.value80 = Encoding.ASCII.GetString(data, 399, 34);
CMD202.value81 = Encoding.ASCII.GetString(data, 433, 6);
CMD202.value82 = ByteUtils.DToUInt16(data, 439);
CMD202.value83 = data[441];
}
CMD202.value16 = ByteUtils.DToUInt32(data, 116);
@ -834,7 +834,7 @@ namespace BatCharging.Service.DataRlt
}
return CMD304;
}
public CMD402 ConCMD402(byte[] data)
public CMD402 ConCMD402(uint func, byte[] data)
{
CMD402 CMD402 = null;
if (data != null && data.Length > 0)
@ -852,7 +852,126 @@ namespace BatCharging.Service.DataRlt
CMD402.startSoc = data[98];
CMD402.endSoc = data[99];
CMD402.chargingEndReason = Encoding.ASCII.GetString(data, 100, 4);
CMD402.currentChargingLevel = (float)ByteUtils.ToUInt32(data, 104);
if (func == 402)
{
CMD402.currentChargingLevel = (ByteUtils.ToUInt32(data, 104) * 0.01).ToString("F2");
CMD402.timeUInt32erval1ChargingElectLevel = ((ByteUtils.DToUInt16(data, 167)) * 0.01).ToString("F2");
CMD402.timeUInt32erval2ChargingElectLevel = ((ByteUtils.DToUInt16(data, 169)) * 0.01).ToString("F2");
CMD402.timeUInt32erval3ChargingElectLevel = ((ByteUtils.DToUInt16(data, 171)) * 0.01).ToString("F2");
CMD402.timeUInt32erval4ChargingElectLevel = ((ByteUtils.DToUInt16(data, 173)) * 0.01).ToString("F2");
CMD402.timeUInt32erval5ChargingElectLevel = ((ByteUtils.DToUInt16(data, 175)) * 0.01).ToString("F2");
CMD402.timeUInt32erval6ChargingElectLevel = ((ByteUtils.DToUInt16(data, 177)) * 0.01).ToString("F2");
CMD402.timeUInt32erval7ChargingElectLevel = ((ByteUtils.DToUInt16(data, 179)) * 0.01).ToString("F2");
CMD402.timeUInt32erval8ChargingElectLevel = ((ByteUtils.DToUInt16(data, 181)) * 0.01).ToString("F2");
CMD402.timeUInt32erval9ChargingElectLevel = ((ByteUtils.DToUInt16(data, 183)) * 0.01).ToString("F2");
CMD402.timeUInt32erval10ChargingElectLevel = ((ByteUtils.DToUInt16(data, 183)) * 0.01).ToString("F2");
CMD402.timeUInt32erval11ChargingElectLevel = ((ByteUtils.DToUInt16(data, 185)) * 0.01).ToString("F2");
CMD402.timeUInt32erval12ChargingElectLevel = ((ByteUtils.DToUInt16(data, 187)) * 0.01).ToString("F2");
CMD402.timeUInt32erval13ChargingElectLevel = ((ByteUtils.DToUInt16(data, 189)) * 0.01).ToString("F2");
CMD402.timeUInt32erval14ChargingElectLevel = ((ByteUtils.DToUInt16(data, 191)) * 0.01).ToString("F2");
CMD402.timeUInt32erval15ChargingElectLevel = ((ByteUtils.DToUInt16(data, 193)) * 0.01).ToString("F2");
CMD402.timeUInt32erval16ChargingElectLevel = ((ByteUtils.DToUInt16(data, 195)) * 0.01).ToString("F2");
CMD402.timeUInt32erval17ChargingElectLevel = ((ByteUtils.DToUInt16(data, 197)) * 0.01).ToString("F2");
CMD402.timeUInt32erval18ChargingElectLevel = ((ByteUtils.DToUInt16(data, 199)) * 0.01).ToString("F2");
CMD402.timeUInt32erval19ChargingElectLevel = ((ByteUtils.DToUInt16(data, 201)) * 0.01).ToString("F2");
CMD402.timeUInt32erval20ChargingElectLevel = ((ByteUtils.DToUInt16(data, 203)) * 0.01).ToString("F2");
CMD402.timeUInt32erval21ChargingElectLevel = ((ByteUtils.DToUInt16(data, 205)) * 0.01).ToString("F2");
CMD402.timeUInt32erval22ChargingElectLevel = ((ByteUtils.DToUInt16(data, 207)) * 0.01).ToString("F2");
CMD402.timeUInt32erval23ChargingElectLevel = ((ByteUtils.DToUInt16(data, 209)) * 0.01).ToString("F2");
CMD402.timeUInt32erval24ChargingElectLevel = ((ByteUtils.DToUInt16(data, 211)) * 0.01).ToString("F2");
CMD402.timeUInt32erval25ChargingElectLevel = ((ByteUtils.DToUInt16(data, 213)) * 0.01).ToString("F2");
CMD402.timeUInt32erval26ChargingElectLevel = ((ByteUtils.DToUInt16(data, 215)) * 0.01).ToString("F2");
CMD402.timeUInt32erval27ChargingElectLevel = ((ByteUtils.DToUInt16(data, 217)) * 0.01).ToString("F2");
CMD402.timeUInt32erval28ChargingElectLevel = ((ByteUtils.DToUInt16(data, 219)) * 0.01).ToString("F2");
CMD402.timeUInt32erval29ChargingElectLevel = ((ByteUtils.DToUInt16(data, 221)) * 0.01).ToString("F2");
CMD402.timeUInt32erval30ChargingElectLevel = ((ByteUtils.DToUInt16(data, 223)) * 0.01).ToString("F2");
CMD402.timeUInt32erval31ChargingElectLevel = ((ByteUtils.DToUInt16(data, 225)) * 0.01).ToString("F2");
CMD402.timeUInt32erval32ChargingElectLevel = ((ByteUtils.DToUInt16(data, 227)) * 0.01).ToString("F2");
CMD402.timeUInt32erval33ChargingElectLevel = ((ByteUtils.DToUInt16(data, 229)) * 0.01).ToString("F2");
CMD402.timeUInt32erval34ChargingElectLevel = ((ByteUtils.DToUInt16(data, 231)) * 0.01).ToString("F2");
CMD402.timeUInt32erval35ChargingElectLevel = ((ByteUtils.DToUInt16(data, 233)) * 0.01).ToString("F2");
CMD402.timeUInt32erval36ChargingElectLevel = ((ByteUtils.DToUInt16(data, 235)) * 0.01).ToString("F2");
CMD402.timeUInt32erval37ChargingElectLevel = ((ByteUtils.DToUInt16(data, 237)) * 0.01).ToString("F2");
CMD402.timeUInt32erval38ChargingElectLevel = ((ByteUtils.DToUInt16(data, 239)) * 0.01).ToString("F2");
CMD402.timeUInt32erval39ChargingElectLevel = ((ByteUtils.DToUInt16(data, 241)) * 0.01).ToString("F2");
CMD402.timeUInt32erval40ChargingElectLevel = ((ByteUtils.DToUInt16(data, 243)) * 0.01).ToString("F2");
CMD402.timeUInt32erval41ChargingElectLevel = ((ByteUtils.DToUInt16(data, 245)) * 0.01).ToString("F2");
CMD402.timeUInt32erval42ChargingElectLevel = ((ByteUtils.DToUInt16(data, 247)) * 0.01).ToString("F2");
CMD402.timeUInt32erval43ChargingElectLevel = ((ByteUtils.DToUInt16(data, 249)) * 0.01).ToString("F2");
CMD402.timeUInt32erval44ChargingElectLevel = ((ByteUtils.DToUInt16(data, 251)) * 0.01).ToString("F2");
CMD402.timeUInt32erval45ChargingElectLevel = ((ByteUtils.DToUInt16(data, 253)) * 0.01).ToString("F2");
CMD402.timeUInt32erval46ChargingElectLevel = ((ByteUtils.DToUInt16(data, 255)) * 0.01).ToString("F2");
CMD402.timeUInt32erval47ChargingElectLevel = ((ByteUtils.DToUInt16(data, 257)) * 0.01).ToString("F2");
CMD402.timeUInt32erval48ChargingElectLevel = ((ByteUtils.DToUInt16(data, 259)) * 0.01).ToString("F2");
CMD402.startWay = data[261];
CMD402.chargingSerialNum = Encoding.ASCII.GetString(data, 262, 32);
CMD402.chargingServiceCharge = ByteUtils.DToUInt32(data, 294);
CMD402.millennialpowerConsumption = (data[298]*0.001).ToString("F4");
CMD402.parallelChargingMark = data[299];
}
else if (func == 422)
{
CMD402.currentChargingLevel = (ByteUtils.ToUInt32(data, 104) * 0.001).ToString("F3");
CMD402.timeUInt32erval1ChargingElectLevel = ((ByteUtils.DToUInt32(data, 167)*0.001)).ToString("F3");
CMD402.timeUInt32erval2ChargingElectLevel = ((ByteUtils.DToUInt32(data, 171)*0.001)).ToString("F3");
CMD402.timeUInt32erval3ChargingElectLevel = ((ByteUtils.DToUInt32(data, 175)*0.001)).ToString("F3");
CMD402.timeUInt32erval4ChargingElectLevel = ((ByteUtils.DToUInt32(data, 179)*0.001)).ToString("F3");
CMD402.timeUInt32erval5ChargingElectLevel = ((ByteUtils.DToUInt32(data, 183)*0.001)).ToString("F3");
CMD402.timeUInt32erval6ChargingElectLevel = ((ByteUtils.DToUInt32(data, 187)*0.001)).ToString("F3");
CMD402.timeUInt32erval7ChargingElectLevel = ((ByteUtils.DToUInt32(data, 191)*0.001)).ToString("F3");
CMD402.timeUInt32erval8ChargingElectLevel = ((ByteUtils.DToUInt32(data, 195)*0.001)).ToString("F3");
CMD402.timeUInt32erval9ChargingElectLevel = ((ByteUtils.DToUInt32(data, 199)*0.001)).ToString("F3");
CMD402.timeUInt32erval10ChargingElectLevel = ((ByteUtils.DToUInt32(data, 203)*0.001)).ToString("F3");
CMD402.timeUInt32erval11ChargingElectLevel = ((ByteUtils.DToUInt32(data, 207)*0.001)).ToString("F3");
CMD402.timeUInt32erval12ChargingElectLevel = ((ByteUtils.DToUInt32(data, 211)*0.001)).ToString("F3");
CMD402.timeUInt32erval13ChargingElectLevel = ((ByteUtils.DToUInt32(data, 215)*0.001)).ToString("F3");
CMD402.timeUInt32erval14ChargingElectLevel = ((ByteUtils.DToUInt32(data, 219)*0.001)).ToString("F3");
CMD402.timeUInt32erval15ChargingElectLevel = ((ByteUtils.DToUInt32(data, 223)*0.001)).ToString("F3");
CMD402.timeUInt32erval16ChargingElectLevel = ((ByteUtils.DToUInt32(data, 227)*0.001)).ToString("F3");
CMD402.timeUInt32erval17ChargingElectLevel = ((ByteUtils.DToUInt32(data, 231)*0.001)).ToString("F3");
CMD402.timeUInt32erval18ChargingElectLevel = ((ByteUtils.DToUInt32(data, 235)*0.001)).ToString("F3");
CMD402.timeUInt32erval19ChargingElectLevel = ((ByteUtils.DToUInt32(data, 239)*0.001)).ToString("F3");
CMD402.timeUInt32erval20ChargingElectLevel = ((ByteUtils.DToUInt32(data, 243)*0.001)).ToString("F3");
CMD402.timeUInt32erval21ChargingElectLevel = ((ByteUtils.DToUInt32(data, 247)*0.001)).ToString("F3");
CMD402.timeUInt32erval22ChargingElectLevel = ((ByteUtils.DToUInt32(data, 251)*0.001)).ToString("F3");
CMD402.timeUInt32erval23ChargingElectLevel = ((ByteUtils.DToUInt32(data, 255)*0.001)).ToString("F3");
CMD402.timeUInt32erval24ChargingElectLevel = ((ByteUtils.DToUInt32(data, 259)*0.001)).ToString("F3");
CMD402.timeUInt32erval25ChargingElectLevel = ((ByteUtils.DToUInt32(data, 263)*0.001)).ToString("F3");
CMD402.timeUInt32erval26ChargingElectLevel = ((ByteUtils.DToUInt32(data, 267)*0.001)).ToString("F3");
CMD402.timeUInt32erval27ChargingElectLevel = ((ByteUtils.DToUInt32(data, 271)*0.001)).ToString("F3");
CMD402.timeUInt32erval28ChargingElectLevel = ((ByteUtils.DToUInt32(data, 275)*0.001)).ToString("F3");
CMD402.timeUInt32erval29ChargingElectLevel = ((ByteUtils.DToUInt32(data, 279)*0.001)).ToString("F3");
CMD402.timeUInt32erval30ChargingElectLevel = ((ByteUtils.DToUInt32(data, 283)*0.001)).ToString("F3");
CMD402.timeUInt32erval31ChargingElectLevel = ((ByteUtils.DToUInt32(data, 287)*0.001)).ToString("F3");
CMD402.timeUInt32erval32ChargingElectLevel = ((ByteUtils.DToUInt32(data, 291)*0.001)).ToString("F3");
CMD402.timeUInt32erval33ChargingElectLevel = ((ByteUtils.DToUInt32(data, 295)*0.001)).ToString("F3");
CMD402.timeUInt32erval34ChargingElectLevel = ((ByteUtils.DToUInt32(data, 299)*0.001)).ToString("F3");
CMD402.timeUInt32erval35ChargingElectLevel = ((ByteUtils.DToUInt32(data, 301)*0.001)).ToString("F3");
CMD402.timeUInt32erval36ChargingElectLevel = ((ByteUtils.DToUInt32(data, 305)*0.001)).ToString("F3");
CMD402.timeUInt32erval37ChargingElectLevel = ((ByteUtils.DToUInt32(data, 309)*0.001)).ToString("F3");
CMD402.timeUInt32erval38ChargingElectLevel = ((ByteUtils.DToUInt32(data, 313)*0.001)).ToString("F3");
CMD402.timeUInt32erval39ChargingElectLevel = ((ByteUtils.DToUInt32(data, 317)*0.001)).ToString("F3");
CMD402.timeUInt32erval40ChargingElectLevel = ((ByteUtils.DToUInt32(data, 321)*0.001)).ToString("F3");
CMD402.timeUInt32erval41ChargingElectLevel = ((ByteUtils.DToUInt32(data, 325)*0.001)).ToString("F3");
CMD402.timeUInt32erval42ChargingElectLevel = ((ByteUtils.DToUInt32(data, 329)*0.001)).ToString("F3");
CMD402.timeUInt32erval43ChargingElectLevel = ((ByteUtils.DToUInt32(data, 333)*0.001)).ToString("F3");
CMD402.timeUInt32erval44ChargingElectLevel = ((ByteUtils.DToUInt32(data, 337)*0.001)).ToString("F3");
CMD402.timeUInt32erval45ChargingElectLevel = ((ByteUtils.DToUInt32(data, 341)*0.001)).ToString("F3");
CMD402.timeUInt32erval46ChargingElectLevel = ((ByteUtils.DToUInt32(data, 345)*0.001)).ToString("F3");
CMD402.timeUInt32erval47ChargingElectLevel = ((ByteUtils.DToUInt32(data, 349)*0.001)).ToString("F3");
CMD402.timeUInt32erval48ChargingElectLevel = ((ByteUtils.DToUInt32(data, 353)*0.001)).ToString("F3");
CMD402.startWay = data[357];
CMD402.chargingSerialNum = Encoding.ASCII.GetString(data, 358, 32);
CMD402.chargingServiceCharge = ByteUtils.DToUInt32(data, 390);
CMD402.millennialpowerConsumption = (data[394] * 0.001).ToString("F4");
CMD402.parallelChargingMark = data[395];
}
CMD402.beforeChargingElectMeter = ByteUtils.DToUInt32(data, 108);
CMD402.behindChargingElectMeter = ByteUtils.DToUInt32(data, 112);
CMD402.currentChargingMoney = ByteUtils.DToUInt32(data, 116);
@ -862,62 +981,23 @@ namespace BatCharging.Service.DataRlt
CMD402.allCharingRecordEntry = ByteUtils.DToUInt32(data, 132);
CMD402.reserved3 = data[136];
CMD402.chargingStrategy = data[137];
CMD402.chargingStrategyPara = (float)ByteUtils.ToUInt32(data, 138);
switch (data[137])
{
case 1:
CMD402.chargingStrategyPara = (ByteUtils.ToUInt32(data, 138)).ToString();
break;
case 2:
CMD402.chargingStrategyPara = ((float)ByteUtils.ToUInt32(data, 138) * 0.01).ToString("F2");
break;
case 3:
CMD402.chargingStrategyPara = ((float)ByteUtils.ToUInt32(data, 138) * 0.01).ToString("F3");
break;
}
CMD402.carVin = Encoding.ASCII.GetString(data, 142, 17);
CMD402.carNum = Encoding.ASCII.GetString(data, 159, 8);
CMD402.timeUInt32erval1ChargingElectLevel = Encoding.ASCII.GetString(data, 167, 2);
CMD402.timeUInt32erval2ChargingElectLevel = Encoding.ASCII.GetString(data, 169, 2);
CMD402.timeUInt32erval3ChargingElectLevel = Encoding.ASCII.GetString(data, 171, 2);
CMD402.timeUInt32erval4ChargingElectLevel = Encoding.ASCII.GetString(data, 173, 2);
CMD402.timeUInt32erval5ChargingElectLevel = Encoding.ASCII.GetString(data, 175, 2);
CMD402.timeUInt32erval6ChargingElectLevel = Encoding.ASCII.GetString(data, 177, 2);
CMD402.timeUInt32erval7ChargingElectLevel = Encoding.ASCII.GetString(data, 179, 2);
CMD402.timeUInt32erval8ChargingElectLevel = Encoding.ASCII.GetString(data, 181, 2);
CMD402.timeUInt32erval9ChargingElectLevel = Encoding.ASCII.GetString(data, 183, 2);
CMD402.timeUInt32erval10ChargingElectLevel = Encoding.ASCII.GetString(data, 183, 2);
CMD402.timeUInt32erval11ChargingElectLevel = Encoding.ASCII.GetString(data, 185, 2);
CMD402.timeUInt32erval12ChargingElectLevel = Encoding.ASCII.GetString(data, 187, 2);
CMD402.timeUInt32erval13ChargingElectLevel = Encoding.ASCII.GetString(data, 189, 2);
CMD402.timeUInt32erval14ChargingElectLevel = Encoding.ASCII.GetString(data, 191, 2);
CMD402.timeUInt32erval15ChargingElectLevel = Encoding.ASCII.GetString(data, 193, 2);
CMD402.timeUInt32erval16ChargingElectLevel = Encoding.ASCII.GetString(data, 195, 2);
CMD402.timeUInt32erval17ChargingElectLevel = Encoding.ASCII.GetString(data, 197, 2);
CMD402.timeUInt32erval18ChargingElectLevel = Encoding.ASCII.GetString(data, 199, 2);
CMD402.timeUInt32erval19ChargingElectLevel = Encoding.ASCII.GetString(data, 201, 2);
CMD402.timeUInt32erval20ChargingElectLevel = Encoding.ASCII.GetString(data, 203, 2);
CMD402.timeUInt32erval21ChargingElectLevel = Encoding.ASCII.GetString(data, 205, 2);
CMD402.timeUInt32erval22ChargingElectLevel = Encoding.ASCII.GetString(data, 207, 2);
CMD402.timeUInt32erval23ChargingElectLevel = Encoding.ASCII.GetString(data, 209, 2);
CMD402.timeUInt32erval24ChargingElectLevel = Encoding.ASCII.GetString(data, 211, 2);
CMD402.timeUInt32erval25ChargingElectLevel = Encoding.ASCII.GetString(data, 213, 2);
CMD402.timeUInt32erval26ChargingElectLevel = Encoding.ASCII.GetString(data, 215, 2);
CMD402.timeUInt32erval27ChargingElectLevel = Encoding.ASCII.GetString(data, 217, 2);
CMD402.timeUInt32erval28ChargingElectLevel = Encoding.ASCII.GetString(data, 219, 2);
CMD402.timeUInt32erval29ChargingElectLevel = Encoding.ASCII.GetString(data, 221, 2);
CMD402.timeUInt32erval30ChargingElectLevel = Encoding.ASCII.GetString(data, 223, 2);
CMD402.timeUInt32erval31ChargingElectLevel = Encoding.ASCII.GetString(data, 225, 2);
CMD402.timeUInt32erval32ChargingElectLevel = Encoding.ASCII.GetString(data, 227, 2);
CMD402.timeUInt32erval33ChargingElectLevel = Encoding.ASCII.GetString(data, 229, 2);
CMD402.timeUInt32erval34ChargingElectLevel = Encoding.ASCII.GetString(data, 231, 2);
CMD402.timeUInt32erval35ChargingElectLevel = Encoding.ASCII.GetString(data, 233, 2);
CMD402.timeUInt32erval36ChargingElectLevel = Encoding.ASCII.GetString(data, 235, 2);
CMD402.timeUInt32erval37ChargingElectLevel = Encoding.ASCII.GetString(data, 237, 2);
CMD402.timeUInt32erval38ChargingElectLevel = Encoding.ASCII.GetString(data, 239, 2);
CMD402.timeUInt32erval39ChargingElectLevel = Encoding.ASCII.GetString(data, 241, 2);
CMD402.timeUInt32erval40ChargingElectLevel = Encoding.ASCII.GetString(data, 243, 2);
CMD402.timeUInt32erval41ChargingElectLevel = Encoding.ASCII.GetString(data, 245, 2);
CMD402.timeUInt32erval42ChargingElectLevel = Encoding.ASCII.GetString(data, 247, 2);
CMD402.timeUInt32erval43ChargingElectLevel = Encoding.ASCII.GetString(data, 249, 2);
CMD402.timeUInt32erval44ChargingElectLevel = Encoding.ASCII.GetString(data, 251, 2);
CMD402.timeUInt32erval45ChargingElectLevel = Encoding.ASCII.GetString(data, 253, 2);
CMD402.timeUInt32erval46ChargingElectLevel = Encoding.ASCII.GetString(data, 255, 2);
CMD402.timeUInt32erval47ChargingElectLevel = Encoding.ASCII.GetString(data, 257, 2);
CMD402.timeUInt32erval48ChargingElectLevel = Encoding.ASCII.GetString(data, 259, 2);
CMD402.startWay = data[261];
CMD402.chargingSerialNum = Encoding.ASCII.GetString(data, 262, 32);
CMD402.chargingServiceCharge = ByteUtils.DToUInt32(data, 294);
CMD402.millennialpowerConsumption = data[298];
CMD402.parallelChargingMark = data[299];
}
return CMD402;
}
@ -1241,8 +1321,7 @@ namespace BatCharging.Service.DataRlt
if (data != null && data.Length > 0)
{
CMD1501 = new CMD1501();
CMD1501.value01 = ByteUtils.DToUInt16(data, 8);
CMD1501.value02 = ByteUtils.DToUInt16(data, 10);
CMD1501.value03 = Encoding.ASCII.GetString(data, 12, 32);
CMD1501.value04 = Encoding.ASCII.GetString(data, 44, 128);
}

@ -623,7 +623,7 @@ namespace BatCharging.Service
#region 充电信息数据
public byte[] SendRCMD201(out APDUModel APDUModel, CMD201 CMD)
public byte[] SendRCMD201(out APDUModel APDUModel, CMD201 CMD, uint func)
{
byte[] result = null;
@ -632,7 +632,15 @@ namespace BatCharging.Service
model.OriginDomain2 = 0xF5;
model.infoDomain = 0x02;
model.SerialNumberDomain = 0xff;
model.CMD = 2011;
if (func == 202)
{
model.CMD = 201;
}
else if (func == 222)
{
model.CMD = 221;
}
model.checksumDomain = 0x01;
model.dataDomain = GetRCMD201DataInfo(CMD); //数据域
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度

Loading…
Cancel
Save