数据库变更CNPC_XJYJ
This commit is contained in:
@@ -0,0 +1,392 @@
|
||||
using BLL;
|
||||
using FineUIPro.Web.HSSE.License;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.CodeDom;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web
|
||||
{
|
||||
public partial class mainMenu_Staff : PageBase
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
getHazardRegisterLists = HSSE_Hazard_HazardRegisterService.GetHazardRegisterListByProjectId(this.CurrUser.LoginProjectId);
|
||||
///当前现场总人数
|
||||
getSitePerson();
|
||||
var project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
||||
if (project != null && project.Telephone != null)
|
||||
{
|
||||
this.xmb.InnerHtml = project.Telephone;
|
||||
}
|
||||
|
||||
getDayReportDetails = (from x in Funs.DB.SitePerson_DayReportDetail
|
||||
join y in Funs.DB.SitePerson_DayReport on x.DayReportId equals y.DayReportId
|
||||
where y.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x).ToList();
|
||||
getProjectUnits = (from x in Funs.DB.Project_ProjectUnit
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Model.SitePerson_DayReportDetail> getDayReportDetails;
|
||||
|
||||
private static List<Model.Project_ProjectUnit> getProjectUnits;
|
||||
|
||||
#region 当前现场总人数
|
||||
/// <summary>
|
||||
/// 当前现场总人数
|
||||
/// </summary>
|
||||
private void getSitePerson()
|
||||
{
|
||||
int AllCount = 0;
|
||||
//var getallin = APIPageDataService.getPersonInOutNum(this.ProjectId, DateTime.Now.AddDays(-1));
|
||||
DateTime dateValue = DateTime.Now.AddDays(-1);
|
||||
List<Model.PageDataPersonInOutItem> getallin = new List<Model.PageDataPersonInOutItem>();
|
||||
var getInMaxs = from x in Funs.DB.SitePerson_Person
|
||||
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.IsUsed == true
|
||||
select new Model.PageDataPersonInOutItem
|
||||
{
|
||||
PersonId = x.PersonId,
|
||||
PostType = y.PostType,
|
||||
WorkPostId = x.WorkPostId,
|
||||
};
|
||||
if (getInMaxs.Count() > 0)
|
||||
{
|
||||
getallin = getInMaxs.Distinct().ToList();
|
||||
}
|
||||
//AllCount = getallin.Count();
|
||||
var getEmployInOutRecords = (from x in Funs.DB.T_d_EmployInOutRecord
|
||||
join y in Funs.DB.SitePerson_Person on new { ss1 = x.ProjectId, ss = x.IDCardNo } equals new { ss1 = y.ProjectId, ss = y.IdentityCard }
|
||||
where y.ProjectId == this.CurrUser.LoginProjectId && y.IsUsed == true && x.ProjectId == this.CurrUser.LoginProjectId && x.RecordDate.Value == DateTime.Now.Date
|
||||
select x.IDCardNo).Distinct();
|
||||
|
||||
//if (AllCount > 0)
|
||||
//{
|
||||
// ////总人数
|
||||
// this.divperson.InnerHtml = ((AllCount % 10000) / 1000).ToString();
|
||||
// this.person00.InnerHtml = ((AllCount % 1000) / 100).ToString();
|
||||
// this.person01.InnerHtml = ((AllCount % 100) / 10).ToString();
|
||||
// this.person02.InnerHtml = (AllCount % 10).ToString();
|
||||
//}
|
||||
|
||||
|
||||
AllCount = getEmployInOutRecords.Count();
|
||||
if (AllCount > 0)
|
||||
{
|
||||
////总人数
|
||||
this.divperson.InnerHtml = ((AllCount % 10000) / 1000).ToString();
|
||||
this.person00.InnerHtml = ((AllCount % 1000) / 100).ToString();
|
||||
this.person01.InnerHtml = ((AllCount % 100) / 10).ToString();
|
||||
this.person02.InnerHtml = (AllCount % 10).ToString();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 项目安全人工时
|
||||
/// <summary>
|
||||
/// 项目安全人工时
|
||||
/// </summary>
|
||||
protected string Two
|
||||
{
|
||||
get
|
||||
{
|
||||
Model.CNPCDB db = Funs.DB;
|
||||
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
||||
List<string> listCategories = new List<string>();
|
||||
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
||||
Model.SingleSerie s = new Model.SingleSerie();
|
||||
List<double> listdata = new List<double>();
|
||||
foreach (var item in getProjectUnits)
|
||||
{
|
||||
listCategories.Add(UnitService.GetShortUnitNameByUnitId(item.UnitId));
|
||||
decimal total = getDayReportDetails.Where(x => x.UnitId == item.UnitId).Sum(x => x.PersonWorkTime ?? 0);
|
||||
listdata.Add(Convert.ToDouble(total));
|
||||
}
|
||||
s.data = listdata;
|
||||
series.Add(s);
|
||||
|
||||
businessColumn.categories = listCategories;
|
||||
businessColumn.series = series;
|
||||
return JsonConvert.SerializeObject(businessColumn);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 作业许可数量统计
|
||||
/// <summary>
|
||||
/// 作业许可数量统计
|
||||
/// </summary>
|
||||
protected string Three
|
||||
{
|
||||
get
|
||||
{
|
||||
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
||||
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
||||
List<string> listCategories = new List<string>();
|
||||
businessColumn.title = "作业许可数量统计";
|
||||
Model.SingleSerie s = new Model.SingleSerie();
|
||||
List<double> listdata = new List<double>();
|
||||
|
||||
var qLicenseManager = ( from x in Funs.DB.License_LicenseManager.Where(xx=>xx.ProjectId==CurrUser.LoginProjectId)
|
||||
join y in Funs.DB.Base_LicenseType
|
||||
on x.LicenseTypeId equals y.LicenseTypeId into z
|
||||
from zz in z
|
||||
select new
|
||||
{
|
||||
x.LicenseTypeId,zz.LicenseTypeCode
|
||||
|
||||
}).ToList();
|
||||
int FireWork = Funs.DB.License_FireWork.Where(x=>x.ProjectId==this.CurrUser.LoginProjectId && x.States== Const.State_3).Count();
|
||||
int HeightWork = Funs.DB.License_HeightWork.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.States == Const.State_3).Count();
|
||||
int LimitedSpace = Funs.DB.License_LimitedSpace.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.States == Const.State_3).Count();
|
||||
int RadialWork = Funs.DB.License_RadialWork.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.States == Const.State_3).Count();
|
||||
int OpenCircuit = Funs.DB.License_OpenCircuit.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.States == Const.State_3).Count();
|
||||
int BreakGround = Funs.DB.License_BreakGround.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.States == Const.State_3).Count();
|
||||
int NightWork = Funs.DB.License_NightWork.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.States == Const.State_3).Count();
|
||||
int LiftingWork = Funs.DB.License_LiftingWork.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.States == Const.State_3).Count();
|
||||
|
||||
foreach(var item in qLicenseManager)
|
||||
{
|
||||
switch (item.LicenseTypeCode)
|
||||
{
|
||||
case "01":
|
||||
case "4"://动火
|
||||
FireWork++;
|
||||
break;
|
||||
case "06":
|
||||
case "18":
|
||||
case "2"://高处
|
||||
HeightWork++;
|
||||
break;
|
||||
case "03":
|
||||
case "7"://受限
|
||||
LimitedSpace++;
|
||||
break;
|
||||
case "14":
|
||||
case "04"://射线
|
||||
RadialWork++;
|
||||
break;
|
||||
case "09":
|
||||
case "5"://断路
|
||||
OpenCircuit++;
|
||||
break;
|
||||
case "02":
|
||||
case "8"://动土
|
||||
BreakGround++;
|
||||
break;
|
||||
case ""://夜间
|
||||
NightWork++;
|
||||
break;
|
||||
case "19":
|
||||
case "05":
|
||||
case "3"://吊装
|
||||
LiftingWork++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
listCategories.Add("动火");
|
||||
listdata.Add(FireWork);
|
||||
listCategories.Add("高处");
|
||||
listdata.Add(HeightWork);
|
||||
listCategories.Add("受限");
|
||||
listdata.Add(LimitedSpace);
|
||||
listCategories.Add("射线");
|
||||
listdata.Add(RadialWork);
|
||||
listCategories.Add("断路");
|
||||
listdata.Add(OpenCircuit);
|
||||
listCategories.Add("动土");
|
||||
listdata.Add(BreakGround);
|
||||
listCategories.Add("夜间");
|
||||
listdata.Add(NightWork);
|
||||
listCategories.Add("吊装");
|
||||
listdata.Add(LiftingWork);
|
||||
|
||||
s.data = listdata;
|
||||
series.Add(s);
|
||||
businessColumn.categories = listCategories;
|
||||
businessColumn.series = series;
|
||||
return JsonConvert.SerializeObject(businessColumn);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 安全检查问题统计
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static List<Model.HSSE_Hazard_HazardRegister> getHazardRegisterLists;
|
||||
|
||||
/// <summary>
|
||||
/// 按单位统计
|
||||
/// </summary>
|
||||
protected string Four1
|
||||
{
|
||||
get
|
||||
{
|
||||
Model.CNPCDB db = Funs.DB;
|
||||
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
||||
List<string> listCategories = new List<string>();
|
||||
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
||||
Model.SingleSerie s = new Model.SingleSerie();
|
||||
List<double> listdata = new List<double>();
|
||||
List<double> listdata2 = new List<double>();
|
||||
var hazardRegisters = from x in db.View_Hazard_HazardRegister where x.ProjectId == this.CurrUser.LoginProjectId select x;
|
||||
if (hazardRegisters.Count() > 0)
|
||||
{
|
||||
var units = hazardRegisters.Select(x => x.ResponsibleUnit).Distinct().ToList();
|
||||
foreach (var unit in units)
|
||||
{
|
||||
listCategories.Add(UnitService.GetShortUnitNameByUnitId(unit));
|
||||
int state1 = hazardRegisters.Count(x => x.ResponsibleUnit == unit && x.States == "1");
|
||||
int state2 = hazardRegisters.Count(x => x.ResponsibleUnit == unit);
|
||||
listdata.Add(Convert.ToDouble(state1));
|
||||
listdata2.Add(Convert.ToDouble(state2));
|
||||
}
|
||||
s.data = listdata;
|
||||
s.data2 = listdata2;
|
||||
series.Add(s);
|
||||
}
|
||||
businessColumn.categories = listCategories;
|
||||
businessColumn.series = series;
|
||||
return JsonConvert.SerializeObject(businessColumn);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按类型统计
|
||||
/// </summary>
|
||||
protected string Four2
|
||||
{
|
||||
get
|
||||
{
|
||||
Model.CNPCDB db = Funs.DB;
|
||||
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
||||
List<string> listCategories = new List<string>();
|
||||
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
||||
Model.SingleSerie s = new Model.SingleSerie();
|
||||
List<double> listdata = new List<double>();
|
||||
List<double> listdata2 = new List<double>();
|
||||
var hazardRegisters = from x in db.View_Hazard_HazardRegister where x.ProjectId == this.CurrUser.LoginProjectId select x;
|
||||
if (hazardRegisters.Count() > 0)
|
||||
{
|
||||
var types = hazardRegisters.Select(x => x.RegisterTypesName).Distinct().ToList();
|
||||
foreach (var type in types)
|
||||
{
|
||||
listCategories.Add(type);
|
||||
int state1 = hazardRegisters.Count(x => x.RegisterTypesName == type && x.States == "1");
|
||||
int state2 = hazardRegisters.Count(x => x.RegisterTypesName == type);
|
||||
listdata.Add(Convert.ToDouble(state1));
|
||||
listdata2.Add(Convert.ToDouble(state2));
|
||||
}
|
||||
s.data = listdata;
|
||||
s.data2 = listdata2;
|
||||
series.Add(s);
|
||||
}
|
||||
businessColumn.categories = listCategories;
|
||||
businessColumn.series = series;
|
||||
return JsonConvert.SerializeObject(businessColumn);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 入场安全培训
|
||||
/// <summary>
|
||||
/// 入场安全培训
|
||||
/// </summary>
|
||||
protected string Five
|
||||
{
|
||||
get
|
||||
{
|
||||
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
||||
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
||||
List<string> listCategories = new List<string>();
|
||||
businessColumn.title = "入场培训";
|
||||
Model.SingleSerie s = new Model.SingleSerie();
|
||||
Model.SingleSerie s2 = new Model.SingleSerie();
|
||||
//// 每月培训数量
|
||||
List<double> listdata = new List<double>();
|
||||
List<double> listdata2 = new List<double>();
|
||||
var getTrainRecord = from x in Funs.DB.EduTrain_TrainRecord
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.TrainTypeId == Const.EntryTrainTypeId
|
||||
select x;
|
||||
var getTrainRecordDetail = from x in Funs.DB.EduTrain_TrainRecordDetail
|
||||
join y in getTrainRecord on x.TrainingId equals y.TrainingId
|
||||
select x;
|
||||
DateTime startTime = DateTime.Now;
|
||||
DateTime endTime = DateTime.Now;
|
||||
var getProject = ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
||||
if (getProject != null && getProject.StartDate.HasValue)
|
||||
{
|
||||
startTime = getProject.StartDate.Value;
|
||||
if (getProject.EndDate.HasValue && getProject.EndDate < DateTime.Now)
|
||||
{
|
||||
endTime = getProject.EndDate.Value;
|
||||
}
|
||||
}
|
||||
int totalCout = 0;
|
||||
for (int i = 0; startTime.AddMonths(i) <= endTime; i++)
|
||||
{
|
||||
listCategories.Add(string.Format("{0:yyyy-MM}", startTime.AddMonths(i)));
|
||||
|
||||
var getMontDetail = from x in getTrainRecordDetail
|
||||
join y in getTrainRecord on x.TrainingId equals y.TrainingId
|
||||
where y.TrainStartDate.Value.Year == startTime.AddMonths(i).Year && y.TrainStartDate.Value.Month == startTime.AddMonths(i).Month
|
||||
select x;
|
||||
listdata.Add(getMontDetail.Count());
|
||||
totalCout = totalCout + getMontDetail.Count();
|
||||
listdata2.Add(totalCout);
|
||||
}
|
||||
|
||||
s.data = listdata;
|
||||
s2.data = listdata2;
|
||||
series.Add(s);
|
||||
series.Add(s2);
|
||||
businessColumn.categories = listCategories;
|
||||
businessColumn.series = series;
|
||||
return JsonConvert.SerializeObject(businessColumn);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
# region 事故统计
|
||||
/// <summary>
|
||||
/// 事故统计
|
||||
/// </summary>
|
||||
protected string Six
|
||||
{
|
||||
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>();
|
||||
|
||||
businessColumn.title = "事故统计";
|
||||
var getAccident = from x in Funs.DB.Accident_AccidentReport
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x;
|
||||
|
||||
listdata.Add(getAccident.Where(x => x.AccidentTypeId == "1" || x.AccidentTypeId == "2" || x.AccidentTypeId == "3" || x.AccidentTypeId == "4").Count());
|
||||
listdata.Add(getAccident.Where(x => x.AccidentTypeId == "5").Count());
|
||||
listdata.Add(getAccident.Where(x => x.AccidentTypeId == "6" || x.AccidentTypeId == "7").Count());
|
||||
listdata.Add(getAccident.Where(x => x.AccidentTypeId == "8" || x.AccidentTypeId == "9").Count());
|
||||
listdata.Add(getAccident.Where(x => x.AccidentTypeId == "10").Count());
|
||||
listdata.Add(getAccident.Where(x => x.AccidentTypeId == "11").Count());
|
||||
|
||||
s.data = listdata;
|
||||
series.Add(s);
|
||||
businessColumn.series = series;
|
||||
return JsonConvert.SerializeObject(businessColumn);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user