Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7096491
  • 博文数量: 703
  • 博客积分: 10821
  • 博客等级: 上将
  • 技术积分: 12042
  • 用 户 组: 普通用户
  • 注册时间: 2005-12-02 10:41
个人简介

中科院云平台架构师,专注于数字化、智能化,技术方向:云、Linux内核、AI、MES/ERP/CRM/OA、物联网、传感器、大数据、ML、微服务。

文章分类

全部博文(703)

分类: Java

2011-04-20 16:28:59

      public long getClassIDByPartId(long partId)
        {
            DBConnect dbCon = new DBConnect(this);
            long iClassId, iProductId, iPartId, iParentPartId;
             
            string dsSql = "Select NodeID,ParentNodeID,Class,OrderIndex,PartId from DM_ProductTree order by Class Desc,ParentNodeID,OrderIndex;
            
            DataSet ds = dbCon.getDataSet(dsSql);
                        
            return getClassIDByNodeID(ds, 0, partId);
        }
        
        private long getClassIDByNodeID(DataSet ds, int fromNo, long varNodeID)
        {
            return getIDByNodeID(ds, fromNo, varNodeID, 0);
        }
       
        private long getProductIDByNodeID(DataSet ds, int fromNo, long varNodeID)
        {
            return getIDByNodeID(ds, fromNo, varNodeID, 1);
        }
         
        private long getIDByNodeID(DataSet ds, int fromNo, long varNodeID, int iFlg)
        {
            DataRow dr;
            for (i = fromNo; i < ds.Tables["tree"].Rows.Count; i++)
            {
                dr=dst.Tables["tree"].Rows[i];
                iNodeId = Convert.ToInt32(dr["NodeID"]);
                if (iNodeId == varNodeID){
                    iClass = Convert.ToInt32(dr["Class"]);
                    iParentNodeID = Convert.ToInt64(dr["ParentNodeID"]);
                    if (iClass == iFlg + 1)
                    {
                        return iParentNodeID;
                    }else{
                        return getClassIDByNodeID(ds, i, iParentNodeID);
                    }
                }
            }
        }
阅读(2451) | 评论(0) | 转发(0) |
0

上一篇:extJS

下一篇:IHttpHandler 概述(ASP)

给主人留下些什么吧!~~