package com.mes.util; public class InsulationParam { public String type; public String description; public String state; // 状态 PASS代表测试通过 public String voltage; // 测试电压 public String testParam; // 测试电阻/电流 public String testTime; // 测试时间 public String result; public InsulationParam(String message) { // 校验 message = message.trim(); if(message.isEmpty()) return; String[] split = message.split(","); if(split.length < 5) return; this.type = split[0].trim(); this.description = "未知"; if(this.type.contains("DCW")) this.description = "直流耐压"; else if(this.type.contains("IR")) this.description = "绝缘电阻"; this.state = split[1].trim(); this.voltage = split[2].trim(); this.testParam = split[3].trim(); this.testTime = split[4].trim().length() > 2 ? split[4].trim().substring(2) : split[4].trim(); if("PASS".equals(this.state)) this.result = "OK"; else this.result = "NG"; } @Override public String toString() { return "InsulationParam{" + "type='" + type + '\'' + ", description='" + description + '\'' + ", state='" + state + '\'' + ", voltage='" + voltage + '\'' + ", testParam='" + testParam + '\'' + ", testTime='" + testTime + '\'' + ", result='" + result + '\'' + '}'; } }