/// <summary>
        /// 方法说明:加载产品树数据
        /// 作    者:jason.tang
        /// 完成时间:2013-03-05
        /// </summary>
        private void LoadPBomData()
        {
            if (tvPBOM.Nodes.Count > 0)
            {
                return;
            }

            //查找根节点(物料版本)下的子节点
            List <Model.MaterialVersionModule> versionModuleList =
                MaterialModuleBLL.GetMaterialVersionModuleList();

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


            versionModuleList.ForEach((o) =>
            {
                TreeNode root = new TreeNode();
                root.Text     = o.Name;
                root.ImageKey = "materialG";
                root.Tag      = o.MaterialVerId;
                root.Name     = o.BaseId;
                root.Expand();

                LoadPBomChildNode(root);

                tvPBOM.Nodes.Add(root);
            });
        }
Example #2
0
        /// <summary>
        /// 方法说明:根据分类ID+类型ID获取物料
        /// 作    者:jason.tang
        /// 完成时间:2013-03-07
        /// </summary>
        /// <param name="typeId">分类Id</param>
        /// <param name="categoryId">业务类型ID</param>
        private void GetMaterialList(string typeId, string categoryId)
        {
            //根据物料分类ID获取物料列表
            DataTable dt = MaterialModuleBLL.GetMaterialModuleDataByCategoryId(typeId, categoryId, null);

            FormCollection collection = Application.OpenForms;
            bool           isOpened   = false;

            foreach (Form form in collection)
            {
                if (form.Name == "MaterialListFrm")
                {
                    isOpened = true;
                    ((MaterialListFrm)form).CategoryTypeId = categoryId;
                    ((MaterialListFrm)form).TypeId         = typeId;
                    ((MaterialListFrm)form).RefreshData(dt);
                    form.Select();
                }
            }

            if (!isOpened)
            {
                MaterialListFrm frm = new MaterialListFrm();
                frm.MaterialData   = dt;
                frm.CategoryTypeId = categoryId;
                frm.TypeId         = typeId;
                MainFrm.mainFrm.OpenModule(frm);
            }
        }
        /// <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;
                    }
                });
            }
        }
Example #4
0
        private void GetChildCategoryModuleList(TreeNode nd)
        {
            //根据物料父分类ID查找是否包含子分类
            List <Model.BusinessCategoryModule> childCategoryModuleList
                = MaterialModuleBLL.GetCategoryModuleListByParentId(nd.Name);

            if (childCategoryModuleList.Count > 0)
            {
                childCategoryModuleList.ForEach((s) =>
                {
                    TreeNode nod = new TreeNode();
                    nod.Text     = s.CategoryName;
                    nod.Tag      = nd.Tag;
                    nod.Name     = s.CategoryId;
                    nod.ImageKey = "class";

                    GetChildCategoryModuleList(nod);

                    nd.Nodes.Add(nod);
                }
                                                );
            }
        }
        /// <summary>
        /// 方法说明:根据根节点加载子节点
        /// 作    者:jason.tang
        /// 完成时间:2013-03-06
        /// </summary>
        /// <param name="parentNode">父节点</param>
        private void LoadMaterialChildNode(TreeNode parentNode)
        {
            if (parentNode == null)
            {
                return;
            }

            parentNode.Nodes.Clear();

            //查找根节点(产品文件夹)下的子节点
            List <Model.MaterialRelationModule> relationModuleList =
                MaterialModuleBLL.GetMaterialVersionModuleListByVersionId(parentNode.Name);

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

            relationModuleList.ForEach((o) =>
            {
                TreeNode node = new TreeNode();
                node.Text     = o.name;
                node.Tag      = o.ChildVerId;
                node.Name     = o.ChildVerId;
                node.ImageKey = "materialG";

                List <Model.MaterialRelationModule> childRelationModuleList =
                    MaterialModuleBLL.GetMaterialVersionModuleListByVersionId(node.Name);
                if (childRelationModuleList.Count > 0)
                {
                    LoadPBomChildNode(node);
                }

                parentNode.Nodes.Add(node);
            });
        }
Example #6
0
        /// <summary>
        /// 方法说明:根据根节点加载子节点
        /// 作    者:jason.tang
        /// 完成时间:2013-03-07
        /// </summary>
        /// <param name="parentNode"></param>
        private void LoadMaterialChildNode(TreeNode parentNode)
        {
            if (parentNode == null)
            {
                return;
            }

            parentNode.Nodes.Clear();

            //查找根节点(物料)下的子节点
            List <Model.MaterialModule> materialModuleList =
                MaterialModuleBLL.GetMaterialModuleList();

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

            materialModuleList.ForEach((o) =>
            {
                TreeNode node = new TreeNode();
                node.Text     = o.TypeName;
                node.Tag      = o.TypeId;
                node.Name     = null;
                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;
                }

                //根据物料类型查找物料分类
                List <Model.BusinessCategoryModule> businessCategoryModuleList
                    = MaterialModuleBLL.GetCategoryModuleListByType(o.TypeId);

                if (businessCategoryModuleList.Count > 0)
                {
                    businessCategoryModuleList.ForEach((c) =>
                    {
                        TreeNode nd = new TreeNode();
                        nd.Text     = c.CategoryName;
                        nd.Tag      = o.TypeId;
                        nd.Name     = c.CategoryId;
                        nd.ImageKey = "class";

                        ////根据物料父分类ID查找是否包含子分类
                        //List<Model.BusinessCategoryModule> childCategoryModuleList
                        //    = MaterialModuleBLL.GetCategoryModuleListByParentId(nd.Name);

                        //if (childCategoryModuleList.Count > 0)
                        //{
                        //    childCategoryModuleList.ForEach((s) =>
                        //    {
                        //        TreeNode nod = new TreeNode();
                        //        nod.Text = s.CategoryName;
                        //        nod.Tag = o.TypeId;
                        //        nod.Name = s.CategoryId;
                        //        nod.ImageKey = "class";

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

                        node.Nodes.Add(nd);
                    });
                }

                parentNode.Nodes.Add(node);
            });
        }
        /// <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);
            });
        }