From 251f61887e8c26db51df7f8d0c3b5464dc1fa6e3 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期二, 03 十二月 2024 16:59:34 +0800 Subject: [PATCH] (1)升级过程中死掉的RTU经过可配置的一段时间后设置成升级失败; (2)升级状态向Remote模块通知时,当升级任务结束后,仍要向remote模块通知可配置的次数; --- pipIrr-platform/pipIrr-global/src/main/resources/application-database-sp.yml | 4 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config(test测试).xml | 4 + pipIrr-platform/pipIrr-global/src/main/resources/application-database-test.yml | 4 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config(ym元谋).xml | 5 + pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/CRC16.java | 21 ++++++ pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeStateReceiverCtrl.java | 4 + pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeTask.java | 35 +++++++++++ pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java | 3 + pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml | 5 + pipIrr-platform/pipIrr-global/src/main/resources/application-database.yml | 2 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config(sp沙盘).xml | 4 + pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeUnitConfigVo.java | 4 + pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeRtuDev.java | 7 ++ pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml | 2 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeManager.java | 50 ++++++++++++++-- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/softUpgrade/state/UpgradeRtu.java | 1 16 files changed, 138 insertions(+), 17 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/softUpgrade/state/UpgradeRtu.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/softUpgrade/state/UpgradeRtu.java index f4bcc93..ef50911 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/softUpgrade/state/UpgradeRtu.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/softUpgrade/state/UpgradeRtu.java @@ -36,6 +36,7 @@ public int currentPackage ;// 褰撳墠涓嬪彂鍗囩骇鍖呮暟 public int currentRamAddr ;// 褰撳墠涓嬪彂鍗囩骇鍖匯TU瀛樺偍鍦板潃 public String lastDownDt ;// 鏈�鍚庝笅鍙戝崌绾ф暟鎹寘鏃堕棿锛坹yyy-mm-dd HH:HH:SS锛� + public Long lastDownDtAt ;// 鏈�鍚庝笅鍙戝崌绾ф暟鎹寘鏃跺埢 public int reTryTimes ;//鍗囩骇涓嶆垚鍔燂紝閲嶈瘯娆℃暟 public boolean isOver ;//鏄惁鍗囩骇杩囩▼缁撴潫锛�1锛氱粨鏉燂紝0锛氭湭缁撴潫 diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/CRC16.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/CRC16.java index 307e1af..d641b85 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/CRC16.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/CRC16.java @@ -5,7 +5,7 @@ @SuppressWarnings("unused") public final class CRC16 { - + /* * 16浣嶇殑CRC鍊兼槸鏃犵鍙蜂袱瀛楄妭鏁存暟锛� * @param b 瀛楄妭鏁扮粍 @@ -150,6 +150,25 @@ byte[] crcBs = new byte[4] ; ByteUtil.int2Bytes_BE(crcBs, crc, 0); System.out.println(ByteUtil.bytes2Hex(crcBs, true)) ; + + // F4 8C 16 + String hex1 = "AA 02 0C AA 16 02 53 01 15 05 99 80 00 00 00 00 10 40 00 20 81 41 00 00 F1 F6 00 00 8B 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8D 41 00 00 00 00 00 00 00 00 00 00 8F 41 00 00 91 41 00 00 93 41 00 00 93 41 00 00 69 23 01 00 93 41 00 00 93 41 00 00 93 41 00 00 93 41 00 00 93 41 00 00 93 41 00 00 93 41 00 00 93 41 00 00 FD 38 01 00 93 41 00 00 6D 39 01 00 DD 39 01 00 93 41 00 00 55 E0 00 00 93 41 00 00 93 41 00 00 93 41 00 00 29 DC 00 00 93 41 00 00 93 41 00 00 93 41 00 00 93 41 00 00 93 41 00 00 93 41 00 00 93 41 00 00 93 41 00 00 93 41 00 00 05 A7 00 00 93 41 00 00 00 F0 02 F8 00 F0 30 F8 0C A0 30 C8 08 38 24 18 2D 18 A2 46 67 1E AB 46 54 46 5D 46 AC 42 01 D1 00 F0 22 F8 7E 46 0F 3E 0F CC B6 46 01 26 33 42 00 D0 FB 1A A2 46 AB 46 33 43 18 47 F8 48 01 00 18 49 01 00 00 23 00 24 00 25 00 26 10 3A 01 D3 78 C1 FB D8 52 07 00 D3 30 C1 00 D5 0B 60 70 47 1F B5 1F BD 10 B5 10 BD 01 F0 44 F9 11 46 FF F7 F7 FF 12 F0 1B F8 01 F0 5C F9 03 B4 FF F7 F2 FF 03 BC 01 F0 91 F9 00 00 70 B5 05 46 0C 46 16 46 02 E0 0F CC 0F C5 10 3E 10 2E FA D2 08 2E 02 D3 03 CC 03 C5 08 3E 04 2E 07 D3 01 CC 01 C5 36 1F 03 E0 21 78 29 70 64 1C 6D 1C 76 1E F9 D2 70 BD 07 48 80 47 07 48 00 47 FE E7 FE E7 FE E7 FE E7 FE E7 FE E7 04 48 05 49 05 4A 06 4B 70 47 00 00 01 37 01 00 C1 40 00 00 10 28 00 20 10 40 00 20 10 30 00 20 10 30 00 20 43 43 51 43 30 B5 5C 18 01 0C 13 0C 0D 46 92 B2 5D 43 80 B2 51 43 2C 19 05 46 55 43 0A 0C 09 04 4D 19 62 41 58 43 01 0C 00 04 40 19 51 41 30 BD FE B5 05 46 10 46 0C 46 18 43 73 D0 AE 46 8C 46 00 20 AD 1A 01 46 9C 41" ; + hex1 = hex1.replaceAll(" ", "") ; + bs = ByteUtil.hex2Bytes(hex1) ; + crc = new CRC16().CRC16_table(bs, 0 , bs.length - 1) ; + crcBs = new byte[4] ; + ByteUtil.int2Bytes_BE(crcBs, crc, 0); + System.out.println(ByteUtil.bytes2Hex(crcBs, true)) ; + + + // 98 D1 16 + String hex2 = "AA 02 0C AA 16 02 53 01 15 05 99 80 00 00 02 00 67 D3 66 46 00 27 01 24 3D 46 B6 1A 9D 41 02 D3 13 46 3A 46 21 24 65 46 76 46 2F 04 36 0C 3E 43 2D 0C B6 1A 9D 41 04 D3 15 0C 1B 04 2B 43 12 04 10 34 65 46 76 46 2F 06 36 0A 3E 43 2D 0A B6 1A 9D 41 04 D3 15 0E 1B 02 2B 43 12 02 08 34 65 46 76 46 2F 07 36 09 3E 43 2D 09 B6 1A 9D 41 04 D3 15 0F 1B 01 2B 43 12 01 24 1D 65 46 76 46 AF 07 B6 08 3E 43 AD 08 B6 1A 9D 41 04 D3 95 0F 9B 00 2B 43 92 00 A4 1C 65 46 76 46 EF 07 76 08 3E 43 6D 08 B6 1A 9D 41 1A D3 92 18 5B 41 64 1C 16 E0 00 18 76 46 65 46 49 41 B7 1A 9D 41 01 91 00 90 09 D3 60 46 B1 1A 98 41 8E 46 84 46 00 98 01 99 00 25 40 1C 69 41 DD 07 52 08 2A 43 5B 08 64 1E E6 D5 72 46 63 46 03 B0 F0 BD FF E7 00 20 01 46 C0 46 C0 46 2A 46 23 46 F5 E7 30 B5 05 46 0B 46 2A 46 1C 78 10 78 52 1C 5B 1C 00 28 01 D0 A0 42 F7 D0 00 2C 03 D0 00 28 02 D0 6D 1C EF E7 28 46 30 BD 00 00 30 B5 44 1C 03 E0 01 78 40 1C 00 29 0D D0 81 07 F9 D1 0B 4B DD 01 04 C8 D1 1A 91 43 29 40 FA D0 00 1B 0A 06 03 D0 C0 1E 30 BD 00 1B 30 BD 0A 04 01 D0 80 1E 30 BD 09 02 FC D0 40 1E 30 BD 00 00 01 01 01 01 F8 B5 04 2A 2C D3 83 07 12 D0 0B 78 49 1C 03 70 40 1C 52 1E 83 07 0B D0 0B 78 49 1C 03 70 40 1C 52 1E 83 07 04 D0 0B 78 49 1C 03 70 40 1C 52 1E 8B 07 9B 0F 05 D0 C9 1A DF 00 20 23 DE 1B 08 C9 0A E0 FF F7 D5 FE F8 BD 1D 46 08 C9 FD 40 1C 46 B4 40 2C 43 10 C0 12 1F 04 2A F5 D2 F3 08 C9 1A 52 1E F0 D4 0B 78 49 1C 03 70 40 1C 52 1E EA D4 0B 78 49 1C 03 70 40 1C 01 2A E4 D4 09 78 01 70 F8 BD 01 E0 04 C0 09 1F 04 29 FB D2 8B 07 01 D5 02 80 80 1C C9 07 00 D0 02 70 70 47 00 29 0B D0 C3 07 02 D0 02 70 40 1C" ; + hex2 = hex2.replaceAll(" ", "") ; + bs = ByteUtil.hex2Bytes(hex2) ; + crc = new CRC16().CRC16_table(bs, 0 , bs.length - 1) ; + crcBs = new byte[4] ; + ByteUtil.int2Bytes_BE(crcBs, crc, 0); + System.out.println(ByteUtil.bytes2Hex(crcBs, true)) ; } } diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/application-database-sp.yml b/pipIrr-platform/pipIrr-global/src/main/resources/application-database-sp.yml index 190348e..ec02735 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/application-database-sp.yml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-database-sp.yml @@ -5,9 +5,9 @@ #name: sp type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.cj.jdbc.Driver -# url: jdbc:mysql://192.168.40.166:3306/pipIrr_sp?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull + url: jdbc:mysql://192.168.40.166:3306/pipIrr_sp?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull # url: jdbc:mysql://8.130.130.233:3306/pipIrr_sp?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull - url: jdbc:mysql://127.0.0.1:3306/pipIrr_sp?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull +# url: jdbc:mysql://127.0.0.1:3306/pipIrr_sp?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull username: root password: dysql,;.abc!@# druid: diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/application-database-test.yml b/pipIrr-platform/pipIrr-global/src/main/resources/application-database-test.yml index 4e972d0..778e7bc 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/application-database-test.yml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-database-test.yml @@ -5,9 +5,9 @@ #name: test type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.cj.jdbc.Driver -# url: jdbc:mysql://192.168.40.166:3306/pipIrr_test?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull + url: jdbc:mysql://192.168.40.166:3306/pipIrr_test?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull # url: jdbc:mysql://8.130.130.233:3306/pipIrr_test?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull - url: jdbc:mysql://127.0.0.1:3306/pipIrr_test?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull +# url: jdbc:mysql://127.0.0.1:3306/pipIrr_test?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull username: root password: dysql,;.abc!@# druid: diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/application-database.yml b/pipIrr-platform/pipIrr-global/src/main/resources/application-database.yml index d9cb7d0..8bbd71d 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/application-database.yml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-database.yml @@ -5,4 +5,4 @@ allow-bean-definition-overriding: true #璁剧疆涓簍rue鏃讹紝鍚庡畾涔夌殑bean浼氳鐩栦箣鍓嶅畾涔夌殑鐩稿悓鍚嶇О鐨刡ean datasource: #閰嶇疆鏁版嵁婧� #澶氫釜鏁版嵁婧愬悕绉板湪姝ら厤缃紝瑕佹眰涓巗pring銆俤atasource銆俒ym][sp][test]涓殑涓�鑷� - names: ym,sp,test + names: ym diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml index c037eec..e4f3b7d 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml @@ -77,7 +77,7 @@ pipIrr: global: - dev: false #鏄惁寮�鍙戦樁娈碉紝true鎴杅alse + dev: true #鏄惁寮�鍙戦樁娈碉紝true鎴杅alse dsName: ym #寮�鍙戦樁娈碉紝璁剧疆涓存椂鐨勬暟鎹簱鍚嶇О nginx: webPort: 54321 diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java index 129aa1f..816c25a 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java @@ -338,12 +338,15 @@ ugVo.enable = conf.getSetAttrBoolean(doc, "config.upgrade", "enable", null, null) ; ugVo.noOneRtuUpgradeMaxDuration = conf.getSetAttrPlusInt(doc, "config.upgrade", "noOneRtuUpgradeMaxDuration", null, 5, 360000, null); ugVo.noOneRtuUpgradeMaxDuration = ugVo.noOneRtuUpgradeMaxDuration * 1000 ;//鍙樻垚姣 + ugVo.runningAndIdleDuration = conf.getSetAttrPlusInt(doc, "config.upgrade", "runningAndIdleDuration", null, 5, 360000, null); + ugVo.runningAndIdleDuration = ugVo.runningAndIdleDuration * 1000 ;//鍙樻垚姣 ugVo.failTryTimes = conf.getSetAttrPlusInt(doc, "config.upgrade", "failTryTimes", null, 0, 100, null); ugVo.ugMaxRtuAtOnce = conf.getSetAttrPlusInt(doc, "config.upgrade", "ugMaxRtuAtOnce", null, 0, 1000000, null); ugVo.rtuOffLineWaitDuration = conf.getSetAttrPlusInt(doc, "config.upgrade", "rtuOffLineWaitDuration", null, 1, 3600000, null); ugVo.rtuOffLineWaitDuration = ugVo.rtuOffLineWaitDuration * 1000;//鍙樻垚姣 ugVo.notifyStateInterval = conf.getSetAttrPlusInt(doc, "config.upgrade", "notifyStateInterval", null, 1, 300, null); ugVo.notifyStateInterval = ugVo.notifyStateInterval * 1000;//鍙樻垚姣 + ugVo.notifyTimesAfterOver = conf.getSetAttrPlusInt(doc, "config.upgrade", "notifyTimesAfterOver", null, 0, null, null); ugVo.showStartInfo = showStartInfo ; AdapterImp_UpgradeUnit ugAdap = new AdapterImp_UpgradeUnit(); ugAdap.setConfig(ugVo); diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeManager.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeManager.java index dc3f161..bd52b71 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeManager.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeManager.java @@ -27,6 +27,8 @@ private Integer failTryTimes ;//鍗囩骇澶辫触鍚庯紝閲嶆柊鍋胯瘯鍗囩骇娆℃暟锛�0琛ㄧず涓嶉噸鏂板伩璇曞崌绾� private Integer ugMaxRtuSameTime ;//鍚屾椂鍗囩骇RTU鏈�澶т釜鏁� + private Integer notifyTimesAfterOver; //鍗囩骇缁撴潫鍚庯紝鍐嶅悜web鏈嶅姟绯荤粺閫氱煡鐘舵�佺殑娆℃暟 + private int nowNotifyTimesAfterOver; //鍗囩骇缁撴潫鍚庯紝鍐嶅悜web鏈嶅姟绯荤粺閫氱煡鐘舵�佺殑娆℃暟 private UpgradeTask task ;//鍗囩骇浠诲姟 private boolean monitorFirst = true ;//鏄惁鏄涓�娆$洃瑙� @@ -45,6 +47,7 @@ public void initOption(UpgradeUnitConfigVo configVo) { this.failTryTimes = configVo.failTryTimes; this.ugMaxRtuSameTime = configVo.ugMaxRtuAtOnce; + this.notifyTimesAfterOver = configVo.notifyTimesAfterOver; } /** @@ -64,6 +67,7 @@ this.task = new UpgradeTask(); this.task.initOption(this.failTryTimes, this.ugMaxRtuSameTime); this.task.setTask(vo); + this.nowNotifyTimesAfterOver = 0 ; log.info("======================================================") ; log.info("= =") ; log.info("=璁剧疆浜嗗崌绾т换鍔★紝娑夊強RTU" + vo.rtuAddrList.size() + "鍙� =") ; @@ -191,6 +195,7 @@ this.stop() ; }else{ if(!this.task.taskIsOver){ + this.nowNotifyTimesAfterOver = 0 ; //鍗囩骇浠诲姟鏈畬鎴� //宸ヤ綔1锛氬垽鏂槸鍚︽棤浠讳綍涓�涓猂TU杩涜杩囧崌绾э紝骞朵笖杈惧埌鏃堕檺锛屽垯璁や负褰撳墠鍗囩骇浠诲姟瀹屾垚 //-1:鏃犱竴RTU鍗囩骇涓旇秴鏃讹紝0锛氭棤RTU鍗囩骇浣嗘湭瓒呮椂绛夊緟锛�1鏈塕TU鍗囩骇姝e父鎵ц @@ -208,27 +213,44 @@ }else if(temp == 1){ //褰撳墠鏈塕TU杩涜杩囧崌绾� //宸ヤ綔2锛氱粺璁″綋鍓嶆鍦ㄥ崌绾х殑RTU鏁伴噺锛屼负鍚屾椂鍗囩骇鏁伴噺闄愬埗鍋氬噯澶� - this.task.countRunningRtuCount() ; + temp = this.task.countRunningRtuCount() ; + if(temp > 0){ + //璇村墠褰撳墠杩樻湁鍗囩骇涓殑RTU + } //宸ヤ綔3锛氱粺璁¢渶瑕佸崌绾т絾褰撳墠绂荤嚎RTU鐨勬儏鍐碉紝瓒呰繃鏃堕檺鐨勮缃负鍗囩骇瀹屾垚 int tmp = this.task.countOffRtuAndSetIfOver() ; if(tmp >= 1){ - //瓒呮椂锛屽己鍒惰缃竴浜汻TU鍗囩骇澶辫触骞朵笖鍗囩骇瀹屾垚锛� + //瓒呮椂锛屽己鍒惰缃竴浜汻TU鍗囩骇澶辫触骞朵笖鍗囩骇瀹屾垚 log.info("======================================================") ; log.info("= =") ; log.info("=鍥犵绾胯秴鏃讹紝寮哄埗璁剧疆" + tmp + "鍙癛TU鍗囩骇澶辫触骞朵笖鍗囩骇瀹屾垚 =") ; log.info("= =") ; log.info("======================================================") ; }else if(tmp == 0){ + /* log.info("======================================================") ; log.info("= =") ; log.info("=绂荤嚎瓒呮椂锛屼絾鏃犱竴鍙癛TU鍥犵绾胯�岃璁剧疆鎴愬崌绾уけ璐ュ苟涓斿崌绾у畬鎴� =") ; log.info("= =") ; log.info("======================================================") ; + */ }else{//tmp = -1 //鏃犱换鍔¢�昏緫 } - //宸ヤ綔4锛氱粺璁℃槸鍚﹀叏閮ㄥ崌绾у畬鎴� + + //宸ヤ綔4锛氱粺璁¤繘琛屽崌绾ц繃绋嬭�屽悗鍙堝仠姝㈠崌绾э紝鍙戝憜涓�瀹氭椂闀跨殑璁惧 + tmp = this.task.countRunningIdleRtuAndSetIfOver() ; + if(tmp >= 1){ + //鍗囩骇鍙戝憜瓒呮椂锛屽己鍒惰缃竴浜汻TU鍗囩骇澶辫触骞朵笖鍗囩骇瀹屾垚 + log.info("======================================================") ; + log.info("= =") ; + log.info("=鍥犲崌绾у彂鍛嗚秴鏃讹紝寮哄埗璁剧疆" + tmp + "鍙癛TU鍗囩骇澶辫触骞朵笖鍗囩骇瀹屾垚 =") ; + log.info("= =") ; + log.info("======================================================") ; + } + + //宸ヤ綔5锛氱粺璁℃槸鍚﹀叏閮ㄥ崌绾у畬鎴� this.task.taskIsOver = this.task.countIsAllOver() ; if(this.task.taskIsOver){ log.info("==================================================") ; @@ -247,24 +269,38 @@ this.task.taskOverDt = DateTime.yyyy_MM_dd_HH_mm_ss() ;//浠诲姟瀹屾垚鏃堕棿(yyyy-mm-dd HH:MM:SS) } //浠诲姟瀹屾垚锛屾墽琛屾渶鍚庝竴娆″崌绾х姸鎬侀�氱煡 - //宸ヤ綔5锛氬崌绾х姸鎬侀�氱煡 + //宸ヤ綔6锛氬崌绾х姸鎬侀�氱煡 //if(!first){ // this.notifyUpgradeStatus() ; //} }else{ //浠诲姟鏈畬鎴愶紝缁х画鎵ц鍗囩骇鐘舵�侀�氱煡 - //宸ヤ綔5锛� 鍗囩骇鐘舵�侀�氱煡 + //宸ヤ綔6锛� 鍗囩骇鐘舵�侀�氱煡 //if(!first){ // this.notifyUpgradeStatus() ; //} } - //宸ヤ綔5锛氬崌绾х姸鎬侀�氱煡 + //宸ヤ綔6锛氬崌绾х姸鎬侀�氱煡 if(!this.monitorFirst){ this.notifyUpgradeStatus() ; } }else{ //浠诲姟宸茬粡瀹屾垚 - this.stop(); + //宸ヤ綔6锛氫换鍔$粨鏉熷悗锛屾渶鍚庡彂鍗囩骇鐘舵�侀�氱煡 + if(this.nowNotifyTimesAfterOver == 0){ + this.nowNotifyTimesAfterOver++ ; + this.notifyUpgradeStatus() ;//蹇呴』閫氱煡涓�娆� + }else{ + //鐒跺悗閲嶅閫氱煡 + if(this.nowNotifyTimesAfterOver <= this.notifyTimesAfterOver){ + //淇濊瘉涓婇潰蹇呴』閫氱煡涓�娆★紝閭f澶勪笂闈f涓氨寰楃敤<= + this.nowNotifyTimesAfterOver++ ; + this.notifyUpgradeStatus() ; + }else{ + this.stop(); + } + } + } } if(this.monitorFirst){ diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeRtuDev.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeRtuDev.java index 8e02203..6b12947 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeRtuDev.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeRtuDev.java @@ -39,6 +39,7 @@ this.currentPackage = 0 ; this.currentRamAddr = 0 ; this.lastDownDt = "" ; + this.lastDownDtAt = 0L ; this.reTryTimes = 0 ; this.isOver = false ; } @@ -53,6 +54,7 @@ this.currentPackage = 0 ; this.currentRamAddr = 0 ; this.lastDownDt = "" ; + this.lastDownDtAt = 0L ; this.reTryTimes = 0 ; this.isOver = false ; } @@ -76,6 +78,7 @@ if(code.equals(UpgradeCode.cd_9601)){ //涓嬪彂閰嶇疆杩斿洖 this.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ; + this.lastDownDtAt = System.currentTimeMillis() ; callbackCom.call(createCommand1602(protocolName, protocolVersion, currentPackage, currentRamAddr, softData));//涓嬪彂鏁版嵁鍖呮寚浠� }else if(code.equals(UpgradeCode.cd_9602)){ //涓嬪彂鏁版嵁鍖呰繑鍥� @@ -83,9 +86,11 @@ currentRamAddr += RAMADDRADD ; if(currentPackage < totalPackage){ this.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ; + this.lastDownDtAt = System.currentTimeMillis() ; callbackCom.call(createCommand1602(protocolName, protocolVersion, currentPackage, currentRamAddr, softData)); }else{ this.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ; + this.lastDownDtAt = System.currentTimeMillis() ; callbackCom.call(createCommand1603(protocolName, protocolVersion));//涓嬪彂鏍¢獙鎸囦护 } }else if(code.equals(UpgradeCode.cd_9603)){ @@ -141,6 +146,7 @@ this.currentRamAddr = 0 ; this.isOver = false ; this.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ; + this.lastDownDtAt = System.currentTimeMillis() ; } /** @@ -150,6 +156,7 @@ this.isOver = true ;//鍗囩骇瀹屾垚 this.state = STATE_SUCCESS ; this.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ; + this.lastDownDtAt = System.currentTimeMillis() ; } @Override diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeTask.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeTask.java index b4707e6..81fa856 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeTask.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeTask.java @@ -311,7 +311,7 @@ /** * 缁熻褰撳墠姝e湪鍗囩骇鐨凴TU鏁伴噺锛屼负鍚屾椂鍗囩骇鏁伴噺闄愬埗鍋氬噯澶� */ - protected void countRunningRtuCount(){ + protected int countRunningRtuCount(){ int runningTotal = 0 ; Collection<UpgradeRtu> col = this.upgradeRtus.values() ; for(UpgradeRtu info : col){ @@ -319,7 +319,7 @@ runningTotal ++ ; } } - this.curUgRunningRtuTotal = runningTotal ; + return this.curUgRunningRtuTotal = runningTotal ; } /** @@ -348,6 +348,37 @@ } /** + * 缁熻:宸茬粡杩涘崌绾т絾RTU鍙堣繘鍏ュ仠姝㈠崌绾у彂鍛嗙姸鎬侊紝瓒呰繃涓�瀹氭椂闄愶紝璁剧疆璁惧涓�鍖呮鎴栧鍖呮锛屽苟璁剧疆涓哄崌绾у畬鎴� + * @return -1:娌℃湁瓒呮椂锛�0瓒呮椂浜嗕笖鏃犲洜绂荤嚎琚己鍒惰缃崌绾у畬鎴愮殑RTU锛�>0绂荤嚎琚己鍒惰缃崌绾у畬鎴愮殑RTU鏁伴噺 + */ + protected int countRunningIdleRtuAndSetIfOver() { + Long now = System.currentTimeMillis() ; + int count = -1 ; + if(now - this.setupDtLong > UpgradeUnit.confVo.rtuOffLineWaitDuration){ + //璁剧疆涓婂彞锛岄槻姝㈤绻佽繘鍏ヤ笅闈㈣鍙ヨ繘琛岃绠� + if (this.taskVo.rtuAddrList != null && this.taskVo.rtuAddrList.size() > 0) { + Collection<UpgradeRtu> col = this.upgradeRtus.values() ; + for(UpgradeRtu info : col){ + if(info.state == UpgradeRtu.STATE_RUNNING && info.isOver == false){ + //鍗囩骇涓紝浣嗘湭鍗囩骇瀹屾垚 + if(now - info.lastDownDtAt > UpgradeUnit.confVo.runningAndIdleDuration){ + if(info.currentPackage <= 1){ + //涓�鍖呮 + info.state = UpgradeRtu.STATE_FAILONE ; + }else{ + //澶氬寘姝� + info.state = UpgradeRtu.STATE_FAIL ; + } + info.isOver = true ; + count ++ ; + } + } + } + } + } + return count ; + } + /** * 缁熻鏄惁鍗囩骇鍏ㄩ儴缁撴潫 */ protected boolean countIsAllOver() { diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeUnitConfigVo.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeUnitConfigVo.java index 45462aa..dcd84f7 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeUnitConfigVo.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeUnitConfigVo.java @@ -10,17 +10,21 @@ public Boolean showStartInfo ; public Boolean enable ;//妯″潡鏄惁鍚姩 public Integer noOneRtuUpgradeMaxDuration ;//鍗囩骇浠诲姟璁剧疆鍚庯紝娌℃湁璁惧鍗囩骇鏈�澶ф椂闀匡紙姣锛夛紝瓒呰繃杩欎釜鏃堕暱锛岃涓哄崌绾т换鍔″畬鎴愶紝鍙栧�艰寖鍥存槸5鍒嗛挓~60鍒嗛挓 + public Integer runningAndIdleDuration ;//rtu鍗囩骇鍚姩鍚庤繘鍏ュ崌绾т腑鐘舵�侊紝浣嗘煇绉嶆儏鍐典笅RTU涓嶅啀閫氫俊浜嗭紝涓�鐩村浜庣瓑寰呯姸鎬侊紝绛夊緟杈惧埌涓�瀹氭椂闀匡紙绉掞級璁や负鍗囩骇澶辫触锛堜竴鍖呮鎴栧鍖呮锛夛紝鍙栧�艰寖鍥存槸5鍒嗛挓~60鍒嗛挓 public Integer failTryTimes ;//鍗囩骇澶辫触鍚庯紙閽堝鐨勬槸鍦ㄧ嚎杩涜浜嗗崌绾т笅鍙戝懡浠わ級锛岄噸鏂板伩璇曞崌绾ф鏁帮紝0琛ㄧず涓嶉噸鏂板伩璇曞崌绾� public Integer ugMaxRtuAtOnce;//涓轰簡缂撹В閫氫俊涓棿浠剁殑鍘嬪姏锛屽悓鏃舵敮鎸佸崌绾х殑RTU鍙版暟 public Integer rtuOffLineWaitDuration;//rtu绂荤嚎锛岀瓑寰呭叾鍗囩骇鐨勬椂闀�(姣)锛岃秴杩囪繖涓椂闂达紝璁剧疆鍏跺崌绾уけ璐ワ紝涓旇缃崌绾т换鍔″畬鎴� public Integer notifyStateInterval;//鍗囩骇鐘舵�侀�氱煡闂撮殧锛堟绉掞級 + public Integer notifyTimesAfterOver;//鍗囩骇缁撴潫鍚庯紝鍐嶅悜web鏈嶅姟绯荤粺閫氱煡鐘舵�佺殑娆℃暟 public UpgradeUnitConfigVo(){ this.enable = false ; this.noOneRtuUpgradeMaxDuration = 10 * 60 * 1000 ; + this.runningAndIdleDuration = 10 * 60 * 1000 ; this.failTryTimes = 0 ; this.ugMaxRtuAtOnce = Integer.MAX_VALUE ; this.rtuOffLineWaitDuration = 10 * 60 * 60 * 1000 ; this.notifyStateInterval = 2000 ; + this.notifyTimesAfterOver = 0 ; } } diff --git "a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050sp\346\262\231\347\233\230\051.xml" "b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050sp\346\262\231\347\233\230\051.xml" index 63e7bc1..0dc339e 100644 --- "a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050sp\346\262\231\347\233\230\051.xml" +++ "b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050sp\346\262\231\347\233\230\051.xml" @@ -57,17 +57,21 @@ <!-- RTU 杞欢鍗囩骇 enable: 妯″潡鏄惁鍚姩 noOneRtuUpgradeMaxDuration锛氬崌绾т换鍔¤缃悗锛屾棤涓�璁惧鍗囩骇鏈�澶ф椂闀匡紙绉掞級锛岃秴杩囪繖涓椂闀匡紝璁や负鍗囩骇浠诲姟瀹屾垚锛屽彇鍊艰寖鍥存槸5鍒嗛挓~60鍒嗛挓 + runningAndIdleDuration锛歳tu鍗囩骇鍚姩鍚庤繘鍏ュ崌绾т腑鐘舵�侊紝浣嗘煇绉嶆儏鍐典笅RTU涓嶅啀閫氫俊浜嗭紝涓�鐩村浜庣瓑寰呯姸鎬侊紝绛夊緟杈惧埌涓�瀹氭椂闀匡紙绉掞紝涓�鑸笌noOneRtuUpgradeMaxDuration鐩哥瓑锛夎涓哄崌绾уけ璐ワ紙涓�鍖呮鎴栧鍖呮锛夛紝鍙栧�艰寖鍥存槸5鍒嗛挓~60鍒嗛挓 failTryTimes锛氬崌绾уけ璐ュ悗锛堥拡瀵圭殑鏄湪绾胯繘琛屼簡鍗囩骇涓嬪彂鍛戒护锛夛紝閲嶆柊鍋胯瘯鍗囩骇娆℃暟锛屽綋璁剧疆涓�0鏃惰〃绀轰笉閲嶆柊鍋胯瘯鍗囩骇 ugMaxRtuAtOnce锛氫负浜嗙紦瑙i�氫俊涓棿浠剁殑鍘嬪姏锛屽悓鏃舵敮鎸佸崌绾х殑RTU鍙版暟锛屽綋璁剧疆涓�0鏃惰〃绀轰笉鍙楅檺鍒� rtuOffLineWaitDuration: rtu绂荤嚎锛岀瓑寰呭叾鍗囩骇鐨勬椂闀匡紙绉掞級锛岃秴杩囪繖涓椂闂达紝璁剧疆鍏跺崌绾уけ璐ワ紝涓旇缃崌绾т换鍔″畬鎴� notifyStateInterval: 鍗囩骇鐘舵�侀�氱煡闂撮殧锛堢锛� + notifyTimesAfterOver: 鍗囩骇缁撴潫鍚庯紝鍐嶅悜web鏈嶅姟绯荤粺閫氱煡鐘舵�佺殑娆℃暟 --> <upgrade enable="true" noOneRtuUpgradeMaxDuration="1200" + runningAndIdleDuration="1200" failTryTimes="2" ugMaxRtuAtOnce="5000" rtuOffLineWaitDuration="1800" notifyStateInterval="2" + notifyTimesAfterOver="1" /> <!-- diff --git "a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050test\346\265\213\350\257\225\051.xml" "b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050test\346\265\213\350\257\225\051.xml" index 79b9715..e51b322 100644 --- "a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050test\346\265\213\350\257\225\051.xml" +++ "b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050test\346\265\213\350\257\225\051.xml" @@ -57,17 +57,21 @@ <!-- RTU 杞欢鍗囩骇 enable: 妯″潡鏄惁鍚姩 noOneRtuUpgradeMaxDuration锛氬崌绾т换鍔¤缃悗锛屾棤涓�璁惧鍗囩骇鏈�澶ф椂闀匡紙绉掞級锛岃秴杩囪繖涓椂闀匡紝璁や负鍗囩骇浠诲姟瀹屾垚锛屽彇鍊艰寖鍥存槸5鍒嗛挓~60鍒嗛挓 + runningAndIdleDuration锛歳tu鍗囩骇鍚姩鍚庤繘鍏ュ崌绾т腑鐘舵�侊紝浣嗘煇绉嶆儏鍐典笅RTU涓嶅啀閫氫俊浜嗭紝涓�鐩村浜庣瓑寰呯姸鎬侊紝绛夊緟杈惧埌涓�瀹氭椂闀匡紙绉掞紝涓�鑸笌noOneRtuUpgradeMaxDuration鐩哥瓑锛夎涓哄崌绾уけ璐ワ紙涓�鍖呮鎴栧鍖呮锛夛紝鍙栧�艰寖鍥存槸5鍒嗛挓~60鍒嗛挓 failTryTimes锛氬崌绾уけ璐ュ悗锛堥拡瀵圭殑鏄湪绾胯繘琛屼簡鍗囩骇涓嬪彂鍛戒护锛夛紝閲嶆柊鍋胯瘯鍗囩骇娆℃暟锛屽綋璁剧疆涓�0鏃惰〃绀轰笉閲嶆柊鍋胯瘯鍗囩骇 ugMaxRtuAtOnce锛氫负浜嗙紦瑙i�氫俊涓棿浠剁殑鍘嬪姏锛屽悓鏃舵敮鎸佸崌绾х殑RTU鍙版暟锛屽綋璁剧疆涓�0鏃惰〃绀轰笉鍙楅檺鍒� rtuOffLineWaitDuration: rtu绂荤嚎锛岀瓑寰呭叾鍗囩骇鐨勬椂闀匡紙绉掞級锛岃秴杩囪繖涓椂闂达紝璁剧疆鍏跺崌绾уけ璐ワ紝涓旇缃崌绾т换鍔″畬鎴� notifyStateInterval: 鍗囩骇鐘舵�侀�氱煡闂撮殧锛堢锛� + notifyTimesAfterOver: 鍗囩骇缁撴潫鍚庯紝鍐嶅悜web鏈嶅姟绯荤粺閫氱煡鐘舵�佺殑娆℃暟 --> <upgrade enable="true" noOneRtuUpgradeMaxDuration="1200" + runningAndIdleDuration="1200" failTryTimes="2" ugMaxRtuAtOnce="5000" rtuOffLineWaitDuration="1800" notifyStateInterval="2" + notifyTimesAfterOver="1" /> <!-- diff --git "a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050ym\345\205\203\350\260\213\051.xml" "b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050ym\345\205\203\350\260\213\051.xml" index 263c8f3..289bac9 100644 --- "a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050ym\345\205\203\350\260\213\051.xml" +++ "b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config\050ym\345\205\203\350\260\213\051.xml" @@ -57,19 +57,24 @@ <!-- RTU 杞欢鍗囩骇 enable: 妯″潡鏄惁鍚姩 noOneRtuUpgradeMaxDuration锛氬崌绾т换鍔¤缃悗锛屾棤涓�璁惧鍗囩骇鏈�澶ф椂闀匡紙绉掞級锛岃秴杩囪繖涓椂闀匡紝璁や负鍗囩骇浠诲姟瀹屾垚锛屽彇鍊艰寖鍥存槸5鍒嗛挓~60鍒嗛挓 + runningAndIdleDuration锛歳tu鍗囩骇鍚姩鍚庤繘鍏ュ崌绾т腑鐘舵�侊紝浣嗘煇绉嶆儏鍐典笅RTU涓嶅啀閫氫俊浜嗭紝涓�鐩村浜庣瓑寰呯姸鎬侊紝绛夊緟杈惧埌涓�瀹氭椂闀匡紙绉掞紝涓�鑸笌noOneRtuUpgradeMaxDuration鐩哥瓑锛夎涓哄崌绾уけ璐ワ紙涓�鍖呮鎴栧鍖呮锛夛紝鍙栧�艰寖鍥存槸5鍒嗛挓~60鍒嗛挓 failTryTimes锛氬崌绾уけ璐ュ悗锛堥拡瀵圭殑鏄湪绾胯繘琛屼簡鍗囩骇涓嬪彂鍛戒护锛夛紝閲嶆柊鍋胯瘯鍗囩骇娆℃暟锛屽綋璁剧疆涓�0鏃惰〃绀轰笉閲嶆柊鍋胯瘯鍗囩骇 ugMaxRtuAtOnce锛氫负浜嗙紦瑙i�氫俊涓棿浠剁殑鍘嬪姏锛屽悓鏃舵敮鎸佸崌绾х殑RTU鍙版暟锛屽綋璁剧疆涓�0鏃惰〃绀轰笉鍙楅檺鍒� rtuOffLineWaitDuration: rtu绂荤嚎锛岀瓑寰呭叾鍗囩骇鐨勬椂闀匡紙绉掞級锛岃秴杩囪繖涓椂闂达紝璁剧疆鍏跺崌绾уけ璐ワ紝涓旇缃崌绾т换鍔″畬鎴� notifyStateInterval: 鍗囩骇鐘舵�侀�氱煡闂撮殧锛堢锛� + notifyTimesAfterOver: 鍗囩骇缁撴潫鍚庯紝鍐嶅悜web鏈嶅姟绯荤粺閫氱煡鐘舵�佺殑娆℃暟 --> <upgrade enable="true" noOneRtuUpgradeMaxDuration="1200" + runningAndIdleDuration="1200" failTryTimes="2" ugMaxRtuAtOnce="5000" rtuOffLineWaitDuration="1800" notifyStateInterval="2" + notifyTimesAfterOver="1" /> + <!-- 鏀寔妯″潡 鐭伐浣滄椂闀跨嚎绋嬫睜锛岀嚎绋嬭礋璐g敤鏃惰緝鐭殑宸ヤ綔浠诲姟 diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml index 263c8f3..181dafb 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml @@ -57,19 +57,22 @@ <!-- RTU 杞欢鍗囩骇 enable: 妯″潡鏄惁鍚姩 noOneRtuUpgradeMaxDuration锛氬崌绾т换鍔¤缃悗锛屾棤涓�璁惧鍗囩骇鏈�澶ф椂闀匡紙绉掞級锛岃秴杩囪繖涓椂闀匡紝璁や负鍗囩骇浠诲姟瀹屾垚锛屽彇鍊艰寖鍥存槸5鍒嗛挓~60鍒嗛挓 + runningAndIdleDuration锛歳tu鍗囩骇鍚姩鍚庤繘鍏ュ崌绾т腑鐘舵�侊紝浣嗘煇绉嶆儏鍐典笅RTU涓嶅啀閫氫俊浜嗭紝涓�鐩村浜庣瓑寰呯姸鎬侊紝绛夊緟杈惧埌涓�瀹氭椂闀匡紙绉掞紝涓�鑸笌noOneRtuUpgradeMaxDuration鐩哥瓑锛夎涓哄崌绾уけ璐ワ紙涓�鍖呮鎴栧鍖呮锛夛紝鍙栧�艰寖鍥存槸5鍒嗛挓~60鍒嗛挓 failTryTimes锛氬崌绾уけ璐ュ悗锛堥拡瀵圭殑鏄湪绾胯繘琛屼簡鍗囩骇涓嬪彂鍛戒护锛夛紝閲嶆柊鍋胯瘯鍗囩骇娆℃暟锛屽綋璁剧疆涓�0鏃惰〃绀轰笉閲嶆柊鍋胯瘯鍗囩骇 ugMaxRtuAtOnce锛氫负浜嗙紦瑙i�氫俊涓棿浠剁殑鍘嬪姏锛屽悓鏃舵敮鎸佸崌绾х殑RTU鍙版暟锛屽綋璁剧疆涓�0鏃惰〃绀轰笉鍙楅檺鍒� rtuOffLineWaitDuration: rtu绂荤嚎锛岀瓑寰呭叾鍗囩骇鐨勬椂闀匡紙绉掞級锛岃秴杩囪繖涓椂闂达紝璁剧疆鍏跺崌绾уけ璐ワ紝涓旇缃崌绾т换鍔″畬鎴� notifyStateInterval: 鍗囩骇鐘舵�侀�氱煡闂撮殧锛堢锛� + notifyTimesAfterOver: 鍗囩骇缁撴潫鍚庯紝鍐嶅悜web鏈嶅姟绯荤粺閫氱煡鐘舵�佺殑娆℃暟 --> <upgrade enable="true" noOneRtuUpgradeMaxDuration="1200" + runningAndIdleDuration="1200" failTryTimes="2" ugMaxRtuAtOnce="5000" rtuOffLineWaitDuration="1800" notifyStateInterval="2" + notifyTimesAfterOver="1" /> - <!-- 鏀寔妯″潡 鐭伐浣滄椂闀跨嚎绋嬫睜锛岀嚎绋嬭礋璐g敤鏃惰緝鐭殑宸ヤ綔浠诲姟 diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeStateReceiverCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeStateReceiverCtrl.java index 37a7fee..a31da14 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeStateReceiverCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeStateReceiverCtrl.java @@ -241,6 +241,7 @@ rtu.currentPackage = 0 ; rtu.currentRamAddr = 0x00 ; rtu.lastDownDt = "" ; + rtu.lastDownDtAt = 0L ; rtu.reTryTimes = 0 ; rtu.isOver = false ; }else{ @@ -248,6 +249,7 @@ rtu.currentPackage = 1 ; rtu.currentRamAddr = 0x00 ; rtu.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ; + rtu.lastDownDtAt = System.currentTimeMillis() ; rtu.reTryTimes = 0 ; rtu.isOver = false ; } @@ -298,6 +300,7 @@ rtu.currentPackage = 1 ; rtu.currentRamAddr = 0x00 ; rtu.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ; + rtu.lastDownDtAt = System.currentTimeMillis() ; rtu.reTryTimes++ ; rtu.isOver = false ; return ; @@ -310,6 +313,7 @@ rtu.currentPackage += 1 ; rtu.currentRamAddr = 0x00 + UpgradeRtu.RAMADDRADD ; rtu.lastDownDt = DateTime.yyyy_MM_dd_HH_mm_ss() ; + rtu.lastDownDtAt = System.currentTimeMillis() ; rtu.isOver = false ; } -- Gitblit v1.8.0