| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 设å¤äº§é è·å设å¤éé产éæå¤§ |
| | | |
| | | [Route("Sc_HEquipStateDistribution/Get_EquipOutputHQty")] |
| | | [HttpGet] |
| | | public object Get_EquipOutputHQty(string sWhere, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | string sql = @"SELECT b.HItemID HSourceID,c.HInterID HEquipID, a.HSourceCode 设å¤åç§°,SUM(CASE WHEN HTechParamName = '产é' THEN TRY_CAST(HResult AS DECIMAL(18,2)) ELSE 0 END) AS 产é, |
| | | MAX(CASE WHEN HTechParamName = 'è¿è¡æ¶é¿' THEN TRY_CAST(HResult AS DECIMAL(18, 2)) ELSE NULL END) AS è¿è¡æ¶é¿ |
| | | FROM Sb_EquipMentCollectionTechParam_Temp a with(nolock) |
| | | left join Gy_Source b on a.HSourceCode=b.HMacAddr |
| | | left join Gy_EquipFileBillMain c on b.HItemID=c.HSourceID |
| | | WHERE HTechParamName IN('产é', 'è¿è¡æ¶é¿') " + sWhere+ " GROUP BY a.HSourceCode,b.HItemID,c.HInterID"; |
| | | |
| | | ds = oCN.RunProcReturn(sql, "Sb_EquipMentCollectionTechParam_Temp"); |
| | | |
| | | //æ·»å åå |
| | | 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("Sc_HEquipStateDistribution/Get_EquipOutputHQty_Detail")] |
| | | [HttpGet] |
| | | public object Get_EquipOutputHQty_Detail(int HEquipID, string HDate) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | ds = oCN.RunProcReturn("exec h_p_Sb_EquipMentCollectionTechParam_TempHQty_Deltail '" + HEquipID + "','" + HDate + "'", "h_p_Sb_EquipMentCollectionTechParam_TempHQty_Deltail"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å½åè®¾å¤æ¥æ 详æ
æ°æ®!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | // éåææè¡¨ |
| | | foreach (DataTable table in ds.Tables) |
| | | { |
| | | List<object> tableColumnList = new List<object>(); |
| | | |
| | | // æ·»å åå |
| | | foreach (DataColumn col in table.Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | tableColumnList.Add(JsonConvert.DeserializeObject(ColmString)); |
| | | } |
| | | |
| | | // å°æ¯ä¸ªè¡¨çååå表添å å°æ»ååå表 |
| | | columnNameList.Add(new { TableName = table.TableName, Columns = tableColumnList }); |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = ds; |
| | | 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 |
| | | |
| | | } |
| | | } |