|
@@ -88,7 +88,7 @@ public class EnvInputServerHandler extends ChannelInboundHandlerAdapter {
|
|
|
public static void main(String[] args) {
|
|
|
|
|
|
String str =
|
|
|
- "55 86 45 00 49 00 01 4F 00 78 45 27 54 27 34 27 21 27 ef 26 fa 26 2c 27 11 27 27 27 23 27 1b 27 1a 27 88 27 67 27 0e 27 0a 27 bf 27 76 27 87 27 1e 27 1c 27 89 27 0a 28 4c 28 2b 28 48 28 96 28 44 28 47 28 81 28 11 28 17 28 6f 28 6a 28 c2 26 d7 23 e6 2f 70 43 35 26 e8 37 c1 39 9d 27 90 27 ab 27 99 27 5b 28 6c 28 c6 29 bb 29 e8 29 84 29 28 2a 99 2a f7 2a 3b 2a d0 29 cc 29 e1 29 d7 2a 2c 27 18 01 1C 12 0A 07 AA ";
|
|
|
+ "55 86 57 00 49 00 01 4F 00 78 C5 09 C4 09 C4 09 C5 09 C4 09 C6 09 C5 09 C5 09 C6 09 C4 09 C5 09 C4 09 C5 09 C5 09 C5 09 C4 09 C3 09 C5 09 C4 09 C4 09 C4 09 C3 09 C5 09 C5 09 C4 09 C4 09 C4 09 C5 09 C4 09 C4 09 C5 09 C5 09 C5 09 C5 09 C4 09 C4 09 C4 09 C4 09 C4 09 C4 09 C4 09 C5 09 C4 09 C3 09 C3 09 C4 09 C5 09 C5 09 C3 09 C5 09 C5 09 C4 09 C5 09 C1 09 C4 09 C4 09 C3 09 C3 09 C3 09 C5 09 18 01 1D 09 19 08 AA ";
|
|
|
String[] s = str.split(" ");
|
|
|
String dateTimeString = "2023-12-07 23:22:54";
|
|
|
// 创建 DateTimeFormatter 对象,指定日期时间格式
|
|
@@ -110,7 +110,7 @@ public class EnvInputServerHandler extends ChannelInboundHandlerAdapter {
|
|
|
String str1 = s[i * 2 + 11] + s[i * 2 + 10];
|
|
|
BigDecimal weight = new BigDecimal(Integer.parseInt(str1, 16));
|
|
|
System.out.println("" + sdf.format(thenTime)+" 重量:" +weight );
|
|
|
- Integer multiply = weight.multiply(BigDecimal.valueOf(0.9945)).intValue();
|
|
|
+ Integer multiply = weight.multiply(BigDecimal.valueOf(1.0274)).intValue();
|
|
|
System.out.println("计算后重量:"+ multiply);
|
|
|
// 将 BigInteger 转换为 16 进制 String
|
|
|
String s1 = Integer.toHexString(multiply);
|
|
@@ -296,10 +296,11 @@ public class EnvInputServerHandler extends ChannelInboundHandlerAdapter {
|
|
|
//保存原始数据
|
|
|
RawData rawData = new RawData();
|
|
|
rawData.setDeviceCode(decId+"");
|
|
|
- rawData.setOriginData(str);
|
|
|
- String replace = replace(str, ratio);
|
|
|
- rawData.setData(replace);
|
|
|
- s = replace.split(" ");
|
|
|
+// rawData.setOriginData(str);
|
|
|
+// String replace = replace(str, ratio);
|
|
|
+ rawData.setData(str);
|
|
|
+// rawData.setData(replace);
|
|
|
+// s = replace.split(" ");
|
|
|
rawData.setCreateTime(new Date(l));
|
|
|
rawData.setLastWeight(new BigDecimal(Integer.parseInt(s[sLength -8]+s[sLength-9], 16)));
|
|
|
rawData.setBattery(batStr);
|