From 514efa8c5ef56d243f9f1aa1bfd95e661304edd9 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期五, 05 七月 2024 08:43:09 +0800
Subject: [PATCH] p206V1.0.0协议与硬件联调,并修改完善代码。

---
 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V1_0_0/TkPreGenObjs.java |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V1_0_0/TkPreGenObjs.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V1_0_0/TkPreGenObjs.java
index b95b9ef..6770b91 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V1_0_0/TkPreGenObjs.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V1_0_0/TkPreGenObjs.java
@@ -1,11 +1,15 @@
 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;
 
@@ -36,7 +40,10 @@
 				//娴佹氮鑰呮帶鍒跺櫒
 				controllerTramp = sv.getPrControllerTrampByRtuAddr(rtuAddr);
 				if(controllerTramp == null){
+					//绗竴娆″彂鐜�
 					controllerTramp = new PrControllerTramp(null, rtuAddr, d.getProtocol(), new Date()) ;
+					//绗竴娆″彂鐜帮紝涓嬪彂娓呯┖RTU鍘嗗彶鍛戒护锛屼互浣垮叾閲嶆柊寮�濮嬭褰曟柊鍦扮偣鐨勬暟鎹�
+					this.sendClearCommand(rtuAddr, d.protocol);
 				}
 			}
 			//涓嶈鏄惁涓烘祦娴帶鍒跺櫒锛圧TU瀹炰綋锛夛紝閮借杩涜涓嬫宸ヤ綔锛岃褰曞叾涓婃姤鐨勪竴浜涙暟鎹紝褰撶粦瀹氭帶鍒跺櫒鍚庯紝鏁版嵁鑷姩鏈変簡褰掑睘
@@ -46,4 +53,25 @@
 			log.error("涓ラ噸閿欒锛屾湭鑳藉緱鍒癉bSv瀵硅薄");
 		}
 	}
+
+	/**
+	 * 鍙戦�佹竻绌篟TU鐨勫懡浠�
+	 * @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 ;//褰撳墠鏄疨206V1_0_0鍗忚鐨勪换鍔�
+		com.rtuResultSendWebUrl = Command.ignoreRtuResultSendWebUrl ;
+		com.param = null ;
+		com.attachment = null ;
+		CommandCtrl comCtrl = SpringContextUtil.getBean(CommandCtrl.class) ;
+		if(comCtrl != null){
+			comCtrl.sendOutComFromLocal(com) ;
+		}
+	}
 }

--
Gitblit v1.8.0