From ce1cc10e518ddac71cfefd433f8a6af9fb46ed40 Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期五, 27 九月 2024 12:01:02 +0800
Subject: [PATCH] 更改事件名称

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs |  191 ++++++++++++++++++++++++-----------------------
 1 files changed, 99 insertions(+), 92 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..96b6506 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,5 @@
-锘縰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;
@@ -23,8 +24,6 @@
         {
             var msg = string.Empty;
 
-            var IsContinue = true;
-
             #region 绗竴姝� 涓存椂鏂囦欢澶勭悊锛堣繘搴�5%锛�
 
             msg = "寮�濮嬪鍏ラ」鐩�...";
@@ -42,13 +41,11 @@
 
             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.XhsProjectExtensionsVmo();
             project.NO = vm.NO;
@@ -58,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<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);
@@ -79,7 +77,7 @@
 
             feedBackProgress?.Invoke(100, 10);
 
-            #endregion 绗簩姝� 鍒涘缓椤圭洰锛堣繘搴� 10%锛�
+            #endregion
 
             #region 绗笁姝� 璁剧疆鍦板浘浣嶇疆锛堣繘搴� 20%锛�
 
@@ -87,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;
@@ -96,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);
@@ -114,26 +112,19 @@
 
             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;
-            }
-            else
-            {
-                IsContinue = false;
-            }
-
-            if (IsContinue)
-            {
-                feedBackMsg?.Invoke("椤圭洰瀵煎叆鎴愬姛銆傘�傘��", Color.Green);
+                feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue);
                 feedBackProgress?.Invoke(100, 100);
                 return true;
             }
@@ -143,54 +134,82 @@
             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%锛�
 
@@ -198,7 +217,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,57 +227,57 @@
 
             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%锛�
 
@@ -271,21 +292,20 @@
             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%锛�
 
@@ -295,22 +315,22 @@
             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%锛�
 
@@ -330,6 +350,9 @@
                 else
                 {
                     feedBackMsg?.Invoke("璺宠繃Bimface妯″瀷杞婚噺鍖栫瓑寰呫�傘�傘��", Color.Black);
+                    feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue);
+                    feedBackProgress?.Invoke(100, 100);
+                    return true;
                 }
             }
             else
@@ -340,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);
@@ -358,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