From bc1b3ee367f7e9aef88fc59647a9631f39eca6b5 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期三, 23 四月 2025 09:19:55 +0800
Subject: [PATCH] 1.数采 2.国产网分仪

---
 cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceServiceImpl.java  |    5 
 cnas-device/src/main/java/com/ruoyi/device/pojo/NA7672LRequestBean.java         |   38 +
 cnas-device/src/main/java/com/ruoyi/device/utils/NA7672LTCPClientUtils.java     | 1053 +++++++++++++++++++++++++++++++++++
 cnas-device/src/main/java/com/ruoyi/device/controller/NA7672LTCPController.java |  109 +++
 cnas-device/src/main/java/com/ruoyi/device/service/DeviceService.java           |    2 
 cnas-device/src/main/java/com/ruoyi/device/controller/DeviceController.java     |    6 
 cnas-device/src/main/java/com/ruoyi/device/pojo/NA7672LValueVO.java             |   35 +
 cnas-device/src/main/java/com/ruoyi/device/utils/DataAcquisition.java           |  470 ++++++++++++++-
 cnas-device/src/main/java/com/ruoyi/device/pojo/NA7672LQueryBean.java           |   47 +
 9 files changed, 1,731 insertions(+), 34 deletions(-)

diff --git a/cnas-device/src/main/java/com/ruoyi/device/controller/DeviceController.java b/cnas-device/src/main/java/com/ruoyi/device/controller/DeviceController.java
index 1a451db..f757174 100644
--- a/cnas-device/src/main/java/com/ruoyi/device/controller/DeviceController.java
+++ b/cnas-device/src/main/java/com/ruoyi/device/controller/DeviceController.java
@@ -155,6 +155,12 @@
         return deviceService.dataAcquisition(request, dto);
     }
 
+    @ApiOperation("/鏁伴噰-鏁版嵁閲囬泦")
+    @PostMapping("/dataCollection1")
+    public Result<?> dataCollection1(HttpServletRequest request, @RequestBody DeviceCollectionDto dto) {
+        return deviceService.dataCollection1(request, dto);
+    }
+
     @ApiOperation(value = "缁存姢鏁伴噰閰嶇疆")
     @PostMapping("/saveDataAcquisitionConfiguration")
     public Result<?> saveDataAcquisitionConfiguration(@RequestBody DataConfigDto dataConfigList) {
diff --git a/cnas-device/src/main/java/com/ruoyi/device/controller/NA7672LTCPController.java b/cnas-device/src/main/java/com/ruoyi/device/controller/NA7672LTCPController.java
new file mode 100644
index 0000000..f2a35df
--- /dev/null
+++ b/cnas-device/src/main/java/com/ruoyi/device/controller/NA7672LTCPController.java
@@ -0,0 +1,109 @@
+package com.ruoyi.device.controller;
+
+
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.device.pojo.NA7672LRequestBean;
+import com.ruoyi.device.pojo.NA7672LValueVO;
+import com.ruoyi.device.utils.NA7672LTCPClientUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.web.bind.annotation.*;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * demo 琛�
+ *
+ * @author pig
+ * @date 2023-07-31 14:07:58
+ */
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("tcpClient")
+@Api(value = "tcp", tags = "璇诲彇缃戝垎浠暟鎹�")
+public class NA7672LTCPController {
+	
+	@ApiOperation(value = "鑾峰彇缃戝垎浠墍鏈夊��", notes = "鑾峰彇缃戝垎浠墍鏈夊��")
+	@PostMapping("/getTCPValuesNew")
+	public Result<?> getTCPValuesNew(@RequestBody NA7672LRequestBean requestBean) throws IOException, InterruptedException {
+		List<NA7672LValueVO> valueList = new ArrayList<>();
+		//璁剧疆榛樿閰嶇疆锛屽彲鍦▂ml閲岃繘琛岄厤缃�
+		String serverIp = requestBean.getServerIp();
+		int serverPort = requestBean.getServerPort();
+		NA7672LTCPClientUtils tcpClient = new NA7672LTCPClientUtils(serverIp, serverPort);
+		//璁剧疆鍏ㄩ儴閫氶亾锛堢晫闈ave/recall-璋冨紡2锛岄渶瑕佹湰鍦版湁state02鏂囦欢锛�
+		tcpClient.initMemory(requestBean.getMemoryDir());
+		String valueUnit = this.getMemoryDirName(requestBean.getMemoryDir());
+		//寤惰繜涓ょ鍐嶅彇鍊�
+		try {
+			Thread.sleep(2000);
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+		}
+		List<NA7672LValueVO> rs = new ArrayList<>();
+		if (valueUnit.equals("state01")) {
+			rs = tcpClient.getState01AllValue(requestBean);
+		} else if (valueUnit.equals("state02")) {
+			rs = tcpClient.getState02AllValue(requestBean);
+		} else if (valueUnit.equals("state03")) {
+			rs = tcpClient.getState03AllValue(requestBean);
+		} else if (valueUnit.equals("state04")) {
+			rs = tcpClient.getState04AllValue(requestBean);
+		} else if (valueUnit.equals("state05")) {
+			rs = tcpClient.getState05AllValue(requestBean);
+		} else if (valueUnit.equals("state06")) {
+			rs = tcpClient.getState06AllValue(requestBean);
+		} else if (valueUnit.equals("state07")) {
+			rs = tcpClient.getState07AllValue(requestBean);
+		} else if (valueUnit.equals("state08")) {
+			rs = tcpClient.getState08AllValue(requestBean);
+		} else if (valueUnit.equals("autorec")) {
+			rs = tcpClient.getStateAutoRecAllValue(requestBean);
+		} else {
+
+		}
+		return Result.success(rs);
+	}
+
+	/*渚濈収绾﹀畾鎶婂墠绔紶閫掔殑鏌ヨ杞寲涓哄悗绔帴鍙f煡璇�*/
+	private String decayLabelOrg2Label(String labelOrg) {
+		String label = "decay_0m";
+		Pattern pattern = Pattern.compile("(\\d*)M");
+		Matcher matcher = pattern.matcher(labelOrg);
+		String valueUnit = null;
+		if (matcher.find()) {
+			valueUnit = matcher.group();
+		}
+		if (valueUnit != null) {
+			label = "decay_" + valueUnit.substring(0, valueUnit.length() - 1) + "m";
+		}
+		return label;
+	}
+	
+	/*浣跨敤memory_dir鐨勮矾寰勮В鏋愬嚭绫诲埆*/
+	private String getMemoryDirName(String pathName) {
+		String[] splitString = pathName.split("/");
+		String filename_1 = splitString[splitString.length - 1];
+		String[] filename_2 = filename_1.split("\\.");
+		String filename_3 = filename_2[0];
+		return filename_3;
+
+		/*Pattern pattern = Pattern.compile("state(\\d*)");
+		Matcher matcher = pattern.matcher(pathName);
+		String valueUnit = null;
+		if (matcher.find()) {
+			valueUnit = matcher.group();
+		}
+		return valueUnit;*/
+	}
+
+
+}
\ No newline at end of file
diff --git a/cnas-device/src/main/java/com/ruoyi/device/pojo/NA7672LQueryBean.java b/cnas-device/src/main/java/com/ruoyi/device/pojo/NA7672LQueryBean.java
new file mode 100644
index 0000000..f4314c5
--- /dev/null
+++ b/cnas-device/src/main/java/com/ruoyi/device/pojo/NA7672LQueryBean.java
@@ -0,0 +1,47 @@
+package com.ruoyi.device.pojo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+@Data
+@ApiModel("NA7672L璁惧鐨勮繙绋嬭幏鍙栨煡璇㈡潯浠�")
+public class NA7672LQueryBean {
+
+	@ApiModelProperty("鑾峰彇绫诲瀷锛�1涓鸿“鍑忥紱2涓洪樆鎶楋紱3涓洪┗娉㈡瘮锛�4涓虹浉浣嶅樊")
+	private int fetchType;
+
+	@ApiModelProperty("閫氶亾鍊�")
+	private int channel;
+
+	@ApiModelProperty("杞ㄨ抗绾�")
+	private int trace;
+
+	@ApiModelProperty("鏌ヨ瀛楃锛屼緥濡俤ecay_400m")
+	private String queryLabel;
+
+	@ApiModelProperty("杈撳叆鐨勬俯搴�")
+	private double temperture;
+
+	@ApiModelProperty("杈撳叆鐨勯暱搴�")
+	private double length;
+
+	@ApiModelProperty("杈撳叆鐨勫懆鏈�")
+	private double cycle;
+
+	@ApiModelProperty("杈撳叆鐨勭浉浣嶅樊")
+	private double phaValue;
+
+	@ApiModelProperty("杈撳叆鐨勭數瀹瑰��")
+	private double capacity;
+
+
+	@ApiModelProperty("棰勭暀瀛楁1")
+	private int backup1;
+
+	@ApiModelProperty("棰勭暀瀛楁2")
+	private int backup2;
+
+
+}
diff --git a/cnas-device/src/main/java/com/ruoyi/device/pojo/NA7672LRequestBean.java b/cnas-device/src/main/java/com/ruoyi/device/pojo/NA7672LRequestBean.java
new file mode 100644
index 0000000..2349f22
--- /dev/null
+++ b/cnas-device/src/main/java/com/ruoyi/device/pojo/NA7672LRequestBean.java
@@ -0,0 +1,38 @@
+package com.ruoyi.device.pojo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+
+@Data
+@ApiModel("NA7672L璁惧鐨勫垵濮嬪寲閰嶇疆")
+public class NA7672LRequestBean {
+
+	@ApiModelProperty("鍦板潃")
+	private String serverIp;
+
+	@ApiModelProperty("绔彛")
+	private int serverPort;
+
+	@ApiModelProperty("閰嶇疆鍦板潃")
+	private String memoryDir;
+
+	@ApiModelProperty("鏌ヨ鏉′欢")
+	List<NA7672LQueryBean> queryBeans;
+
+	@ApiModelProperty("閰嶇疆鍦板潃")
+	private Double temperture;
+
+	@ApiModelProperty("閰嶇疆鍦板潃")
+	private Double length;
+
+	@ApiModelProperty("閰嶇疆鍦板潃")
+	private Double cycle;
+
+	@ApiModelProperty("閰嶇疆鍦板潃")
+	private Double capacity;
+
+}
diff --git a/cnas-device/src/main/java/com/ruoyi/device/pojo/NA7672LValueVO.java b/cnas-device/src/main/java/com/ruoyi/device/pojo/NA7672LValueVO.java
new file mode 100644
index 0000000..f14a4d3
--- /dev/null
+++ b/cnas-device/src/main/java/com/ruoyi/device/pojo/NA7672LValueVO.java
@@ -0,0 +1,35 @@
+package com.ruoyi.device.pojo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class NA7672LValueVO {
+	/*绫诲埆锛岃幏鍙栫被鍨嬶細1涓鸿“鍑忥紱2涓洪樆鎶楋紱3涓洪┗娉㈡瘮锛�4涓虹浉浣嶅樊*/
+	private int fetchType;
+	/*閫氶亾*/
+	Integer channel;
+	/*杞ㄨ抗绾�*/
+	Integer trace;
+	/*markId*/
+	Integer mark;
+	/*鏍囩*/
+	String label;
+	/*鍘熷鏍囩*/
+	String labelOrg;
+	/*鏁存暟鍊�*/
+	Integer intVal;
+	/*娴偣鍊�*/
+	BigDecimal decimalVal;
+	/*娴嬮噺鍊�*/
+	BigDecimal measureValue;
+	/*鍏朵粬鍊�*/
+	BigDecimal calculateValue;
+	/*鍗曚綅*/
+	String unit;
+	/*鏄惁鍚堟硶,1涓哄悎娉曪紝0涓轰笉鍚堟硶*/
+	int ifLegal = 1;
+
+
+}
diff --git a/cnas-device/src/main/java/com/ruoyi/device/service/DeviceService.java b/cnas-device/src/main/java/com/ruoyi/device/service/DeviceService.java
index 00e6914..2d79128 100644
--- a/cnas-device/src/main/java/com/ruoyi/device/service/DeviceService.java
+++ b/cnas-device/src/main/java/com/ruoyi/device/service/DeviceService.java
@@ -70,4 +70,6 @@
      * @return
      */
     Result<?> determineWhetherToCollectData(String managementNumber, HttpServletRequest request);
+
+    Result<?> dataCollection1(HttpServletRequest request, DeviceCollectionDto dto);
 }
diff --git a/cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceServiceImpl.java b/cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceServiceImpl.java
index 31c04ba..8ca0333 100644
--- a/cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceServiceImpl.java
+++ b/cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceServiceImpl.java
@@ -554,6 +554,11 @@
         }
     }
 
+    @Override
+    public Result<?> dataCollection1(HttpServletRequest request, DeviceCollectionDto dto) {
+        return null;
+    }
+
     private Map<String, Integer> queryUserMap(List<Device> batch) {
         Set<String> managerNames = batch.stream()
                 .map(Device::getEquipmentManagerName)
diff --git a/cnas-device/src/main/java/com/ruoyi/device/utils/DataAcquisition.java b/cnas-device/src/main/java/com/ruoyi/device/utils/DataAcquisition.java
index 44a20e5..2fda700 100644
--- a/cnas-device/src/main/java/com/ruoyi/device/utils/DataAcquisition.java
+++ b/cnas-device/src/main/java/com/ruoyi/device/utils/DataAcquisition.java
@@ -15,6 +15,7 @@
 import javax.script.ScriptEngineManager;
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
+import java.text.DecimalFormat;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
@@ -139,6 +140,9 @@
                 case ".pdf":
                     map = readPdfString(data, userMap, device);
                     break;
+                case ".et":
+                    map = readEtString(data, userMap, device);
+                    break;
                 default:
                     map = null;
                     break;
@@ -152,40 +156,262 @@
         }
     }
 
-    private static Map<String, Object> readPdfString(String data, Map<String, List<DataConfig>> dataConfig, Device device) {
+    private static Map<String, Object> readEtString(String data, Map<String, List<DataConfig>> dataConfig, Device device) {
         Map<String, Object> map = new HashMap<>();
+        // 瀹氫箟 RoHS 鎸囨爣鍒楄〃
+        List<String> rohsIndicators = Arrays.asList("RoHS鎸囨爣,闀夛紙Cd锛�", "RoHS鎸囨爣,鎬绘捍鑱旇嫰锛圔r锛�", "RoHS鎸囨爣,鎬婚摤锛圕r锛�", "RoHS鎸囨爣,姹烇紙Hg锛�", "RoHS鎸囨爣,閾咃紙Pb锛�");
         dataConfig.forEach((k, v) -> {
-            List<Object> list = new ArrayList<>();
-            for (int config = 0; config < v.size(); config++) {
-                String referx = getRefer(v.get(config).getReferx());
-                String result = null;
-                // 閫氳繃\n灏嗗瓧绗︿覆鍒嗗壊涓鸿
-                String[] aColumnY = data.split("\n");
-                List<String> list1 = new ArrayList<>();
-                // 璇ュ惊鐜緱鍑虹敤鎴烽厤缃殑y杞�
-                for (int i = 0; i < aColumnY.length; i++) {
-                    String addDataWithSpaces = referx.replaceAll("", " ");
-                    int x = getXOrY(v.get(config).getX(), k, "X");
-                    if (aColumnY[i].contains(addDataWithSpaces)) {
-                        Matcher matcher = SPATTERN.matcher(aColumnY[i]);
-                        while (matcher.find()) {
-                            String group = matcher.group();
-                            list1.add(group);
-                        }
-                    }
-                    if (ObjectUtils.isNotEmpty(list1)) {
-                        result = list1.get(x);
-                    }
+            List<Object> list;
+            boolean containsRoHS = false;
+            for (DataConfig item : v) {
+                if (rohsIndicators.contains(item.getInsProductItem())) {
+                    containsRoHS = true;
+                    break;
                 }
-                if (ObjectUtils.isNotEmpty(result)) {
-                    list.add(result);
-                }
+            }
+            if (containsRoHS) {
+                list = analyzeEt1Data(data, v, splitIdentifier);
+            } else {
+                list = analyzeEtData(data, v, splitIdentifier);
             }
             // 杩涜鍏紡璁$畻
             Object resultValue = calculationFormula(list, v.get(0), k, device);
             map.put(k, resultValue);
         });
         return map;
+    }
+
+    /**
+     * 鑽у厜鍏夎氨浠� .et鏂囦欢
+     *
+     * @param data
+     * @param v
+     * @param splitIdentifier
+     * @return
+     */
+    private static List<Object> analyzeEt1Data(String data, List<DataConfig> v, String splitIdentifier) {
+        List<Object> finalResult = new ArrayList<>();
+        List<String> matchingLines = new ArrayList<>();
+
+        // 閬嶅巻 DataConfig 鍒楄〃
+        for (DataConfig config : v) {
+            String referx = getRefer(config.getReferx());
+            if (ObjectUtils.isEmpty(referx)) {
+                continue;
+            }
+            // 浣跨敤姝e垯琛ㄨ揪寮忔瀯寤哄畬鏁村尮閰嶇殑妯″紡
+            String regex = "\\b" + Pattern.quote(referx) + "\\b";
+            Pattern pattern = Pattern.compile(regex);
+
+            String[] lines = data.replaceAll(" ", "").split("\n");
+            // 绛涢�夊嚭鍖呭惈 referx 鐨勮
+            for (String line : lines) {
+                if (pattern.matcher(line).find()) {
+                    matchingLines.add(line);
+                }
+            }
+        }
+
+        // 閬嶅巻鍖归厤鐨勮锛屾彁鍙� splitIdentifier 绗竷涓拰绗叓涓垎闅旂涓棿鐨勫��
+        for (String line : matchingLines) {
+            int startIndex = -1;
+            int endIndex = -1;
+            int count = 0;
+            int index = 0;
+            while ((index = line.indexOf(splitIdentifier, index)) != -1) {
+                count++;
+                if (count == 7) {
+                    startIndex = index + splitIdentifier.length();
+                } else if (count == 8) {
+                    endIndex = index;
+                    break;
+                }
+                index++;
+            }
+            if (startIndex != -1 && endIndex != -1) {
+                finalResult.add(line.substring(startIndex, endIndex));
+            }
+        }
+
+        // 纭繚杩斿洖鍊间负鏁扮粍鏍煎紡
+        if (finalResult.size() == 1) {
+            List<Object> singleResultAsArray = new ArrayList<>();
+            singleResultAsArray.add(finalResult.get(0));
+            return singleResultAsArray;
+        }
+        return finalResult;
+    }
+
+    /**
+     * 鎷夊姏鏈�.et鏂囦欢
+     *
+     * @param data
+     * @param v
+     * @param splitIdentifier
+     * @return
+     */
+    public static List<Object> analyzeEtData(String data, List<DataConfig> v, String splitIdentifier) {
+        List<Object> finalResult = new ArrayList<>();
+
+        for (DataConfig config : v) {
+            String referx = getRefer(config.getReferx());
+            if (ObjectUtils.isEmpty(referx)) {
+                continue;
+            }
+
+            String[] lines = data.replaceAll(" ", "").split("\n");
+            boolean foundReferx = false;
+            List<String> validLines = new ArrayList<>();
+            int referxColumnIndex = -1; // 鐢ㄤ簬瀛樺偍referx鎵�鍦ㄥ垪绱㈠紩
+
+            // 鍏堟壘鍑簉eferx鎵�鍦ㄥ垪绱㈠紩
+            for (String line : lines) {
+                String[] parts = line.split(splitIdentifier);
+                for (int i = 0; i < parts.length; i++) {
+                    if (parts[i].contains(referx)) {
+                        referxColumnIndex = i;
+                        break;
+                    }
+                }
+                if (referxColumnIndex != -1) {
+                    break;
+                }
+            }
+            // 鑻ユ湭鎵惧埌鍖归厤鐨剅eferx锛屾姏鍑哄紓甯�
+            if (referxColumnIndex == -1) {
+                throw new IllegalArgumentException("璇疯緭鍏ユ纭殑x鍊硷紝鏂囦欢涓湭鎵惧埌涓� " + referx + " 鍖归厤鐨勫�笺��");
+            }
+            for (int i = 0; i < lines.length; i++) {
+                String line = lines[i];
+                String[] parts = line.split(splitIdentifier, 2);
+
+                if (!foundReferx) {
+                    if (containsReferx(parts, referx)) {
+                        foundReferx = true;
+                    }
+                    continue;
+                }
+
+                if (i > 0 && foundReferx) {
+                    if (parts.length > 0 && isNumeric(parts[0])) {
+                        validLines.add(line);
+                    }
+                }
+            }
+            for (String line : validLines) {
+                String[] parts = line.split(splitIdentifier);
+                if (referxColumnIndex < parts.length) {
+                    String value = parts[referxColumnIndex].trim();
+                    if (value.isEmpty()) {
+                        value = "";
+                    }
+                    finalResult.add(value);
+                } else {
+                    finalResult.add("");
+                }
+            }
+        }
+        return finalResult;
+    }
+
+    private static boolean containsReferx(String[] parts, String referx) {
+        for (String part : parts) {
+            if (part.contains(referx)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private static boolean isNumeric(String str) {
+        try {
+            Double.parseDouble(str);
+            return true;
+        } catch (NumberFormatException e) {
+            return false;
+        }
+    }
+
+    /**
+     * 鑹茶氨pdf鏂囦欢闇�瑕佸畾浣峹,y
+     *
+     * @param data
+     * @param dataConfig
+     * @param device
+     * @return
+     */
+    private static Map<String, Object> readPdfString(String data, Map<String, List<DataConfig>> dataConfig, Device device) {
+        Map<String, Object> map = new HashMap<>();
+        dataConfig.forEach((k, v) -> {
+            List<Object> list = new ArrayList<>();
+            for (int config = 0; config < v.size(); config++) {
+                String referX = getRefer(v.get(config).getReferx());
+                String referY = getRefer(v.get(config).getRefery());
+                String[] aColumnY = data.split("\n");
+                for (String line : aColumnY) {
+                    if (line.contains(referX) || line.contains(referY)) {
+                        list.add(line);
+                    }
+                }
+
+                int referYColumnIndex = -1;
+                for (Object item : list) {
+                    // 浣跨敤姝e垯琛ㄨ揪寮� \\s+ 鍒嗗壊瀛楃涓�
+                    String[] columns = ((String) item).split("\\s+");
+                    for (int i = 0; i < columns.length; i++) {
+                        if (columns[i].equals(referY)) {
+                            referYColumnIndex = i;
+                            break;
+                        }
+                    }
+                    if (referYColumnIndex != -1) {
+                        break;
+                    }
+                }
+
+                List<Object> targetColumnValues = new ArrayList<>();
+                if (referYColumnIndex != -1) {
+                    for (Object item : list) {
+                        String line = (String) item;
+                        // 杩囨护鎺夊寘鍚� referY 鐨勮
+                        if (!line.contains(referY)) {
+                            String[] columns = line.split("\\s+");
+                            if (columns.length > referYColumnIndex) {
+                                targetColumnValues.add(columns[referYColumnIndex]);
+                            }
+                        }
+                    }
+                }
+                Object resultValue = calculationFormula(targetColumnValues, v.get(0), k, device);
+                map.put(k, resultValue);
+            }
+        });
+        return map;
+    }
+
+    public static List<Object> extractColumnValues(List<Object> list, String columnName) {
+        List<Object> columnValues = new ArrayList<>();
+        if (list.isEmpty()) {
+            return columnValues;
+        }
+        String[] headers = ((String) list.get(0)).split(",");
+        int columnIndex = -1;
+        for (int i = 0; i < headers.length; i++) {
+            if (headers[i].equals(columnName)) {
+                columnIndex = i;
+                break;
+            }
+        }
+        if (columnIndex == -1) {
+            return columnValues;
+        }
+        for (int i = 1; i < list.size(); i++) {
+            String[] columns = ((String) list.get(i)).split(",");
+            if (columnIndex < columns.length) {
+                columnValues.add(columns[columnIndex]);
+            }
+        }
+        return columnValues;
     }
 
     public static Map<String, Object> createFrequency(String entrustCode, String sampleCode, Map<String, Object> map) {
@@ -465,7 +691,7 @@
         ArrayList<Object> listResult = new ArrayList<>();
         Map<String, Object> hashMap = new HashMap<>();
         // 濡傛灉涓嶄负绌猴紝杩涜鍏紡璁$畻
-        if (ObjectUtils.isNotEmpty(dataConfig.getFormula())) {
+        if (ObjectUtils.isNotEmpty(dataConfig.getFormula()) && !"(null)".equals(dataConfig.getFormula())) {
             // 鍚﹀垯锛氭病鏈夊叕寮忎唬琛ㄤ笉闇�瑕佽绠楋紝鐩存帴鎻愬彇List閲岄潰鐨勬暟鎹�
             if (ObjectUtils.isEmpty(device.getEntrustCode()) && ObjectUtils.isEmpty(device.getSampleCode())) {
                 String s = calculationFormulaList(list, dataConfig.getFormula());
@@ -568,18 +794,194 @@
         Map<String, Object> map = new HashMap<>();
         dataConfig.forEach((k, v) -> {
             List<Object> list = new ArrayList<>();
-            // 濮旀墭缂栧彿涓庢牱鍝佺紪鍙蜂笉瀛樺湪锛屽畾锛�1銆乊瀹氳寖鍥达紝X瀹氭í鍧愭爣锛�2銆佸彧瀛樺湪Y锛�3銆佸彧瀛樺湪X
-            if (ObjectUtils.isEmpty(device.getEntrustCode()) && ObjectUtils.isEmpty(device.getSampleCode())) {
-                list = analyzeXlsData(data, v, k, splitIdentifier);
-                // 濮旀墭缂栧彿涓庢牱鍝佺紪鍙峰瓨鍦�
-            } else if (ObjectUtils.isNotEmpty(device.getEntrustCode()) && ObjectUtils.isNotEmpty(device.getSampleCode())) {
-                list = analyzeDataEntrustCodAndSampleCode(data, v, k, splitIdentifier, device, entrustCode, sampleCode);
-            }
+//            // 濮旀墭缂栧彿涓庢牱鍝佺紪鍙蜂笉瀛樺湪锛屽畾锛�1銆乊瀹氳寖鍥达紝X瀹氭í鍧愭爣锛�2銆佸彧瀛樺湪Y锛�3銆佸彧瀛樺湪X
+//            if (ObjectUtils.isEmpty(device.getEntrustCode()) && ObjectUtils.isEmpty(device.getSampleCode())) {
+//                list = analyzeXlsData(data, v, k, splitIdentifier);
+//                // 濮旀墭缂栧彿涓庢牱鍝佺紪鍙峰瓨鍦�
+//            } else if (ObjectUtils.isNotEmpty(device.getEntrustCode()) && ObjectUtils.isNotEmpty(device.getSampleCode())) {
+//                list = analyzeDataEntrustCodAndSampleCode(data, v, k, splitIdentifier, device, entrustCode, sampleCode);
+//            }
+            list = analyzeXlsx1Data(data, v, k, splitIdentifier);
             // 杩涜鍏紡璁$畻
             Object resultValue = calculationFormula(list, v.get(0), k, device);
             map.put(k, resultValue);
         });
         return map;
+    }
+
+    private static List<Object> analyzeXlsx1Data(String data, List<DataConfig> v, String k, String splitIdentifier) {
+        List<Object> finalResult = new ArrayList<>();
+
+        if (data == null || data.isEmpty()) {
+            throw new IllegalArgumentException("杈撳叆鐨勬暟鎹负绌猴紝璇锋鏌ヨ緭鍏ャ��");
+        }
+
+        // 鍒嗗壊鏁版嵁涓鸿
+        String[] lines = data.replaceAll(" ", "").split("\n");
+        if (lines.length == 0) {
+            throw new IllegalArgumentException("杈撳叆鐨勬暟鎹病鏈夋湁鏁堢殑琛岋紝璇锋鏌ヨ緭鍏ャ��");
+        }
+
+        // 鑾峰彇琛ㄥご
+        String[] headers = lines[0].split("\\s+");
+        if (headers.length == 0) {
+            throw new IllegalArgumentException("琛ㄥご鏁版嵁涓虹┖锛岃妫�鏌ヨ緭鍏ユ牸寮忋��");
+        }
+
+        // 鏌ユ壘娴嬭瘯鏃堕棿鍒楃殑绱㈠紩
+        int testTimeIndex = -1;
+        for (int i = 0; i < headers.length; i++) {
+            if (headers[i].contains("娴嬭瘯鏃堕棿")) {
+                testTimeIndex = i;
+                break;
+            }
+        }
+
+        // 鑻ユ湭鎵惧埌娴嬭瘯鏃堕棿鍒楋紝鎶涘嚭寮傚父
+        if (testTimeIndex == -1) {
+            throw new IllegalArgumentException("鏈壘鍒板寘鍚� '娴嬭瘯鏃堕棿' 鐨勫垪锛岃妫�鏌ヨ〃澶淬��");
+        }
+
+        // 鐢ㄤ簬瀛樺偍娴嬭瘯鏃堕棿涓� 2400 鐨勮鏁版嵁
+        String[] targetLine = null;
+
+        // 鏌ユ壘娴嬭瘯鏃堕棿涓� 2400 鐨勮
+        for (int i = 1; i < lines.length; i++) {
+            try {
+                String[] lineData = lines[i].split("\\s+");
+                double testTime = Double.parseDouble(lineData[testTimeIndex]);
+                if (testTime == 2400) {
+                    targetLine = lineData;
+                    break;
+                }
+            } catch (NumberFormatException e) {
+                throw new RuntimeException("绗� " + (i + 1) + " 琛岀殑 '娴嬭瘯鏃堕棿' 鍒楁暟鎹棤娉曡浆鎹负鏁板瓧锛岃妫�鏌ユ暟鎹牸寮忋��", e);
+            } catch (ArrayIndexOutOfBoundsException e) {
+                throw new RuntimeException("绗� " + (i + 1) + " 琛岀殑鏁版嵁鍒楁暟涓嶈冻锛屾棤娉曡幏鍙� '娴嬭瘯鏃堕棿' 鍒楋紝璇锋鏌ユ暟鎹牸寮忋��", e);
+            }
+        }
+
+        // 鑻ユ湭鎵惧埌娴嬭瘯鏃堕棿涓� 2400 鐨勮锛屾姏鍑哄紓甯�
+        if (targetLine == null) {
+            throw new RuntimeException("鏈壘鍒版祴璇曟椂闂翠负 2400 鐨勬暟鎹紝璇锋鏌ユ暟鎹唴瀹广��");
+        }
+
+        for (DataConfig config : v) {
+            String referx = getRefer(config.getReferx());
+            if (ObjectUtils.isEmpty(referx)) {
+                continue;
+            }
+
+            // 鏌ユ壘 referx 鍒楃殑绱㈠紩
+            int referxIndex = -1;
+            for (int i = 0; i < headers.length; i++) {
+                if (headers[i].trim().contains(referx.trim())) {
+                    referxIndex = i;
+                    break;
+                }
+            }
+
+            // 鑻ユ湭鎵惧埌 referx 鍒楋紝鎶涘嚭寮傚父
+            if (referxIndex == -1) {
+                throw new IllegalArgumentException("鏈壘鍒� '" + referx + "' 鍒楋紝璇锋鏌ヨ〃澶村拰閰嶇疆銆�");
+            }
+
+            try {
+                double value = Double.parseDouble(targetLine[referxIndex]);
+                // 鍥涜垗浜斿叆淇濈暀涓や綅灏忔暟
+                DecimalFormat df = new DecimalFormat("#.00");
+                String formattedValue = df.format(value);
+                finalResult.add(Double.parseDouble(formattedValue));
+            } catch (NumberFormatException e) {
+                throw new RuntimeException("'娴嬭瘯鏃堕棿' 涓� 2400 鐨勮涓紝'" + referx + "' 鍒楃殑鏁版嵁鏃犳硶杞崲涓烘暟瀛楋紝璇锋鏌ユ暟鎹牸寮忋��", e);
+            } catch (ArrayIndexOutOfBoundsException e) {
+                throw new RuntimeException("'娴嬭瘯鏃堕棿' 涓� 2400 鐨勮鐨勬暟鎹垪鏁颁笉瓒筹紝鏃犳硶鑾峰彇 '" + referx + "' 鍒楋紝璇锋鏌ユ暟鎹牸寮忋��", e);
+            }
+        }
+        return finalResult;
+    }
+
+    private static List<Object> analyzeXlsxData(String data, List<DataConfig> v, String k, String splitIdentifier) {
+
+        List<Object> finalResult = new ArrayList<>();
+        String ss = k;
+
+        // 瀛樺偍绗﹀悎娴嬭瘯鏃堕棿鑼冨洿鐨勬暟鎹
+        List<String[]> validLines = new ArrayList<>();
+        String[] lines = data.replaceAll(" ", "").split("\n");
+        String[] headers = lines[0].split("\\s+");
+        int testTimeIndex = -1;
+        for (int i = 0; i < headers.length; i++) {
+            if ("娴嬭瘯鏃堕棿".equals(headers[i])) {
+                testTimeIndex = i;
+                break;
+            }
+        }
+
+        if (testTimeIndex == -1) {
+            return finalResult;
+        }
+
+        // 绛涢�夊嚭娴嬭瘯鏃堕棿鍦� 300 鍒� 1500 涔嬮棿鐨勬暟鎹
+        for (int i = 1; i < lines.length; i++) {
+            String[] lineData = lines[i].split("\\s+");
+            try {
+                double testTime = Double.parseDouble(lineData[testTimeIndex]);
+                if (testTime > 300 && testTime <= 1500) {
+                    validLines.add(lineData);
+                } else if (testTime > 1500) {
+                    break;
+                }
+            } catch (NumberFormatException e) {
+                continue;
+            }
+        }
+
+        for (DataConfig config : v) {
+            String referx = getRefer(config.getReferx());
+            if (ObjectUtils.isEmpty(referx)) {
+                continue;
+            }
+
+            int referxIndex = -1;
+            for (int i = 0; i < headers.length; i++) {
+                if (referx.equals(headers[i])) {
+                    referxIndex = i;
+                    break;
+                }
+            }
+
+            if (referxIndex == -1) {
+                continue;
+            }
+
+            List<Double> values = new ArrayList<>();
+            for (String[] lineData : validLines) {
+                try {
+                    double value = Double.parseDouble(lineData[referxIndex]);
+                    values.add(value);
+                } catch (NumberFormatException e) {
+                    continue;
+                }
+            }
+
+            Object result;
+            if ("HRR".equals(referx) || "SPR".equals(referx) || "FIGRA".equals(referx)) {
+                result = values.stream().mapToDouble(Double::doubleValue).max().orElse(0);
+            } else if ("THR".equals(referx) || "TSP".equals(referx)) {
+                result = values.stream().mapToDouble(Double::doubleValue).sum();
+            } else {
+                continue;
+            }
+
+            if (result != null) {
+                // 鍥涜垗浜斿叆淇濈暀涓や綅灏忔暟
+                DecimalFormat df = new DecimalFormat("#.00");
+                result = Double.parseDouble(df.format(result));
+                finalResult.add(result);
+            }
+        }
+        return finalResult;
     }
 
     /**
@@ -590,7 +992,7 @@
      * @return
      */
     public static Map<String, Object> analysisXlsList(String data, Map<String, List<DataConfig>> dataConfig,
-                                                   Device device, String entrustCode, String sampleCode) {
+                                                      Device device, String entrustCode, String sampleCode) {
         Map<String, Object> map = new HashMap<>();
         dataConfig.forEach((k, v) -> {
             List<Object> list = new ArrayList<>();
diff --git a/cnas-device/src/main/java/com/ruoyi/device/utils/NA7672LTCPClientUtils.java b/cnas-device/src/main/java/com/ruoyi/device/utils/NA7672LTCPClientUtils.java
new file mode 100644
index 0000000..06ec86f
--- /dev/null
+++ b/cnas-device/src/main/java/com/ruoyi/device/utils/NA7672LTCPClientUtils.java
@@ -0,0 +1,1053 @@
+package com.ruoyi.device.utils;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.ruoyi.device.pojo.NA7672LRequestBean;
+import com.ruoyi.device.pojo.NA7672LValueVO;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.net.Socket;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Scanner;
+
+public class NA7672LTCPClientUtils {
+
+	private Socket socket = null;
+	private String serverIP = null;
+	private int serverPort;
+
+	public NA7672LTCPClientUtils(String serverIP, int serverPort) {
+		this.serverIP = serverIP;
+		this.serverPort = serverPort;
+	}
+
+	public void initTCP() throws IOException {
+		this.socket = new Socket(this.serverIP, this.serverPort);
+		this.socket.setSoTimeout(5000);
+	}
+
+	public void closeTcp() throws IOException {
+		this.socket.close();
+		this.socket = null;
+	}
+
+	//璁剧疆鍏ㄩ儴閫氶亾锛堢晫闈ave/recall-璋冨紡2锛岄渶瑕佹湰鍦版湁state02鏂囦欢锛�
+	public void initMemory(String filePath) throws IOException {
+		try {
+			this.initTCP();
+			InputStream inputStream = this.socket.getInputStream();
+			OutputStream outputStream = this.socket.getOutputStream();
+			// 鎶婂瓧鑺傛祦杞崲鎴愬瓧绗︽祦
+			PrintWriter printWriter = new PrintWriter(outputStream);
+			Scanner inFromSocket = new Scanner(inputStream);
+			String requestString = ":MMEM:LOAD " + filePath;
+			printWriter.println(requestString);
+			printWriter.flush();
+			this.closeTcp();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+
+	//鑾峰彇01閰嶇疆閲岀殑鎵�鏈夊��
+	public List<NA7672LValueVO> getState01AllValue(NA7672LRequestBean requestBean) {
+		List<NA7672LValueVO> rs = new ArrayList<>();
+		List<NA7672LValueVO> c1_t1 = this.getListValue(1, 1, 3, "swr", 1);
+		//鍐欏叆
+		rs.addAll(c1_t1);
+		return rs;
+	}
+
+	//鑾峰彇02閰嶇疆閲岀殑鎵�鏈夊��
+	public List<NA7672LValueVO> getState02AllValue(NA7672LRequestBean requestBean) {
+		List<NA7672LValueVO> rs = new ArrayList<>();
+		/*鍒ゆ柇鏄惁闇�瑕佽“鍑忕殑璁$畻鍊�*/
+		int ifNeedDecay = 0;
+		if (requestBean.getTemperture() != null) {
+			ifNeedDecay = 1;
+		}
+		List<NA7672LValueVO> c1_t1 = this.getListValue(1, 1, 1, "decay", 16);
+		if (ifNeedDecay == 1) {
+			for (NA7672LValueVO one : c1_t1) {
+				/*琛板噺鐨勬俯搴︾郴鏁版崲绠楀叕寮� = 1+0.002脳锛堝疄闄呮俯搴�-20鈩冿級娴嬭瘯鍊济烽暱搴γ锋俯搴︾郴鏁懊�100*/
+				double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+				double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+				one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+			}
+		}
+		List<NA7672LValueVO> c3_t1 = this.getListValue(3, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c3_t2 = this.getListValue(3, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c4_t1 = this.getListValue(4, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c4_t2 = this.getListValue(4, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c5_t1 = this.getListValue(5, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c5_t2 = this.getListValue(5, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c6_t1 = this.getListValue(6, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c6_t2 = this.getListValue(6, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c8_t1 = this.getListValue(8, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c8_t2 = this.getListValue(8, 2, 3, "swr", 1);
+		rs.addAll(c1_t1);
+		rs.addAll(c4_t1);
+		rs.addAll(c4_t2);
+		rs.addAll(c5_t1);
+		rs.addAll(c5_t2);
+		rs.addAll(c6_t1);
+		rs.addAll(c6_t2);
+		rs.addAll(c8_t1);
+		rs.addAll(c8_t2);
+		/*鍒ゆ柇鏄惁闇�瑕佽绠楃浉浣嶅樊鍜屽钩鍧囩壒鎬ч樆鎶�*/
+		int ifNeedPHA = 0;
+		if (requestBean.getCycle() != null) {
+			ifNeedPHA = 1;
+		} else {
+			ifNeedPHA = 0;
+		}
+		if (ifNeedPHA == 1) {
+			NA7672LValueVO pha = this.getPhaseAndImpedanceCalculate(7, 1, requestBean.getCycle(), requestBean.getCapacity());
+			NA7672LValueVO imp_1 = this.getImpedance(2, 1);
+			NA7672LValueVO imp_2 = this.getImpedance(2, 2);
+			imp_1.setCalculateValue(pha.getCalculateValue());
+			imp_2.setCalculateValue(pha.getCalculateValue());
+			rs.add(pha);
+			rs.add(imp_1);
+			rs.add(imp_2);
+		} else {
+
+		}
+		return rs;
+	}
+
+	//鑾峰彇03閰嶇疆閲岀殑鎵�鏈夊��(鑰佺殑03)
+	public List<NA7672LValueVO> getState03AllValueOld(NA7672LRequestBean requestBean) {
+		List<NA7672LValueVO> rs = new ArrayList<>();
+		List<NA7672LValueVO> c1_t1 = this.getListValue(1, 1, 3, "swr", 1);
+		/*鍒ゆ柇鏄惁闇�瑕佽“鍑忕殑璁$畻鍊�*/
+		int ifNeedDecay = 0;
+		if (requestBean.getTemperture() != null) {
+			ifNeedDecay = 1;
+		}
+		List<NA7672LValueVO> c1_t2 = this.getListValue(1, 2, 1, "decay", 16);
+		NA7672LValueVO c2_t1 = this.getImpedance(2, 1);
+		NA7672LValueVO c2_t2 = this.getImpedance(2, 2);
+		List<NA7672LValueVO> c3 = this.getListValue(5, 1, 1, "decay", 16);
+		if (ifNeedDecay == 1) {
+			for (NA7672LValueVO one : c1_t2) {
+				double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+				double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+				one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+			}
+			for (NA7672LValueVO one : c3) {
+				double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+				double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+				one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+			}
+		}
+		//鍐欏叆
+		rs.addAll(c1_t1);
+		rs.addAll(c1_t2);
+		rs.add(c2_t1);
+		rs.add(c2_t2);
+		rs.addAll(c3);
+		return rs;
+	}
+
+	//鑾峰彇03閰嶇疆閲岀殑鎵�鏈夊�硷紙鏂扮殑锛�
+	public List<NA7672LValueVO> getState03AllValue(NA7672LRequestBean requestBean) {
+		List<NA7672LValueVO> rs = new ArrayList<>();
+		List<NA7672LValueVO> c1_t1 = this.getListValue(1, 1, 1, "decay", 16);
+		List<NA7672LValueVO> c2_t1 = this.getListValue(2, 1, 1, "decay", 16);
+		List<NA7672LValueVO> c4_t1 = this.getListValue(4, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c4_t2 = this.getListValue(4, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c5_t1 = this.getListValue(5, 1, 4, "swr", 1);
+		List<NA7672LValueVO> c5_t2 = this.getListValue(5, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c6_t1 = this.getListValue(6, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c6_t2 = this.getListValue(6, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c7_t1 = this.getListValue(7, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c7_t2 = this.getListValue(7, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c8_t1 = this.getListValue(8, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c8_t2 = this.getListValue(8, 2, 3, "swr", 1);
+		for (NA7672LValueVO one : c1_t1) {
+			double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+			double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+			one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+		}
+		for (NA7672LValueVO one : c2_t1) {
+			double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+			double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+			one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+		}
+		//鐗规�ч樆鎶�
+		NA7672LValueVO c3_t1 = this.getImpedance(3, 1);
+		NA7672LValueVO c3_t2 = this.getImpedance(3, 2);
+		//鍐欏叆
+		rs.addAll(c1_t1);
+		rs.addAll(c2_t1);
+		rs.add(c3_t1);
+		rs.add(c3_t2);
+		rs.addAll(c4_t1);
+		rs.addAll(c4_t2);
+		rs.addAll(c5_t1);
+		rs.addAll(c5_t2);
+		rs.addAll(c6_t1);
+		rs.addAll(c6_t2);
+		rs.addAll(c7_t1);
+		rs.addAll(c7_t2);
+		rs.addAll(c8_t1);
+		rs.addAll(c8_t2);
+		return rs;
+	}
+
+	//鑾峰彇04閰嶇疆閲岀殑鎵�鏈夊��
+	public List<NA7672LValueVO> getState04AllValue(NA7672LRequestBean requestBean) {
+		List<NA7672LValueVO> rs = new ArrayList<>();
+		List<NA7672LValueVO> c1_t1 = this.getListValue(1, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c1_t2 = this.getListValue(1, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c3_t1 = this.getListValue(3, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c3_t2 = this.getListValue(3, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c4_t1 = this.getListValue(4, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c4_t2 = this.getListValue(4, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c5_t1 = this.getListValue(5, 1, 4, "swr", 1);
+		List<NA7672LValueVO> c5_t2 = this.getListValue(5, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c6_t1 = this.getListValue(6, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c6_t2 = this.getListValue(6, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c7_t1 = this.getListValue(7, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c7_t2 = this.getListValue(7, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c8_t1 = this.getListValue(8, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c8_t2 = this.getListValue(8, 2, 3, "swr", 1);
+		//鐗规�ч樆鎶�
+		NA7672LValueVO c2_t1 = this.getImpedance(2, 1);
+		NA7672LValueVO c2_t2 = this.getImpedance(2, 2);
+		//鍐欏叆
+		rs.addAll(c1_t1);
+		rs.addAll(c1_t2);
+		rs.addAll(c3_t1);
+		rs.addAll(c3_t2);
+		rs.addAll(c4_t1);
+		rs.addAll(c4_t2);
+		rs.addAll(c5_t1);
+		rs.addAll(c5_t2);
+		rs.addAll(c6_t1);
+		rs.addAll(c6_t2);
+		rs.addAll(c7_t1);
+		rs.addAll(c7_t2);
+		rs.addAll(c8_t1);
+		rs.addAll(c8_t2);
+		rs.add(c2_t1);
+		rs.add(c2_t2);
+		return rs;
+	}
+
+	//鑾峰彇05閰嶇疆閲岀殑鎵�鏈夊��
+	public List<NA7672LValueVO> getState05AllValue(NA7672LRequestBean requestBean) {
+		List<NA7672LValueVO> rs = new ArrayList<>();
+		/*鍒ゆ柇鏄惁闇�瑕佽“鍑忕殑璁$畻鍊�*/
+		int ifNeedDecay = 0;
+		if (requestBean.getTemperture() != null) {
+			ifNeedDecay = 1;
+		}
+		List<NA7672LValueVO> c1_t1 = this.getListValue(1, 1, 1, "decay", 16);
+		List<NA7672LValueVO> c1_t2 = this.getListValue(1, 2, 1, "decay", 16);
+		List<NA7672LValueVO> c2_t1 = this.getListValue(2, 1, 1, "decay", 16);
+		List<NA7672LValueVO> c2_t2 = this.getListValue(2, 2, 1, "decay", 16);
+		List<NA7672LValueVO> c4_t1 = this.getListValue(4, 1, 1, "decay", 16);
+		List<NA7672LValueVO> c4_t2 = this.getListValue(4, 2, 1, "decay", 16);
+		List<NA7672LValueVO> c5_t1 = this.getListValue(5, 1, 1, "decay", 16);
+		List<NA7672LValueVO> c5_t2 = this.getListValue(5, 2, 1, "decay", 16);
+		List<NA7672LValueVO> c6_t1 = this.getListValue(6, 1, 1, "decay", 16);
+		List<NA7672LValueVO> c6_t2 = this.getListValue(6, 2, 1, "decay", 16);
+		if (ifNeedDecay == 1) {
+			for (NA7672LValueVO one : c1_t1) {
+				double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+				double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+				one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+			}
+			for (NA7672LValueVO one : c1_t2) {
+				double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+				double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+				one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+			}
+			for (NA7672LValueVO one : c2_t1) {
+				double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+				double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+				one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+			}
+			for (NA7672LValueVO one : c2_t2) {
+				double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+				double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+				one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+			}
+			for (NA7672LValueVO one : c4_t1) {
+				double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+				double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+				one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+			}
+			for (NA7672LValueVO one : c4_t2) {
+				double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+				double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+				one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+			}
+			for (NA7672LValueVO one : c5_t1) {
+				double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+				double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+				one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+			}
+			for (NA7672LValueVO one : c5_t2) {
+				double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+				double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+				one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+			}
+			for (NA7672LValueVO one : c6_t1) {
+				double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+				double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+				one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+			}
+			for (NA7672LValueVO one : c6_t2) {
+				double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+				double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+				one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+			}
+		}
+		//鐗规�ч樆鎶�
+		NA7672LValueVO c3_t1 = this.getImpedance(3, 1);
+		NA7672LValueVO c3_t2 = this.getImpedance(3, 2);
+		//鍐欏叆
+		rs.addAll(c1_t1);
+		rs.addAll(c1_t2);
+		rs.addAll(c2_t1);
+		rs.addAll(c2_t2);
+		rs.add(c3_t1);
+		rs.add(c3_t2);
+		rs.addAll(c4_t1);
+		rs.addAll(c4_t2);
+		rs.addAll(c5_t1);
+		rs.addAll(c5_t2);
+		rs.addAll(c6_t1);
+		rs.addAll(c6_t2);
+		return rs;
+	}
+
+	//鑾峰彇06閰嶇疆閲岀殑鎵�鏈夊��
+	public List<NA7672LValueVO> getState06AllValue(NA7672LRequestBean requestBean) {
+		List<NA7672LValueVO> rs = new ArrayList<>();
+		List<NA7672LValueVO> c1 = this.getListValue(1, 1, 1, "swr", 1);
+		rs.addAll(c1);
+		return rs;
+	}
+
+	//鑾峰彇07閰嶇疆閲岀殑鎵�鏈夊��
+	public List<NA7672LValueVO> getState07AllValue(NA7672LRequestBean requestBean) {
+		List<NA7672LValueVO> rs = new ArrayList<>();
+		List<NA7672LValueVO> c1_t1 = this.getListValue(1, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c1_t2 = this.getListValue(1, 2, 1, "decay", 16);
+		List<NA7672LValueVO> c2_t1 = this.getListValue(2, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c2_t2 = this.getListValue(2, 2, 1, "decay", 16);
+		List<NA7672LValueVO> c4_t1 = this.getListValue(4, 1, 1, "decay", 16);
+		/*鍒ゆ柇鏄惁闇�瑕佽“鍑忕殑璁$畻鍊�*/
+		int ifNeedDecay = 0;
+		if (requestBean.getTemperture() != null) {
+			ifNeedDecay = 1;
+		}
+		if (ifNeedDecay == 1) {
+			for (NA7672LValueVO one : c1_t2) {
+				double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+				double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+				one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+			}
+			for (NA7672LValueVO one : c2_t2) {
+				double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+				double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+				one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+			}
+			for (NA7672LValueVO one : c4_t1) {
+				double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+				double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+				one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+			}
+		}
+		rs.addAll(c1_t1);
+		rs.addAll(c1_t2);
+		rs.addAll(c2_t1);
+		rs.addAll(c2_t2);
+		rs.addAll(c4_t1);
+		//鐗规�ч樆鎶�
+		NA7672LValueVO c3_t1 = this.getImpedance(3, 1);
+		NA7672LValueVO c3_t2 = this.getImpedance(3, 2);
+		rs.add(c3_t1);
+		rs.add(c3_t2);
+		return rs;
+	}
+
+	//鑾峰彇08閰嶇疆閲岀殑鎵�鏈夊��
+	public List<NA7672LValueVO> getState08AllValue(NA7672LRequestBean requestBean) {
+		List<NA7672LValueVO> rs = new ArrayList<>();
+		/*鍒ゆ柇鏄惁闇�瑕佽“鍑忕殑璁$畻鍊�*/
+		int ifNeedDecay = 0;
+		if (requestBean.getTemperture() != null) {
+			ifNeedDecay = 1;
+		}
+		List<NA7672LValueVO> c1_t1 = this.getListValue(1, 1, 1, "decay", 16);
+		if (ifNeedDecay == 1) {
+			for (NA7672LValueVO one : c1_t1) {
+				/*鑾峰彇璁$畻鍊�*/
+			/*琛板噺鐨勬俯搴︾郴鏁版崲绠楀叕寮� = 1+0.002脳锛堝疄闄呮俯搴�-20鈩冿級
+			娴嬭瘯鍊济烽暱搴γ锋俯搴︾郴鏁懊�100*/
+				double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+				double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+				one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+			}
+		}
+		//鑾峰彇椹绘尝姣�
+		List<NA7672LValueVO> c3_t1 = this.getListValue(3, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c3_t2 = this.getListValue(3, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c4_t1 = this.getListValue(4, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c4_t2 = this.getListValue(4, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c5_t1 = this.getListValue(5, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c5_t2 = this.getListValue(5, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c6_t1 = this.getListValue(6, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c6_t2 = this.getListValue(6, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c8_t1 = this.getListValue(8, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c8_t2 = this.getListValue(8, 2, 3, "swr", 1);
+		rs.addAll(c1_t1);
+		rs.addAll(c3_t1);
+		rs.addAll(c3_t2);
+		rs.addAll(c4_t1);
+		rs.addAll(c4_t2);
+		rs.addAll(c5_t1);
+		rs.addAll(c5_t2);
+		rs.addAll(c6_t1);
+		rs.addAll(c6_t2);
+		rs.addAll(c8_t1);
+		rs.addAll(c8_t2);
+		/*鍒ゆ柇鏄惁闇�瑕佽绠楃浉浣嶅樊鍜屽钩鍧囩壒鎬ч樆鎶�*/
+		int ifNeedPHA = 0;
+		if (requestBean.getCycle() != null) {
+			ifNeedPHA = 1;
+		} else {
+			ifNeedPHA = 0;
+		}
+		if (ifNeedPHA == 1) {
+			NA7672LValueVO pha = this.getPhaseAndImpedanceCalculate(7, 1, requestBean.getCycle(), requestBean.getCapacity());
+			NA7672LValueVO imp_1 = this.getImpedance(2, 1);
+			NA7672LValueVO imp_2 = this.getImpedance(2, 2);
+			imp_1.setCalculateValue(pha.getCalculateValue());
+			imp_2.setCalculateValue(pha.getCalculateValue());
+			rs.add(pha);
+			rs.add(imp_1);
+			rs.add(imp_2);
+		} else {
+
+		}
+		return rs;
+	}
+
+	//鑾峰彇autorec閰嶇疆閲岀殑鎵�鏈夊��
+	public List<NA7672LValueVO> getStateAutoRecAllValue(NA7672LRequestBean requestBean) {
+		List<NA7672LValueVO> rs = new ArrayList<>();
+		/*鍒ゆ柇鏄惁闇�瑕佽“鍑忕殑璁$畻鍊�*/
+		int ifNeedDecay = 0;
+		if (requestBean.getTemperture() != null) {
+			ifNeedDecay = 1;
+		}
+		List<NA7672LValueVO> c1_t1 = this.getListValue(1, 1, 1, "decay", 16);
+		List<NA7672LValueVO> c2_t1 = this.getListValue(2, 1, 1, "decay", 16);
+		if (ifNeedDecay == 1) {
+			for (NA7672LValueVO one : c1_t1) {
+				/*鑾峰彇璁$畻鍊�*/
+			/*琛板噺鐨勬俯搴︾郴鏁版崲绠楀叕寮� = 1+0.002脳锛堝疄闄呮俯搴�-20鈩冿級
+			娴嬭瘯鍊济烽暱搴γ锋俯搴︾郴鏁懊�100*/
+				double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+				double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+				one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+			}
+			for (NA7672LValueVO one : c2_t1) {
+				/*鑾峰彇璁$畻鍊�*/
+			/*琛板噺鐨勬俯搴︾郴鏁版崲绠楀叕寮� = 1+0.002脳锛堝疄闄呮俯搴�-20鈩冿級
+			娴嬭瘯鍊济烽暱搴γ锋俯搴︾郴鏁懊�100*/
+				double wd = 1 + 0.002 * (requestBean.getTemperture() - 20);
+				double decay_cal = one.getDecimalVal().doubleValue() / requestBean.getLength() / wd * 100;
+				one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+			}
+		}
+		List<NA7672LValueVO> c4_t1 = this.getListValue(4, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c4_t2 = this.getListValue(4, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c5_t1 = this.getListValue(5, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c5_t2 = this.getListValue(5, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c6_t1 = this.getListValue(6, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c6_t2 = this.getListValue(6, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c7_t1 = this.getListValue(7, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c7_t2 = this.getListValue(7, 2, 3, "swr", 1);
+		List<NA7672LValueVO> c8_t1 = this.getListValue(8, 1, 3, "swr", 1);
+		List<NA7672LValueVO> c8_t2 = this.getListValue(8, 2, 3, "swr", 1);
+		rs.addAll(c1_t1);
+		rs.addAll(c2_t1);
+		rs.addAll(c4_t1);
+		rs.addAll(c4_t2);
+		rs.addAll(c5_t1);
+		rs.addAll(c5_t2);
+		rs.addAll(c6_t1);
+		rs.addAll(c6_t2);
+		rs.addAll(c7_t1);
+		rs.addAll(c7_t2);
+		rs.addAll(c8_t1);
+		rs.addAll(c8_t2);
+		/*鍒ゆ柇鏄惁闇�瑕佽绠楃浉浣嶅樊鍜屽钩鍧囩壒鎬ч樆鎶�*/
+		int ifNeedPHA = 0;
+		if (requestBean.getCycle() != null) {
+			ifNeedPHA = 1;
+		} else {
+			ifNeedPHA = 0;
+		}
+		if (ifNeedPHA == 1) {
+			NA7672LValueVO pha = this.getPhaseAndImpedanceCalculate(9, 1, requestBean.getCycle(), requestBean.getCapacity());
+			NA7672LValueVO imp_1 = this.getImpedance(3, 1);
+			NA7672LValueVO imp_2 = this.getImpedance(3, 2);
+			imp_1.setCalculateValue(pha.getCalculateValue());
+			imp_2.setCalculateValue(pha.getCalculateValue());
+			rs.add(pha);
+			rs.add(imp_1);
+			rs.add(imp_2);
+		} else {
+
+		}
+		return rs;
+	}
+
+	/*鑾峰彇鐩镐綅宸拰鐗规�ч樆鎶楄绠楀��*/
+	public NA7672LValueVO getPhaseAndImpedanceCalculate(int channelId, int traceId, double cycle, double capacity) {
+		NA7672LValueVO phaseMeatured = this.getPHA(channelId, traceId);
+		NA7672LValueVO impedanceCalculate = this.getImpedanceCalculateVal(cycle, phaseMeatured.getDecimalVal().doubleValue(), capacity);
+		phaseMeatured.setCalculateValue(impedanceCalculate.getMeasureValue());
+		return phaseMeatured;
+	}
+
+
+	/*鑾峰彇琛板噺锛堟柊锛�*/
+	public List<NA7672LValueVO> getDecayListNew(int channelId, int traceId, int fetchType, String returnType, double temperture, double length) {
+		List<NA7672LValueVO> returnValueList = new ArrayList<>();
+		try {
+			this.initTCP();
+			InputStream inputStream = this.socket.getInputStream();
+			OutputStream outputStream = this.socket.getOutputStream();
+			// 鎶婂瓧鑺傛祦杞崲鎴愬瓧绗︽祦
+			PrintWriter printWriter = new PrintWriter(outputStream);
+			Scanner inFromSocket = new Scanner(inputStream);
+			//鑾峰彇mark鐨剎
+			for (int markId = 1; markId <= 16; markId++) {
+				NA7672LValueVO returnValue = new NA7672LValueVO();
+				String requestString = ":CALC" + channelId + ":TRAC" + traceId + ":MARK" + markId + ":X?";
+				printWriter.println(requestString);
+				printWriter.flush();
+				String responseString = inFromSocket.next();
+				BigDecimal val = new BigDecimal(responseString);
+				BigDecimal valRound = val.divide(new BigDecimal(1000 * 1000), 0, RoundingMode.CEILING);
+				returnValue.setLabel(returnType + "_" + valRound.toString() + "m");
+				//鑾峰彇mark鐨剏
+				requestString = ":CALC" + channelId + ":TRAC" + traceId + ":MARK" + markId + ":Y?";
+				printWriter.println(requestString);
+				printWriter.flush();
+				responseString = inFromSocket.next();
+				String[] valList = responseString.split(",");
+				val = new BigDecimal(valList[0]);
+				val.setScale(4, RoundingMode.HALF_UP);
+				returnValue.setDecimalVal(val);
+				/*绫诲埆琛板噺銆侀�氶亾銆佽建杩圭嚎銆乵ark*/
+				returnValue.setFetchType(fetchType);
+				returnValue.setChannel(channelId);
+				returnValue.setTrace(traceId);
+				returnValue.setChannel(channelId);
+				returnValue.setMark(markId);
+				returnValueList.add(returnValue);
+			}
+			this.closeTcp();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		for (NA7672LValueVO one : returnValueList) {
+			/*鑾峰彇璁$畻鍊�*/
+			/*琛板噺鐨勬俯搴︾郴鏁版崲绠楀叕寮� = 1+0.002脳锛堝疄闄呮俯搴�-20鈩冿級
+			娴嬭瘯鍊济烽暱搴γ锋俯搴︾郴鏁懊�100*/
+			double wd = 1 + 0.002 * (temperture - 20);
+			double decay_cal = one.getDecimalVal().doubleValue() / length / wd * 100;
+			one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+		}
+		return returnValueList;
+	}
+
+	/*鑾峰彇椹绘尝姣旓紙鏂帮級*/
+	public NA7672LValueVO getSWRNew(int channelId, int fetchType) {
+		NA7672LValueVO swr1 = this.getSWR(channelId, 1, 1);
+		NA7672LValueVO swr2 = this.getSWR(channelId, 2, 1);
+		BigDecimal p1 = swr1.getDecimalVal();
+		BigDecimal p2 = swr2.getDecimalVal();
+		BigDecimal p3 = new BigDecimal(0.0);
+		if (p1.compareTo(p2) == 1) {
+			p3 = p1;
+		} else {
+			p3 = p2;
+		}
+		swr1.setMeasureValue(swr2.getDecimalVal());
+		swr1.setCalculateValue(p3);
+		swr1.setFetchType(fetchType);
+		return swr1;
+	}
+
+	/*鑾峰彇鍒楄〃鍊�*/
+	public List<NA7672LValueVO> getListValue(int channelId, int traceId, int fetchType, String returnType, int fetchNum) {
+		List<NA7672LValueVO> returnValueList = new ArrayList<>();
+		try {
+			this.initTCP();
+			InputStream inputStream = this.socket.getInputStream();
+			OutputStream outputStream = this.socket.getOutputStream();
+			// 鎶婂瓧鑺傛祦杞崲鎴愬瓧绗︽祦
+			PrintWriter printWriter = new PrintWriter(outputStream);
+			Scanner inFromSocket = new Scanner(inputStream);
+			//鑾峰彇mark鐨剎
+			for (int markId = 1; markId <= fetchNum; markId++) {
+				NA7672LValueVO returnValue = new NA7672LValueVO();
+				String requestString = ":CALC" + channelId + ":TRAC" + traceId + ":MARK" + markId + ":X?";
+				printWriter.println(requestString);
+				printWriter.flush();
+				String responseString = inFromSocket.next();
+				BigDecimal val = new BigDecimal(responseString);
+				BigDecimal valRound = val.divide(new BigDecimal(1000 * 1000), 0, RoundingMode.CEILING);
+				returnValue.setLabel(returnType + "_" + valRound.toString() + "m");
+				//鑾峰彇mark鐨剏
+				requestString = ":CALC" + channelId + ":TRAC" + traceId + ":MARK" + markId + ":Y?";
+				printWriter.println(requestString);
+				printWriter.flush();
+				responseString = inFromSocket.next();
+				String[] valList = responseString.split(",");
+				val = new BigDecimal(valList[0]);
+				val.setScale(4, RoundingMode.HALF_UP);
+				returnValue.setDecimalVal(val);
+				/*绫诲埆琛板噺銆侀�氶亾銆佽建杩圭嚎銆乵ark*/
+				returnValue.setFetchType(fetchType);
+				returnValue.setChannel(channelId);
+				returnValue.setTrace(traceId);
+				returnValue.setChannel(channelId);
+				returnValue.setMark(markId);
+				returnValueList.add(returnValue);
+			}
+			this.closeTcp();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return returnValueList;
+	}
+
+	/*鑾峰彇鍗曚竴鍧囧��*/
+	public NA7672LValueVO getMeanValue(int channelId, int traceId) {
+		NA7672LValueVO returnValue = new NA7672LValueVO();
+		try {
+			this.initTCP();
+			InputStream inputStream = this.socket.getInputStream();
+			OutputStream outputStream = this.socket.getOutputStream();
+			// 鎶婂瓧鑺傛祦杞崲鎴愬瓧绗︽祦
+			PrintWriter printWriter = new PrintWriter(outputStream);
+			Scanner inFromSocket = new Scanner(inputStream);
+			//鑾峰彇闃绘姉
+			String requestString = ":CALC" + channelId + ":TRAC" + traceId + ":MST:DATA?";
+			printWriter.println(requestString);
+			printWriter.flush();
+			String responseString = inFromSocket.next();
+			String[] valList = responseString.split(",");
+			BigDecimal val = new BigDecimal(valList[0]);
+			val.setScale(4, RoundingMode.HALF_UP);
+			returnValue.setDecimalVal(val);
+			returnValue.setLabel("impedance_mean");
+			/*绫诲埆闃绘姉銆侀�氶亾銆佽建杩圭嚎銆乵ark*/
+			returnValue.setFetchType(2);
+			returnValue.setChannel(channelId);
+			returnValue.setTrace(traceId);
+			returnValue.setChannel(channelId);
+			returnValue.setMark(-1);
+			this.closeTcp();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return returnValue;
+	}
+
+	/*娴嬭瘯1锛岄敊璇殑渚嬪瓙*/
+	public void test1() {
+		try {
+			this.initTCP();
+			InputStream inputStream = socket.getInputStream();
+			OutputStream outputStream = socket.getOutputStream();
+			// 鎶婂瓧鑺傛祦杞崲鎴愬瓧绗︽祦
+			PrintWriter printWriter = new PrintWriter(outputStream);
+			Scanner inFromSocket = new Scanner(inputStream);
+			String requestString = ":CALC1:TRAC1:MARK100:Y?";
+			// 2,鍐欏叆璇锋眰
+			printWriter.println(requestString);
+			printWriter.flush();
+			// 3,璇诲彇璇锋眰
+			String responseString = inFromSocket.next();
+			// 鎺у埗鍙� 鎵撳嵃璇锋眰瀛楃涓� + 鍝嶅簲瀛楃涓�
+			System.out.println(requestString + " + " + responseString);
+			this.closeTcp();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+
+	/*娴嬭瘯2锛屾纭殑渚嬪瓙*/
+	public void test2() {
+		try {
+			this.initTCP();
+			InputStream inputStream = socket.getInputStream();
+			OutputStream outputStream = socket.getOutputStream();
+			// 鎶婂瓧鑺傛祦杞崲鎴愬瓧绗︽祦
+			PrintWriter printWriter = new PrintWriter(outputStream);
+			Scanner inFromSocket = new Scanner(inputStream);
+			String requestString = ":CALC1:TRAC1:MARK1:Y?";
+			// 2,鍐欏叆璇锋眰
+			printWriter.println(requestString);
+			printWriter.flush();
+			// 3,璇诲彇璇锋眰
+			String responseString = inFromSocket.next();
+			// 鎺у埗鍙� 鎵撳嵃璇锋眰瀛楃涓� + 鍝嶅簲瀛楃涓�
+			System.out.println(requestString + " + " + responseString);
+			this.closeTcp();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+
+	/*鑾峰彇琛板噺*/
+	public NA7672LValueVO getDecay(int channelId, int traceId, int markId) {
+		NA7672LValueVO returnValue = new NA7672LValueVO();
+		try {
+			this.initTCP();
+			InputStream inputStream = this.socket.getInputStream();
+			OutputStream outputStream = this.socket.getOutputStream();
+			// 鎶婂瓧鑺傛祦杞崲鎴愬瓧绗︽祦
+			PrintWriter printWriter = new PrintWriter(outputStream);
+			Scanner inFromSocket = new Scanner(inputStream);
+			//鑾峰彇mark鐨剎
+			String requestString = ":CALC" + channelId + ":TRAC" + traceId + ":MARK" + markId + ":X?";
+			printWriter.println(requestString);
+			printWriter.flush();
+			String responseString = inFromSocket.next();
+			BigDecimal val = new BigDecimal(responseString);
+			BigDecimal valRound = val.divide(new BigDecimal(1000 * 1000), 0, RoundingMode.CEILING);
+			returnValue.setLabel("decay_" + valRound.toString() + "m");
+			//鑾峰彇mark鐨剏
+			requestString = ":CALC" + channelId + ":TRAC" + traceId + ":MARK" + markId + ":Y?";
+			printWriter.println(requestString);
+			printWriter.flush();
+			responseString = inFromSocket.next();
+			String[] valList = responseString.split(",");
+			val = new BigDecimal(valList[0]);
+			val.setScale(4, RoundingMode.HALF_UP);
+			returnValue.setDecimalVal(val);
+			/*绫诲埆琛板噺銆侀�氶亾銆佽建杩圭嚎銆乵ark*/
+			returnValue.setFetchType(1);
+			returnValue.setChannel(channelId);
+			returnValue.setTrace(traceId);
+			returnValue.setChannel(channelId);
+			returnValue.setMark(markId);
+			this.closeTcp();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return returnValue;
+	}
+
+	/*鑾峰彇琛板噺鍒楄〃*/
+	public List<NA7672LValueVO> getDecayList(int channelId, int traceId) {
+		List<NA7672LValueVO> returnValueList = new ArrayList<>();
+		try {
+			this.initTCP();
+			InputStream inputStream = this.socket.getInputStream();
+			OutputStream outputStream = this.socket.getOutputStream();
+			// 鎶婂瓧鑺傛祦杞崲鎴愬瓧绗︽祦
+			PrintWriter printWriter = new PrintWriter(outputStream);
+			Scanner inFromSocket = new Scanner(inputStream);
+			//鑾峰彇mark鐨剎
+			for (int markId = 1; markId <= 16; markId++) {
+				NA7672LValueVO returnValue = new NA7672LValueVO();
+				String requestString = ":CALC" + channelId + ":TRAC" + traceId + ":MARK" + markId + ":X?";
+				printWriter.println(requestString);
+				printWriter.flush();
+				String responseString = inFromSocket.next();
+				BigDecimal val = new BigDecimal(responseString);
+				BigDecimal valRound = val.divide(new BigDecimal(1000 * 1000), 0, RoundingMode.CEILING);
+				returnValue.setLabel("decay_" + valRound.toString() + "m");
+				//鑾峰彇mark鐨剏
+				requestString = ":CALC" + channelId + ":TRAC" + traceId + ":MARK" + markId + ":Y?";
+				printWriter.println(requestString);
+				printWriter.flush();
+				responseString = inFromSocket.next();
+				String[] valList = responseString.split(",");
+				val = new BigDecimal(valList[0]);
+				val.setScale(4, RoundingMode.HALF_UP);
+				returnValue.setDecimalVal(val);
+				/*绫诲埆琛板噺銆侀�氶亾銆佽建杩圭嚎銆乵ark*/
+				returnValue.setFetchType(1);
+				returnValue.setChannel(channelId);
+				returnValue.setTrace(traceId);
+				returnValue.setChannel(channelId);
+				returnValue.setMark(markId);
+				returnValueList.add(returnValue);
+			}
+			this.closeTcp();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return returnValueList;
+	}
+
+	/*閫氳繃label鑾峰彇琛板噺*/
+	public NA7672LValueVO getDecayByLabel(int channelId, int traceId, String label, double temperture, double length) {
+		NA7672LValueVO returnVale = new NA7672LValueVO();
+		List<NA7672LValueVO> list = this.getDecayList(channelId, traceId);
+		int ifFind = 0;
+		for (NA7672LValueVO one : list) {
+			if (one.getLabel().equals(label)) {
+				BeanUtil.copyProperties(one, returnVale);
+				/*鑾峰彇璁$畻鍊�*/
+				/*琛板噺鐨勬俯搴︾郴鏁版崲绠楀叕寮� = 1+0.002脳锛堝疄闄呮俯搴�-20鈩冿級
+				娴嬭瘯鍊济烽暱搴γ锋俯搴︾郴鏁懊�100*/
+				double wd = 1 + 0.002 * (temperture - 20);
+				double decay_cal = one.getDecimalVal().doubleValue() / length / wd * 100;
+				returnVale.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP));
+				ifFind = 1;
+				break;
+			}
+		}
+		if (ifFind == 0) {
+			returnVale.setIfLegal(0);
+			returnVale.setLabel(label);
+		}
+		return returnVale;
+	}
+
+	/*鑾峰彇闃绘姉*/
+	public NA7672LValueVO getImpedance(int channelId, int traceId) {
+		NA7672LValueVO returnValue = new NA7672LValueVO();
+		try {
+			this.initTCP();
+			InputStream inputStream = this.socket.getInputStream();
+			OutputStream outputStream = this.socket.getOutputStream();
+			// 鎶婂瓧鑺傛祦杞崲鎴愬瓧绗︽祦
+			PrintWriter printWriter = new PrintWriter(outputStream);
+			Scanner inFromSocket = new Scanner(inputStream);
+			//鑾峰彇闃绘姉
+			String requestString = ":CALC" + channelId + ":TRAC" + traceId + ":MST:DATA?";
+			printWriter.println(requestString);
+			printWriter.flush();
+			String responseString = inFromSocket.next();
+			String[] valList = responseString.split(",");
+			BigDecimal val = new BigDecimal(valList[0]);
+			val.setScale(4, RoundingMode.HALF_UP);
+			returnValue.setDecimalVal(val);
+			returnValue.setLabel("impedance_mean");
+			/*绫诲埆闃绘姉銆侀�氶亾銆佽建杩圭嚎銆乵ark*/
+			returnValue.setFetchType(2);
+			returnValue.setChannel(channelId);
+			returnValue.setTrace(traceId);
+			returnValue.setChannel(channelId);
+			returnValue.setMark(-1);
+			this.closeTcp();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return returnValue;
+	}
+
+	/*鑾峰彇椹绘尝姣�*/
+	public NA7672LValueVO getSWR(int channelId, int traceId, int markId) {
+		NA7672LValueVO returnValue = new NA7672LValueVO();
+		try {
+			this.initTCP();
+			InputStream inputStream = this.socket.getInputStream();
+			OutputStream outputStream = this.socket.getOutputStream();
+			// 鎶婂瓧鑺傛祦杞崲鎴愬瓧绗︽祦
+			PrintWriter printWriter = new PrintWriter(outputStream);
+			Scanner inFromSocket = new Scanner(inputStream);
+			//鑾峰彇mark鐨剎
+			String requestString = ":CALC" + channelId + ":TRAC" + traceId + ":MARK" + markId + ":X?";
+			printWriter.println(requestString);
+			printWriter.flush();
+			String responseString = inFromSocket.next();
+			BigDecimal val = new BigDecimal(responseString);
+			BigDecimal valRound = val.divide(new BigDecimal(1000 * 1000), 0, RoundingMode.CEILING);
+			returnValue.setLabel("swr_" + valRound.toString() + "m");
+			//鑾峰彇mark鐨剏
+			requestString = ":CALC" + channelId + ":TRAC" + traceId + ":MARK" + markId + ":Y?";
+			printWriter.println(requestString);
+			printWriter.flush();
+			responseString = inFromSocket.next();
+			String[] valList = responseString.split(",");
+			val = new BigDecimal(valList[0]);
+			val.setScale(4, RoundingMode.HALF_UP);
+			returnValue.setDecimalVal(val);
+			/*绫诲埆琛板噺銆侀�氶亾銆佽建杩圭嚎銆乵ark*/
+			returnValue.setFetchType(3);
+			returnValue.setChannel(channelId);
+			returnValue.setTrace(traceId);
+			returnValue.setChannel(channelId);
+			returnValue.setMark(markId);
+			this.closeTcp();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return returnValue;
+	}
+
+	/*鑾峰彇椹绘尝姣斿垪琛�*/
+	public List<NA7672LValueVO> getSWRList(int channelId, int traceId) {
+		List<NA7672LValueVO> returnValueList = new ArrayList<>();
+		try {
+			this.initTCP();
+			InputStream inputStream = this.socket.getInputStream();
+			OutputStream outputStream = this.socket.getOutputStream();
+			// 鎶婂瓧鑺傛祦杞崲鎴愬瓧绗︽祦
+			PrintWriter printWriter = new PrintWriter(outputStream);
+			Scanner inFromSocket = new Scanner(inputStream);
+			//鑾峰彇mark鐨剎
+			for (int markId = 1; markId <= 16; markId++) {
+				NA7672LValueVO returnValue = new NA7672LValueVO();
+				String requestString = ":CALC" + channelId + ":TRAC" + traceId + ":MARK" + markId + ":X?";
+				printWriter.println(requestString);
+				printWriter.flush();
+				String responseString = inFromSocket.next();
+				BigDecimal val = new BigDecimal(responseString);
+				BigDecimal valRound = val.divide(new BigDecimal(1000 * 1000), 0, RoundingMode.CEILING);
+				returnValue.setLabel("swr_" + valRound.toString() + "m");
+				//鑾峰彇mark鐨剏
+				requestString = ":CALC" + channelId + ":TRAC" + traceId + ":MARK" + markId + ":Y?";
+				printWriter.println(requestString);
+				printWriter.flush();
+				responseString = inFromSocket.next();
+				String[] valList = responseString.split(",");
+				val = new BigDecimal(valList[0]);
+				val.setScale(4, RoundingMode.HALF_UP);
+				returnValue.setDecimalVal(val);
+				/*绫诲埆琛板噺銆侀�氶亾銆佽建杩圭嚎銆乵ark*/
+				returnValue.setFetchType(1);
+				returnValue.setChannel(channelId);
+				returnValue.setTrace(traceId);
+				returnValue.setChannel(channelId);
+				returnValue.setMark(markId);
+				returnValueList.add(returnValue);
+			}
+			this.closeTcp();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return returnValueList;
+	}
+
+	/*閫氳繃label鑾峰彇椹绘尝姣�*/
+	public NA7672LValueVO getSWRByLabel(int channelId, int traceId, String label) {
+		NA7672LValueVO returnVale = new NA7672LValueVO();
+		List<NA7672LValueVO> list = this.getSWRList(channelId, traceId);
+		int ifFind = 0;
+		for (NA7672LValueVO one : list) {
+			if (one.getLabel().equals(label)) {
+				BeanUtil.copyProperties(one, returnVale);
+				ifFind = 1;
+				break;
+			}
+		}
+		if (ifFind == 0) {
+			returnVale.setIfLegal(0);
+			returnVale.setLabel(label);
+		}
+		return returnVale;
+	}
+
+	/*鑾峰彇鐩镐綅宸�*/
+	public NA7672LValueVO getPHA(int channelId, int traceId) {
+		NA7672LValueVO returnValue = new NA7672LValueVO();
+		try {
+			this.initTCP();
+			InputStream inputStream = this.socket.getInputStream();
+			OutputStream outputStream = this.socket.getOutputStream();
+			// 鎶婂瓧鑺傛祦杞崲鎴愬瓧绗︽祦
+			PrintWriter printWriter = new PrintWriter(outputStream);
+			Scanner inFromSocket = new Scanner(inputStream);
+			//鍏堣缃Е鍙戞槸杩炵画妯″紡锛岄粯璁ゆ槸鍗曠偣
+			String requestString = ":INIT" + channelId + ":CONT 1";
+			printWriter.println(requestString);
+			printWriter.flush();
+			//鍐嶈缃暟鎹粺璁$姸鎬佽缃负寮�鍚紝榛樿鏄叧闂姸鎬�
+			requestString = ":CALC" + channelId + ":TRAC" + traceId + ":MST 1";
+			printWriter.println(requestString);
+			printWriter.flush();
+			//闇�瑕佹殏鍋滀竴鍒�
+			Thread.sleep(1000);
+			//鑾峰彇鐩镐綅宸�
+			requestString = ":CALC" + channelId + ":TRAC" + traceId + ":MST:DATA?";
+			printWriter.println(requestString);
+			printWriter.flush();
+			String responseString = inFromSocket.next();
+			String[] valList = responseString.split(",");
+			BigDecimal val = new BigDecimal(valList[0]);
+			val.setScale(4, RoundingMode.HALF_UP);
+			returnValue.setDecimalVal(val);
+			returnValue.setLabel("pha_mean");
+			/*绫诲埆闃绘姉銆侀�氶亾銆佽建杩圭嚎銆乵ark*/
+			returnValue.setFetchType(4);
+			returnValue.setChannel(channelId);
+			returnValue.setTrace(traceId);
+			returnValue.setChannel(channelId);
+			returnValue.setMark(-1);
+			this.closeTcp();
+		} catch (IOException e) {
+			e.printStackTrace();
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+		}
+		return returnValue;
+	}
+
+	/*鑾峰彇鐗规�ч樆鎶楄绠楀��*/
+	public NA7672LValueVO getImpedanceCalculateVal(double cycle, double phaValue, double capacity) {
+		//骞冲潎鐗规�ч樆鎶� = 鍛ㄦ湡鏁懊凤紙鐩镐綅宸��/1000000锛壝凤紙鐢靛娴嬶級脳1000
+		NA7672LValueVO returnValue = new NA7672LValueVO();
+		returnValue.setFetchType(5);
+		BigDecimal val = new BigDecimal(cycle / (phaValue / 1000000) / capacity * 1000);
+		BigDecimal newVal = val.setScale(4, RoundingMode.HALF_UP);
+		returnValue.setMeasureValue(newVal);
+		return returnValue;
+	}
+
+
+	/*鑾峰彇鎵�鏈夋暟鍊�*/
+	/*public static void main(String[] args) throws IOException {
+		String serverIp = "10.88.15.169";
+		int serverPort = 5025;
+		NA7672LTCPClientUtils tcpClient = new NA7672LTCPClientUtils(serverIp, serverPort);
+		tcpClient.initMemory("D:/state03.sta");
+		*//*
+		tcpClient.test1();
+		tcpClient.test2();
+		*//*
+		*//*鍗曚釜娴嬭瘯*//*
+		*//*
+		NA7672LValueVO decay = tcpClient.getDecay(1, 1, 1);
+		NA7672LValueVO impedance = tcpClient.getImpedance(2, 1);
+		NA7672LValueVO swr = tcpClient.getSWR(3, 1, 1);
+		NA7672LValueVO pha=tcpClient.getPHA(7,1);
+		*//*
+		*//*鍒楄〃娴嬭瘯*//*
+		*//*List<NA7672LValueVO> decayList = tcpClient.getDecayList(1, 1);
+		List<NA7672LValueVO> swrList = tcpClient.getSWRList(3, 1);*//*
+
+		*//*浣跨敤鐨勬帴鍙f祴璇�*//*
+//		NA7672LValueVO decay = tcpClient.getDecayByLabel(1, 1, "decay_400m", 37.5, 100);
+		NA7672LValueVO impedance = tcpClient.getImpedance(2, 1);
+//		NA7672LValueVO swr = tcpClient.getSWRByLabel(3, 1, "swr_1000m");
+//		NA7672LValueVO pha = tcpClient.getPHA(7, 1);
+//		System.out.println("eqweqwe");
+
+	}*/
+
+}

--
Gitblit v1.9.3