(1)升级过程中死掉的RTU经过可配置的一段时间后设置成升级失败;
(2)升级状态向Remote模块通知时,当升级任务结束后,仍要向remote模块通知可配置的次数;
16个文件已修改
155 ■■■■ 已修改文件
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/softUpgrade/state/UpgradeRtu.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/CRC16.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-database-sp.yml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-database-test.yml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-database.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeManager.java 50 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeRtuDev.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeTask.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeUnitConfigVo.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config(sp沙盘).xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config(test测试).xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config(ym元谋).xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeStateReceiverCtrl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/softUpgrade/state/UpgradeRtu.java
@@ -36,6 +36,7 @@
    public int currentPackage ;// å½“前下发升级包数
    public int currentRamAddr ;// å½“前下发升级包RTU存储地址
    public String lastDownDt ;// æœ€åŽä¸‹å‘升级数据包时间(yyyy-mm-dd HH:HH:SS)
    public Long lastDownDtAt ;// æœ€åŽä¸‹å‘升级数据包时刻
    public int reTryTimes ;//升级不成功,重试次数
    public boolean isOver ;//是否升级过程结束,1:结束,0:未结束
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)) ;
    }
}
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:
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:
pipIrr-platform/pipIrr-global/src/main/resources/application-database.yml
@@ -5,4 +5,4 @@
        allow-bean-definition-overriding: true #设置为true时,后定义的bean会覆盖之前定义的相同名称的bean
    datasource: #配置数据源
        #多个数据源名称在此配置,要求与spring。datasource。[ym][sp][test]中的一致
        names: ym,sp,test
        names: ym
pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml
@@ -77,7 +77,7 @@
pipIrr:
    global:
        dev: false  #是否开发阶段,true或false
        dev: true  #是否开发阶段,true或false
        dsName: ym  #开发阶段,设置临时的数据库名称
    nginx:
        webPort: 54321
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);
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:判断是否无任何一个RTU进行过升级,并且达到时限,则认为当前升级任务完成
                //-1:无一RTU升级且超时,0:无RTU升级但未超时等待,1有RTU升级正常执行
@@ -208,27 +213,44 @@
                }else if(temp == 1){
                    //当前有RTU进行过升级
                    //工作2:统计当前正在升级的RTU数量,为同时升级数量限制做准备
                    this.task.countRunningRtuCount() ;
                    temp = this.task.countRunningRtuCount() ;
                    if(temp > 0){
                        //说前当前还有升级中的RTU
                    }
                    //工作3:统计需要升级但当前离线RTU的情况,超过时限的设置为升级完成
                    int tmp = this.task.countOffRtuAndSetIfOver() ;
                    if(tmp >= 1){
                        //超时,强制设置一些RTU升级失败并且升级完成)
                        //超时,强制设置一些RTU升级失败并且升级完成
                        log.info("======================================================") ;
                        log.info("=                                                    =") ;
                        log.info("=因离线超时,强制设置" + tmp + "台RTU升级失败并且升级完成            =") ;
                        log.info("=                                                    =") ;
                        log.info("======================================================") ;
                    }else if(tmp == 0){
                        /*
                        log.info("======================================================") ;
                        log.info("=                                                    =") ;
                        log.info("=离线超时,但无一台RTU因离线而被设置成升级失败并且升级完成     =") ;
                        log.info("=                                                    =") ;
                        log.info("======================================================") ;
                         */
                    }else{//tmp = -1
                        //无任务逻辑
                    }
                    //工作4:统计是否全部升级完成
                    //工作4:统计进行升级过程而后又停止升级,发呆一定时长的设备
                    tmp = this.task.countRunningIdleRtuAndSetIfOver() ;
                    if(tmp >= 1){
                        //升级发呆超时,强制设置一些RTU升级失败并且升级完成
                        log.info("======================================================") ;
                        log.info("=                                                    =") ;
                        log.info("=因升级发呆超时,强制设置" + tmp + "台RTU升级失败并且升级完成          =") ;
                        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){
                        //保证上面必须通知一次,那此处上面if中就得用<=
                        this.nowNotifyTimesAfterOver++ ;
                        this.notifyUpgradeStatus() ;
                    }else{
                        this.stop();
                    }
                }
            }
        }
        if(this.monitorFirst){
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
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeTask.java
@@ -311,7 +311,7 @@
    /**
     * ç»Ÿè®¡å½“前正在升级的RTU数量,为同时升级数量限制做准备
     */
    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() {
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 ;
    }
}
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config(spɳÅÌ).xml
@@ -57,17 +57,21 @@
    <!-- RTU è½¯ä»¶å‡çº§
    enable: æ¨¡å—是否启动
    noOneRtuUpgradeMaxDuration:升级任务设置后,无一设备升级最大时长(秒),超过这个时长,认为升级任务完成,取值范围是5分钟~60分钟
    runningAndIdleDuration:rtu升级启动后进入升级中状态,但某种情况下RTU不再通信了,一直处于等待状态,等待达到一定时长(秒,一般与noOneRtuUpgradeMaxDuration相等)认为升级失败(一包死或多包死),取值范围是5分钟~60分钟
    failTryTimes:升级失败后(针对的是在线进行了升级下发命令),重新偿试升级次数,当设置为0时表示不重新偿试升级
    ugMaxRtuAtOnce:为了缓解通信中间件的压力,同时支持升级的RTU台数,当设置为0时表示不受限制
    rtuOffLineWaitDuration: rtu离线,等待其升级的时长(秒),超过这个时间,设置其升级失败,且设置升级任务完成
    notifyStateInterval: å‡çº§çŠ¶æ€é€šçŸ¥é—´éš”ï¼ˆç§’ï¼‰
    notifyTimesAfterOver: å‡çº§ç»“束后,再向web服务系统通知状态的次数
    -->
    <upgrade enable="true"
             noOneRtuUpgradeMaxDuration="1200"
             runningAndIdleDuration="1200"
             failTryTimes="2"
             ugMaxRtuAtOnce="5000"
             rtuOffLineWaitDuration="1800"
             notifyStateInterval="2"
             notifyTimesAfterOver="1"
    />
    <!--
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config(test²âÊÔ).xml
@@ -57,17 +57,21 @@
    <!-- RTU è½¯ä»¶å‡çº§
    enable: æ¨¡å—是否启动
    noOneRtuUpgradeMaxDuration:升级任务设置后,无一设备升级最大时长(秒),超过这个时长,认为升级任务完成,取值范围是5分钟~60分钟
    runningAndIdleDuration:rtu升级启动后进入升级中状态,但某种情况下RTU不再通信了,一直处于等待状态,等待达到一定时长(秒,一般与noOneRtuUpgradeMaxDuration相等)认为升级失败(一包死或多包死),取值范围是5分钟~60分钟
    failTryTimes:升级失败后(针对的是在线进行了升级下发命令),重新偿试升级次数,当设置为0时表示不重新偿试升级
    ugMaxRtuAtOnce:为了缓解通信中间件的压力,同时支持升级的RTU台数,当设置为0时表示不受限制
    rtuOffLineWaitDuration: rtu离线,等待其升级的时长(秒),超过这个时间,设置其升级失败,且设置升级任务完成
    notifyStateInterval: å‡çº§çŠ¶æ€é€šçŸ¥é—´éš”ï¼ˆç§’ï¼‰
    notifyTimesAfterOver: å‡çº§ç»“束后,再向web服务系统通知状态的次数
    -->
    <upgrade enable="true"
             noOneRtuUpgradeMaxDuration="1200"
             runningAndIdleDuration="1200"
             failTryTimes="2"
             ugMaxRtuAtOnce="5000"
             rtuOffLineWaitDuration="1800"
             notifyStateInterval="2"
             notifyTimesAfterOver="1"
    />
    <!--
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config(ymԪı).xml
@@ -57,19 +57,24 @@
    <!-- RTU è½¯ä»¶å‡çº§
    enable: æ¨¡å—是否启动
    noOneRtuUpgradeMaxDuration:升级任务设置后,无一设备升级最大时长(秒),超过这个时长,认为升级任务完成,取值范围是5分钟~60分钟
    runningAndIdleDuration:rtu升级启动后进入升级中状态,但某种情况下RTU不再通信了,一直处于等待状态,等待达到一定时长(秒,一般与noOneRtuUpgradeMaxDuration相等)认为升级失败(一包死或多包死),取值范围是5分钟~60分钟
    failTryTimes:升级失败后(针对的是在线进行了升级下发命令),重新偿试升级次数,当设置为0时表示不重新偿试升级
    ugMaxRtuAtOnce:为了缓解通信中间件的压力,同时支持升级的RTU台数,当设置为0时表示不受限制
    rtuOffLineWaitDuration: rtu离线,等待其升级的时长(秒),超过这个时间,设置其升级失败,且设置升级任务完成
    notifyStateInterval: å‡çº§çŠ¶æ€é€šçŸ¥é—´éš”ï¼ˆç§’ï¼‰
    notifyTimesAfterOver: å‡çº§ç»“束后,再向web服务系统通知状态的次数
    -->
    <upgrade enable="true"
             noOneRtuUpgradeMaxDuration="1200"
             runningAndIdleDuration="1200"
             failTryTimes="2"
             ugMaxRtuAtOnce="5000"
             rtuOffLineWaitDuration="1800"
             notifyStateInterval="2"
             notifyTimesAfterOver="1"
    />
    <!--
    æ”¯æŒæ¨¡å—
    çŸ­å·¥ä½œæ—¶é•¿çº¿ç¨‹æ± ï¼Œçº¿ç¨‹è´Ÿè´£ç”¨æ—¶è¾ƒçŸ­çš„工作任务
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml
@@ -57,19 +57,22 @@
    <!-- RTU è½¯ä»¶å‡çº§
    enable: æ¨¡å—是否启动
    noOneRtuUpgradeMaxDuration:升级任务设置后,无一设备升级最大时长(秒),超过这个时长,认为升级任务完成,取值范围是5分钟~60分钟
    runningAndIdleDuration:rtu升级启动后进入升级中状态,但某种情况下RTU不再通信了,一直处于等待状态,等待达到一定时长(秒,一般与noOneRtuUpgradeMaxDuration相等)认为升级失败(一包死或多包死),取值范围是5分钟~60分钟
    failTryTimes:升级失败后(针对的是在线进行了升级下发命令),重新偿试升级次数,当设置为0时表示不重新偿试升级
    ugMaxRtuAtOnce:为了缓解通信中间件的压力,同时支持升级的RTU台数,当设置为0时表示不受限制
    rtuOffLineWaitDuration: rtu离线,等待其升级的时长(秒),超过这个时间,设置其升级失败,且设置升级任务完成
    notifyStateInterval: å‡çº§çŠ¶æ€é€šçŸ¥é—´éš”ï¼ˆç§’ï¼‰
    notifyTimesAfterOver: å‡çº§ç»“束后,再向web服务系统通知状态的次数
    -->
    <upgrade enable="true"
             noOneRtuUpgradeMaxDuration="1200"
             runningAndIdleDuration="1200"
             failTryTimes="2"
             ugMaxRtuAtOnce="5000"
             rtuOffLineWaitDuration="1800"
             notifyStateInterval="2"
             notifyTimesAfterOver="1"
    />
    <!--
    æ”¯æŒæ¨¡å—
    çŸ­å·¥ä½œæ—¶é•¿çº¿ç¨‹æ± ï¼Œçº¿ç¨‹è´Ÿè´£ç”¨æ—¶è¾ƒçŸ­çš„工作任务
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 ;
        }