wtt
昨天 9dd3f02a66c612def2811b07090178aba8f9b2e3
WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs
@@ -1322,6 +1322,73 @@
        }
        #endregion
        #region 设备运行报表(分页)
        [Route("SB_EquipRunningStatus/ReportPage")]
        [HttpGet]
        public object ReportPage(string sWhere, string user, int page=1, int size=50)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //if (!DBUtility.ClsPub.Security_Log("Gy_EquipFileList", 1, false, user))
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "没有查看权限";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_Sb_EquipRunningStatusReport " + sWhere + " order by 所属日期 desc", "h_v_Sb_EquipRunningStatusReport");
                }
                else
                {
                    string sql1 = "select * from h_v_Sb_EquipRunningStatusReport where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by 所属日期 desc";
                    sql += $" offset {(page - 1) * size} rows fetch next {size} rows only";
                    ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipRunningStatusReport");
                }
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
                //if (ds.Tables[0].Rows.Count != 0 && ds != null)
                //{
                //}
                //else
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "无数据";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 设备运行状态报表
        [Route("SB_EquipRunningStatus/Report")]