Merge branch 'master' of http://121.41.2.71:3000/wyw/mh_jy_safe
This commit is contained in:
commit
b804cec5b5
@ -276,14 +276,12 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
JsonActionResult<ReturnAll> result = new JsonActionResult<ReturnAll>();
|
||||
result.Data = new ReturnAll();
|
||||
DataTable tableRisk = new DataTable();
|
||||
DataTable tableJob = new DataTable();
|
||||
DataTable tableJobGroup = new DataTable();
|
||||
DataTable tableHidden = new DataTable();
|
||||
DataTable tableTask = new DataTable();
|
||||
DataTable tableJobRate = new DataTable();
|
||||
DataTable tableSafeCheck = new DataTable();
|
||||
DataTable tableLink = new DataTable();
|
||||
|
||||
//培训教育 对应统计
|
||||
var ListAllORG = GetEntities<T_FM_ORGANIZATION>(e => !e.IS_DELETED && e.CODE != "003", null, null).OrderBy(e => e.TENANT_CODE).ToList();
|
||||
string strConn = OPTenantDBConnService.GetConnByORGID(filter.OrgId.Value);//获取数据库链接
|
||||
@ -312,12 +310,7 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
//SqlDataAdapter jobGroupData = new SqlDataAdapter(comJobGroup);
|
||||
//jobGroupData.Fill(tableJobGroup);
|
||||
//result.Data.jobTodayTop3 = JobTodayTopData(filter.OrgId.Value, tableJob, tableJobGroup);
|
||||
//当日工作票的统计数量
|
||||
string sqlJob = "select * from vhome_jobToday ORDER BY NUM";
|
||||
SqlCommand comJob = new SqlCommand(sqlJob, connection);
|
||||
SqlDataAdapter jobData = new SqlDataAdapter(comJob);
|
||||
jobData.Fill(tableJob);
|
||||
result.Data.jobTodayQty = JobTodayQtyData(tableJob);
|
||||
|
||||
//隐患统计数据
|
||||
string sqlHidden = "select * from vhome_hiddenSummary";
|
||||
SqlCommand comHidden = new SqlCommand(sqlHidden, connection);
|
||||
@ -1006,19 +999,40 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
/// </summary>
|
||||
/// <param name="filter"></param>
|
||||
[HttpPost, Route("JobManage")]
|
||||
public JsonActionResult<List<JobManage>> JobManage([FromBody] KeywordFilter filter)
|
||||
public JsonActionResult<JobManage> JobManage([FromBody] KeywordFilter filter)
|
||||
{
|
||||
JsonActionResult<List<JobManage>> result = new JsonActionResult<List<JobManage>>();
|
||||
var list = new List<JobManage>();
|
||||
DateTime startDate = DateTime.Now.Date;
|
||||
DateTime endDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));
|
||||
if (!string.IsNullOrEmpty(filter.Parameter1))
|
||||
{
|
||||
startDate = Convert.ToDateTime(filter.Parameter1).Date;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(filter.Parameter2))
|
||||
{
|
||||
endDate = Convert.ToDateTime(Convert.ToDateTime(filter.Parameter2).Date.ToString("yyyy-MM-dd 23:59:59"));
|
||||
}
|
||||
if (startDate.Year != DateTime.Now.Year)
|
||||
{
|
||||
throw new Exception("只能查询本年度数据,请修改开始时间!");
|
||||
}
|
||||
if (endDate.Year != DateTime.Now.Year)
|
||||
{
|
||||
throw new Exception("只能查询本年度数据,请修改结束时间!");
|
||||
}
|
||||
JsonActionResult<JobManage> result = new JsonActionResult<JobManage>();
|
||||
result.Data = new JobManage();
|
||||
var list = new List<JobList>();
|
||||
DataTable tableList = new DataTable();
|
||||
DataTable tableJob = new DataTable();
|
||||
string strConn = OPTenantDBConnService.GetConnByORGID(filter.OrgId.Value);//获取数据库链接
|
||||
using (SqlConnection connection = new SqlConnection(strConn))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
connection.Open();
|
||||
//当日危险作业清单
|
||||
string sql = "select * from vhome_jobTodayList";
|
||||
string sql = "select * from vhome_jobTodayList where create_time >='"+ startDate +"' and create_time<='" + endDate+"'";
|
||||
SqlCommand com = new SqlCommand(sql, connection);
|
||||
SqlDataAdapter data = new SqlDataAdapter(com);
|
||||
data.Fill(tableList);
|
||||
@ -1026,7 +1040,7 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
{
|
||||
foreach (DataRow item in tableList.Rows)
|
||||
{
|
||||
JobManage job = new JobManage();
|
||||
JobList job = new JobList();
|
||||
job.companyName = item["companyName"] != null ? item["companyName"].ToString() : null;
|
||||
job.startDate = item["JOB_DATE"] != null ? item["JOB_DATE"].ToString() : null;
|
||||
job.endDate = item["JOB_END_DATE"] != null ? item["JOB_END_DATE"].ToString() : null;
|
||||
@ -1039,6 +1053,13 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
list.Add(job);
|
||||
}
|
||||
}
|
||||
result.Data.jobList = list.ToList();
|
||||
//当日工作票的统计数量
|
||||
string sqlJob = "select WORK_PERMIT_TYPE_ID,NAME,count(*) as QTY from vhome_jobTodayNew where create_time >='" + startDate + "' and create_time<='" + endDate + "' GROUP BY WORK_PERMIT_TYPE_ID,NAME ORDER BY QTY DESC";
|
||||
SqlCommand comJob = new SqlCommand(sqlJob, connection);
|
||||
SqlDataAdapter jobData = new SqlDataAdapter(comJob);
|
||||
jobData.Fill(tableJob);
|
||||
result.Data.jobTodayQty = JobTodayQtyData(tableJob);
|
||||
connection.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -1049,7 +1070,6 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
throw new Exception("【" + HttpContext.Request.Path + "】错误日志:[Message]" + ex.Message);
|
||||
}
|
||||
}
|
||||
result.Data = list;
|
||||
return result;
|
||||
|
||||
}
|
||||
@ -1141,6 +1161,17 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
public int? qty { get; set; }
|
||||
}
|
||||
public class JobManage
|
||||
{
|
||||
/// <summary>
|
||||
/// 作业清单
|
||||
/// </summary>
|
||||
public List<JobList> jobList { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public List<JobTodayQty> jobTodayQty { get; set; }
|
||||
}
|
||||
public class JobList
|
||||
{
|
||||
/// <summary>
|
||||
/// 公司名称
|
||||
|
||||
Loading…
Reference in New Issue
Block a user