1.微调相序校验

This commit is contained in:
wr
2024-12-19 20:33:45 +08:00
parent 5cc542e624
commit 8835249c1b
6 changed files with 29 additions and 29 deletions

View File

@@ -235,7 +235,7 @@ public class SocketDevResponseService {
System.out.println("开始相序校验++++++++++"); System.out.println("开始相序校验++++++++++");
PqScriptIssueParam issueParam=new PqScriptIssueParam(); PqScriptIssueParam issueParam=new PqScriptIssueParam();
issueParam.setPlanId(param.getPlanId()); issueParam.setPlanId(param.getPlanId());
issueParam.setSourceId(param.getScriptId()); issueParam.setSourceId(param.getSourceId());
issueParam.setIsPhaseSequence(true); issueParam.setIsPhaseSequence(true);
issueParam.setDevIds(param.getDevIds()); issueParam.setDevIds(param.getDevIds());
List<SourceIssue> sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam); List<SourceIssue> sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam);
@@ -300,6 +300,7 @@ public class SocketDevResponseService {
sourceParam.setPlanId(param.getPlanId()); sourceParam.setPlanId(param.getPlanId());
sourceParam.setDevIds(param.getDevIds()); sourceParam.setDevIds(param.getDevIds());
sourceParam.setIsPhaseSequence(true); sourceParam.setIsPhaseSequence(true);
sourceParam.setSourceId(param.getSourceId());
List<SourceIssue> sourceIssues = scriptDtlsService.listSourceIssue(sourceParam); List<SourceIssue> sourceIssues = scriptDtlsService.listSourceIssue(sourceParam);
List<SourceCompareDev> info = new ArrayList<>(); List<SourceCompareDev> info = new ArrayList<>();
if (CollUtil.isNotEmpty(sourceIssues)) { if (CollUtil.isNotEmpty(sourceIssues)) {
@@ -308,6 +309,15 @@ public class SocketDevResponseService {
} }
} }
xuClear(); xuClear();
String s = param.getUserPageId() + "_Source";
SocketMsg msg= new SocketMsg();
msg.setRequestId(SourceOperateCodeEnum.YJC_YTXJY.getValue());
msg.setOperateCode(SourceOperateCodeEnum.CLOSE_GATHER.getValue());
Map<String,String> map=new HashMap<>(1);
map.put("sourceId",sourceIssues.get(0).getSourceId());
msg.setData(JSON.toJSONString(map));
SocketManager.sendMsg(s, JSON.toJSONString(msg));
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_XUJY.getValue()); socketMsg.setRequestId(SourceOperateCodeEnum.YJC_XUJY.getValue());
socketMsg.setOperateCode(socketDataMsg.getOperateCode()); socketMsg.setOperateCode(socketDataMsg.getOperateCode());
socketMsg.setData(JSON.toJSONString(info)); socketMsg.setData(JSON.toJSONString(info));

View File

@@ -133,7 +133,7 @@ public class SocketSourceResponseService {
phaseSequenceParam.setMoniterIdList(moniterIdList); phaseSequenceParam.setMoniterIdList(moniterIdList);
phaseSequenceParam.setDataType(Arrays.asList("实时数据/电压有效值","实时数据/电流有效值")); phaseSequenceParam.setDataType(Arrays.asList("实时数据/电压有效值","实时数据/电流有效值"));
phaseSequenceParam.setReadCount(1); phaseSequenceParam.setReadCount(1);
phaseSequenceParam.setIgnoreCount(1); phaseSequenceParam.setIgnoreCount(10);
socketMsg.setData(JSON.toJSONString(phaseSequenceParam)); socketMsg.setData(JSON.toJSONString(phaseSequenceParam));
SocketManager.sendMsg(s,JSON.toJSONString(socketMsg)); SocketManager.sendMsg(s,JSON.toJSONString(socketMsg));
break; break;

View File

@@ -32,4 +32,8 @@ public class PreDetectionParam {
*/ */
private String scriptId; private String scriptId;
/**
* 检测脚本Id
*/
private String sourceId;
} }

View File

@@ -103,20 +103,6 @@ public class PreDetectionServiceImpl implements PreDetectionService {
socketDevResponseService.initList(param); socketDevResponseService.initList(param);
if(channel==null || !channel.isActive()){ if(channel==null || !channel.isActive()){
NettyClient.socketClient(ip, port, param.getUserPageId(), new NettySourceClientHandler(param, sourceResponseService)); NettyClient.socketClient(ip, port, param.getUserPageId(), new NettySourceClientHandler(param, sourceResponseService));
}else{
//关闭源
msg= new SocketMsg();
msg.setRequestId(SourceOperateCodeEnum.YJC_YTXJY.getValue());
msg.setOperateCode(SourceOperateCodeEnum.CLOSE_GATHER.getValue());
Map<String,String> map=new HashMap<>(1);
map.put("sourceId",sourceParam.getSourceId());
msg.setData(JSON.toJSONString(map));
SocketManager.sendMsg(s, JSON.toJSONString(msg));
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
} }
msg= new SocketMsg(); msg= new SocketMsg();
msg.setRequestId(SourceOperateCodeEnum.YJC_YTXJY.getValue()); msg.setRequestId(SourceOperateCodeEnum.YJC_YTXJY.getValue());

View File

@@ -53,7 +53,7 @@ public class NettyClient {
//空闲状态的handler //空闲状态的handler
// 添加LineBasedFrameDecoder来按行分割数据 // 添加LineBasedFrameDecoder来按行分割数据
// .addLast(new LineBasedFrameDecoder(10240)) // .addLast(new LineBasedFrameDecoder(10240))
.addLast(new IdleStateHandler(0, 5, 0, TimeUnit.SECONDS)) .addLast(new IdleStateHandler(20, 0, 0, TimeUnit.SECONDS))
.addLast(new StringDecoder(CharsetUtil.UTF_8)) .addLast(new StringDecoder(CharsetUtil.UTF_8))
.addLast(new StringEncoder(CharsetUtil.UTF_8)) .addLast(new StringEncoder(CharsetUtil.UTF_8))
.addLast(handler); .addLast(handler);

View File

@@ -76,7 +76,7 @@ public class NettySourceClientHandler extends SimpleChannelInboundHandler<Strin
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) { public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
//如果是空闲状态事件 //如果是空闲状态事件
if (evt instanceof IdleStateEvent) { if (evt instanceof IdleStateEvent) {
if (((IdleStateEvent) evt).state() == IdleState.WRITER_IDLE) { if (((IdleStateEvent) evt).state() == IdleState.READER_IDLE) {
//发送ping 保持心跳链接 //发送ping 保持心跳链接
SocketMsg msg=new SocketMsg(); SocketMsg msg=new SocketMsg();
msg.setRequestId("yxt"); msg.setRequestId("yxt");