From 146ca8c7eefe74d3b73c00a73e99e94e903be401 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期四, 06 二月 2025 15:04:21 +0800 Subject: [PATCH] 增加工况管理功能和计算结果自由压力与绝对压力切换 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs | 633 ++++++++++++++++++++++++++++++++------------------------- 1 files changed, 352 insertions(+), 281 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 fb1f4a7..92b38e5 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,6 +1,4 @@ -锘縰sing DevExpress.XtraEditors; -using static DevExpress.XtraEditors.XtraInputBox; -using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window; +锘縰sing Castle.Core.Internal; namespace HStation.WinFrmUI { @@ -18,14 +16,14 @@ /// <param name="feedBackMsg">淇℃伅鍙嶉</param> /// <param name="feedBackProgress">杩涘害鍙嶉</param> /// <returns></returns> - public static async Task<bool> Import(ImportXhsProjectViewModel vm, Action<string> feedBackMsg, Action<int, int> feedBackProgress) + public static async Task<bool> Import(ImportXhsProjectViewModel vm, Action<string, Color> feedBackMsg, Action<int, int> feedBackProgress) { var msg = string.Empty; #region 绗竴姝� 涓存椂鏂囦欢澶勭悊锛堣繘搴�5%锛� msg = "寮�濮嬪鍏ラ」鐩�..."; - feedBackMsg?.Invoke(msg); + feedBackMsg?.Invoke(msg, Color.Black); //涓存椂鏂囦欢澶硅矾寰� var tempFolder = Path.Combine(Yw.Service.ConfigHelper.DataPath, HStation.Settings.XhsParasHelper.Xhs.DataFolder, _tempFolder); @@ -39,335 +37,408 @@ feedBackProgress?.Invoke(100, 5); - #endregion 绗竴姝� 涓存椂鏂囦欢澶勭悊锛堣繘搴�5%锛� + #endregion - #region 绗簩姝� 鍘嬬缉鏂囦欢瑙f瀽 锛堣繘搴�10%锛� + #region 绗簩姝� 鍒涘缓椤圭洰锛堣繘搴� 10%锛� - msg = "姝e湪瑙f瀽妯″瀷鏂囦欢..."; - feedBackMsg?.Invoke(msg); - var bol = Yw.FileFolderZipHelper.UnZip(vm.ZipFile, tempFolder, null); + //鍒ゆ柇椤圭洰鏁版嵁鍚堟硶鎬� + if (vm.Project == null) + { + feedBackMsg?.Invoke("椤圭洰鏁版嵁鍒濆鍖栭敊璇紒锛侊紒", Color.Red); + return false; + } + + if (vm.Project.ID < 1) + { + feedBackMsg?.Invoke("姝e湪鍒涘缓椤圭洰...", Color.Black); + vm.Project.ID = await BLLFactory<HStation.BLL.XhsProjectExtensions>.Instance.Insert(vm.Project); + if (vm.Project.ID < 1) + { + feedBackMsg?.Invoke("椤圭洰鍒涘缓澶辫触锛侊紒锛�", Color.Red); + return false; + } + vm.Project = await BLLFactory<HStation.BLL.XhsProjectExtensions>.Instance.GetByID(vm.Project.ID); + feedBackMsg?.Invoke("椤圭洰鍒涘缓鎴愬姛銆傘�傘��", Color.Green); + } + else + { + feedBackMsg?.Invoke("姝e湪鏇存柊椤圭洰...", Color.Black); + if (!await BLLFactory<HStation.BLL.XhsProjectExtensions>.Instance.Update(vm.Project)) + { + feedBackMsg?.Invoke("椤圭洰鏇存柊澶辫触锛侊紒锛�", Color.Red); + return false; + } + vm.Project = await BLLFactory<HStation.BLL.XhsProjectExtensions>.Instance.GetByID(vm.Project.ID); + feedBackMsg?.Invoke("椤圭洰鏇存柊鎴愬姛銆傘�傘��", Color.Green); + } + + feedBackProgress?.Invoke(100, 10); + + #endregion + + #region 绗笁姝� 璁剧疆鍦板浘浣嶇疆锛堣繘搴� 20%锛� + + //宸叉湁鍦板浘淇℃伅鎵嶉渶瑕佽繘琛岃缃� + if (vm.MapInfo != null) + { + feedBackMsg?.Invoke("姝e湪璁剧疆浣嶇疆淇℃伅...", Color.Black); + vm.MapInfo.ObjectID = vm.Project.ID; + vm.MapInfo.ObjectName = vm.Project.Name; + if (vm.MapInfo.ID < 1) + { + vm.MapInfo.ID = await BLLFactory<Yw.BLL.MapInfo>.Instance.Insert(vm.MapInfo); + if (vm.MapInfo.ID < 1) + { + feedBackMsg?.Invoke("浣嶇疆淇℃伅璁剧疆澶辫触锛侊紒锛�", Color.Red); + } + else + { + feedBackMsg?.Invoke("浣嶇疆淇℃伅璁剧疆鎴愬姛銆傘�傘��", Color.Green); + } + } + else + { + if (!await BLLFactory<Yw.BLL.MapInfo>.Instance.Update(vm.MapInfo)) + { + feedBackMsg?.Invoke("浣嶇疆淇℃伅璁剧疆澶辫触锛侊紒锛�", Color.Red); + } + else + { + feedBackMsg?.Invoke("浣嶇疆淇℃伅璁剧疆鎴愬姛銆傘�傘��", Color.Green); + } + } + } + else + { + feedBackMsg?.Invoke("鏈缃綅缃俊鎭紒锛侊紒", Color.Red); + } + + feedBackProgress?.Invoke(100, 20); + + #endregion + + #region 绗洓姝� 鍘嬬缉鏂囦欢瑙f瀽 锛堣繘搴�30%锛� + + var zipFilePwd = HStation.Settings.XhsParasHelper.Xhs.File.Password; + var localZipFile = vm.LocalZipFile; + if (!vm.IsLocal) + { + if (vm.TransferRevitFile != null) + { + feedBackMsg?.Invoke("姝e湪涓嬭浇妯″瀷鏂囦欢...", Color.Black); + localZipFile = await BLLFactory<HStation.BLL.TransferRevitFile>.Instance.Download(vm.TransferRevitFile.StorageHouse, vm.TransferRevitFile.StorageCode); + feedBackMsg?.Invoke("妯″瀷鏂囦欢涓嬭浇瀹屾垚锛侊紒锛�", Color.Green); + } + } + feedBackMsg?.Invoke("姝e湪瑙f瀽妯″瀷鏂囦欢...", Color.Black); + var bol = Yw.FileFolderZipHelper.UnZip(localZipFile, tempFolder, zipFilePwd); if (!bol) { - feedBackMsg?.Invoke("妯″瀷鏂囦欢瑙f瀽澶辫触锛侊紒锛�"); - return false; + feedBackMsg?.Invoke("妯″瀷鏂囦欢瑙f瀽澶辫触锛侊紒锛�", Color.Red); + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; } var tempFolderInfo = new DirectoryInfo(tempFolder); var allFileInfoList = tempFolderInfo.GetFiles(); if (allFileInfoList == null || allFileInfoList.Count() < 1) { - feedBackMsg?.Invoke("妯″瀷鏂囦欢鏍煎紡閿欒锛侊紒锛�"); - return false; + feedBackMsg?.Invoke("妯″瀷鏂囦欢鏍煎紡閿欒锛侊紒锛�", Color.Red); + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; } - feedBackMsg?.Invoke("妯″瀷鏂囦欢瑙f瀽鎴愬姛銆傘�傘��"); - - feedBackProgress?.Invoke(100, 10); - - #endregion 绗簩姝� 鍘嬬缉鏂囦欢瑙f瀽 锛堣繘搴�10%锛� - - #region 绗笁姝� 瑙f瀽姘村姏缁撴瀯鏂囦欢 锛堣繘搴�15%锛� - - feedBackMsg?.Invoke("姝e湪瑙f瀽姘村姏缁撴瀯鏂囦欢..."); - var jsonFileInfo = allFileInfoList.Where(x => x.Extension == ".json").FirstOrDefault(); - if (jsonFileInfo == null) - { - feedBackMsg?.Invoke("姘村姏缁撴瀯鏂囦欢鏍煎紡閿欒锛侊紒锛�"); - return false; - } - - var revitModel = HStation.Service.RevitParseHelper.FromJsonFile(jsonFileInfo.FullName, out msg); - if (revitModel == null) - { - feedBackMsg?.Invoke($"{msg}锛侊紒锛�"); - return false; - } - - var hydroInfo = HStation.Hydro.TransferHelper.FromRevit(revitModel, out msg); - if (hydroInfo == null) - { - feedBackMsg?.Invoke($"姘村姏缁撴瀯鏂囦欢瑙f瀽澶辫触锛寋msg}锛侊紒锛�"); - return false; - } - - var bllHydroInfo = new Yw.BLL.HydroModelInfo(); - var hydroId = await bllHydroInfo.Save(hydroInfo); - if (hydroId < 1) - { - feedBackMsg?.Invoke("姘村姏缁撴瀯淇℃伅淇濆瓨澶辫触锛侊紒锛�"); - return false; - } - - feedBackMsg?.Invoke("姘村姏缁撴瀯鏂囦欢瑙f瀽鎴愬姛銆傘�傘��"); - - feedBackProgress?.Invoke(100, 15); - - vm.HydroID = hydroId; - - #endregion 绗笁姝� 瑙f瀽姘村姏缁撴瀯鏂囦欢 锛堣繘搴�15%锛� - - #region 绗洓姝� 鍒涘缓椤圭洰锛堣繘搴� 20%锛� - - feedBackMsg?.Invoke("姝e湪鍒涘缓椤圭洰..."); - - var bllXhsProjectExtensions = new Lazy<BLL.XhsProjectExtensions>(() => new BLL.XhsProjectExtensions()); - - var project = new Vmo.Xhs.XhsProjectExtensions(); - project.NO = vm.NO; - project.Name = vm.Name; - project.Address = vm.Address; - project.Customer = vm.Customer; - project.Flags = vm.Flags; - project.TagName = vm.TagName; - project.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); - if (projectId < 1) - { - feedBackMsg?.Invoke("椤圭洰鍒涘缓澶辫触锛侊紒锛�"); - return false; - } - - feedBackMsg?.Invoke("椤圭洰鍒涘缓鎴愬姛銆傘�傘��"); - - vm.ProjectID = projectId; - - feedBackProgress?.Invoke(100, 20); - - #endregion 绗洓姝� 鍒涘缓椤圭洰锛堣繘搴� 20%锛� - - #region 绗簲姝� 鍏宠仈姘村姏缁撴瀯妯″瀷锛堣繘搴� 25%锛� - - var bllXhsProjectSite = new BLL.XhsProjectSiteStd(); - var projectSite = await bllXhsProjectSite.GetDefaultByProjectID(projectId); - if (projectSite == null) - { - feedBackMsg?.Invoke("椤圭洰绔欎俊鎭敊璇�..."); - return false; - } - - var projectSiteId = projectSite.ID; - vm.ProjectSiteID = projectSite.ID; - - feedBackMsg?.Invoke("姝e湪鍏宠仈姘村姏缁撴瀯妯″瀷..."); - - var hydroRelation = new Yw.Dto.AddHydroModelRelationInput(); - hydroRelation.ObjectType = HStation.Xhs.DataType.XhsProjectSite; - hydroRelation.ObjectID = projectSiteId; - hydroRelation.ModelID = hydroId; - hydroRelation.Purpose = Yw.Hydro.Purpose.Simulation; - hydroRelation.Content = null; - hydroRelation.Description = null; - - var bllHydroRelation = new Yw.BLL.HydroModelRelation(); - var hydroRelationId = await bllHydroRelation.Insert(hydroRelation); - if (hydroRelationId < 1) - { - feedBackMsg?.Invoke("鍏宠仈姘村姏缁撴瀯妯″瀷澶辫触锛侊紒锛�"); - return false; - } - - vm.HydroRelationID = hydroRelationId; - - feedBackMsg?.Invoke("鍏宠仈姘村姏缁撴瀯妯″瀷鎴愬姛銆傘�傘��"); - - feedBackProgress?.Invoke(100, 25); - - #endregion 绗簲姝� 鍏宠仈姘村姏缁撴瀯妯″瀷锛堣繘搴� 25%锛� - - #region 绗叚姝� 璁剧疆鍦板浘浣嶇疆锛堣繘搴� 30%锛� - - feedBackMsg?.Invoke("姝e湪璁剧疆鍦板浘浣嶇疆..."); - - if (vm.Location != null) - { - var mapInfo = new Yw.Vmo.Map.MapInfo(); - mapInfo.ObjectType = HStation.Xhs.DataType.XhsProject; - mapInfo.ObjectID = projectId; - mapInfo.ObjectName = project.Name; - mapInfo.Purpose = Yw.Map.Purpose.Location; - mapInfo.Kind = Yw.Map.Kind.Gaodei; - mapInfo.Shape = Yw.Map.Shape.Marker; - mapInfo.Position = vm.Location.ToJson(); - - var mapInfoId = await new Yw.BLL.MapInfo().Insert(mapInfo); - if (mapInfoId < 1) - { - feedBackMsg?.Invoke("璁剧疆鍦板浘浣嶇疆澶辫触锛侊紒锛�"); - } - else - { - vm.MapInfoID = mapInfoId; - feedBackMsg?.Invoke("璁剧疆鍦板浘浣嶇疆鎴愬姛銆傘�傘��"); - } - } - else - { - feedBackMsg?.Invoke("鏈缃湴鍥句綅缃俊鎭紒锛侊紒"); - } + feedBackMsg?.Invoke("妯″瀷鏂囦欢瑙f瀽鎴愬姛銆傘�傘��", Color.Green); feedBackProgress?.Invoke(100, 30); - #endregion 绗叚姝� 璁剧疆鍦板浘浣嶇疆锛堣繘搴� 30%锛� + #endregion - #region 绗竷姝� 涓婁紶Revit妯″瀷鏂囦欢锛堣繘搴� 45%锛� + #region 绗簲姝� 瑙f瀽姘村姏缁撴瀯鏂囦欢 锛堣繘搴�40%锛� - feedBackMsg?.Invoke("姝e湪瑙f瀽Revit妯″瀷鏂囦欢..."); - var rvtFileInfo = allFileInfoList.Where(x => x.Extension == ".rvt").FirstOrDefault(); - if (rvtFileInfo == null) + feedBackMsg?.Invoke("姝e湪瑙f瀽姘村姏缁撴瀯鏂囦欢...", Color.Black); + var structFileInfo = allFileInfoList.Find(x => x.Name == HStation.Revit.ConstParas.StructFileName); + if (structFileInfo == null) { - feedBackMsg?.Invoke("Revit妯″瀷鏂囦欢瑙f瀽澶辫触锛侊紒锛�"); - feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��"); + feedBackMsg?.Invoke("姘村姏缁撴瀯鏂囦欢鏍煎紡閿欒锛侊紒锛�", Color.Red); + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); return true; } - - //var bimfaceId = await Yw.WinFrmUI.BimfaceHelper.UploadFile(rvtFileInfo.FullName);//涓婁紶 - var bimfaceId = 10000872561364; //娴嬭瘯鐢ㄤ緥 - if (bimfaceId < 1) + var structOthersFileInfo = allFileInfoList.Find(x => x.Name == HStation.Revit.ConstParas.StructOthersFileName); + vm.RevitModel = HStation.Service.RevitParseHelper.FromJsonFile + (structFileInfo.FullName, structOthersFileInfo?.FullName, out bool structFileResult, out List<string> structFileMsgList); + //瑙f瀽缁撴灉鍒ゆ柇 + if (!structFileResult) { - feedBackMsg?.Invoke("Revit妯″瀷鏂囦欢涓婁紶澶辫触锛侊紒锛�"); - feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��"); - return true; + structFileMsgList?.ForEach(x => feedBackMsg?.Invoke(x, Color.Red)); } - - vm.BimfaceId = bimfaceId; - - feedBackMsg?.Invoke("瑙f瀽Revit妯″瀷鏂囦欢鎴愬姛銆傘�傘��"); - - feedBackProgress?.Invoke(100, 45); - - #endregion 绗竷姝� 涓婁紶Revit妯″瀷鏂囦欢锛堣繘搴� 45%锛� - - #region 绗叓姝� 淇濆瓨Bimface鏂囦欢 锛堣繘搴� 50%锛� - - feedBackMsg?.Invoke("姝e湪淇濆瓨Bimface鏂囦欢..."); - - var bimfaceFile = new Yw.Dto.AddBimfaceFileInput(); - bimfaceFile.BimfaceId = bimfaceId.ToString(); - bimfaceFile.Name = vm.Name; - bimfaceFile.ModelType = (int)Yw.Bimface.eModelType.File; - bimfaceFile.FileStatus = (int)Yw.Bimface.eFileStatus.UploadSucceed; - bimfaceFile.FormatType = (int)Yw.Bimface.eFormatType._3D; - 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); - if (bimfaceFileId < 1) + //Revit灞炴�ч敊璇鐞� + var hasRevitPropError = false; + if (vm.RevitModel != null) { - feedBackMsg?.Invoke("Bimface鏂囦欢淇濆瓨澶辫触锛侊紒锛�"); - feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��"); - return true; - } - vm.BimfaceFileID = bimfaceFileId; - - feedBackMsg?.Invoke("Bimface鏂囦欢淇濆瓨鎴愬姛銆傘�傘��"); - - feedBackProgress?.Invoke(100, 50); - - #endregion 绗叓姝� 淇濆瓨Bimface鏂囦欢 锛堣繘搴� 50%锛� - - #region 绗節姝� 鍏宠仈Bimface鏂囦欢锛堣繘搴� 55%锛� - - feedBackMsg?.Invoke("姝e湪鍏宠仈Bimface鏂囦欢..."); - - var bimfaceRelation = new Yw.Dto.AddBimfaceFileRelationInput(); - bimfaceRelation.ObjectType = HStation.Xhs.DataType.XhsProjectSite; - bimfaceRelation.ObjectID = projectSiteId; - bimfaceRelation.BimfaceFileID = bimfaceFileId; - bimfaceRelation.Purpose = Yw.Bimface.Purpose.Simulation; - bimfaceRelation.Description = vm.Description; - - var bllBimfaceRelation = new Yw.BLL.BimfaceFileRelation(); - var bimfaceRelationId = await bllBimfaceRelation.Insert(bimfaceRelation); - if (bimfaceRelationId < 1) - { - feedBackMsg?.Invoke("Bimface鏂囦欢鍏宠仈澶辫触锛侊紒锛�"); - feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��"); - return true; - } - vm.BimfaceFileRelationID = bimfaceRelationId; - feedBackMsg?.Invoke("Bimface鏂囦欢鍏宠仈鎴愬姛銆傘�傘��"); - feedBackProgress?.Invoke(100, 55); - - #endregion 绗節姝� 鍏宠仈Bimface鏂囦欢锛堣繘搴� 55%锛� - - #region 绗節姝� 鍙戣捣bimface杞崲锛堣繘搴� 80%锛� - - feedBackMsg?.Invoke("姝e湪杩涜Bimface妯″瀷杞婚噺鍖�..."); - // var bimfaceTranslateStatus = await Yw.WinFrmUI.BimfaceHelper.TranslateRvtFile(bimfaceId);//鍙戣捣杞崲 - var bimfaceTranslateStatus = Yw.BIMFace.eTranslateStatus.Processing;//娴嬭瘯浠g爜 - feedBackProgress?.Invoke(100, 60); - if (bimfaceTranslateStatus != Yw.BIMFace.eTranslateStatus.Success) - { - var dlgResult = XtraMessageBox.Show("Bimface妯″瀷杞婚噺鍖栭渶瑕佷竴瀹氱殑鏃堕棿锛屾槸鍚︾户缁瓑寰咃紵", "璇㈤棶", MessageBoxButtons.YesNo, MessageBoxIcon.Question); - if (dlgResult == DialogResult.Yes) + var allRevitParterList = vm.RevitModel.GetAllParters(); + foreach (var revitParter in allRevitParterList) { - await Yw.WinFrmUI.BimfaceHelper.WaitFileTranslateStatusUntilSuccess(bimfaceId, 3000); - vm.BimfaceConverted = true; - feedBackMsg?.Invoke("Bimface妯″瀷杞婚噺鍖栧畬鎴愩�傘�傘��"); + 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.Id}锛屾瀯浠跺睘鎬э細{revitParterPropStatus.PropName}锛岄敊璇細{revitParterPropStatus.StatusInfo} ", Color.Red); + } + break; + + default: break; + } + } + } + } + } + if (hasRevitPropError || !structFileResult) + { + feedBackMsg?.Invoke($"姘村姏缁撴瀯鏂囦欢瑙f瀽閿欒锛侊紒锛�", Color.Red); + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; + } + + vm.HydroInfo = HStation.Hydro.TransferHelper.FromRevit + ( + vm.RevitModel, + out List<Yw.Model.HydroParterPropStatusInfo> allPropStatusDbList, + out List<Yw.Model.HydroParterScenePropValueInfo> allScenePropValueList, + out List<Yw.Model.HydroDecoratorInfo> allDecoratorList, + out msg + ); + if (vm.HydroInfo == null) + { + feedBackMsg?.Invoke($"姘村姏缁撴瀯鏂囦欢瑙f瀽澶辫触锛寋msg}锛侊紒锛�", Color.Red); + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; + } + + var propStatusHelper = new HydroPropStatusHelper(vm.HydroInfo, allPropStatusDbList); + + feedBackMsg?.Invoke("姝e湪杩涜浜у搧鍖归厤...", Color.Black); + var matchingParas = Yw.WinFrmUI.HydroMatchingHelper.Create(vm.HydroInfo); + if (AssetsMatchingHelper.Matching(matchingParas, out string error)) + { + if (Yw.WinFrmUI.HydroMatchingHelper.Apply(vm.HydroInfo, matchingParas)) + { + feedBackMsg?.Invoke("浜у搧鍖归厤瀹屾垚銆傘�傘��", Color.Green); } else { - feedBackMsg?.Invoke("璺宠繃Bimface妯″瀷杞婚噺鍖栫瓑寰呫�傘�傘��"); + feedBackMsg?.Invoke("浜у搧鍖归厤澶辫触锛侊紒锛�", Color.Red); } } else { - vm.BimfaceConverted = true; - feedBackMsg?.Invoke("Bimface妯″瀷杞婚噺鍖栧畬鎴愩�傘�傘��"); + feedBackMsg?.Invoke("浜у搧鍖归厤澶辫触锛侊紒锛�", Color.Red); } - feedBackProgress?.Invoke(100, 80); - - #endregion 绗節姝� 鍙戣捣bimface杞崲锛堣繘搴� 80%锛� - - #region 绗崄姝� 鏇存柊Bimface鏂囦欢鐘舵�侊紙杩涘害 90%锛� - - feedBackMsg?.Invoke("姝e湪鏇存柊Bimface鏂囦欢鐘舵��..."); - bol = await bllBimfaceFile.UpdateFileStatus(bimfaceFileId, (int)Yw.Bimface.eFileStatus.ConvertSucceed); - if (bol) + feedBackMsg?.Invoke("姝e湪杩涜绠$綉鍙傛暟淇...", Color.Black); + vm.HydroInfo.RepairParas(propStatusHelper, out msg); + if (string.IsNullOrEmpty(msg)) { - feedBackMsg?.Invoke("Bimface鏂囦欢鐘舵�佹洿鏂版垚鍔熴�傘�傘��"); + feedBackMsg?.Invoke("绠$綉鍙傛暟淇瀹屾垚銆傘�傘��", Color.Green); } else { - feedBackMsg?.Invoke("Bimface鏂囦欢鐘舵�佹洿鏂板け璐ワ紒锛侊紒"); - feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��"); + feedBackMsg?.Invoke(msg, Color.Red); + } + + feedBackMsg?.Invoke("姝e湪淇濆瓨姘村姏缁撴瀯淇℃伅...", Color.Black); + vm.HydroInfo.ID = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.Save(vm.HydroInfo); + if (vm.HydroInfo.ID < 1) + { + feedBackMsg?.Invoke("姘村姏缁撴瀯淇℃伅淇濆瓨澶辫触锛侊紒锛�", Color.Red); + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; + } + feedBackMsg?.Invoke("姘村姏缁撴瀯淇℃伅淇濆瓨鎴愬姛銆傘�傘��", Color.Green); + + feedBackMsg?.Invoke("姘村姏缁撴瀯鏂囦欢瑙f瀽鎴愬姛銆傘�傘��", Color.Green); + feedBackProgress?.Invoke(100, 40); + vm.HydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(vm.HydroInfo.ID); + + //灞炴�х姸鎬� + if (allPropStatusDbList != null && allPropStatusDbList.Count > 0) + { + await BLLFactory<Yw.BLL.HydroParterPropStatusInfo>.Instance.Save(vm.HydroInfo.ID, allPropStatusDbList); + } + + //鍦烘櫙灞炴�� + if (allScenePropValueList != null && allScenePropValueList.Count > 0) + { + await BLLFactory<Yw.BLL.HydroParterScenePropValueInfo>.Instance.Save(vm.HydroInfo.ID, HStation.Revit.ConstParas.Scene, allScenePropValueList); + } + + //瑁呴グ浠� + if (allDecoratorList != null && allDecoratorList.Count > 0) + { + await BLLFactory<Yw.BLL.HydroDecoratorInfo>.Instance.Save(vm.HydroInfo.ID, HStation.Revit.ConstParas.Scene, allDecoratorList); + } + + #endregion + + #region 绗叚姝� 鍏宠仈姘村姏缁撴瀯妯″瀷锛堣繘搴� 50%锛� + + feedBackMsg?.Invoke("姝e湪鍏宠仈姘村姏缁撴瀯妯″瀷...", Color.Black); + + vm.HydroRelation = new Yw.Vmo.HydroModelRelationVmo(); + vm.HydroRelation.ObjectType = HStation.Xhs.DataType.XhsProjectSite; + vm.HydroRelation.ObjectID = vm.Project.SiteList.First().ID; + vm.HydroRelation.ModelID = vm.HydroInfo.ID; + vm.HydroRelation.Purpose = Yw.Hydro.Purpose.Simulation; + vm.HydroRelation.Content = null; + vm.HydroRelation.Description = "瀵煎叆鑷姩鐢熸垚"; + + vm.HydroRelation.ID = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance.Insert(vm.HydroRelation); + if (vm.HydroRelation.ID < 1) + { + feedBackMsg?.Invoke("鍏宠仈姘村姏缁撴瀯妯″瀷澶辫触锛侊紒锛�", Color.Red); + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; + } + vm.HydroRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance.GetByID(vm.HydroRelation.ID); + + feedBackMsg?.Invoke("鍏宠仈姘村姏缁撴瀯妯″瀷鎴愬姛銆傘�傘��", Color.Green); + feedBackProgress?.Invoke(100, 50); + + #endregion + + #region 绗竷姝� 涓婁紶Revit妯″瀷鏂囦欢锛堣繘搴� 60%锛� + + feedBackMsg?.Invoke("姝e湪瑙f瀽Revit妯″瀷鏂囦欢...", Color.Black); + 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);//姝e紡浠g爜 + //var bimfaceId = 10000899666805;//娴嬭瘯鐢ㄤ緥 鍒舵爱寰幆:10000884893369 10000896755736 10000899666805 + if (bimfaceId < 1) + { + feedBackMsg?.Invoke("Revit妯″瀷鏂囦欢涓婁紶澶辫触锛侊紒锛�", Color.Red); + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; + } + + feedBackMsg?.Invoke("瑙f瀽Revit妯″瀷鏂囦欢鎴愬姛銆傘�傘��", Color.Green); + feedBackProgress?.Invoke(100, 60); + + #endregion + + #region 绗叓姝� 淇濆瓨Bimface鏂囦欢 锛堣繘搴� 65%锛� + + feedBackMsg?.Invoke("姝e湪淇濆瓨Bimface鏂囦欢...", Color.Black); + + vm.BimfaceFile = new Yw.Vmo.BimfaceFileVmo(); + vm.BimfaceFile.BimfaceId = bimfaceId.ToString(); + vm.BimfaceFile.Name = vm.Project.Name; + vm.BimfaceFile.ModelType = (int)Yw.Bimface.eModelType.File; + vm.BimfaceFile.FileStatus = (int)Yw.Bimface.eFileStatus.UploadSucceed; + vm.BimfaceFile.FormatType = (int)Yw.Bimface.eFormatType._3D; + vm.BimfaceFile.FileSuffix = rvtFileInfo.Extension; + vm.BimfaceFile.FileSize = string.Format("{0}MB", System.Math.Ceiling(rvtFileInfo.Length / 1024.0 / 1024.0)); + + vm.BimfaceFile.ID = await BLLFactory<Yw.BLL.BimfaceFile>.Instance.Insert(vm.BimfaceFile); + if (vm.BimfaceFile.ID < 1) + { + feedBackMsg?.Invoke("Bimface鏂囦欢淇濆瓨澶辫触锛侊紒锛�", Color.Red); + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; + } + vm.BimfaceFile = await BLLFactory<Yw.BLL.BimfaceFile>.Instance.GetByID(vm.BimfaceFile.ID); + feedBackMsg?.Invoke("Bimface鏂囦欢淇濆瓨鎴愬姛銆傘�傘��", Color.Green); + feedBackProgress?.Invoke(100, 65); + + #endregion + + #region 绗節姝� 鍏宠仈Bimface鏂囦欢锛堣繘搴� 70%锛� + + feedBackMsg?.Invoke("姝e湪鍏宠仈Bimface鏂囦欢...", Color.Black); + + vm.BimfaceRelation = new Yw.Vmo.BimfaceFileRelationVmo(); + vm.BimfaceRelation.ObjectType = HStation.Xhs.DataType.XhsProjectSite; + vm.BimfaceRelation.ObjectID = vm.Project.SiteList.First().ID; + vm.BimfaceRelation.BimfaceFileID = vm.BimfaceFile.ID; + vm.BimfaceRelation.Purpose = Yw.Bimface.Purpose.Simulation; + vm.BimfaceRelation.Description = "瀵煎叆鑷姩鐢熸垚"; + + vm.BimfaceRelation.ID = await BLLFactory<Yw.BLL.BimfaceFileRelation>.Instance.Insert(vm.BimfaceRelation); + if (vm.BimfaceRelation.ID < 1) + { + feedBackMsg?.Invoke("Bimface鏂囦欢鍏宠仈澶辫触锛侊紒锛�", Color.Red); + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + feedBackProgress?.Invoke(100, 100); + return true; + } + vm.BimfaceRelation = await BLLFactory<Yw.BLL.BimfaceFileRelation>.Instance.GetByID(vm.BimfaceRelation.ID); + feedBackMsg?.Invoke("Bimface鏂囦欢鍏宠仈鎴愬姛銆傘�傘��", Color.Green); + feedBackProgress?.Invoke(100, 70); + + #endregion + + #region 绗崄姝� 鍙戣捣妯″瀷杞崲锛堣繘搴� 90%锛� + + feedBackProgress?.Invoke(100, 60); + feedBackMsg?.Invoke("姝e湪杩涜妯″瀷杞婚噺鍖�...", Color.Black); + var bimfaceTranslateStatus = await Yw.WinFrmUI.BimfaceHelper.TranslateRvtFile(bimfaceId);//鍙戣捣杞崲 + //var bimfaceTranslateStatus = Yw.BIMFace.eTranslateStatus.Processing;//娴嬭瘯浠g爜 + + if (bimfaceTranslateStatus != Yw.BIMFace.eTranslateStatus.Success) + { + await Yw.WinFrmUI.BimfaceHelper.WaitFileTranslateStatusUntilSuccess(bimfaceId, 3000); + } + feedBackMsg?.Invoke("妯″瀷杞婚噺鍖栧畬鎴愩�傘�傘��", Color.Green); feedBackProgress?.Invoke(100, 90); - #endregion 绗崄姝� 鏇存柊Bimface鏂囦欢鐘舵�侊紙杩涘害 90%锛� + #endregion - #region 绗崄涓�姝� 椤圭洰鍙戝竷锛堣繘搴� 100%锛� + #region 绗崄涓�姝� 鏇存柊妯″瀷鏂囦欢鐘舵�侊紙杩涘害 100%锛� - feedBackMsg?.Invoke("姝e湪鍙戝竷椤圭洰..."); - var bllXhsProject = new BLL.XhsProject(); - bol = await bllXhsProject.Publish(projectId); - if (!bol) + feedBackMsg?.Invoke("姝e湪鏇存柊妯″瀷鏂囦欢鐘舵��...", Color.Black); + bol = await BLLFactory<Yw.BLL.BimfaceFile>.Instance.UpdateFileStatus(vm.BimfaceFile.ID, (int)Yw.Bimface.eFileStatus.ConvertSucceed); + if (bol) { - feedBackMsg?.Invoke("椤圭洰鍙戝竷澶辫触..."); + vm.BimfaceFile.FileStatus = (int)Yw.Bimface.eFileStatus.ConvertSucceed; + feedBackMsg?.Invoke("妯″瀷鏂囦欢鐘舵�佹洿鏂版垚鍔熴�傘�傘��", Color.Green); } else { - vm.IsPublished = true; - feedBackMsg?.Invoke("椤圭洰鍙戝竷鎴愬姛..."); + feedBackMsg?.Invoke("妯″瀷鏂囦欢鐘舵�佹洿鏂板け璐ワ紒锛侊紒", Color.Red); + feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue); + return true; } 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