From 5447abaae60e4d8d98c52c952a10d9c4ad6c06d6 Mon Sep 17 00:00:00 2001
From: Administrator <zhubaomin>
Date: 星期四, 27 六月 2024 09:19:20 +0800
Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV

---
 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CommonV1_0_1.java |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 55 insertions(+), 2 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 30df01f..c2964d5 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
@@ -82,7 +82,7 @@
 	public String parseRtuAddr(byte[] bs)throws Exception{
 		String rtuAddrBCD = "" + ByteUtil.BCD2Long_BE(bs, ProtocolConstantV206V1_0_0.rtuAddr1Index_start, ProtocolConstantV206V1_0_0.rtuAddr1Index_end) ;
 		String rtuAddrStr = "" + ByteUtilUnsigned.bytes2Short_LE(bs, ProtocolConstantV206V1_0_0.rtuAddr2Index_start) ;
-		while(rtuAddrStr.length() < 5){
+		while(rtuAddrStr.length() <= 5){
 			rtuAddrStr = "0" + rtuAddrStr ;
 		}
 		return rtuAddrBCD + rtuAddrStr ;
@@ -146,9 +146,25 @@
 		//DIR = 0
 		return b ;
 	}
+	/**
+	 * 寰楀埌IC鍗$被鍨嬪悕绉� 锛� 鍗$被鍨�(1:鐢ㄦ埛鍗★紱2锛氱鐞嗗憳鍗★紱3锛氳皟璇曞崱锛�4锛氬紑鍏抽榾鍗★紱5锛氭竻绌哄崱)锛�
+	 * @param type 瀛楄妭
+	 * @return 鍚嶇О
+	 */
+	public static String icCardType(byte type){
+		return switch (type) {
+			case 1 -> "鐢ㄦ埛鍗�";
+			case 2 -> "绠$悊鍛樺崱";
+			case 3 -> "璋冭瘯鍗�";
+			case 4 -> "寮�鍏抽榾鍗�";
+			case 5 -> "娓呯┖鍗�";
+			default -> "鏈煡";
+		};
+	}
 
 	/**
 	 * 寰楀埌鍏冲紑闃�绫诲瀷鍚嶇О
+	 * 寮�鍏抽榾绫诲瀷(1:鍒峰崱寮�闃�锛�2:鍒峰崱鍏抽榾锛�3:涓績绔欏紑闃�锛�4:涓績绔欏叧闃�锛�5:娆犺垂鍏抽榾锛�6:娴侀噺璁℃晠闅滃叧闃�锛�7:绱ф�ュ叧闂紱8:鐢ㄦ埛杩滅▼寮�闃�锛�9:鐢ㄦ埛杩滅▼鍏抽榾锛�10:寮�鍏抽榾鍗″叧闃�锛�11:寮�鍏抽榾鍗″埛鍗″崱寮�闃�锛�)
 	 * @param type 瀛楄妭
 	 * @return 鍚嶇О
 	 */
@@ -163,10 +179,47 @@
 			case 7 -> "绱ф�ュ叧闃�";
 			case 8 -> "鐢ㄦ埛杩滅▼寮�闃�";
 			case 9 -> "鐢ㄦ埛杩滅▼鍏抽榾";
-			case 16 -> "绠¢亾鏃犳按鑷姩鍏抽榾";
+			case 10 -> "寮�鍏抽榾鍗″叧闃�";
+			case 11 -> "寮�鍏抽榾鍗″紑闃�";
 			default -> "鏈煡";
 		};
 	}
+	public static Boolean isCloseValveType(byte type){
+		return switch (type) {
+			case 1 -> false ;
+			case 2 -> true ;
+			case 3 -> false ;
+			case 4 -> true ;
+			case 5 -> true ;
+			case 6 -> true ;
+			case 7 -> true ;
+			case 8 -> false ;
+			case 9 -> true ;
+			case 10 -> true ;
+			case 11 -> false ;
+			default -> null ;
+		};
+	}
+
+	/**
+	 * 澶勭悊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