20211011考勤首页去重

This commit is contained in:
杨红卫 2021-10-11 22:01:12 +08:00
parent f1c846da8a
commit f786812569
2 changed files with 34 additions and 14 deletions

View File

@ -25,6 +25,21 @@ namespace FineUIPro.Web.HSSE.SitePerson
/// 错误集合 /// 错误集合
/// </summary> /// </summary>
public static string errorInfos = string.Empty; public static string errorInfos = string.Empty;
/// <summary>
/// 项目ID
/// </summary>
public string ProjectId
{
get
{
return (string)ViewState["ProjectId"];
}
set
{
ViewState["ProjectId"] = value;
}
}
#endregion #endregion
#region #region
@ -39,6 +54,7 @@ namespace FineUIPro.Web.HSSE.SitePerson
{ {
this.hdFileName.Text = string.Empty; this.hdFileName.Text = string.Empty;
this.hdCheckResult.Text = string.Empty; this.hdCheckResult.Text = string.Empty;
this.ProjectId = this.CurrUser.LoginProjectId;
if (viewCheckings != null) if (viewCheckings != null)
{ {
viewCheckings.Clear(); viewCheckings.Clear();
@ -154,7 +170,8 @@ namespace FineUIPro.Web.HSSE.SitePerson
if (pds != null && ir > 0) if (pds != null && ir > 0)
{ {
var units = from x in Funs.DB.Base_Unit select x; var units = from x in Funs.DB.Base_Unit select x;
var sitePersons = from x in Funs.DB.SitePerson_Person where x.ProjectId == this.CurrUser.LoginProjectId select x; var sitePersons = from x in Funs.DB.SitePerson_Person
where x.ProjectId == this.ProjectId select x;
for (int i = 0; i < ir; i++) for (int i = 0; i < ir; i++)
{ {
@ -170,7 +187,7 @@ namespace FineUIPro.Web.HSSE.SitePerson
var unit = units.FirstOrDefault(e => e.UnitName == col0); var unit = units.FirstOrDefault(e => e.UnitName == col0);
if (unit != null) if (unit != null)
{ {
var projectUnit = Funs.DB.Project_ProjectUnit.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId && x.UnitId == unit.UnitId); var projectUnit = Funs.DB.Project_ProjectUnit.FirstOrDefault(x => x.ProjectId == this.ProjectId && x.UnitId == unit.UnitId);
if (projectUnit == null) if (projectUnit == null)
{ {
result += "第" + (i + 2).ToString() + "行," + "单位" + "," + "[" + col0 + "]不在本项目中!" + "|"; result += "第" + (i + 2).ToString() + "行," + "单位" + "," + "[" + col0 + "]不在本项目中!" + "|";
@ -333,7 +350,7 @@ namespace FineUIPro.Web.HSSE.SitePerson
if (pds != null && ir > 0) if (pds != null && ir > 0)
{ {
var units = from x in Funs.DB.Base_Unit select x; var units = from x in Funs.DB.Base_Unit select x;
var sitePersons = from x in Funs.DB.SitePerson_Person where x.ProjectId == this.CurrUser.LoginProjectId select x; var sitePersons = from x in Funs.DB.SitePerson_Person where x.ProjectId == this.ProjectId select x;
for (int i = 0; i < ir; i++) for (int i = 0; i < ir; i++)
{ {
@ -352,12 +369,13 @@ namespace FineUIPro.Web.HSSE.SitePerson
IntoOut = col3 == "进" ? "1" : "0", IntoOut = col3 == "进" ? "1" : "0",
IntoOutTime = Convert.ToDateTime(col4) IntoOutTime = Convert.ToDateTime(col4)
}; };
var person = BLL.PersonService.GetPersonByIdentityCard(this.CurrUser.LoginProjectId, checking.IdentityCard); var person = BLL.PersonService.GetPersonByIdentityCard( this.ProjectId, checking.IdentityCard);
if (person != null) if (person != null)
{ {
checking.PersonId = person.PersonId; checking.PersonId = person.PersonId;
checking.ProjectId = person.ProjectId;
} }
checking.CheckingId = SQLHelper.GetNewID(typeof(Model.SitePerson_Checking)); checking.CheckingId = SQLHelper.GetNewID();
viewCheckings.Add(checking); viewCheckings.Add(checking);
} }
} }
@ -390,13 +408,15 @@ namespace FineUIPro.Web.HSSE.SitePerson
int a = viewCheckings.Count(); int a = viewCheckings.Count();
for (int i = 0; i < a; i++) for (int i = 0; i < a; i++)
{ {
Model.SitePerson_Checking newChecking = new Model.SitePerson_Checking(); Model.SitePerson_Checking newChecking = new Model.SitePerson_Checking
newChecking.CheckingId = viewCheckings[i].CheckingId; {
newChecking.ProjectId = this.CurrUser.LoginProjectId; CheckingId = viewCheckings[i].CheckingId,
newChecking.IdentityCard = viewCheckings[i].IdentityCard; ProjectId = viewCheckings[i].ProjectId,
newChecking.IntoOutTime = viewCheckings[i].IntoOutTime; IdentityCard = viewCheckings[i].IdentityCard,
newChecking.IntoOut = viewCheckings[i].IntoOut; IntoOutTime = viewCheckings[i].IntoOutTime,
newChecking.PersonId = viewCheckings[i].PersonId; IntoOut = viewCheckings[i].IntoOut,
PersonId = viewCheckings[i].PersonId
};
BLL.SitePerson_CheckingService.AddPersonInfo(newChecking); BLL.SitePerson_CheckingService.AddPersonInfo(newChecking);
} }
string rootPath = Server.MapPath("~/"); string rootPath = Server.MapPath("~/");

View File

@ -110,10 +110,10 @@ namespace FineUIPro.Web.common
{ {
var unitRords = from x in getEmployInOutRecords var unitRords = from x in getEmployInOutRecords
join y in getAllPersons on x.IDCardNo equals y.IdentityCard join y in getAllPersons on x.IDCardNo equals y.IdentityCard
where y.UnitId == unitId && y.PersonId != null where y.UnitId == unitId && y.PersonId != null && x.UnitId== unitId
select x; select x;
var unitPersons = getPersons.Where(x => x.UnitId == unitId); var unitPersons = getPersons.Where(x => x.UnitId == unitId);
int rcount = unitRords.Count(); int rcount = unitRords.Distinct().Count();
if (rcount > 0) if (rcount > 0)
{ {
manCount += rcount; manCount += rcount;