1
This commit is contained in:
parent
560304c716
commit
0ed4841adc
@ -143,58 +143,59 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
{
|
{
|
||||||
string connhead = ConfigurationManager.ConnectionStrings["head"];
|
string connhead = ConfigurationManager.ConnectionStrings["head"];
|
||||||
ReturnAll result = new ReturnAll();
|
ReturnAll result = new ReturnAll();
|
||||||
//风险等级占比
|
DataTable tableRisk = new DataTable();
|
||||||
result.riskTypeRate = RiskTypeRateData(connhead);
|
DataTable tableJob = new DataTable();
|
||||||
//当日工作票排名前三
|
DataTable tableJobGroup = new DataTable();
|
||||||
result.jobTodayTop3 = JobTodayTopData(connhead,filter.OrgId.Value);
|
DataTable tableHidden = new DataTable();
|
||||||
//隐患整改率
|
DataTable tableTask = new DataTable();
|
||||||
result.hiddenRectify = HiddenRectifyData(connhead);
|
DataTable tableJobRate = new DataTable();
|
||||||
//各事项排名前三
|
DataTable tableSafeCheck = new DataTable();
|
||||||
result.taskTop3 = TaskTopData(connhead);
|
|
||||||
//作业现场完成情况统计
|
|
||||||
result.jobFinishRate = jobFinishRateData(connhead);
|
|
||||||
//各公司安全检查统计
|
|
||||||
result.safeCheckSum = safeCheckSumData(connhead);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 风险等级占比
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="filter">分页过滤实体</param>
|
|
||||||
public List<RiskTypeRate> RiskTypeRateData(string connhead)
|
|
||||||
{
|
|
||||||
List<RiskTypeRate> result = new List<RiskTypeRate>();
|
|
||||||
DataTable Table = new DataTable();
|
|
||||||
using (SqlConnection connection = new SqlConnection(connhead))
|
using (SqlConnection connection = new SqlConnection(connhead))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
connection.Open();
|
connection.Open();
|
||||||
string sql = "select * from vhome_risk_type_data ";
|
//风险等级占比
|
||||||
//if (dt != DateTime.Now.Date)
|
string sqlRisk = "select * from vhome_risk_type_data ";
|
||||||
//{
|
SqlCommand comRisk = new SqlCommand(sqlRisk, connection);
|
||||||
// sql += " and crdate>='" + dt + "'";
|
SqlDataAdapter riskData = new SqlDataAdapter(comRisk);
|
||||||
//}
|
riskData.Fill(tableRisk);
|
||||||
//sql += " order by crdate desc";
|
result.riskTypeRate = RiskTypeRateData(connhead, tableRisk);
|
||||||
using (SqlCommand Com = new SqlCommand(sql, connection))
|
//当日工作票排名前三
|
||||||
{
|
string sqlJob = "select * from vhome_jobtop3_today ";
|
||||||
SqlDataAdapter Data = new SqlDataAdapter(Com);
|
SqlCommand comJob = new SqlCommand(sqlJob, connection);
|
||||||
Data.Fill(Table);
|
SqlDataAdapter jobData = new SqlDataAdapter(comJob);
|
||||||
}
|
jobData.Fill(tableJob);
|
||||||
|
string sqlJobGroup = "select* from vhome_jobdata_today_group";
|
||||||
|
SqlCommand comJobGroup = new SqlCommand(sqlJobGroup, connection);
|
||||||
|
SqlDataAdapter jobGroupData = new SqlDataAdapter(comJobGroup);
|
||||||
|
jobGroupData.Fill(tableJobGroup);
|
||||||
|
result.jobTodayTop3 = JobTodayTopData(connhead, filter.OrgId.Value, tableJob,tableJobGroup);
|
||||||
|
//隐患整改率
|
||||||
|
string sqlHidden = "select * from vhome_hidden_data_result ";
|
||||||
|
SqlCommand comHidden = new SqlCommand(sqlHidden, connection);
|
||||||
|
SqlDataAdapter hiddenData = new SqlDataAdapter(comHidden);
|
||||||
|
hiddenData.Fill(tableHidden);
|
||||||
|
result.hiddenRectify = HiddenRectifyData(connhead, tableHidden);
|
||||||
|
//各事项排名前三
|
||||||
|
string sqlTask = "select * from vhome_task_data_result ";
|
||||||
|
SqlCommand comTask = new SqlCommand(sqlTask, connection);
|
||||||
|
SqlDataAdapter taskData = new SqlDataAdapter(comTask);
|
||||||
|
taskData.Fill(tableTask);
|
||||||
|
result.taskTop3 = TaskTopData(connhead, tableTask);
|
||||||
|
//作业现场完成情况统计
|
||||||
|
string sqlJobRate = "select * from vhome_jobrecord_data ";
|
||||||
|
SqlCommand comJobRate = new SqlCommand(sqlJobRate, connection);
|
||||||
|
SqlDataAdapter jobRateData = new SqlDataAdapter(comJobRate);
|
||||||
|
jobRateData.Fill(tableJobRate);
|
||||||
|
result.jobFinishRate = jobFinishRateData(connhead, tableJobRate);
|
||||||
|
//各公司安全检查统计
|
||||||
|
string sqlSafecCheck= "select * from vhome_check_total ";
|
||||||
|
SqlCommand comSafecCheck = new SqlCommand(sqlSafecCheck, connection);
|
||||||
|
SqlDataAdapter safecCheckData = new SqlDataAdapter(comSafecCheck);
|
||||||
|
safecCheckData.Fill(tableSafeCheck);
|
||||||
|
result.safeCheckSum = safeCheckSumData(connhead, tableSafeCheck);
|
||||||
connection.Close();
|
connection.Close();
|
||||||
if (Table != null && Table.Rows.Count > 0)
|
|
||||||
{
|
|
||||||
foreach (DataRow item in Table.Rows)
|
|
||||||
{
|
|
||||||
result.Add(new RiskTypeRate()
|
|
||||||
{
|
|
||||||
riskType = item["风险类别"] != null ? item["风险类别"].ToString() : null,
|
|
||||||
count = int.Parse(item["数量"].ToString()) != 0 ? int.Parse(item["数量"].ToString()) : 0,
|
|
||||||
rate = item["占比"] != null ? item["占比"].ToString() : "0"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -206,96 +207,78 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 风险等级占比
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filter">分页过滤实体</param>
|
||||||
|
public List<RiskTypeRate> RiskTypeRateData(string connhead, DataTable Table)
|
||||||
|
{
|
||||||
|
List<RiskTypeRate> result = new List<RiskTypeRate>();
|
||||||
|
if (Table != null && Table.Rows.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (DataRow item in Table.Rows)
|
||||||
|
{
|
||||||
|
result.Add(new RiskTypeRate()
|
||||||
|
{
|
||||||
|
riskType = item["风险类别"] != null ? item["风险类别"].ToString() : null,
|
||||||
|
count = int.Parse(item["数量"].ToString()) != 0 ? int.Parse(item["数量"].ToString()) : 0,
|
||||||
|
rate = item["占比"] != null ? item["占比"].ToString() : "0"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当日工作票排名前三
|
/// 当日工作票排名前三
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filter">参数</param>
|
/// <param name="filter">参数</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<JobTodayTop3> JobTodayTopData(string connhead,Guid orgId)
|
public List<JobTodayTop3> JobTodayTopData(string connhead,Guid orgId, DataTable Table, DataTable Table2)
|
||||||
{
|
{
|
||||||
List<JobTodayTop3> result = new List<JobTodayTop3>();
|
List<JobTodayTop3> result = new List<JobTodayTop3>();
|
||||||
var details = new List<JobTodayDetail>();
|
var details = new List<JobTodayDetail>();
|
||||||
DataTable Table = new DataTable();
|
if (Table != null && Table.Rows.Count > 0)
|
||||||
DataTable Table2 = new DataTable();
|
|
||||||
using (SqlConnection connection = new SqlConnection(connhead))
|
|
||||||
{
|
{
|
||||||
try
|
foreach (DataRow item in Table.Rows)
|
||||||
{
|
{
|
||||||
connection.Open();
|
var JobTodayTop3 = new JobTodayTop3();
|
||||||
string sql = "select * from vhome_jobtop3_today ";
|
JobTodayTop3.totalQty = int.Parse(item["今日总数"].ToString()) != 0 ? int.Parse(item["今日总数"].ToString()) : 0;
|
||||||
//if (dt != DateTime.Now.Date)
|
JobTodayTop3.num = int.Parse(item["排名"].ToString()) != 0 ? int.Parse(item["排名"].ToString()) : 0;
|
||||||
//{
|
JobTodayTop3.company = item["公司名称"] != null ? item["公司名称"].ToString() : "";
|
||||||
// sql += " and crdate>='" + dt + "'";
|
result.Add(JobTodayTop3);
|
||||||
//}
|
}
|
||||||
//sql += " order by crdate desc";
|
}
|
||||||
using (SqlCommand Com = new SqlCommand(sql, connection))
|
if (Table2 != null && Table2.Rows.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (DataRow item2 in Table2.Rows)
|
||||||
|
{
|
||||||
|
var JobTodayDetail = new JobTodayDetail();
|
||||||
|
JobTodayDetail.qty = int.Parse(item2["cnt"].ToString()) != 0 ? int.Parse(item2["cnt"].ToString()) : 0;
|
||||||
|
JobTodayDetail.jobName = item2["stepid"] != null ? item2["stepid"].ToString() : null;
|
||||||
|
JobTodayDetail.company = item2["db_name"] != null ? item2["db_name"].ToString() : null;
|
||||||
|
details.Add(JobTodayDetail);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (result != null && result.Any())
|
||||||
|
{
|
||||||
|
var steps = this.GetEntities<T_HM_OPERATION_STEP>(t => !t.IS_DELETED, new BaseFilter(orgId));
|
||||||
|
foreach (var da in result)
|
||||||
|
{
|
||||||
|
var temps = details.Where(t => t.company == da.company).ToList();
|
||||||
|
if (temps.Any())
|
||||||
{
|
{
|
||||||
SqlDataAdapter Data = new SqlDataAdapter(Com);
|
var detailTemps = new List<JobTodayDetail>();
|
||||||
Data.Fill(Table);
|
foreach (var de in temps)
|
||||||
}
|
|
||||||
string sql2 = "select * from vhome_jobdata_today_group ";
|
|
||||||
//if (dt != DateTime.Now.Date)
|
|
||||||
//{
|
|
||||||
// sql += " and crdate>='" + dt + "'";
|
|
||||||
//}
|
|
||||||
//sql += " order by crdate desc";
|
|
||||||
using (SqlCommand Com = new SqlCommand(sql2, connection))
|
|
||||||
{
|
|
||||||
SqlDataAdapter Data = new SqlDataAdapter(Com);
|
|
||||||
Data.Fill(Table2);
|
|
||||||
}
|
|
||||||
connection.Close();
|
|
||||||
if (Table != null && Table.Rows.Count > 0)
|
|
||||||
{
|
|
||||||
foreach (DataRow item in Table.Rows)
|
|
||||||
{
|
|
||||||
var JobTodayTop3 = new JobTodayTop3();
|
|
||||||
JobTodayTop3.totalQty = int.Parse(item["今日总数"].ToString()) != 0 ? int.Parse(item["今日总数"].ToString()) : 0;
|
|
||||||
JobTodayTop3.num = int.Parse(item["排名"].ToString()) != 0 ? int.Parse(item["排名"].ToString()) : 0;
|
|
||||||
JobTodayTop3.company = item["公司名称"] != null ? item["公司名称"].ToString() : "";
|
|
||||||
result.Add(JobTodayTop3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Table2 != null && Table2.Rows.Count > 0)
|
|
||||||
{
|
|
||||||
foreach (DataRow item2 in Table2.Rows)
|
|
||||||
{
|
{
|
||||||
var JobTodayDetail = new JobTodayDetail();
|
var JobTodayDetail = new JobTodayDetail();
|
||||||
JobTodayDetail.qty = int.Parse(item2["cnt"].ToString()) != 0 ? int.Parse(item2["cnt"].ToString()) : 0;
|
JobTodayDetail.qty = de.qty;
|
||||||
JobTodayDetail.jobName = item2["stepid"] != null ? item2["stepid"].ToString() : null;
|
JobTodayDetail.jobName = steps.FirstOrDefault(t => t.ID == Guid.Parse(de.jobName))?.NAME;
|
||||||
JobTodayDetail.company = item2["db_name"] != null ? item2["db_name"].ToString() : null;
|
JobTodayDetail.company = de.company;
|
||||||
details.Add(JobTodayDetail);
|
detailTemps.Add(JobTodayDetail);
|
||||||
}
|
}
|
||||||
|
da.details = detailTemps;
|
||||||
}
|
}
|
||||||
if (result != null && result.Any())
|
|
||||||
{
|
|
||||||
var steps = this.GetEntities<T_HM_OPERATION_STEP>(t => !t.IS_DELETED, new BaseFilter(orgId));
|
|
||||||
foreach (var da in result)
|
|
||||||
{
|
|
||||||
var temps = details.Where(t => t.company == da.company).ToList();
|
|
||||||
if (temps.Any())
|
|
||||||
{
|
|
||||||
var detailTemps = new List<JobTodayDetail>();
|
|
||||||
foreach (var de in temps)
|
|
||||||
{
|
|
||||||
var JobTodayDetail = new JobTodayDetail();
|
|
||||||
JobTodayDetail.qty = de.qty;
|
|
||||||
JobTodayDetail.jobName = steps.FirstOrDefault(t=>t.ID == Guid.Parse(de.jobName))?.NAME;
|
|
||||||
JobTodayDetail.company = de.company;
|
|
||||||
detailTemps.Add(JobTodayDetail);
|
|
||||||
}
|
|
||||||
da.details = detailTemps;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(ex.StackTrace))
|
|
||||||
throw new Exception("错误日志:[StackTrace]" + ex.StackTrace);
|
|
||||||
else
|
|
||||||
throw new Exception("【" + HttpContext.Request.Path + "】错误日志:[Message]" + ex.Message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -306,42 +289,15 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filter">参数</param>
|
/// <param name="filter">参数</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public HiddenRectify HiddenRectifyData(string connhead)
|
public HiddenRectify HiddenRectifyData(string connhead, DataTable Table)
|
||||||
{
|
{
|
||||||
HiddenRectify result = new HiddenRectify();
|
HiddenRectify result = new HiddenRectify();
|
||||||
DataTable Table = new DataTable();
|
if (Table != null && Table.Rows.Count > 0)
|
||||||
using (SqlConnection connection = new SqlConnection(connhead))
|
|
||||||
{
|
{
|
||||||
try
|
result.qty = int.Parse(Table.Rows[0]["隐患数"].ToString()) != 0 ? int.Parse(Table.Rows[0]["隐患数"].ToString()) : 0;
|
||||||
{
|
result.ontimeQty = int.Parse(Table.Rows[0]["按期整改数"].ToString()) != 0 ? int.Parse(Table.Rows[0]["按期整改数"].ToString()) : 0;
|
||||||
connection.Open();
|
result.delayQty = int.Parse(Table.Rows[0]["延期整改数"].ToString()) != 0 ? int.Parse(Table.Rows[0]["延期整改数"].ToString()) : 0;
|
||||||
string sql = "select * from vhome_hidden_data_result ";
|
result.rate = Table.Rows[0]["整改率"] != null ? Table.Rows[0]["整改率"].ToString() : null;
|
||||||
//if (dt != DateTime.Now.Date)
|
|
||||||
//{
|
|
||||||
// sql += " and crdate>='" + dt + "'";
|
|
||||||
//}
|
|
||||||
//sql += " order by crdate desc";
|
|
||||||
using (SqlCommand Com = new SqlCommand(sql, connection))
|
|
||||||
{
|
|
||||||
SqlDataAdapter Data = new SqlDataAdapter(Com);
|
|
||||||
Data.Fill(Table);
|
|
||||||
}
|
|
||||||
connection.Close();
|
|
||||||
if (Table != null && Table.Rows.Count > 0)
|
|
||||||
{
|
|
||||||
result.qty = int.Parse(Table.Rows[0]["隐患数"].ToString()) != 0 ? int.Parse(Table.Rows[0]["隐患数"].ToString()) : 0;
|
|
||||||
result.ontimeQty = int.Parse(Table.Rows[0]["按期整改数"].ToString()) != 0 ? int.Parse(Table.Rows[0]["按期整改数"].ToString()) : 0;
|
|
||||||
result.delayQty = int.Parse(Table.Rows[0]["延期整改数"].ToString()) != 0 ? int.Parse(Table.Rows[0]["延期整改数"].ToString()) : 0;
|
|
||||||
result.rate = Table.Rows[0]["整改率"] != null ? Table.Rows[0]["整改率"].ToString() : null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(ex.StackTrace))
|
|
||||||
throw new Exception("错误日志:[StackTrace]" + ex.StackTrace);
|
|
||||||
else
|
|
||||||
throw new Exception("【" + HttpContext.Request.Path + "】错误日志:[Message]" + ex.Message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -351,71 +307,44 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filter">参数</param>
|
/// <param name="filter">参数</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<TaskTop3> TaskTopData(string connhead)
|
public List<TaskTop3> TaskTopData(string connhead, DataTable Table)
|
||||||
{
|
{
|
||||||
List<TaskTop3> result = new List<TaskTop3>();
|
List<TaskTop3> result = new List<TaskTop3>();
|
||||||
var dataTemps = new List<TaskTopTemp>();
|
var dataTemps = new List<TaskTopTemp>();
|
||||||
DataTable Table = new DataTable();
|
if (Table != null && Table.Rows.Count > 0)
|
||||||
using (SqlConnection connection = new SqlConnection(connhead))
|
|
||||||
{
|
{
|
||||||
try
|
foreach (DataRow item in Table.Rows)
|
||||||
{
|
{
|
||||||
connection.Open();
|
var JobTodayTop3 = new TaskTopTemp();
|
||||||
string sql = "select * from vhome_task_data_result ";
|
JobTodayTop3.totalQty = int.Parse(item["待办总数"].ToString()) != 0 ? int.Parse(item["待办总数"].ToString()) : 0;
|
||||||
//if (dt != DateTime.Now.Date)
|
JobTodayTop3.qty = int.Parse(item["数量"].ToString()) != 0 ? int.Parse(item["数量"].ToString()) : 0;
|
||||||
//{
|
JobTodayTop3.company = item["公司名称"] != null ? item["公司名称"].ToString() : "";
|
||||||
// sql += " and crdate>='" + dt + "'";
|
JobTodayTop3.type = item["类型"] != null ? item["类型"].ToString() : "";
|
||||||
//}
|
dataTemps.Add(JobTodayTop3);
|
||||||
//sql += " order by crdate desc";
|
|
||||||
using (SqlCommand Com = new SqlCommand(sql, connection))
|
|
||||||
{
|
|
||||||
SqlDataAdapter Data = new SqlDataAdapter(Com);
|
|
||||||
Data.Fill(Table);
|
|
||||||
}
|
|
||||||
connection.Close();
|
|
||||||
if (Table != null && Table.Rows.Count > 0)
|
|
||||||
{
|
|
||||||
foreach (DataRow item in Table.Rows)
|
|
||||||
{
|
|
||||||
var JobTodayTop3 = new TaskTopTemp();
|
|
||||||
JobTodayTop3.totalQty = int.Parse(item["待办总数"].ToString()) != 0 ? int.Parse(item["待办总数"].ToString()) : 0;
|
|
||||||
JobTodayTop3.qty = int.Parse(item["数量"].ToString()) != 0 ? int.Parse(item["数量"].ToString()) : 0;
|
|
||||||
JobTodayTop3.company = item["公司名称"] != null ? item["公司名称"].ToString() : "";
|
|
||||||
JobTodayTop3.type = item["类型"] != null ? item["类型"].ToString() : "";
|
|
||||||
dataTemps.Add(JobTodayTop3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (dataTemps != null && dataTemps.Any())
|
|
||||||
{
|
|
||||||
var dataGroup = dataTemps.GroupBy(t => new { t.company,t.totalQty }).ToList();
|
|
||||||
foreach (var da in dataGroup)
|
|
||||||
{
|
|
||||||
var TaskTop3 = new TaskTop3();
|
|
||||||
TaskTop3.company = da.Key.company;
|
|
||||||
TaskTop3.totalQty = da.Key.totalQty;
|
|
||||||
var temps = dataTemps.Where(t => t.company == da.Key.company).ToList();
|
|
||||||
if (temps.Any())
|
|
||||||
{
|
|
||||||
var detailTemps = new List<TaskTopDetail>();
|
|
||||||
foreach (var de in temps)
|
|
||||||
{
|
|
||||||
var JobTodayDetail = new TaskTopDetail();
|
|
||||||
JobTodayDetail.qty = de.qty;
|
|
||||||
JobTodayDetail.name = de.type;
|
|
||||||
detailTemps.Add(JobTodayDetail);
|
|
||||||
}
|
|
||||||
TaskTop3.details = detailTemps;
|
|
||||||
}
|
|
||||||
result.Add(TaskTop3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
}
|
||||||
|
if (dataTemps != null && dataTemps.Any())
|
||||||
|
{
|
||||||
|
var dataGroup = dataTemps.GroupBy(t => new { t.company, t.totalQty }).ToList();
|
||||||
|
foreach (var da in dataGroup)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(ex.StackTrace))
|
var TaskTop3 = new TaskTop3();
|
||||||
throw new Exception("错误日志:[StackTrace]" + ex.StackTrace);
|
TaskTop3.company = da.Key.company;
|
||||||
else
|
TaskTop3.totalQty = da.Key.totalQty;
|
||||||
throw new Exception("【" + HttpContext.Request.Path + "】错误日志:[Message]" + ex.Message);
|
var temps = dataTemps.Where(t => t.company == da.Key.company).ToList();
|
||||||
|
if (temps.Any())
|
||||||
|
{
|
||||||
|
var detailTemps = new List<TaskTopDetail>();
|
||||||
|
foreach (var de in temps)
|
||||||
|
{
|
||||||
|
var JobTodayDetail = new TaskTopDetail();
|
||||||
|
JobTodayDetail.qty = de.qty;
|
||||||
|
JobTodayDetail.name = de.type;
|
||||||
|
detailTemps.Add(JobTodayDetail);
|
||||||
|
}
|
||||||
|
TaskTop3.details = detailTemps;
|
||||||
|
}
|
||||||
|
result.Add(TaskTop3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -427,47 +356,20 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filter">参数</param>
|
/// <param name="filter">参数</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<JobFinishRate> jobFinishRateData(string connhead)
|
public List<JobFinishRate> jobFinishRateData(string connhead, DataTable Table)
|
||||||
{
|
{
|
||||||
List<JobFinishRate> result = new List<JobFinishRate>();
|
List<JobFinishRate> result = new List<JobFinishRate>();
|
||||||
DataTable Table = new DataTable();
|
if (Table != null && Table.Rows.Count > 0)
|
||||||
using (SqlConnection connection = new SqlConnection(connhead))
|
|
||||||
{
|
{
|
||||||
try
|
foreach (DataRow item in Table.Rows)
|
||||||
{
|
{
|
||||||
connection.Open();
|
result.Add(new JobFinishRate()
|
||||||
string sql = "select * from vhome_jobrecord_data ";
|
|
||||||
//if (dt != DateTime.Now.Date)
|
|
||||||
//{
|
|
||||||
// sql += " and crdate>='" + dt + "'";
|
|
||||||
//}
|
|
||||||
//sql += " order by crdate desc";
|
|
||||||
using (SqlCommand Com = new SqlCommand(sql, connection))
|
|
||||||
{
|
{
|
||||||
SqlDataAdapter Data = new SqlDataAdapter(Com);
|
name = item["表单名称"] != null ? item["表单名称"].ToString() : null,
|
||||||
Data.Fill(Table);
|
qty = int.Parse(item["总数"].ToString()) != 0 ? int.Parse(item["总数"].ToString()) : 0,
|
||||||
}
|
finishQty = int.Parse(item["完成数"].ToString()) != 0 ? int.Parse(item["完成数"].ToString()) : 0,
|
||||||
connection.Close();
|
rate = item["完成率"] != null ? item["完成率"].ToString() : null,
|
||||||
if (Table != null && Table.Rows.Count > 0)
|
});
|
||||||
{
|
|
||||||
foreach (DataRow item in Table.Rows)
|
|
||||||
{
|
|
||||||
result.Add(new JobFinishRate()
|
|
||||||
{
|
|
||||||
name = item["表单名称"] != null ? item["表单名称"].ToString() : null,
|
|
||||||
qty = int.Parse(item["总数"].ToString()) != 0 ? int.Parse(item["总数"].ToString()) : 0,
|
|
||||||
finishQty = int.Parse(item["完成数"].ToString()) != 0 ? int.Parse(item["完成数"].ToString()) : 0,
|
|
||||||
rate = item["完成率"] != null ? item["完成率"].ToString() : null,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(ex.StackTrace))
|
|
||||||
throw new Exception("错误日志:[StackTrace]" + ex.StackTrace);
|
|
||||||
else
|
|
||||||
throw new Exception("【" + HttpContext.Request.Path + "】错误日志:[Message]" + ex.Message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -479,46 +381,19 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filter">参数</param>
|
/// <param name="filter">参数</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<SafeCheckSum> safeCheckSumData(string connhead)
|
public List<SafeCheckSum> safeCheckSumData(string connhead, DataTable Table)
|
||||||
{
|
{
|
||||||
List<SafeCheckSum> result = new List<SafeCheckSum>();
|
List<SafeCheckSum> result = new List<SafeCheckSum>();
|
||||||
DataTable Table = new DataTable();
|
if (Table != null && Table.Rows.Count > 0)
|
||||||
using (SqlConnection connection = new SqlConnection(connhead))
|
|
||||||
{
|
{
|
||||||
try
|
foreach (DataRow item in Table.Rows)
|
||||||
{
|
{
|
||||||
connection.Open();
|
result.Add(new SafeCheckSum()
|
||||||
string sql = "select * from vhome_check_total ";
|
|
||||||
//if (dt != DateTime.Now.Date)
|
|
||||||
//{
|
|
||||||
// sql += " and crdate>='" + dt + "'";
|
|
||||||
//}
|
|
||||||
//sql += " order by crdate desc";
|
|
||||||
using (SqlCommand Com = new SqlCommand(sql, connection))
|
|
||||||
{
|
{
|
||||||
SqlDataAdapter Data = new SqlDataAdapter(Com);
|
company = item["公司名称"] != null ? item["公司名称"].ToString() : null,
|
||||||
Data.Fill(Table);
|
qty = int.Parse(item["数量"].ToString()) != 0 ? int.Parse(item["数量"].ToString()) : 0,
|
||||||
}
|
num = int.Parse(item["排名"].ToString()) != 0 ? int.Parse(item["排名"].ToString()) : 0,
|
||||||
connection.Close();
|
});
|
||||||
if (Table != null && Table.Rows.Count > 0)
|
|
||||||
{
|
|
||||||
foreach (DataRow item in Table.Rows)
|
|
||||||
{
|
|
||||||
result.Add(new SafeCheckSum()
|
|
||||||
{
|
|
||||||
company = item["公司名称"] != null ? item["公司名称"].ToString() : null,
|
|
||||||
qty = int.Parse(item["数量"].ToString()) != 0 ? int.Parse(item["数量"].ToString()) : 0,
|
|
||||||
num = int.Parse(item["排名"].ToString()) != 0 ? int.Parse(item["排名"].ToString()) : 0,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(ex.StackTrace))
|
|
||||||
throw new Exception("错误日志:[StackTrace]" + ex.StackTrace);
|
|
||||||
else
|
|
||||||
throw new Exception("【" + HttpContext.Request.Path + "】错误日志:[Message]" + ex.Message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user