| | |
| | | |
| | | private static final UpgradeManager INSTANCE = new UpgradeManager(); |
| | | |
| | | private Boolean openNoUpgrade ;//阀开(泵开)不执行升级 |
| | | private Integer lastOpenMaxGoOn ;//阀开(泵开)状态设置以来持续最长时间(秒钟),超过这个时间认为状态无效(这个时长取决于工作报间隔) |
| | | private Integer failTryTimes ;//升级失败后,重新偿试升级次数,0表示不重新偿试升级 |
| | | private Integer ugMaxRtuSameTime ;//同时升级RTU最大个数 |
| | | private Integer notifyTimesAfterOver; //升级结束后,再向web服务系统通知状态的次数 |
| | | private int nowNotifyTimesAfterOver; //升级结束后,再向web服务系统通知状态的次数 |
| | | |
| | | private UpgradeTask task ;//升级任务 |
| | | private boolean monitorFirst = true ;//是否是第一次监视 |
| | | private boolean monitorFirst ;//是否是第一次监视 |
| | | |
| | | private UpgradeManager(){ |
| | | monitorFirst = true ; |
| | |
| | | * 初始化配置信息 |
| | | */ |
| | | public void initOption(UpgradeUnitConfigVo configVo) { |
| | | this.openNoUpgrade = configVo.openNoUpgrade; |
| | | this.lastOpenMaxGoOn = configVo.lastOpenMaxGoOn; |
| | | this.failTryTimes = configVo.failTryTimes; |
| | | this.ugMaxRtuSameTime = configVo.ugMaxRtuAtOnce; |
| | | this.notifyTimesAfterOver = configVo.notifyTimesAfterOver; |
| | |
| | | this.task.forceOver(); |
| | | } |
| | | this.task = new UpgradeTask(); |
| | | this.task.initOption(this.failTryTimes, this.ugMaxRtuSameTime); |
| | | this.task.initOption(this.openNoUpgrade, this.lastOpenMaxGoOn, this.failTryTimes, this.ugMaxRtuSameTime); |
| | | this.task.setTask(vo); |
| | | this.nowNotifyTimesAfterOver = 0 ; |
| | | this.monitorFirst = true ; |
| | | log.info("======================================================") ; |
| | | log.info("= =") ; |
| | | log.info("=设置了升级任务,涉及RTU" + vo.rtuAddrList.size() + "台 =") ; |
| | |
| | | this.stop() ; |
| | | }else{ |
| | | if(!this.task.taskIsOver){ |
| | | if(this.openNoUpgrade != null |
| | | && this.openNoUpgrade.booleanValue() |
| | | && this.monitorFirst){ |
| | | //第一次进入,进行阀开不升级处理 |
| | | this.task.openNoUpgrade() ; |
| | | } |
| | | this.nowNotifyTimesAfterOver = 0 ; |
| | | //升级任务未完成 |
| | | //工作1:判断是否无任何一个RTU进行过升级,并且达到时限,则认为当前升级任务完成 |
| | |
| | | return true ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 升级状态通知 |
| | | */ |