diff --git a/SGGL/BLL/API/APIPersonService.cs b/SGGL/BLL/API/APIPersonService.cs index 22fc70d4..51e9c7c8 100644 --- a/SGGL/BLL/API/APIPersonService.cs +++ b/SGGL/BLL/API/APIPersonService.cs @@ -293,6 +293,119 @@ namespace BLL } #endregion + #region 根据条件获取项目人员信息(支持多条件过滤) + /// + /// 根据条件获取项目人员信息(支持多条件过滤) + /// + /// 查询过滤条件 + /// + public static List getPersonByFilter(Model.ProjectPersonInput filter) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var query = from x in db.View_SitePerson_Person + select x; + + // 添加过滤条件 + if (filter != null) + { + // 项目ID过滤 + if (!string.IsNullOrEmpty(filter.ProjectId)) + { + query = query.Where(x => x.ProjectId == filter.ProjectId); + } + + // 项目名称过滤(模糊查询) + if (!string.IsNullOrEmpty(filter.ProjectName)) + { + query = query.Where(x => x.ProjectName.Contains(filter.ProjectName)); + } + + // 人员ID过滤 + if (!string.IsNullOrEmpty(filter.PersonId)) + { + query = query.Where(x => x.PersonId == filter.PersonId); + } + + // 项目人员ID过滤 + if (!string.IsNullOrEmpty(filter.SitePersonId)) + { + query = query.Where(x => x.SitePersonId == filter.SitePersonId); + } + + // 姓名过滤(模糊查询) + if (!string.IsNullOrEmpty(filter.PersonName)) + { + query = query.Where(x => x.PersonName.Contains(filter.PersonName)); + } + + // 身份证号过滤 + if (!string.IsNullOrEmpty(filter.IdentityCard)) + { + query = query.Where(x => x.IdentityCard == filter.IdentityCard); + } + + // 卡号过滤 + if (!string.IsNullOrEmpty(filter.CardNo)) + { + query = query.Where(x => x.CardNo == filter.CardNo); + } + + // 单位名称过滤(模糊查询) + if (!string.IsNullOrEmpty(filter.UnitName)) + { + query = query.Where(x => x.UnitName.Contains(filter.UnitName)); + } + + // 班组名称过滤(模糊查询) + if (!string.IsNullOrEmpty(filter.TeamGroupName)) + { + query = query.Where(x => x.TeamGroupName.Contains(filter.TeamGroupName)); + } + + // 岗位名称过滤(模糊查询) + if (!string.IsNullOrEmpty(filter.WorkPostName)) + { + query = query.Where(x => x.WorkPostName.Contains(filter.WorkPostName)); + } + } + + // 默认只返回在岗人员 + query = query.Where(x => x.States == Const.ProjectPersonStates_1); + + var persons = from x in query orderby x.CardNo descending + select new Model.ProjectPersonOutput + { + PersonId = x.PersonId, + SitePersonId = x.SitePersonId, + CardNo = x.CardNo, + PersonName = x.PersonName, + SexName = x.SexName, + IdentityCard = x.IdentityCard, + ProjectId = x.ProjectId, + ProjectName = x.ProjectName, + UnitId = x.UnitId, + UnitName = x.UnitName, + TeamGroupName = x.TeamGroupName, + WorkPostName = x.WorkPostName, + InTime = string.Format("{0:yyyy-MM-dd}", x.InTime), + OutTime = string.Format("{0:yyyy-MM-dd}", x.OutTime), + OutResult = x.OutResult, + Telephone = x.Telephone, + PhotoUrl = x.PhotoUrl, + DepartName = x.DepartName, + WorkAreaName = x.WorkAreaName, + PostType = x.PostType, + PersonType = x.PersonType, + PersonTypeName = x.PersonType == "2" ? "外聘" : (x.PersonType == "3" ? "第三方" : "员工"), + PostTypeName = db.Sys_Const.FirstOrDefault(z => z.GroupId == ConstValue.Group_PostType && z.ConstValue == x.PostType).ConstText, + }; + + return persons.ToList(); + } + } + #endregion + #region 获取在岗、离岗、待审人员列表 /// /// 记录数 @@ -986,6 +1099,56 @@ namespace BLL } #endregion + #region 根据条件获取人员出入场记录(支持多条件过滤) + /// + /// 根据条件获取人员出入场记录(支持多条件过滤) + /// + /// 查询过滤条件 + /// + public static List getPersonInOutListByFilter(Model.PersonInOutRecordInput filter) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var query = from x in db.SitePerson_PersonInOut + join y in db.SitePerson_Person on x.PersonId equals y.PersonId + join z in db.Base_Project on x.ProjectId equals z.ProjectId + where x.ChangeTime >= filter.StartTime && x.ChangeTime <= filter.EndTime && z.ProjectName.Contains(filter.ProjectName) + select new Model.PersonInOutItem + { + PersonId = x.PersonId, + PersonName = y.PersonName, + ProjectId = x.ProjectId, + UnitId = y.UnitId, + UnitName = db.Base_Unit.First(z => z.UnitId == y.UnitId).UnitName, + WorkPostId = y.WorkPostId, + WorkPostName = db.Base_WorkPost.First(z => z.WorkPostId == y.WorkPostId).WorkPostName, + IsIn = x.IsIn, + IsInName = x.IsIn == true ? "进场" : "出场", + ChangeTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.ChangeTime), + ChangeTimeD = x.ChangeTime, + }; + + // 添加过滤条件 + if (filter != null) + { + // 单位名称过滤(模糊查询) + if (!string.IsNullOrEmpty(filter.UnitName)) + { + query = query.Where(x => x.UnitName.Contains(filter.UnitName)); + } + + // 人员姓名过滤(模糊查询) + if (!string.IsNullOrEmpty(filter.PersonName)) + { + query = query.Where(x => x.PersonName.Contains(filter.PersonName)); + } + } + + return query.OrderByDescending(x => x.ChangeTimeD).ToList(); + } + } + #endregion + #region 根据identityCard获取人员资质信息 /// /// 根据identityCard获取人员资质信息 diff --git a/SGGL/BLL/DropListService.cs b/SGGL/BLL/DropListService.cs index f616d01e..76dd763a 100644 --- a/SGGL/BLL/DropListService.cs +++ b/SGGL/BLL/DropListService.cs @@ -463,12 +463,15 @@ namespace BLL /// public static ListItem[] GetBidType() { - ListItem[] list = new ListItem[5]; - list[0] = new ListItem("招标", "公开招标"); - list[1] = new ListItem("谈判", "邀请招标"); - list[2] = new ListItem("询比 ", "询比价"); - list[3] = new ListItem("竞价", "竞争性谈判"); - list[4] = new ListItem("直接分包", "单一来源"); + ListItem[] list = new ListItem[8]; + list[0] = new ListItem("公开招标", "公开招标"); + list[1] = new ListItem("邀请招标", "邀请招标"); + list[2] = new ListItem("公开询比 ", "公开询比"); + list[3] = new ListItem("邀请询比 ", "邀请询比"); + list[4] = new ListItem("公开谈判", "公开谈判"); + list[5] = new ListItem("邀请谈判", "邀请谈判"); + list[6] = new ListItem("竞价", "竞价"); + list[7] = new ListItem("直接分包", "直接分包"); return list; } diff --git a/SGGL/BLL/PHTGL/BiddingManagement/BidDocumentsReviewService.cs b/SGGL/BLL/PHTGL/BiddingManagement/BidDocumentsReviewService.cs index 840d9350..28803f2d 100644 --- a/SGGL/BLL/PHTGL/BiddingManagement/BidDocumentsReviewService.cs +++ b/SGGL/BLL/PHTGL/BiddingManagement/BidDocumentsReviewService.cs @@ -127,8 +127,8 @@ namespace BLL /// 是否显示请选择 public static void InitGetBidTypeDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease) { - dropName.DataValueField = "Text"; - dropName.DataTextField = "Value"; + dropName.DataValueField = "Value"; + dropName.DataTextField = "Text"; dropName.DataSource = BLL.DropListService.GetBidType(); dropName.DataBind(); if (isShowPlease) diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index 017734c8..a36f6d86 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -496,10 +496,6 @@ - - - - @@ -9232,34 +9228,6 @@ TechnicalProposalReviewView.aspx - - ProjectHighlightsSitePic.aspx - ASPXCodeBehind - - - ProjectHighlightsSitePic.aspx - - - ProjectHighlightsSitePicEdit.aspx - ASPXCodeBehind - - - ProjectHighlightsSitePicEdit.aspx - - - ProjectHighlightsSitePicReport.aspx - ASPXCodeBehind - - - ProjectHighlightsSitePicReport.aspx - - - ProjectHighlightsSiteType.aspx - ASPXCodeBehind - - - ProjectHighlightsSiteType.aspx - QCGroupRegistration.aspx ASPXCodeBehind @@ -16894,7 +16862,7 @@ - + diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx.cs index f85822d3..696c9dd8 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx.cs +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx.cs @@ -27,9 +27,8 @@ namespace FineUIPro.Web.ProjectData if (!IsPostBack) { Funs.DropDownPageSize(this.ddlPageSize); - this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); - + // 绑定表格 this.BindGrid(); ////权限按钮方法 @@ -60,7 +59,7 @@ namespace FineUIPro.Web.ProjectData tb = GetFilteredTable(Grid1.FilteredData, tb); var table = this.GetPagedDataTable(Grid1, tb); Grid1.DataSource = table; - Grid1.DataBind(); + Grid1.DataBind(); } #region 操作 Events @@ -165,7 +164,7 @@ namespace FineUIPro.Web.ProjectData return; } - var device = Funs.DB.Project_Devices.FirstOrDefault(x=>x.DeviceId== Grid1.SelectedRowID) ; + var device = Funs.DB.Project_Devices.FirstOrDefault(x => x.DeviceId == Grid1.SelectedRowID); if (device != null) { var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId); @@ -201,13 +200,14 @@ namespace FineUIPro.Web.ProjectData var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId); var token = YunMouHelper.getToken(); var res = YunMouHelper.addDevicesToGroups(project.YunMouGroupId, new string[] { device.DeviceSerial }, token);//添加到权限组 - YunMouHelper.setDefence(device.DeviceSerial,"1",token); + YunMouHelper.setDefence(device.DeviceSerial, "1", token); if (string.IsNullOrEmpty(res)) { Alert.ShowInTop("关联权限出错!", MessageBoxIcon.Warning); } - else { + else + { device.YunMouPermission = "是"; Funs.DB.SubmitChanges(); ShowNotify("关联成功", MessageBoxIcon.Success); @@ -215,7 +215,7 @@ namespace FineUIPro.Web.ProjectData } } } - + protected void btnMenuDeletePermission_Click(object sender, EventArgs e) { if (Grid1.SelectedRowIndexArray.Length == 0) @@ -255,8 +255,8 @@ namespace FineUIPro.Web.ProjectData return; } - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ProjectDevicesEdit.aspx?DeviceId={0}", Grid1.SelectedRowID), "编辑项目单位", 800, 300)); - + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ProjectDevicesEdit.aspx?DeviceId={0}", Grid1.SelectedRowID), "编辑项目单位", 800, 300)); + } /// @@ -282,18 +282,18 @@ namespace FineUIPro.Web.ProjectData return; } string menuId = BLL.Const.ProjectDevicesMenuId; - + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, menuId); if (buttonList.Count() > 0) { if (buttonList.Contains(BLL.Const.BtnAdd)) { this.btnAdd.Hidden = false; - + } if (buttonList.Contains(BLL.Const.BtnModify)) { - this.btnMenuDeletePermission.Hidden= false; + this.btnMenuDeletePermission.Hidden = false; this.btnAdd.Hidden = false; this.btnMenuEdit.Hidden = false; this.btnMenuDeviceToYunMou.Hidden = false; @@ -304,7 +304,7 @@ namespace FineUIPro.Web.ProjectData this.btnMenuDelete.Hidden = false; } } - + } #endregion @@ -320,8 +320,8 @@ namespace FineUIPro.Web.ProjectData this.BindGrid(); this.GetButtonPower(); } - #endregion + #endregion + - } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx.cs index d2471ca8..13d8a6f3 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx.cs @@ -6,7 +6,10 @@ using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using BLL; -using BLL.Common; +using BLL.Common; +using FastReport.Cloud.OAuth; +using FineUIPro.Web.DataShow; +using Org.BouncyCastle.Crypto; namespace FineUIPro.Web.ProjectData { @@ -39,11 +42,11 @@ namespace FineUIPro.Web.ProjectData { if (!IsPostBack) { - btnClose.OnClientClick = ActiveWindow.GetHideReference(); + btnClose.OnClientClick = ActiveWindow.GetHideReference(); this.DeviceId = Request.Params["DeviceId"]; if (!string.IsNullOrEmpty(this.DeviceId)) { - Model.Project_Devices device = Funs.DB.Project_Devices.FirstOrDefault(x=>x.DeviceId==this.DeviceId); + Model.Project_Devices device = Funs.DB.Project_Devices.FirstOrDefault(x => x.DeviceId == this.DeviceId); if (device != null) { this.txtDeviceName.Text = device.DeviceName; @@ -59,8 +62,8 @@ namespace FineUIPro.Web.ProjectData { this.dpCreateDate.Text = string.Format("{0:yyyy-MM-dd}", device.CreateDate); } - - } + + } } } } @@ -74,15 +77,15 @@ namespace FineUIPro.Web.ProjectData /// protected void btnSave_Click(object sender, EventArgs e) { - - + + Model.Project_Devices device = new Model.Project_Devices { ProjectId = this.CurrUser.LoginProjectId, DeviceName = this.txtDeviceName.Text.Trim(), DeviceSerial = this.txtDeviceSerial.Text.Trim(), Address = txtAddress.Text.Trim(), - ValidateCode=txtValidateCode.Text.Trim(), + ValidateCode = txtValidateCode.Text.Trim(), CreateDate = Funs.GetNewDateTime(this.dpCreateDate.Text.Trim()) }; if (this.drpInOut.SelectedValue != BLL.Const._Null) @@ -120,9 +123,9 @@ namespace FineUIPro.Web.ProjectData } #endregion - - - + + + } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSysSet.aspx b/SGGL/FineUIPro.Web/ProjectData/ProjectSysSet.aspx index fca5e0d5..4c77b905 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectSysSet.aspx +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSysSet.aspx @@ -30,12 +30,7 @@ - - - - - - + diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSysSet.aspx.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectSysSet.aspx.cs index de5019cc..85a404b2 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectSysSet.aspx.cs +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSysSet.aspx.cs @@ -51,6 +51,35 @@ namespace FineUIPro.Web.common.ProjectSet ShowNotify("请选择项目!", MessageBoxIcon.Warning); return; } + #region 云眸 + ///通用 + var getProject = ProjectService.GetProjectByProjectId(projectId); + if (getProject != null) + { + getProject.IsYunMou = this.ckbIsYunMou.Checked; + if (this.ckbIsYunMou.Checked) + { + var token = YunMouHelper.getToken(); + string data; + data = Regex.Replace(getProject.ProjectCode, "[^0-9A-Fa-f]", "", RegexOptions.IgnoreCase); + YunMouHelper.addDevicesGroups(getProject.ProjectName, data, token); + var groupId = YunMouHelper.addPermissionGroups(getProject.ProjectName, token); + if (!string.IsNullOrEmpty(groupId)) + { + getProject.YunMouGroupId = groupId; + } + } + else + { + var token = YunMouHelper.getToken(); + string data; + data = Regex.Replace(getProject.ProjectCode, "[^0-9A-Fa-f]", "", RegexOptions.IgnoreCase); + YunMouHelper.deleteDevicesGroups(data, token);//删除设备分组,如果有子节点,可以不删除 + + } + Funs.DB.SubmitChanges(); + } + #endregion #region 焊接 // 焊接 Model.Project_Sys_Set dayReport = BLL.Project_SysSetService.GetSysSetBySetId("1", projectId); @@ -339,7 +368,11 @@ namespace FineUIPro.Web.common.ProjectSet SetCheckFromDict(dict, "10", this.ckPressMustCheckBItem); if (dict.ContainsKey("11")) this.rbMaterialColorAttribute.SelectedValue = dict["11"].SetValue == "1" ? "1" : "2"; } - + var getProject = ProjectService.GetProjectByProjectId(projectId); + if (getProject != null && getProject.IsYunMou == true) + { + this.ckbIsYunMou.Checked = true; + } //颜色模型设置 var m1 = BLL.Project_SysSetService.GetSysSetBySetName("管线未完成", this.CurrUser.LoginProjectId); if (m1 != null) this.txtPipelineNOComplete.Text = m1.SetValue; diff --git a/SGGL/Model/HSSE/PersonInOutRecordInput.cs b/SGGL/Model/HSSE/PersonInOutRecordInput.cs new file mode 100644 index 00000000..12287848 --- /dev/null +++ b/SGGL/Model/HSSE/PersonInOutRecordInput.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model +{ + /// + /// 人员出入记录入参 + /// + public class PersonInOutRecordInput + { + /// + /// 项目名称 + /// + public string ProjectName { get; set; } + /// + /// 单位名称 + /// + public string UnitName { get; set; } + /// + /// 人员姓名 + /// + public string PersonName { get; set; } + /// + /// 开始时间 + /// + public DateTime StartTime { get; set; } + /// + /// 结束时间 + /// + public DateTime EndTime { get; set; } + } +} diff --git a/SGGL/Model/HSSE/ProjectPersonInput.cs b/SGGL/Model/HSSE/ProjectPersonInput.cs new file mode 100644 index 00000000..e594b832 --- /dev/null +++ b/SGGL/Model/HSSE/ProjectPersonInput.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model +{ + public class ProjectPersonInput + { + /// + /// 人员主键ID + /// + public string PersonId { get; set; } + /// + /// 项目人员主键ID + /// + public string SitePersonId { get; set; } + + /// + /// 卡号 + /// + public string CardNo { get; set; } + /// + /// 姓名 + /// + public string PersonName { get; set; } + /// + /// 身份证号码 + /// + public string IdentityCard { get; set; } + + /// + /// 项目id + /// + public string ProjectId { get; set; } + + /// + /// 项目名称 + /// + public string ProjectName { get; set; } + /// + /// 单位名称 + /// + public string UnitName { get; set; } + /// + /// 班组名称 + /// + public string TeamGroupName { get; set; } + /// + /// 岗位名称 + /// + public string WorkPostName { get; set; } + + /// + /// 部门名称 + /// + public string DepartName { get; set; } + /// + /// 岗位类型名称 + /// + public string PostTypeName + { + get; + set; + } + /// + /// 人员类型 + /// + public string PersonTypeName + { + get; + set; + } + } +} diff --git a/SGGL/Model/HSSE/ProjectPersonOutput.cs b/SGGL/Model/HSSE/ProjectPersonOutput.cs new file mode 100644 index 00000000..b0fb4ebd --- /dev/null +++ b/SGGL/Model/HSSE/ProjectPersonOutput.cs @@ -0,0 +1,124 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model +{ + public class ProjectPersonOutput + { + /// + /// 人员主键ID + /// + public string PersonId { get; set; } + /// + /// 项目人员主键ID + /// + public string SitePersonId { get; set; } + /// + /// 卡号 + /// + public string CardNo { get; set; } + /// + /// 姓名 + /// + public string PersonName { get; set; } + /// + /// 性别 + /// + public string SexName { get; set; } + /// + /// 身份证号码 + /// + public string IdentityCard { get; set; } + + /// + /// 项目id + /// + public string ProjectId { get; set; } + /// + /// 项目名称 + /// + public string ProjectName { get; set; } + /// + /// 单位ID + /// + public string UnitId { get; set; } + /// + /// 单位名称 + /// + public string UnitName { get; set; } + /// + /// 班组名称 + /// + public string TeamGroupName { get; set; } + /// + /// 岗位名称 + /// + public string WorkPostName { get; set; } + /// + /// 入场时间 + /// + public string InTime { get; set; } + /// + /// 出场时间 + /// + public string OutTime { get; set; } + /// + /// 出场原因 + /// + public string OutResult { get; set; } + /// + /// 电话 + /// + public string Telephone { get; set; } + /// + /// 照片路径 + /// + public string PhotoUrl { get; set; } + /// + /// 部门名称 + /// + public string DepartName { get; set; } + + /// + /// 作业区域名称 + /// + public string WorkAreaName { get; set; } + + /// + /// 岗位类型 + /// + public string PostType + { + get; + set; + } + /// + /// 岗位类型名称 + /// + public string PostTypeName + { + get; + set; + } + /// + /// 人员类型 + /// + public string PersonType + { + get; + set; + } + /// + /// 人员类型 + /// + public string PersonTypeName + { + get; + set; + } + + } +} diff --git a/SGGL/Model/Model.csproj b/SGGL/Model/Model.csproj index 016a5a9d..a1b83dcc 100644 --- a/SGGL/Model/Model.csproj +++ b/SGGL/Model/Model.csproj @@ -252,6 +252,9 @@ + + + diff --git a/SGGL/WebAPI/Controllers/PersonController.cs b/SGGL/WebAPI/Controllers/PersonController.cs index d115bc9b..c534b96a 100644 --- a/SGGL/WebAPI/Controllers/PersonController.cs +++ b/SGGL/WebAPI/Controllers/PersonController.cs @@ -98,6 +98,52 @@ namespace WebAPI.Controllers } #endregion + #region 根据条件获取项目人员信息(支持分页和过滤) + /// + /// 根据条件获取项目人员信息(支持分页和过滤) + /// + /// 查询过滤条件(ProjectName为必填参数) + /// 每页条数 + /// 页码(从1开始) + /// 是否返回全部数据 + /// + public Model.ResponeData getPersonByFilter([FromUri] Model.ProjectPersonInput filter, int? pagesize = 15, int? pageindex = 1, bool ? returnAll = false) + { + var responeData = new Model.ResponeData(); + try + { + // 验证必填参数 ProjectName + if (filter == null || string.IsNullOrEmpty(filter.ProjectName)) + { + responeData.code = 0; + responeData.message = "ProjectName为必填参数!"; + return responeData; + } + + // 处理可空参数的默认值 + int actualPagesize = pagesize ?? 15; + int actualPageindex = pageindex ?? 1; + bool actualReturnAll = returnAll ?? false; + + var getDataList = APIPersonService.getPersonByFilter(filter); + int pageCount = getDataList.Count; + + if (!actualReturnAll && pageCount > 0 && actualPageindex > 0 && actualPagesize > 0) + { + getDataList = getDataList.Skip(actualPagesize * (actualPageindex - 1)).Take(actualPagesize).ToList(); + } + + responeData.data = new { pageCount, pageindex = actualPageindex, pagesize = actualPagesize, getDataList }; + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } + #endregion + #region 获取在岗、离岗、待审人员数量 /// /// 获取在岗、离岗、待审人员列表 @@ -970,8 +1016,8 @@ namespace WebAPI.Controllers #region 根据人员ID获取个人出入场记录 /// /// 根据人员ID获取个人出入场记录 - /// - /// + /// + /// /// /// /// 页码 @@ -998,6 +1044,65 @@ namespace WebAPI.Controllers } #endregion + #region 根据条件获取人员出入场记录(支持分页和过滤) + /// + /// 根据条件获取人员出入场记录(支持分页和过滤) + /// + /// 查询过滤条件(StartTime和EndTime必填) + /// 每页条数 + /// 页码(从1开始) + /// 是否返回全部数据 + /// + public Model.ResponeData getPersonInOutListByFilter([FromUri] Model.PersonInOutRecordInput filter, int? pagesize = 15, int? pageindex = 1, bool? returnAll = false) + { + var responeData = new Model.ResponeData(); + try + { + // 验证必填参数 + if (filter == null || filter.StartTime == default(DateTime) || filter.EndTime == default(DateTime)) + { + responeData.code = 0; + responeData.message = "StartTime和EndTime为必填参数!"; + return responeData; + } + // 验证时间范围 + if (filter.StartTime > filter.EndTime) + { + responeData.code = 0; + responeData.message = "StartTime不能大于EndTime!"; + return responeData; + } + if (filter == null || string.IsNullOrEmpty(filter.ProjectName)) + { + responeData.code = 0; + responeData.message = "ProjectName为必填参数!"; + return responeData; + } + + // 处理可空参数的默认值 + int actualPagesize = pagesize ?? 15; + int actualPageindex = pageindex ?? 1; + bool actualReturnAll = returnAll ?? false; + + var getDataList = APIPersonService.getPersonInOutListByFilter(filter); + int pageCount = getDataList.Count; + + if (!actualReturnAll && pageCount > 0 && actualPageindex > 0 && actualPagesize > 0) + { + getDataList = getDataList.Skip(actualPagesize * (actualPageindex - 1)).Take(actualPagesize).ToList(); + } + + responeData.data = new { pageCount, pageindex = actualPageindex, pagesize = actualPagesize, getDataList }; + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } + #endregion + #region 获取异常人员信息出入场记录 /// /// 获取异常人员信息出入场记录