From 9eb94e9eec2e2e164698e34d0481d66093c8655b Mon Sep 17 00:00:00 2001
From: Shuxia Ning <NingShuxia0927@outlook.com>
Date: 星期三, 15 一月 2025 17:40:55 +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 |  370 ++++++++++++++++++++++++++++------------------------
 1 files changed, 200 insertions(+), 170 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 6fd6f31..68d7fc9 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,9 +1,4 @@
 锘縰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;
 
 namespace HStation.WinFrmUI
 {
@@ -46,35 +41,36 @@
 
             #region 绗簩姝� 鍒涘缓椤圭洰锛堣繘搴� 10%锛�
 
-            feedBackMsg?.Invoke("姝e湪鍒涘缓椤圭洰...", Color.Black);
-
-            var project = new Vmo.XhsProjectExtensionsVmo();
-            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<XhsProjectSiteVmo>()
-             {
-                    new XhsProjectSiteVmo()
-                     {
-                            Name=vm.Name,
-                            Description=vm.Description
-                     }
-             };
-
-            var projectId = await BLLFactory<HStation.BLL.XhsProjectExtensions>.Instance.Insert(project);
-            if (projectId < 1)
+            //鍒ゆ柇椤圭洰鏁版嵁鍚堟硶鎬�
+            if (vm.Project == null)
             {
-                feedBackMsg?.Invoke("椤圭洰鍒涘缓澶辫触锛侊紒锛�", Color.Red);
+                feedBackMsg?.Invoke("椤圭洰鏁版嵁鍒濆鍖栭敊璇紒锛侊紒", Color.Red);
                 return false;
             }
 
-            feedBackMsg?.Invoke("椤圭洰鍒涘缓鎴愬姛銆傘�傘��", Color.Green);
-
-            vm.ProjectID = projectId;
+            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);
 
@@ -82,46 +78,60 @@
 
             #region 绗笁姝� 璁剧疆鍦板浘浣嶇疆锛堣繘搴� 20%锛�
 
-            feedBackMsg?.Invoke("姝e湪璁剧疆鍦板浘浣嶇疆...", Color.Black);
-
-            if (vm.Location != null)
+            //宸叉湁鍦板浘淇℃伅鎵嶉渶瑕佽繘琛岃缃�
+            if (vm.MapInfo != null)
             {
-                var mapInfo = new Yw.Vmo.MapInfoVmo();
-                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 BLLFactory<Yw.BLL.MapInfo>.Instance.Insert(mapInfo);
-                if (mapInfoId < 1)
+                feedBackMsg?.Invoke("姝e湪璁剧疆浣嶇疆淇℃伅...", Color.Black);
+                vm.MapInfo.ObjectID = vm.Project.ID;
+                vm.MapInfo.ObjectName = vm.Project.Name;
+                if (vm.MapInfo.ID < 1)
                 {
-                    feedBackMsg?.Invoke("璁剧疆鍦板浘浣嶇疆澶辫触锛侊紒锛�", Color.Red);
+                    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
                 {
-                    vm.MapInfoID = mapInfoId;
-                    feedBackMsg?.Invoke("璁剧疆鍦板浘浣嶇疆鎴愬姛銆傘�傘��", Color.Green);
+                    if (!await BLLFactory<Yw.BLL.MapInfo>.Instance.Update(vm.MapInfo))
+                    {
+                        feedBackMsg?.Invoke("浣嶇疆淇℃伅璁剧疆澶辫触锛侊紒锛�", Color.Red);
+                    }
+                    else
+                    {
+                        feedBackMsg?.Invoke("浣嶇疆淇℃伅璁剧疆鎴愬姛銆傘�傘��", Color.Green);
+                    }
                 }
             }
             else
             {
-                feedBackMsg?.Invoke("鏈缃湴鍥句綅缃俊鎭紒锛侊紒", Color.Red);
+                feedBackMsg?.Invoke("鏈缃綅缃俊鎭紒锛侊紒", Color.Red);
             }
 
             feedBackProgress?.Invoke(100, 20);
 
             #endregion 绗笁姝� 璁剧疆鍦板浘浣嶇疆锛堣繘搴� 20%锛�
 
-            #region 绗洓姝� 鍘嬬缉鏂囦欢瑙f瀽 锛堣繘搴�25%锛�
-
-            msg = "姝e湪瑙f瀽妯″瀷鏂囦欢...";
-            feedBackMsg?.Invoke(msg, Color.Black);
+            #region 绗洓姝� 鍘嬬缉鏂囦欢瑙f瀽 锛堣繘搴�30%锛�
 
             var zipFilePwd = HStation.Settings.XhsParasHelper.Xhs.File.Password;
-            var bol = Yw.FileFolderZipHelper.UnZip(vm.ZipFile, tempFolder, zipFilePwd);
+            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瀽澶辫触锛侊紒锛�", Color.Red);
@@ -142,11 +152,11 @@
 
             feedBackMsg?.Invoke("妯″瀷鏂囦欢瑙f瀽鎴愬姛銆傘�傘��", Color.Green);
 
-            feedBackProgress?.Invoke(100, 25);
+            feedBackProgress?.Invoke(100, 30);
 
-            #endregion 绗洓姝� 鍘嬬缉鏂囦欢瑙f瀽 锛堣繘搴�25%锛�
+            #endregion 绗洓姝� 鍘嬬缉鏂囦欢瑙f瀽 锛堣繘搴�30%锛�
 
-            #region 绗簲姝� 瑙f瀽姘村姏缁撴瀯鏂囦欢 锛堣繘搴�30%锛�
+            #region 绗簲姝� 瑙f瀽姘村姏缁撴瀯鏂囦欢 锛堣繘搴�40%锛�
 
             feedBackMsg?.Invoke("姝e湪瑙f瀽姘村姏缁撴瀯鏂囦欢...", Color.Black);
             var structFileInfo = allFileInfoList.Find(x => x.Name == HStation.Revit.ConstParas.StructFileName);
@@ -158,14 +168,18 @@
                 return true;
             }
             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);
+            vm.RevitModel = HStation.Service.RevitParseHelper.FromJsonFile
+               (structFileInfo.FullName, structOthersFileInfo?.FullName, out bool structFileResult, out List<string> structFileMsgList);
+            //瑙f瀽缁撴灉鍒ゆ柇
+            if (!structFileResult)
+            {
+                structFileMsgList?.ForEach(x => feedBackMsg?.Invoke(x, Color.Red));
+            }
             //Revit灞炴�ч敊璇鐞�
             var hasRevitPropError = false;
-            if (structRevitModel != null)
+            if (vm.RevitModel != null)
             {
-                var allRevitParterList = structRevitModel.GetAllParters();
+                var allRevitParterList = vm.RevitModel.GetAllParters();
                 foreach (var revitParter in allRevitParterList)
                 {
                     if (revitParter.PropStatusList != null && revitParter.PropStatusList.Count > 0)
@@ -180,33 +194,16 @@
                             {
                                 case Revit.ePropStatus.Error:
                                     {
-                                        feedBackMsg?.Invoke($"鏋勪欢缂栫爜锛歿revitParter.Id}锛屾瀯浠跺睘鎬э細{revitParterPropStatus.PropName}锛岄敊璇細{revitParterPropStatus.StatusInfo} ", Color.Red);
+                                        feedBackMsg?.Invoke($"鏋勪欢绫诲瀷锛歿revitParter.Catalog}锛屾瀯浠剁紪鐮侊細{revitParter.Id}锛屾瀯浠跺睘鎬э細{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;
                             }
                         }
                     }
                 }
             }
-
-            //瑙f瀽缁撴灉鍒ゆ柇
-            if (!structFileResult)
-            {
-                structFileMsgList?.ForEach(x => feedBackMsg?.Invoke(x, Color.Red));
-            }
-
             if (hasRevitPropError || !structFileResult)
             {
                 feedBackMsg?.Invoke($"姘村姏缁撴瀯鏂囦欢瑙f瀽閿欒锛侊紒锛�", Color.Red);
@@ -215,8 +212,15 @@
                 return true;
             }
 
-            var hydroInfo = HStation.Hydro.TransferHelper.FromRevit(structRevitModel, out msg);
-            if (hydroInfo == null)
+            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);
@@ -224,23 +228,15 @@
                 return true;
             }
 
-            var hydroId = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.Save(hydroInfo);
-            if (hydroId < 1)
-            {
-                feedBackMsg?.Invoke("姘村姏缁撴瀯淇℃伅淇濆瓨澶辫触锛侊紒锛�", Color.Red);
-                feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue);
-                feedBackProgress?.Invoke(100, 100);
-                return true;
-            }
+            var propStatusHelper = new HydroPropStatusHelper(vm.HydroInfo, allPropStatusDbList);
 
             feedBackMsg?.Invoke("姝e湪杩涜浜у搧鍖归厤...", Color.Black);
-            hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroId);
-            var matchingParas = AssetsMatchingParasHelper.Create(hydroInfo, null);
+            var matchingParas = Yw.WinFrmUI.HydroMatchingHelper.Create(vm.HydroInfo);
             if (AssetsMatchingHelper.Matching(matchingParas, out string error))
             {
-                if (AssetsMatchingParasHelper.Apply(hydroInfo, matchingParas))
+                if (Yw.WinFrmUI.HydroMatchingHelper.Apply(vm.HydroInfo, matchingParas))
                 {
-                    feedBackMsg?.Invoke("浜у搧鍖归厤鎴愬姛銆傘�傘��", Color.Green);
+                    feedBackMsg?.Invoke("浜у搧鍖归厤瀹屾垚銆傘�傘��", Color.Green);
                 }
                 else
                 {
@@ -251,54 +247,81 @@
             {
                 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%锛�
-
-            #region 绗叚姝� 鍏宠仈姘村姏缁撴瀯妯″瀷锛堣繘搴� 40%锛�
-
-            var projectSite = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(projectId);
-            if (projectSite == null)
+            feedBackMsg?.Invoke("姝e湪杩涜绠$綉鍙傛暟淇...", Color.Black);
+            vm.HydroInfo.RepairParas(propStatusHelper, out msg);
+            if (string.IsNullOrEmpty(msg))
             {
-                feedBackMsg?.Invoke("椤圭洰绔欎俊鎭敊璇�...", Color.Red);
+                feedBackMsg?.Invoke("绠$綉鍙傛暟淇瀹屾垚銆傘�傘��", Color.Green);
+            }
+            else
+            {
+                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);
 
-            var projectSiteId = projectSite.ID;
-            vm.ProjectSiteID = projectSite.ID;
+            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 绗簲姝� 瑙f瀽姘村姏缁撴瀯鏂囦欢 锛堣繘搴�40%锛�
+
+            #region 绗叚姝� 鍏宠仈姘村姏缁撴瀯妯″瀷锛堣繘搴� 50%锛�
 
             feedBackMsg?.Invoke("姝e湪鍏宠仈姘村姏缁撴瀯妯″瀷...", Color.Black);
 
-            var hydroRelation = new Yw.Vmo.HydroModelRelationVmo();
-            hydroRelation.ObjectType = HStation.Xhs.DataType.XhsProjectSite;
-            hydroRelation.ObjectID = projectSiteId;
-            hydroRelation.ModelID = hydroId;
-            hydroRelation.Purpose = HStation.Xhs.Purpose.Simulation;
-            hydroRelation.Content = null;
-            hydroRelation.Description = null;
+            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 = "瀵煎叆鑷姩鐢熸垚";
 
-            var hydroRelationId = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance.Insert(hydroRelation);
-            if (hydroRelationId < 1)
+            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);
 
-            vm.HydroRelationID = hydroRelationId;
             feedBackMsg?.Invoke("鍏宠仈姘村姏缁撴瀯妯″瀷鎴愬姛銆傘�傘��", Color.Green);
-            feedBackProgress?.Invoke(100, 40);
+            feedBackProgress?.Invoke(100, 50);
 
-            #endregion 绗叚姝� 鍏宠仈姘村姏缁撴瀯妯″瀷锛堣繘搴� 40%锛�
+            #endregion 绗叚姝� 鍏宠仈姘村姏缁撴瀯妯″瀷锛堣繘搴� 50%锛�
 
-            #region 绗竷姝� 涓婁紶Revit妯″瀷鏂囦欢锛堣繘搴� 45%锛�
+            #region 绗竷姝� 涓婁紶Revit妯″瀷鏂囦欢锛堣繘搴� 60%锛�
 
             feedBackMsg?.Invoke("姝e湪瑙f瀽Revit妯″瀷鏂囦欢...", Color.Black);
             var rvtFileInfo = allFileInfoList.Find(x => x.Name == HStation.Revit.ConstParas.RvtFileName);
@@ -310,8 +333,8 @@
                 return true;
             }
 
-            //var bimfaceId = await Yw.WinFrmUI.BimfaceHelper.UploadFile(rvtFileInfo.FullName);//涓婁紶
-            var bimfaceId = 10000884283372; //娴嬭瘯鐢ㄤ緥 10000878572231 10000882826621  10000884283372
+            //var bimfaceId = await Yw.WinFrmUI.BimfaceHelper.UploadFile(rvtFileInfo.FullName);//姝e紡浠g爜
+            var bimfaceId = 10000899666805;//娴嬭瘯鐢ㄤ緥  10000884893369  10000894297457  10000895957527  10000896316958 10000896755736
             if (bimfaceId < 1)
             {
                 feedBackMsg?.Invoke("Revit妯″瀷鏂囦欢涓婁紶澶辫触锛侊紒锛�", Color.Red);
@@ -320,83 +343,90 @@
                 return true;
             }
 
-            vm.BimfaceId = bimfaceId;
             feedBackMsg?.Invoke("瑙f瀽Revit妯″瀷鏂囦欢鎴愬姛銆傘�傘��", Color.Green);
-            feedBackProgress?.Invoke(100, 45);
+            feedBackProgress?.Invoke(100, 60);
 
-            #endregion 绗竷姝� 涓婁紶Revit妯″瀷鏂囦欢锛堣繘搴� 45%锛�
+            #endregion 绗竷姝� 涓婁紶Revit妯″瀷鏂囦欢锛堣繘搴� 60%锛�
 
-            #region 绗叓姝� 淇濆瓨Bimface鏂囦欢 锛堣繘搴� 50%锛�
+            #region 绗叓姝� 淇濆瓨Bimface鏂囦欢 锛堣繘搴� 65%锛�
 
             feedBackMsg?.Invoke("姝e湪淇濆瓨Bimface鏂囦欢...", Color.Black);
 
-            var bimfaceFile = new Yw.Vmo.BimfaceFileVmo();
-            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));
+            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));
 
-            var bimfaceFileId = await BLLFactory<Yw.BLL.BimfaceFile>.Instance.Insert(bimfaceFile);
-            if (bimfaceFileId < 1)
+            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.BimfaceFileID = bimfaceFileId;
+            vm.BimfaceFile = await BLLFactory<Yw.BLL.BimfaceFile>.Instance.GetByID(vm.BimfaceFile.ID);
             feedBackMsg?.Invoke("Bimface鏂囦欢淇濆瓨鎴愬姛銆傘�傘��", Color.Green);
-            feedBackProgress?.Invoke(100, 50);
+            feedBackProgress?.Invoke(100, 65);
 
-            #endregion 绗叓姝� 淇濆瓨Bimface鏂囦欢 锛堣繘搴� 50%锛�
+            #endregion 绗叓姝� 淇濆瓨Bimface鏂囦欢 锛堣繘搴� 65%锛�
 
-            #region 绗節姝� 鍏宠仈Bimface鏂囦欢锛堣繘搴� 55%锛�
+            #region 绗節姝� 鍏宠仈Bimface鏂囦欢锛堣繘搴� 70%锛�
 
             feedBackMsg?.Invoke("姝e湪鍏宠仈Bimface鏂囦欢...", Color.Black);
 
-            var bimfaceRelation = new Yw.Vmo.BimfaceFileRelationVmo();
-            bimfaceRelation.ObjectType = HStation.Xhs.DataType.XhsProjectSite;
-            bimfaceRelation.ObjectID = projectSiteId;
-            bimfaceRelation.BimfaceFileID = bimfaceFileId;
-            bimfaceRelation.Purpose = HStation.Xhs.Purpose.Simulation;
-            bimfaceRelation.Description = vm.Description;
+            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 = "瀵煎叆鑷姩鐢熸垚";
 
-            var bimfaceRelationId = await BLLFactory<Yw.BLL.BimfaceFileRelation>.Instance.Insert(bimfaceRelation);
-            if (bimfaceRelationId < 1)
+            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.BimfaceFileRelationID = bimfaceRelationId;
+            vm.BimfaceRelation = await BLLFactory<Yw.BLL.BimfaceFileRelation>.Instance.GetByID(vm.BimfaceRelation.ID);
             feedBackMsg?.Invoke("Bimface鏂囦欢鍏宠仈鎴愬姛銆傘�傘��", Color.Green);
-            feedBackProgress?.Invoke(100, 55);
+            feedBackProgress?.Invoke(100, 70);
 
-            #endregion 绗節姝� 鍏宠仈Bimface鏂囦欢锛堣繘搴� 55%锛�
+            #endregion 绗節姝� 鍏宠仈Bimface鏂囦欢锛堣繘搴� 70%锛�
 
-            #region 绗崄姝� 鍙戣捣bimface杞崲锛堣繘搴� 80%锛�
+            #region 绗崄姝� 鍙戣捣妯″瀷杞崲锛堣繘搴� 90%锛�
 
-            feedBackMsg?.Invoke("姝e湪杩涜Bimface妯″瀷杞婚噺鍖�...", Color.Black);
+            feedBackProgress?.Invoke(100, 60);
+            feedBackMsg?.Invoke("姝e湪杩涜妯″瀷杞婚噺鍖�...", Color.Black);
             //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)
                 {
                     await Yw.WinFrmUI.BimfaceHelper.WaitFileTranslateStatusUntilSuccess(bimfaceId, 3000);
-                    vm.BimfaceConverted = true;
-                    feedBackMsg?.Invoke("Bimface妯″瀷杞婚噺鍖栧畬鎴愩�傘�傘��", Color.Green);
+                    feedBackMsg?.Invoke("妯″瀷杞婚噺鍖栧畬鎴愩�傘�傘��", Color.Green);
                 }
                 else
                 {
-                    feedBackMsg?.Invoke("璺宠繃Bimface妯″瀷杞婚噺鍖栫瓑寰呫�傘�傘��", Color.Black);
+                    bol = await BLLFactory<Yw.BLL.BimfaceFile>.Instance.UpdateFileStatus(vm.BimfaceFile.ID, (int)Yw.Bimface.eFileStatus.Converting);
+                    if (bol)
+                    {
+                        vm.BimfaceFile.FileStatus = (int)Yw.Bimface.eFileStatus.Converting;
+                    }
+                    else
+                    {
+                        feedBackMsg?.Invoke("妯″瀷鏂囦欢鐘舵�佹洿鏂板け璐ワ紒锛侊紒", Color.Red);
+                    }
+                    feedBackMsg?.Invoke("璺宠繃妯″瀷杞婚噺鍖栫瓑寰呫�傘�傘��", Color.Black);
                     feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue);
                     feedBackProgress?.Invoke(100, 100);
                     return true;
@@ -404,26 +434,26 @@
             }
             else
             {
-                vm.BimfaceConverted = true;
-                feedBackMsg?.Invoke("Bimface妯″瀷杞婚噺鍖栧畬鎴愩�傘�傘��", Color.Green);
+                feedBackMsg?.Invoke("妯″瀷杞婚噺鍖栧畬鎴愩�傘�傘��", Color.Green);
             }
 
-            feedBackProgress?.Invoke(100, 80);
+            feedBackProgress?.Invoke(100, 90);
 
-            #endregion 绗崄姝� 鍙戣捣bimface杞崲锛堣繘搴� 80%锛�
+            #endregion 绗崄姝� 鍙戣捣妯″瀷杞崲锛堣繘搴� 90%锛�
 
-            #region 绗崄涓�姝� 鏇存柊Bimface鏂囦欢鐘舵�侊紙杩涘害 100%锛�
+            #region 绗崄涓�姝� 鏇存柊妯″瀷鏂囦欢鐘舵�侊紙杩涘害 100%锛�
 
-            feedBackMsg?.Invoke("姝e湪鏇存柊Bimface鏂囦欢鐘舵��...", Color.Black);
-            bol = await BLLFactory<Yw.BLL.BimfaceFile>.Instance.UpdateFileStatus(bimfaceFileId, (int)Yw.Bimface.eFileStatus.ConvertSucceed);
+            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("Bimface鏂囦欢鐘舵�佹洿鏂版垚鍔熴�傘�傘��", Color.Green);
+                vm.BimfaceFile.FileStatus = (int)Yw.Bimface.eFileStatus.ConvertSucceed;
+                feedBackMsg?.Invoke("妯″瀷鏂囦欢鐘舵�佹洿鏂版垚鍔熴�傘�傘��", Color.Green);
             }
             else
             {
-                feedBackMsg?.Invoke("Bimface鏂囦欢鐘舵�佹洿鏂板け璐ワ紒锛侊紒", Color.Red);
-                feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Black);
+                feedBackMsg?.Invoke("妯″瀷鏂囦欢鐘舵�佹洿鏂板け璐ワ紒锛侊紒", Color.Red);
+                feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue);
                 return true;
             }
 
@@ -431,7 +461,7 @@
             feedBackMsg?.Invoke("椤圭洰瀵煎叆瀹屾垚銆傘�傘��", Color.Green);
             return true;
 
-            #endregion 绗崄涓�姝� 鏇存柊Bimface鏂囦欢鐘舵�侊紙杩涘害 100%锛�
+            #endregion 绗崄涓�姝� 鏇存柊妯″瀷鏂囦欢鐘舵�侊紙杩涘害 100%锛�
         }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3