Browse Source

xls:增加文件

xls 6 năm trước cách đây
mục cha
commit
a923be2b1a

+ 40 - 0
MBI/SAGA.GplotManage/RelationManager/ElectricalRelationUploader.cs

@@ -0,0 +1,40 @@
+using SAGA.GplotRelationComputerManage;
+using SAGA.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.GplotManage
+{
+    public class ElectricalRelationUploader : RelationUploader
+    {
+        public ElectricalRelationUploader(string relationType, string relationDisplay) : base(relationType, relationDisplay)
+        {
+            CurrentHandler=ElectricalRelationHandlerFactory.Create(relationType);
+        }
+        public IElectricalRelationHandler CurrentHandler { get; private set; }
+        public override void Upload()
+        {
+            //计算数据
+            if (CurrentHandler == null)
+                return;
+           
+            //加载数据
+            var data = CurrentHandler.GetComputeData(new PowerComputerContext()); ;
+
+            //使用数据
+            Upload(data);
+        }
+        public override void Upload(object loadData)
+        {
+            List<DataNode> dataNodes = loadData as List<DataNode>;
+            if(dataNodes==null)
+            {
+                return;
+            }
+            //上传数据处理
+        }
+    }
+}

+ 14 - 0
MBI/SAGA.GplotManage/RelationManager/IRelationUploader.cs

@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.GplotManage
+{
+    public interface IRelationUploader
+    {
+        void Upload();
+        void Upload(object relationData);
+    }
+}

+ 58 - 0
MBI/SAGA.GplotManage/RelationManager/RelationDataManager.cs

@@ -0,0 +1,58 @@
+using SAGA.GplotRelationComputerManage;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.GplotManage
+{
+    public class RelationDataManager
+    {
+        private void InitRelationData(List<RelationUploader> uploaders)
+        {
+            bool containSpace = false;
+            List<string> systems = new List<string>();
+            foreach (var uploader in uploaders)
+            {
+                if(uploader is SystemRelationUploader)
+                {
+                    systems.Add(uploader.RelationType);
+                    continue;
+                }
+                if(!containSpace&&uploader is SpaceRelationUploader)
+                {
+                    containSpace = true;
+                    continue;
+                }
+            }
+            //计算数据,以后可能合并
+            #region 计算空间数据
+
+            #endregion
+            #region 计算管道数据
+            SystemComputerHandler systemHandler = new SystemComputerHandler();
+            systemHandler.ComputerWidthCache(systems);
+            #endregion
+        }
+        /// <summary>
+        /// 获取空间计算数据
+        /// </summary>
+        private object SpaceData { get; set; }
+        public void CommitRelations(List<RelationUploader> uploaders)
+        {
+            InitRelationData(uploaders);
+            foreach (RelationUploader uploader in uploaders)
+            {
+                if(uploader is SpaceRelationUploader)
+                {
+                    uploader.Upload(SpaceData);
+                }
+                else
+                {
+                    uploader.Upload();
+                }
+            }
+        }
+    }
+}

+ 38 - 0
MBI/SAGA.GplotManage/RelationManager/RelationUploader.cs

@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.GplotManage
+{
+    public abstract class RelationUploader:IRelationUploader
+    {
+        public RelationUploader(string relationType,string relationDisplay)
+        {
+            RelationType = relationType;
+            RelationDisplay = RelationDisplay;
+        }
+        /*
+         *可以将计算写在upload中,就像把计算卸载Show中 
+         */
+        /// <summary>
+        /// 图关系类型
+        /// </summary>
+        public string RelationType { get;private set; }
+        /// <summary>
+        /// 图关系显示名称
+        /// </summary>
+        public string RelationDisplay { get; private set; }
+
+        public virtual void Upload()
+        {
+            var data = string.Empty;
+            Upload(data);
+        }
+        public virtual void Upload(object loadData)
+        {
+
+        }
+    }
+}

+ 31 - 0
MBI/SAGA.GplotManage/RelationManager/SpaceRelationUploader.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.GplotManage
+{
+    public class SpaceRelationUploader: RelationUploader
+    {
+        public SpaceRelationUploader(string relationType, string relationDisplay) : base(relationType, relationDisplay)
+        {
+
+        }
+
+        public override void Upload()
+        {
+            //计算数据
+
+            //加载数据
+            var data = string.Empty;
+
+            //使用数据
+            Upload(data);
+        }
+        public override void Upload(object loadData)
+        {
+
+        }
+    }
+}

+ 26 - 0
MBI/SAGA.GplotManage/RelationManager/SystemRelationUploader.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.GplotManage
+{
+    public class SystemRelationUploader : RelationUploader
+    {
+        public SystemRelationUploader(string relationType,string relationDisplay):base(relationType,relationDisplay)
+        {
+
+        }
+        public override void Upload()
+        {
+            //RelationDataUtil
+            var data = string.Empty;
+            Upload(data);
+        }
+        public override void Upload(object loadData)
+        {
+            
+        }
+    }
+}

+ 38 - 0
MBI/SAGA.GplotRelationComputerManage/PowerDistribution/ComputerHandler/IElectricalRelationHandler.cs

@@ -0,0 +1,38 @@
+using SAGA.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.GplotRelationComputerManage
+{
+    public interface IElectricalRelationHandler
+    {
+        string ElectricalRelationType { get; }
+        List<DataNode> GetViewData(PowerComputerContext context);
+        List<DataNode> GetComputeData(PowerComputerContext context);
+    }
+
+    public class  ElectricalRelationHandlerFactory
+    {
+        static ElectricalRelationHandlerFactory()
+        {
+            IElectricalRelationHandler handler = new DistributionRelationshipHandler();
+            m_Handlers[handler.ElectricalRelationType] = handler;
+            handler = new EquipPowerRelationshipHandler();
+            m_Handlers[handler.ElectricalRelationType] = handler;
+            handler = new ObjectControlRelationshipHandler();
+            m_Handlers[handler.ElectricalRelationType] = handler;
+        }
+        private static Dictionary<string, IElectricalRelationHandler> m_Handlers = new Dictionary<string, IElectricalRelationHandler>();
+        public static IElectricalRelationHandler Create(string electricalRelationType)
+        {
+            if (m_Handlers.TryGetValue(electricalRelationType, out IElectricalRelationHandler handler))
+            {
+                return handler;
+            }
+            return null;
+        }
+    }
+}