1
zrg
2024-08-13 461a7bfc0a2250ec5ff4b7a85cb6ce3c2f0bf06e
WebAPI/Controllers/SBGL/Sb_EquipReportController.cs
@@ -275,5 +275,87 @@
        #endregion
        #region 设备保养率报表(月度保养统计表)
        /// <summary>
        /// 设备保养率报表(月度保养统计表)
        /// </summary>
        /// <returns></returns>
        [Route("Sb_EquipReportController/GetSb_EquipMaintainMonthSumReport_Json")]
        [HttpGet]
        public object GetSb_EquipMaintainMonthSumReport_Json(DateTime HDate, Int64 HStockOrgID, string sWhere)
        {
            try
            {
                ds = oCN.RunProcReturn("exec h_p_Sb_EquipMaintainMonthSumReport '" + HDate.ToShortDateString() + "'," + HStockOrgID.ToString() + "," + sWhere, "h_p_Sb_EquipMaintainMonthSumReport");
                List<object> columnNameList = new List<object>();
                //添加列名
                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 = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "成功!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
                //}
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "返回报表信息失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 设备维修率报表
        /// <summary>
        /// 设备维修率报表
        /// </summary>
        /// <returns></returns>
        [Route("Sb_EquipReportController/GetSb_EquipRepairMonthSumReport_Json")]
        [HttpGet]
        public object GetSb_EquipRepairMonthSumReport_Json(DateTime HDate, Int64 HStockOrgID, string sWhere)
        {
            try
            {
                ds = oCN.RunProcReturn("exec h_p_Sb_EquipRepairMonthSumReport '" + HDate.ToShortDateString() + "'," + HStockOrgID.ToString() + "," + sWhere, "h_p_Sb_EquipRepairMonthSumReport");
                List<object> columnNameList = new List<object>();
                //添加列名
                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 = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "成功!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
                //}
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "返回报表信息失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}