|  |  |  | 
|---|
|  |  |  | public String rtuAddr ;     //控制器地址 | 
|---|
|  |  |  | public Integer rate ;       //进度 | 
|---|
|  |  |  | public String state;        //升级状态 | 
|---|
|  |  |  | public Integer status;      //过程状态(0:离线,1:升级中,2:升级成功,3升级失败),前端利用其设置卡片样式 | 
|---|
|  |  |  | public Integer reTryTimes ; //重试次数 | 
|---|
|  |  |  | public boolean over ;       //是否结束(true:是,false:否) | 
|---|
|  |  |  | public boolean success ;    //是否成功(true:是,false:否) | 
|---|
|  |  |  | public Boolean over ;       //是否结束(true:是,false:否) | 
|---|
|  |  |  | public Boolean success ;    //是否成功(null:进行中,true:是,false:否) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void fromCache(UpgradeRtu ugRtu){ | 
|---|
|  |  |  | this.rtuAddr = ugRtu.rtuAddr ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | this.rate = (ugRtu.currentPackage * 1000)/ugRtu.totalPackage ;//前端实现是1000份的进度条 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | this.state = UpgradeRtu.getStateName(ugRtu.state) ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //过程状态(0:离线,1:升级中,2:升级成功,3升级失败),前端利用其设置卡片样式 | 
|---|
|  |  |  | this.status = 1 ;//默认升级中 | 
|---|
|  |  |  | if(ugRtu.state == UpgradeRtu.STATE_OFFLINE){ | 
|---|
|  |  |  | this.status = 0 ; | 
|---|
|  |  |  | }else if(ugRtu.state == UpgradeRtu.STATE_SUCCESS){ | 
|---|
|  |  |  | this.status = 2 ; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | if(ugRtu.isOver && ugRtu.state != UpgradeRtu.STATE_SUCCESS){ | 
|---|
|  |  |  | this.status = 3; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | this.reTryTimes = ugRtu.reTryTimes ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | this.over = ugRtu.isOver ; | 
|---|
|  |  |  | this.success = ugRtu.state == UpgradeRtu.STATE_SUCCESS ? true : false ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(ugRtu.isOver){ | 
|---|
|  |  |  | this.success = (ugRtu.state == UpgradeRtu.STATE_SUCCESS ? true : false) ; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | this.success = null ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|