From 33faec600aa8fcc631f98823ec4f0af48960397f Mon Sep 17 00:00:00 2001 From: geh <1923421292@qq.com> Date: Tue, 12 May 2026 18:54:11 +0800 Subject: [PATCH] 1 --- SUBQHSE/FineUIPro.Web/DataShow/kq.aspx | 2 +- SUBQHSE/FineUIPro.Web/DataShow/kqProject.aspx | 877 ++++++++++++++++++ .../FineUIPro.Web/DataShow/kqProject.aspx.cs | 283 ++++++ .../DataShow/kqProject.aspx.designer.cs | 17 + SUBQHSE/FineUIPro.Web/common/main.aspx | 2 +- 5 files changed, 1179 insertions(+), 2 deletions(-) create mode 100644 SUBQHSE/FineUIPro.Web/DataShow/kqProject.aspx create mode 100644 SUBQHSE/FineUIPro.Web/DataShow/kqProject.aspx.cs create mode 100644 SUBQHSE/FineUIPro.Web/DataShow/kqProject.aspx.designer.cs diff --git a/SUBQHSE/FineUIPro.Web/DataShow/kq.aspx b/SUBQHSE/FineUIPro.Web/DataShow/kq.aspx index 7777e71..43a4aae 100644 --- a/SUBQHSE/FineUIPro.Web/DataShow/kq.aspx +++ b/SUBQHSE/FineUIPro.Web/DataShow/kq.aspx @@ -587,7 +587,7 @@ if (params.seriesType == "effectScatter") { // alert("点击了" + params.name) var projectId = params.data && params.data.id ? params.data.id : ''; - var jumpUrl = "../HSSE/KqShowScreen/KqShowScreen.aspx?projectId=" + encodeURIComponent(projectId); + var jumpUrl = "../DataShow/kqProject.aspx?projectId=" + encodeURIComponent(projectId); window.open(jumpUrl) } // 你可以在这里添加你的逻辑代码 diff --git a/SUBQHSE/FineUIPro.Web/DataShow/kqProject.aspx b/SUBQHSE/FineUIPro.Web/DataShow/kqProject.aspx new file mode 100644 index 0000000..a9cbdc0 --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/DataShow/kqProject.aspx @@ -0,0 +1,877 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="kqProject.aspx.cs" Inherits="FineUIPro.Web.DataShow.kqProject" %> + + + + + + + + + + + + +
+
+ +
QHSE系统实名制管理看板
+ +
+
项目:{{projectName}}
+
全屏
+
+
+
+
+
+
+ 劳务人员工种结构 TOP10 +
+
+
+
{{idx|formatNumber}}
+
+
+ + {{i.name}} + {{i.value}}个 +
+
+
+
+
+
+
+
+
+
+
+ 劳务人员 +
+
+
+ 序号头像 + + 姓名 + 工种时间 +
+
+
+
{{index + 1}}
+
+ +
+
{{item.PersonName}}
+
{{item.WorkPostName}}
+
{{item.ChangeTime}}
+
{{item.IsIn === 'out' ? '出' : '入'}}
+
+
+
+
+
+
+
+
+
总在册
+
{{form.person.allNum}}
+
+
+
当前在册
+
{{form.person.onDutyNum}}
+
+
+
今日出勤
+
{{form.person.todayAttendanceNum}}
+
+
+
今日出勤率
+
{{form.person.todayAttendanceRate}}
+
+
+
+ +
+
+ 出勤动态曲线 +
+
+
+
+
+
+
+ 考勤统计 +
+
+
+ 序号组织名称 + + 总在册 + 当前在册今日出勤 +
+
+
+ {{index + 1}} + {{item.projectName}} + {{item.allNum}} + {{item.onDutyNum}} + {{item.todayAttendanceNum}} +
+
+
+
+
+
+ 劳务人员年龄性别结构 +
+
+
+
+
+
+ 性别 + 占比统计 +
+
+
+
+
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/SUBQHSE/FineUIPro.Web/DataShow/kqProject.aspx.cs b/SUBQHSE/FineUIPro.Web/DataShow/kqProject.aspx.cs new file mode 100644 index 0000000..28733df --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/DataShow/kqProject.aspx.cs @@ -0,0 +1,283 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Web.Services; +using System.Linq; + +namespace FineUIPro.Web.DataShow +{ + public partial class kqProject : PageBase + { + public static string userId; + public static string projectId; + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + userId = this.CurrUser.UserId; + if (!string.IsNullOrEmpty(Request.Params["projectId"])) + { + projectId = Request.Params["projectId"]; + } + } + } + + /// + /// 根据身份证号计算年龄 + /// + private static int? CalculateAgeFromIdCard(string idCard) + { + if (string.IsNullOrEmpty(idCard) || idCard.Length < 17) + return null; + + try + { + string birthDateStr = idCard.Substring(6, 8); + DateTime birthDate = DateTime.ParseExact(birthDateStr, "yyyyMMdd", null); + + int age = DateTime.Now.Year - birthDate.Year; + if (DateTime.Now.Month < birthDate.Month || + (DateTime.Now.Month == birthDate.Month && DateTime.Now.Day < birthDate.Day)) + { + age--; + } + + return age > 0 ? age : (int?)null; + } + catch + { + return null; + } + } + + + /// + /// 看板数据 + /// + /// + [WebMethod] + public static object GetData() + { + try + { + var db = Funs.DB; + var projectList = (from project in db.Base_Project + where (project.ProjectAttribute == "GONGCHENG" || project.ProjectAttribute == null) + && (project.IsDelete == null || project.IsDelete == false) && project.ProjectState == "1" + select new + { + project.UnitId, + project.ProjectId, + ProjectName = string.IsNullOrEmpty(project.ShortName) ? project.ProjectName : project.ShortName, + project.ProjectAddress, + project.MapCoordinates, + }).ToList(); + var projectName = string.Empty; + if (!string.IsNullOrEmpty(projectId)) + { + projectList = projectList.Where(x => x.ProjectId == projectId).ToList(); + projectName = projectList.FirstOrDefault(x => x.ProjectId == projectId).ProjectName; + } + + int unitType = CommonService.GetUnitTypeByUserId(userId); + if (unitType == 1) + { + projectList = projectList.Where(x => x.UnitId == userId).ToList(); + } + + var chinaMapData = projectList + .Where(x => !string.IsNullOrEmpty(x.MapCoordinates)) + .Select(x => + { + var coords = x.MapCoordinates.Split(','); + return new + { + id = x.ProjectId, + name = x.ProjectName, + address = x.ProjectAddress, + value = coords.Length >= 2 + ? new[] { Convert.ToDouble(coords[0]), Convert.ToDouble(coords[1]) } + : new double[] { 0, 0 } + }; + }).ToList(); + + + // 获取在建项目id列表 + List beUnderConstructionList = projectList.Select(p => p.ProjectId).ToList(); + //获取所有人员列表 + var persons = db.View_SitePerson_Person.Where(x => beUnderConstructionList.Contains(x.ProjectId)) + .ToList(); + + var onDutyNum = persons.Where(x => x.IsUsedType == "1").Count(); + + //获取今天所有出入场记录 + DateTime todayStart = DateTime.Now.Date; + DateTime todayEnd = todayStart.AddDays(1).AddSeconds(-1); + var outOuts = db.SitePerson_PersonInOut.Where(x => + x.ChangeTime.HasValue && x.ChangeTime.Value.Date >= todayStart && + x.ChangeTime.Value.Date <= todayEnd && beUnderConstructionList.Contains(x.ProjectId)).ToList(); + + var inNum = outOuts.Where(x => x.IsIn == true) + .GroupBy(x => x.PersonId) + .Select(grp => grp.First()) + .Count(); //入场数量 + + var inRate = "0.00%"; + if (onDutyNum > 0) + { + inRate = (inNum * 100.0 / onDutyNum).ToString("F2") + "%"; + } + + var attendanceStats = (from p in persons + join proj in projectList on p.ProjectId equals proj.ProjectId + group p by new { p.ProjectId, proj.ProjectName } + into g + let todayInCount = outOuts.Where(x => x.ProjectId == g.Key.ProjectId && x.IsIn == true) + .GroupBy(x => x.PersonId) + .Select(grp => grp.First()) + .Count() + orderby g.Count() descending + select new + { + projectId = g.Key.ProjectId, + projectName = g.Key.ProjectName, + allNum = g.Count(), + onDutyNum = g.Count(x => x.IsUsedType == "1"), + todayAttendanceNum = todayInCount + }).ToList(); + + var workTypeStats = (from p in persons + where !string.IsNullOrEmpty(p.WorkPostId) + group p by new { p.WorkPostId, p.WorkPostName } + into g + orderby g.Count() descending + select new + { + id = g.Key.WorkPostId, + name = g.Key.WorkPostName, + value = g.Count() + }).Take(10).ToList(); + + var personWithAge = persons + .Where(x => !string.IsNullOrEmpty(x.IdentityCard)) + .Select(x => new + { + Person = x, + Age = CalculateAgeFromIdCard(x.IdentityCard) + }).Where(x => x.Age.HasValue).ToList(); + + var ageStats = personWithAge + .Where(x => x.Age.Value >= 16 && x.Age.Value <= 55) + .GroupBy(x => + { + int age = x.Age.Value; + if (age >= 16 && age <= 25) return "16-25"; + if (age >= 26 && age <= 35) return "26-35"; + if (age >= 36 && age <= 45) return "36-45"; + return "46-55"; + }) + .Select(g => new { name = g.Key, value = g.Count() }) + .OrderByDescending(x => x.value) + .ToList(); + + var genderStats = persons.Where(x => !string.IsNullOrEmpty(x.Sex)) + .GroupBy(x => x.Sex) + .Select(g => new + { + name = g.Key == "1" ? "男" : (g.Key == "2" ? "女" : g.Key), + value = g.Count() + }) + .ToList(); + + var lwInOutList = (from o in outOuts + join p in db.View_SitePerson_Person on o.PersonId equals p.PersonId into personGroup + from p in personGroup.DefaultIfEmpty() + where p != null + orderby o.ChangeTime descending + select new + { + PhotoUrl = p.PhotoUrl, + PersonName = o.PersonName ?? string.Empty, + WorkPostName = o.WorkPostName ?? string.Empty, + ChangeTime = o.ChangeTime.HasValue + ? o.ChangeTime.Value.ToString("yyyy-MM-dd HH:mm:ss") + : string.Empty, + IsIn = o.IsIn.HasValue && o.IsIn.Value ? "in" : "out" + }).Take(200).ToList(); + + //先获取管理人员的数据 + var projectUserList = (from a in db.Project_ProjectUser + join b in db.Sys_User on a.UserId equals b.UserId into userJoin + from b in userJoin.DefaultIfEmpty() + where beUnderConstructionList.Contains(a.ProjectId) + select new + { + ProjectId = a.ProjectId, + IdentityCard = b.IdentityCard, + }).ToList(); + //获取管理人员身份证 + var managerIdentityCards = projectUserList.Where(x => x.IdentityCard != null) + .Select(x => x.IdentityCard).ToList(); + + var managerData = new List(); + var workerData = new List(); + + for (int hour = 0; hour < 24; hour++) + { + DateTime hourStart = todayStart.AddHours(hour); + DateTime hourEnd = hourStart.AddHours(1).AddSeconds(-1); + + var hourRecords = outOuts.Where(x => x.ChangeTime.HasValue && + x.ChangeTime.Value >= hourStart && + x.ChangeTime.Value <= hourEnd).ToList(); + + int managerCount = 0; + int workerCount = 0; + if (hourRecords.Count > 0) + { + managerCount = hourRecords.Count(x => managerIdentityCards.Contains(x.IdentityCard)); + workerCount = hourRecords.Count - managerCount; + } + + managerData.Add(managerCount); + workerData.Add(workerCount); + } + + + var returnData = new + { + success = true, + data = new + { + person = new + { + allNum = persons.Count, //总在册数 + onDutyNum = onDutyNum, //总在场数 + todayAttendanceNum = inNum, //今日出勤数 + todayAttendanceRate = inRate, //今日出勤率 + }, + attendanceCurve = new + { + managerData = managerData, + workerData = workerData + }, + attendanceStats = attendanceStats, + workTypeStats = workTypeStats, + ageStats = ageStats, + genderStats = genderStats, + lwInOutList = lwInOutList, + chinaMapData = chinaMapData, + projectName = projectName, + } + }; + + return returnData; + } + catch (Exception ex) + { + return new { success = false, msg = ex.Message }; + } + } + } +} \ No newline at end of file diff --git a/SUBQHSE/FineUIPro.Web/DataShow/kqProject.aspx.designer.cs b/SUBQHSE/FineUIPro.Web/DataShow/kqProject.aspx.designer.cs new file mode 100644 index 0000000..91586d6 --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/DataShow/kqProject.aspx.designer.cs @@ -0,0 +1,17 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.DataShow +{ + + + public partial class kqProject + { + } +} diff --git a/SUBQHSE/FineUIPro.Web/common/main.aspx b/SUBQHSE/FineUIPro.Web/common/main.aspx index 4d7b5d7..19cc138 100644 --- a/SUBQHSE/FineUIPro.Web/common/main.aspx +++ b/SUBQHSE/FineUIPro.Web/common/main.aspx @@ -1032,7 +1032,7 @@ // 控制台打印点击的地区名称 if (params.seriesType == "effectScatter") { var projectId = params.data && params.data.id ? params.data.id : ''; - var jumpUrl = "../HSSE/KqShowScreen/KqShowScreen.aspx?projectId=" + encodeURIComponent(projectId); + var jumpUrl = "../indexProject.aspx?projectId=" + encodeURIComponent(projectId)+ "&state=0"; window.open(jumpUrl) } // 控制台打印点击的地区名称