| | |
| | | { |
| | | 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; |
| | | }); |
| | | |
| | | } |