更改日志记录内容

master
lch 8 months ago
parent a0625f847f
commit 01b13f9d3e

@ -20,6 +20,6 @@ namespace BatCharging.Model
/// 应答码 /// 应答码
/// 0-允许发送 其他-不支持日志上传 /// 0-允许发送 其他-不支持日志上传
/// </summary> /// </summary>
public UInt16 responseCode { get; set; } public uint responseCode { get; set; }
} }
} }

@ -1325,7 +1325,7 @@ namespace BatCharging.Service
case 402: case 402:
case 422: case 422:
{ {
CMD402 CMD402 = new MsgReceiveCMDCom().ConCMD402(func,data); CMD402 CMD402 = new MsgReceiveCMDCom().ConCMD402(func, data);
string result = "充电桩上报历史的充电记录 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + ""; string result = "充电桩上报历史的充电记录 - 接收字节内容:" + ByteUtils.BytesToHexStr(data) + "";
result += "\r\n" + "充电桩上报历史的充电记录:" + JsonConvert.SerializeObject(CMD402); result += "\r\n" + "充电桩上报历史的充电记录:" + JsonConvert.SerializeObject(CMD402);
Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码"); Log.LogInstance.WriteLog(result, LogType.Information, "Charger" + "充电机编码");
@ -1563,11 +1563,15 @@ namespace BatCharging.Service
if (CMD1501 != null) if (CMD1501 != null)
{ {
PublicProgram.failName01 = CMD1501.value03 + "/" + CMD1501.value04 + "/" + DateTime.Now.ToString("yyyyMMddHHmmss"); //判断是否允许上传 todo
//应答码responseCode 0-允许发送,其他-不支持日志上传
uint responseCode = 0;
//(CMD=9)后台服务器应答桩上传命令请求(预留)
CmnChargerParam._CHR00TCPCLIENT.Send1502(0);
//服务器允许上传
CmnChargerParam._CHR00TCPCLIENT.Send1502(responseCode);
PublicProgram.failName01 = CMD1501.value03 + "/" + CMD1501.value04 + "/" + DateTime.Now.ToString("yyyyMMddHHmmss");
//获取桌面路径 //获取桌面路径
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
@ -2236,7 +2240,7 @@ namespace BatCharging.Service
#region 充电信息数据 #region 充电信息数据
public void Send201(CMD201 CMD201,uint func) public void Send201(CMD201 CMD201, uint func)
{ {
if (_chr_client != null) if (_chr_client != null)
{ {
@ -2514,7 +2518,7 @@ namespace BatCharging.Service
#region 协议方式日志上传 #region 协议方式日志上传
public void Send1502(ushort responseCode) public void Send1502(uint responseCode)
{ {
if (_chr_client != null) if (_chr_client != null)
{ {

@ -301,7 +301,7 @@ namespace BatCharging.Service
if (APDUModel != null) if (APDUModel != null)
{ {
string result = "后台服务器下发充电桩整形工作参数-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "1后台服务器下发充电桩整形工作参数-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
@ -330,7 +330,7 @@ namespace BatCharging.Service
if (APDUModel != null) if (APDUModel != null)
{ {
string result = "后台服务器下发充电桩字符型参数-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "3后台服务器下发充电桩字符型参数-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
@ -362,7 +362,7 @@ namespace BatCharging.Service
if (APDUModel != null) if (APDUModel != null)
{ {
string result = "后台服务器下发充电桩控制命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "5后台服务器下发充电桩控制命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
@ -384,7 +384,7 @@ namespace BatCharging.Service
if (APDUModel != null) if (APDUModel != null)
{ {
string result = "后台服务器下发充电桩开启充电控制命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "7后台服务器下发充电桩开启充电控制命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
@ -393,14 +393,7 @@ namespace BatCharging.Service
/// <summary>
/// 后台服务器应答桩上传命令请求(预留)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="chargeMuzzle">充电枪号</param>
/// <param name="executeResult">执行结果</param>
/// <param name="address">命令地址</param>
/// <param name="setData">数据</param>
internal void Send9(TcpClientChargerTool tcp_client, byte chargeMuzzle, uint executeResult, uint address, byte[] setData) internal void Send9(TcpClientChargerTool tcp_client, byte chargeMuzzle, uint executeResult, uint address, byte[] setData)
{ {
APDUModel APDUModel; APDUModel APDUModel;
@ -417,7 +410,7 @@ namespace BatCharging.Service
if (APDUModel != null) if (APDUModel != null)
{ {
string result = "后台服务器应答桩上传命令请求(预留)-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "9后台服务器应答桩上传命令请求(预留)-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
@ -445,7 +438,7 @@ namespace BatCharging.Service
if (APDUModel != null) if (APDUModel != null)
{ {
string result = "服务器应答心跳包信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "101服务器应答心跳包信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
@ -471,7 +464,7 @@ namespace BatCharging.Service
byte[] bytes = new ChargerSendCMD().SendRCMD103(out APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD103(out APDUModel, CMD);
if (APDUModel != null) if (APDUModel != null)
{ {
string result = "服务器应答充电桩状态信息包-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "103服务器应答充电桩状态信息包-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
@ -490,7 +483,7 @@ namespace BatCharging.Service
byte[] bytes = new ChargerSendCMD().SendRCMD105(out APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD105(out APDUModel, CMD);
if (APDUModel != null) if (APDUModel != null)
{ {
string result = "服务器应答充电桩签到命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "105服务器应答充电桩签到命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
@ -510,7 +503,7 @@ namespace BatCharging.Service
byte[] bytes = new ChargerSendCMD().SendRCMD107(out APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD107(out APDUModel, CMD);
if (APDUModel != null) if (APDUModel != null)
{ {
string result = "服务器应答充电桩告警信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "107服务器应答充电桩告警信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
@ -533,18 +526,13 @@ namespace BatCharging.Service
byte[] bytes = new ChargerSendCMD().SendRCMD109(out APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD109(out APDUModel, CMD);
if (APDUModel != null) if (APDUModel != null)
{ {
string result = "服务器应答充电桩告警信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "109服务器应答充电桩启动完成命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
} }
/// <summary>
/// 服务器应答充电桩上报模块信息(预留)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="messageType">报文类型</param>
internal void Send111(TcpClientChargerTool tcp_client, byte messageType) internal void Send111(TcpClientChargerTool tcp_client, byte messageType)
{ {
APDUModel APDUModel; APDUModel APDUModel;
@ -558,7 +546,7 @@ namespace BatCharging.Service
byte[] bytes = new ChargerSendCMD().SendRCMD111(out APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD111(out APDUModel, CMD);
if (APDUModel != null) if (APDUModel != null)
{ {
string result = "服务器应答充电桩上报模块信息(预留)-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "111服务器应答充电桩上报模块信息(预留)-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
@ -584,7 +572,7 @@ namespace BatCharging.Service
byte[] bytes = new ChargerSendCMD().SendRCMD113(out APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD113(out APDUModel, CMD);
if (APDUModel != null) if (APDUModel != null)
{ {
string result = "服务器查询最近一次充电各时段信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "113服务器查询最近一次充电各时段信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
@ -605,19 +593,14 @@ namespace BatCharging.Service
{ {
byte[] bytes = new ChargerSendCMD().SendRCMD201(out APDUModel APDUModel, CMD, func); byte[] bytes = new ChargerSendCMD().SendRCMD201(out APDUModel APDUModel, CMD, func);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "201服务器应答充电桩上报充电信息报文-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send203(TcpClientChargerTool tcp_client, CMD204 CMD204, uint value03, uint value04, ushort value05, ushort value06, byte value07, byte value08, byte value09, byte value10, string value11, string value12) internal void Send203(TcpClientChargerTool tcp_client, CMD204 CMD204, uint value03, uint value04, ushort value05, ushort value06, byte value07, byte value08, byte value09, byte value10, string value11, string value12)
{ {
CMD203 CMD = new CMD203(); CMD203 CMD = new CMD203();
@ -636,19 +619,14 @@ namespace BatCharging.Service
CMD.value13 = CMD204.value11; CMD.value13 = CMD204.value11;
byte[] bytes = new ChargerSendCMD().SendRCMD203(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD203(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "203服务器应答账户查询信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send205(TcpClientChargerTool tcp_client, uint value03, uint value04) internal void Send205(TcpClientChargerTool tcp_client, uint value03, uint value04)
{ {
CMD205 CMD = new CMD205(); CMD205 CMD = new CMD205();
@ -665,19 +643,14 @@ namespace BatCharging.Service
} }
byte[] bytes = new ChargerSendCMD().SendRCMD205(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD205(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "205服务器应答充电密码验证报文预留-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send207(TcpClientChargerTool tcp_client, CMD208 CMD208, string value06, string value07, byte value08, byte value09, uint value10, ulong value11) internal void Send207(TcpClientChargerTool tcp_client, CMD208 CMD208, string value06, string value07, byte value08, byte value09, uint value10, ulong value11)
{ {
CMD207 CMD = new CMD207(); CMD207 CMD = new CMD207();
@ -693,19 +666,14 @@ namespace BatCharging.Service
CMD.value10 = value10; CMD.value10 = value10;
CMD.value11 = value11; CMD.value11 = value11;
byte[] bytes = new ChargerSendCMD().SendRCMD207(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD207(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "207平台回复“即插即充”请求充电结果-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send209(TcpClientChargerTool tcp_client, CMD210 CMD210, string value05) internal void Send209(TcpClientChargerTool tcp_client, CMD210 CMD210, string value05)
{ {
CMD209 CMD = new CMD209(); CMD209 CMD = new CMD209();
@ -715,17 +683,12 @@ namespace BatCharging.Service
CMD.value04 = CMD210.value04; CMD.value04 = CMD210.value04;
CMD.value05 = value05; CMD.value05 = value05;
byte[] bytes = new ChargerSendCMD().SendRCMD209(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD209(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "209平台回复“即插即充”启动充电结果-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send221(TcpClientChargerTool tcp_client, CMD221 CMD221, uint value05) internal void Send221(TcpClientChargerTool tcp_client, CMD221 CMD221, uint value05)
{ {
CMD221 CMD = new CMD221(); CMD221 CMD = new CMD221();
@ -745,37 +708,27 @@ namespace BatCharging.Service
#endregion #endregion
#region 直流充电桩 BMS 信息数据(预留) #region 直流充电桩 BMS 信息数据(预留)
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send301(TcpClientChargerTool tcp_client) internal void Send301(TcpClientChargerTool tcp_client)
{ {
CMD301 CMD = new CMD301(); CMD301 CMD = new CMD301();
CMD.reserved1 = 0; CMD.reserved1 = 0;
CMD.reserved2 = 0; CMD.reserved2 = 0;
byte[] bytes = new ChargerSendCMD().SendRCMD301(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD301(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "301服务器应答充电桩上报BMS信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send303(TcpClientChargerTool tcp_client) internal void Send303(TcpClientChargerTool tcp_client)
{ {
CMD303 CMD = new CMD303(); CMD303 CMD = new CMD303();
CMD.reserved1 = 0; CMD.reserved1 = 0;
CMD.reserved2 = 0; CMD.reserved2 = 0;
byte[] bytes = new ChargerSendCMD().SendRCMD303(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD303(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "303服务器应答充电桩上报BMS信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
@ -783,12 +736,7 @@ namespace BatCharging.Service
#endregion #endregion
#region 历史记录 #region 历史记录
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send401(TcpClientChargerTool tcp_client, string chargingSerialNum, uint startIndex) internal void Send401(TcpClientChargerTool tcp_client, string chargingSerialNum, uint startIndex)
{ {
CMD401 CMD = new CMD401(); CMD401 CMD = new CMD401();
@ -797,7 +745,7 @@ namespace BatCharging.Service
CMD.startingIndexOfQueryRecord = startIndex; CMD.startingIndexOfQueryRecord = startIndex;
CMD.chargingSerialNumber = chargingSerialNum; CMD.chargingSerialNumber = chargingSerialNum;
byte[] bytes = new ChargerSendCMD().SendRCMD401(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD401(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "401/421服务器查询充电桩历史充电记录-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
@ -805,115 +753,80 @@ namespace BatCharging.Service
#endregion #endregion
#region 升级命令 #region 升级命令
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send1001(TcpClientChargerTool tcp_client, int instruct) internal void Send1001(TcpClientChargerTool tcp_client, int instruct)
{ {
CMD1001 CMD = new CMD1001(); CMD1001 CMD = new CMD1001();
CMD.eraseOrQueryInstructions = instruct; CMD.eraseOrQueryInstructions = instruct;
byte[] bytes = new ChargerSendCMD().SendRCMD1001(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD1001(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "1001服务器下发擦除指令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send1003(TcpClientChargerTool tcp_client, string fileName) internal void Send1003(TcpClientChargerTool tcp_client, string fileName)
{ {
CMD1003 CMD = new CMD1003(); CMD1003 CMD = new CMD1003();
CMD.fileName = fileName; CMD.fileName = fileName;
byte[] bytes = new ChargerSendCMD().SendRCMD1003(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD1003(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "1003服务器下发升级文件名指令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send1005(TcpClientChargerTool tcp_client, uint fileLength) internal void Send1005(TcpClientChargerTool tcp_client, uint fileLength)
{ {
CMD1005 CMD = new CMD1005(); CMD1005 CMD = new CMD1005();
CMD.fileLength = fileLength; CMD.fileLength = fileLength;
byte[] bytes = new ChargerSendCMD().SendRCMD1005(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD1005(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "1005服务器下发升级文件大小-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send1007(TcpClientChargerTool tcp_client, string updata) internal void Send1007(TcpClientChargerTool tcp_client, string updata)
{ {
CMD1007 CMD = new CMD1007(); CMD1007 CMD = new CMD1007();
CMD.upgradeFileData = updata; CMD.upgradeFileData = updata;
byte[] bytes = new ChargerSendCMD().SendRCMD1007(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD1007(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "1007服务器下发升级文件数据-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send1009(TcpClientChargerTool tcp_client) internal void Send1009(TcpClientChargerTool tcp_client)
{ {
CMD1009 CMD = new CMD1009(); CMD1009 CMD = new CMD1009();
CMD.Value01 = 0; CMD.Value01 = 0;
byte[] bytes = new ChargerSendCMD().SendRCMD1009(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD1009(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "1009服务器下发升级文件数据结束指令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send1011(TcpClientChargerTool tcp_client) internal void Send1011(TcpClientChargerTool tcp_client)
{ {
CMD1011 CMD = new CMD1011(); CMD1011 CMD = new CMD1011();
CMD.reserved1 = 0; CMD.reserved1 = 0;
byte[] bytes = new ChargerSendCMD().SendRCMD1011(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD1011(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "1011服务器下发重启指令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send1021(TcpClientChargerTool tcp_client, uint results, string description) internal void Send1021(TcpClientChargerTool tcp_client, uint results, string description)
{ {
CMD1021 CMD = new CMD1021(); CMD1021 CMD = new CMD1021();
CMD.responseResults = results; CMD.responseResults = results;
CMD.responseDescription = description; CMD.responseDescription = description;
byte[] bytes = new ChargerSendCMD().SendRCMD1021(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD1021(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "1021服务器回复充电桩主动请求升级命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
@ -922,58 +835,38 @@ namespace BatCharging.Service
#region 与计费策略相关的指令 #region 与计费策略相关的指令
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send1101(TcpClientChargerTool tcp_client) internal void Send1101(TcpClientChargerTool tcp_client)
{ {
byte[] bytes = new ChargerSendCMD().SendRCMD1101(out APDUModel APDUModel); byte[] bytes = new ChargerSendCMD().SendRCMD1101(out APDUModel APDUModel);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "1101后台服务器查询24时电费计价策略信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send1103(TcpClientChargerTool tcp_client, CMD1103 CMD) internal void Send1103(TcpClientChargerTool tcp_client, CMD1103 CMD)
{ {
byte[] bytes = new ChargerSendCMD().SendRCMD1103(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD1103(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "1103后台服务器设置24时段电费计价策略信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send1105(TcpClientChargerTool tcp_client, CMD1105 CMD) internal void Send1105(TcpClientChargerTool tcp_client, CMD1105 CMD)
{ {
byte[] bytes = new ChargerSendCMD().SendRCMD1105(out APDUModel APDUModel,CMD); byte[] bytes = new ChargerSendCMD().SendRCMD1105(out APDUModel APDUModel,CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "1105后台服务器设置分时段计价策略信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send1107(TcpClientChargerTool tcp_client) internal void Send1107(TcpClientChargerTool tcp_client)
{ {
byte[] bytes = new ChargerSendCMD().SendRCMD1107(out APDUModel APDUModel); byte[] bytes = new ChargerSendCMD().SendRCMD1107(out APDUModel APDUModel);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "1107后台服务器查询分时电费计价策略信息-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
@ -982,16 +875,11 @@ namespace BatCharging.Service
#region 白名单报文 #region 白名单报文
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send1301(TcpClientChargerTool tcp_client, CMD1301 CMD) internal void Send1301(TcpClientChargerTool tcp_client, CMD1301 CMD)
{ {
byte[] bytes = new ChargerSendCMD().SendRCMD1301(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD1301(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "1301服务器下发白名单操作日志数据包-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
@ -1000,45 +888,20 @@ namespace BatCharging.Service
#endregion #endregion
#region FTP 远程升级和 FTP 方式日志上传 #region FTP 远程升级和 FTP 方式日志上传
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="UpgradeSoftwareFileVersionNum"></param>
/// <param name="ftpServerIPaddress"></param>
/// <param name="ftpUserName"></param>
/// <param name="ftpPassWord"></param>
/// <param name="ftpDownloadPath"></param>
/// <param name="executeWay"></param>
/// <param name="nowUpgradeDeviceType"></param>
internal void Send1401(TcpClientChargerTool tcp_client, CMD1401 CMD) internal void Send1401(TcpClientChargerTool tcp_client, CMD1401 CMD)
{ {
byte[] bytes = new ChargerSendCMD().SendRCMD1401(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD1401(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "1401服务器下发FTP远程升级命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send1406(TcpClientChargerTool tcp_client, CMD1406 CMD) internal void Send1406(TcpClientChargerTool tcp_client, CMD1406 CMD)
{ {
//CMD1406 CMD = new CMD1406();
//CMD.reserved1 = 0;
//CMD.reserved2 = 0;
//CMD.getLogType = 0;
//CMD.ftpServerIPaddress = null;
//CMD.ftpUserName = null;
//CMD.ftpPassWord = null;
//CMD.ftpSavePath = null;
//CMD.executeWay = 0;
byte[] bytes = new ChargerSendCMD().SendRCMD1406(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD1406(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "1406服务器下发获取充电桩日志信息命令-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
@ -1046,32 +909,20 @@ namespace BatCharging.Service
#endregion #endregion
#region 协议方式日志上传 #region 协议方式日志上传
/// <summary>
/// (CMD=5) internal void Send1502(TcpClientChargerTool tcp_client,uint responseCode)
/// </summary>
/// <param name="tcp_client"></param>
/// <param name="dest_addr"></param>
/// <param name="respResult"></param>
internal void Send1502(TcpClientChargerTool tcp_client,ushort responseCode)
{ {
CMD1502 CMD = new CMD1502(); CMD1502 CMD = new CMD1502();
CMD.reserved1 = 0;
CMD.reserved2 = 0;
CMD.responseCode = responseCode; CMD.responseCode = responseCode;
byte[] bytes = new ChargerSendCMD().SendRCMD1502(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD1502(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "cmd1502 服务器允许上传-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
/// <summary>
/// (CMD=5) internal void Send1504(TcpClientChargerTool tcp_client, uint logo, uint successReservedMessageNum)
/// </summary>
/// <param name="tcp_client">TCP</param>
/// <param name="logo">标识</param>
/// <param name="successReservedMessageNum">已成功接收的报文编号
/// 这个要与最后一次收到的 1503 报文中的字段 4 一样。</param>
internal void Send1504(TcpClientChargerTool tcp_client, uint logo,uint successReservedMessageNum)
{ {
CMD1504 CMD = new CMD1504(); CMD1504 CMD = new CMD1504();
CMD.reserved1 = 0; CMD.reserved1 = 0;
@ -1079,25 +930,19 @@ namespace BatCharging.Service
CMD.logo = logo; CMD.logo = logo;
CMD.successReservedMessageNum = successReservedMessageNum; CMD.successReservedMessageNum = successReservedMessageNum;
byte[] bytes = new ChargerSendCMD().SendRCMD1504(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD1504(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "1504服务器应答上传日志-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);
} }
/// <summary>
/// (CMD=5)
/// </summary>
/// <param name="tcp_client">TCP</param>
/// <param name="logo">标识</param>
/// <param name="successReservedMessageNum">已成功接收的报文编号
/// 这个要与最后一次收到的 1503 报文中的字段 4 一样。</param>
internal void Send1506(TcpClientChargerTool tcp_client) internal void Send1506(TcpClientChargerTool tcp_client)
{ {
CMD1506 CMD = new CMD1506(); CMD1506 CMD = new CMD1506();
CMD.value01 = 0; CMD.value01 = 0;
CMD.value01 = 0; CMD.value01 = 0;
byte[] bytes = new ChargerSendCMD().SendRCMD1506(out APDUModel APDUModel, CMD); byte[] bytes = new ChargerSendCMD().SendRCMD1506(out APDUModel APDUModel, CMD);
string result = "站控响应充放电机上报模块状态-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + ""; string result = "1506当前文件接收完成-发送字节内容:" + ByteUtils.BytesToHexStr(bytes) + "";
Log.LogInstance.WriteLog(result, LogType.Information, "SendLog"); Log.LogInstance.WriteLog(result, LogType.Information, "SendLog");
tcp_client.Write(bytes); tcp_client.Write(bytes);

@ -1851,22 +1851,13 @@ namespace BatCharging.Service
List<byte> lstContent = new List<byte>(); List<byte> lstContent = new List<byte>();
lstContent.AddRange(BitConverter.GetBytes(CMD.reserved1)); lstContent.AddRange(BitConverter.GetBytes(CMD.reserved1));
lstContent.AddRange(BitConverter.GetBytes(CMD.reserved2)); lstContent.AddRange(BitConverter.GetBytes(CMD.reserved2));
lstContent.AddRange(BitConverter.GetBytes((ushort)(Convert.ToSingle(CMD.UpgradeSoftwareFileVersionNum) * 100)));
lstContent.AddRange(BitConverter.GetBytes(Convert.ToUInt16(CMD.UpgradeSoftwareFileVersionNum) * 100)); lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.ftpServerIPaddress), 32));
lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.ftpUserName), 16));
lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.ftpPassWord), 16));
lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.ftpDownloadPath), 64));
string[] parts = CMD.ftpServerIPaddress.Split(".");
if (parts.Length == 4)
{
lstContent.Add(byte.Parse(parts[0]));
lstContent.Add(byte.Parse(parts[1]));
lstContent.Add(byte.Parse(parts[2]));
lstContent.Add(byte.Parse(parts[3]));
}
lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD.ftpUserName));
lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD.ftpPassWord));
lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD.ftpDownloadPath));
lstContent.Add(CMD.executeWay); lstContent.Add(CMD.executeWay);
lstContent.Add(CMD.nowUpgradeDeviceType); lstContent.Add(CMD.nowUpgradeDeviceType);
@ -1878,7 +1869,7 @@ namespace BatCharging.Service
public byte[] SendRCMD1406(out APDUModel APDUModel, CMD1406 CMD) public byte[] SendRCMD1406(out APDUModel APDUModel, CMD1406 CMD)
{ {
byte[] result = null; byte[] result;
APDUModel model = new APDUModel(); APDUModel model = new APDUModel();
model.OriginDomain1 = 0xAA; model.OriginDomain1 = 0xAA;
@ -1913,11 +1904,12 @@ namespace BatCharging.Service
lstContent.AddRange(BitConverter.GetBytes(CMD.reserved1)); lstContent.AddRange(BitConverter.GetBytes(CMD.reserved1));
lstContent.AddRange(BitConverter.GetBytes(CMD.reserved2)); lstContent.AddRange(BitConverter.GetBytes(CMD.reserved2));
lstContent.Add(CMD.getLogType); lstContent.Add(CMD.getLogType);
lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD.ftpServerIPaddress));
lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD.ftpUserName)); lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.ftpServerIPaddress),32));
lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD.ftpPassWord)); lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.ftpUserName),16));
lstContent.AddRange(ByteUtils.ToByteByHexStr(CMD.ftpSavePath)); lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.ftpPassWord),16));
lstContent.AddRange(BitConverter.GetBytes(CMD.executeWay)); lstContent.AddRange(AddByteArray(Encoding.ASCII.GetBytes(CMD.ftpSavePath),32));
lstContent.Add(CMD.executeWay);
results = lstContent.ToArray(); results = lstContent.ToArray();
} }

@ -570,6 +570,9 @@ namespace Monitor.ChargeTest
cMD1401.ftpServerIPaddress = "16.80.1.20"; cMD1401.ftpServerIPaddress = "16.80.1.20";
cMD1401.ftpUserName = "ftpuserName"; cMD1401.ftpUserName = "ftpuserName";
cMD1401.ftpPassWord = "123456"; cMD1401.ftpPassWord = "123456";
cMD1401.ftpDownloadPath = "ftp://172.16.4.254/SINEXCEL/dcharg.bin";
cMD1401.executeWay = 1;
cMD1401.nowUpgradeDeviceType = 1;
CmnChargerParam._CHR00TCPCLIENT.Send1401(cMD1401); CmnChargerParam._CHR00TCPCLIENT.Send1401(cMD1401);
} }
@ -582,6 +585,13 @@ namespace Monitor.ChargeTest
{ {
CMD1406 cMD1406 = new CMD1406(); CMD1406 cMD1406 = new CMD1406();
cMD1406.getLogType = 1;
cMD1406.ftpServerIPaddress = "16.80.1.20";
cMD1406.ftpUserName = "ftpuserName";
cMD1406.ftpPassWord = "123456";
cMD1406.ftpSavePath = "";
cMD1406.executeWay = 1;
CmnChargerParam._CHR00TCPCLIENT.Send1406(cMD1406); CmnChargerParam._CHR00TCPCLIENT.Send1406(cMD1406);
} }
#endregion #endregion

Loading…
Cancel
Save