From eccc597eb5b29ce1a9982ebf31f0e1272d3db14f Mon Sep 17 00:00:00 2001
From: Shuxia Ning <NingShuxia0927@outlook.com>
Date: 星期三, 09 十月 2024 11:33:45 +0800
Subject: [PATCH] 阀门管理

---
 BLL/HStation.BLL.PhartRelation.Core/03-localclient/02-valve-main/XhsValveMainPhartMappingExtensions.cs |  113 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 56 insertions(+), 57 deletions(-)

diff --git a/BLL/HStation.BLL.PhartRelation.Core/03-localclient/02-valve-main/XhsValveMainPhartMappingExtensions.cs b/BLL/HStation.BLL.PhartRelation.Core/03-localclient/02-valve-main/XhsValveMainPhartMappingExtensions.cs
index 377d055..0c71553 100644
--- a/BLL/HStation.BLL.PhartRelation.Core/03-localclient/02-valve-main/XhsValveMainPhartMappingExtensions.cs
+++ b/BLL/HStation.BLL.PhartRelation.Core/03-localclient/02-valve-main/XhsValveMainPhartMappingExtensions.cs
@@ -123,68 +123,67 @@
         {
             return await Task.Factory.StartNew(() =>
             {
-                //var mapping = _service.GetByID(input.ID);
-                //if (mapping == null)
-                //{
-                //    throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"ID:{input.ID} 鏁版嵁涓嶅瓨鍦�");
-                //}
-                //var equipment = new Service.ValveMainVmo().GetByID(input.ValveMainID);
-                //if (equipment == null)
-                //{
-                //    throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"ValveMainID:{input.ValveMainID} 鏁版嵁涓嶅瓨鍦�");
-                //}
-                //var diagram = new Yw.Service.PhartDiagram().GetByID(input.DiagramID);
-                //if (diagram == null)
-                //{
-                //    throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"DiagramID:{input.DiagramID} 鏁版嵁涓嶅瓨鍦�");
-                //}
+                var mapping = _service.GetByID(input.ID);
+                if (mapping == null)
+                {
+                    throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"ID:{input.ID} 鏁版嵁涓嶅瓨鍦�");
+                }
+                var equipment = new Service.ValveMain().GetByID(input.ValveMainID);
+                if (equipment == null)
+                {
+                    throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"ValveMainID:{input.ValveMainID} 鏁版嵁涓嶅瓨鍦�");
+                }
+                var diagram = new Yw.Service.PhartDiagram().GetByID(input.DiagramID);
+                if (diagram == null)
+                {
+                    throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"DiagramID:{input.DiagramID} 鏁版嵁涓嶅瓨鍦�");
+                }
 
-                //if (input.Diagram != null)
-                //{
-                //    if (input.Diagram.ID != input.DiagramID)
-                //    {
-                //        throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.V001, $"鍥捐〃鏁版嵁涓嶅尮閰�");
-                //    }
-                //    if (input.Diagram.GraphList != null && input.Diagram.GraphList.Count > 0)
-                //    {
-                //        if (input.Diagram.GraphList.Exists(x => x.DiagramID != input.DiagramID))
-                //        {
-                //            throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.V001, $"鍥惧舰鏁版嵁涓嶅尮閰�");
-                //        }
-                //    }
-                //}
+                if (input.Diagram != null)
+                {
+                    if (input.Diagram.ID != input.DiagramID)
+                    {
+                        throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.V001, $"鍥捐〃鏁版嵁涓嶅尮閰�");
+                    }
+                    if (input.Diagram.GraphList != null && input.Diagram.GraphList.Count > 0)
+                    {
+                        if (input.Diagram.GraphList.Exists(x => x.DiagramID != input.DiagramID))
+                        {
+                            throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.V001, $"鍥惧舰鏁版嵁涓嶅尮閰�");
+                        }
+                    }
+                }
 
-                //var mapping_rhs = new Model.XhsValveMainPhartMapping(mapping);
-                //input.Adapt(mapping_rhs);
+                var mapping_rhs = new Model.XhsValveMainPhartMapping(mapping);
+                input.Adapt(mapping_rhs);
 
-                //Yw.Model.PhartDiagram diagram_rhs = null;
-                //List<Yw.Model.PhartGraph> graph_rhs_list = null;
-                //if (input.Diagram != null)
-                //{
-                //    diagram_rhs = new Yw.Model.PhartDiagram(diagram);
-                //    input.Diagram.Adapt(diagram_rhs);
-                //    if (input.Diagram.GraphList != null && input.Diagram.GraphList.Count > 0)
-                //    {
-                //        var service_graph = new Yw.Service.PhartGraph();
-                //        graph_rhs_list = new List<Yw.Model.PhartGraph>();
-                //        foreach (var graph in input.Diagram.GraphList)
-                //        {
-                //            var graph_model = service_graph.GetByID(graph.ID);
-                //            if (graph_model == null)
-                //            {
-                //                throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"GraphID:{graph.ID} 鏁版嵁涓嶅瓨鍦�");
-                //            }
-                //            var graph_rhs = new Yw.Model.PhartGraph(graph_model);
-                //            graph.Adapt(graph_rhs);
-                //            graph_rhs_list.Add(graph_rhs);
-                //        }
-                //    }
-                //}
+                Yw.Model.PhartDiagram diagram_rhs = null;
+                List<Yw.Model.PhartGraph> graph_rhs_list = null;
+                if (input.Diagram != null)
+                {
+                    diagram_rhs = new Yw.Model.PhartDiagram(diagram);
+                    input.Diagram.Adapt(diagram_rhs);
+                    if (input.Diagram.GraphList != null && input.Diagram.GraphList.Count > 0)
+                    {
+                        var service_graph = new Yw.Service.PhartGraph();
+                        graph_rhs_list = new List<Yw.Model.PhartGraph>();
+                        foreach (var graph in input.Diagram.GraphList)
+                        {
+                            var graph_model = service_graph.GetByID(graph.ID);
+                            if (graph_model == null)
+                            {
+                                throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"GraphID:{graph.ID} 鏁版嵁涓嶅瓨鍦�");
+                            }
+                            var graph_rhs = new Yw.Model.PhartGraph(graph_model);
+                            graph.Adapt(graph_rhs);
+                            graph_rhs_list.Add(graph_rhs);
+                        }
+                    }
+                }
 
-                //var bol = _service.UpdateEx(mapping_rhs, diagram_rhs, graph_rhs_list);
-                //return bol;
+                var bol = _service.UpdateEx(mapping_rhs, diagram_rhs, graph_rhs_list);
+                return bol;
 
-                return false;
             });
              
         }

--
Gitblit v1.9.3