diff --git a/DataBase/版本日志/SGGLDB_V2021-07-20-001.sql b/DataBase/版本日志/SGGLDB_V2021-07-20-001.sql new file mode 100644 index 00000000..1708b4e4 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2021-07-20-001.sql @@ -0,0 +1,45 @@ +ALTER VIEW [dbo].[View_SitePerson_Checking] +AS +/*Աͼ*/ +SELECT ch.CheckingId,person.CardNo,ch.ProjectId,person.IdentityCard,ch.WorkAreaId,ch.IntoOutTime,ch.IntoOut, + ch.[Address],ch.WorkAreaName,person.PersonName,person.UnitId,unit.UnitName,ch.States +from dbo.SitePerson_Checking ch + left join dbo.SitePerson_Person person on ch.PersonId=person.PersonId + left join dbo.Base_Unit unit on person.UnitId=unit.UnitId + + +GO + +UPDATE SitePerson_Checking SET IntoOut=0 WHERE IntoOut !=1 +GO +/****** Object: Index [NonClusteredIndex-20210720-112756] Script Date: 2021/7/20 11:31:47 ******/ +CREATE NONCLUSTERED INDEX [NonClusteredIndex-20210720-112756] ON [dbo].[t_d_facerecord] +( + [ProjectId] ASC, + [EmployNO] ASC, + [RoleID] ASC, + [DateTimeRecord] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +GO + +/****** Object: Index [NonClusteredIndex-20210720-113607] Script Date: 2021/7/20 11:36:59 ******/ +CREATE NONCLUSTERED INDEX [NonClusteredIndex-20210720-113607] ON [dbo].[t_d_EmployInOutRecord] +( + [ProjectId] ASC, + [RecordDate] ASC, + [IDCardNo] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +GO + +/****** Object: Index [SitePerson_PersonInOut_PersonIdChangeTime] Script Date: 2021/7/20 11:38:07 ******/ +DROP INDEX [SitePerson_PersonInOut_PersonIdChangeTime] ON [dbo].[SitePerson_PersonInOut] +GO + +/****** Object: Index [SitePerson_PersonInOut_PersonIdChangeTime] Script Date: 2021/7/20 11:38:07 ******/ +CREATE NONCLUSTERED INDEX [SitePerson_PersonInOut_PersonIdChangeTime] ON [dbo].[SitePerson_PersonInOut] +( + [ProjectId] ASC, + [PersonId] ASC, + [ChangeTime] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +GO diff --git a/DataBase/菜单初始化脚本/1-3安全管理(Menu_HSSE).sql b/DataBase/菜单初始化脚本/1-3安全管理(Menu_HSSE).sql index 81451279..78dbefd4 100644 --- a/DataBase/菜单初始化脚本/1-3安全管理(Menu_HSSE).sql +++ b/DataBase/菜单初始化脚本/1-3安全管理(Menu_HSSE).sql @@ -380,7 +380,7 @@ GO GO INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed) - VALUES('12F7123B-C2ED-4011-9859-83260AC91F09','ֳԱڹ','HSSE/SitePerson/PersonInfo.aspx',50,'EE260447-028F-46AF-8864-9A5DC9DAA5BD','Menu_HSSE',0,1,1) + VALUES('12F7123B-C2ED-4011-9859-83260AC91F09','ֳԱֶ','HSSE/SitePerson/PersonInfo.aspx',50,'EE260447-028F-46AF-8864-9A5DC9DAA5BD','Menu_HSSE',0,1,1) GO --ֳԱڹť INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex) diff --git a/SGGL/BLL/API/APIDoorServerService.cs b/SGGL/BLL/API/APIDoorServerService.cs new file mode 100644 index 00000000..0b8332e3 --- /dev/null +++ b/SGGL/BLL/API/APIDoorServerService.cs @@ -0,0 +1,68 @@ +using EmitMapper; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace BLL +{ + public static class APIDoorServerService + { + /// + /// 保存 出入记录 + /// + /// 项目ID + /// 身份证号码 + /// 1进0出 + /// 进出时间 + /// 进出方式 + public static void SaveDoorInOutRecord(string projectId, string idCard, int isIn, DateTime changeTime, string Intype) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + int maxId = 0; + var getmax = db.T_d_facerecord.Where(x => x.ProjectId == projectId && x.RoleID == Intype).Select(x => x.ID); + if (getmax.Count() > 0) + { + maxId = getmax.Max() + 1; + } + string name = string.Empty; + var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == idCard && x.ProjectId ==projectId); + if (getPerson != null) + { + name = getPerson.PersonName; + } + + Model.T_d_facerecord newFacerecord = new Model.T_d_facerecord() + { + NewID = SQLHelper.GetNewID(), + ProjectId = projectId, + ID = maxId + 1, + EmployName = name, + EmployNO = idCard, + RoleID = Intype, + DateTimeRecord = changeTime, + RecordDes = Intype, + InOrOut = (isIn == 1 ? "进门" : "出门"), + }; + + db.T_d_facerecord.InsertOnSubmit(newFacerecord); + db.SubmitChanges(); + ///// 根据出入记录 写入考勤记录 + Model.t_d_facerecordItem facerecord = new Model.t_d_facerecordItem + { + ID = maxId + 1, + EmployName = name, + IDCardNo = idCard, + EmployNO = idCard, + ProjectId = projectId, + RoleID = Intype, + DateTimeRecord = changeTime, + RecordDes = Intype, + InOrOut = (isIn == 1 ? "进门" : "出门"), + }; + DoorServerService.InsertEmployInOutRecord(facerecord); + } + APIPersonService.getPersonInOut(projectId, idCard, isIn, changeTime); + } + } +} diff --git a/SGGL/BLL/BLL.csproj b/SGGL/BLL/BLL.csproj index 5c502f56..7c594cd6 100644 --- a/SGGL/BLL/BLL.csproj +++ b/SGGL/BLL/BLL.csproj @@ -91,6 +91,7 @@ + diff --git a/SGGL/BLL/DoorServer/InOutService.cs b/SGGL/BLL/DoorServer/InOutService.cs index fb6b0fad..5d07f734 100644 --- a/SGGL/BLL/DoorServer/InOutService.cs +++ b/SGGL/BLL/DoorServer/InOutService.cs @@ -27,9 +27,9 @@ namespace BLL private static IQueryable qq = from x in db.T_d_facerecord orderby x.DateTimeRecord descending select x; - private static IQueryable qq1= from x in db.T_d_validcardevent - orderby x.RecordDateTime descending - select x; + private static IQueryable qq1 = from x in db.T_d_validcardevent + orderby x.RecordDateTime descending + select x; /// /// 获取分页列表 @@ -42,7 +42,7 @@ namespace BLL if (type == "1") { IQueryable q1 = qq1.Where(x => x.ProjectId == projectId); - + if (!string.IsNullOrEmpty(startDate)) { q1 = q1.Where(e => e.RecordDateTime >= Funs.GetNewDateTime(startDate)); @@ -55,8 +55,8 @@ namespace BLL { q1 = from x in q1 join y in db.SitePerson_Person on x.IDCardNo equals y.IdentityCard - where y.UnitId == unitId - select x; + where y.UnitId == unitId + select x; } if (!string.IsNullOrEmpty(name)) { @@ -75,14 +75,14 @@ namespace BLL x.ProjectId, x.EmployName, x.DepartmentID, - DepartName=x.DepartmentName, + DepartName = x.DepartmentName, x.AreaID, x.AreaName, x.EmployNO, - CardID=x.CardNO, - DateTimeRecord=x.RecordDateTime, - RecordDes=x.RecordAll, - InOrOut=(x.InOrOut ==2? "出门" : "进门"), + CardID = x.CardNO, + DateTimeRecord = x.RecordDateTime, + RecordDes = x.RecordAll, + InOrOut = (x.InOrOut == 2 ? "出门" : "进门"), }; } else @@ -92,9 +92,13 @@ namespace BLL { q = q.Where(e => e.RoleID == "微信端"); } + else if (type == "3") + { + q = q.Where(e => e.RoleID == "手动"); + } else { - q = q.Where(e => e.RoleID != "微信端"); + q = q.Where(e => e.RoleID == "白名单"); } if (!string.IsNullOrEmpty(startDate)) { @@ -107,9 +111,9 @@ namespace BLL if (!string.IsNullOrEmpty(unitId)) { q = from x in q - join y in db.SitePerson_Person on x.EmployNO equals y.IdentityCard - where y.UnitId == unitId - select x; + join y in db.SitePerson_Person on x.EmployNO equals y.IdentityCard + where y.UnitId == unitId + select x; } if (!string.IsNullOrEmpty(name)) { @@ -135,7 +139,7 @@ namespace BLL x.CardID, x.DateTimeRecord, x.RecordDes, - x.InOrOut, + x.InOrOut, }; } } diff --git a/SGGL/BLL/HSSE/SitePerson/SitePerson_CheckingService.cs b/SGGL/BLL/HSSE/SitePerson/SitePerson_CheckingService.cs index e9b5bab5..db5c5bba 100644 --- a/SGGL/BLL/HSSE/SitePerson/SitePerson_CheckingService.cs +++ b/SGGL/BLL/HSSE/SitePerson/SitePerson_CheckingService.cs @@ -44,6 +44,12 @@ namespace BLL db.SitePerson_Checking.InsertOnSubmit(newPersonInfo); db.SubmitChanges(); + + if (!string.IsNullOrEmpty(personInfo.ProjectId) && !string.IsNullOrEmpty(personInfo.IdentityCard) && personInfo.IntoOutTime.HasValue) + { + int inOut = personInfo.IntoOut == "1" ? 1 : 0; + APIDoorServerService.SaveDoorInOutRecord(personInfo.ProjectId, personInfo.IdentityCard, inOut, personInfo.IntoOutTime.Value, "手动"); + } } /// @@ -53,18 +59,21 @@ namespace BLL public static void UpdatePersonInfo(Model.SitePerson_Checking personInfo) { Model.SGGLDB db = Funs.DB; - Model.SitePerson_Checking newPersonInfo = db.SitePerson_Checking.First(e => e.CheckingId == personInfo.CheckingId); - newPersonInfo.CardNo = personInfo.CardNo; - newPersonInfo.PersonId = personInfo.PersonId; - newPersonInfo.ProjectId = personInfo.ProjectId; - newPersonInfo.WorkAreaId = personInfo.WorkAreaId; - newPersonInfo.WorkAreaName = personInfo.WorkAreaName; - newPersonInfo.IdentityCard = personInfo.IdentityCard; - newPersonInfo.IntoOutTime = personInfo.IntoOutTime; - newPersonInfo.IntoOut = personInfo.IntoOut; - newPersonInfo.Address = personInfo.Address; + Model.SitePerson_Checking newPersonInfo = db.SitePerson_Checking.FirstOrDefault(e => e.CheckingId == personInfo.CheckingId); + if (newPersonInfo != null) + { + newPersonInfo.CardNo = personInfo.CardNo; + newPersonInfo.PersonId = personInfo.PersonId; + newPersonInfo.ProjectId = personInfo.ProjectId; + newPersonInfo.WorkAreaId = personInfo.WorkAreaId; + newPersonInfo.WorkAreaName = personInfo.WorkAreaName; + newPersonInfo.IdentityCard = personInfo.IdentityCard; + newPersonInfo.IntoOutTime = personInfo.IntoOutTime; + newPersonInfo.IntoOut = personInfo.IntoOut; + newPersonInfo.Address = personInfo.Address; - db.SubmitChanges(); + db.SubmitChanges(); + } } /// diff --git a/SGGL/FineUIPro.Web/Door/InOutList.aspx b/SGGL/FineUIPro.Web/Door/InOutList.aspx index cf14233a..917759cc 100644 --- a/SGGL/FineUIPro.Web/Door/InOutList.aspx +++ b/SGGL/FineUIPro.Web/Door/InOutList.aspx @@ -49,11 +49,12 @@ - + diff --git a/SGGL/FineUIPro.Web/Door/InOutRecord.aspx b/SGGL/FineUIPro.Web/Door/InOutRecord.aspx index 2d881e50..ef9c27b5 100644 --- a/SGGL/FineUIPro.Web/Door/InOutRecord.aspx +++ b/SGGL/FineUIPro.Web/Door/InOutRecord.aspx @@ -77,7 +77,7 @@ SortField="EmployName" FieldType="String" HeaderText="姓名" HeaderTextAlign="Center" TextAlign="Left"> - diff --git a/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20212820112825842.jpg b/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20212820112825842.jpg new file mode 100644 index 00000000..9cdc51da Binary files /dev/null and b/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20212820112825842.jpg differ diff --git a/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20212820112826316.jpg b/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20212820112826316.jpg new file mode 100644 index 00000000..8ad64e1d Binary files /dev/null and b/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20212820112826316.jpg differ diff --git a/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20212820112826364.jpg b/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20212820112826364.jpg new file mode 100644 index 00000000..b375ae00 Binary files /dev/null and b/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20212820112826364.jpg differ diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfo.aspx.cs b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfo.aspx.cs index d97e7a0b..babdcd05 100644 --- a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfo.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfo.aspx.cs @@ -64,7 +64,7 @@ namespace FineUIPro.Web.HSSE.SitePerson this.drpUnit.Enabled = false; } this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddMonths(-1)); - this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); + this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddDays(1)); // 绑定表格 BindGrid(); } @@ -307,18 +307,14 @@ namespace FineUIPro.Web.HSSE.SitePerson { if (intoOut != null) { - if (intoOut.ToString() == "True") + if (intoOut.ToString() == "1") { return "进场"; } - else if (intoOut.ToString() == "False") + else { return "出场"; } - else - { - return ""; - } } return ""; } diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoEdit.aspx b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoEdit.aspx index 3a394e1d..f440675e 100644 --- a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoEdit.aspx +++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoEdit.aspx @@ -70,12 +70,12 @@ + - + @@ -95,7 +95,7 @@ --%> - + diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoEdit.aspx.cs b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoEdit.aspx.cs index abcbaaa4..84da0422 100644 --- a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoEdit.aspx.cs @@ -102,6 +102,7 @@ namespace FineUIPro.Web.HSSE.SitePerson var person = BLL.PersonService.GetPersonById(this.drpPersonId.Value); if (person != null) { + this.txtIdCard.Text = person.IdentityCard; if (!string.IsNullOrEmpty(person.WorkAreaId)) { this.drpWorkArea.SelectedValue = person.WorkAreaId; @@ -198,6 +199,7 @@ namespace FineUIPro.Web.HSSE.SitePerson Model.SitePerson_Checking personInfo = new Model.SitePerson_Checking { PersonId = this.drpPersonId.Value, + IdentityCard = this.txtIdCard.Text, ProjectId = this.ProjectId, WorkAreaName = this.txtWorkArea.Text.Trim(), Address = this.txtAddress.Text.Trim() @@ -215,8 +217,8 @@ namespace FineUIPro.Web.HSSE.SitePerson } else { - string newKeyID = SQLHelper.GetNewID(typeof(Model.SitePerson_Checking)); - personInfo.CheckingId = newKeyID; + this.CheckingId = SQLHelper.GetNewID(); + personInfo.CheckingId = this.CheckingId; BLL.SitePerson_CheckingService.AddPersonInfo(personInfo); BLL.LogService.AddSys_Log(this.CurrUser, personInfo.CardNo, personInfo.CheckingId, BLL.Const.PersonalInfoMenuId, BLL.Const.BtnDelete); } diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoEdit.aspx.designer.cs index 1e59f8c5..283a9348 100644 --- a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoEdit.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoEdit.aspx.designer.cs @@ -120,6 +120,15 @@ namespace FineUIPro.Web.HSSE.SitePerson { /// protected global::FineUIPro.TextBox txtIdentityCard; + /// + /// txtIdCard 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtIdCard; + /// /// txtWorkArea 控件。 /// diff --git a/SGGL/WebAPI/Controllers/PersonController.cs b/SGGL/WebAPI/Controllers/PersonController.cs index 7bf9e5ad..2ed773a3 100644 --- a/SGGL/WebAPI/Controllers/PersonController.cs +++ b/SGGL/WebAPI/Controllers/PersonController.cs @@ -756,54 +756,7 @@ namespace WebAPI.Controllers var responeData = new Model.ResponeData(); try { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - int maxId = 0; - var getmax = db.T_d_facerecord.Where(x => x.ProjectId == projectId && x.RoleID == "白名单").Select(x => x.ID); - if (getmax.Count() > 0) - { - maxId = getmax.Max() + 1; - } - string name = string.Empty; - string cardNo = string.Empty; - var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == idCard); - if (getPerson != null) - { - name = getPerson.PersonName; - cardNo = getPerson.CardNo; - } - - Model.T_d_facerecord newFacerecord = new Model.T_d_facerecord() - { - NewID = SQLHelper.GetNewID(), - ProjectId = projectId, - ID = maxId + 1, - EmployName = name, - EmployNO = idCard, - RoleID = "白名单", - DateTimeRecord = changeTime, - RecordDes = "白名单:允许通行", - InOrOut = (isIn == 1 ? "进门" : "出门"), - }; - - db.T_d_facerecord.InsertOnSubmit(newFacerecord); - db.SubmitChanges(); - ///// 根据出入记录 写入考勤记录 - Model.t_d_facerecordItem facerecord = new Model.t_d_facerecordItem - { - ID = maxId + 1, - EmployName = name, - IDCardNo = idCard, - EmployNO = idCard, - ProjectId = projectId, - RoleID = "白名单", - DateTimeRecord = changeTime, - RecordDes = "白名单:允许通行", - InOrOut = (isIn == 1 ? "进门" : "出门"), - }; - DoorServerService.InsertEmployInOutRecord(facerecord); - } - APIPersonService.getPersonInOut(projectId, idCard, isIn, changeTime); + APIDoorServerService.SaveDoorInOutRecord(projectId, idCard, isIn, changeTime, "白名单"); } catch (Exception ex) {