From ed2d2c9b9e9bca8cd97136b738c2624193dd9d92 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期日, 09 十月 2022 11:48:34 +0800 Subject: [PATCH] 百叶帘,编辑场景数据显示异常,光伏功能安卓系统返回上一次 --- HDL_ON/Common/ApiUtlis.cs | 311 +++++++++++++++++++++++++++++++++------------------ 1 files changed, 198 insertions(+), 113 deletions(-) diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs index 35d8c7d..e175781 100644 --- a/HDL_ON/Common/ApiUtlis.cs +++ b/HDL_ON/Common/ApiUtlis.cs @@ -43,6 +43,15 @@ } } /// <summary> + /// 璇诲彇璁惧鍔熻兘鏁版嵁瀹屾垚 + /// </summary> + bool complateDevice = false; + /// <summary> + /// 璇诲彇鍦烘櫙鏁版嵁瀹屾垚 + /// </summary> + bool complateScene = false; + + /// <summary> /// 鏍¢獙缃戝叧鏄惁鍦ㄧ嚎 /// </summary> public bool GatewayOnlineVerification() @@ -152,124 +161,161 @@ { MainPage.Log($"璇诲彇鎴块棿鏁版嵁澶辫触:Code:{roomResult.Code}; msg:{roomResult.message}"); } - //===================璁惧======================= - var deviceResult = Ins.HttpRequest.GetDeviceList("30","1"); - if (deviceResult.Code == StateCode.SUCCESS) - { - endTime = DateTime.Now.AddSeconds(5); - MainPage.Log($"璇诲彇璁惧淇℃伅鎴愬姛"); - var deviceList = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString()); - if (deviceList == null) - { - deviceList = new DevcieApiPack(); - } + //===================璁惧======================= + new System.Threading.Thread(() => + { try { - while (deviceList.totalPage != deviceList.pageNo) + complateDevice = false; + var deviceResult = Ins.HttpRequest.GetDeviceList("30", "1"); + if (deviceResult.Code == StateCode.SUCCESS) { - var deviceResult2 = Ins.HttpRequest.GetDeviceList("30", Convert.ToInt32(deviceList.pageNo) + 1 + ""); - if (deviceResult2.Code == StateCode.SUCCESS) + endTime = DateTime.Now.AddSeconds(5); + + MainPage.Log($"璇诲彇璁惧淇℃伅鎴愬姛"); + MainPage.Log($"sid鍒楄〃鑾峰彇====" + deviceResult.Data.ToString()); + var deviceList = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString()); + if (deviceList == null) { - var deviceList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString()); - deviceList.pageNo = deviceList2.pageNo; - deviceList.list.AddRange(deviceList2.list); + deviceList = new DevcieApiPack(); } - } - }catch(Exception ex) - { - - } - - string delFile = ""; - if (FunctionList.List.GetDeviceFunctionList().Count > 0) - { - - for (int i = 0; i < FunctionList.List.GetDeviceFunctionList().Count;) - { - var localFunction = FunctionList.List.GetDeviceFunctionList()[i]; - //if (SPK.MusicSpkList().Contains(localFunction.spk)) - //{ - // i++; - // continue; - //} - var newFunction = deviceList.list.Find((obj) => obj.deviceId == localFunction.deviceId); - - if (delFile == localFunction.savePath) + try { - i++; - continue; - } - delFile = localFunction.savePath; - FunctionList.List.DeleteFunction(localFunction); - } - } - //澶勭悊鍓╀笅鐨勬柊澧炲姛鑳� - foreach (var newFunction in deviceList.list) - { - newFunction.AssembleStatus(); - newFunction.SaveFunctionFile(); - FunctionList.List.IniFunctionList(newFunction.savePath); - } - endTime = DateTime.Now.AddSeconds(5); - } - else - { - MainPage.Log($"璇诲彇浜戠璁惧鏁版嵁澶辫触:Code:{deviceResult.Code}; Msg:{deviceResult.message}"); - } - - //===================鍦烘櫙========================== - var pack = Ins.HttpRequest.GetSceneList(); - if (pack.Code == StateCode.SUCCESS) - { - endTime = DateTime.Now.AddSeconds(100); - MainPage.Log($"璇诲彇鍦烘櫙鏁版嵁鎴愬姛"); - var sceneList = JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString()); - if (sceneList == null) - { - sceneList = new List<Scene>(); - } - FunctionList.List.scenes.Clear(); - - //澶勭悊鍓╀笅鐨勬柊澧炲姛鑳� - foreach (var tempScene in sceneList) - { - tempScene.SaveSceneFile(); - FunctionList.List.scenes.Add(tempScene); - } - //濡傛灉鏄竴绔彛闇�瑕佹彁鍓嶄笅杞藉満鏅暟鎹紝鍚﹀垯鎺у埗涓嶄簡涓�绔彛鍦烘櫙 - if (DB_ResidenceData.Instance.GatewayType == 0) - { - var sceneIds = new List<string>(); - foreach (var tempScene in FunctionList.List.scenes) - { - sceneIds.Add(tempScene.userSceneId); - } - var packInfo = HttpRequest.GetSceneListInfo(sceneIds); - if (packInfo.Code == StateCode.SUCCESS) - { - var serverTempList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(packInfo.Data.ToString()); - foreach (var localScene in FunctionList.List.scenes) - { - var serverTemp = serverTempList.Find((obj) => obj.userSceneId == localScene.userSceneId); - if (serverTemp != null) + while (deviceList.totalPage != deviceList.pageNo) { - localScene.functions = serverTemp.functions; - localScene.SaveSceneFile(); + var deviceResult2 = Ins.HttpRequest.GetDeviceList("30", Convert.ToInt32(deviceList.pageNo) + 1 + ""); + if (deviceResult2.Code == StateCode.SUCCESS) + { + var deviceList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString()); + deviceList.pageNo = deviceList2.pageNo; + deviceList.list.AddRange(deviceList2.list); + } } } + catch (Exception ex) + { + + } + finally + { + complateDevice = true; + } + + string delFile = ""; + if (FunctionList.List.GetDeviceFunctionList().Count > 0) + { + + for (int i = 0; i < FunctionList.List.GetDeviceFunctionList().Count;) + { + var localFunction = FunctionList.List.GetDeviceFunctionList()[i]; + //if (SPK.MusicSpkList().Contains(localFunction.spk)) + //{ + // i++; + // continue; + //} + var newFunction = deviceList.list.Find((obj) => obj.deviceId == localFunction.deviceId); + + if (delFile == localFunction.savePath) + { + i++; + continue; + } + delFile = localFunction.savePath; + FunctionList.List.DeleteFunction(localFunction); + } + } + //澶勭悊鍓╀笅鐨勬柊澧炲姛鑳� + foreach (var newFunction in deviceList.list) + { + newFunction.AssembleStatus(); + newFunction.SaveFunctionFile(); + FunctionList.List.IniFunctionList(newFunction.savePath); + } + endTime = DateTime.Now.AddSeconds(5); } else { - IMessageCommon.Current.ShowErrorInfoAlter(packInfo.Code); + MainPage.Log($"璇诲彇浜戠璁惧鏁版嵁澶辫触:Code:{deviceResult.Code}; Msg:{deviceResult.message}"); } + }catch (Exception ex) + { + MainPage.Log($"============璁惧============{ex.Message}"); } - endTime = DateTime.Now.AddSeconds(5); - } - else + finally + { + complateDevice = true; + } + }) + { IsBackground = true }.Start(); + + //===================鍦烘櫙========================== + new System.Threading.Thread(() => { - MainPage.Log($"璇诲彇浜戠鍦烘櫙鏁版嵁澶辫触:Code:{pack.Code}; Msg:{pack.message}"); - } + try + { + complateScene = true; + var pack = Ins.HttpRequest.GetSceneList(); + if (pack.Code == StateCode.SUCCESS) + { + endTime = DateTime.Now.AddSeconds(100); + MainPage.Log($"璇诲彇鍦烘櫙鏁版嵁鎴愬姛"); + var sceneList = JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString()); + if (sceneList == null) + { + sceneList = new List<Scene>(); + } + FunctionList.List.scenes.Clear(); + + //澶勭悊鍓╀笅鐨勬柊澧炲姛鑳� + foreach (var tempScene in sceneList) + { + tempScene.SaveSceneFile(); + FunctionList.List.scenes.Add(tempScene); + } + //濡傛灉鏄竴绔彛闇�瑕佹彁鍓嶄笅杞藉満鏅暟鎹紝鍚﹀垯鎺у埗涓嶄簡涓�绔彛鍦烘櫙 + if (DB_ResidenceData.Instance.GatewayType == 0) + { + var sceneIds = new List<string>(); + foreach (var tempScene in FunctionList.List.scenes) + { + sceneIds.Add(tempScene.userSceneId); + } + var packInfo = HttpRequest.GetSceneListInfo(sceneIds); + if (packInfo.Code == StateCode.SUCCESS) + { + var serverTempList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(packInfo.Data.ToString()); + foreach (var localScene in FunctionList.List.scenes) + { + var serverTemp = serverTempList.Find((obj) => obj.userSceneId == localScene.userSceneId); + if (serverTemp != null) + { + localScene.functions = serverTemp.functions; + localScene.SaveSceneFile(); + } + } + } + else + { + IMessageCommon.Current.ShowErrorInfoAlter(packInfo.Code); + } + } + endTime = DateTime.Now.AddSeconds(5); + } + else + { + MainPage.Log($"璇诲彇浜戠鍦烘櫙鏁版嵁澶辫触:Code:{pack.Code}; Msg:{pack.message}"); + } + }catch(Exception ex) + { + MainPage.Log($"===鍦烘櫙==={ex.Message}"); + } + finally + { + complateScene = true; + } + }) + { IsBackground = true }.Start(); //===================璇诲彇閫昏緫鍒楄〃========================== UI.UI2.Intelligence.Automation.MainView.GetLogicList(); @@ -306,9 +352,11 @@ } else if (video.interphoneType == InterphoneType.FREEVIEW.ToString()) {//涓哄叏瑙嗛�氬彲瑙嗗璁� + DB_ResidenceData.Instance.SupportFacePass = true; Entity.DB_ResidenceData.Instance.SupportVisitorManage = true; Entity.DB_ResidenceData.Instance.SupportFVDevice = true; + //isInterphoneType_HDL = true; isInterphoneType_FREEVIEW = true; } @@ -322,15 +370,24 @@ if (isInterphoneType_HDL) { //HDLLinphone鍙瀵硅,鑾峰彇Sip璐﹀彿骞跺垵濮嬪寲SDK - HDLLinphone.Current.GetHDLSipInfoAndInitSDK(DB_ResidenceData.Instance.CurrentRegion.id); - + HDLCallVideoInfo callVideoInfo = new HDLCallVideoInfo(); + callVideoInfo.HomeId = DB_ResidenceData.Instance.CurrentRegion.id; + callVideoInfo.InterphoneType = InterphoneType.HDL.ToString(); + HDLLinphone.Current.GetHDLSipInfoAndInitSDK(callVideoInfo); + } + else if (isInterphoneType_FREEVIEW) + { + //HDLLinphone鍙瀵硅,鑾峰彇Sip璐﹀彿骞跺垵濮嬪寲SDK + HDLCallVideoInfo callVideoInfo = new HDLCallVideoInfo(); + callVideoInfo.HomeId = DB_ResidenceData.Instance.CurrentRegion.id; + callVideoInfo.InterphoneType = InterphoneType.FREEVIEW.ToString(); + HDLLinphone.Current.GetHDLSipInfoAndInitSDK(callVideoInfo); } else { Utlis.WriteLine("褰撳墠浣忓畢涓嶆敮鎸丠DL鍙瀵硅,閫�鍑虹櫥褰曟墍鏈夎处鍙�"); //褰撳墠浣忓畢涓嶆敮鎸丠DL鍙瀵硅 HDLLinphone.Current.LogoutAllAccount(); - } } @@ -346,6 +403,9 @@ //======================瀹夐槻==================== GetSecurityList(); + //======================娉ㄥ唽鎺ㄩ��==================== + httpRequest.RegisteredPush(); + } catch (Exception ex) @@ -382,15 +442,11 @@ { while (endTime > DateTime.Now) { - if (DownloadDataComplete) + if (DownloadDataComplete && complateDevice && complateScene) { break; } System.Threading.Thread.Sleep(100); - } - if (!DownloadDataComplete) - { - //downloadDataThread.Abort(); } DownloadDataComplete = true; Application.RunOnMainThread(() => @@ -401,9 +457,6 @@ waitPage = null; } }); - //鍒濆鍖栨暟鎹� - //SpatialInfo.CurrentSpatial.Clear(); - } catch { } finally @@ -421,6 +474,37 @@ } }) { IsBackground = true }.Start(); + + + + + ////涓嬭浇鍏変紡鏁版嵁 + //new System.Threading.Thread(() => { + // try + // {//00 + // HttpServerRequest http = new HttpServerRequest(); + // var packData = http.GetInverterList(); + // if (packData != null) + // { + // if (packData.Code == StateCode.SUCCESS) + // { + // var inverterList = JsonConvert.DeserializeObject<List<InverterInfo>>(packData.Data.ToString()); + // if (inverterList!= null) + // { + // FunctionList.List.InverterList = inverterList; + // } + // } + // } + // } + // catch (Exception ex) + // { + // MainPage.Log($"璇诲彇鍏変紡鏁版嵁寮傚父:{ex.Message}"); + // } + + //}) { IsBackground = true }.Start(); + + + } /// <summary> @@ -468,6 +552,7 @@ FileUtlis.Files.DeleteFile(file); } } + FunctionList.List.securities.Clear(); foreach (var function in infoList) { function.SaveFile(); -- Gitblit v1.8.0