| | |
| | | }
|
| | |
|
| | | //保存协调器的nv分区组网信息
|
| | | bool result = this.SaveNVFile(realGateway);
|
| | | if (result == false)
|
| | | {
|
| | | //如果上传失败的话,就把它删除
|
| | | await HdlBackupLogic.Current.DeleteDbBackupData(backupClassId);
|
| | | //关闭进度条
|
| | | ProgressFormBar.Current.Close();
|
| | | return;
|
| | | }
|
| | | //bool result = this.SaveNVFile(realGateway);
|
| | | //if (result == false)
|
| | | //{
|
| | | // //如果上传失败的话,就把它删除
|
| | | // await HdlBackupLogic.Current.DeleteDbBackupData(backupClassId);
|
| | | // //关闭进度条
|
| | | // ProgressFormBar.Current.Close();
|
| | | // return;
|
| | | //}
|
| | |
|
| | | //打开协调器串口发送功能
|
| | | result = this.OpenZbMsComSend(realGateway);
|
| | | if (result == false)
|
| | | {
|
| | | //如果上传失败的话,就把它删除
|
| | | await HdlBackupLogic.Current.DeleteDbBackupData(backupClassId);
|
| | | //关闭进度条
|
| | | ProgressFormBar.Current.Close();
|
| | | return;
|
| | | }
|
| | | //result = this.OpenZbMsComSend(realGateway);
|
| | | //if (result == false)
|
| | | //{
|
| | | // //如果上传失败的话,就把它删除
|
| | | // await HdlBackupLogic.Current.DeleteDbBackupData(backupClassId);
|
| | | // //关闭进度条
|
| | | // ProgressFormBar.Current.Close();
|
| | | // return;
|
| | | //}
|
| | |
|
| | | //开始上传数据
|
| | | result = this.StartUpLoadData(realGateway, backupClassId);
|
| | | bool result = this.StartUpLoadData(realGateway, backupClassId);
|
| | | if (result == false)
|
| | | {
|
| | | //如果上传失败的话,就把它删除
|
| | |
| | | this.ShowErrorMsg(msg);
|
| | | return false;
|
| | | }
|
| | | System.Threading.Thread.Sleep(1000);
|
| | |
|
| | | return success;
|
| | | }
|
| | |
|
| | |
| | | /// </summary>
|
| | | /// <param name="realGateway">真实物理网关对象</param>
|
| | | /// <param name="backupId">备份主键</param>
|
| | | public bool RecoverGateway(ZbGateway realGateway, string backupId)
|
| | | /// <param name="isAutoBack">0:获取网关手动备份文件列表 1:获取网关自动备份文件列表</param>
|
| | | public bool RecoverGateway(ZbGateway realGateway, string backupId, int isAutoBack)
|
| | | {
|
| | | //展开进度条
|
| | | ProgressFormBar.Current.Start();
|
| | | //从云端获取备份文件列表
|
| | | var result = this.GetGatewayFileList(realGateway, backupId);
|
| | | var result = this.GetGatewayFileList(realGateway, backupId, isAutoBack);
|
| | | if (result == false)
|
| | | {
|
| | | //关闭进度条
|
| | |
| | | }
|
| | |
|
| | | //从云端下载备份文件
|
| | | result = this.DownloadGatewayFile(realGateway, backupId);
|
| | | result = this.DownloadGatewayFile(realGateway, backupId, isAutoBack);
|
| | | if (result == false)
|
| | | {
|
| | | //关闭进度条
|
| | |
| | | return false;
|
| | | }
|
| | |
|
| | | //恢复协调器nv分区的组网信息
|
| | | result = this.RestoreGatewayNV(realGateway);
|
| | | if (result == false)
|
| | | {
|
| | | //关闭进度条
|
| | | ProgressFormBar.Current.Close();
|
| | | return false;
|
| | | }
|
| | | ////恢复协调器nv分区的组网信息
|
| | | //result = this.RestoreGatewayNV(realGateway);
|
| | | //if (result == false)
|
| | | //{
|
| | | // //关闭进度条
|
| | | // ProgressFormBar.Current.Close();
|
| | | // return false;
|
| | | //}
|
| | |
|
| | | //打开协调器串口发送功能
|
| | | result = this.OpenZbMsComSend(realGateway);
|
| | | if (result == false)
|
| | | {
|
| | | //关闭进度条
|
| | | ProgressFormBar.Current.Close();
|
| | | return false;
|
| | | }
|
| | | //result = this.OpenZbMsComSend(realGateway);
|
| | | //if (result == false)
|
| | | //{
|
| | | // //关闭进度条
|
| | | // ProgressFormBar.Current.Close();
|
| | | // return false;
|
| | | //}
|
| | |
|
| | | //重启网关系统
|
| | | result = this.GatewayReboot(realGateway);
|
| | |
| | | /// <param name="realGateway"></param>
|
| | | /// <param name="backupClassId"></param>
|
| | | /// <returns></returns>
|
| | | private bool GetGatewayFileList(ZbGateway realGateway, string backupClassId)
|
| | | private bool GetGatewayFileList(ZbGateway realGateway, string backupClassId, int isAutoBack)
|
| | | {
|
| | | //正在获取备份文件列表
|
| | | ProgressFormBar.Current.SetMsg(Language.StringByID(R.MyInternationalizationString.uBackupFileListGetting));
|
| | |
| | | var jObject = new Newtonsoft.Json.Linq.JObject { { "Cluster_ID", 0 }, { "Command", 6202 } };
|
| | | var data = new Newtonsoft.Json.Linq.JObject {
|
| | | { "url", fullUrl }, { "RequestVersion", Common.CommonPage.RequestVersion },
|
| | | { "LoginAccessToken", UserCenterLogic.GetConnectMainToken() }, { "IsGatewayAutoBackup", 0 },
|
| | | { "LoginAccessToken", UserCenterLogic.GetConnectMainToken() }, { "IsGatewayAutoBackup", isAutoBack },
|
| | | { "BackupClassId", backupClassId },{ "GatewayUniqueId",HdlGatewayLogic.Current.GetGatewayId(realGateway)},
|
| | | { "IsOtherAccountCtrl",connectMode == HttpConnectMode.Admin?1:0}
|
| | | };
|
| | |
| | | /// <param name="realGateway"></param>
|
| | | /// <param name="backupClassId"></param>
|
| | | /// <returns></returns>
|
| | | private bool DownloadGatewayFile(ZbGateway realGateway, string backupClassId)
|
| | | private bool DownloadGatewayFile(ZbGateway realGateway, string backupClassId, int isAutoBack)
|
| | | {
|
| | | //正在下载备份文件
|
| | | ProgressFormBar.Current.SetMsg(Language.StringByID(R.MyInternationalizationString.uBackupFileDownloading));
|
| | |
| | | var jObject = new Newtonsoft.Json.Linq.JObject { { "Cluster_ID", 0 }, { "Command", 6203 } };
|
| | | var data = new Newtonsoft.Json.Linq.JObject {
|
| | | { "url", fullUrl }, { "RequestVersion", Common.CommonPage.RequestVersion },
|
| | | { "LoginAccessToken", UserCenterLogic.GetConnectMainToken() }, { "IsGatewayAutoBackup", 0 },
|
| | | { "LoginAccessToken", UserCenterLogic.GetConnectMainToken() }, { "IsGatewayAutoBackup", isAutoBack },
|
| | | { "BackupClassId", backupClassId },{ "GatewayUniqueId",HdlGatewayLogic.Current.GetGatewayId(realGateway)},
|
| | | { "IsOtherAccountCtrl",connectMode == HttpConnectMode.Admin?1:0}
|
| | | };
|
| | |
| | | }
|
| | | if (gatewatAction == true)
|
| | | {
|
| | | //设置进度值:100%
|
| | | ProgressFormBar.Current.SetValue(1, 1);
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | //网关数据恢复成功!
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uRestoreGatewayDataSuccess);
|
| | | this.ShowTipMsg(msg);
|