From 97c4b1bc4ca88c5487f8ae38a0da32c93b66c4ce Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期五, 27 九月 2024 08:34:37 +0800 Subject: [PATCH] 功能修改 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs | 192 ++++++++++++++++++++++++++--------------------- 1 files changed, 106 insertions(+), 86 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 2766b78..bfb05bd 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.Vmo; using static DevExpress.XtraEditors.XtraInputBox; using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window; @@ -39,15 +41,13 @@ feedBackProgress?.Invoke(100, 5); - #endregion 绗竴姝� 涓存椂鏂囦欢澶勭悊锛堣繘搴�5%锛� + #endregion #region 绗簩姝� 鍒涘缓椤圭洰锛堣繘搴� 10%锛� feedBackMsg?.Invoke("姝e湪鍒涘缓椤圭洰...", Color.Black); - var bllXhsProjectExtensions = new Lazy<BLL.XhsProjectExtensions>(() => new BLL.XhsProjectExtensions()); - - var project = new Vmo.Xhs.XhsProjectExtensions(); + var project = new Vmo.XhsProjectExtensionsVmo(); project.NO = vm.NO; project.Name = vm.Name; project.Address = vm.Address; @@ -55,15 +55,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<Vmo.Xhs.XhsProjectSite>() { - new Vmo.Xhs.XhsProjectSite(){ - 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); @@ -76,7 +77,7 @@ feedBackProgress?.Invoke(100, 10); - #endregion 绗簩姝� 鍒涘缓椤圭洰锛堣繘搴� 10%锛� + #endregion #region 绗笁姝� 璁剧疆鍦板浘浣嶇疆锛堣繘搴� 20%锛� @@ -84,7 +85,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; @@ -93,7 +94,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); @@ -111,17 +112,21 @@ feedBackProgress?.Invoke(100, 20); - #endregion 绗笁姝� 璁剧疆鍦板浘浣嶇疆锛堣繘搴� 20%锛� + #endregion #region 绗洓姝� 鍘嬬缉鏂囦欢瑙f瀽 锛堣繘搴�25%锛� 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; + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; } var tempFolderInfo = new DirectoryInfo(tempFolder); @@ -129,63 +134,92 @@ 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); feedBackProgress?.Invoke(100, 25); - #endregion 绗洓姝� 鍘嬬缉鏂囦欢瑙f瀽 锛堣繘搴�25%锛� + #endregion #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 structOthersFileInfo = allFileInfoList.Find(x => x.Name == HStation.Revit.ConstParas.StructOthersFileName); - var revitModel = HStation.Service.RevitParseHelper.FromJsonFile(jsonFileInfo.FullName, out msg); - if (revitModel == null) + var structRevitModel = HStation.Service.RevitParseHelper.FromJsonFile(structFileInfo.FullName, structOthersFileInfo?.FullName, out msg); + if (structRevitModel == null) { feedBackMsg?.Invoke($"{msg}锛侊紒锛�", Color.Red); - return false; + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; } - var hydroInfo = HStation.Hydro.TransferHelper.FromRevit(revitModel, out msg); + 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); + if (await AssetsMatchingHelper.Matching(matchingParas)) + { + if (AssetsMatchingParasHelper.Apply(hydroInfo, matchingParas)) + { + feedBackMsg?.Invoke("浜у搧鍖归厤鎴愬姛銆傘�傘��", Color.Green); + } + else + { + feedBackMsg?.Invoke("浜у搧鍖归厤澶辫触锛侊紒锛�", Color.Red); + } + } + else + { + feedBackMsg?.Invoke("浜у搧鍖归厤澶辫触锛侊紒锛�", Color.Red); } feedBackMsg?.Invoke("姘村姏缁撴瀯鏂囦欢瑙f瀽鎴愬姛銆傘�傘��", Color.Green); - feedBackProgress?.Invoke(100, 30); - vm.HydroID = hydroId; - #endregion 绗簲姝� 瑙f瀽姘村姏缁撴瀯鏂囦欢 锛堣繘搴�30%锛� + #endregion #region 绗叚姝� 鍏宠仈姘村姏缁撴瀯妯″瀷锛堣繘搴� 40%锛� - var bllXhsProjectSite = new BLL.XhsProjectSiteStd(); - var projectSite = await bllXhsProjectSite.GetDefaultByProjectID(projectId); + var projectSite = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(projectId); if (projectSite == null) { feedBackMsg?.Invoke("椤圭洰绔欎俊鎭敊璇�...", Color.Red); - return false; + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; } var projectSiteId = projectSite.ID; @@ -193,63 +227,63 @@ 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%锛� + #endregion #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 = await Yw.WinFrmUI.BimfaceHelper.UploadFile(rvtFileInfo.FullName);//涓婁紶 + var bimfaceId = 10000878572231; //娴嬭瘯鐢ㄤ緥 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%锛� + #endregion #region 绗叓姝� 淇濆瓨Bimface鏂囦欢 锛堣繘搴� 50%锛� feedBackMsg?.Invoke("姝e湪淇濆瓨Bimface鏂囦欢...", Color.Black); - var bimfaceFile = new Yw.Dto.AddBimfaceFileInput(); + var bimfaceFile = new Yw.Vmo.BimfaceFileVmo(); bimfaceFile.BimfaceId = bimfaceId.ToString(); bimfaceFile.Name = vm.Name; bimfaceFile.ModelType = (int)Yw.Bimface.eModelType.File; @@ -258,46 +292,45 @@ 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%锛� + #endregion #region 绗節姝� 鍏宠仈Bimface鏂囦欢锛堣繘搴� 55%锛� feedBackMsg?.Invoke("姝e湪鍏宠仈Bimface鏂囦欢...", Color.Black); - var bimfaceRelation = new Yw.Dto.AddBimfaceFileRelationInput(); + var bimfaceRelation = new Yw.Vmo.BimfaceFileRelationVmo(); 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; feedBackMsg?.Invoke("Bimface鏂囦欢鍏宠仈鎴愬姛銆傘�傘��", Color.Green); feedBackProgress?.Invoke(100, 55); - #endregion 绗節姝� 鍏宠仈Bimface鏂囦欢锛堣繘搴� 55%锛� + #endregion #region 绗崄姝� 鍙戣捣bimface杞崲锛堣繘搴� 80%锛� @@ -317,6 +350,9 @@ else { feedBackMsg?.Invoke("璺宠繃Bimface妯″瀷杞婚噺鍖栫瓑寰呫�傘�傘��", Color.Black); + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; } } else @@ -327,12 +363,12 @@ feedBackProgress?.Invoke(100, 80); - #endregion 绗崄姝� 鍙戣捣bimface杞崲锛堣繘搴� 80%锛� + #endregion #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); @@ -345,29 +381,13 @@ } 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 + } + + } } \ No newline at end of file -- Gitblit v1.9.3