Esempio n. 1
0
        /// <summary>
        /// 获取ParaId及对应的数据表名。(已过滤)
        /// </summary>
        /// <returns></returns>
        public List<ParaTableInfo> GetInfo(string capacityLevel,string  unitType,string BoilerId,string SteamId,out string errMsg)
        {
            this.init();
            errMsg = "";
            List<ParaTableInfo> infoList = new List<ParaTableInfo>();
            string sql = "select b.T_PARAID,c.T_DESC,c.T_OUTTABLE,b.T_UNITID,p.T_PLANTDESC ,u.T_UNITDESC from T_BASE_CONSUMEPARA as b left join T_BASE_CALCPARA as c on b.T_PARAID=c.T_PARAID left join T_BASE_UNIT as u on b.T_UNITID=u.T_UNITID left join  T_BASE_BOILER as j on u.T_BOILERID = j.T_BOILERID left  join T_BASE_STEAM as s on u.T_STEAMID=s.T_STEAMID  left join T_BASE_PLANT as p on  u.T_PLANTID=p.T_PLANTID where c.I_CONSUMETYPE  is not null  and c.I_TARGETTYPE IS NOT NULL";

            if(!String.IsNullOrEmpty(capacityLevel)&&capacityLevel!="0")
            {
            sql+=" and  u.T_CAPABILITYLEVEL='"+capacityLevel+"'";
            }

            if(!String.IsNullOrEmpty(unitType)&&unitType!="0")
            {
            sql+=" and u.T_PLANTTYPE='"+unitType+"'";
            }

            if(!String.IsNullOrEmpty(BoilerId)&&BoilerId!="0")
            {
            sql+=" and   u.T_BOILERID='"+BoilerId+"'";
            }

            if (!String.IsNullOrEmpty(SteamId) && SteamId != "0")
            {
                sql += " and u.T_STEAMID='" + SteamId + "'";
            }
            DataTable dt = null;

            if (rlDBType == "SQL")
            {
                // sql = "select ID_KEY,班次名,起始时间,结束时间 from 班次时间表 order by ID_KEY";
                //dt = DBsql.RunDataTable(sql, out errMsg);
            }
            else
            {
                dt = DBdb2.RunDataTable(sql, out errMsg);
            }

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (!String.IsNullOrEmpty(dt.Rows[i]["T_OUTTABLE"].ToString()))
                    {
                        ParaTableInfo info = new ParaTableInfo();
                        info.ParaId = String.IsNullOrEmpty(dt.Rows[i]["T_PARAID"].ToString()) ? String.Empty : dt.Rows[i]["T_PARAID"].ToString();
                        info.ParaDesc = String.IsNullOrEmpty(dt.Rows[i]["T_DESC"].ToString()) ? String.Empty : dt.Rows[i]["T_DESC"].ToString();
                        info.OutTableName = dt.Rows[i]["T_OUTTABLE"].ToString();
                        info.UnitId = dt.Rows[i]["T_UNITID"].ToString();
                        info.UnitName = dt.Rows[i]["T_PLANTDESC"].ToString() + dt.Rows[i]["T_UNITDESC"].ToString();
                        infoList.Add(info);
                    }
                }

            }
            //去掉重复。
            //return infoList.Distinct(new EqualCompare<ParaTableInfo>((x, y) => (x != null && y != null) &&(x.OutTableName == y.OutTableName))).ToList();
            //不能过滤,因为会把ParaId过滤掉。以ParaId来取值的。
            return infoList;
        }
Esempio n. 2
0
        /// <summary>
        /// 获取ParaId及对应的数据表名。(已过滤)
        /// </summary>
        /// <returns></returns>
        public List<ParaTableInfo> GetInfo(out string errMsg)
        {
            this.init();
            errMsg = "";
            List<ParaTableInfo> infoList = new List<ParaTableInfo>();
            string sql = "select b.T_PARAID,c.T_DESC,c.T_OUTTABLE from T_BASE_CONSUMEPARA as b left join T_BASE_CALCPARA as c on b.T_PARAID=c.T_PARAID";

            DataTable dt = null;

            if (rlDBType == "SQL")
            {
                // sql = "select ID_KEY,班次名,起始时间,结束时间 from 班次时间表 order by ID_KEY";
                //dt = DBsql.RunDataTable(sql, out errMsg);
            }
            else
            {
                dt = DBdb2.RunDataTable(sql, out errMsg);
            }

            if (dt!=null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (!String.IsNullOrEmpty(dt.Rows[i]["T_OUTTABLE"].ToString()))
                    {
                        ParaTableInfo info = new ParaTableInfo();
                        info.ParaId = String.IsNullOrEmpty(dt.Rows[i]["T_PARAID"].ToString()) ? String.Empty : dt.Rows[i]["T_PARAID"].ToString();
                        info.ParaDesc = String.IsNullOrEmpty(dt.Rows[i]["T_DESC"].ToString()) ? String.Empty : dt.Rows[i]["T_DESC"].ToString();
                        info.OutTableName =dt.Rows[i]["T_OUTTABLE"].ToString();

                        infoList.Add(info);
                    }
                }

            }
            //去掉重复。
            //return infoList.Distinct(new EqualCompare<ParaTableInfo>((x, y) => (x != null && y != null) &&(x.OutTableName == y.OutTableName))).ToList();
            //不能过滤,因为会把ParaId过滤掉。以ParaId来取值的。
            return infoList;
        }