首页数据修改

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

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)

View File

@ -148,49 +148,73 @@ namespace FineUIPro.Web.common
/// </summary>
private void getSitePerson()
{
var getEmployInOutRecords = Funs.DB.T_d_EmployInOutRecord.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.RecordDate.Value == DateTime.Now.Date).ToList();
//var getEmployInOutRecords = Funs.DB.T_d_EmployInOutRecord.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.RecordDate.Value == DateTime.Now.Date).ToList();
//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 a.ProjectId='" + this.ProjectId + @"' and a.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 = getEmployInOutRecords.Count();
// 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();
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 a.ProjectId='" + this.ProjectId + @"' and a.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 = getEmployInOutRecords.Count();
int mcount = 0;
if (tb != null)
//if (allcount > mcount)
//{
// this.divGLPerson.InnerHtml = mcount.ToString();
// this.divZYPerson.InnerHtml = (allcount - mcount).ToString();
//}
//else
//{
// this.divGLPerson.InnerHtml = allcount.ToString();
// this.divZYPerson.InnerHtml = "0";
//}
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 && y.ProjectId==CurrUser.LoginProjectId
select x.YearTotal).Sum();
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 && y.ProjectId == CurrUser.LoginProjectId
select x.YearTotal).Sum();
if (ProjectTotal1.HasValue)
{
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.divGLPerson.InnerHtml = ProjectTotal1.Value.ToString();
}
this.divALLPerson.InnerHtml = allcount.ToString();
if (allcount > mcount)
{
this.divGLPerson.InnerHtml = mcount.ToString();
this.divZYPerson.InnerHtml = (allcount - mcount).ToString();
}
else
{
this.divGLPerson.InnerHtml = allcount.ToString();
this.divZYPerson.InnerHtml = "0";
}
if (CurrUser.LoginProjectId == "b11a16ea-148c-4bae-a5a1-32158b599482")
if (ProjectTotal2.HasValue)
{
this.divALLPerson.InnerHtml = "1301";
this.divGLPerson.InnerHtml = "172";
this.divZYPerson.InnerHtml = "1129";
this.divALLPerson.InnerHtml = ProjectTotal2.Value.ToString();
}
if (ProjectTotal1.HasValue && ProjectTotal2.HasValue)
{
this.divZYPerson.InnerHtml = (ProjectTotal2.Value - ProjectTotal1.Value).ToString();
}
else if(ProjectTotal2.HasValue)
{
this.divZYPerson.InnerHtml = ProjectTotal2.Value .ToString();
}