| | |
| | | //è·åç³»ç»åæ° |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | |
| | | |
| | | |
| | | #region 设å¤åå¸ è®¾å¤ç»å®ççäº§èµæºä¸æ£å¨ç产çå·¥å |
| | | |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 设å¤è¿è¡åçï¼è·åé¨é¨-è®¾å¤ æ ç¶å¾ |
| | | private class HEquipTreeList_DAQ_Node |
| | | { |
| | | public int id { get; set; } |
| | | public string title { get; set; } |
| | | public List<HEquipTreeList_DAQ_Node> children { get; set; } |
| | | } |
| | | |
| | | |
| | | [Route("DAQ_EquipRunningSlice/GetHEquipTreeList_DAQ")] |
| | | [HttpGet] |
| | | public object Sc_HEquipStateDistribution_Souce(string sWhere) |
| | | { |
| | | try |
| | | { |
| | | List<HEquipTreeList_DAQ_Node> treeArr = new List<HEquipTreeList_DAQ_Node>(); |
| | | // è®°å½é¨é¨æ¯å¦å·²ç»å å
¥treeArr(ä¸å¯éå¤å å
¥) |
| | | HashSet<String> HDeptSet = new HashSet<String>(); |
| | | |
| | | ds = oCN.RunProcReturn($@"select hmainid HEquipID, 设å¤åç§° HEquipName, HDeptID HDeptID, 使ç¨é¨é¨ HDeptName from h_v_Gy_EquipFileMainList |
| | | {sWhere} |
| | | order by HEquipName asc", "h_v_Gy_EquipFileMainList"); |
| | | |
| | | foreach(DataRow row in ds.Tables[0].Rows) |
| | | { |
| | | int HDeptID = int.Parse(row["HDeptID"].ToString()); |
| | | string HDeptName = row["HDeptName"] as string; |
| | | int HEquipID = int.Parse(row["HEquipID"].ToString()); |
| | | string HEquipName = row["HEquipName"] as string; |
| | | |
| | | if (!HDeptSet.Contains(row["HDeptID"].ToString())) |
| | | { |
| | | // 没æé¨é¨å¯¹åºçä¸çº§èç¹ï¼åæ·»å ä¸çº§èç¹ |
| | | treeArr.Add(new HEquipTreeList_DAQ_Node |
| | | { |
| | | id = int.Parse(row["HDeptID"].ToString()), |
| | | title = row["HDeptName"].ToString(), |
| | | children = new List<HEquipTreeList_DAQ_Node>() |
| | | }); |
| | | |
| | | // é¨é¨IDæ·»å å°Setï¼ç¡®ä¿å¯ä¸æ§ |
| | | HDeptSet.Add(row["HDeptID"].ToString()); |
| | | } |
| | | |
| | | // é¨é¨å¯¹å°çä¸çº§èç¹å·²ç»è®¾ç½®å¥½ï¼è®¾ç½®äºçº§èç¹ |
| | | HEquipTreeList_DAQ_Node Node = treeArr.First(item => item.id == HDeptID); |
| | | Node.children.Add(new HEquipTreeList_DAQ_Node |
| | | { |
| | | id = HEquipID, |
| | | title = HEquipName, |
| | | children = new List<HEquipTreeList_DAQ_Node>() |
| | | }); |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "æ¥è¯¢æå"; |
| | | objJsonResult.data = JArray.FromObject(treeArr); |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.Message.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 设å¤è¿è¡åç è¿å设å¤ç¶æ å¾è¡¨æ°æ® |
| | | [Route("DAQ_EquipRunningSlice/GetHEquipStatusReportList_DAQ")] |
| | | [HttpGet] |
| | | public object GetHEquipStatusReportList_DAQ(string HEquipID, string HDeptID, string HBeginDate, string HEndDate, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | string sql = "select * from h_v_Sb_EquipRunningStatusReport where 1 = 1"; |
| | | if(!string.IsNullOrWhiteSpace(HEquipID) && HEquipID != "0") |
| | | { |
| | | sql += $" and HEquipID = {HEquipID}"; |
| | | } |
| | | if(!string.IsNullOrWhiteSpace(HDeptID) && HDeptID != "0") |
| | | { |
| | | sql += $" and HDeptID = {HDeptID}"; |
| | | } |
| | | if(!string.IsNullOrWhiteSpace(HBeginDate) && !string.IsNullOrWhiteSpace(HEndDate)) |
| | | { |
| | | sql += $"and (æå±æ¥æ between CONVERT(DATETIME, '{HBeginDate} 00:00:00', 120) AND CONVERT(DATETIME, '{HEndDate} 23:59:59', 120))"; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipRunningStatusReport"); |
| | | |
| | | //æ·»å åå |
| | | 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 ex) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¥è¯¢æ°æ®å¼å¸¸ï¼è¯·ä¸ç®¡çåèç³»ï¼" + ex.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |