系统运行报表接口
This commit is contained in:
parent
7de38274ad
commit
82ce41eac6
@ -8,6 +8,7 @@ using APT.BaseData.Domain.IServices;
|
||||
using APT.BaseData.Domain.IServices.FM;
|
||||
using APT.BaseData.Services.DomainServices;
|
||||
using APT.BaseData.Services.Services.FM;
|
||||
using APT.Infrastructure.Api;
|
||||
using APT.Infrastructure.Api.Redis;
|
||||
using APT.Infrastructure.Core;
|
||||
using APT.MS.Domain.Entities.BI;
|
||||
@ -32,6 +33,7 @@ using InfluxData.Net.Kapacitor.Models;
|
||||
using log4net.Filter;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using MySqlX.XDevAPI.Common;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Renci.SshNet.Common;
|
||||
@ -46,6 +48,7 @@ using System.Linq.Expressions;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
using static APT.SC.WebApi.Controllers.Api.BI.BIKanBanController;
|
||||
|
||||
namespace APT.SC.WebApi.Controllers.Api.BIController
|
||||
{
|
||||
@ -139,6 +142,37 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
||||
public string departmentName { get; set; }
|
||||
public int num { get; set; }
|
||||
public List<DepartmentInfo> deptInfos { get; set; }
|
||||
}
|
||||
public class TaskViewInfo
|
||||
{
|
||||
public string MOULD_NAME { get; set; }
|
||||
public string FORM_NAME { get; set; }
|
||||
|
||||
public string COMPANY_NAME { get; set; }
|
||||
public int TOTAL_QTY { get; set; }
|
||||
public int NORMAL_FINISH { get; set; }
|
||||
public int OVER_FINISH { get; set; }
|
||||
public int DOING { get; set; }
|
||||
public int UNFINISH { get; set; }
|
||||
public int OVER_UNFINISH { get; set; }
|
||||
public string FINISH_RATE { get; set; }
|
||||
public string NORMAL_RATE { get; set; }
|
||||
public List<TaskViewInfoDetail> details { get; set; }
|
||||
}
|
||||
public class TaskViewInfoDetail
|
||||
{
|
||||
public string MOULD_NAME { get; set; }
|
||||
public string FORM_NAME { get; set; }
|
||||
|
||||
public string COMPANY_NAME { get; set; }
|
||||
public string NOTICE_TITLE { get; set; }
|
||||
public DateTime? TASK_STARTDT { get; set; }
|
||||
|
||||
public DateTime? TASK_ENDDT { get; set; }
|
||||
|
||||
public DateTime? TASK_DT { get; set; }
|
||||
public string NOTICE_STATUS { get; set; }
|
||||
public string USER_NAME { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
@ -11140,6 +11174,80 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
||||
/// 存储信息
|
||||
/// </summary>
|
||||
public List<T_FM_WORK_TICKET_COMPLETION> result { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 系统运行情况报表
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("GetTaskViewInfo")]
|
||||
public JsonActionResult<List<TaskViewInfo>> GetTaskViewInfo([FromBody] KeywordFilter filter)
|
||||
{
|
||||
string connhead = ConfigurationManager.ConnectionStrings["head"];
|
||||
JsonActionResult<List<TaskViewInfo>> result = new JsonActionResult<List<TaskViewInfo>>();
|
||||
result.Data = new List<TaskViewInfo>();
|
||||
DataTable Table = new DataTable();
|
||||
using (SqlConnection connection = new SqlConnection(connhead))
|
||||
{
|
||||
try
|
||||
{
|
||||
connection.Open();
|
||||
//各公司待办明细
|
||||
string sql = "select * from vhome_task_data_form ";
|
||||
SqlCommand com = new SqlCommand(sql, connection);
|
||||
SqlDataAdapter Data = new SqlDataAdapter(com);
|
||||
Data.Fill(Table);
|
||||
connection.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(ex.StackTrace))
|
||||
throw new Exception("错误日志:[StackTrace]" + ex.StackTrace);
|
||||
else
|
||||
throw new Exception("【" + HttpContext.Request.Path + "】错误日志:[Message]" + ex.Message);
|
||||
}
|
||||
if (Table != null && Table.Rows.Count > 0)
|
||||
{
|
||||
List<TaskViewInfoDetail> listAddNew = new List<TaskViewInfoDetail>();
|
||||
|
||||
foreach (DataRow item in Table.Rows)
|
||||
{
|
||||
listAddNew.Add(new TaskViewInfoDetail()
|
||||
{
|
||||
COMPANY_NAME = item["db_name"] != null ? item["db_name"].ToString() : null,
|
||||
MOULD_NAME = item["MODEL_NAME"] != null ? item["MODEL_NAME"].ToString() : null,
|
||||
FORM_NAME = item["FORM_NAME"] != null ? item["FORM_NAME"].ToString() : null,
|
||||
NOTICE_TITLE = item["NOTICE_TITLE"] != null ? item["NOTICE_TITLE"].ToString() : null,
|
||||
NOTICE_STATUS = item["NOTICE_STATUS"] != null ? item["NOTICE_STATUS"].ToString() : null,
|
||||
TASK_DT = item["TASK_DT"] != null ? Convert.ToDateTime(item["TASK_DT"].ToString()) : null,
|
||||
TASK_STARTDT = item["TASK_STARTDT"] != null ? Convert.ToDateTime(item["TASK_STARTDT"].ToString()) : null,
|
||||
TASK_ENDDT = item["TASK_ENDDT"] != null ? Convert.ToDateTime(item["TASK_ENDDT"].ToString()) : null,
|
||||
USER_NAME = item["USER_NAME"] != null ? item["USER_NAME"].ToString() : null
|
||||
});
|
||||
}
|
||||
var taskGroup = listAddNew.GroupBy(t => new { t.COMPANY_NAME, t.MOULD_NAME, t.FORM_NAME }).ToList();
|
||||
if (taskGroup != null && taskGroup.Any())
|
||||
{
|
||||
foreach (var item in taskGroup)
|
||||
{
|
||||
TaskViewInfo info = new TaskViewInfo();
|
||||
info.COMPANY_NAME = item.Key.COMPANY_NAME;
|
||||
info.MOULD_NAME = item.Key.MOULD_NAME;
|
||||
info.FORM_NAME = item.Key.FORM_NAME;
|
||||
info.TOTAL_QTY = listAddNew.Count(t => t.COMPANY_NAME == item.Key.COMPANY_NAME && t.MOULD_NAME == item.Key.MOULD_NAME && t.FORM_NAME == item.Key.FORM_NAME);
|
||||
info.NORMAL_FINISH = listAddNew.Count(t => t.COMPANY_NAME == item.Key.COMPANY_NAME && t.MOULD_NAME == item.Key.MOULD_NAME && t.FORM_NAME == item.Key.FORM_NAME && t.NOTICE_STATUS == "1");
|
||||
info.OVER_FINISH = listAddNew.Count(t => t.COMPANY_NAME == item.Key.COMPANY_NAME && t.MOULD_NAME == item.Key.MOULD_NAME && t.FORM_NAME == item.Key.FORM_NAME && t.NOTICE_STATUS == "2");
|
||||
info.DOING = listAddNew.Count(t => t.COMPANY_NAME == item.Key.COMPANY_NAME && t.MOULD_NAME == item.Key.MOULD_NAME && t.FORM_NAME == item.Key.FORM_NAME && t.NOTICE_STATUS == "0" && t.TASK_ENDDT >=DateTime.Now);
|
||||
info.UNFINISH = listAddNew.Count(t => t.COMPANY_NAME == item.Key.COMPANY_NAME && t.MOULD_NAME == item.Key.MOULD_NAME && t.FORM_NAME == item.Key.FORM_NAME && t.NOTICE_STATUS == "0");
|
||||
info.OVER_UNFINISH = listAddNew.Count(t => t.COMPANY_NAME == item.Key.COMPANY_NAME && t.MOULD_NAME == item.Key.MOULD_NAME && t.FORM_NAME == item.Key.FORM_NAME && t.NOTICE_STATUS == "0" && t.TASK_ENDDT < DateTime.Now);
|
||||
info.FINISH_RATE = info.TOTAL_QTY == 0 ? "0" : ((info.NORMAL_FINISH + info.OVER_FINISH) / info.TOTAL_QTY * 100).ToString();
|
||||
info.NORMAL_RATE = info.TOTAL_QTY == 0 ? "0" : (info.NORMAL_FINISH / info.TOTAL_QTY * 100).ToString();
|
||||
result.Data.Add(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user