From 0711485ecb4fe66fbe820478d92eb9f04b77c042 Mon Sep 17 00:00:00 2001 From: Shuxia Ning <NingShuxia0927@outlook.com> Date: 星期四, 24 十月 2024 13:51:38 +0800 Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs | 218 +++++++++++++++++++++++++++++++++-------------------- 1 files changed, 135 insertions(+), 83 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs index 5b02142..20d4a85 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs @@ -1,4 +1,6 @@ -锘縰sing DevExpress.XtraEditors; +锘縰sing Castle.Core.Internal; +using DevExpress.XtraEditors; +using HStation.Model; using HStation.Vmo; using static DevExpress.XtraEditors.XtraInputBox; using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window; @@ -23,8 +25,6 @@ { var msg = string.Empty; - var IsContinue = true; - #region 绗竴姝� 涓存椂鏂囦欢澶勭悊锛堣繘搴�5%锛� msg = "寮�濮嬪鍏ラ」鐩�..."; @@ -48,8 +48,6 @@ feedBackMsg?.Invoke("姝e湪鍒涘缓椤圭洰...", Color.Black); - var bllXhsProjectExtensions = new Lazy<BLL.XhsProjectExtensions>(() => new BLL.XhsProjectExtensions()); - var project = new Vmo.XhsProjectExtensionsVmo(); project.NO = vm.NO; project.Name = vm.Name; @@ -58,15 +56,16 @@ project.Flags = vm.Flags; project.TagName = vm.TagName; project.Description = vm.Description; + project.SiteList = new List<XhsProjectSiteVmo>() + { + new XhsProjectSiteVmo() + { + Name=vm.Name, + Description=vm.Description + } + }; - project.SiteList = new List<XhsProjectSiteVmo>() { - new XhsProjectSiteVmo(){ - Name=vm.Name, - Description=vm.Description - } - }; - - var projectId = await bllXhsProjectExtensions.Value.Insert(project); + var projectId = await BLLFactory<HStation.BLL.XhsProjectExtensions>.Instance.Insert(project); if (projectId < 1) { feedBackMsg?.Invoke("椤圭洰鍒涘缓澶辫触锛侊紒锛�", Color.Red); @@ -87,7 +86,7 @@ if (vm.Location != null) { - var mapInfo = new Yw.Vmo.Map.MapInfo(); + var mapInfo = new Yw.Vmo.MapInfoVmo(); mapInfo.ObjectType = HStation.Xhs.DataType.XhsProject; mapInfo.ObjectID = projectId; mapInfo.ObjectName = project.Name; @@ -96,7 +95,7 @@ mapInfo.Shape = Yw.Map.Shape.Marker; mapInfo.Position = vm.Location.ToJson(); - var mapInfoId = await new Yw.BLL.MapInfo().Insert(mapInfo); + var mapInfoId = await BLLFactory<Yw.BLL.MapInfo>.Instance.Insert(mapInfo); if (mapInfoId < 1) { feedBackMsg?.Invoke("璁剧疆鍦板浘浣嶇疆澶辫触锛侊紒锛�", Color.Red); @@ -120,20 +119,13 @@ msg = "姝e湪瑙f瀽妯″瀷鏂囦欢..."; feedBackMsg?.Invoke(msg, Color.Black); - var bol = Yw.FileFolderZipHelper.UnZip(vm.ZipFile, tempFolder, null); + + var zipFilePwd = HStation.Settings.XhsParasHelper.Xhs.File.Password; + var bol = Yw.FileFolderZipHelper.UnZip(vm.ZipFile, tempFolder, zipFilePwd); if (!bol) { feedBackMsg?.Invoke("妯″瀷鏂囦欢瑙f瀽澶辫触锛侊紒锛�", Color.Red); - //return false; - } - else - { - IsContinue = false; - } - - if (IsContinue) - { - feedBackMsg?.Invoke("椤圭洰瀵煎叆鎴愬姛銆傘�傘��", Color.Green); + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); feedBackProgress?.Invoke(100, 100); return true; } @@ -143,7 +135,9 @@ if (allFileInfoList == null || allFileInfoList.Count() < 1) { feedBackMsg?.Invoke("妯″瀷鏂囦欢鏍煎紡閿欒锛侊紒锛�", Color.Red); - return false; + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; } feedBackMsg?.Invoke("妯″瀷鏂囦欢瑙f瀽鎴愬姛銆傘�傘��", Color.Green); @@ -155,39 +149,113 @@ #region 绗簲姝� 瑙f瀽姘村姏缁撴瀯鏂囦欢 锛堣繘搴�30%锛� feedBackMsg?.Invoke("姝e湪瑙f瀽姘村姏缁撴瀯鏂囦欢...", Color.Black); - var jsonFileInfo = allFileInfoList.Where(x => x.Extension == ".json").FirstOrDefault(); - if (jsonFileInfo == null) + var structFileInfo = allFileInfoList.Find(x => x.Name == HStation.Revit.ConstParas.StructFileName); + if (structFileInfo == null) { feedBackMsg?.Invoke("姘村姏缁撴瀯鏂囦欢鏍煎紡閿欒锛侊紒锛�", Color.Red); - return false; + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; } - - var revitModel = HStation.Service.RevitParseHelper.FromJsonFile(jsonFileInfo.FullName, out msg); - if (revitModel == null) + var structOthersFileInfo = allFileInfoList.Find(x => x.Name == HStation.Revit.ConstParas.StructOthersFileName); + var structRevitModel = HStation.Service.RevitParseHelper.FromJsonFile + (structFileInfo.FullName, structOthersFileInfo?.FullName, out bool structFileResult, out List<string> structFileMsgList); + //瑙f瀽缁撴灉鍒ゆ柇 + if (!structFileResult) { - feedBackMsg?.Invoke($"{msg}锛侊紒锛�", Color.Red); - return false; + structFileMsgList?.ForEach(x => feedBackMsg?.Invoke(x, Color.Red)); + } + //Revit灞炴�ч敊璇鐞� + var hasRevitPropError = false; + if (structRevitModel != null) + { + var allRevitParterList = structRevitModel.GetAllParters(); + foreach (var revitParter in allRevitParterList) + { + if (revitParter.PropStatusList != null && revitParter.PropStatusList.Count > 0) + { + foreach (var revitParterPropStatus in revitParter.PropStatusList) + { + if (revitParterPropStatus.PropStatus == HStation.Revit.ePropStatus.Error) + { + hasRevitPropError = true; + } + switch (revitParterPropStatus.PropStatus) + { + case Revit.ePropStatus.Error: + { + feedBackMsg?.Invoke($"鏋勪欢绫诲瀷锛歿revitParter.Catalog}锛屾瀯浠剁紪鐮侊細{revitParter.Code}锛屾瀯浠跺睘鎬э細{revitParterPropStatus.PropName}锛岄敊璇細{revitParterPropStatus.StatusInfo} ", Color.Red); + } + break; + + case Revit.ePropStatus.Lack: + { + //feedBackMsg?.Invoke($"鏋勪欢缂栫爜锛歿revitParter.Id}锛屾瀯浠跺睘鎬э細{revitParterPropStatus.PropName}锛岀己鐪侊細{revitParterPropStatus.StatusInfo} ", Color.Gray); + } + break; + + case Revit.ePropStatus.Abnormal: + { + //feedBackMsg?.Invoke($"鏋勪欢缂栫爜锛歿revitParter.Id}锛屾瀯浠跺睘鎬э細{revitParterPropStatus.PropName}锛屽紓甯革細{revitParterPropStatus.StatusInfo} ", Color.Orange); + } + break; + + default: break; + } + } + } + } + } + if (hasRevitPropError || !structFileResult) + { + feedBackMsg?.Invoke($"姘村姏缁撴瀯鏂囦欢瑙f瀽閿欒锛侊紒锛�", Color.Red); + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; } - var hydroInfo = HStation.Hydro.TransferHelper.FromRevit(revitModel, out msg); + vm.RevitModel = structRevitModel; + + var hydroInfo = HStation.Hydro.TransferHelper.FromRevit(structRevitModel, out msg); if (hydroInfo == null) { feedBackMsg?.Invoke($"姘村姏缁撴瀯鏂囦欢瑙f瀽澶辫触锛寋msg}锛侊紒锛�", Color.Red); - return false; + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; } - var bllHydroInfo = new Yw.BLL.HydroModelInfo(); - var hydroId = await bllHydroInfo.Save(hydroInfo); + var hydroId = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.Save(hydroInfo); if (hydroId < 1) { feedBackMsg?.Invoke("姘村姏缁撴瀯淇℃伅淇濆瓨澶辫触锛侊紒锛�", Color.Red); - return false; + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; } + feedBackMsg?.Invoke("姝e湪杩涜浜у搧鍖归厤...", Color.Black); + hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroId); + var matchingParas = AssetsMatchingParasHelper.Create(hydroInfo, null); + if (AssetsMatchingHelper.Matching(matchingParas, out string error)) + { + if (AssetsMatchingParasHelper.Apply(hydroInfo, matchingParas)) + { + feedBackMsg?.Invoke("浜у搧鍖归厤瀹屾垚銆傘�傘��", Color.Green); + } + else + { + feedBackMsg?.Invoke("浜у搧鍖归厤澶辫触锛侊紒锛�", Color.Red); + } + } + else + { + feedBackMsg?.Invoke("浜у搧鍖归厤澶辫触锛侊紒锛�", Color.Red); + } + hydroId = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.Save(hydroInfo); + feedBackMsg?.Invoke("姘村姏缁撴瀯鏂囦欢瑙f瀽鎴愬姛銆傘�傘��", Color.Green); - feedBackProgress?.Invoke(100, 30); - vm.HydroID = hydroId; #endregion 绗簲姝� 瑙f瀽姘村姏缁撴瀯鏂囦欢 锛堣繘搴�30%锛� @@ -198,7 +266,9 @@ if (projectSite == null) { feedBackMsg?.Invoke("椤圭洰绔欎俊鎭敊璇�...", Color.Red); - return false; + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; } var projectSiteId = projectSite.ID; @@ -206,26 +276,25 @@ feedBackMsg?.Invoke("姝e湪鍏宠仈姘村姏缁撴瀯妯″瀷...", Color.Black); - var hydroRelation = new Yw.Dto.AddHydroModelRelationInput(); + var hydroRelation = new Yw.Vmo.HydroModelRelationVmo(); hydroRelation.ObjectType = HStation.Xhs.DataType.XhsProjectSite; hydroRelation.ObjectID = projectSiteId; hydroRelation.ModelID = hydroId; - hydroRelation.Purpose = Yw.Hydro.Purpose.Simulation; + hydroRelation.Purpose = HStation.Xhs.Purpose.Simulation; hydroRelation.Content = null; hydroRelation.Description = null; - var bllHydroRelation = new Yw.BLL.HydroModelRelation(); - var hydroRelationId = await bllHydroRelation.Insert(hydroRelation); + var hydroRelationId = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance.Insert(hydroRelation); if (hydroRelationId < 1) { feedBackMsg?.Invoke("鍏宠仈姘村姏缁撴瀯妯″瀷澶辫触锛侊紒锛�", Color.Red); - return false; + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; } vm.HydroRelationID = hydroRelationId; - feedBackMsg?.Invoke("鍏宠仈姘村姏缁撴瀯妯″瀷鎴愬姛銆傘�傘��", Color.Green); - feedBackProgress?.Invoke(100, 40); #endregion 绗叚姝� 鍏宠仈姘村姏缁撴瀯妯″瀷锛堣繘搴� 40%锛� @@ -233,27 +302,27 @@ #region 绗竷姝� 涓婁紶Revit妯″瀷鏂囦欢锛堣繘搴� 45%锛� feedBackMsg?.Invoke("姝e湪瑙f瀽Revit妯″瀷鏂囦欢...", Color.Black); - var rvtFileInfo = allFileInfoList.Where(x => x.Extension == ".rvt").FirstOrDefault(); + var rvtFileInfo = allFileInfoList.Find(x => x.Name == HStation.Revit.ConstParas.RvtFileName); if (rvtFileInfo == null) { feedBackMsg?.Invoke("Revit妯″瀷鏂囦欢瑙f瀽澶辫触锛侊紒锛�", Color.Red); feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); return true; } //var bimfaceId = await Yw.WinFrmUI.BimfaceHelper.UploadFile(rvtFileInfo.FullName);//涓婁紶 - var bimfaceId = 10000872887098; //娴嬭瘯鐢ㄤ緥 + var bimfaceId = 10000884702464; //娴嬭瘯鐢ㄤ緥 10000878572231 10000882826621 10000884283372 10000884362886 10000884702464 if (bimfaceId < 1) { feedBackMsg?.Invoke("Revit妯″瀷鏂囦欢涓婁紶澶辫触锛侊紒锛�", Color.Red); feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); return true; } vm.BimfaceId = bimfaceId; - feedBackMsg?.Invoke("瑙f瀽Revit妯″瀷鏂囦欢鎴愬姛銆傘�傘��", Color.Green); - feedBackProgress?.Invoke(100, 45); #endregion 绗竷姝� 涓婁紶Revit妯″瀷鏂囦欢锛堣繘搴� 45%锛� @@ -271,18 +340,17 @@ bimfaceFile.FileSuffix = rvtFileInfo.Extension; bimfaceFile.FileSize = string.Format("{0}MB", System.Math.Ceiling(rvtFileInfo.Length / 1024.0 / 1024.0)); - var bllBimfaceFile = new Yw.BLL.BimfaceFile(); - var bimfaceFileId = await bllBimfaceFile.Insert(bimfaceFile); + var bimfaceFileId = await BLLFactory<Yw.BLL.BimfaceFile>.Instance.Insert(bimfaceFile); if (bimfaceFileId < 1) { feedBackMsg?.Invoke("Bimface鏂囦欢淇濆瓨澶辫触锛侊紒锛�", Color.Red); feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); return true; } + vm.BimfaceFileID = bimfaceFileId; - feedBackMsg?.Invoke("Bimface鏂囦欢淇濆瓨鎴愬姛銆傘�傘��", Color.Green); - feedBackProgress?.Invoke(100, 50); #endregion 绗叓姝� 淇濆瓨Bimface鏂囦欢 锛堣繘搴� 50%锛� @@ -295,15 +363,15 @@ bimfaceRelation.ObjectType = HStation.Xhs.DataType.XhsProjectSite; bimfaceRelation.ObjectID = projectSiteId; bimfaceRelation.BimfaceFileID = bimfaceFileId; - bimfaceRelation.Purpose = Yw.Bimface.Purpose.Simulation; + bimfaceRelation.Purpose = HStation.Xhs.Purpose.Simulation; bimfaceRelation.Description = vm.Description; - var bllBimfaceRelation = new Yw.BLL.BimfaceFileRelation(); - var bimfaceRelationId = await bllBimfaceRelation.Insert(bimfaceRelation); + var bimfaceRelationId = await BLLFactory<Yw.BLL.BimfaceFileRelation>.Instance.Insert(bimfaceRelation); if (bimfaceRelationId < 1) { feedBackMsg?.Invoke("Bimface鏂囦欢鍏宠仈澶辫触锛侊紒锛�", Color.Red); feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); return true; } vm.BimfaceFileRelationID = bimfaceRelationId; @@ -330,6 +398,9 @@ else { feedBackMsg?.Invoke("璺宠繃Bimface妯″瀷杞婚噺鍖栫瓑寰呫�傘�傘��", Color.Black); + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; } } else @@ -345,7 +416,7 @@ #region 绗崄涓�姝� 鏇存柊Bimface鏂囦欢鐘舵�侊紙杩涘害 100%锛� feedBackMsg?.Invoke("姝e湪鏇存柊Bimface鏂囦欢鐘舵��...", Color.Black); - bol = await bllBimfaceFile.UpdateFileStatus(bimfaceFileId, (int)Yw.Bimface.eFileStatus.ConvertSucceed); + bol = await BLLFactory<Yw.BLL.BimfaceFile>.Instance.UpdateFileStatus(bimfaceFileId, (int)Yw.Bimface.eFileStatus.ConvertSucceed); if (bol) { feedBackMsg?.Invoke("Bimface鏂囦欢鐘舵�佹洿鏂版垚鍔熴�傘�傘��", Color.Green); @@ -358,29 +429,10 @@ } feedBackProgress?.Invoke(100, 100); - - #endregion 绗崄涓�姝� 鏇存柊Bimface鏂囦欢鐘舵�侊紙杩涘害 100%锛� - - #region 寮冪敤 绗崄浜屾 椤圭洰鍙戝竷锛堣繘搴� 100%锛� - - /* feedBackMsg?.Invoke("姝e湪鍙戝竷椤圭洰..."); - var bllXhsProject = new BLL.XhsProject(); - bol = await bllXhsProject.Publish(projectId); - if (!bol) - { - feedBackMsg?.Invoke("椤圭洰鍙戝竷澶辫触..."); - } - else - { - vm.IsPublished = true; - feedBackMsg?.Invoke("椤圭洰鍙戝竷鎴愬姛..."); - } - - feedBackProgress?.Invoke(100, 100); - feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��");*/ + feedBackMsg?.Invoke("椤圭洰瀵煎叆瀹屾垚銆傘�傘��", Color.Green); return true; - #endregion 寮冪敤 绗崄浜屾 椤圭洰鍙戝竷锛堣繘搴� 100%锛� + #endregion 绗崄涓�姝� 鏇存柊Bimface鏂囦欢鐘舵�侊紙杩涘害 100%锛� } } } \ No newline at end of file -- Gitblit v1.9.3