lixiaojun
2024-10-12 a8ccc992964272f6a74631e8c164e8c91e5cb6d4
WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs
@@ -41,7 +41,7 @@
            feedBackProgress?.Invoke(100, 5);
            #endregion
            #endregion 第一步 临时文件处理(进度5%)
            #region 第二步 创建项目(进度 10%)
@@ -77,7 +77,7 @@
            feedBackProgress?.Invoke(100, 10);
            #endregion
            #endregion 第二步 创建项目(进度 10%)
            #region 第三步 设置地图位置(进度 20%)
@@ -112,7 +112,7 @@
            feedBackProgress?.Invoke(100, 20);
            #endregion
            #endregion 第三步 设置地图位置(进度 20%)
            #region 第四步 压缩文件解析 (进度25%)
@@ -139,12 +139,11 @@
                return true;
            }
            feedBackMsg?.Invoke("模型文件解析成功。。。", Color.Green);
            feedBackProgress?.Invoke(100, 25);
            #endregion
            #endregion 第四步 压缩文件解析 (进度25%)
            #region 第五步 解析水力结构文件 (进度30%)
@@ -157,11 +156,56 @@
                feedBackProgress?.Invoke(100, 100);
                return true;
            }
            var structOthersFileInfo = allFileInfoList.Find(x => x.Name == HStation.Revit.ConstParas.StructOthersFileName);
            var structRevitModel = HStation.Service.RevitParseHelper.FromJsonFile(structFileInfo.FullName, out msg);
            var structRevitModel = HStation.Service.RevitParseHelper.FromJsonFile(structFileInfo.FullName, structOthersFileInfo?.FullName, out msg);
            if (structRevitModel == null)
            {
                feedBackMsg?.Invoke($"{msg}!!!", Color.Red);
                feedBackMsg?.Invoke("项目导入结束。。。", Color.Blue);
                feedBackProgress?.Invoke(100, 100);
                return true;
            }
            //Revit 属性错误处理
            var hasRevitError = false;
            var allRevitParterList = structRevitModel.GetAllParters();
            foreach (var revitParter in allRevitParterList)
            {
                if (revitParter.PropStatusList != null && revitParter.PropStatusList.Count > 0)
                {
                    foreach (var revitParterPropStatus in revitParter.PropStatusList)
                    {
                        if (revitParterPropStatus.PropStatus == HStation.Revit.ePropStatus.Error)
                        {
                            hasRevitError = true;
                        }
                        switch (revitParterPropStatus.PropStatus)
                        {
                            case Revit.ePropStatus.Error:
                                {
                                    feedBackMsg?.Invoke($"构件编码:{revitParter.Code},构件属性:{revitParterPropStatus.PropName},错误:{revitParterPropStatus.StatusInfo} ", Color.Red);
                                }
                                break;
                            case Revit.ePropStatus.Lack:
                                {
                                    feedBackMsg?.Invoke($"构件编码:{revitParter.Code},构件属性:{revitParterPropStatus.PropName},缺省:{revitParterPropStatus.StatusInfo} ", Color.Gray);
                                }
                                break;
                            case Revit.ePropStatus.Abnormal:
                                {
                                    feedBackMsg?.Invoke($"构件编码:{revitParter.Code},构件属性:{revitParterPropStatus.PropName},异常:{revitParterPropStatus.StatusInfo} ", Color.Orange);
                                }
                                break;
                        }
                    }
                }
            }
            if (hasRevitError)
            {
                feedBackMsg?.Invoke($"水力结构文件属性错误!!!", Color.Red);
                feedBackMsg?.Invoke("项目导入结束。。。", Color.Blue);
                feedBackProgress?.Invoke(100, 100);
                return true;
@@ -185,11 +229,31 @@
                return true;
            }
            feedBackMsg?.Invoke("正在进行产品匹配...", Color.Black);
            hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroId);
            var matchingParas = AssetsMatchingParasHelper.Create(hydroInfo);
            if (AssetsMatchingHelper.Matching(matchingParas, out string error))
            {
                if (AssetsMatchingParasHelper.Apply(hydroInfo, matchingParas))
                {
                    feedBackMsg?.Invoke("产品匹配成功。。。", Color.Green);
                }
                else
                {
                    feedBackMsg?.Invoke("产品匹配失败!!!", Color.Red);
                }
            }
            else
            {
                feedBackMsg?.Invoke("产品匹配失败!!!", Color.Red);
            }
            hydroId = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.Save(hydroInfo);
            feedBackMsg?.Invoke("水力结构文件解析成功。。。", Color.Green);
            feedBackProgress?.Invoke(100, 30);
            vm.HydroID = hydroId;
            #endregion
            #endregion 第五步 解析水力结构文件 (进度30%)
            #region 第六步 关联水力结构模型(进度 40%)
@@ -224,12 +288,11 @@
                return true;
            }
            vm.HydroRelationID = hydroRelationId;
            feedBackMsg?.Invoke("关联水力结构模型成功。。。", Color.Green);
            feedBackProgress?.Invoke(100, 40);
            #endregion
            #endregion 第六步 关联水力结构模型(进度 40%)
            #region 第七步 上传Revit模型文件(进度 45%)
@@ -257,7 +320,7 @@
            feedBackMsg?.Invoke("解析Revit模型文件成功。。。", Color.Green);
            feedBackProgress?.Invoke(100, 45);
            #endregion
            #endregion 第七步 上传Revit模型文件(进度 45%)
            #region 第八步 保存Bimface文件 (进度 50%)
@@ -285,7 +348,7 @@
            feedBackMsg?.Invoke("Bimface文件保存成功。。。", Color.Green);
            feedBackProgress?.Invoke(100, 50);
            #endregion
            #endregion 第八步 保存Bimface文件 (进度 50%)
            #region 第九步 关联Bimface文件(进度 55%)
@@ -310,7 +373,7 @@
            feedBackMsg?.Invoke("Bimface文件关联成功。。。", Color.Green);
            feedBackProgress?.Invoke(100, 55);
            #endregion
            #endregion 第九步 关联Bimface文件(进度 55%)
            #region 第十步 发起bimface转换(进度 80%)
@@ -343,7 +406,7 @@
            feedBackProgress?.Invoke(100, 80);
            #endregion
            #endregion 第十步 发起bimface转换(进度 80%)
            #region 第十一步 更新Bimface文件状态(进度 100%)
@@ -364,10 +427,7 @@
            feedBackMsg?.Invoke("项目导入完成。。。", Color.Green);
            return true;
            #endregion
            #endregion 第十一步 更新Bimface文件状态(进度 100%)
        }
    }
}