From fb9b202e2d421d7ee4e6879ae1232e481a3c6fa1 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期四, 25 七月 2024 16:53:22 +0800 Subject: [PATCH] 1、完善协议解析代码; 2、测试系统增加功能码为99、A0命令测试。 --- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CommonV1_0_1.java | 40 ++++++++++++++++++++-------------------- 1 files changed, 20 insertions(+), 20 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CommonV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CommonV1_0_1.java index 0817c1b..929f503 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CommonV1_0_1.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CommonV1_0_1.java @@ -99,7 +99,7 @@ public String parseRtuAddr(byte[] bs, int index)throws Exception{ String rtuAddrBCD = "" + ByteUtil.BCD2Long_BE(bs, index, index + 2) ;//鍦板潃鏄ぇ绔ā寮� String rtuAddrStr = "" + ByteUtilUnsigned.bytes2Short_LE(bs, index + 3) ; - while(rtuAddrStr.length() < 5){ + while(rtuAddrStr.length() <= 5){ rtuAddrStr = "0" + rtuAddrStr ; } return rtuAddrBCD + rtuAddrStr ; @@ -202,25 +202,25 @@ }; } - /** - * 澶勭悊IC鍗$紪鍙凤紝闈虫�诲埗瀹氱殑鍗忚瑕佹眰10浣岻C鍗$紪鍙� - * @param icCardNo - * @return - */ - public static String[] dealIcCardNo(String icCardNo){ - if(icCardNo.length() > 10){ - String tail = icCardNo.substring(icCardNo.length() - 10) ; - String head = icCardNo.substring(0, icCardNo.length() - 10) ; - return new String[]{head , tail} ; - }else if(icCardNo.length() < 10){ - while(icCardNo.length() != 10){ - icCardNo = "0" + icCardNo ; - } - return new String[]{null , icCardNo} ; - }else{ - return new String[]{null , icCardNo} ; - } - } +// /** +// * 澶勭悊IC鍗$紪鍙凤紝闈虫�诲埗瀹氱殑鍗忚瑕佹眰10浣岻C鍗$紪鍙� +// * @param icCardNo +// * @return +// */ +// public static String[] dealIcCardNo(String icCardNo){ +// if(icCardNo.length() > 10){ +// String tail = icCardNo.substring(icCardNo.length() - 10) ; +// String head = icCardNo.substring(0, icCardNo.length() - 10) ; +// return new String[]{head , tail} ; +// }else if(icCardNo.length() < 10){ +// while(icCardNo.length() != 10){ +// icCardNo = "0" + icCardNo ; +// } +// return new String[]{null , icCardNo} ; +// }else{ +// return new String[]{null , icCardNo} ; +// } +// } /* * 鍒嗘瀽鐗堟湰鍙� -- Gitblit v1.8.0