| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 设å¤è¿è¡åç è¿å设å¤ç¶æ å¾è¡¨æ°æ® |
| | | #region 设å¤è¿è¡åç è¿å设å¤ç¶æ å¾è¡¨æ°æ® (饼å¾) |
| | | [Route("DAQ_EquipRunningSlice/GetHEquipStatusReportList_DAQ")] |
| | | [HttpGet] |
| | | public object GetHEquipStatusReportList_DAQ(string HEquipID, string HDeptID, string HBeginDate, string HEndDate, string user) |
| | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 设å¤è¿è¡åç è¿å设å¤ç¶æ å¾è¡¨æ°æ® (æ¶åºå¾) |
| | | [Route("DAQ_EquipRunningSlice/GetHEquipStatusReportList2_DAQ")] |
| | | [HttpGet] |
| | | public object GetHEquipStatusReportList2_DAQ(string HEquipID, string HDeptID, string HBeginDate, string HEndDate, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | ds = oCN.RunProcReturn($@"exec h_p_DAQ_EquipTimeLineReport {HEquipID}, {HDeptID}, N'{HBeginDate}', N'{HEndDate}'", "h_p_DAQ_EquipTimeLineReport"); |
| | | |
| | | |
| | | // åå§åç»æ JObject |
| | | JObject result = new JObject(); |
| | | // ææ¶é´å¯¹è¡¨æ¥è¯¢åºæ¥çæ°æ®è¿è¡åç» |
| | | DataTable table = ds.Tables[0]; |
| | | var groupedData = table.Rows.Cast<DataRow>() |
| | | .GroupBy(row => |
| | | { |
| | | // ååºæ¶é´åæ®µå¹¶è½¬ä¸ºæ¥æï¼èªå¨å¿½ç¥æ¶åç§ï¼ |
| | | DateTime time = Convert.ToDateTime(row["æ¶é´"]); |
| | | return time.ToString("yyyy-MM-dd"); // åç» Key |
| | | }); |
| | | |
| | | foreach (var group in groupedData) |
| | | { |
| | | string dateKey = group.Key; |
| | | JArray dataArray = new JArray(); |
| | | |
| | | foreach (DataRow row in group) |
| | | { |
| | | JObject rowObj = new JObject(); |
| | | |
| | | // æè¿ä¸è¡çææåé½è½¬æ EChartså¯ä»¥è¯»åçdata对象 |
| | | foreach (DataColumn col in table.Columns) |
| | | { |
| | | |
| | | rowObj[col.ColumnName] = row[col] != DBNull.Value |
| | | ? JToken.FromObject(row[col]) |
| | | : null; |
| | | } |
| | | |
| | | dataArray.Add(rowObj); |
| | | } |
| | | |
| | | // å å
¥æç»ç»æ |
| | | result[dateKey] = dataArray; |
| | | } |
| | | |
| | | //æ·»å åå |
| | | 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 = result; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¥è¯¢æ°æ®å¼å¸¸ï¼è¯·ä¸ç®¡çåèç³»ï¼" + ex.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 设å¤é©¾é©¶è± æ ¹æ®é¨é¨æ¥è¯¢å¯¹åºçè®¾å¤ |
| | | |
| | | [Route("Sc_HEquipStateDistribution/Get_HEquipStateList")] |
| | | [HttpGet] |
| | | public object Get_HEquipStateList(string HDeptID, string user, int OrganizationID) |
| | | { |
| | | try |
| | | { |
| | | string sql1 = string.Format("exec h_p_sc_HDeptEquipList {0},{1}", HDeptID, OrganizationID); |
| | | |
| | | ds = oCN.RunProcReturn(sql1, "h_p_sc_HDeptEquipList"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = ds; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |