duheng
2025-02-17 26f45822a2a84af81e20ca543da98d3b822c5afd
WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs
@@ -1,10 +1,4 @@
using Castle.Core.Internal;
using DevExpress.XtraEditors;
using HStation.Model;
using HStation.Vmo;
using Microsoft.Extensions.DependencyInjection;
using static DevExpress.XtraEditors.XtraInputBox;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
namespace HStation.WinFrmUI
{
@@ -203,6 +197,7 @@
                                        feedBackMsg?.Invoke($"构件类型:{revitParter.Catalog},构件编码:{revitParter.Id},构件属性:{revitParterPropStatus.PropName},错误:{revitParterPropStatus.StatusInfo} ", Color.Red);
                                    }
                                    break;
                                default: break;
                            }
                        }
@@ -218,7 +213,13 @@
            }
            vm.HydroInfo = HStation.Hydro.TransferHelper.FromRevit
                (vm.RevitModel, out List<Yw.Model.HydroParterScenePropValueInfo> allScenePropValueInfo, out List<Yw.Model.HydroDecoratorInfo> allDecoratorList, out msg);
                (
                    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($"水力结构文件解析失败,{msg}!!!", Color.Red);
@@ -226,6 +227,8 @@
                feedBackProgress?.Invoke(100, 100);
                return true;
            }
            var propStatusHelper = new HydroPropStatusHelper(vm.HydroInfo, allPropStatusDbList);
            feedBackMsg?.Invoke("正在进行产品匹配...", Color.Black);
            var matchingParas = Yw.WinFrmUI.HydroMatchingHelper.Create(vm.HydroInfo);
@@ -246,7 +249,7 @@
            }
            feedBackMsg?.Invoke("正在进行管网参数修复...", Color.Black);
            vm.HydroInfo.RepairParas(out msg);
            vm.HydroInfo.RepairParas(propStatusHelper, out msg);
            if (string.IsNullOrEmpty(msg))
            {
                feedBackMsg?.Invoke("管网参数修复完成。。。", Color.Green);
@@ -269,13 +272,26 @@
            feedBackMsg?.Invoke("水力结构文件解析成功。。。", Color.Green);
            feedBackProgress?.Invoke(100, 40);
            //vm.HydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(vm.HydroInfo.ID);
            vm.HydroInfo = await HStation.BLL.XhsHydroInfo.GetByID(vm.HydroInfo.ID);
            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%)
@@ -318,7 +334,7 @@
            }
            var bimfaceId = await Yw.WinFrmUI.BimfaceHelper.UploadFile(rvtFileInfo.FullName);//正式代码
            //var bimfaceId = 10000884893369;//测试用例  10000884893369  10000894297457  10000895957527  10000896316958 10000896755736
            //var bimfaceId = 10000899666805;//测试用例  制氮循环:10000884893369   10000896755736 10000899666805
            if (bimfaceId < 1)
            {
                feedBackMsg?.Invoke("Revit模型文件上传失败!!!", Color.Red);
@@ -393,34 +409,9 @@
            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);
                    feedBackMsg?.Invoke("模型轻量化完成。。。", Color.Green);
                }
                else
                {
                    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;
                }
                await Yw.WinFrmUI.BimfaceHelper.WaitFileTranslateStatusUntilSuccess(bimfaceId, 3000);
            }
            else
            {
                feedBackMsg?.Invoke("模型轻量化完成。。。", Color.Green);
            }
            feedBackMsg?.Invoke("模型轻量化完成。。。", Color.Green);
            feedBackProgress?.Invoke(100, 90);
            #endregion
@@ -446,8 +437,8 @@
            return true;
            #endregion
        }
    }
}