/// <summary> /// 获取位置信息树 /// </summary> /// <returns></returns> public string GetTreeNodes(List <Orgaization> list) { List <TreeNodeResult> nodes = new List <TreeNodeResult>(); List <Orgaization> childList = null; try { TreeNodeResult rootNode = new TreeNodeResult(); rootNode.Tid = "root"; rootNode.Ttext = ConfigurationManager.AppSettings["rootOrgan"]; childList = list.Where(p => p.OrganParent == "root").ToList <Orgaization>(); foreach (Orgaization info in childList) { TreeNodeResult node = new TreeNodeResult(); node.Tid = info.OrganID; node.Ttext = info.OrganDESC; //添加子机构 this.BuildChildItems(node, list); rootNode.AddchildNode(node); } nodes.Add(rootNode); return(TreeNodeResult.GetResultJosnS(nodes.ToArray())); } catch (Exception ex) { throw ex; } }
/// <summary> /// 获取仓库树数据源 /// </summary> /// <returns></returns> public string GetWHList() { List <TreeNodeResult> list = new List <TreeNodeResult>(); WarehouseBLL bll = null; List <Warehouse> array = null; try { bll = BLLFactory.CreateBLL <WarehouseBLL>(); array = bll.GetList(); TreeNodeResult rootNode = new TreeNodeResult(); rootNode.Tid = ""; rootNode.Ttext = "仓库"; foreach (Warehouse info in array) { TreeNodeResult node = new TreeNodeResult(); node.Tid = info.ID; node.Ttext = info.Code + "|" + info.Description; rootNode.AddchildNode(node); } list.Add(rootNode); return(TreeNodeResult.GetResultJosnS(list.ToArray())); } catch (Exception ex) { throw ex; } }
/// <summary> /// 获取位置信息树 /// </summary> /// <returns></returns> public string GetTreeNodes(List <VDPosition> list) { List <TreeNodeResult> nodes = new List <TreeNodeResult>(); List <VDPosition> childList = null; try { TreeNodeResult rootNode = new TreeNodeResult(); rootNode.Tid = "root"; rootNode.Ttext = "视频监控位置"; childList = list.Where(p => p.ParentID == "root").ToList <VDPosition>(); foreach (VDPosition info in childList) { TreeNodeResult node = new TreeNodeResult(); node.Tid = info.ID; node.Ttext = info.PositionName; //添加子位置 this.BuildChildItems(node, list); rootNode.AddchildNode(node); } nodes.Add(rootNode); return(TreeNodeResult.GetResultJosnS(nodes.ToArray())); } catch (Exception ex) { throw ex; } }
/// <summary> /// 创建子权限 /// </summary> /// <param name="parentNode">父节点</param> /// <param name="childPowers">子权限</param> private void BuildChildItems(TreeNodeResult parentNode, List <MenuInfo> childPowers, RoleInfo role) { foreach (MenuInfo info in childPowers) { TreeNodeResult node = new TreeNodeResult(); node.Tid = info.MenuID; node.Ttext = info.MenuDes; node.TChecked = role.Powers.Exists(p => p.AuthorityID == info.MenuID); //如果为空,那么结束循环 if (info.ChildMenus != null) { //添加子权限 this.BuildChildItems(node, info.ChildMenus, role); } parentNode.AddchildNode(node); } }
/// <summary> /// 创建子机构信息 /// </summary> /// <param name="parentNode">父节点</param> /// <param name="childPowers">子权限</param> private void BuildChildItems(TreeNodeResult parentNode, List <Orgaization> list) { List <Orgaization> childList = null; childList = list.Where(p => p.OrganParent == parentNode.Tid).ToList <Orgaization>(); foreach (Orgaization info in childList) { TreeNodeResult node = new TreeNodeResult(); node.Tid = info.OrganID; node.Ttext = info.OrganDESC; //添加子机构 this.BuildChildItems(node, list); parentNode.AddchildNode(node); } }
/// <summary> /// 创建子位置信息 /// </summary> /// <param name="parentNode">父节点</param> /// <param name="childPowers">子权限</param> private void BuildChildItems(TreeNodeResult parentNode, List <VDPosition> list) { List <VDPosition> childList = null; childList = list.Where(p => p.ParentID == parentNode.Tid).ToList <VDPosition>(); foreach (VDPosition info in childList) { TreeNodeResult node = new TreeNodeResult(); node.Tid = info.ID; node.Ttext = info.PositionName; //添加子位置 this.BuildChildItems(node, list); parentNode.AddchildNode(node); } }
/// <summary> /// 获取仓库树数据源 /// </summary> /// <returns></returns> public string GetWSList() { List <TreeNodeResult> list = new List <TreeNodeResult>(); FactoryInfoBLL bllF = null; ProcessFlowBLL bllP = null; List <FactoryInfo> arrayF = null; List <ProcessFlow> arrayP = null; try { bllF = BLLFactory.CreateBLL <FactoryInfoBLL>(); bllP = BLLFactory.CreateBLL <ProcessFlowBLL>(); arrayF = bllF.GetList(); arrayP = bllP.GetList(); TreeNodeResult rootNode = new TreeNodeResult(); rootNode.Tid = ""; rootNode.Ttext = "工厂/工艺流程"; foreach (FactoryInfo infoF in arrayF) { TreeNodeResult node = new TreeNodeResult(); node.Tid = infoF.PID + "|F"; node.Ttext = infoF.PCODE + "|" + infoF.PNAME; rootNode.AddchildNode(node); List <ProcessFlow> plines = arrayP.Where(o => o.FACTORYPID == infoF.PID).ToList(); foreach (ProcessFlow infoP in plines) { TreeNodeResult nodeP = new TreeNodeResult(); nodeP.Tid = infoP.PID + "|P"; nodeP.Ttext = infoP.PCODE + "|" + infoP.PNAME; node.AddchildNode(nodeP); } } list.Add(rootNode); return(TreeNodeResult.GetResultJosnS(list.ToArray())); } catch (Exception ex) { throw ex; } }