diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoIn.aspx.cs b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoIn.aspx.cs index 9995d333..a9136967 100644 --- a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoIn.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoIn.aspx.cs @@ -25,6 +25,21 @@ namespace FineUIPro.Web.HSSE.SitePerson /// 错误集合 /// public static string errorInfos = string.Empty; + + /// + /// 项目ID + /// + public string ProjectId + { + get + { + return (string)ViewState["ProjectId"]; + } + set + { + ViewState["ProjectId"] = value; + } + } #endregion #region 加载页面 @@ -39,6 +54,7 @@ namespace FineUIPro.Web.HSSE.SitePerson { this.hdFileName.Text = string.Empty; this.hdCheckResult.Text = string.Empty; + this.ProjectId = this.CurrUser.LoginProjectId; if (viewCheckings != null) { viewCheckings.Clear(); @@ -154,7 +170,8 @@ namespace FineUIPro.Web.HSSE.SitePerson if (pds != null && ir > 0) { 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++) { @@ -170,7 +187,7 @@ namespace FineUIPro.Web.HSSE.SitePerson var unit = units.FirstOrDefault(e => e.UnitName == col0); 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) { result += "第" + (i + 2).ToString() + "行," + "单位" + "," + "[" + col0 + "]不在本项目中!" + "|"; @@ -333,7 +350,7 @@ namespace FineUIPro.Web.HSSE.SitePerson if (pds != null && ir > 0) { 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++) { @@ -352,12 +369,13 @@ namespace FineUIPro.Web.HSSE.SitePerson IntoOut = col3 == "进" ? "1" : "0", 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) { checking.PersonId = person.PersonId; + checking.ProjectId = person.ProjectId; } - checking.CheckingId = SQLHelper.GetNewID(typeof(Model.SitePerson_Checking)); + checking.CheckingId = SQLHelper.GetNewID(); viewCheckings.Add(checking); } } @@ -390,13 +408,15 @@ namespace FineUIPro.Web.HSSE.SitePerson int a = viewCheckings.Count(); for (int i = 0; i < a; i++) { - Model.SitePerson_Checking newChecking = new Model.SitePerson_Checking(); - newChecking.CheckingId = viewCheckings[i].CheckingId; - newChecking.ProjectId = this.CurrUser.LoginProjectId; - newChecking.IdentityCard = viewCheckings[i].IdentityCard; - newChecking.IntoOutTime = viewCheckings[i].IntoOutTime; - newChecking.IntoOut = viewCheckings[i].IntoOut; - newChecking.PersonId = viewCheckings[i].PersonId; + Model.SitePerson_Checking newChecking = new Model.SitePerson_Checking + { + CheckingId = viewCheckings[i].CheckingId, + ProjectId = viewCheckings[i].ProjectId, + IdentityCard = viewCheckings[i].IdentityCard, + IntoOutTime = viewCheckings[i].IntoOutTime, + IntoOut = viewCheckings[i].IntoOut, + PersonId = viewCheckings[i].PersonId + }; BLL.SitePerson_CheckingService.AddPersonInfo(newChecking); } string rootPath = Server.MapPath("~/"); diff --git a/SGGL/FineUIPro.Web/common/mainMenu_PDigData.aspx.cs b/SGGL/FineUIPro.Web/common/mainMenu_PDigData.aspx.cs index 2656f3d9..0a2e3415 100644 --- a/SGGL/FineUIPro.Web/common/mainMenu_PDigData.aspx.cs +++ b/SGGL/FineUIPro.Web/common/mainMenu_PDigData.aspx.cs @@ -110,10 +110,10 @@ namespace FineUIPro.Web.common { var unitRords = from x in getEmployInOutRecords 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; var unitPersons = getPersons.Where(x => x.UnitId == unitId); - int rcount = unitRords.Count(); + int rcount = unitRords.Distinct().Count(); if (rcount > 0) { manCount += rcount;