施工人力

This commit is contained in:
geh
2025-12-01 10:24:34 +08:00
parent da23e72a7f
commit 07b7d8426a
11 changed files with 561 additions and 212 deletions
@@ -82,9 +82,58 @@ namespace FineUIPro.Web.JDGL.SGManPower
businessColumn.xFontNum = 8;
// 延迟执行查询,只获取需要的数据
var actualBaseQuery = Funs.DB.T_d_EmployInOutRecord.Where(x =>
x.ProjectId == this.CurrUser.LoginProjectId);
// var actualBaseQuery = Funs.DB.T_d_EmployInOutRecord.Where(x =>
// x.ProjectId == this.CurrUser.LoginProjectId);
// var query = from spc in Funs.DB.SitePerson_Checking
// where spc.ProjectId == this.CurrUser.LoginProjectId
// select new
// {
// IntoOutTime = spc.IntoOutTime.Value.Date,
// spc.PersonId,
// spc.UnitId,
// }
// into a
// group a by new { a.PersonId, a.IntoOutTime, a.UnitId }
// into g
// select new
// {
// g.Key.PersonId,
// g.Key.UnitId,
// g.Key.IntoOutTime,
// num = g.Count()
// };
// //关联人员表
// var actualBaseQuery = (from x in query
// join y in Funs.DB.SitePerson_Person on x.PersonId equals y.PersonId into yInto
// from y in yInto.DefaultIfEmpty()
// select new
// {
// x.PersonId,
// x.IntoOutTime,
// x.UnitId,
// x.num,
// PostId = y.WorkPostId,
// }
// );
var actualBaseQuery = from spc in Funs.DB.SitePerson_Checking_Statistics
where spc.ProjectId == this.CurrUser.LoginProjectId
group spc by new
{
spc.UnitId,
spc.WorkPostId,
spc.IntoOutTime
} into g
select new
{
UnitId = g.Key.UnitId,
WorkPostId = g.Key.WorkPostId,
IntoOutTime = g.Key.IntoOutTime,
num = g.Sum(item => item.Num)
};
var planBaseQuery =
Funs.DB.JDGL_SGManPower.Where(x => x.ProjectId == this.CurrUser.LoginProjectId);
@@ -107,14 +156,14 @@ namespace FineUIPro.Web.JDGL.SGManPower
else if (chartTitle == "施工单位管理人员统计分析")
{
actualBaseQuery =
actualBaseQuery.Where(x => Units.Contains(x.UnitId) && workPosts.Contains(x.PostId));
actualBaseQuery.Where(x => Units.Contains(x.UnitId) && workPosts.Contains(x.WorkPostId));
planBaseQuery =
planBaseQuery.Where(x => Units.Contains(x.UnitId) && workPosts.Contains(x.WorkPostId));
}
else if (chartTitle == "作业人员统计分析")
{
actualBaseQuery =
actualBaseQuery.Where(x => Units.Contains(x.UnitId) && !workPosts.Contains(x.PostId));
actualBaseQuery.Where(x => Units.Contains(x.UnitId) && !workPosts.Contains(x.WorkPostId));
planBaseQuery =
planBaseQuery.Where(x => Units.Contains(x.UnitId) && !workPosts.Contains(x.WorkPostId));
}
@@ -127,7 +176,7 @@ namespace FineUIPro.Web.JDGL.SGManPower
{
int selectedYear = int.Parse(year);
actualBaseQuery = actualBaseQuery.Where(x =>
x.RecordDate.HasValue && x.RecordDate.Value.Year == selectedYear);
x.IntoOutTime.Value.Year == selectedYear);
planBaseQuery =
planBaseQuery.Where(x => x.PlanDate.HasValue && x.PlanDate.Value.Year == selectedYear);
}
@@ -135,9 +184,9 @@ namespace FineUIPro.Web.JDGL.SGManPower
{
int selectedYear = int.Parse(year);
int selectedMonth = int.Parse(month);
actualBaseQuery = actualBaseQuery.Where(x => x.RecordDate.HasValue &&
x.RecordDate.Value.Year == selectedYear &&
x.RecordDate.Value.Month == selectedMonth);
actualBaseQuery = actualBaseQuery.Where(x =>
x.IntoOutTime.Value.Year == selectedYear &&
x.IntoOutTime.Value.Month == selectedMonth);
planBaseQuery = planBaseQuery.Where(x => x.PlanDate.HasValue &&
x.PlanDate.Value.Year == selectedYear &&
x.PlanDate.Value.Month == selectedMonth);
@@ -152,14 +201,13 @@ namespace FineUIPro.Web.JDGL.SGManPower
case "annual":
// 按月分组(年度视图显示每个月的数据)
var actualAnnualQuery = from x in actualBaseQuery
where x.RecordDate.HasValue
group x by new { x.RecordDate.Value.Year, x.RecordDate.Value.Month }
group x by new { x.IntoOutTime.Value.Year, x.IntoOutTime.Value.Month }
into g
select new
{
Year = g.Key.Year,
Month = g.Key.Month,
ActualCount = g.Count()
ActualCount = g.Sum(x => x.num)
};
var planAnnualQuery = from x in planBaseQuery
@@ -185,15 +233,14 @@ namespace FineUIPro.Web.JDGL.SGManPower
case "monthly":
// 按天分组(月度视图显示每天的数据)
var actualMonthlyQuery = from x in actualBaseQuery
where x.RecordDate.HasValue
group x by new { x.RecordDate.Value.Year, x.RecordDate.Value.Month, x.RecordDate.Value.Day }
group x by new { x.IntoOutTime.Value.Year, x.IntoOutTime.Value.Month, x.IntoOutTime.Value.Day }
into g
select new
{
Year = g.Key.Year,
Month = g.Key.Month,
Day = g.Key.Day,
ActualCount = g.Count()
ActualCount = g.Sum(x => x.num)
};
var planMonthlyQuery = from x in planBaseQuery
@@ -221,14 +268,13 @@ namespace FineUIPro.Web.JDGL.SGManPower
default:
// 按月分组(默认情况)
var actualDefaultQuery = from x in actualBaseQuery
where x.RecordDate.HasValue
group x by new { x.RecordDate.Value.Year, x.RecordDate.Value.Month }
group x by new { x.IntoOutTime.Value.Year, x.IntoOutTime.Value.Month }
into g
select new
{
Year = g.Key.Year,
Month = g.Key.Month,
ActualCount = g.Count()
ActualCount = g.Sum(x => x.num)
};
var planDefaultQuery = from x in planBaseQuery