Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tableName">表名</param>
        /// <param name="ids"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="total"></param>
        /// <returns></returns>
        public object GetDataTw(string tableName, IdsModel ids, int pageIndex, int pageSize, out int total)
        {
            total = 0;
            int start = 0, end = pageSize;

            if (pageIndex > 1)
            {
                start = (pageIndex - 1) * pageSize;
                end   = pageIndex * pageSize;
            }
            string      sql    = string.Format("SELECT SQL_CALC_FOUND_ROWS time,data_work_status from `{0}`  WHERE area_id = @AreaId AND mc_id=@McId AND par_id=@ParId AND dir_id=@DirId ORDER BY time DESC LIMIT {1},{2};SELECT FOUND_ROWS() total;", tableName, start, end);
            IDataReader reader = Db.Ado.GetDataReader(sql, new { ids.AreaId, ids.McId, ids.ParId, ids.DirId });

            List <long> time         = new List <long>();
            List <int>  twWorkStatus = new List <int>();

            while (reader.Read())
            {
                time.Add(new DateTimeOffset(Convert.ToDateTime(reader["time"])).ToUnixTimeSeconds());
                twWorkStatus.Add(Convert.ToInt32(reader["data_work_status"]));
            }

            if (reader.NextResult())
            {
                if (reader.Read())
                {
                    total = Convert.ToInt32(reader["total"]);
                }
            }
            if (!reader.IsClosed)
            {
                reader.Close();
            }
            return(new { time, twWorkStatus });
        }
Пример #2
0
        /// <summary>
        /// 获取方向下某时间波形
        /// </summary>
        /// <param name="tableName">表名</param>
        /// <param name="ids">方向</param>
        /// <param name="time">时间</param>
        /// <returns></returns>
        public ResultData GetDataTwByDirId(string parameter, IdsModel ids, TimeModel time)
        {
            List <DataTw>      list    = _dataTwDal.GetDataTwByDirId(GetTableName(parameter), ids, time);
            List <DataTwModel> dtmList = new List <DataTwModel>();

            foreach (DataTw item in list)
            {
                dtmList.Add(_mapper.Map <DataTwModel>(item));
            }
            return(new ResultData(dtmList));
        }
Пример #3
0
        /// <summary>
        /// 获取方向下最新 count条数据
        /// </summary>
        /// <param name="ids">方向</param>
        /// <param name="count">数量</param>
        /// <returns>结果集</returns>
        public ResultData GetDataOaByDirId(IdsModel ids, int count)
        {
            List <DataOa>      list    = _dataOaDal.GetDataOaByDirId(ids, count);
            List <DataOaModel> domList = new List <DataOaModel>();

            foreach (DataOa oa in list)
            {
                domList.Add(_mapper.Map <DataOaModel>(oa));
            }
            return(new ResultData(domList));
        }
Пример #4
0
        /// <summary>
        /// 获取方向下的时间列表(包含工况)
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="ids"></param>
        /// <returns></returns>
        public object GetDataTwTimeList(string tableName, IdsModel ids)
        {
            string      sql          = string.Format("SELECT time,data_work_status from `{0}`  WHERE area_id = @AreaId AND mc_id=@McId AND par_id=@ParId AND dir_id=@DirId ORDER BY time DESC", tableName);
            IDataReader reader       = Db.Ado.GetDataReader(sql, new { ids.AreaId, ids.McId, ids.ParId, ids.DirId });
            List <long> time         = new List <long>();
            List <int>  twWorkStatus = new List <int>();

            while (reader.Read())
            {
                time.Add(new DateTimeOffset(Convert.ToDateTime(reader["time"])).ToUnixTimeSeconds());
                twWorkStatus.Add(Convert.ToInt32(reader["data_work_status"]));
            }
            if (!reader.IsClosed)
            {
                reader.Close();
            }
            return(new { time, twWorkStatus });
        }
Пример #5
0
        /// <summary>
        /// 获取方向下所有总值,每一项是个数组
        /// </summary>
        /// <param name="ids">方向</param>
        /// <returns></returns>
        public object GetDataOaByDirId(IdsModel ids)
        {
            string       sql          = "SELECT * FROM tb_data_oa WHERE area_id=@AreaId AND mc_id=@McId AND par_id=@ParId AND dir_id=@DirId Order BY oa_time DESC";
            IDataReader  dataReader   = Db.Ado.GetDataReader(sql, new { AreaId = ids.AreaId, McId = ids.McId, ParId = ids.ParId, DirId = ids.DirId });
            List <float> temp         = new List <float>();
            List <float> acc          = new List <float>();
            List <float> vel          = new List <float>();
            List <float> disp         = new List <float>();
            List <float> env          = new List <float>();
            List <float> cf           = new List <float>();
            List <float> kurt         = new List <float>();
            List <float> bv           = new List <float>();
            List <float> bg           = new List <float>();
            List <long>  time         = new List <long>();
            List <int>   oaWorkStatus = new List <int>();

            while (dataReader.Read())
            {
                temp.Add(Convert.ToInt32(dataReader["oa_temp"]));
                acc.Add(Convert.ToSingle(dataReader["oa_acc"]));
                vel.Add(Convert.ToSingle(dataReader["oa_vel"]));
                bg.Add(Convert.ToSingle(dataReader["oa_bg"]));
                bv.Add(Convert.ToSingle(dataReader["oa_bv"]));
                env.Add(Convert.ToSingle(dataReader["oa_env"]));
                disp.Add(Convert.ToSingle(dataReader["oa_disp"]));
                cf.Add(Convert.ToSingle(dataReader["oa_CF"]));
                kurt.Add(Convert.ToSingle(dataReader["oa_kurt"]));
                time.Add(new DateTimeOffset(Convert.ToDateTime(dataReader["oa_time"])).ToUnixTimeSeconds());
                oaWorkStatus.Add(Convert.ToInt32(dataReader["oa_work_status"]));
            }
            if (!dataReader.IsClosed)
            {
                dataReader.Close();
            }

            return(new { temp, acc, vel, disp, env, cf, kurt, bv, bg, time, oaWorkStatus });
        }
Пример #6
0
        /// <summary>
        /// 获取方向下某时间波形
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="ids"></param>
        /// <returns></returns>
        public List <DataTw> GetDataTwByDirId(string tableName, IdsModel ids, TimeModel time)
        {
            string sql = string.Format("SELECT * FROM `{0}` WHERE  area_id=@AreaId AND mc_id=@McId AND par_id=@ParId AND dir_id=@DirId AND time=@Time", tableName);

            return(Db.Ado.SqlQuery <DataTw>(sql, new { ids.AreaId, ids.McId, ids.ParId, ids.DirId, time.Time }));
        }
Пример #7
0
        /// <summary>
        /// 查询方向下的时间数据列表
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public ResultData GetDataOaTimeList(IdsModel ids)
        {
            List <TimeModel> list = _dataOaDal.GetDataOaTimeList(ids);

            return(new ResultData(list));
        }
Пример #8
0
        /// <summary>
        /// 获取方向下所有总值,每一项是个数组
        /// </summary>
        /// <param name="ids">方向</param>
        public ResultData GetDataOaByDirId(IdsModel ids)
        {
            object obj = _dataOaDal.GetDataOaByDirId(ids);

            return(new ResultData(obj));
        }
Пример #9
0
        /// <summary>
        /// 获取方向下的时间列表(包含工况)
        /// </summary>
        /// <param name="tableName">表名</param>
        /// <param name="ids">方向</param>
        /// <returns>时间列表(含对应工况)</returns>
        public ResultData GetDataTwTimeList(string parameter, IdsModel ids)
        {
            object obj = _dataTwDal.GetDataTwTimeList(GetTableName(parameter), ids);

            return(new ResultData(obj));
        }
 public IActionResult CheckIfOrganizationsHaveUsers([FromBody] IdsModel model)
 {
     return(Ok(organizationService.CheckIfOrganizationsHaveUsers(model.Ids)));
 }
Пример #11
0
        /// <summary>
        /// 查询方向下的时间数据列表
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public List <TimeModel> GetDataOaTimeList(IdsModel ids)
        {
            string sql = "SELECT time FROM tb_data_oa WHERE area_id=@AreaId AND mc_id=@McId AND par_id=@ParId AND dir_id=@DirId ";

            return(Db.Ado.SqlQuery <TimeModel>(sql, ids));
        }
Пример #12
0
        /// <summary>
        /// 获取方向下最新 count条数据
        /// </summary>
        /// <param name="ids">方向</param>
        /// <param name="count">数量</param>
        /// <returns>结果集</returns>
        public List <DataOa> GetDataOaByDirId(IdsModel ids, int count)
        {
            string sql = "SELECT * FROM tb_data_oa WHERE area_id=@AreaId AND mc_id=@McId AND par_id=@ParId AND dir_id=@DirId Order BY oa_time DESC LIMIT 0,@Count";

            return(Db.Ado.SqlQuery <DataOa>(sql, new { AreaId = ids.AreaId, McId = ids.McId, ParId = ids.ParId, DirId = ids.DirId, Count = count }));
        }