mengxiangge 6 rokov pred
rodič
commit
8ad1934239

+ 1 - 2
MBI/SAGA.MBI/Html5Command.cs

@@ -220,8 +220,7 @@ namespace SAGA.MBI
         {
             try
             {
-                string url = $"{MBIConst.Html5ScanLocalHost}buildFamily?projId={MBIControl.ProjectCur.Id}&userId={MBIControl.ManageInfo.Person_Id}";
-
+                string url = $"{MBIConst.Html5ScanLocalHost}buildFamily?projId={MBIControl.ProjectCur.Id}&userId={MBIControl.ManageInfo.Person_Id}&secret={MBIControl.ProjectCur.Password}";
                 var win = WinBrowser.Instance;
                 win.Show(url, "扫楼设置App信息点");
                 win.Height = 854;

+ 2 - 0
MBI/SAGA.MBI/SAGA.MBI.csproj

@@ -298,6 +298,8 @@
     <Compile Include="ToolsData\DataCheck\WinDataCheckSetting.xaml.cs">
       <DependentUpon>WinDataCheckSetting.xaml</DependentUpon>
     </Compile>
+    <Compile Include="ToolsData\ModeCheck\EquipmentLocationCenterComparer.cs" />
+    <Compile Include="ToolsData\ModeCheck\EquipmentLocationCenterComparerResult.cs" />
     <Compile Include="ToolsData\ModeCheck\ModeCheckBase.cs" />
     <Compile Include="ToolsData\ModeCheck\DataCheckRule.cs" />
     <Compile Include="ToolsData\CheckBase\DCElementType.cs" />

+ 141 - 0
MBI/SAGA.MBI/ToolsData/ModeCheck/EquipmentLocationCenterComparer.cs

@@ -0,0 +1,141 @@
+/* ==============================================================================
+ * 功能描述:设备部件定位点和中心点对比检查
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 15:08:55
+ * ==============================================================================*/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Autodesk.Revit.DB;
+using NPOI.SS.UserModel;
+using SAGA.DotNetUtils.Others;
+using SAGA.MBI.DataArrange;
+using SAGA.MBI.Tools;
+using SAGA.MBI.ToolsData.CheckBase;
+using SAGA.RevitUtils.Extends;
+
+namespace SAGA.MBI.ToolsData.ModeCheck
+{
+    /// <summary>
+    /// UnitCheck
+    /// </summary>
+    class EquipmentLocationCenterComparer : ModeCheckBase
+    {
+        public EquipmentLocationCenterComparer()
+        {
+            Name = "设备中心点检查";
+        }
+        [DataCheckProcessAspect]
+        public override bool Check()
+        {
+            if (!RBase.IsRight)
+            {
+                IsRight = RBase.IsRight;
+                return IsRight;
+            }
+            IsRight = GetCheckResult();
+            return IsRight;
+          
+        }
+
+        public override void Correct()
+        {
+            throw new NotImplementedException();
+        }
+
+        private bool GetCheckResult()
+        {
+            bool unitResult = true;
+            foreach (SagaSignCheckResult signResult in RBase.Results)
+            {
+                var document = signResult.RDocument;
+                var elements = document.GetFamilyInstances();
+                var equips = elements.Where(t =>  t.IsEquipmentPart()||t.IsEquipment());
+                foreach (FamilyInstance fi in equips)
+                {
+                    var result = GetCheckResult(fi);
+                    result.RBase = signResult;
+                    Results.Add(result);
+                }
+            }
+            return Results.All(t => t.IsRight);
+        }
+
+        /// <summary>
+        /// 获取检测结果
+        /// </summary>
+        /// <param name="fi"></param>
+        /// <returns></returns>
+        private ModeCheckResultBase GetCheckResult(FamilyInstance fi)
+        {
+            var result = new EquipmentPartRefEqCheckResult();
+            result.FamilyName = fi.GetFamily().Name;
+            result.Id = fi.Id.ToString();
+            XYZ location = fi.GetLocationPoint();
+            XYZ origin = fi.GetBoxCenter();
+            if (location.IsEqual2(origin))
+            {
+                result.IsRight = true;
+            }
+            else
+            {
+                result.IsRight = false;
+                result.RMessage = "定位点和中心点不重合,请检查";
+            }
+            result.LocationXYZ = location.ToString2();
+            result.CenterXYZ = origin.ToString();
+            return result;
+        }
+        //[DataCheckProcessAspect]
+        public override void Export()
+        {
+            //   Check();
+            try
+            {
+                IWorkbook book = DCRExport.GetWorkbook();
+                //ISheet sheet = book.CreateSheet(Name);
+                ISheet sheet = book.GetSheet(Name);
+
+                #region 添加数据
+                int index = 3;
+                //IRow row4 = sheet.CreateRow(index);
+                //row4.HeightInPoints = 15;
+
+                //row4.AddCell(0, "楼层本地名称", DataCheckNPOIStyle.Title);
+                //row4.AddCell(1, "文件名", DataCheckNPOIStyle.Title);
+                //row4.AddCell(2, "文件地址", DataCheckNPOIStyle.Title);
+                //row4.AddCell(3, "族名称", DataCheckNPOIStyle.Title);
+                //row4.AddCell(4, "ID", DataCheckNPOIStyle.Title);
+                //row4.AddCell(5, "通过", DataCheckNPOIStyle.Title);
+                //row4.AddCell(6, "备注(失败原因)", DataCheckNPOIStyle.Title);
+                foreach (EquipmentPartRefEqCheckResult result in Results)
+                {
+                    SagaSignCheckResult rbase = result.RBase as SagaSignCheckResult;
+                    if (rbase == null)
+                        continue;
+                    index++;
+                    IRow rowN = sheet.CreateRow(index);
+                    DataCheckNPOIStyle style = result.IsRight ? DataCheckNPOIStyle.Content : DataCheckNPOIStyle.Error;
+
+                    rowN.AddCell(0, rbase.RFloorName, style);
+                    rowN.AddCell(1, rbase.RFileName, style);
+                    rowN.AddCell(2, rbase.RPath, style);
+                    rowN.AddCell(3, result.FamilyName, style);
+                    rowN.AddCell(4, result.Id, style);
+                    string rowN4 = result.IsRight ? "通过" : "不通过";
+                    rowN.AddCell(5, rowN4, style);
+                    rowN.AddCell(6, result.RMessage, style);
+                }
+
+                #endregion
+
+            }
+            catch (Exception e)
+            {
+                MessageShowBase.Show(e);
+            }
+        }
+    }
+}

+ 29 - 0
MBI/SAGA.MBI/ToolsData/ModeCheck/EquipmentLocationCenterComparerResult.cs

@@ -0,0 +1,29 @@
+/* ==============================================================================
+ * 功能描述:设备部件定位点和中心点对比检查
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 15:13:17
+ * ==============================================================================*/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Autodesk.Revit.DB;
+
+namespace SAGA.MBI.ToolsData.ModeCheck
+{
+    /// <summary>
+    /// UnitCheckResult
+    /// </summary>
+    class EquipmentLocationCenterComparerResult : ModeCheckResultBase
+    {
+
+        public string FamilyName { get; set; }
+
+        public string Id { get; set; }
+        public override void Export()
+        {
+            base.Export();
+        }
+    }
+}

+ 3 - 1
MBI/SAGA.MBI/ToolsData/ModeCheck/EquipmentPartRefEqCheckResult.cs

@@ -18,9 +18,11 @@ namespace SAGA.MBI.ToolsData.ModeCheck
     class EquipmentPartRefEqCheckResult : ModeCheckResultBase
     {
 
+        public string Id { get; set; }
         public string FamilyName { get; set; }
+        public string CenterXYZ { get; set; }
+        public string LocationXYZ { get; set; }
 
-        public string Id { get; set; }
         public override void Export()
         {
             base.Export();