大屏看板
This commit is contained in:
@@ -1,38 +1,293 @@
|
||||
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 main : PageBase
|
||||
{
|
||||
|
||||
public string userId;
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
|
||||
var thisUnit = CommonService.GetIsThisUnit();
|
||||
if (thisUnit != null && thisUnit.CollCropCode== "913700001630777743")
|
||||
{
|
||||
Tab3.Hidden=true;
|
||||
//Tab4.Hidden=true;
|
||||
}
|
||||
if(this.SysType == "SHIYE")
|
||||
{
|
||||
this.mainTabStrip.ActiveTabIndex = 2;
|
||||
}
|
||||
userId = this.CurrUser.UserId;
|
||||
}
|
||||
}
|
||||
|
||||
protected void mainTabStrip_TabIndexChanged(object sender, EventArgs e)
|
||||
/// <summary>
|
||||
/// 看板数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[WebMethod]
|
||||
public static object GetHSSEData()
|
||||
{
|
||||
if (this.mainTabStrip.ActiveTabIndex == 2)
|
||||
try
|
||||
{
|
||||
this.SysType = "SHIYE";
|
||||
var db = Funs.DB;
|
||||
var page = new main();
|
||||
MainSevice mainSevice = new MainSevice(page.CurrUser.UserId);
|
||||
// 获取HSSE数据
|
||||
var hsseData = Task.Run(() => mainSevice.GetHsseDataAsync()).Result;
|
||||
|
||||
//班前会
|
||||
var classMeetingList = HSSEData_HSSEService.GetProjectClassMeeting(null);
|
||||
//周前会
|
||||
var weekMeetingList = HSSEData_HSSEService.GetProjectWeekMeeting(null);
|
||||
|
||||
// 获取项目数据
|
||||
int unitType = CommonService.GetUnitTypeByUserId(page.CurrUser.UserId);
|
||||
var projects = new List<Base_Project>();
|
||||
|
||||
if (unitType == 0)
|
||||
{
|
||||
projects = db.Base_Project.Where(x => x.MapCoordinates != null && (x.IsDelete == null || x.IsDelete == false)).ToList();
|
||||
}
|
||||
else if (unitType == 1)
|
||||
{
|
||||
projects = db.Base_Project.Where(x => x.UnitId == page.CurrUser.UnitId && x.MapCoordinates != null && (x.IsDelete == null || x.IsDelete == false)).ToList();
|
||||
}
|
||||
|
||||
// 在建项目集合
|
||||
List<string> _beUnderConstructionList = projects.Select(x => x.ProjectId).ToList();
|
||||
|
||||
// 计算整改率
|
||||
string hsseZGRate = "0";
|
||||
double generalRectificationRate = 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;
|
||||
hsseZGRate = String.Format("{0:N2}", generalRectificationRate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//设计交底
|
||||
var designDetailsList = (from x in db.Comprehensive_DesignDetails select x).ToList();
|
||||
//施工方案
|
||||
var cqmsConstructSolutionList = (from x in db.Solution_CQMSConstructSolution select x).ToList();
|
||||
|
||||
//设备报验
|
||||
var inspectionEquipmentList = (from x in db.Comprehensive_InspectionEquipment select x).ToList();
|
||||
|
||||
//人员报验
|
||||
var inspectionPersonList = (from x in db.Comprehensive_InspectionPerson select x).ToList();
|
||||
|
||||
//机具报验
|
||||
var inspectionMachineList = (from x in db.Comprehensive_InspectionMachine select x).ToList();
|
||||
|
||||
|
||||
Model.CQMSData_CQMS cqmsData = new Model.CQMSData_CQMS();
|
||||
var getCqmsDataCqms = db.CQMSData_CQMS.OrderByDescending(x => x.ReportDate).FirstOrDefault();
|
||||
if (getCqmsDataCqms == null)
|
||||
{
|
||||
cqmsData = new Model.CQMSData_CQMS();
|
||||
}
|
||||
|
||||
if (unitType == 0)
|
||||
{
|
||||
//classMeetingList = classMeetingList;
|
||||
cqmsData = getCqmsDataCqms;
|
||||
}
|
||||
else if (unitType == 1)
|
||||
{
|
||||
cqmsData = CQMSDataService.GetSubUnitCqmsDataByDate(page.CurrUser.UnitId, getCqmsDataCqms.ReportDate);
|
||||
classMeetingList = classMeetingList.Where(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == page.CurrUser.UnitId).ToList();
|
||||
weekMeetingList = weekMeetingList.Where(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == page.CurrUser.UnitId).ToList();
|
||||
designDetailsList = designDetailsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitName == page.CurrUser.UnitId).ToList();
|
||||
cqmsConstructSolutionList = cqmsConstructSolutionList.Where(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == page.CurrUser.UnitId).ToList();
|
||||
inspectionEquipmentList = inspectionEquipmentList.Where(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == page.CurrUser.UnitId).ToList();
|
||||
inspectionPersonList = inspectionPersonList.Where(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == page.CurrUser.UnitId).ToList();
|
||||
inspectionMachineList = inspectionMachineList.Where(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == page.CurrUser.UnitId).ToList();
|
||||
}
|
||||
else if (unitType == 2)
|
||||
{
|
||||
cqmsData = new Model.CQMSData_CQMS();
|
||||
classMeetingList = new List<MeetingOutput>();
|
||||
weekMeetingList = new List<MeetingOutput>();
|
||||
designDetailsList = new List<Comprehensive_DesignDetails>();
|
||||
cqmsConstructSolutionList = new List<Solution_CQMSConstructSolution>();
|
||||
inspectionEquipmentList = new List<Comprehensive_InspectionEquipment>();
|
||||
inspectionPersonList = new List<Comprehensive_InspectionPerson>();
|
||||
inspectionMachineList = new List<Comprehensive_InspectionMachine>();
|
||||
}
|
||||
|
||||
|
||||
int inspectionEquipment = inspectionEquipmentList.Count();
|
||||
int inspectionPerson = inspectionPersonList.Count();
|
||||
int inspectionMachine = inspectionMachineList.Count();
|
||||
int inspectionEquipmentIsCheckOk = inspectionEquipmentList.Where(x => x.SamplingResult == "1").Count();
|
||||
int inspectionPersonIsCheckOk = inspectionPersonList.Where(x => x.IsOnSite.HasValue && x.IsOnSite == true).Count();
|
||||
int inspectionMachineIsCheckOk = inspectionMachineList.Where(x => x.IsCheckOK.HasValue && x.IsCheckOK == true).Count();
|
||||
|
||||
double inspectionEquipmentRate = inspectionEquipmentIsCheckOk > 0 ? Math.Round((100 * (double)(inspectionEquipmentIsCheckOk / inspectionEquipment)), 2) : 0;
|
||||
double inspectionPersonRate = inspectionPersonIsCheckOk > 0 ? Math.Round((100 * (double)(inspectionPersonIsCheckOk / inspectionPerson)), 2) : 0;
|
||||
double inspectionMachineRate = inspectionMachineIsCheckOk > 0 ? Math.Round((100 * (double)(inspectionMachineIsCheckOk / inspectionMachine)), 2) : 0;
|
||||
|
||||
string cqmsZGRate = "0";
|
||||
if (cqmsData.ProblemNum.HasValue && cqmsData.ProblemCompletedNum.HasValue)
|
||||
{
|
||||
cqmsZGRate = String.Format("{0:N2}", 100 * cqmsData.ProblemCompletedNum.Value / cqmsData.ProblemNum.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
cqmsZGRate = "0";
|
||||
}
|
||||
|
||||
// 构造返回数据
|
||||
var returnData = new
|
||||
{
|
||||
success = true,
|
||||
data = new
|
||||
{
|
||||
educationIdx = 0,
|
||||
checkIdx = 0,
|
||||
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证
|
||||
},
|
||||
warning = new
|
||||
{//预警警报【待汇总】
|
||||
hydropower = 0,//水电监测
|
||||
hydropower2 = 0,//水电监测
|
||||
towercrane = 0,//塔式起重机预警
|
||||
foundationpit = 0,//基坑监测预警
|
||||
car = 0,//车辆冲洗监测
|
||||
},
|
||||
hsseCheck = new
|
||||
{//安全检查
|
||||
generalNum = (hsseData.GeneralClosedNum ?? 0) + (hsseData.GeneralNotClosedNum ?? 0),//安全问题
|
||||
notClosedNum = hsseData.GeneralNotClosedNum ?? 0,//未完成
|
||||
closedNum = hsseData.GeneralClosedNum ?? 0,//整改闭环
|
||||
rectificationRate = Convert.ToDouble(hsseZGRate),//整改率
|
||||
},
|
||||
cqmsCheck = new
|
||||
{//质量检查
|
||||
generalNum = cqmsData.ProblemNum ?? 0,//质量问题
|
||||
notClosedNum = cqmsData.ProblemNotCompletedNum ?? 0,//未完成
|
||||
closedNum = cqmsData.ProblemCompletedNum ?? 0,//整改闭环
|
||||
rectificationRate = Convert.ToDouble(cqmsZGRate),//整改率
|
||||
},
|
||||
riskClassification = new
|
||||
{//风险分级管控
|
||||
highRiskNum = hsseData.HighRiskNum ?? 0,//重大风险
|
||||
mediumRiskNum = hsseData.MediumRiskNum ?? 0,//较大风险
|
||||
generalRiskNum = hsseData.GeneralRiskNum ?? 0,//一般风险
|
||||
lowRiskNum = hsseData.LowRiskNum ?? 0//低风险
|
||||
},
|
||||
costEquipmentMeeting = 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,//施工机具设备-特种设备
|
||||
classMeeting = classMeetingList.Count(),//会议-班前会
|
||||
weekMeeting = weekMeetingList.Count()//会议-周例会
|
||||
},
|
||||
projectInfo = new
|
||||
{//项目数据
|
||||
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,
|
||||
address = p.ProjectAddress,
|
||||
value = p.MapCoordinates.Split(','),
|
||||
}).ToList(),
|
||||
dangerousProject = new
|
||||
{//危大工程管控数据
|
||||
approvalCompleted = hsseData.CompletedNum ?? 0,//审批完成
|
||||
construction = hsseData.ConstructionNum ?? 0,//施工个数
|
||||
training = hsseData.TrainPersonNum ?? 0,//培训人次
|
||||
completed = hsseData.FinishedNum ?? 0,//完工个数
|
||||
reasoning = 0//论证个数【待汇总】
|
||||
},
|
||||
meetAnEmergency = new
|
||||
{//应急管理数据
|
||||
comprehensive = hsseData.CompanyComprehensivePlanNum ?? 0,//综合预案
|
||||
special = hsseData.CompanySpecialPlanNum ?? 0,//专项预案
|
||||
scene = hsseData.CompanyOnSiteDisposalPlan ?? 0,//现场处置
|
||||
drill = hsseData.CompanyDrillNum ?? 0//演练次数
|
||||
},
|
||||
engineeringDivision = new
|
||||
{//工程划分
|
||||
unitNum = cqmsData.UnitProjectNum ?? 0,//单位工程数
|
||||
branchNum = cqmsData.SubProjectNum ?? 0,//分部工程数
|
||||
itemizeNum = cqmsData.SubdivisionalWorksNum ?? 0,//分项工程数
|
||||
},
|
||||
//质量验收数据【待汇总】
|
||||
specialEquipmentSys = 0,//特种设备质保体系【待汇总】
|
||||
designBriefing = designDetailsList.Count(),//图纸会审、设计交底
|
||||
hsseEduTrain = new
|
||||
{//安全教育
|
||||
safeWorkingHour = hsseData.SafeWorkingHour ?? 0,//安全工时数
|
||||
specialTrainNum = hsseData.SpecialTrainNum ?? 0,//专项培训
|
||||
safeTrainNum = hsseData.SafeTrainNum ?? 0,//三级安全教育培训
|
||||
specialOperationTrainNum = hsseData.SpecialOperationTrainNum ?? 0,//特种作业培训
|
||||
safetyTechnicalBriefing = 0//安全技术交底次数【待汇总】
|
||||
},
|
||||
cqmsTrainPersonNum = cqmsData.TrainPersonNum ?? 0,//质量教育-培训人数
|
||||
inspectionRecord = new
|
||||
{//报验记录
|
||||
equipmentNum = inspectionEquipment,//设备报验
|
||||
equipmentRate = inspectionEquipmentRate,//设备报验合格率
|
||||
personNum = inspectionPerson,//人员报验
|
||||
personRate = inspectionPersonRate,//人员报验合格率
|
||||
machineNum = inspectionMachine,//机具报验
|
||||
machineRate = inspectionMachineRate,//机具报验合格率
|
||||
},
|
||||
constructSolution = new
|
||||
{//施工方案
|
||||
total = cqmsConstructSolutionList.Count(),//总数
|
||||
projectApprove = cqmsConstructSolutionList.Where(x => x.State == "1").Count(),//项目审批数(审批状态:已闭合)
|
||||
enterpriseApprove = 0//企业审批数【待汇总】
|
||||
},
|
||||
highRisk = new
|
||||
{//高风险作业许可
|
||||
closeItem = hsseData.LicensesCloseNum ?? 0,//关闭项
|
||||
licenseItem = hsseData.LicensesNum ?? 0//许可项
|
||||
},
|
||||
measuringInstrumentsData = new
|
||||
{//计量器具数据
|
||||
useNum = cqmsData.UseNum ?? 0,//计量器具
|
||||
okNum = cqmsData.OKNum ?? 0,//校准合格
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
return returnData;
|
||||
}
|
||||
else
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.SysType = "GONGCHENG";
|
||||
return new { success = false, msg = ex.Message };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user