220 lines
12 KiB
C#
220 lines
12 KiB
C#
using BLL;
|
|
using Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Web.Services;
|
|
using System.Linq;
|
|
using System.Web.UI.WebControls;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace FineUIPro.Web.common
|
|
{
|
|
public partial class mainnew : PageBase
|
|
{
|
|
//public Model.HSSEData_HSSE hSSEData_HSSE;
|
|
public string userId;
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
userId = this.CurrUser.UserId;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 看板数据
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[WebMethod]
|
|
public static object GetHSSEData()
|
|
{
|
|
try
|
|
{
|
|
var page = new mainnew();
|
|
MainSevice mainSevice = new MainSevice(page.CurrUser.UserId);
|
|
// 获取HSSE数据
|
|
var hSSEData = Task.Run(() => mainSevice.GetHsseDataAsync()).Result;
|
|
|
|
var hiddenDangerList = mainSevice.GetDataHiddenDangerDetailItems();
|
|
|
|
// 获取项目数据
|
|
int unitType = CommonService.GetUnitTypeByUserId(page.CurrUser.UserId);
|
|
var projects = new List<Base_Project>();
|
|
|
|
if (unitType == 0)
|
|
{
|
|
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();
|
|
}
|
|
|
|
// 计算整改率
|
|
string zgl1 = "0";
|
|
string zgl2 = "0";
|
|
double generalRectificationRate = 0;
|
|
double majorRectificationRate = 0;
|
|
|
|
if (hSSEData.GeneralClosedNum.HasValue && hSSEData.GeneralNotClosedNum.HasValue)
|
|
{
|
|
double total = hSSEData.GeneralClosedNum.Value + hSSEData.GeneralNotClosedNum.Value;
|
|
if (total > 0)
|
|
{
|
|
generalRectificationRate = 100.0 * hSSEData.GeneralClosedNum.Value / total;
|
|
zgl1 = String.Format("{0:N2}", generalRectificationRate);
|
|
}
|
|
}
|
|
|
|
if (hSSEData.MajorClosedNum.HasValue && hSSEData.MajorNotClosedNum.HasValue)
|
|
{
|
|
double total = hSSEData.MajorClosedNum.Value + hSSEData.MajorNotClosedNum.Value;
|
|
if (total > 0)
|
|
{
|
|
majorRectificationRate = 100.0 * hSSEData.MajorClosedNum.Value / total;
|
|
zgl2 = String.Format("{0:N2}", majorRectificationRate);
|
|
}
|
|
}
|
|
|
|
// 构造返回数据
|
|
return new
|
|
{
|
|
success = true,
|
|
data = new
|
|
{
|
|
org = new
|
|
{//组织机构人员
|
|
groupSum = (hSSEData.HeadOfficeInspectorGeneralNum ?? 0) + (hSSEData.HeadOfficeFullTimeNum ?? 0),//企业总部人数
|
|
director = hSSEData.HeadOfficeInspectorGeneralNum ?? 0,//企业总监
|
|
fullTime = hSSEData.HeadOfficeFullTimeNum ?? 0,//企业专职
|
|
//enterpriseSum = 0,
|
|
branchSum = (hSSEData.BranchInspectorGeneralNum ?? 0) + (hSSEData.BranchFullTimeNum ?? 0),//分支机构人数
|
|
branchDirector = hSSEData.BranchInspectorGeneralNum ?? 0,//分支机构总监
|
|
branchFullTime = hSSEData.BranchFullTimeNum ?? 0,//分支机构专职
|
|
attentionSafetyEngineer = hSSEData.SafetyInjectionEngineer ?? 0,//注安师在岗职业
|
|
projectSum = (hSSEData.ProjectInspectorGeneralNum ?? 0) + (hSSEData.ProjectFullTimeNum ?? 0) + (hSSEData.ProjectSafetyMonitorNum ?? 0),//项目人数
|
|
projectDirector = hSSEData.ProjectInspectorGeneralNum ?? 0,//项目总监
|
|
projectFullTime = hSSEData.ProjectFullTimeNum ?? 0,//项目专职
|
|
projectSafetyMonitoring = hSSEData.ProjectSafetyMonitorNum ?? 0,//项目安全监护
|
|
aCard = hSSEData.CertificateANum ?? 0,//A证
|
|
bCard = hSSEData.CertificateBNum ?? 0,//B证
|
|
cCard = hSSEData.CertificateCNum ?? 0//C证
|
|
},
|
|
projectInfo = new
|
|
{//项目数据
|
|
projectsUnderConstruction = hSSEData.BeUnderConstructionNum ?? 0,//在建项目
|
|
shutdownProject = hSSEData.ShutdownNum ?? 0,//停工项目
|
|
participateInNum = hSSEData.JoinConstructionPersonNum ?? 0,//参建人数
|
|
dangerousProject = hSSEData.MajorProjectsUnderConstructionNum ?? 0,//在施危大工程
|
|
chinaData = (from project in projects
|
|
join city in Funs.DB.RealName_City
|
|
on new { Province = project.Province, Country = project.Country }
|
|
equals new { Province = city.ProvinceCode, Country = city.CountryId }
|
|
group city by city.Cname into g
|
|
select new
|
|
{
|
|
name = g.Key,
|
|
value = g.Count()
|
|
}).ToList(),//项目地图数据
|
|
},
|
|
specialEquipmentSys = 0,//特种设备质保体系【暂无】
|
|
designBriefing = 0,//图纸会审、设计交底
|
|
education = new
|
|
{//安全教育
|
|
safeWorkingHour = hSSEData.SafeWorkingHour ?? 0,//安全工时数
|
|
specialTrainNum = hSSEData.SpecialTrainNum ?? 0,//专项培训
|
|
safeTrainNum = hSSEData.SafeTrainNum ?? 0,//三级安全教育培训
|
|
specialOperationTrainNum = hSSEData.SpecialOperationTrainNum ?? 0,//特种作业培训
|
|
safetyTechnicalBriefing = 0//安全技术交底次数【待处理】
|
|
},
|
|
warning = new
|
|
{//预警警报
|
|
hydropower = 0,//水电监测
|
|
hydropower2 = 0,//水电监测
|
|
towercrane = 0,//塔式起重机预警
|
|
foundationpit = 0,//基坑监测预警
|
|
car = 0,//车辆冲洗监测
|
|
},
|
|
safetyHazard = new
|
|
{
|
|
// 集团级
|
|
orgHazard = 0,
|
|
orgIncomplete = 0,
|
|
orgClosedLoop = 0,
|
|
orgRectificationRate = 0,
|
|
// 分支机构级 - 假设使用与企业级相同的数据或可以从其他字段映射
|
|
branchHazard = 0,
|
|
branchIncomplete = 0,
|
|
branchClosedLoop = 0,
|
|
branchRectificationRate = 0,
|
|
// 企业级
|
|
enterpriseHazard = 0,
|
|
enterpriseIncomplete = 0,
|
|
enterpriseClosedLoop = 0,
|
|
enterpriseRectificationRate = 0,
|
|
// 项目级
|
|
projectHazard = (hSSEData.GeneralClosedNum ?? 0) + (hSSEData.GeneralNotClosedNum ?? 0),
|
|
projectIncomplete = hSSEData.GeneralNotClosedNum ?? 0,
|
|
projectClosedLoop = hSSEData.GeneralClosedNum ?? 0,
|
|
projectRectificationRate = Convert.ToDouble(zgl1),
|
|
},
|
|
costEquipment = new
|
|
{
|
|
expenseExtraction = hSSEData.CostExtract.HasValue ?
|
|
Math.Round(hSSEData.CostExtract.Value / 100000000m, 2) : 0, // 转换为亿元
|
|
costUtilization = hSSEData.CostUse.HasValue ?
|
|
Math.Round(hSSEData.CostUse.Value / 100000000m, 2) : 0, // 转换为亿元
|
|
usingNumbers = hSSEData.UseEquipmentNum ?? 0,
|
|
specialEquipment = hSSEData.SpecialEquipmentNum ?? 0
|
|
},
|
|
dangerousProject = new
|
|
{
|
|
approvalCompleted = hSSEData.CompletedNum ?? 0,
|
|
construction = hSSEData.ConstructionNum ?? 0,
|
|
training = hSSEData.TrainPersonNum ?? 0,
|
|
completed = hSSEData.FinishedNum ?? 0,
|
|
reasoning = 0
|
|
},
|
|
riskClassification = new
|
|
{
|
|
major = hSSEData.HighRiskNum ?? 0,
|
|
larger = hSSEData.MediumRiskNum ?? 0,
|
|
general = hSSEData.GeneralRiskNum ?? 0,
|
|
low = hSSEData.LowRiskNum ?? 0
|
|
},
|
|
highRisk = new
|
|
{
|
|
closeItem = hSSEData.LicensesCloseNum ?? 0,
|
|
licenseItem = hSSEData.LicensesNum ?? 0
|
|
},
|
|
meetAnEmergency = new
|
|
{
|
|
comprehensive = hSSEData.CompanyComprehensivePlanNum ?? 0,
|
|
special = hSSEData.CompanySpecialPlanNum ?? 0,
|
|
scene = hSSEData.CompanyOnSiteDisposalPlan ?? 0,
|
|
drill = hSSEData.CompanyDrillNum ?? 0
|
|
},
|
|
/* chinaData = projects.Select(p => new {
|
|
name = p.ShortName,
|
|
value = p.MapCoordinates?.ToString() ?? "",
|
|
address = p.ProjectAddress,
|
|
id = p.ProjectId,
|
|
openDate = p.StartDate.HasValue ? p.StartDate.Value.ToString("yyyy-MM-dd") : "--",
|
|
endDate = p.EndDate.HasValue ? p.EndDate.Value.ToString("yyyy-MM-dd") : "--",
|
|
ownUnit = ProjectService.getProjectUnitNameByUnitType(p.ProjectId, Const.ProjectUnitType_4),
|
|
jLUnit = ProjectService.getProjectUnitNameByUnitType(p.ProjectId, Const.ProjectUnitType_3),
|
|
sGUnit = ProjectService.getProjectUnitNameByUnitType(p.ProjectId, Const.ProjectUnitType_2),
|
|
projectMoney = p.ProjectMoney
|
|
}).ToList()*/
|
|
}
|
|
};
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return new { success = false, msg = ex.Message };
|
|
}
|
|
}
|
|
}
|
|
} |