using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Pub_Class; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.IO; using System.Web.Http; using WebAPI.DLL; using WebAPI.Models; using WebAPI.Service; using Kingdee.BOS.WebApi.Client; namespace WebAPI.Controllers { public class Sc_ICMOBillWorkQtyStatus_TmpController : ApiController { private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; #region 设备产量采集列表 [Route("Sc_ICMOBillWorkQtyStatus_Tmp/Sc_ICMOBillWorkQtyStatus_TmpList")] [HttpGet] public object Sc_ICMOBillWorkQtyStatus_TmpList(string sWhere, string user) { try { List columnNameList = new List(); string sql1 = "select * from Sc_ICMOBillWorkQtyStatus_TmpList where 1 = 1 "; string sql = sql1 + sWhere + " order by 采集时间 desc"; ds = oCN.RunProcReturn(sql, "Sc_ICMOBillWorkQtyStatus_TmpList"); //添加列名 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.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 设备产量采集列表 [Route("Sc_ICMOBillQualityStatus_Tmp/Sc_ICMOBillQualityStatus_TmpList")] [HttpGet] public object Sc_ICMOBillQualityStatus_TmpList(string sWhere, string user) { try { List columnNameList = new List(); string sql1 = "select * from Sc_ICMOBillQualityStatus_TmpList where 1 = 1 "; string sql = sql1 + sWhere + " order by 制单日期 desc"; ds = oCN.RunProcReturn(sql, "Sc_ICMOBillQualityStatus_TmpList"); //添加列名 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.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 } }