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 QC_QualityReportsController : ApiController { private json objJsonResult = new json(); public DataSet ds = new DataSet(); public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); #region 质量模块 直通率报表查询 /// /// 返回直通率报表列表 ///参数:string sql。 ///返回值:object。 /// [Route("QC_Report/FirstPassRate")] [HttpGet] public object FirstPassRate(string Year,string DeptName, string user) { try { List columnNameList = new List(); if (Year == null || Year.Equals("")) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "请选择有效年份"; return objJsonResult; } else { ds = oCN.RunProcReturn("exec h_p_QC_FirstPassRateReport '" + Year + "','" + DeptName + "'", "h_p_QC_FirstPassRateReport"); } //添加列名 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 #region 质量模块 生产不良原因统计分析报表查询 /// /// 返回生产不良原因统计分析报表列表 ///参数:string sql。 ///返回值:object。 /// [Route("QC_Report/ProdBadReason")] [HttpGet] public object ProdBadReason(string BeginDate, string EndDate, string DeptName,string ICMOBillNo, string SourceName, string DeptType, string user) { try { List columnNameList = new List(); if (BeginDate == null || BeginDate.Equals("")) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "请选择有效年份"; return objJsonResult; } else { ds = oCN.RunProcReturn("exec h_p_Sc_BadReasonByProcReport '" + BeginDate + "','" + EndDate + "','" + DeptName + "','" + ICMOBillNo + "','" + SourceName + "','" + DeptType + "'", "h_p_Sc_BadReasonByProcReport"); } //添加列名 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 #region 质量模块 直通率周报表查询 /// /// 返回直通率周报表列表 ///参数:string sql。 ///返回值:object。 /// [Route("QC_Report/FirstPassRateWeek")] [HttpGet] public object FirstPassRateWeek(string Year, string DeptName, string user) { try { List columnNameList = new List(); if (Year == null || Year.Equals("")) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "请选择有效年份"; return objJsonResult; } else { ds = oCN.RunProcReturn("exec h_p_QC_FirstPassRateWeekReport '" + Year + "','" + DeptName + "'", "h_p_QC_FirstPassRateWeekReport"); } //添加列名 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 #region 质量模块 不良原因总体统计分析报表查询 /// /// 返回不良原因总体统计分析报表列表 ///参数:string sql。 ///返回值:object。 /// [Route("QC_Report/ProdBadReason_Sum")] [HttpGet] public object ProdBadReason_Sum(string BeginDate, string EndDate, string DeptName, string ICMOBillNo, string SourceName, string DeptType, string user) { try { List columnNameList = new List(); if (BeginDate == null || BeginDate.Equals("")) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "请选择有效年份"; return objJsonResult; } else { ds = oCN.RunProcReturn("exec h_p_Sc_BadReasonByProcReport_Sum '" + BeginDate + "','" + EndDate + "','" + DeptName + "','" + ICMOBillNo + "','" + SourceName + "','" + DeptType + "'", "h_p_Sc_BadReasonByProcReport_Sum"); } //添加列名 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 #region 质量模块 质量预警报表查询 /// /// 返回质量预警报表列表 ///参数:string sql。 ///返回值:object。 /// [Route("QC_Report/ProductQtyWarning")] [HttpGet] public object ProductQtyWarning(DateTime HBeginDate, DateTime HEndDate, string DeptName) { try { List columnNameList = new List(); if (HBeginDate == null || HBeginDate.Equals("")) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "请选择有时间"; return objJsonResult; } else { ds = oCN.RunProcReturn("exec h_p_QC_FirstPassRateICMOReport '" + HBeginDate + "','" + HEndDate + "','" + DeptName + "'", "h_p_QC_FirstPassRateICMOReport"); } //添加列名 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 #region 质量模块 质量追溯报表报表查询(首件检验) /// /// 返回质量追溯报表列表 ///参数:string sql。 ///返回值:object。 /// [Route("QC_Report/QualityTraceability1")] [HttpGet] public object QualityTraceability1(string HICMOBillNo, string HType) { try { List columnNameList = new List(); ds = oCN.RunProcReturn("exec h_p_Sc_QueryQualityByICMOBill '" + HType + "','" + HICMOBillNo + "'", "h_p_Sc_QueryQualityByICMOBill"); //添加列名 foreach (DataColumn col in ds.Tables[2].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[2]; 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 #region 质量模块 质量追溯报表报表查询(工序检验) /// /// 返回质量追溯报表列表 ///参数:string sql。 ///返回值:object。 /// [Route("QC_Report/QualityTraceability2")] [HttpGet] public object QualityTraceability2(string HICMOBillNo, string HType) { try { List columnNameList = new List(); ds = oCN.RunProcReturn("exec h_p_Sc_QueryQualityByICMOBill '" + HType + "','" + HICMOBillNo + "'", "h_p_Sc_QueryQualityByICMOBill"); //添加列名 foreach (DataColumn col in ds.Tables[3].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[3]; 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 #region 质量模块 质量追溯报表报表查询(生产汇报) /// /// 返回质量追溯报表列表 ///参数:string sql。 ///返回值:object。 /// [Route("QC_Report/QualityTraceability3")] [HttpGet] public object QualityTraceability3(string HICMOBillNo, string HType) { try { List columnNameList = new List(); ds = oCN.RunProcReturn("exec h_p_Sc_QueryQualityByICMOBill '" + HType + "','" + HICMOBillNo + "'", "h_p_Sc_QueryQualityByICMOBill"); //添加列名 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 #region 质量模块 质量追溯报表报表查询(质量汇报) /// /// 返回质量追溯报表列表 ///参数:string sql。 ///返回值:object。 /// [Route("QC_Report/QualityTraceability4")] [HttpGet] public object QualityTraceability4(string HICMOBillNo, string HType) { try { List columnNameList = new List(); ds = oCN.RunProcReturn("exec h_p_Sc_QueryQualityByICMOBill '" + HType + "','" + HICMOBillNo + "'", "h_p_Sc_QueryQualityByICMOBill"); //添加列名 foreach (DataColumn col in ds.Tables[1].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[1]; 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 #region 质量模块 SPC检验单分析 /// /// 返回直通率报表列表 ///参数:string sql。 ///返回值:object。 /// [Route("QC_CustomerAppealReport/QC_InspectionFormReport")] [HttpGet] public object QC_InspectionFormReport(string sWhere,string user) { try { List columnNameList = new List(); if (sWhere == null || sWhere == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查询条件!"; objJsonResult.data = null; return objJsonResult; } Dictionary dic = Newtonsoft.Json.JsonConvert.DeserializeObject>(sWhere); string HBeginDate = dic["HBeginDate"].ToString(); string HEndDate = dic["HEndDate"].ToString(); int limit = int.Parse(dic["limit"].ToString()); int HQCCheckItemID = int.Parse(dic["HQCCheckItemID"].ToString()); int HMaterID = int.Parse(dic["HMaterID"].ToString()); string HMouldNum = dic["HMouldNum"].ToString(); ds = oCN.RunProcReturn("exec h_p_QC_InspectionFormReport '" + HBeginDate + "','" + HEndDate + "'," + limit + "," + HQCCheckItemID + "," + HMaterID + ",'" + HMouldNum + "'", "h_p_QC_InspectionFormReport"); //添加列名 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 #region 质量模块 生产质量统计日报 /// /// 返回直通率报表列表 ///参数:string sql。 ///返回值:object。 /// [Route("QC_CustomerAppealReport/QC_QualityStatisticsDailyReport")] [HttpGet] public object QC_QualityStatisticsDailyReport(string sWhere, string user) { try { List columnNameList = new List(); if (sWhere == null || sWhere == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查询条件!"; objJsonResult.data = null; return objJsonResult; } Dictionary dic = Newtonsoft.Json.JsonConvert.DeserializeObject>(sWhere); string HYear = dic["HYear"].ToString(); string HMonth = dic["HMonth"].ToString(); int HDeptName = int.Parse(dic["HDeptName"].ToString()); int HOrgID = int.Parse(dic["HOrgID"].ToString()); ds = oCN.RunProcReturn("exec h_p_QC_QualityStatisticsDailyReport '" + HYear + "','" + HMonth + "'," + HDeptName + "," + HOrgID, "h_p_QC_QualityStatisticsDailyReport"); //添加列名 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 #region 质量模块 含水率数据台账 /// /// 返回直通率报表列表 ///参数:string sql。 ///返回值:object。 /// [Route("QC_CustomerAppealReport/QC_MoistureContentDataLedger")] [HttpGet] public object QC_MoistureContentDataLedger(string sWhere, string user) { try { List columnNameList = new List(); if (sWhere == null || sWhere == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查询条件!"; objJsonResult.data = null; return objJsonResult; } Dictionary dic = Newtonsoft.Json.JsonConvert.DeserializeObject>(sWhere); string HBeginDate = dic["HBeginDate"].ToString(); string HEndDate = dic["HEndDate"].ToString(); string HResult = dic["HResult"].ToString(); int HSourceID = int.Parse(dic["HSourceID"].ToString()); ds = oCN.RunProcReturn("exec h_p_QC_MoistureContentDataLedger '" + HBeginDate + "','" + HEndDate + "','" + HResult + "'," + HSourceID, "h_p_QC_MoistureContentDataLedger"); //添加列名 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 #region 质量模块 各工序质量趋势图 查询 [Route("QC_CustomerAppealReport/getSc_StationOutBill_HProc")] [HttpGet] public object getSc_HMaterYieldStatistics(string sWhere, string user) { try { List columnNameList = new List(); if (sWhere == null || sWhere.Equals("")) { ds = oCN.RunProcReturn("select * from h_v_Sc_StationOutBillQuery_HProc order by 日期 desc", "h_v_Sc_StationOutBillQuery_HProc"); } else { string sql1 = "select * from h_v_Sc_StationOutBillQuery_HProc where 1 = 1 "; string sql = sql1 + sWhere + " order by 日期 "; ds = oCN.RunProcReturn(sql, "h_v_Sc_StationOutBillQuery_HProc"); } //添加列名 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 #region 质量模块 设备工艺参数趋势图 根据流转卡获取设备 [Route("QC_CustomerAppealReport/Get_EquipList")] [HttpGet] public object Get_EquipList(string HProcExchBillNo, string user) { try { List columnNameList = new List(); ds = oCN.RunProcReturn("select distinct b.HInterID HItemID,b.HName HName from SB_EquipICMOTechParamBillMain a left join Gy_EquipFileBillMain b on a.HEquipID=b.HInterID where HProcExchBillNo='" + HProcExchBillNo + "'", "SB_EquipICMOTechParamBillMain"); //添加列名 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 #region 质量模块 设备工艺参数趋势图 [Route("QC_CustomerAppealReport/SB_EquipICMOTechParamList")] [HttpGet] public object SB_EquipICMOTechParamList(string sWhere, string user) { try { List columnNameList = new List(); Dictionary dic = Newtonsoft.Json.JsonConvert.DeserializeObject>(sWhere); string HProcExchBillNo = dic["HProcExchBillNo"].ToString(); string HProcName = dic["HProcName"].ToString(); string HTechParamName = dic["HTechParamName"].ToString(); string HEquipName = dic["HEquipName"].ToString(); if ((HProcExchBillNo == null || HProcExchBillNo == "")&&(HProcName == null || HProcName == "") && (HTechParamName == null || HTechParamName == "") && (HEquipName == null || HEquipName == "")) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查询条件!"; objJsonResult.data = null; return objJsonResult; } ds = oCN.RunProcReturn("exec h_p_SB_EquipICMOTechParamBillList '" + HProcExchBillNo + "','" + HProcName + "','" + HTechParamName + "',"+HEquipName, "h_p_SB_EquipICMOTechParamBillList"); //添加列名 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 #region 质量模块 性能报废台账 /// /// 返回直通率报表列表 ///参数:string sql。 ///返回值:object。 /// [Route("QC_CustomerAppealReport/QC_PerformanceScrapLedger")] [HttpGet] public object QC_PerformanceScrapLedger(string sWhere, string user) { try { List columnNameList = new List(); if (sWhere == null || sWhere == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查询条件!"; objJsonResult.data = null; return objJsonResult; } Dictionary dic = Newtonsoft.Json.JsonConvert.DeserializeObject>(sWhere); string HBeginDate = dic["HBeginDate"].ToString(); string HEndDate = dic["HEndDate"].ToString(); string HBatchNo = dic["HBatchNo"].ToString(); int HMaterID = int.Parse(dic["HMaterID"].ToString()); ds = oCN.RunProcReturn("exec h_p_QC_PerformanceScrapLedger '" + HBeginDate + "','" + HEndDate + "','" + HMaterID + "','" + HBatchNo+"'", "h_p_QC_PerformanceScrapLedger"); //添加列名 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 #region 质量模块 送测登记数据台账 /// /// 返回直通率报表列表 ///参数:string sql。 ///返回值:object。 /// [Route("QC_CustomerAppealReport/QC_RegistrationForTestingReport")] [HttpGet] public object QC_RegistrationForTestingReport(string sWhere, string user) { try { List columnNameList = new List(); if (sWhere == null || sWhere == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查询条件!"; objJsonResult.data = null; return objJsonResult; } Dictionary dic = Newtonsoft.Json.JsonConvert.DeserializeObject>(sWhere); string HBeginDate = dic["HBeginDate"].ToString(); string HEndDate = dic["HEndDate"].ToString(); string HBatchNo = dic["HBatchNo"].ToString(); int HMaterID = int.Parse(dic["HMaterID"].ToString()); ds = oCN.RunProcReturn("exec h_p_QC_RegistrationForTestingReport '" + HBeginDate + "','" + HEndDate + "','" + HMaterID + "','" + HBatchNo + "'", "h_p_QC_RegistrationForTestingReport"); //添加列名 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 #region 质量模块 制程绩效趋势图(一次合格率) 查询 [Route("QC_CustomerAppealReport/getQC_ProcessPerformanceFirstPass")] [HttpGet] public object getQC_ProcessPerformanceFirstPass(string sWhere, string user) { try { List columnNameList = new List(); if (sWhere == null || sWhere.Equals("")) { ds = oCN.RunProcReturn("select * from h_v_QC_ProcessPerformanceFirstPassList order by 月份 desc", "h_v_QC_ProcessPerformanceFirstPassList"); } else { string sql1 = "select * from h_v_QC_ProcessPerformanceFirstPassList where 1 = 1 "; string sql = sql1 + sWhere + " order by 月份 "; ds = oCN.RunProcReturn(sql, "h_v_QC_ProcessPerformanceFirstPassList"); } //添加列名 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 #region 质量模块 制程绩效趋势图(合格率) 查询 [Route("QC_CustomerAppealReport/getQC_ProcessPerformancePass")] [HttpGet] public object getQC_ProcessPerformancePass(string sWhere, string user) { try { List columnNameList = new List(); if (sWhere == null || sWhere.Equals("")) { ds = oCN.RunProcReturn("select * from h_v_QC_ProcessPerformancePassList order by 月份 desc", "h_v_QC_ProcessPerformancePassList"); } else { string sql1 = "select * from h_v_QC_ProcessPerformancePassList where 1 = 1 "; string sql = sql1 + sWhere + " order by 月份 "; ds = oCN.RunProcReturn(sql, "h_v_QC_ProcessPerformancePassList"); } //添加列名 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 } }