修改安全月报

This commit is contained in:
2024-09-04 16:31:09 +08:00
parent 97b236d21d
commit 3d1e4f6338
6 changed files with 172 additions and 49 deletions
@@ -1775,7 +1775,8 @@ namespace FineUIPro.Web.HSSE.Manager
int totalSumPersonNum = 0;//总部
int totalSumOutPersonNum = 0;//外聘
int totalHSEPersonNum = 0;
var spckList = db.SitePerson_Checking.Where(x => x.ProjectId == ProjectId && x.IntoOut == "1");
var spckList = db.SitePerson_Checking.Where(x => x.IntoOutTime >= startTime
&& x.IntoOutTime <= endTime && x.ProjectId == ProjectId && x.IntoOut == "1");
if (units.Count() > 0)
{
foreach (Model.Project_ProjectUnit u in units)
@@ -1789,8 +1790,7 @@ namespace FineUIPro.Web.HSSE.Manager
};
//本部本月人数,本年考勤人数除当前月份,取平均数
//年度
var yearList = spckList.Where(x => x.IntoOutTime >= startTime
&& x.IntoOutTime <= endTime && x.UnitId == u.UnitId).ToList().Select(x => new hseDayItem()
var yearList = spckList.Where(x => x.UnitId == u.UnitId).ToList().Select(x => new hseDayItem()
{
IdentityCard = x.IdentityCard,
IntoOutTime = getShortTime(x.IntoOutTime)
@@ -1896,7 +1896,13 @@ namespace FineUIPro.Web.HSSE.Manager
private void getMonthReportCHSEDay()
{
var spckList = db.SitePerson_Checking.Where(x => x.ProjectId == ProjectId && x.IntoOut == "1");
//数据了太大,查起来有点问题。
//var spckList = db.SitePerson_Checking.Where(x => x.ProjectId == ProjectId && x.IntoOut == "1").Select(x=>new {
// IntoOutTime=x.IntoOutTime,
// IdentityCard=x.IdentityCard,
// UnitId=x.UnitId
//});
//本月项目现场HSE人工日统计
Model.MonthReportCHSEDay hseDay = new Model.MonthReportCHSEDay
{
@@ -1905,63 +1911,71 @@ namespace FineUIPro.Web.HSSE.Manager
//累计安全工作天数(当前日期-项目开始日期)
hseDay.SumHSEDay = (endTime - projectStartTime).Days;
//本月HSE人工日、年度累计HSE人工日、总累计HSE人工日,考勤中取
//本月
var list = spckList.Where(x => x.IntoOutTime >= startTime
&& x.IntoOutTime <= endTime).ToList().Select(x => new hseDayItem()
{
IdentityCard = x.IdentityCard,
IntoOutTime = getShortTime(x.IntoOutTime)
}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
.ToList();
////本月HSE人工日、年度累计HSE人工日、总累计HSE人工日,考勤中取
////本月
//var list = spckList.Where(x => x.IntoOutTime >= startTime
//&& x.IntoOutTime <= endTime).ToList().Select(x => new hseDayItem()
//{
// IdentityCard = x.IdentityCard,
// IntoOutTime = getShortTime(x.IntoOutTime)
//}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
// .ToList();
//本月HSE人工日
hseDay.MonthHSEWorkDay = list.Count();
//本月安全人工时(五环)
hseDay.HseManhours = spckList.Where(x => x.IntoOutTime >= startTime
&& x.IntoOutTime <= endTime && x.UnitId == Const.UnitId_CWCEC).ToList().Select(x => new hseDayItem()
{
IdentityCard = x.IdentityCard,
IntoOutTime = getShortTime(x.IntoOutTime)
}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
.ToList().Count() * 8;
hseDay.MonthHSEWorkDay = SQLHelper.RunProcGetHsseKq(ProjectId, startTime, endTime, "0");
//list.Count();
//本月安全人工时(五环)
//hseDay.HseManhours = spckList.Where(x => x.IntoOutTime >= startTime
//&& x.IntoOutTime <= endTime && x.UnitId == Const.UnitId_CWCEC).ToList().Select(x => new hseDayItem()
//{
// IdentityCard = x.IdentityCard,
// IntoOutTime = getShortTime(x.IntoOutTime)
//}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
// .ToList().Count() * 8;
hseDay.HseManhours = SQLHelper.RunProcGetHsseKq(ProjectId, startTime, endTime, "3");
//本月安全人工时(分包商)
hseDay.SubcontractManHours= spckList.Where(x => x.IntoOutTime >= startTime
&& x.IntoOutTime <= endTime && x.UnitId != Const.UnitId_CWCEC).ToList().Select(x => new hseDayItem()
{
IdentityCard = x.IdentityCard,
IntoOutTime = getShortTime(x.IntoOutTime)
}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
.ToList().Count() * 8;
hseDay.SubcontractManHours = SQLHelper.RunProcGetHsseKq(ProjectId, startTime, endTime, "1");
// spckList.Where(x => x.IntoOutTime >= startTime
//&& x.IntoOutTime <= endTime && x.UnitId != Const.UnitId_CWCEC).ToList().Select(x => new hseDayItem()
//{
// IdentityCard = x.IdentityCard,
// IntoOutTime = getShortTime(x.IntoOutTime)
//}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
// .ToList().Count() * 8;
//年度
var yearList = spckList.Where(x => x.IntoOutTime >= yearStartTime
&& x.IntoOutTime <= endTime).ToList().Select(x => new hseDayItem()
{
IdentityCard = x.IdentityCard,
IntoOutTime = getShortTime(x.IntoOutTime)
}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
.ToList();
//var yearList = spckList.Where(x => x.IntoOutTime >= yearStartTime
// && x.IntoOutTime <= endTime).ToList().Select(x => new hseDayItem()
// {
// IdentityCard = x.IdentityCard,
// IntoOutTime = getShortTime(x.IntoOutTime)
// }).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
// .ToList();
//年度累计人工日
hseDay.YearHSEWorkDay = yearList.Count;
hseDay.YearHSEWorkDay = SQLHelper.RunProcGetHsseKq(ProjectId, yearStartTime, endTime, "0"); ;
//yearList.Count;
//年度累计HSE人工时
hseDay.TotalHseManhoursYear = yearList.Count * 8;
hseDay.TotalHseManhoursYear = hseDay.YearHSEWorkDay*8;
//yearList.Count * 8;
// //项目累计
var pList = spckList.Where(x => x.IntoOutTime >= projectStartTime
&& x.IntoOutTime <= endTime).ToList().Select(x => new hseDayItem()
{
IdentityCard = x.IdentityCard,
IntoOutTime = getShortTime(x.IntoOutTime)
}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
.ToList();
// // //项目累计
// var pList = spckList.Where(x => x.IntoOutTime >= projectStartTime
//&& x.IntoOutTime <= endTime).ToList().Select(x => new hseDayItem()
//{
// IdentityCard = x.IdentityCard,
// IntoOutTime = getShortTime(x.IntoOutTime)
//}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
// .ToList();
hseDay.SumHSEWorkDay = pList.Count;
hseDay.SumHSEWorkDay = SQLHelper.RunProcGetHsseKq(ProjectId, projectStartTime, endTime, "0");
//pList.Count;
hseDay.TotalHseManhours = pList.Count * 8;
hseDay.TotalHseManhours = hseDay.SumHSEWorkDay*8;
//pList.Count * 8;
List<Model.MonthReportCHSEDay> listCHSEDay = new List<Model.MonthReportCHSEDay>();
listCHSEDay.Add(hseDay);