InsulationParam.java 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package com.mes.util;
  2. public class InsulationParam {
  3. public String type;
  4. public String description;
  5. public String state; // 状态 PASS代表测试通过
  6. public String voltage; // 测试电压
  7. public String testParam; // 测试电阻/电流
  8. public String testTime; // 测试时间
  9. public String result;
  10. public InsulationParam(String message) {
  11. // 校验
  12. message = message.trim();
  13. if(message.isEmpty()) return;
  14. String[] split = message.split(",");
  15. if(split.length < 5) return;
  16. this.type = split[0].trim();
  17. this.description = "未知";
  18. if(this.type.contains("DCW")) this.description = "直流耐压";
  19. else if(this.type.contains("IR")) this.description = "绝缘电阻";
  20. this.state = split[1].trim();
  21. this.voltage = split[2].trim();
  22. this.testParam = split[3].trim();
  23. this.testTime = split[4].trim().length() > 2 ? split[4].trim().substring(2) : split[4].trim();
  24. if("PASS".equals(this.state)) this.result = "OK";
  25. else this.result = "NG";
  26. }
  27. @Override
  28. public String toString() {
  29. return "InsulationParam{" +
  30. "type='" + type + '\'' +
  31. ", description='" + description + '\'' +
  32. ", state='" + state + '\'' +
  33. ", voltage='" + voltage + '\'' +
  34. ", testParam='" + testParam + '\'' +
  35. ", testTime='" + testTime + '\'' +
  36. ", result='" + result + '\'' +
  37. '}';
  38. }
  39. }