| using DBUtility; | 
| using Newtonsoft.Json; | 
| using Newtonsoft.Json.Linq; | 
| using System; | 
| using System.Collections.Generic; | 
| using System.Data; | 
| using System.Linq; | 
| using System.Net; | 
| using System.Net.Http; | 
| using System.Web.Http; | 
| using WebAPI.Models; | 
|   | 
| namespace WebAPI.Controllers.CJGL | 
| { | 
|     public class Mes_OrderProcFlowAllReportController : ApiController | 
|     { | 
|         public DBUtility.ClsPub.Enum_BillStatus BillStatus; | 
|         private json objJsonResult = new json(); | 
|         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|         DataSet ds; | 
|   | 
|         #region 车间工序全程跟踪报表 查询 | 
|         [Route("Mes_OrderProcFlowAllReport/OrderProcFlowAllReportList")] | 
|         [HttpGet] | 
|         public object OrderProcFlowAllReportList(string sWhere) | 
|         { | 
|             try | 
|             { | 
|                 //反序列化传递的值 | 
|   | 
|                 ds = oCN.RunProcReturn($"exec h_p_Mes_OrderProcFlowAllReport " +sWhere+"", "h_p_Mes_OrderProcFlowAllReport"); | 
|   | 
|                 List<object> listCol = new List<object>(); | 
|                 foreach (DataColumn col in ds.Tables[0].Columns) | 
|                 { | 
|                     Type dataType = col.DataType; | 
|                     string str = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
|                     listCol.Add(JsonConvert.DeserializeObject(str)); | 
|                 } | 
|   | 
|                 objJsonResult.code = "1"; | 
|                 objJsonResult.count = 1; | 
|                 objJsonResult.Message = "Sucess!"; | 
|                 objJsonResult.data = ds.Tables[0]; | 
|                 objJsonResult.list = listCol; | 
|                 return objJsonResult; | 
|             } | 
|             catch (Exception e) | 
|             { | 
|                 objJsonResult.code = "0"; | 
|                 objJsonResult.count = 0; | 
|                 objJsonResult.Message = "Exception!" + e.ToString(); | 
|                 objJsonResult.data = null; | 
|                 return objJsonResult; | 
|             } | 
|         } | 
|         #endregion | 
|   | 
|         #region 工序在制品报表(纵向) 查询 | 
|         [Route("Mes_OrderProcFlowAllReport/WIPProcReportList")] | 
|         [HttpGet] | 
|         public object WIPProcReportList(string sWhere) | 
|         { | 
|             try | 
|             { | 
|                 //反序列化传递的值 | 
|   | 
|                 ds = oCN.RunProcReturn($"exec h_p_MES_WIPProcReport_New " + sWhere + "", "h_p_MES_WIPProcReport_New"); | 
|   | 
|                 List<object> listCol = new List<object>(); | 
|                 foreach (DataColumn col in ds.Tables[0].Columns) | 
|                 { | 
|                     Type dataType = col.DataType; | 
|                     string str = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
|                     listCol.Add(JsonConvert.DeserializeObject(str)); | 
|                 } | 
|   | 
|                 objJsonResult.code = "1"; | 
|                 objJsonResult.count = 1; | 
|                 objJsonResult.Message = "Sucess!"; | 
|                 objJsonResult.data = ds.Tables[0]; | 
|                 objJsonResult.list = listCol; | 
|                 return objJsonResult; | 
|             } | 
|             catch (Exception e) | 
|             { | 
|                 objJsonResult.code = "0"; | 
|                 objJsonResult.count = 0; | 
|                 objJsonResult.Message = "Exception!" + e.ToString(); | 
|                 objJsonResult.data = null; | 
|                 return objJsonResult; | 
|             } | 
|         } | 
|         #endregion | 
|   | 
|         #region 不良明细良率报表 查询 | 
|         [Route("Mes_OrderProcFlowAllReport/DefectiveDetailedYieldReportList")] | 
|         [HttpGet] | 
|         public object DefectiveDetailedYieldReportList(string sWhere) | 
|         { | 
|             try | 
|             { | 
|                 //反序列化传递的值 | 
|   | 
|                 ds = oCN.RunProcReturn("select * from h_v_DefectiveDetailedYieldReport where 1=1 "+sWhere+" order by HProcID", "h_v_DefectiveDetailedYieldReport"); | 
|   | 
|                 List<object> listCol = new List<object>(); | 
|                 foreach (DataColumn col in ds.Tables[0].Columns) | 
|                 { | 
|                     Type dataType = col.DataType; | 
|                     string str = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
|                     listCol.Add(JsonConvert.DeserializeObject(str)); | 
|                 } | 
|   | 
|                 objJsonResult.code = "1"; | 
|                 objJsonResult.count = 1; | 
|                 objJsonResult.Message = "Sucess!"; | 
|                 objJsonResult.data = ds.Tables[0]; | 
|                 objJsonResult.list = listCol; | 
|                 return objJsonResult; | 
|             } | 
|             catch (Exception e) | 
|             { | 
|                 objJsonResult.code = "0"; | 
|                 objJsonResult.count = 0; | 
|                 objJsonResult.Message = "Exception!" + e.ToString(); | 
|                 objJsonResult.data = null; | 
|                 return objJsonResult; | 
|             } | 
|         } | 
|         #endregion | 
|   | 
|         #region 不良明细良率报表 查询 | 
|         [Route("Mes_OrderProcFlowAllReport/StationOutSumReportList")] | 
|         [HttpGet] | 
|         public object StationOutSumReportList(string sWhere) | 
|         { | 
|             try | 
|             { | 
|                 //反序列化传递的值 | 
|   | 
|                 ds = oCN.RunProcReturn("exec h_p_Sc_StationOutSumReport_New " + sWhere + "", "h_p_Sc_StationOutSumReport_New"); | 
|   | 
|                 List<object> listCol = new List<object>(); | 
|                 foreach (DataColumn col in ds.Tables[0].Columns) | 
|                 { | 
|                     Type dataType = col.DataType; | 
|                     string str = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
|                     listCol.Add(JsonConvert.DeserializeObject(str)); | 
|                 } | 
|   | 
|                 objJsonResult.code = "1"; | 
|                 objJsonResult.count = 1; | 
|                 objJsonResult.Message = "Sucess!"; | 
|                 objJsonResult.data = ds.Tables[0]; | 
|                 objJsonResult.list = listCol; | 
|                 return objJsonResult; | 
|             } | 
|             catch (Exception e) | 
|             { | 
|                 objJsonResult.code = "0"; | 
|                 objJsonResult.count = 0; | 
|                 objJsonResult.Message = "Exception!" + e.ToString(); | 
|                 objJsonResult.data = null; | 
|                 return objJsonResult; | 
|             } | 
|         } | 
|         #endregion | 
|     } | 
| } |