| | |
| | | package com.dy.rtuMw.server.rtuData.p206V1_0_0; |
| | | |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.CommandType; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.CodeV1_0_1; |
| | | import com.dy.rtuMw.server.rtuData.TaskSurpport; |
| | | import com.dy.rtuMw.server.rtuData.dbSv.DbSv; |
| | | import com.dy.common.mw.protocol.Data; |
| | | import com.dy.common.springUtil.SpringContextUtil; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrController; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrControllerTramp; |
| | | import com.dy.rtuMw.web.com.CommandCtrl; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | |
| | | //流浪者控制器 |
| | | controllerTramp = sv.getPrControllerTrampByRtuAddr(rtuAddr); |
| | | if(controllerTramp == null){ |
| | | //第一次发现 |
| | | controllerTramp = new PrControllerTramp(null, rtuAddr, d.getProtocol(), new Date()) ; |
| | | //第一次发现,下发清空RTU历史命令,以使其重新开始记录新地点的数据 |
| | | this.sendClearCommand(rtuAddr, d.protocol); |
| | | } |
| | | } |
| | | //不论是否为流浪控制器(RTU实体),都要进行下步工作,记录其上报的一些数据,当绑定控制器后,数据自动有了归属 |
| | |
| | | log.error("严重错误,未能得到DbSv对象"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 发送清空RTU的命令 |
| | | * @param rtuAddr |
| | | * @param protocol |
| | | */ |
| | | private void sendClearCommand(String rtuAddr, String protocol){ |
| | | Command com = new Command() ; |
| | | com.id = Command.defaultId ; |
| | | com.rtuAddr = rtuAddr ; |
| | | com.protocol = protocol ; |
| | | com.type = CommandType.outerCommand; |
| | | com.code = CodeV1_0_1.cd_91 ;//当前是P206V1_0_0协议的任务 |
| | | com.rtuResultSendWebUrl = Command.ignoreRtuResultSendWebUrl ; |
| | | com.param = null ; |
| | | com.attachment = null ; |
| | | CommandCtrl comCtrl = SpringContextUtil.getBean(CommandCtrl.class) ; |
| | | if(comCtrl != null){ |
| | | comCtrl.sendOutComFromLocal(com) ; |
| | | } |
| | | } |
| | | } |