zrg
2025-02-25 a1c3a3d1b0b0b8c28a19e99177e4cee5a64949b7
WebAPI/Controllers/MJGL/Sc_MouldLifeUseBillController.cs
@@ -27,6 +27,18 @@
        {
            try
            {
                //判断权限
                if (!DBUtility.ClsPub.Security_Log("Sc_MouldLifeUseBill_Query", 3, 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_Sc_MouldLifeUseBillList order by HMainID asc", "h_v_Sc_MouldLifeUseBillList");
@@ -524,5 +536,69 @@
            }
        }
        #endregion
        #region 器具寿命趋势分析报表 查询
        /// <summary>
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Sc_MouldLifeUseReport/GetSc_MouldLifeUseReport")]
        [HttpGet]
        public object GetSc_MouldLifeUseReport(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                ////查看权限
                //if (!DBUtility.ClsPub.Security_Log("Sc_MouldLifeUseReport_Query", 1, false, user))
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "无查看权限!";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                //查询
                if (sWhere == null || sWhere.Equals(""))
                {
                    string sql = "exec h_p_Sc_MouldLifeUseReport ''";
                    ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldLifeUseReport");
                }
                else
                {
                    string sql = "exec h_p_Sc_MouldLifeUseReport  '" + sWhere + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldLifeUseReport");
                }
                //添加列名
                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;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}