首页数据修改

This commit is contained in:
2023-12-25 17:15:12 +08:00
parent 242ce72163
commit e8877811ef
2 changed files with 110 additions and 61 deletions
+49 -24
View File
@@ -98,31 +98,56 @@ namespace FineUIPro.Web.common
// }
//}
string sql = @"select c.ConstText,b.PostType,count( *) num from SitePerson_Person a left join Base_WorkPost b on a.WorkPostId=b.WorkPostId
LEFT JOIN Sys_Const AS c ON c.ConstValue = b.PostType and c.GroupId = 'PostType' where IsUsed =1 and InTime<='" + DateTime.Now.ToString("yyyy-MM-dd") + "' and (OutTime is null or OutTime>'" + DateTime.Now.ToString("yyyy-MM-dd") + @"' )
and AuditorDate is not null
group by c.ConstText,b.PostType ";
List<SqlParameter> listStr = new List<SqlParameter>();
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(sql, parameter);
int allcount = 0;
int mcount = 0;
if (tb != null)
{
foreach (DataRow row in tb.Rows)
{
allcount += int.Parse(row["num"].ToString());
if (!string.IsNullOrEmpty(row["ConstText"].ToString()) && row["ConstText"].ToString().Contains("管理"))
{
mcount += int.Parse(row["num"].ToString());
}
}
}
//string sql = @"select c.ConstText,b.PostType,count( *) num from SitePerson_Person a left join Base_WorkPost b on a.WorkPostId=b.WorkPostId
// LEFT JOIN Sys_Const AS c ON c.ConstValue = b.PostType and c.GroupId = 'PostType' where IsUsed =1 and InTime<='" + DateTime.Now.ToString("yyyy-MM-dd") + "' and (OutTime is null or OutTime>'" + DateTime.Now.ToString("yyyy-MM-dd") + @"' )
// and AuditorDate is not null
// group by c.ConstText,b.PostType ";
//List<SqlParameter> listStr = new List<SqlParameter>();
//SqlParameter[] parameter = listStr.ToArray();
//DataTable tb = SQLHelper.GetDataTableRunText(sql, parameter);
//int allcount = 0;
//int mcount = 0;
//if (tb != null)
//{
// foreach (DataRow row in tb.Rows)
// {
// allcount += int.Parse(row["num"].ToString());
// if (!string.IsNullOrEmpty(row["ConstText"].ToString()) && row["ConstText"].ToString().Contains("管理"))
// {
// mcount += int.Parse(row["num"].ToString());
// }
// }
//}
//this.divALLPerson.InnerHtml = allcount.ToString();
this.divGLPerson.InnerHtml = mcount.ToString();
this.divZYPerson.InnerHtml = (allcount - mcount).ToString();
OnDutyRate = Math.Round(getallin.Count() * 1.0 / allcount * 100, 1);
var ProjectTotal1 = (from x in Funs.DB.HSSE_MonthReportItem
join y in Funs.DB.HSSE_MonthReport on x.MonthReportId equals y.MonthReportId
where ("成达公司HSE管理人数" == x.ReportItem || "分包商HSE管理人数" == x.ReportItem) && y.Years == DateTime.Now.Year
select x.YearTotal).Sum();
if (ProjectTotal1.HasValue)
{
this.divGLPerson.InnerHtml = ProjectTotal1.Value.ToString();
}
var ProjectTotal2 = (from x in Funs.DB.HSSE_MonthReportItem
join y in Funs.DB.HSSE_MonthReport on x.MonthReportId equals y.MonthReportId
where ("成达公司现场人数" == x.ReportItem || "分包商现场人数" == x.ReportItem) && y.Years == DateTime.Now.Year
select x.YearTotal).Sum();
if (ProjectTotal2.HasValue && ProjectTotal1.HasValue)
{
this.divZYPerson.InnerHtml = (ProjectTotal2.Value - ProjectTotal1.Value).ToString();
}
else if (ProjectTotal2.HasValue)
{
this.divZYPerson.InnerHtml = ProjectTotal2.Value.ToString();
}
// OnDutyRate = Math.Round(getallin.Count() * 1.0 / allcount * 100, 1);
}
@@ -154,7 +179,7 @@ namespace FineUIPro.Web.common
this.divSafeWorkTime.InnerHtml = "0000000000";
var ProjectTotal = (from x in Funs.DB.HSSE_MonthReportItem
join y in Funs.DB.HSSE_MonthReport on x.MonthReportId equals y.MonthReportId
where "安全生产人工时数" == x.ReportItem
where "安全生产人工时数" == x.ReportItem && y.Years== DateTime.Now.Year
select x.YearTotal).Sum();
if (ProjectTotal.HasValue)