|  |  | 
 |  |  | using System.Data; | 
 |  |  | using Newtonsoft.Json.Linq; | 
 |  |  | using Pub_Class; | 
 |  |  | using Newtonsoft.Json; | 
 |  |  |  | 
 |  |  | namespace WebAPI.Controllers | 
 |  |  | { | 
 |  |  | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<object> a = new List<object>(); | 
 |  |  |                 //添加列名 | 
 |  |  |                 foreach (DataColumn col in ds.Tables[0].Columns) | 
 |  |  |                 { | 
 |  |  |                     Type dataType = col.DataType; | 
 |  |  |                     string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
 |  |  |                     a.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 | 
 |  |  |                 } | 
 |  |  |                 //if (ds.Tables[0].Rows.Count != 0 || ds != null) | 
 |  |  |                 //{ | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "Sucess!"; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 objJsonResult.list = a; | 
 |  |  |                 return objJsonResult; | 
 |  |  |                 //} | 
 |  |  |                 //else | 
 |  |  | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region 查询列表方法 | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 返回检验方案单列表 仅包含主表 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="sWhere"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("QC_Management/MES_QC_CheckProjectList_Json_Main")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object MES_QC_CheckProjectList_Json_Main(string sWhere, string user) | 
 |  |  |         { | 
 |  |  |             DataSet ds; | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //判断权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Gy_QCCheckProject_Query", 1, false, user)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "无查询权限"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |                 if (sWhere == null || sWhere.Equals("")) | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn("select  * from h_v_Gy_QCCheckProjectList_Main order by 日期 desc ", "h_v_Gy_QCCheckProjectList_Main"); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     string sql1 = "select * from h_v_Gy_QCCheckProjectList_Main where 1=1"; | 
 |  |  |                     string sql = sql1 + sWhere + " order by 日期 desc "; | 
 |  |  |                     ds = oCN.RunProcReturn(sql, "h_v_Gy_QCCheckProjectList_Main"); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "没有返回任何记录!" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             return GetObjectJson(ds); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 返回检验方案单列表 | 
 |  |  |         /// </summary> | 
 |  |  | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     string sql1 = "select * from h_v_QC_PatrolProcCheckBillList where 关闭人='' "; | 
 |  |  |                     string sql = sql1 + sqlWhere+ " order by hmainid desc "; | 
 |  |  |                     string sql = sql1 + sqlWhere+ " order by 制单日期 desc "; | 
 |  |  |                     ds = oCN.RunProcReturn(sql, "h_v_QC_PatrolProcCheckBillList"); | 
 |  |  |                 } | 
 |  |  |             } |