1、系统菜单调整;

2、系统看板UI调整;
3、事故事件功能
4、其他
This commit is contained in:
2025-12-10 15:58:02 +08:00
parent 3d00bb7a94
commit 6619f1e004
276 changed files with 131707 additions and 50045 deletions
+86 -369
View File
@@ -1,9 +1,15 @@
using BLL;
using Newtonsoft.Json;
using FineUIPro.Web.ZHGL.DataSync;
using Model;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web.UI;
using System.Runtime.Remoting.Metadata.W3cXsd2001;
using System.Threading.Tasks;
using System.Web.Services;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.common
{
@@ -13,385 +19,96 @@ namespace FineUIPro.Web.common
{
if (!IsPostBack)
{
////项目信息
var getProjectLists = getProjectInfo();
////合同
getHTContract();
///劳务统计
getSitePerson();
/// 获取安全人工时
getPersonWorkTime();
/// 获取质量问题
getCQMSProblem();
/// 获取施工产值
getOutputValue(getProjectLists);
/// 获取风险管控
getHazard();
}
}
#region
protected string ProjectInfo;
/// <summary>
/// 项目信息
/// 看板数据
/// </summary>
private List<Model.Base_Project> getProjectInfo()
/// <returns></returns>
[WebMethod]
public static object GetMainData()
{
ProjectInfo = "[]";
var getProjects = Funs.DB.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null) && (x.IsDelete == null || x.IsDelete == false));
this.divProjectNum.InnerHtml = getProjects.Count().ToString();
var getProjectMap = getProjects.Where(x => x.MapCoordinates.Length > 0);
if (getProjectMap.Count() > 0)
try
{
List<Model.SingleSerie> list = new List<Model.SingleSerie>();
foreach (var item in getProjectMap)
var page = new main();
MainSevice mainSevice = new MainSevice(page.CurrUser.UserId);
// 获取数据
var hsseData = Task.Run(() => mainSevice.GetHsseData()).Result;
//var hiddenDangerList = mainSevice.GetDataHiddenDangerDetailItems();
// 获取项目数据
int unitType = CommonService.GetUnitTypeByUserId(page.CurrUser.UserId);
var projects = new List<Base_Project>();
if (unitType == 0)
{
Model.SingleSerie newS = new Model.SingleSerie
projects = Funs.DB.Base_Project.Where(x => x.MapCoordinates != null && (x.IsDelete == null || x.IsDelete == false)).ToList();
}
else if (unitType == 1)
{
projects = Funs.DB.Base_Project.Where(x => x.UnitId == page.CurrUser.UnitId && x.MapCoordinates != null && (x.IsDelete == null || x.IsDelete == false)).ToList();
}
//安全生产天数
int workSafetyDays = DateHelper.DaysDifference(new DateTime(2020, 5, 20), DateTime.Today);
//事故事件
var list = AccidentWarningService.GetYearsTodayList();
// 构造返回数据
return new
{
success = true,
data = new
{
name = "【项目名称】:" + item.ProjectName
//+ "</br> 【项目状态】:" + GetProjectState(item.ProjectId)
+ "</br>【开工时间】:" + string.Format("{0:yyyy-MM-dd}", item.StartDate)
+ "</br>【竣工时间】:" + string.Format("{0:yyyy-MM-dd}", item.EndDate)
+ "</br>【项目地址】:" + item.ProjectAddress,
url = "indexProject.aspx?projectId=" + item.ProjectId,
cityname = "中国"
};
var strMap = Funs.GetStrListByStr(item.MapCoordinates, ',');
if (strMap.Count > 1)
{
newS.value = new[] { Funs.GetNewDecimalOrZero(strMap[0]), Funs.GetNewDecimalOrZero(strMap[1]) };
list.Add(newS);
accidentWarning = (from x in list select new { Title = x.Title, AccidentDate = x.AccidentDate.ToString("yyyy-MM-dd") }).ToList(),
org = new
{
//groupSum = (hsseData.HeadOfficeInspectorGeneralNum ?? 0) + (hsseData.HeadOfficeFullTimeNum ?? 0),
//director = hsseData.HeadOfficeInspectorGeneralNum ?? 0,
//fullTime = hsseData.HeadOfficeFullTimeNum ?? 0,
//enterpriseSum = 0,
//branchDirector = hsseData.BranchInspectorGeneralNum ?? 0,
//branchFullTime = hsseData.BranchFullTimeNum ?? 0,
//attentionSafetyEngineer = hsseData.SafetyInjectionEngineer ?? 0,
//projectDirector = hsseData.ProjectInspectorGeneralNum ?? 0,
//projectFullTime = hsseData.ProjectFullTimeNum ?? 0,
//projectSafetyMonitoring = hsseData.ProjectSafetyMonitorNum ?? 0,
//aCard = hsseData.CertificateANum ?? 0,
//bCard = hsseData.CertificateBNum ?? 0,
//cCard = hsseData.CertificateCNum ?? 0
},
projectInfo = new
{
workSafetyDay1 = (workSafetyDays % 10),
workSafetyDay10 = ((workSafetyDays % 100) / 10),
workSafetyDay100 = ((workSafetyDays % 1000) / 100),
workSafetyDay1000 = ((workSafetyDays % 10000) / 1000),
projectsUnderConstruction = hsseData.BeUnderConstructionNum ?? 0,
shutdownProject = hsseData.ShutdownNum ?? 0,
participateInNum = hsseData.JoinConstructionPersonNum ?? 0,
dangerousProject = hsseData.MajorProjectsUnderConstructionNum ?? 0
},
//项目地图数据
chinaData = projects.Select(p => new
{
id = p.ProjectId,
name = p.ShortName,
projectMoney = p.ProjectMoney,
startDate = p.StartDate != null ? ((DateTime)p.StartDate).ToString("yyyy-MM-dd") : string.Empty,
endDate = p.EndDate != null ? ((DateTime)p.EndDate).ToString("yyyy-MM-dd") : string.Empty,
address = p.ProjectAddress,
value = p.MapCoordinates.Split(','),
}).ToList()
}
}
ProjectInfo = JsonConvert.SerializeObject(list);
};
}
return getProjects.ToList();
}
#endregion
#region
protected double OnDutyRate;
/// <summary>
/// 劳务统计
/// </summary>
private void getSitePerson()
{
OnDutyRate = 0;
int AllCount = 0;
int MCount = 0;
DateTime dateValue = DateTime.Now.AddDays(-1);
List<Model.PageDataPersonInOutItem> getallin = new List<Model.PageDataPersonInOutItem>();
var getDayAll = from x in Funs.DB.SitePerson_PersonInOut
where x.ChangeTime.Value.Year == dateValue.Year && x.ChangeTime.Value.Month == dateValue.Month
&& x.ChangeTime.Value.Day == dateValue.Day && x.IsIn == true
select x;
if (getDayAll.Count() > 0)
catch (Exception ex)
{
var getInMaxs = from x in getDayAll
select new Model.PageDataPersonInOutItem
{
PersonId = x.PersonId,
PostType = x.PostType,
WorkPostId = x.WorkPostId,
};
if (getInMaxs.Count() > 0)
{
getallin = getInMaxs.Distinct().ToList();
}
}
AllCount = getallin.Count();
if (AllCount > 0)
{
MCount = getallin.Where(x => x.PostType == Const.PostType_1).Count();
/////管理人数
this.divGLPerson.InnerHtml = MCount.ToString();
/////作业人数
this.divZYPerson.InnerHtml = (AllCount - MCount).ToString();
int getPersonCount = Funs.DB.SitePerson_Person.Where(x => x.IsUsed == true
&& x.InTime <= DateTime.Now && !x.OutTime.HasValue && x.AuditorDate.HasValue).Count();
if (getPersonCount > 0)
{
OnDutyRate = Math.Round(AllCount * 1.0 / getPersonCount * 100, 1);
}
return new { success = false, msg = ex.Message };
}
}
#endregion
#region
/// <summary>
/// 获取安全人工时
/// </summary>
private void getPersonWorkTime()
{
int wHours = 0;
var getMax = from x in Funs.DB.SitePerson_DayReportDetail
join y in Funs.DB.SitePerson_DayReport on x.DayReportId equals y.DayReportId
select x;
if (getMax.Count() > 0)
{
wHours = Convert.ToInt32(getMax.Sum(x => x.PersonWorkTime) ?? 0);
}
this.divSafeWorkTime.InnerHtml = wHours.ToString("0000000000");
///整改单
var getRectify = from x in Funs.DB.Check_RectifyNotices
where x.States != Const.State_0 && x.States != null && x.ProjectId != null
select x;
int allcout = getRectify.Count();
if (allcout > 0)
{
this.divAllRectify.InnerHtml = allcout.ToString();
int ccount = getRectify.Where(x => x.States == "5").Count();
this.divRectifyRate.InnerHtml = Math.Round(ccount * 1.0 / allcout * 100, 1).ToString();
}
}
#endregion
#region
private void getHTContract()
{
//var getC = (from x in Funs.DB.PHTGL_ContractReview
// join y in Funs.DB.PHTGL_Approve on x.ContractReviewId equals y.ContractId
// join z in Funs.DB.PHTGL_Contract on x.ContractId equals z.ContractId
// where x.State == 5 && Convert.ToDateTime(y.ApproveDate).Year == DateTime.Now.Year
// select new { x.ContractReviewId, z.ContractAmount }).Distinct();
this.divHTNum.InnerHtml = "0";
decimal d = 0;
//foreach (var item in getC)
//{
// d += item.ContractAmount ?? 0;
//}
this.divHTAmount.InnerHtml = Math.Round((d / 100000000), 4).ToString();
}
#endregion
#region
protected double CRectificationRate;
protected double CQualifiedRate;
/// <summary>
/// 获取质量问题
/// </summary>
private void getCQMSProblem()
{
///整改率
CRectificationRate = 0;
///合格率
CQualifiedRate = 0;
var getJointCheckDetail = from x in Funs.DB.Check_JointCheckDetail
select x;
var getCheckControl = from x in Funs.DB.Check_CheckControl select x;
///问题总数
int AllCount = getJointCheckDetail.Count() + getCheckControl.Count();
this.divCQMSAllNum.InnerHtml = AllCount.ToString();
if (AllCount > 0)
{
///问题完成数
var getJOk = getJointCheckDetail.Where(x => x.State == "6").Count();
var getCOk = getCheckControl.Where(x => x.State == "7").Count();
int CCount = getJOk + getCOk;
if (CCount > 0)
{
CRectificationRate = Math.Round(CCount * 1.0 / AllCount * 100, 1);
}
}
//质量共检数据
var inspectionManagements = from x in Funs.DB.ProcessControl_InspectionManagement select x;
int a = inspectionManagements.Count();
//验收数据
int b = inspectionManagements.Count(x => x.IsOnceQualified == true);
if (a > 0 && b > 0)
{
CQualifiedRate = Math.Round(b * 1.0 / a * 100, 1);
}
}
#endregion
/// <summary>
/// 进度
/// </summary>
protected string projectJDHtml;
/// <summary>
/// 月施工计划产值
/// </summary>
protected string MonthPlanOutPutValue;
/// <summary>
/// 月施工实际产值
/// </summary>
protected string MonthActualOutPutValue;
/// <summary>
/// 获取当年施工产值
/// </summary>
private void getOutputValue(List<Model.Base_Project> getProjectLists)
{
MonthPlanOutPutValue = "[0,0,0,0,0,0,0,0,0,0,0,0]";
MonthActualOutPutValue = "[0,0,0,0,0,0,0,0,0,0,0,0]";
projectJDHtml = "";
DateTime date = DateTime.Now.AddYears(-1);
var getOutputValue = Funs.DB.Sys_OutputValueProject.Where(x => x.Year > date.Year || (x.Year == date.Year && x.Month >= date.Month));
if (getOutputValue.Count() > 0)
{
this.divYearPlanOutPutValue.InnerHtml = (getOutputValue.Sum(x => x.PlanOutPutValue ?? 0)).ToString();
this.divYearActualOutPutValue.InnerHtml = (getOutputValue.Sum(x => x.ActualOutPutValue ?? 0)).ToString();
}
//decimal[] monthValues = new decimal[12];
//decimal[] monthValues2 = new decimal[12];
//if (getOutputValue.Count() > 0)
//{
// for (int i = 0; i < 12; i++)
// {
// monthValues[i] = 0;
// monthValues2[i] = 0;
// var getOutMI = getOutputValue.Where(x => x.Month == i);
// if (getOutMI.Count() > 0)
// {
// monthValues[i] = getOutMI.Sum(x => x.PlanOutPutValue ?? 0);
// monthValues2[i] = getOutMI.Sum(x => x.ActualOutPutValue ?? 0);
// }
// }
// MonthPlanOutPutValue = JsonConvert.SerializeObject(monthValues);
// MonthActualOutPutValue = JsonConvert.SerializeObject(monthValues2);
// if (getProjectLists.Count() > 0)
// {
// foreach (var item in getProjectLists)
// {
// string shortName = item.ShortName;
// string jdRate = "0%";
// var getOutProjectV = getOutputValue.Where(x => x.ProjectId == item.ProjectId);
// if (getOutProjectV.Count() > 0)
// {
// decimal sumPlan = getOutProjectV.Sum(x => x.PlanOutPutValue ?? 0);
// if (sumPlan > 0)
// {
// decimal sumActual = getOutProjectV.Sum(x => x.ActualOutPutValue ?? 0);
// jdRate = Math.Round(sumActual * 100 / sumPlan, 1).ToString() + "%";
// }
// }
// projectJDHtml += @"<div class='sd-rate-item'><span class='sd-rate-status'>【在建】</span><span class='sd-rate-name'>" + shortName + "</span><span class='sd-rate-bar' style='cursor:pointer' title='" + jdRate + "'><span class='sd-rate-bar-value' style='width: " + jdRate + ";'></span></span></div>";
// }
// }
//}
//else
//{
// if (getProjectLists.Count() > 0)
// {
// foreach (var item in getProjectLists)
// {
// string shortName = item.ShortName;
// string jdRate = "0%";
// projectJDHtml += @"<div class='sd-rate-item'><span class='sd-rate-status'>【在建】</span><span class='sd-rate-name'>" + shortName + "</span><span class='sd-rate-bar' style='cursor:pointer' title='" + jdRate + "'><span class='sd-rate-bar-value' style='width: " + jdRate + ";'></span></span></div>";
// }
// }
//}
DateTime dateValue = DateTime.Now.AddMonths(-1).AddDays(-1);
var getPersonAll = from x in Funs.DB.SitePerson_Person select x;
List<Model.PageDataPersonInOutItem> getIn = new List<Model.PageDataPersonInOutItem>();
var getDayAll = from x in Funs.DB.SitePerson_PersonInOut
where x.ChangeTime.Value.Year == dateValue.Year && x.ChangeTime.Value.Month == dateValue.Month
&& x.ChangeTime.Value.Day == dateValue.Day && x.IsIn == true
select x;
foreach (var item in getProjectLists)
{
getIn.Clear();
var projectClockIns = getDayAll.Where(x => x.ProjectId == item.ProjectId);
if (projectClockIns.Count() > 0)
{
var getInMaxs = from x in projectClockIns
select new Model.PageDataPersonInOutItem
{
PersonId = x.PersonId,
PostType = x.PostType,
WorkPostId = x.WorkPostId,
};
if (getInMaxs.Count() > 0)
{
getIn = getInMaxs.Distinct().ToList();
}
}
var getPersons = getPersonAll.Where(x => x.ProjectId == item.ProjectId && x.IsUsed == true && x.InTime <= dateValue
&& !x.OutTime.HasValue);
string shortName = item.ShortName;
string jdRate = "0%";
if (getPersons.Count() > 0 && getIn.Count > 0)
{
decimal a = Convert.ToDecimal(getIn.Count);
decimal b = Convert.ToDecimal(getPersons.Count());
jdRate = Math.Round(a * 100 / b, 1).ToString() + "%";
}
projectJDHtml += @"<div class='sd-rate-item'><span class='sd-rate-status'>【在建】</span><span class='sd-rate-name'>" + shortName + "</span><span class='sd-rate-bar' style='cursor:pointer' title='" + jdRate + "'><span class='sd-rate-bar-value' style='width: " + jdRate + ";'></span></span></div>";
}
}
#region
/// <summary>
/// 安全隐患分析
/// </summary>
protected string SafeHiddenDanger
{
get
{
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
Model.SingleSerie s = new Model.SingleSerie();
List<double> listdata = new List<double>();
List<string> list = new List<string>();
businessColumn.title = "安全隐患分析";
var getTypes = from x in Funs.DB.HSSE_Hazard_HazardRegisterTypes select x;
var getAllChecks = from x in Funs.DB.HSSE_Hazard_HazardRegister select x;
var getChecks = from x in Funs.DB.HSSE_Hazard_HazardRegister
group x by x.RegisterTypesId into g
select new { g.First().RegisterTypesId, Count = g.Count(x => x.RegisterTypesId == g.First().RegisterTypesId) };
var top5Checks = getChecks.OrderByDescending(x => x.Count).Take(5);
int top5Count = 0;
string typeName = string.Empty;
foreach (var item in top5Checks)
{
typeName = string.Empty;
var type = getTypes.FirstOrDefault(x => x.RegisterTypesId == item.RegisterTypesId);
if (type != null)
{
typeName = type.RegisterTypesName;
}
list.Add(typeName);
listdata.Add(item.Count);
top5Count += item.Count;
}
list.Add("其他");
listdata.Add(getAllChecks.Count() - top5Count);
s.data = listdata;
series.Add(s);
businessColumn.legend = list;
businessColumn.series = series;
return JsonConvert.SerializeObject(businessColumn);
}
}
#endregion
#region
/// <summary>
/// 获取风险管控
/// </summary>
private void getHazard()
{
var getHazards = from x in Funs.DB.Hazard_HazardSelectedItem
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
select new { x.HazardSelectedItemId, y.RiskLevel };
var riskLevels = from x in Funs.DB.Base_RiskLevel select x;
this.divHazard1.InnerHtml = riskLevels.FirstOrDefault(x => x.RiskLevel == 1).RiskLevelName;
this.divHazard1Num.InnerHtml = getHazards.Count(x => x.RiskLevel == 1).ToString();
this.divHazard2.InnerHtml = riskLevels.FirstOrDefault(x => x.RiskLevel == 2).RiskLevelName;
this.divHazard2Num.InnerHtml = getHazards.Count(x => x.RiskLevel == 2).ToString();
this.divHazard3.InnerHtml = riskLevels.FirstOrDefault(x => x.RiskLevel == 3).RiskLevelName;
this.divHazard3Num.InnerHtml = getHazards.Count(x => x.RiskLevel == 3).ToString();
this.divHazard4.InnerHtml = riskLevels.FirstOrDefault(x => x.RiskLevel == 4).RiskLevelName;
this.divHazard4Num.InnerHtml = getHazards.Count(x => x.RiskLevel == 4).ToString();
}
#endregion
}
}
}