using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Pub_Class; using RestSharp; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.IO; using System.Web; using System.Web.Http; using System.Windows.Forms; using WebAPI.Models; using WebAPI.Service; using System.Text.RegularExpressions; using WebAPI.Controllers.SCGL.日计划管理; using SyntacticSugar.constant; namespace WebAPI.Controllers.SBGL { public class Sb_EquipMentReportController : ApiController { private json objJsonResult = new json(); public DataSet ds = new DataSet(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); #region 设备工艺参数数采临时表分页查询 [Route("Sb_EquipMentReport/Sb_EquipMentCollectionTechParam_Temp_Page")] [HttpGet] public object Sb_EquipMentCollectionTechParam_Temp_Page(string sWhere, string user, int page, int size) { DataSet ds; json res = new json(); try { List columnNameList = new List(); if (sWhere == null || sWhere.Equals("")) { ds = oCN.RunProcReturn("exec h_p_Sb_EquipMentCollectionTechParam_TempList " + page + "," + size + ",''", "h_p_Sb_EquipMentCollectionTechParam_TempList"); } else { sWhere = sWhere.Replace("'", "''"); ds = oCN.RunProcReturn("exec h_p_Sb_EquipMentCollectionTechParam_TempList " + page + "," + size + ",'" + sWhere + "'", "h_p_Sb_EquipMentCollectionTechParam_TempList"); } //添加列名 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列对象的列名 } res.code = CodeConstant.SUCCEED; res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); res.Message = "Sucess!"; res.list = columnNameList; res.data = ds.Tables[0]; return res; } catch (Exception e) { res.code = CodeConstant.FAIL; res.count = CountConstant.FAIL; res.Message = "Exception!" + e.ToString(); res.data = null; return res; } } #endregion #region 设备工艺参数数采表分页查询 [Route("Sb_EquipMentReport/Sb_EquipMentCollectionTechParam_Page")] [HttpGet] public object Sb_EquipMentCollectionTechParam_Page(string sWhere, string user, int page, int size) { DataSet ds; json res = new json(); try { List columnNameList = new List(); if (sWhere == null || sWhere.Equals("")) { ds = oCN.RunProcReturn("exec h_p_Sb_EquipMentCollectionTechParamList " + page + "," + size + ",''", "h_p_Sb_EquipMentCollectionTechParamList"); } else { sWhere = sWhere.Replace("'", "''"); ds = oCN.RunProcReturn("exec h_p_Sb_EquipMentCollectionTechParamList " + page + "," + size + ",'" + sWhere + "'", "h_p_Sb_EquipMentCollectionTechParamList"); } //添加列名 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列对象的列名 } res.code = CodeConstant.SUCCEED; res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); res.Message = "Sucess!"; res.list = columnNameList; res.data = ds.Tables[0]; return res; } catch (Exception e) { res.code = CodeConstant.FAIL; res.count = CountConstant.FAIL; res.Message = "Exception!" + e.ToString(); res.data = null; return res; } } #endregion } }