现场考勤——当前现场总人数

This commit is contained in:
2025-11-06 16:32:23 +08:00
parent 134f759589
commit c54c470818
3 changed files with 168 additions and 108 deletions
@@ -1,4 +1,5 @@
using BLL;
using FineUIPro.Web.DataShow;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
@@ -8,15 +9,37 @@ namespace FineUIPro.Web.common
{
public partial class mainMenu_PDigData : PageBase
{
#region
/// <summary>
/// 项目主键
/// </summary>
public string ProjectId
{
get
{
return (string)ViewState["ProjectId"];
}
set
{
ViewState["ProjectId"] = value;
}
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.ProjectId = string.Empty;
if (this.CurrUser != null && !string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
{
this.ProjectId = this.CurrUser.LoginProjectId;
}
getEmployInOutRecords = Funs.DB.T_d_EmployInOutRecord.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.RecordDate.Value == DateTime.Now.Date).ToList();
getAllPersons = Funs.DB.SitePerson_Person.Where(x => x.ProjectId == this.CurrUser.LoginProjectId).ToList();
getPersons = getAllPersons.Where(x =>x.IsUsed == true && x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime > DateTime.Now)).ToList();
getPersons = getAllPersons.Where(x => x.IsUsed == true && x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime > DateTime.Now)).ToList();
///当前现场总人数
getSitePerson();
getSitePerson();
}
}
@@ -26,7 +49,13 @@ namespace FineUIPro.Web.common
/// </summary>
private void getSitePerson()
{
var AllCount = getEmployInOutRecords.Count();
//var AllCount = getEmployInOutRecords.Count();
//var getEmployInOutRecords = Funs.DB.T_d_EmployInOutRecord.Where(x => x.ProjectId == this.ProjectId && x.RecordDate.Value == DateTime.Now.Date).ToList();
// int AllCount = getEmployInOutRecords.Count();
var getallin = APIPageDataService.getPersonNum(this.ProjectId, DateTime.Now);
int AllCount = getallin.Count();
if (AllCount > 0)
{
////总人数
@@ -72,7 +101,7 @@ namespace FineUIPro.Web.common
}
}
#endregion
#region
/// <summary>
///
@@ -105,12 +134,12 @@ namespace FineUIPro.Web.common
int manCount = 0;
var units = getAllPersons.Select(x => x.UnitId).Distinct();
if (units.Count() > 0)
{
{
foreach (var unitId in units)
{
{
var unitRords = from x in getEmployInOutRecords
join y in getAllPersons on x.IDCardNo equals y.IdentityCard
where y.UnitId == unitId && y.PersonId != null && x.UnitId== unitId
where y.UnitId == unitId && y.PersonId != null && x.UnitId == unitId
select x;
var unitPersons = getPersons.Where(x => x.UnitId == unitId);
int rcount = unitRords.Distinct().Count();
@@ -160,8 +189,8 @@ namespace FineUIPro.Web.common
businessColumn.title = "现场人员";
var getTypes = (from x in getEmployInOutRecords
join y in getAllPersons on x.IDCardNo equals y.IdentityCard
join z in Funs.DB.Base_WorkPost on y.WorkPostId equals z.WorkPostId
select new { y.WorkPostId,z.WorkPostName }).Distinct();
join z in Funs.DB.Base_WorkPost on y.WorkPostId equals z.WorkPostId
select new { y.WorkPostId, z.WorkPostName }).Distinct();
if (getTypes.Count() > 0)
{
foreach (var item in getTypes)
@@ -196,6 +225,6 @@ namespace FineUIPro.Web.common
}
}
#endregion
}
}