/// <summary>
        /// 方法说明:获取下层PBOM
        /// 作    者:jason.tang
        /// 完成时间:2013-08-30
        /// </summary>
        /// <param name="parentNode">父节点</param>
        /// <param name="childId">子节点ID</param>
        private void ShowPbomChildNode(TreeNode parentNode, string childId)
        {
            //根据物料类型查找物料分类
            List <Model.MaterialVersionModule> versionModuleList
                = MaterialModuleBLL.GetChildPbomMaterialByPbomId(childId);

            if (versionModuleList.Count > 0)
            {
                versionModuleList.ForEach((v) =>
                {
                    TreeNode nod       = new TreeNode();
                    MaterialModule mod = new MaterialModule();
                    mod.code           = v.Code;
                    mod.name           = v.Name;
                    mod.materialverid  = v.MaterialVerId;
                    mod.baseid         = v.BaseId;
                    mod.productname    = v.ProductId;
                    mod.pbomid         = v.ChildId;

                    nod.Text = string.Format("{0}({1})", v.Name, v.Code);
                    //nod.Tag = v;
                    nod.Tag      = mod;
                    nod.Name     = v.ChildId;
                    nod.ImageKey = "materialC";

                    ShowPbomChildNode(nod, v.ChildId);

                    List <Model.ProcessCard> materialCardRelations =
                        MaterialCardRelationBLL.GetProcessCardByMaterialId(v.BaseId, 2);

                    if (materialCardRelations.Count > 0)
                    {
                        materialCardRelations.ForEach((m) =>
                        {
                            TreeNode nd = new TreeNode();
                            nd.Text     = m.Name;
                            nd.Tag      = m.ID;
                            nd.Name     = m.ID.ToString();
                            nd.ImageKey = "card";

                            nod.Nodes.Add(nd);
                            nod.ImageKey = "materialCard";
                        });
                    }

                    parentNode.Nodes.Add(nod);
                    if (nod.ImageKey == "materialCard")
                    {
                        parentNode.ImageKey = nod.ImageKey;
                    }
                });
            }
        }
        /// <summary>
        /// 方法说明:根据根节点加载子节点
        /// 作    者:jason.tang
        /// 完成时间:2013-03-05
        /// </summary>
        /// <param name="parentNode"></param>
        private void LoadPbomChildNode(string categoryid, string code)
        {
            //查找根节点(物料)下的子节点
            materialModuleList = MaterialModuleBLL.GetMaterialModuleListByCategoryId(CategoryTypeIds[0], CategoryTypeIds[1]);

            if (materialModuleList.Count <= 0)
            {
                return;
            }


            List <string> listBaseIds = new List <string>();

            foreach (MaterialModule material in materialModuleList)
            {
                listBaseIds.Add(string.Format("'{0}'", material.baseid));
            }
            string            baseIds        = string.Join(",", listBaseIds.ToArray());
            List <PBomModule> pbomModuleList = MaterialModuleBLL.GetPBomModuleListByBaseId(baseIds);

            if (pbomModuleList.Count <= 0)
            {
                return;
            }

            pbomModuleList.ForEach((o) =>
            {
                TreeNode node = new TreeNode();
                node.Text     = o.FolderName;
                node.Tag      = o.VerId;
                node.Name     = o.VerId;
                node.ImageKey = "materialG";

                node.ExpandAll();

                //根据物料类型查找物料分类
                List <Model.MaterialVersionModule> versionModuleList
                    = MaterialModuleBLL.GetChildPbomMaterialByPbomId(o.VerId);

                if (versionModuleList.Count > 0)
                {
                    versionModuleList.ForEach((v) =>
                    {
                        TreeNode nod       = new TreeNode();
                        MaterialModule mod = new MaterialModule();
                        mod.code           = v.Code;
                        mod.name           = v.Name;
                        mod.materialverid  = v.MaterialVerId;
                        mod.baseid         = v.BaseId;
                        mod.productname    = v.ProductId;
                        mod.pbomid         = v.ChildId;

                        nod.Text = string.Format("{0}({1})", v.Name, v.Code);
                        //nod.Tag = v;
                        nod.Tag      = mod;
                        nod.Name     = v.ChildId;
                        nod.ImageKey = "materialC";

                        ShowPbomChildNode(nod, v.ChildId);

                        List <Model.ProcessCard> materialCardRelations =
                            MaterialCardRelationBLL.GetProcessCardByMaterialId(v.BaseId, 2);

                        if (materialCardRelations.Count > 0)
                        {
                            materialCardRelations.ForEach((m) =>
                            {
                                TreeNode nd = new TreeNode();
                                nd.Text     = m.Name;
                                nd.Tag      = m.ID;
                                nd.Name     = m.ID.ToString();
                                nd.ImageKey = "card";

                                nod.Nodes.Add(nd);
                                nod.ImageKey = "materialCard";
                            });
                        }

                        node.Nodes.Add(nod);
                        if (nod.ImageKey == "materialCard")
                        {
                            node.ImageKey = nod.ImageKey;
                        }
                    });
                }

                ////if (versionModuleList.Count > 0)
                ////{
                ////    versionModuleList.ForEach((v) =>
                ////    {
                ////        TreeNode nod = new TreeNode();
                ////        MaterialModule mod = new MaterialModule();
                ////        mod.code = v.Code;
                ////        mod.name = v.Name;
                ////        mod.materialverid = v.MaterialVerId;
                ////        mod.baseid = v.BaseId;
                ////        mod.productname = v.ProductId;

                ////        nod.Text = string.Format("{0}({1})", v.Code, v.Name);
                ////        //nod.Tag = v;
                ////        nod.Tag = mod;
                ////        nod.Name = v.BaseId;
                ////        nod.ImageKey = "materialC";

                ////        List<Model.ProcessCard> materialCardRelations =
                ////            MaterialCardRelationBLL.GetProcessCardByMaterialId(v.BaseId, 2);

                ////        if (materialCardRelations.Count > 0)
                ////        {
                ////            materialCardRelations.ForEach((m) =>
                ////            {
                ////                TreeNode nd = new TreeNode();
                ////                nd.Text = m.Name;
                ////                nd.Tag = m.ID;
                ////                nd.Name = m.ID.ToString();
                ////                nd.ImageKey = "card";

                ////                nod.Nodes.Add(nd);
                ////            });
                ////        }

                ////        node.Nodes.Add(nod);
                ////    });
                ////}

                tvMaterialPBom.Nodes.Add(node);
            });
        }
        /// <summary>
        /// 方法说明:根据根节点加载子节点
        /// 作    者:jason.tang
        /// 完成时间:2013-03-05
        /// </summary>
        /// <param name="parentNode"></param>
        private void LoadMaterialChildNode(string categoryid, string code)
        {
            //if (parentNode == null) return;

            //parentNode.Nodes.Clear();

            //查找根节点(物料)下的子节点
            materialModuleList = MaterialModuleBLL.GetMaterialModuleListByCategoryId(categoryid, code);

            if (materialModuleList.Count <= 0)
            {
                return;
            }

            materialModuleList.ForEach((o) =>
            {
                TreeNode node = new TreeNode();
                node.Text     = string.Format("({0})", o.name);
                node.Tag      = o;
                node.Name     = o.baseid;
                switch (o.TypeId)
                {
                case "1":
                    node.ImageKey = "materialG";
                    break;

                case "2":
                    node.ImageKey = "materialS";
                    break;

                case "3":
                    node.ImageKey = "materialC";
                    break;

                case "4":
                    node.ImageKey = "materialC";
                    break;

                default:
                    break;
                }
                node.ExpandAll();

                //根据物料类型查找物料分类
                List <Model.MaterialVersionModule> versionModuleList
                    = MaterialModuleBLL.GetChildMaterialByVersionId(o.materialverid);

                if (versionModuleList.Count > 0)
                {
                    versionModuleList.ForEach((v) =>
                    {
                        TreeNode nod       = new TreeNode();
                        MaterialModule mod = new MaterialModule();
                        mod.code           = v.Code;
                        mod.name           = v.Name;
                        mod.materialverid  = v.MaterialVerId;
                        mod.baseid         = v.BaseId;
                        mod.productname    = v.ProductId;

                        nod.Text = string.Format("{0}({1})", v.Name, v.Code);
                        //nod.Tag = v;
                        nod.Tag      = mod;
                        nod.Name     = v.MaterialVerId;
                        nod.ImageKey = "materialC";

                        //TreeNode nod = new TreeNode();
                        //nod.Text = string.Format("{0}({1})", v.Code, v.Name);
                        //nod.Tag = v.MaterialVerId;
                        //nod.Name = v.BaseId;
                        //nod.ImageKey = "materialC";

                        ShowMaterialChildNode(nod, v.MaterialVerId);

                        List <Model.ProcessCard> materialCardRelations =
                            MaterialCardRelationBLL.GetProcessCardByMaterialId(v.BaseId, 1);

                        if (materialCardRelations.Count > 0)
                        {
                            materialCardRelations.ForEach((m) =>
                            {
                                TreeNode nd = new TreeNode();
                                nd.Text     = m.Name;
                                nd.Tag      = m.ID;
                                nd.Name     = m.ID.ToString();
                                nd.ImageKey = "card";

                                nod.Nodes.Add(nd);
                                nod.ImageKey = "materialCard";
                            });
                        }

                        node.Nodes.Add(nod);
                        if (nod.ImageKey == "materialCard")
                        {
                            node.ImageKey = nod.ImageKey;
                        }
                    });
                }

                //parentNode.Nodes.Add(node);
                tvMaterialDesign.Nodes.Add(node);
            });
        }