Ejemplo n.º 1
0
        public void DrawTextToAllNodes(Node node, Node parent, ng.SystemVRF sysItem)
        {
            // RND
            if (sysItem.editrpt == false)
            {
                sysItem.IsExportToReport = true;
            }

            if (node is ng.MyNodeOut)
            {
                ng.MyNodeOut nodeOut = node as ng.MyNodeOut;
                DrawTextToAllNodes(nodeOut.ChildNode, nodeOut, sysItem);
                nodeOut.Stroke = System.Windows.Media.Brushes.RoyalBlue;
            }
            else if (node is ng.MyNodeYP)
            {
                ng.MyNodeYP nodeYP = node as ng.MyNodeYP;
                drawTextToOtherNode(node, parent, sysItem);

                foreach (Node item in nodeYP.ChildNodes)
                {
                    DrawTextToAllNodes(item, nodeYP, sysItem);
                }
            }
            else if (node is ng.MyNodeCH)
            {
                ng.MyNodeCH nodeCH = node as ng.MyNodeCH;
                drawTextToOtherNode(node, parent, sysItem);

                DrawTextToAllNodes(nodeCH.ChildNode, nodeCH, sysItem);
            }
            else if (node is ng.MyNodeMultiCH)
            {
                ng.MyNodeMultiCH nodeMCH = node as ng.MyNodeMultiCH;
                drawTextToOtherNode(node, parent, sysItem);

                foreach (Node item in nodeMCH.ChildNodes)
                {
                    DrawTextToAllNodes(item, nodeMCH, sysItem);
                }
            }
            else if (node is ng.MyNodeIn)
            {
                ng.MyNodeIn nodeIn = node as ng.MyNodeIn;
                drawTextToIDUNode(sysItem, nodeIn);
            }

            if (node is ng.MyNode)
            {
                ng.MyNode myNode = node as ng.MyNode;
                if (myNode != null && myNode.MyInLinks != null && myNode.MyInLinks.Count > 0)
                {
                    for (int i = 0; i < myNode.MyInLinks.Count; i++)
                    {
                        ng.MyLink myLink = myNode.MyInLinks[i] as ng.MyLink;
                        drawTextToLink(myLink, i, parent, node, isInch, sysItem);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void DoPipingCalculation(PipingBLL pipBll, JCHVRF.Model.NextGen.MyNodeOut nodeOut, out PipingErrors errorType)
        {
            errorType = PipingErrors.OK;
            if (nodeOut.ChildNode == null)
            {
                return;
            }
            //分歧管型号和管径改为如果后面的大于前面的,则后面的替换为前面的型号和管径  by Shen Junjie on 20170409
            //getSumCalculation(ref firstDstNode, factoryCode, type, unitType);

            pipBll.GetSumCapacity(nodeOut.ChildNode);

            pipBll.IsBranchKitNeedSizeUp(curSystemItem);

            PipingBranchKit firstBranchKit = null;

            if (nodeOut.ChildNode is JCHVRF.Model.NextGen.MyNodeYP)
            {
                JCHVRF.Model.NextGen.MyNodeYP nodeYP = nodeOut.ChildNode as JCHVRF.Model.NextGen.MyNodeYP;
                if (nodeYP.IsCP)
                {
                    //第一分歧管可能是梳形管 20170711 by Yunxiao Lin
                    firstBranchKit = pipBll.getFirstHeaderBranchPipeCalculation(nodeYP, curSystemItem, out errorType);
                }
                else
                {
                    // 第一分歧管放大一号计算
                    firstBranchKit = pipBll.getFirstPipeCalculation(nodeYP, curSystemItem, out errorType);
                }
                if (errorType != PipingErrors.OK)
                {
                    SetSystemPipingOK(curSystemItem, false);
                    return;
                }
            }

            //分歧管型号和管径改为如果后面的大于前面的,则后面的替换为前面的型号和管径  by Shen Junjie on 20170409
            pipBll.getSumCalculationInversion(firstBranchKit, nodeOut, nodeOut.ChildNode, curSystemItem, false, out errorType);
            if (errorType != PipingErrors.OK)
            {
                SetSystemPipingOK(curSystemItem, false);
                return;
            }

            pipBll.CheckIndoorNumberConnectedCHBox(nodeOut);
        }
Ejemplo n.º 3
0
        private void DoPipingCalculation(NextGenBLL.PipingBLL pipBll, JCHVRF.Model.NextGen.MyNodeOut nodeOut, JCHVRF.Model.NextGen.SystemVRF currentSystem, out NextGenBLL.PipingErrors errorType)
        {
            errorType = NextGenBLL.PipingErrors.OK;
            if (nodeOut.ChildNode == null)
            {
                return;
            }
            pipBll.GetSumCapacity(nodeOut.ChildNode);
            pipBll.IsBranchKitNeedSizeUp(currentSystem);
            PipingBranchKit firstBranchKit = null;

            if (nodeOut.ChildNode is JCHVRF.Model.NextGen.MyNodeYP)
            {
                JCHVRF.Model.NextGen.MyNodeYP nodeYP = nodeOut.ChildNode as JCHVRF.Model.NextGen.MyNodeYP;
                if (nodeYP.IsCP)
                {
                    firstBranchKit = pipBll.getFirstHeaderBranchPipeCalculation(nodeYP, currentSystem, out errorType);
                }
                else
                {
                    firstBranchKit = pipBll.getFirstPipeCalculation(nodeYP, currentSystem, out errorType);
                }
                if (errorType != NextGenBLL.PipingErrors.OK)
                {
                    SetSystemPipingOK(currentSystem, false);
                    return;
                }
            }
            //bug 3489
            var L2SizeDownRule = pipBll.GetL2SizeDownRule(currentSystem);//增大1st branch的管径型号 或者 缩小2nd branch的管径型号 add by Shen Junjie on 2018/2/21

            //bug 3489
            pipBll.getSumCalculationInversion(firstBranchKit, nodeOut, nodeOut.ChildNode, currentSystem, false, out errorType, L2SizeDownRule);
            if (errorType != NextGenBLL.PipingErrors.OK)
            {
                SetSystemPipingOK(currentSystem, false);
                return;
            }
            pipBll.CheckIndoorNumberConnectedCHBox(nodeOut);
        }
Ejemplo n.º 4
0
 public void GetHeightDifferenceNodes(Lassalle.WPF.Flow.Node node, Lassalle.WPF.Flow.Node parent, JCHVRF.Model.NextGen.SystemVRF sysItem, List <JCHVRF.Model.NextGen.MyNode> list)
 {
     if (node is JCHVRF.Model.NextGen.MyNodeOut)
     {
         JCHVRF.Model.NextGen.MyNodeOut nodeOut = node as JCHVRF.Model.NextGen.MyNodeOut;
         GetHeightDifferenceNodes(nodeOut.ChildNode, nodeOut, sysItem, list);
     }
     else if (node is JCHVRF.Model.NextGen.MyNodeYP)
     {
         JCHVRF.Model.NextGen.MyNodeYP nodeYP = node as JCHVRF.Model.NextGen.MyNodeYP;
         foreach (Lassalle.WPF.Flow.Node item in nodeYP.ChildNodes)
         {
             GetHeightDifferenceNodes(item, nodeYP, sysItem, list);
         }
     }
     else if (node is JCHVRF.Model.NextGen.MyNodeCH)
     {
         JCHVRF.Model.NextGen.MyNodeCH nodeCH = node as JCHVRF.Model.NextGen.MyNodeCH;
         list.Add(nodeCH);
         GetHeightDifferenceNodes(nodeCH.ChildNode, nodeCH, sysItem, list);
     }
     else if (node is JCHVRF.Model.NextGen.MyNodeMultiCH)
     {
         JCHVRF.Model.NextGen.MyNodeMultiCH nodeMCH = node as JCHVRF.Model.NextGen.MyNodeMultiCH;
         list.Add(nodeMCH);
         foreach (Lassalle.WPF.Flow.Node item in nodeMCH.ChildNodes)
         {
             GetHeightDifferenceNodes(item, nodeMCH, sysItem, list);
         }
     }
     else if (node is JCHVRF.Model.NextGen.MyNodeIn)
     {
         //因为DoPipingCalculation之后可能影响indoor的管径,
         //所以绘制YP型号的时候顺便绘制indoor的管径 add on 20170512 by Shen Junjie
         JCHVRF.Model.NextGen.MyNodeIn nodeIn = node as JCHVRF.Model.NextGen.MyNodeIn;
         list.Add(nodeIn);
     }
 }
Ejemplo n.º 5
0
        private void drawTextToLink(ng.MyLink myLink, int linkIndex, Node parent, Node node, bool isInch, ng.SystemVRF sysItem)
        {
            if (myLink == null || parent == null || node == null)
            {
                return;
            }

            string p1 = "";   //Low Pressure Gas
            string p2 = "";   //High Pressure Gas
            string p3 = "";   //Liquid
            string p5 = "";

            if (sysItem.IsPipingOK)
            {
                string SpecL   = myLink.SpecL;
                string SpecG_h = myLink.SpecG_h;
                string SpecG_l = myLink.SpecG_l;
                if (!string.IsNullOrEmpty(SpecL) && !string.IsNullOrEmpty(SpecG_h))
                {
                    if (SpecG_l != null && SpecG_l != "-")
                    {
                        p1 = "φ" + SpecG_l + ut_pipeSize;
                    }
                    if (SpecG_h != null && SpecG_h != "-")
                    {
                        p2 = "φ" + SpecG_h + ut_pipeSize;
                    }
                    p3 = "φ" + SpecL + ut_pipeSize;

                    if (isInch)
                    {
                        _dal    = new PipingDAL(thisProject);
                        SpecL   = GetPipeSize_Inch(myLink.SpecL);
                        SpecG_h = GetPipeSize_Inch(myLink.SpecG_h);
                        SpecG_l = GetPipeSize_Inch(myLink.SpecG_l);

                        p1 = "";
                        p2 = "";
                        p3 = "";
                        if (SpecG_l != null && SpecG_l != "-")
                        {
                            p1 = SpecG_l + ut_pipeSize;
                        }
                        if (SpecG_h != null && SpecG_h != "-")
                        {
                            p2 = SpecG_h + ut_pipeSize;
                        }
                        p3 = SpecL + ut_pipeSize;
                    }
                }
            }

            if (sysItem.IsInputLengthManually)
            {
                p5 = Unit.ConvertToControl(myLink.Length, UnitType.LENGTH_M, ut_length).ToString("0.##") + ut_length;
            }

            bool isCoolingOnly;

            if (node is ng.MyNodeIn)
            {
                isCoolingOnly = (node as ng.MyNodeIn).IsCoolingonly;
            }
            else if (node is ng.MyNodeYP)
            {
                isCoolingOnly = (node as ng.MyNodeYP).IsCoolingonly;
            }
            else
            {
                isCoolingOnly = false;
            }

            float   width  = 0;
            float   height = 5;
            JCHNode label1 = new JCHNode();
            Caption Child1 = new Caption();

            if (!string.IsNullOrEmpty(p1))
            {
                if (string.IsNullOrEmpty(p2) && !isCoolingOnly)
                {
                    DrawPipeLableColor(label1, " ", node, 4);
                    Child1 = DrawPipeCaptionColor(Child1, p1, node, 4);
                }
                else
                {
                    DrawPipeLableColor(label1, " ", node, 1);
                    Child1 = DrawPipeCaptionColor(Child1, p1, node, 1);
                }
                height += 8;
            }

            JCHNode label2 = new JCHNode();
            Caption Child2 = new Caption();

            if (!string.IsNullOrEmpty(p2))
            {
                if (parent is ng.MyNodeMultiCH || parent is ng.MyNodeCH)
                {
                    DrawPipeLableColor(label2, " ", node, 4);
                    Child2 = DrawPipeCaptionColor(Child2, p2, node, 4);
                }
                else if (string.IsNullOrEmpty(p1))
                {
                    DrawPipeLableColor(label2, " ", node, 4);
                    Child2 = DrawPipeCaptionColor(Child2, p2, node, 4);
                }
                else
                {
                    if (parent is ng.MyNodeYP)
                    {
                        ng.MyNodeYP pNodeYp = parent as ng.MyNodeYP;
                        if (pNodeYp.ParentNode is ng.MyNodeMultiCH || pNodeYp.ParentNode is ng.MyNodeCH)
                        {
                            DrawPipeLableColor(label2, " ", node, 4);
                            Child2 = DrawPipeCaptionColor(Child2, p2, node, 4);
                        }
                        else
                        {
                            DrawPipeLableColor(label2, " ", node, 2);
                            Child2 = DrawPipeCaptionColor(Child2, p2, node, 2);
                        }
                    }
                    else
                    {
                        DrawPipeLableColor(label2, " ", node, 2);
                        Child2 = DrawPipeCaptionColor(Child2, p2, node, 2);
                    }
                }
                height += 8;
            }

            JCHNode label3 = new JCHNode();
            Caption Child3 = new Caption();

            if (!string.IsNullOrEmpty(p3))
            {
                DrawPipeLableColor(label3, " ", node, 3);
                Child3  = DrawPipeCaptionColor(Child3, p3, node, 3);
                height += 8;
            }
            JCHNode label5 = new JCHNode();
            Caption Child5 = new Caption();

            if (!string.IsNullOrEmpty(p5))
            {
                DrawPipeLableColor(label5, " ", node, 5);
                Child5  = DrawPipeCaptionColor(Child5, p5, node, 5);
                height += 8;
            }
            width       = Math.Max(Math.Max((float)label1.Size.Width, (float)label2.Size.Width), Math.Max((float)label3.Size.Width, (float)label5.Size.Width));
            label1.Size = convertSize(width, height);

            if (sysItem.PipingLayoutType == old.PipingLayoutTypes.BinaryTree)
            {
                SetLinkTextLocationForBinaryTree(myLink, linkIndex, parent, node, label1, sysItem.IsPipingVertical);//TODO
            }
            else if (sysItem.PipingLayoutType == old.PipingLayoutTypes.SchemaA)
            {
                SetLinkTextLocationForSechmaA(myLink, linkIndex, parent, node, label1, sysItem.IsPipingVertical);//TODO
            }
            else
            {
                SetLinkTextLocationForNormal(myLink, linkIndex, parent, node, label1, sysItem.IsPipingVertical);
            }

            System.Windows.Point pf = label1.Location;


            if (!string.IsNullOrEmpty(p1))
            {
                Child1.Location = pf;
                addFlowPiping.AddCaption(Child1);
                addFlowPiping.RemoveNode(label1);
                pf.Y += 8;
            }
            if (!string.IsNullOrEmpty(p2))
            {
                label2.Location = pf;
                Child2.Location = pf;
                addFlowPiping.AddCaption(Child2);
                addFlowPiping.RemoveNode(label2);
                pf.Y += 8;
            }
            if (!string.IsNullOrEmpty(p3))
            {
                label3.Location = pf;
                Child3.Location = pf;
                addFlowPiping.AddCaption(Child3);
                addFlowPiping.RemoveNode(label3);
                pf.Y += 8;
            }
            if (!string.IsNullOrEmpty(p5))
            {
                label5.Location = pf;
                Child5.Location = pf;
                addFlowPiping.AddCaption(Child5);
                addFlowPiping.RemoveNode(label5);
                pf.Y += 8;
            }
        }
Ejemplo n.º 6
0
        private void drawTextToOtherNode(Node node, Node parent, ng.SystemVRF sysItem)
        {
            if (node == null)
            {
                return;
            }

            //DOUBT
            //if (node.Children != null)
            //{
            //    node.Children.Clear();
            //}

            if (!sysItem.IsPipingOK)
            {
                return;
            }

            if (node is ng.MyNodeYP)
            {
                ng.MyNodeYP nodeYP = node as ng.MyNodeYP;
                if (!string.IsNullOrEmpty(nodeYP.Model) && sysItem.IsPipingOK)
                {
                    JCHNode label1 = new JCHNode();
                    initTextNode(label1, " ");

                    Caption Cap1 = initCaptionText(nodeYP.Model, nodeYP);

                    label1.Location = convertPointFToWinPoint(nodeYP.Location.X + 20, nodeYP.Location.Y - label1.Size.Height);
                    if (sysItem.PipingLayoutType == old.PipingLayoutTypes.BinaryTree)
                    {
                        if (!sysItem.IsPipingVertical)
                        {
                            label1.Location = convertPointFToWinPoint(nodeYP.Location.X + 10, nodeYP.Location.Y);
                        }
                        else
                        {
                            label1.Location = convertPointFToWinPoint(nodeYP.Location.X + 15, nodeYP.Location.Y - label1.Size.Height);
                        }
                    }
                    else if (sysItem.PipingLayoutType == old.PipingLayoutTypes.SchemaA)
                    {
                        if (!sysItem.IsPipingVertical)
                        {
                            label1.Location = convertPointFToWinPoint(label1.Location.X + 3, label1.Location.Y);
                        }
                        else
                        {
                            label1.Location = convertPointFToWinPoint(label1.Location.X - 8, label1.Location.Y + 20);
                        }
                    }
                    else if (sysItem.PipingLayoutType == old.PipingLayoutTypes.Normal)
                    {
                        if (sysItem.IsPipingVertical)
                        {
                            label1.Location = convertPointFToWinPoint(nodeYP.Location.X + 20, nodeYP.Location.Y - label1.Size.Height - 8);
                        }
                        else
                        {
                            label1.Location = convertPointFToWinPoint(nodeYP.Location.X + 20, nodeYP.Location.Y - label1.Size.Height);
                        }
                    }

                    //addFlowPiping.AddNode(label1);

                    //nodeYP.AddFlow.Items.Add(label1);

                    Cap1.Location = label1.Location;
                    addFlowPiping.AddCaption(Cap1);

                    if (nodeYP.Model != "")
                    {
                        if (sysItem.IsExportToReport)
                        {
                            InsertPipingKitTable("BranchKit", sysItem.Name, nodeYP.Model, 1, sysItem.Id);
                        }
                    }
                    addFlowPiping.RemoveNode(label1);
                }
            }
            else if (node is ng.MyNodeCH)
            {
                ng.MyNodeCH nodeCH = node as ng.MyNodeCH;
                if (!string.IsNullOrEmpty(nodeCH.Model))
                {
                    if (sysItem.IsExportToReport)
                    {
                        InsertPipingKitTable("CHBox", sysItem.Name, nodeCH.Model, 1, sysItem.Id);
                    }
                    if (sysItem.IsPipingOK)
                    {
                        JCHNode label1 = new JCHNode();
                        initTextNode(label1, nodeCH.Model);
                        if (!sysItem.IsPipingVertical)
                        {
                            label1.Location = convertPointFToWinPoint(nodeCH.Location.X + nodeCH.Size.Width / 2 + 5, nodeCH.Location.Y - label1.Size.Height);
                        }
                        else
                        {
                            label1.Location = convertPointFToWinPoint((nodeCH.Location.X - 50) + nodeCH.Size.Width / 2 - label1.Size.Width / 2, (nodeCH.Location.Y + 12) - label1.Size.Height);
                        }

                        addFlowPiping.AddNode(label1);

                        nodeCH.AddFlow.Items.Add(label1);
                    }
                }
            }
            else if (node is ng.MyNodeMultiCH)
            {
                ng.MyNodeMultiCH nodeMCH = node as ng.MyNodeMultiCH;
                if (!string.IsNullOrEmpty(nodeMCH.Model))
                {
                    if (sysItem.IsExportToReport)
                    {
                        InsertPipingKitTable("CHBox", sysItem.Name, nodeMCH.Model, 1, sysItem.Id);
                    }
                    if (sysItem.IsPipingOK)
                    {
                        JCHNode label1 = new JCHNode();
                        initTextNode(label1, nodeMCH.Model);
                        if (sysItem.IsPipingVertical)
                        {
                            label1.Location = convertPointFToWinPoint(nodeMCH.Location.X + nodeMCH.Size.Width / 2 - label1.Size.Width / 2, nodeMCH.Location.Y - label1.Size.Height);
                        }
                        else
                        {
                            if (parent is ng.MyNodeYP && parent.Location.Y > node.Location.Y)
                            {
                                label1.Location = convertPointFToWinPoint(nodeMCH.Location.X + nodeMCH.Size.Width / 2 - label1.Size.Width / 2, nodeMCH.Location.Y - label1.Size.Height);
                            }
                            else
                            {
                                label1.Location = convertPointFToWinPoint(nodeMCH.Location.X + nodeMCH.Size.Width / 2 + 5, nodeMCH.Location.Y - label1.Size.Height);
                            }
                        }

                        addFlowPiping.AddNode(label1);

                        nodeMCH.AddFlow.Items.Add(label1);
                    }
                }
            }
        }