yusijie
2026-04-10 31223f50a23b2c3316da73057cf991c312e808bb
WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs
@@ -1389,6 +1389,64 @@
        }
        #endregion
        #region 设备运行报表 时序图
        [Route("SB_EquipRunningStatus/ReportByID")]
        [HttpGet]
        public object ReportByID(string HEquipID, string user, string sWhere)
        {
            try
            {
               List<object> columnNameList = new List<object>();
                string sql = $"select * from h_v_Gy_EquipmentCockpit_Gantt where HEquipID = {HEquipID} ";
                if(!string.IsNullOrWhiteSpace(sWhere))
                {
                    sql += sWhere;
                }
                sql += "order by StartTime desc";
                ds = oCN.RunProcReturn(sql, "h_v_Gy_EquipmentCockpit_Gantt");
                //添加列名
                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;
                //if (ds.Tables[0].Rows.Count != 0 && ds != null)
                //{
                //}
                //else
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "无数据";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 设备运行状态报表
        [Route("SB_EquipRunningStatus/Report")]