예제 #1
0
        /// <summary>
        /// 查询值班记录分类
        /// </summary>
        /// <returns></returns>
        public DataTable GetFL()
        {
            var       db  = new FaultContext();
            string    sql = "select DISTINCT FL from MAXIMO.V_YXJJBRZ ";
            DataTable dt  = db.ExcuteDataTable(sql);

            return(dt);
        }
예제 #2
0
        /// <summary>
        /// 分页查询班长值班交接日志
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">每个个数</param>
        /// <param name="bZMC">班组,班号</param>
        /// <param name="fL">分类</param>
        /// <param name="kEYWORD">关键字</param>
        /// <param name="sTARTDATE">开始时间</param>
        /// <param name="eNDDATE">结束时间</param>
        /// <param name="totalCount">返回的总条数</param>
        /// <returns></returns>
        public DataTable GetJJRZ(int pageIndex, int pageSize, string bZMC, string fL, string kEYWORD, string sTARTDATE, string eNDDATE, ref int totalCount)
        {
            string where = " 1=1 ";
            if (!string.IsNullOrWhiteSpace(bZMC))
            {
                where += $" AND T.XT='{bZMC}'";
            }
            if (!string.IsNullOrWhiteSpace(fL))
            {
                string[] flArry = fL.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                string   flSql  = "'" + string.Join("','", flArry) + "'";
                where += $" AND T.FL IN ({flSql})";
            }
            if (!string.IsNullOrWhiteSpace(kEYWORD))
            {
                where += $" AND T.CZNR like '%{kEYWORD}%'";
            }
            if (!string.IsNullOrWhiteSpace(sTARTDATE))
            {
                DateTime start;
                if (DateTime.TryParse(sTARTDATE, out start))
                {
                    where += $" AND T.FSDATE>=to_date('{start.ToString("yyyy-MM-dd")}','yyyy-MM-dd')";
                }
            }
            if (!string.IsNullOrWhiteSpace(eNDDATE))
            {
                DateTime end;
                if (DateTime.TryParse(eNDDATE, out end))
                {
                    end    = end.AddDays(1).Date;
                    where += $" AND T.FSDATE<to_date('{end.ToString("yyyy-MM-dd")}','yyyy-MM-dd')";
                }
            }

            string countSql  = $"SELECT COUNT(*) FROM ( select rownum as ROWNO,T.* from ( select * from V_YXJJBRZ order by FSDATE desc ) T where {where} ) tt";
            string selectSql = $"SELECT tt.*  FROM ( select rownum as ROWNO,T.* from ( select * from V_YXJJBRZ order by FSDATE desc ) T where {where} ) tt where tt.ROWNO>{(pageIndex - 1) * pageSize} and tt.ROWNO <{(pageSize * pageIndex) + 1}";
            var    db        = new FaultContext();
            object obj       = db.ExcuteScalar(countSql);

            totalCount = Convert.ToInt32(obj);

            DataTable dt = db.ExcuteDataTable(selectSql);

            return(dt);
        }