From 21d9f7bcbe8c82d2af9dbdc18f189a3bb1672d74 Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期二, 15 十月 2024 13:06:59 +0800 Subject: [PATCH] 优化泵信息界面 --- BLL/HStation.BLL.PhartRelation.Core/03-localclient/02-valve-main/XhsValveMainPhartMappingExtensions.cs | 138 ++++++++++++++++++++++------------------------ 1 files changed, 66 insertions(+), 72 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 4d6b9d2..42cbf6f 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 @@ -1,7 +1,7 @@ 锘縩amespace HStation.CAL.LocalClient { /// <summary> - /// + /// /// </summary> public class XhsValveMainPhartMappingExtensions : IXhsValveMainPhartMappingExtensions { @@ -12,7 +12,7 @@ /// <summary> /// 鑾峰彇鎵�鏈� /// </summary> - /// <returns></returns> + /// <returns></returns> public async Task<List<XhsValveMainPhartMappingExtensionsDto>> GetAll() { return await Task.Factory.StartNew(() => @@ -21,9 +21,8 @@ }); } - /// <summary> - /// 閫氳繃 ValveMainID 鑾峰彇 + /// 閫氳繃 ValveMainID 鑾峰彇 /// </summary> public async Task<List<XhsValveMainPhartMappingExtensionsDto>> GetByValveMainID(long ValveMainID) { @@ -64,7 +63,7 @@ }); } - #endregion + #endregion Query #region Insert @@ -100,7 +99,6 @@ }); } - /// <summary> /// 澶ф壒閲忔彃鍏� /// </summary> @@ -112,7 +110,7 @@ }); } - #endregion + #endregion Insert #region Update @@ -123,70 +121,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.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} 鏁版嵁涓嶅瓨鍦�"); - //} + var mapping = _service.GetByID(input.ID); + if (mapping == null) + { + throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"ID:{input.ID} 鏁版嵁涓嶅瓨鍦�"); + } + var equipment = new Service.AssetsValveMain().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; - - return false; + var bol = _service.UpdateEx(mapping_rhs, diagram_rhs, graph_rhs_list); + return bol; }); - } /// <summary> @@ -200,7 +195,6 @@ }); } - /// <summary> /// 澶ф壒閲忔洿鏂� /// </summary> @@ -212,7 +206,7 @@ }); } - #endregion + #endregion Update #region Delete @@ -229,7 +223,7 @@ /// <summary> /// 閫氳繃 DiagramID 鍒犻櫎 - /// </summary> + /// </summary> public async Task<bool> DeleteByDiagramID(long DiagramID) { return await Task.Factory.StartNew(() => @@ -241,7 +235,6 @@ } return bol; }); - } /// <summary> @@ -266,6 +259,7 @@ return false; }); } - #endregion + + #endregion Delete } -} +} \ No newline at end of file -- Gitblit v1.9.3