lch 8 months ago committed by CZ
commit 8cef64ddbd

@ -67,7 +67,7 @@ namespace BatCharging.Model
/// <summary> /// <summary>
/// 用户卡号/用户识别号(内容只能”0~9、A~Z、a~z 字符 ASCII 码,不够长度填’\0) /// 用户卡号/用户识别号(内容只能”0~9、A~Z、a~z 字符 ASCII 码,不够长度填’\0)
/// </summary> /// </summary>
public UInt32 value10 { get; set; } public string value10 { get; set; }
/// <summary> /// <summary>
/// 断网充电标志 /// 断网充电标志
/// <para>0-不允许</para> /// <para>0-不允许</para>

@ -943,7 +943,6 @@ namespace BatCharging.Service
} }
} }
/// <summary> /// <summary>
/// 接收事件 /// 接收事件
/// </summary> /// </summary>

@ -170,12 +170,12 @@ namespace BatCharging.Service
{ {
Array.Copy(byteArray, 0, bytes, 0, byteArray.Length); Array.Copy(byteArray, 0, bytes, 0, byteArray.Length);
} }
else if (byteArray.Length > leng) //else if (byteArray.Length > leng)
{ //{
// 长度超过32字节可以截断或者抛出异常 // // 长度超过32字节可以截断或者抛出异常
Array.Copy(byteArray, 0, new byte[leng], 0, leng); // 截断数组到32字节 // Array.Copy(byteArray, 0, new byte[leng], 0, leng); // 截断数组到32字节
} //}
return byteArray; return bytes;
} }
/// <summary> /// <summary>

@ -341,6 +341,57 @@ namespace BatCharging.Service.DataRlt
CMD114.value04 = data[44]; CMD114.value04 = data[44];
CMD114.value05 = data[45]; CMD114.value05 = data[45];
CMD114.value06 = Encoding.ASCII.GetString(data, 46, 8); CMD114.value06 = Encoding.ASCII.GetString(data, 46, 8);
/*
7 54
8 56
9 58
10 60
11 62
12 64
13 66
14 68
15 70
16 72
17 74
18 76
19 78
20 80
21 82
22 84
23 86
24 88
25 90
26 92
27 94
28 96
29 98
30 100
31 102
32 104
33 106
34 108
35 110
36 112
37 114
38 116
39 118
40 120
41 122
42 124
43 126
44 128
45 130
46 132
47 134
48 136
49 138
50 140
51 142
52 144
53 146
54 148
*/
CMD114.value07 = ByteUtils.DToUInt16(data, 54); CMD114.value07 = ByteUtils.DToUInt16(data, 54);
CMD114.value08 = ByteUtils.DToUInt16(data, 56); CMD114.value08 = ByteUtils.DToUInt16(data, 56);
CMD114.value09 = ByteUtils.DToUInt16(data, 58); CMD114.value09 = ByteUtils.DToUInt16(data, 58);

@ -50,9 +50,9 @@ namespace BatCharging.Service
lstContent.AddRange(BitConverter.GetBytes(CMD1.value1)); lstContent.AddRange(BitConverter.GetBytes(CMD1.value1));
lstContent.AddRange(BitConverter.GetBytes(CMD1.value2)); lstContent.AddRange(BitConverter.GetBytes(CMD1.value2));
lstContent.Add(CMD1.value3); lstContent.Add(CMD1.value3);
lstContent.AddRange(BitConverter.GetBytes(CMD1.value4)); lstContent.AddRange(BitConverter.GetBytes(CMD1.value4));//起始地址
lstContent.Add(CMD1.value5); lstContent.Add(CMD1.value5);//查询个数
lstContent.AddRange(BitConverter.GetBytes(CMD1.value6)); lstContent.AddRange(BitConverter.GetBytes(CMD1.value6));//参数字节数
if (CMD1.value3 == 1) if (CMD1.value3 == 1)
{ {
lstContent.AddRange(CMD1.value7); lstContent.AddRange(CMD1.value7);
@ -199,19 +199,20 @@ namespace BatCharging.Service
lstContent.AddRange(BitConverter.GetBytes(CMD.value01)); lstContent.AddRange(BitConverter.GetBytes(CMD.value01));
lstContent.AddRange(BitConverter.GetBytes(CMD.value02)); lstContent.AddRange(BitConverter.GetBytes(CMD.value02));
lstContent.AddRange(BitConverter.GetBytes(CMD.value03)); lstContent.Add(CMD.value03);
lstContent.AddRange(BitConverter.GetBytes(CMD.value04)); lstContent.AddRange(BitConverter.GetBytes(CMD.value04));
lstContent.AddRange(BitConverter.GetBytes(CMD.value05)); lstContent.AddRange(BitConverter.GetBytes(CMD.value05));
lstContent.AddRange(BitConverter.GetBytes(CMD.value06));
lstContent.AddRange(BitConverter.GetBytes(CMD.value07)); lstContent.AddRange(BitConverter.GetBytes(CMD.value07));
lstContent.AddRange(BitConverter.GetBytes(CMD.value08)); lstContent.AddRange(BitConverter.GetBytes(CMD.value08));
lstContent.AddRange(BitConverter.GetBytes(CMD.value09)); lstContent.Add(CMD.value09);
lstContent.AddRange(BitConverter.GetBytes(CMD.value10)); lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.value10, 32));
lstContent.AddRange(BitConverter.GetBytes(CMD.value11)); lstContent.Add(CMD.value11);
lstContent.AddRange(BitConverter.GetBytes(CMD.value12)); lstContent.AddRange(BitConverter.GetBytes(CMD.value12));
lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.value13, 32)); lstContent.AddRange(ByteUtils.ToByteByHexStr32(CMD.value13, 32));
lstContent.AddRange(BitConverter.GetBytes(CMD.value14)); lstContent.Add(CMD.value14);
lstContent.AddRange(BitConverter.GetBytes(CMD.value15)); lstContent.AddRange(BitConverter.GetBytes(CMD.value15));
lstContent.AddRange(BitConverter.GetBytes(CMD.value16)); lstContent.Add(CMD.value16);
results = lstContent.ToArray(); results = lstContent.ToArray();
} }
return results; return results;
@ -356,8 +357,8 @@ namespace BatCharging.Service
lstContent.AddRange(BitConverter.GetBytes(CMD.value01)); lstContent.AddRange(BitConverter.GetBytes(CMD.value01));
lstContent.AddRange(BitConverter.GetBytes(CMD.value02)); lstContent.AddRange(BitConverter.GetBytes(CMD.value02));
lstContent.AddRange(BitConverter.GetBytes(CMD.value03)); lstContent.Add(CMD.value03);
lstContent.AddRange(BitConverter.GetBytes(CMD.value04)); lstContent.Add(Convert.ToByte(CMD.value04));
results = lstContent.ToArray(); results = lstContent.ToArray();
} }
@ -571,8 +572,6 @@ namespace BatCharging.Service
model.CMD = 113; model.CMD = 113;
model.checksumDomain = 0x01; model.checksumDomain = 0x01;
model.dataDomain = GetRCMD113DataInfo(CMD); //数据域 model.dataDomain = GetRCMD113DataInfo(CMD); //数据域
model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度 model.LengthDomain = Convert.ToUInt16(9 + model.dataDomain.Length); //报文长度
@ -598,8 +597,8 @@ namespace BatCharging.Service
lstContent.AddRange(BitConverter.GetBytes(CMD.value01)); lstContent.AddRange(BitConverter.GetBytes(CMD.value01));
lstContent.AddRange(BitConverter.GetBytes(CMD.value02)); lstContent.AddRange(BitConverter.GetBytes(CMD.value02));
lstContent.AddRange(BitConverter.GetBytes(CMD.value03)); lstContent.Add(CMD.value03);
lstContent.AddRange(BitConverter.GetBytes(CMD.value04)); lstContent.Add(Convert.ToByte(CMD.value04));
results = lstContent.ToArray(); results = lstContent.ToArray();
} }

@ -226,7 +226,7 @@ namespace Monitor.ChargeTest
{ {
byte type = 1;//类型 0-查询/1-设置 byte type = 1;//类型 0-查询/1-设置
uint startAddress = 2;//设置/查询参数起始地址 uint startAddress = 2;//设置/查询参数起始地址
byte num = 3;//设置/查询个数 byte num = 2;//设置/查询个数
byte[] setData = new byte[8];//设置数据 byte[] setData = new byte[8];//设置数据
setData[0] = 0; setData[0] = 0;
setData[1] = 1; setData[1] = 1;
@ -265,10 +265,18 @@ namespace Monitor.ChargeTest
/// <param name="e"></param> /// <param name="e"></param>
private void button16_Click(object sender, EventArgs e) private void button16_Click(object sender, EventArgs e)
{ {
byte type = 0; byte type = 1;//充电枪口
uint startAddress = 9; uint startAddress = 1;//启始命令地址
byte num = 10; byte num = 2;//命令个数
byte[] setData = null; byte[] setData = new byte[8];//命令参数
setData[0] = 0;
setData[1] = 1;
setData[2] = 2;
setData[3] = 3;
setData[4] = 4;
setData[5] = 5;
setData[6] = 6;
setData[7] = 7;
CmnChargerParam._CHR00TCPCLIENT.Send5(type, startAddress, num, setData); CmnChargerParam._CHR00TCPCLIENT.Send5(type, startAddress, num, setData);
} }
#endregion #endregion
@ -645,7 +653,7 @@ namespace Monitor.ChargeTest
CMD.value07 = 5; CMD.value07 = 5;
CMD.value08 = 6; CMD.value08 = 6;
CMD.value09 = 7; CMD.value09 = 7;
CMD.value10 = 8; CMD.value10 = "123456789";
CMD.value11 = 9; CMD.value11 = 9;
CMD.value12 = 10; CMD.value12 = 10;
CMD.value13 = "12345678"; CMD.value13 = "12345678";

Loading…
Cancel
Save