diff --git a/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java b/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java index e18cb6da..0b712778 100644 --- a/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java +++ b/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java @@ -188,7 +188,7 @@ public class SocketDevResponseService { sendWebSocket(param.getUserPageId(), SourceOperateCodeEnum.Coefficient_Check.getValue(), SourceOperateCodeEnum.small_start.getValue(), XiNumberManager.devParameterList.get(1)); - System.out.println("开始配置小电压电流参数下发给源----------------------"); + System.out.println("第一步结束开始配置小电压电流参数下发给源----------------------"); xiSocket.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue()); xiSocket.setData(JSON.toJSONString(XiNumberManager.xiSourceIssueList.get(1))); SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(xiSocket)); @@ -456,10 +456,14 @@ public class SocketDevResponseService { return percentage <= limit; } - private BigDecimal rangeNum(double num1, double num2) { + private BigDecimal rangeNum(double num1, double num2,String type) { double diff = Math.abs(num1 - num2); double larger = Math.max(num1, num2); - return BigDecimal.valueOf(diff / larger).multiply(BigDecimal.valueOf(100)).setScale(4, RoundingMode.HALF_UP); + if(DicDataEnum.V.getCode().equals(type)){ + return BigDecimal.valueOf(diff / larger).setScale(4, RoundingMode.HALF_UP); + }else { + return BigDecimal.valueOf(diff / larger).multiply(BigDecimal.valueOf(100)).setScale(4, RoundingMode.HALF_UP); + } } @@ -521,12 +525,12 @@ public class SocketDevResponseService { coefficientVO.setBIeXi(isWithinTenPercent(optionalIB, devParameter.getDevCurr(), iLimit) ? "合格" : "不合格"); coefficientVO.setCIeXi(isWithinTenPercent(optionalIC, devParameter.getDevCurr(), iLimit) ? "合格" : "不合格"); - coefficientVO.setAV(rangeNum(optionalA, devParameter.getDevVolt()).toString()); - coefficientVO.setBV(rangeNum(optionalB, devParameter.getDevVolt()).toString()); - coefficientVO.setCV(rangeNum(optionalC, devParameter.getDevVolt()).toString()); - coefficientVO.setAI(rangeNum(optionalIA, devParameter.getDevCurr()).toString()); - coefficientVO.setBI(rangeNum(optionalIB, devParameter.getDevCurr()).toString()); - coefficientVO.setCI(rangeNum(optionalIC, devParameter.getDevCurr()).toString()); + coefficientVO.setAV(rangeNum(optionalA, devParameter.getDevVolt(),DicDataEnum.V.getCode()).toString()); + coefficientVO.setBV(rangeNum(optionalB, devParameter.getDevVolt(),DicDataEnum.V.getCode()).toString()); + coefficientVO.setCV(rangeNum(optionalC, devParameter.getDevVolt(),DicDataEnum.V.getCode()).toString()); + coefficientVO.setAI(rangeNum(optionalIA, devParameter.getDevCurr(),DicDataEnum.I.getCode()).toString()); + coefficientVO.setBI(rangeNum(optionalIB, devParameter.getDevCurr(),DicDataEnum.I.getCode()).toString()); + coefficientVO.setCI(rangeNum(optionalIC, devParameter.getDevCurr(),DicDataEnum.I.getCode()).toString()); if ("不合格".equals(coefficientVO.getAVuXi()) || "不合格".equals(coefficientVO.getBVuXi()) || "不合格".equals(coefficientVO.getCVuXi()) || "不合格".equals(coefficientVO.getAIeXi()) || "不合格".equals(coefficientVO.getBIeXi()) || "不合格".equals(coefficientVO.getCIeXi())) { coefficientVO.setResultFlag(0); diff --git a/detection/src/main/java/com/njcn/gather/detection/pojo/enums/SourceOperateCodeEnum.java b/detection/src/main/java/com/njcn/gather/detection/pojo/enums/SourceOperateCodeEnum.java index 8c7a2cd2..e43a47dc 100644 --- a/detection/src/main/java/com/njcn/gather/detection/pojo/enums/SourceOperateCodeEnum.java +++ b/detection/src/main/java/com/njcn/gather/detection/pojo/enums/SourceOperateCodeEnum.java @@ -55,6 +55,7 @@ public enum SourceOperateCodeEnum { UNKNOWN_OPERATE("unknown_operate","未知的操作返回,请联系管理员排查"), SOCKET_TIMEOUT("socket_timeout","与源或者装置通讯等待超时"), + STOP_TIMEOUT("stop_timeout","暂停时间超过十分钟"), diff --git a/detection/src/main/java/com/njcn/gather/detection/util/socket/cilent/NettyDevClientHandler.java b/detection/src/main/java/com/njcn/gather/detection/util/socket/cilent/NettyDevClientHandler.java index 32a817de..b090c8b6 100644 --- a/detection/src/main/java/com/njcn/gather/detection/util/socket/cilent/NettyDevClientHandler.java +++ b/detection/src/main/java/com/njcn/gather/detection/util/socket/cilent/NettyDevClientHandler.java @@ -153,6 +153,7 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler { System.out.println("当前进入暂停操作超时函数-----------------"+FormalTestManager.stopTime); if(FormalTestManager.stopTime > 600){ CnSocketUtil.quitSend(param); + CnSocketUtil.sendToWebSocket(param.getUserPageId(),SourceOperateCodeEnum.FORMAL_REAL.getValue(),SourceOperateCodeEnum.STOP_TIMEOUT.getValue(),SourceOperateCodeEnum.STOP_TIMEOUT.getMsg(),null); } } }