Compare commits

...

4 Commits

Author SHA1 Message Date
李鹏飞 8b3a68f529 1 2025-03-13 15:42:41 +08:00
李鹏飞 70707cac4e 首页优化 2025-03-13 15:41:27 +08:00
李鹏飞 c6783807ff Merge branch 'master' of http://47.104.102.122:3000/panhf/CNCEC_SUBQHSE_WUHUAN 2025-03-12 21:44:33 +08:00
李鹏飞 4a6e16d5d2 1 2025-03-12 21:44:32 +08:00
6 changed files with 461 additions and 275 deletions

Binary file not shown.

View File

@ -55,10 +55,6 @@
"$type": "Bookmark",
"Name": "ST:129:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{1a46fd64-28d5-434c-8eb3-17a02d419b53}"
},
{
"$type": "Bookmark",
"Name": "ST:131:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
@ -66,6 +62,14 @@
{
"$type": "Bookmark",
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{1a46fd64-28d5-434c-8eb3-17a02d419b53}"
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{5726b0e3-1012-5233-81f9-d1fad48e7a56}"
}
]
}

View File

@ -0,0 +1,7 @@
{
"ExpandedNodes": [
""
],
"SelectedNode": "\\SGGL.sln",
"PreviewInSolutionExplorer": false
}

View File

@ -20,7 +20,9 @@ namespace BLL
var getDayAll = from x in db.SitePerson_PersonInOutNow
join y in db.SitePerson_Person on x.PersonId equals y.PersonId
join z in db.Base_WorkPost on y.WorkPostId equals z.WorkPostId
where x.ProjectId == projectId && x.ChangeTime.Value.Year == dateValue.Year && x.ChangeTime.Value.Month == dateValue.Month
where x.ProjectId == projectId
&& x.ChangeTime.Value.Year == dateValue.Year
&& x.ChangeTime.Value.Month == dateValue.Month
&& x.ChangeTime.Value.Day == dateValue.Day
select new { x.PersonId, x.ChangeTime, x.IsIn, z.PostType };
if (getDayAll.Count() > 0)

View File

@ -1,6 +1,8 @@
using BLL;
using Model;
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
@ -17,7 +19,7 @@ namespace FineUIPro.Web.common
public string[] pids { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
/* if (!IsPostBack)
{
Model.SGGLDB db = Funs.DB;
if (!string.IsNullOrEmpty(CurrUser.CompanyProjectId))
@ -35,19 +37,10 @@ namespace FineUIPro.Web.common
}
////未遂事故
//var wsAccidentList1 = from x in db.Accident_AccidentPersonRecord
// join y in db.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId
// where y.AccidentTypeName.Contains("未遂")
// select x;
//var wsAccidentList2 = from x in db.Accident_AccidentReportOther
// join y in db.Sys_Const on x.AccidentTypeId equals y.ConstValue
// where y.ConstText.Contains("未遂")
// select x;
//未遂事故
this.divWS.InnerHtml = GetNearMissNum().ToString();
//安全人工时
int wHours = db.SitePerson_PersonInOutNumber.Max(x => x.WorkHours) ?? 0;
var countAqrgsSum = Convert.ToDecimal(0);
if (pids == null)
{
@ -255,8 +248,185 @@ namespace FineUIPro.Web.common
//材料到货表格
getCldh();
}
*/
if (!IsPostBack)
{
InitializeProjectIds(); // 项目ID初始化封装
BindSafetyStatistics(); // 安全统计模块
BindQualityStatistics(); // 质量统计模块
BindProjectStatistics(); // 项目统计模块
getZlwt();
//质量共检
getZlgj();
//焊接
getHj();
//关键事项
getGjsx();
//人员信息
getSitePerson();
//项目人员图表
getProjectSitePerson();
//进度
getJd();
//整改数据
getZgsj();
//材料到货表格
getCldh();
}
}
// 初始化项目ID集合
private void InitializeProjectIds()
{
var db = Funs.DB;
pids = !string.IsNullOrEmpty(CurrUser.CompanyProjectId)
? CurrUser.CompanyProjectId.Split(',')
: db.Base_Project
.Where(x => x.ProjectState == "1")
.Select(x => x.ProjectId)
.ToArray();
}
// 安全统计模块封装
private void BindSafetyStatistics()
{
var db = Funs.DB;
// 未遂事故
divWS.InnerHtml = GetNearMissNum().ToString();
// 安全人工时(合并重复逻辑)
var countAqrgsSum = pids?.Any() == true
? CountAqrgs(d1: null, d2: null, pids)
: CountAqrgs();
if (countAqrgsSum > 10000)
{
countAqrgsSum = countAqrgsSum / Convert.ToDecimal(10000.00);
this.divSafeWorkTime.InnerHtml = Math.Round(countAqrgsSum, 2).ToString() + "万";
}
else
{
this.divSafeWorkTime.InnerHtml = countAqrgsSum.ToString().Split('.')[0];
}
// 当月安全人工时
var countMonthAqrgs = pids?.Any() == true
? CountAqrgs(getStartMonth(), getEndMonth(), pids)
: CountAqrgs(getStartMonth(), getEndMonth());
if (countMonthAqrgs > 10000)
{
countMonthAqrgs = countMonthAqrgs / Convert.ToDecimal(10000.00);
this.divSafeWorkTimeMonth.InnerHtml = Math.Round(countMonthAqrgs, 2).ToString() + "万";
}
else
{
this.divSafeWorkTimeMonth.InnerHtml = countMonthAqrgs.ToString().Split('.')[0];
}
// 安全培训人员(合并数据库查询)
var trainingQuery = db.EduTrain_TrainRecord
.Where(x => pids.Contains(x.ProjectId))
.GroupBy(x => 1)
.Select(g => new {
TrainCount = g.Sum(x => x.TrainPersonNum) ?? 0,
BoShengCount = db.Bo_Sheng_TrainPerson
.Where(x => (x.DeleteTag == "False" || x.DeleteTag == null))
.Where(x => pids.Contains(x.ProjectId))
.Count()
}).FirstOrDefault();
divSafePersonNum.InnerHtml = trainingQuery != null
? (trainingQuery.TrainCount + trainingQuery.BoShengCount).ToString()
: "0";
// 安全管理人员(优化关联查询)
var safetyStaffCount = db.SitePerson_Person
.Where(x=> x.IsUsed == true && x.InTime < DateTime.Now && (x.OutTime == null || x.OutTime > DateTime.Now))
.Where(x => pids.Contains(x.ProjectId))
.Join(db.Base_WorkPost.Where(x => x.IsHsse==true),
person => person.WorkPostId,
post => post.WorkPostId,
(person, post) => person)
.Count();
divSafeManagePersonNum.InnerText = safetyStaffCount.ToString();
}
// 质量统计模块封装
private void BindQualityStatistics()
{
var db = Funs.DB;
// 质量管理人员(合并公司+项目级查询)
var qualityQuery = db.Base_WorkPost
.Where(x => x.IsCQMS == true)
.GroupJoin(db.SitePerson_Person.Where(x=> x.IsUsed == true),
post => post.WorkPostId,
person => person.WorkPostId,
(post, persons) => new { post, persons })
.SelectMany(x => x.persons.DefaultIfEmpty(),
(x, person) => new { x.post, person })
.Where(x => pids.Contains(x.person.ProjectId));
divCqmsManageNum.InnerText = qualityQuery.Count().ToString();
// 质量培训人员
divCqmsPxNum.InnerText = db.Comprehensive_InspectionPerson
.Where(x => pids.Contains(x.ProjectId))
.Count(x => x.IsTrain == true).ToString();
}
// 项目统计优化
private void BindProjectStatistics()
{
var db = Funs.DB;
//在建项目
if (pids == null)
{
allProjects = ProjectService.GetAllProjectDropDownList();
}
else
{
allProjects = ProjectService.GetAllProjectDropDownList(pids);
}
int acount = allProjects.Count();
int pcount1 = 0;
int pcount2 = 0;
int pcount3 = 0;
if (acount > 0)
{
pcount1 = allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).Count();
var pidzjsg = string.Join(",", allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).Select(x => x.ProjectId)).Split(',');
if (pids == null)
{
pcount2 = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && pidzjsg.Contains(x.ProjectId) select x).Count();
}
else
{
pidzjsg = pids;
pcount2 = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && pids.Contains(x.ProjectId) select x).Count();
}
pcount3 = Count3(pidzjsg);
}
div_zjxmCount.InnerHtml = pcount1.ToString() + "<div class=\"th\">个</div>";
div_cjrsCount.InnerHtml = pcount2.ToString() + "<div class=\"th\">人</div>";
div_wdgcCount.InnerHtml = pcount3.ToString() + "<div class=\"th\">个</div>";
}
#region
@ -300,12 +470,8 @@ namespace FineUIPro.Web.common
select x;
if (pids != null)
{
getAllPersonInOutList = from x in Funs.DB.SitePerson_PersonInOutNumber
where pids.Contains(x.ProjectId)
select x;
getAllPersonInOutList = getAllPersonInOutList.Where(x => pids.Contains(x.ProjectId));
}
if (getAllPersonInOutList.Count() > 0)
{
if (datetime1.HasValue)
{
getAllPersonInOutList = getAllPersonInOutList.Where(x => x.InOutDate >= datetime1);
@ -314,20 +480,18 @@ namespace FineUIPro.Web.common
{
getAllPersonInOutList = getAllPersonInOutList.Where(x => x.InOutDate <= datetime2);
}
if (pids != null && getAllPersonInOutList.Count() > 0)
var projects = getAllPersonInOutList
.GroupBy(x => x.ProjectId)
.Select(g => new
{
//cout1 = getAllPersonInOutList.Sum(x => (long)x.WorkHours);
foreach (var pid in pids)
{
var q1 = getAllPersonInOutList.Where(x => x.ProjectId == pid).OrderByDescending(x => x.InOutDate);
var q2 = getAllPersonInOutList.Where(x => x.ProjectId == pid).OrderBy(x => x.InOutDate);
if (q1.Count() > 0)
{
cout1 += (q1.First().WorkHours ?? 0) - (q2.First().WorkHours ?? 0);
}
}
}
}
Project = g.Key,
Items = g.OrderBy(x => x.InOutDate).ToList()
})
.Where(g => g.Items.Any());
cout1 = projects.ToList().Sum(g =>
(g.Items.Last().WorkHours ?? 0) -
(g.Items.First().WorkHours ?? 0));
var getD1 = from x in Funs.DB.Accident_AccidentHandle
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
@ -340,16 +504,9 @@ namespace FineUIPro.Web.common
if (pids != null)
{
getD1 = from x in Funs.DB.Accident_AccidentHandle
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
where pids.Contains(x.ProjectId)
select x;
getD2 = from x in Funs.DB.Accident_AccidentReport
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
where pids.Contains(x.ProjectId)
select x;
getD1 = getD1.Where(x => pids.Contains(x.ProjectId));
getD2 = getD2.Where(x => pids.Contains(x.ProjectId));
}
if (datetime1.HasValue)
{
getD1 = getD1.Where(x => x.AccidentDate >= datetime1);
@ -360,19 +517,16 @@ namespace FineUIPro.Web.common
getD1 = getD1.Where(x => x.AccidentDate <= datetime2);
getD2 = getD2.Where(x => x.CompileDate <= datetime2);
}
if (getD1.Count() > 0)
if (getD1.Any())
{
cout1 = cout1 - getD1.Sum(x => x.WorkHoursLoss ?? 0);
}
if (getD2.Count() > 0)
if (getD2.Any())
{
cout1 = cout1 - getD2.Sum(x => x.WorkingHoursLoss ?? 0);
}
return cout1;
}
/// <summary>
/// 获取出入记录人工时-月报(项目级别)
/// </summary>
@ -823,10 +977,29 @@ namespace FineUIPro.Web.common
var ndtLists = from x in db.ProcessControl_NondestructiveTest_New where x.ProfessionalName == "工艺管道" select x;
if (pids != null)
{
ndtLists = from x in db.ProcessControl_NondestructiveTest_New where x.ProfessionalName == "工艺管道" && pids.Contains(x.ProjectId) select x;
ndtLists = ndtLists.Where(x=>pids.Contains(x.ProjectId));
}
decimal a = 0, b = 0;
if (ndtLists.Count() > 0)
var sumResult = ndtLists
.GroupBy(x => x.ProjectId)
.Select(g => new {
TotalQ = g.OrderByDescending(x => x.CreateDate)
.Select(x => x.TotalQuantity)
.FirstOrDefault(),
Rate = g.OrderByDescending(x => x.CreateDate)
.Select(x => x.TotalRate)
.FirstOrDefault()
})
.Where(x => x.TotalQ.HasValue).ToList()
.Select(x => new {
A = Math.Floor(x.TotalQ.Value * (decimal.Parse(x.Rate)) / 100),
B = x.TotalQ.Value
});
a = sumResult.Sum(x=>x.A);
b = sumResult.Sum(x => x.B);
/* if (ndtLists.Count() > 0)
{
foreach (var project in allProjects)
{
@ -843,7 +1016,7 @@ namespace FineUIPro.Web.common
}
}
}
}
}*/
if (b > 0)
{
result = Convert.ToDouble(decimal.Round(decimal.Parse((a / b * 100).ToString()), 2));

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>