yusijie
2024-11-22 3697b0dda739b38c33406d6e164714167e9ad5b5
WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs
@@ -90,6 +90,59 @@
            }
        }
        #region 设备保养记录分页查询
        [Route("Sb_EquipMaintainBill/GetEquipMaintainBillListPage")]
        [HttpGet]
        public object GetEquipMaintainBillListPage(string sWhere, string user, int page, int size)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log_second("Sb_EquipMaintainBillList", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                sWhere = sWhere.Replace("'", "''");
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("exec h_p_Sc_EquipMaintainListPage " + page + "," + size + ",''", "h_p_Sc_EquipMaintainListPage");
                }
                else
                {
                    ds = oCN.RunProcReturn("exec h_p_Sc_EquipMaintainListPage " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_EquipMaintainListPage");
                }
                //添加列名
                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 = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                objJsonResult.Message = "Sucess!";
                objJsonResult.list = columnNameList;
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 设备保养记录统计分析 
        /// <summary>
        /// 返回设备保养记录统计分析 列表